| @@ -33,7 +33,7 @@ public class AliPayController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private AliPayUtil alipayUtil; | private AliPayUtil alipayUtil; | ||||
| @ApiOperation("分页列表接口") | |||||
| @ApiOperation("获取会员页面") | |||||
| @GetMapping("getMemberPage") | @GetMapping("getMemberPage") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @@ -58,4 +58,30 @@ public class AliPayController extends BaseController { | |||||
| return new ResultData(Result.ERROR,"url返回失败"); | return new ResultData(Result.ERROR,"url返回失败"); | ||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("获取商圈智能积分授权授权页面") | |||||
| @GetMapping("getSmartDistrctPointPage") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData getSmartDistrctPointPage(@ModelAttribute WxActivity wxActivity, Integer pageNum, Integer pageSize) { | |||||
| WxMall wxMall = wxMallService.getByTenantInfo(getTenantInfo()); | |||||
| if (null == wxMall ) { | |||||
| return new ResultData(Result.ERROR,"wxMall不存在"); | |||||
| } | |||||
| if (StringUtils.isBlank(wxMall.getAlipayAppAuthToken())) { | |||||
| return new ResultData(Result.ERROR,"wxMall alipayAppToken不存在"); | |||||
| } | |||||
| if (StringUtils.isBlank(wxMall.getAlipayMemberTemplateId())) { | |||||
| return new ResultData(Result.ERROR,"wxMall alipayMemberTemplateId不存在"); | |||||
| } | |||||
| String url = alipayUtil.getH5SmartDistrictMallVipPointsUrl(wxMall.getTenantId()); | |||||
| try { | |||||
| return new ResultData(URLDecoder.decode(url, "utf-8")); | |||||
| } catch (UnsupportedEncodingException e) { | |||||
| logger.error("getMemberPage error url["+url+"]",e); | |||||
| return new ResultData(Result.ERROR,"url返回失败"); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -135,8 +135,10 @@ public class AliPayController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } | |||||
| }//商圈节分授权 | |||||
| }else if ("mall_vip_points".equals(scope)) { | |||||
| } | |||||
| out.close(); | out.close(); | ||||
| } | } | ||||
| @@ -150,6 +150,14 @@ wechat: | |||||
| max-wait: -1 | max-wait: -1 | ||||
| min-idle: 10 | min-idle: 10 | ||||
| alipay: | |||||
| open: | |||||
| appId:"2021002137663024" | |||||
| appPrivateKey:"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCUfymV5J73QQMG52PVIGUbowkloYCO4B7TQoKbrTZf2YeYsg/To/o4PiXPMNwEUfEUU8NYQ6WwNhCd2fa1ei8WFXJUf3bfgswtBk1aOmHLeY9yoXFxIKMTQ9RcobnmBzKQZlaAPMTSr7t1QtKZKPuc2gEHGRFYKO/ZuL8gIpnsVidVtmi52yd7hzao/pI3ThLA0lreg4L3rYP5ESQZRytxIPgUQ4KI11pZxFgbe+uy28AGDYIQscSIb+SWOHPYKLvOEqqepIZ8M18w/U0lZzpzepzi/V/llekvXJ6UEf1lzl7x/4UIA3WPN1B40+NzbD/OxEGTuM0UctOG6ZTd4Te9AgMBAAECggEAPYksnHbvARspu/SrRCh2fatkIPn6Ijrxyy3mnch7neCw9i/jqxpqmF/4nxFqO0gRlRDZBHyT7p+Y5zDpsW5+kLI2fJmNkzXKkmXoLBnBaOZo8WHBdtXFfjg/iltig9Y7t+cQtXd5QK2eCwuz5dA75FXa0ywqKdRdAGY0nYZ5LpwrHVU8RXheUDCJyhKNj2+W6lIaSKDxLZU3laO1oBrv1agcy7Crd5E2ndb8O3Enga+z7wSz2h7A1BasC/Yl/Ro0Y21wLCH3s/R6qA0Paq12+WEF+xdodM7SrP43CCTVFGbC1TfEOdanJfixop8QuYsIp7pHrL925+vP4eY9RfckgQKBgQDQqLdpDzzU7Ot/L9Vc/r8d4iwXXbX8+HwVFV4oBuausgFyv8eJJpfrI+IlEoB1ubJcPpJBFqfmeYTW6/v6ioFljJAlWfFvesUVt/HszBMIOsU0Bzt7ex6WlwKOagb0q0ZPA4T0OY0K0lg0loaaaR8ZTr4ivDymaGBtTBYhslpc7QKBgQC2MBznGEc5r2dhyENvdPOR20PnXQcevGnPdqSus8m0VmDcHE72RVcckcZtwczsb3NaLSqmjAcWTn51/VFmlvhB3F34FcFTPZGq6sj7fWK8HuFq7l7mu5OzYuVr73zy9ggsUuaw10IqvvwIVxszNAF0hiRnSGH3z27CoRmz3s+8EQKBgQCK3o7atBJ3X4rIJiypbL4DhIB1uJ+jUjk6yvLUTut+fufp1+tTw0S+cS5UIAEw2Lr1G4u5F/v8rwmTBJG6SC4gSLGyui6uVBYRA1BWmedcxchzfRDAeMt9y9kesUAZ3Fe5xIzbAeZ1ulKMBVZmM+pHrJlsgr0Wv0bV1xqvqITtbQKBgBIsIGXopQoa9dvqBtfyOW1eCprkS5aEQqWf9vM6Ga90QjsSU8n6xqKh48IE57TZtQ7UnIF6TCasc66/MsRh4KdpHLJnMR5lcMc0nhF/wz5ychehaTPol+X3wlyOyc7OPah2KG6ROhdbb3ZBggQMduyxiKYIsUTvmuOtAAxR+DSRAoGADtuDzGQDOJYWiO2uuP6FpA5IJaiwlSfu3xncJVfhO8SVr6VBJFg88igbIB3w6nk/sv7j9VTXqXre9HMvp1flxaaLsdxM4HcTSALS9q6t/ajaveqte6S5kAtWx0WW8C6PtgWXHbxcD7LXARSsKLoEl2JXXyUVS/m2l/RzHBQ8GJI=" | |||||
| appPublicKeyCertPath:"/opt/iformall/service/alipay/appCertPublicKey_2021002137663024.crt" | |||||
| alipayCertPath:"/opt/iformall/service/alipay/alipayCertPublicKey_RSA2.crt" | |||||
| alipayRootCertPath:"/opt/iformall/service/alipay/alipayRootCert.crt" | |||||
| callback:"https://callbacktest.malls.iformall.com/api/alipay/notify/callback" | |||||
| jasypt: | jasypt: | ||||
| encryptor: | encryptor: | ||||
| @@ -109,6 +109,15 @@ wechat: | |||||
| max-wait: -1 | max-wait: -1 | ||||
| min-idle: 10 | min-idle: 10 | ||||
| alipay: | |||||
| open: | |||||
| appId:"2021002137663024" | |||||
| appPrivateKey:"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCUfymV5J73QQMG52PVIGUbowkloYCO4B7TQoKbrTZf2YeYsg/To/o4PiXPMNwEUfEUU8NYQ6WwNhCd2fa1ei8WFXJUf3bfgswtBk1aOmHLeY9yoXFxIKMTQ9RcobnmBzKQZlaAPMTSr7t1QtKZKPuc2gEHGRFYKO/ZuL8gIpnsVidVtmi52yd7hzao/pI3ThLA0lreg4L3rYP5ESQZRytxIPgUQ4KI11pZxFgbe+uy28AGDYIQscSIb+SWOHPYKLvOEqqepIZ8M18w/U0lZzpzepzi/V/llekvXJ6UEf1lzl7x/4UIA3WPN1B40+NzbD/OxEGTuM0UctOG6ZTd4Te9AgMBAAECggEAPYksnHbvARspu/SrRCh2fatkIPn6Ijrxyy3mnch7neCw9i/jqxpqmF/4nxFqO0gRlRDZBHyT7p+Y5zDpsW5+kLI2fJmNkzXKkmXoLBnBaOZo8WHBdtXFfjg/iltig9Y7t+cQtXd5QK2eCwuz5dA75FXa0ywqKdRdAGY0nYZ5LpwrHVU8RXheUDCJyhKNj2+W6lIaSKDxLZU3laO1oBrv1agcy7Crd5E2ndb8O3Enga+z7wSz2h7A1BasC/Yl/Ro0Y21wLCH3s/R6qA0Paq12+WEF+xdodM7SrP43CCTVFGbC1TfEOdanJfixop8QuYsIp7pHrL925+vP4eY9RfckgQKBgQDQqLdpDzzU7Ot/L9Vc/r8d4iwXXbX8+HwVFV4oBuausgFyv8eJJpfrI+IlEoB1ubJcPpJBFqfmeYTW6/v6ioFljJAlWfFvesUVt/HszBMIOsU0Bzt7ex6WlwKOagb0q0ZPA4T0OY0K0lg0loaaaR8ZTr4ivDymaGBtTBYhslpc7QKBgQC2MBznGEc5r2dhyENvdPOR20PnXQcevGnPdqSus8m0VmDcHE72RVcckcZtwczsb3NaLSqmjAcWTn51/VFmlvhB3F34FcFTPZGq6sj7fWK8HuFq7l7mu5OzYuVr73zy9ggsUuaw10IqvvwIVxszNAF0hiRnSGH3z27CoRmz3s+8EQKBgQCK3o7atBJ3X4rIJiypbL4DhIB1uJ+jUjk6yvLUTut+fufp1+tTw0S+cS5UIAEw2Lr1G4u5F/v8rwmTBJG6SC4gSLGyui6uVBYRA1BWmedcxchzfRDAeMt9y9kesUAZ3Fe5xIzbAeZ1ulKMBVZmM+pHrJlsgr0Wv0bV1xqvqITtbQKBgBIsIGXopQoa9dvqBtfyOW1eCprkS5aEQqWf9vM6Ga90QjsSU8n6xqKh48IE57TZtQ7UnIF6TCasc66/MsRh4KdpHLJnMR5lcMc0nhF/wz5ychehaTPol+X3wlyOyc7OPah2KG6ROhdbb3ZBggQMduyxiKYIsUTvmuOtAAxR+DSRAoGADtuDzGQDOJYWiO2uuP6FpA5IJaiwlSfu3xncJVfhO8SVr6VBJFg88igbIB3w6nk/sv7j9VTXqXre9HMvp1flxaaLsdxM4HcTSALS9q6t/ajaveqte6S5kAtWx0WW8C6PtgWXHbxcD7LXARSsKLoEl2JXXyUVS/m2l/RzHBQ8GJI=" | |||||
| appPublicKeyCertPath:"/opt/iformall/service/alipay/appCertPublicKey_2021002137663024.crt" | |||||
| alipayCertPath:"/opt/iformall/service/alipay/alipayCertPublicKey_RSA2.crt" | |||||
| alipayRootCertPath:"/opt/iformall/service/alipay/alipayRootCert.crt" | |||||
| callback:"https://callbacktest.malls.iformall.com/api/alipay/notify/callback" | |||||
| fm: | fm: | ||||
| exception: true | exception: true | ||||
| exception_emails: houtaikaifa@iformall.com | exception_emails: houtaikaifa@iformall.com | ||||
| @@ -215,9 +215,9 @@ public class AliPayUtil { | |||||
| } | } | ||||
| //商圈智能积分授权(算法授权)URL | //商圈智能积分授权(算法授权)URL | ||||
| public String getH5SmartDistrictMallVipPointsUrl(String appId,String param) { | |||||
| public String getH5SmartDistrictMallVipPointsUrl(String param) { | |||||
| try { | try { | ||||
| return "https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id="+appId+"&scope=mall_vip_points&redirect_uri="+URLEncoder.encode(getCallBack(),"utf-8")+"&state="+param; | |||||
| return "https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id="+getConfig().appId+"&scope=mall_vip_points&redirect_uri="+URLEncoder.encode(getCallBack(),"utf-8")+"&state="+param; | |||||
| } catch (UnsupportedEncodingException e) { | } catch (UnsupportedEncodingException e) { | ||||
| log.error("alipay getH5MallVipPointsUrl error. ",e); | log.error("alipay getH5MallVipPointsUrl error. ",e); | ||||
| } | } | ||||
| @@ -4,9 +4,12 @@ import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import java.awt.image.BufferedImage; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import javax.imageio.ImageIO; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -15,6 +18,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| @@ -65,6 +69,32 @@ public class AlipayController extends BaseController { | |||||
| } | } | ||||
| try { | try { | ||||
| long size = multiReq.getSize(); | |||||
| final long length = 2097152; | |||||
| if (size > length) { | |||||
| return new ResultData(ErrorCode.PICTURE_SIZE_EXCEED); | |||||
| } | |||||
| long maxSize = 0l; | |||||
| try { | |||||
| maxSize = Long.parseLong(param.get("size")); | |||||
| } catch (NumberFormatException e) {} | |||||
| if(maxSize > 0l && size > maxSize*1024){ | |||||
| return new ResultData(ErrorCode.PICTURE_SIZE_CUSTOMIZE); | |||||
| } | |||||
| BufferedImage bufferedImage = ImageIO.read(multiReq.getInputStream()); | |||||
| if(bufferedImage != null){ | |||||
| int width = 0;int hight = 0; | |||||
| try { | |||||
| width = Integer.parseInt(param.get("width")); | |||||
| hight = Integer.parseInt(param.get("hight")); | |||||
| } catch (NumberFormatException e) {} | |||||
| Integer relWidth = bufferedImage.getWidth(); | |||||
| Integer relHeight = bufferedImage.getHeight(); | |||||
| if((width > 0 && width != relWidth.intValue()) | |||||
| || (hight > 0 && hight != relHeight.intValue())){ | |||||
| return new ResultData(ErrorCode.PICTURE_W_H_CUSTOMIZE); | |||||
| } | |||||
| } | |||||
| String imageId = aliPayUtil.merchantImageUpload(wxMall.getAlipayAppAuthToken(), multiReq.getOriginalFilename(), multiReq.getBytes()); | String imageId = aliPayUtil.merchantImageUpload(wxMall.getAlipayAppAuthToken(), multiReq.getOriginalFilename(), multiReq.getBytes()); | ||||
| if (StringUtils.isBlank(imageId)) { | if (StringUtils.isBlank(imageId)) { | ||||
| return new ResultData(Result.ERROR,"imageId 返回空"); | return new ResultData(Result.ERROR,"imageId 返回空"); | ||||
| @@ -124,4 +154,33 @@ public class AlipayController extends BaseController { | |||||
| return new ResultData(Result.ERROR,"merchantMemberConfig error."); | return new ResultData(Result.ERROR,"merchantMemberConfig error."); | ||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("消息订阅") | |||||
| @PostMapping(value = "/topicSubscribe") | |||||
| @SystemControllerLog(description = "支付账号-新增") | |||||
| public ResultData topicSubscribe(@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()); | |||||
| 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."); | |||||
| } | |||||
| } | |||||
| } | } | ||||