| @@ -66,7 +66,6 @@ public class AlipayController extends BaseController { | |||
| */ | |||
| @PostMapping(value = "/imageUpload", consumes = "multipart/*", headers = "content-type=multipart/form-data") | |||
| @ApiOperation("上传图片") | |||
| @SystemControllerLog(description = "上传图片") | |||
| public ResultData imageUpload(@RequestParam("file") MultipartFile multiReq | |||
| ,@RequestParam Map<String, String> param) { | |||
| String tenantId = param.get("tenantId"); | |||
| @@ -133,7 +132,6 @@ public class AlipayController extends BaseController { | |||
| @ApiOperation("创建商圈会员卡") | |||
| @PostMapping(value = "/merchantMemberConfig") | |||
| @SystemControllerLog(description = "支付账号-新增") | |||
| public ResultData merchantMemberConfig(@RequestBody Map<String, String> param) { | |||
| String tenantId = param.get("tenantId"); | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| @@ -191,10 +189,9 @@ public class AlipayController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation("消息订阅") | |||
| @PostMapping(value = "/topicSubscribe") | |||
| @SystemControllerLog(description = "支付账号-新增") | |||
| public ResultData topicSubscribe(@RequestBody Map<String, String> param) { | |||
| @ApiOperation("商圈交易成功信息订阅") | |||
| @PostMapping(value = "/smartDistrictTradeSuccessTopicSubscribe") | |||
| public ResultData smartDistrictTradeSuccessTopicSubscribe(@RequestBody Map<String, String> param) { | |||
| String tenantId = param.get("tenantId"); | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| return new ResultData(Result.ERROR,"tenantId不能为空"); | |||
| @@ -208,7 +205,35 @@ public class AlipayController extends BaseController { | |||
| } | |||
| try { | |||
| boolean result = aliPayUtil.smartDistrictTopicSubscribe(wxMall.getAlipayAppAuthToken()); | |||
| boolean result = aliPayUtil.smartDistrictTopicSubscribe(wxMall.getAlipayAppAuthToken(),"alipay.business.mall.trade.success"); | |||
| if (result) { | |||
| return new ResultData(); | |||
| }else { | |||
| return new ResultData(Result.ERROR,"消息订阅失败"); | |||
| } | |||
| } catch (Exception e) { | |||
| logger.error("topicSubscribe error.",e); | |||
| return new ResultData(Result.ERROR,"topicSubscribe error."); | |||
| } | |||
| } | |||
| @ApiOperation("商圈交易退款信息订阅") | |||
| @PostMapping(value = "/smartDistrictTradeRefundTopicSubscribe") | |||
| public ResultData smartDistrictTradeRefundTopicSubscribe(@RequestBody Map<String, String> param) { | |||
| String tenantId = param.get("tenantId"); | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| return new ResultData(Result.ERROR,"tenantId不能为空"); | |||
| } | |||
| WxMall wxMall = mallService.getByTenantId(tenantId); | |||
| if (null == wxMall ) { | |||
| return new ResultData(Result.ERROR,"wxMall未查询到"); | |||
| } | |||
| if(StringUtils.isBlank(wxMall.getAlipayAppAuthToken())) { | |||
| return new ResultData(Result.ERROR,"wxMall alipayAppAuthToken为空"); | |||
| } | |||
| try { | |||
| boolean result = aliPayUtil.smartDistrictTopicSubscribe(wxMall.getAlipayAppAuthToken(),"alipay.business.mall.trade.refunded"); | |||
| if (result) { | |||
| return new ResultData(); | |||
| }else { | |||
| @@ -299,9 +299,9 @@ public class AliPayUtil { | |||
| } | |||
| //商圈消息订阅 | |||
| public boolean smartDistrictTopicSubscribe(String appAuthToken) { | |||
| public boolean smartDistrictTopicSubscribe(String appAuthToken,String topic) { | |||
| try { | |||
| AlipayOpenApiGenericResponse response = AliPayApi.topicSubscribe(getConfig(),appAuthToken, "app_auth", "alipay.open.auth.appauth.cancelled", "HTTP", "BIZ_TAG"); | |||
| AlipayOpenApiGenericResponse response = AliPayApi.topicSubscribe(getConfig(),appAuthToken, "app_auth", topic, "HTTP", "BIZ_TAG"); | |||
| JSONObject result = getGenericResponse(response.getHttpBody(),"alipay_open_app_message_topic_subscribe_response"); | |||
| if (null != result) { | |||
| return true; | |||
| @@ -335,17 +335,17 @@ public class AliPayUtil { | |||
| return buffer; | |||
| } | |||
| // public static void main(String[] args) { | |||
| // AliPayUtil util = new AliPayUtil(); | |||
| //// String token = getAppAuthToken("Pfbe94a5103a0414db99ce865204ee63"); | |||
| //// System.out.println(token); | |||
| // //File file = new File("C://logo-img.png"); | |||
| // //System.out.println(util.merchantImageUpload("202104BB054c88e950ba4513854e4275ff71cF63", "aa.jpg", File2byte(file))); | |||
| // //System.out.println(util.createSmartDistrictMemberCardModel("202104BB054c88e950ba4513854e4275ff71cF63", "会员卡", "OKJx3oOPTUOaINs0AQ_qMgAAACMAAQQD", "OKJx3oOPTUOaINs0AQ_qMgAAACMAAQQD")); | |||
| // //System.out.println(util.setSmartDistrictMemberCardModelConfig("202104BB054c88e950ba4513854e4275ff71cF63", "20210417000000002702655000300637")); | |||
| // //System.out.println(util.getSmartDistrictMemberCardUrl("202104BB054c88e950ba4513854e4275ff71cF63", "20210417000000002702655000300637", "https://ctest.malls.iformall.com/C/api/alipay/callback", "123")); | |||
| // //System.out.println(util.getH5SmartDistrictMallVipPointsUrl("2021002139648762", "https://ctest.malls.iformall.com/C/api/alipay/callback", "123")); | |||
| // System.out.println(util.smartDistrictTopicSubscribe("202104BB054c88e950ba4513854e4275ff71cF63")); | |||
| // } | |||
| public static void main(String[] args) { | |||
| AliPayUtil util = new AliPayUtil(); | |||
| // String token = getAppAuthToken("Pfbe94a5103a0414db99ce865204ee63"); | |||
| // System.out.println(token); | |||
| //File file = new File("C://logo-img.png"); | |||
| //System.out.println(util.merchantImageUpload("202104BB054c88e950ba4513854e4275ff71cF63", "aa.jpg", File2byte(file))); | |||
| //System.out.println(util.createSmartDistrictMemberCardModel("202104BB054c88e950ba4513854e4275ff71cF63", "会员卡", "OKJx3oOPTUOaINs0AQ_qMgAAACMAAQQD", "OKJx3oOPTUOaINs0AQ_qMgAAACMAAQQD")); | |||
| //System.out.println(util.setSmartDistrictMemberCardModelConfig("202104BB054c88e950ba4513854e4275ff71cF63", "20210417000000002702655000300637")); | |||
| //System.out.println(util.getSmartDistrictMemberCardUrl("202104BB054c88e950ba4513854e4275ff71cF63", "20210417000000002702655000300637", "https://ctest.malls.iformall.com/C/api/alipay/callback", "123")); | |||
| //System.out.println(util.getH5SmartDistrictMallVipPointsUrl("2021002139648762", "https://ctest.malls.iformall.com/C/api/alipay/callback", "123")); | |||
| System.out.println(util.smartDistrictTopicSubscribe("202104BB054c88e950ba4513854e4275ff71cF63","alipay.business.mall.trade.success")); | |||
| } | |||
| } | |||