diff --git a/mallinkAdmin/src/main/java/com/iformall/UserApplication.java b/mallinkAdmin/src/main/java/com/iformall/UserApplication.java index f72f27524..668c20847 100644 --- a/mallinkAdmin/src/main/java/com/iformall/UserApplication.java +++ b/mallinkAdmin/src/main/java/com/iformall/UserApplication.java @@ -22,13 +22,21 @@ import tk.mybatis.spring.annotation.MapperScan; @EnableRocketMQ public class UserApplication { - @Value("${fm.exception}") - private boolean fmException; + @Value("${fm.exception}") + private boolean fmException; - @Bean - public boolean isFmException() { - return fmException; - } + @Value("${fm.open}") + private boolean fmOpen; + + @Bean + public boolean isFmException() { + return fmException; + } + + @Bean + public boolean isFmOpen() { + return fmOpen; + } public static void main(String[] args) { SpringApplication.run(UserApplication.class, args); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxAppinfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxAppinfoController.java index d935fdbdb..edbeadb87 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxAppinfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxAppinfoController.java @@ -74,20 +74,6 @@ public class WxAppinfoController extends BaseController { return new ResultData(Result.SUCCESS, "查询成功", wxAppinfoService.getById(id)); } - - @ApiOperation("C端更新AccessToken, 无限制二维码生成需要更新token") - @GetMapping("/accessTokenUpdate") - public ResultData ctokenUpdate() { - logger.debug("[" + getIpAddr() + "] WxAppinfoController::ctokenUpdate"); - try { - wxAppinfoService.ctokenUpdate(getTenantId()); - } catch (Exception e) { - logger.error(e.getMessage()); - } - - return new ResultData(); - } - @ApiOperation(value = "下载二维码", notes = "参数{\"pageUrl\":\"String\", \"sceneParam\":\"二维码参数\", \"type\":0:有限二维码,1:无限二维码,\"withText\":int(0:不带字, 1:加一行字,2:加两行字),\"text1\":\"String\",\"text2\":\"String\"}") @PostMapping("/downQrCode") public ResultData downQrCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map params) { diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java index 07dd7f9d1..c34919f03 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxCreditHistoryController.java @@ -87,7 +87,6 @@ public class WxCreditHistoryController extends BaseController logger.debug("[" + getIpAddr() + "] WxCreditHistoryController::findById"); return new ResultData(Result.SUCCESS,"查询成功",wxCreditHistoryService.getById(id)); } - - - + + } diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml index 5bfd19ec2..4011c29c5 100644 --- a/mallinkAdmin/src/main/resources/application-dev.yml +++ b/mallinkAdmin/src/main/resources/application-dev.yml @@ -22,7 +22,7 @@ spring: poolPreparedStatements: true maxOpenPreparedStatements: 20 connectionProperties: "druid.stat.mergeSql=true;druid.stat.slowSqlMillis=6000" - #jackson: + #jackson: #date-format: yyyy-MM-dd HH:mm:ss # REDIS redis: @@ -85,6 +85,25 @@ wechat: appId: "wxe31beafbfd8295ba" secret: "c689fabf3c4c9f5b6424ff2a36a26727" url: "https://mall.youlane.cn" + open: + componentAppId: "wx897e4673286c915d" + componentSecret: "cdfdfda65c45689beb6766c4c427eed2" + componentToken: "formall2018" + componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" + redis: + host: 202.165.179.86 + port: 6379 + password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 500 + max-wait: -1 + min-idle: 10 jasypt: encryptor: @@ -92,6 +111,8 @@ jasypt: fm: exception: false + deploy: 1 + open: false ueditor: config: config.json diff --git a/mallinkAdmin/src/main/resources/application-prod.yml b/mallinkAdmin/src/main/resources/application-prod.yml index 99f82a91a..85b34da23 100644 --- a/mallinkAdmin/src/main/resources/application-prod.yml +++ b/mallinkAdmin/src/main/resources/application-prod.yml @@ -44,13 +44,13 @@ spring: password: ENC(APQMO9XQRzMKd0eap+oSSOYH9MQe/r5K0YFF9A9mizU=) # 授权密码 properties: mail: - smtp: - auth: true - starttls: - enable: true - socketFactory: - port: 465 - class: javax.net.ssl.SSLSocketFactory + smtp: + auth: true + starttls: + enable: true + socketFactory: + port: 465 + class: javax.net.ssl.SSLSocketFactory # RABBITMQ rabbitmq: host: localhost @@ -73,9 +73,30 @@ wechat: appId: "wx9cc4ca09eb20fe03" secret: "af1d7f7a1268022a73cb4ce0b9cf0985" url: "https://admin.malls.iformall.com" + open: + componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) + componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) + componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) + componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 fm: exception: true + deploy: 3 + open: true ueditor: config: config.json diff --git a/mallinkAdmin/src/main/resources/application-test.yml b/mallinkAdmin/src/main/resources/application-test.yml index 8302e5688..2178ea199 100644 --- a/mallinkAdmin/src/main/resources/application-test.yml +++ b/mallinkAdmin/src/main/resources/application-test.yml @@ -73,9 +73,30 @@ wechat: appId: "wx091907dd0bfd3f6b" secret: "2a2ca10738998b9ef92c1fe8a4d366a6" url: "https://admintest.malls.iformall.com" + open: + componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) + componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) + componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) + componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 fm: exception: true + deploy: 2 + open: true ueditor: config: config.json diff --git a/mallinkBApi/src/main/java/com/iformall/BApplication.java b/mallinkBApi/src/main/java/com/iformall/BApplication.java index 0dabd6ccc..8ab96db8a 100644 --- a/mallinkBApi/src/main/java/com/iformall/BApplication.java +++ b/mallinkBApi/src/main/java/com/iformall/BApplication.java @@ -21,11 +21,19 @@ public class BApplication { @Value("${fm.exception}") private boolean fmException; + @Value("${fm.open}") + private boolean fmOpen; + @Bean public boolean isFmException() { return fmException; } + @Bean + public boolean isFmOpen() { + return fmOpen; + } + public static void main(String[] args) { SpringApplication.run(BApplication.class, args); diff --git a/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java b/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java index 75e565418..89249f077 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java @@ -12,6 +12,7 @@ import com.iformall.domain.po.WxMerchantBUser; import com.iformall.exception.MallinkException; import com.iformall.service.WxAppinfoService; import com.iformall.service.WxMerchantBUserService; +import com.iformall.service.wechat.FmOpenService; import com.iformall.utils.Constant; import com.iformall.utils.IPUtil; import com.iformall.utils.MaUtil; @@ -26,12 +27,17 @@ import javax.servlet.http.HttpServletRequest; @RestController public class BaseController { + @Autowired + private boolean isFmOpen; @Autowired private WxMerchantBUserService wxMerchantBUserService; @Autowired private WxAppinfoService wxAppinfoService; + @Autowired + private FmOpenService openService; + @InitBinder public void InitBinder(WebDataBinder dataBinder) { dataBinder.registerCustomEditor(Date.class, new PropertyEditorSupport() { @@ -79,14 +85,21 @@ public class BaseController { } public WxMaService getWeappService(String appId) { - WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); - WxMaService service = MaUtil.getWeappService(appinfo); - return service; + if(isFmOpen) { + return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); + } else { + WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); + WxMaService service = MaUtil.getWeappService(appinfo); + return service; + } } public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { - WxMaService service = MaUtil.getWeappService(appinfo); - return service; + if(!isFmOpen) { + WxMaService service = MaUtil.getWeappService(appinfo); + return service; + } + return null; } public String getIpAddr() { diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java index 967a11f78..b553347b6 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxInfoController.java @@ -41,6 +41,9 @@ import java.util.Map; public class WxInfoController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Autowired + private boolean isFmOpen; + @Autowired WxAppinfoService wxAppinfoService; @@ -115,28 +118,14 @@ public class WxInfoController extends BaseController { private Map getOpenIdInfo(String appId, String code) { WxAppinfo wxAppinfo = getAppInfo(appId); - WxMaService wxMaService = getWeappServiceByAppInfo(wxAppinfo); - - if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { - // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 - try { - String accessToken = wxMaService.getAccessToken(true); - wxAppinfo.setAccessToken(accessToken); - wxAppinfo.setLastTokenTime(new Date()); - wxAppinfo.setExpiresIn(7200); - wxAppinfoService.saveOrUpdate(wxAppinfo); - } catch (WxErrorException e) { - logger.error(e.getMessage()); - } catch (Exception e) { - logger.error(e.getMessage()); - } - - wxMaService = getWeappServiceByAppInfo(wxAppinfo); + WxMaService wxMaService = null; + if(isFmOpen) { + wxMaService = getWeappService(appId); } else { - // 检查token是否已过期, 小时就重新获取 - Date curDate = new Date(); - if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { + wxMaService = getWeappServiceByAppInfo(wxAppinfo); + if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { + // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 try { String accessToken = wxMaService.getAccessToken(true); wxAppinfo.setAccessToken(accessToken); @@ -148,7 +137,26 @@ public class WxInfoController extends BaseController { } catch (Exception e) { logger.error(e.getMessage()); } + wxMaService = getWeappServiceByAppInfo(wxAppinfo); + + } else { + // 检查token是否已过期, 小时就重新获取 + Date curDate = new Date(); + if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { + try { + String accessToken = wxMaService.getAccessToken(true); + wxAppinfo.setAccessToken(accessToken); + wxAppinfo.setLastTokenTime(new Date()); + wxAppinfo.setExpiresIn(7200); + wxAppinfoService.saveOrUpdate(wxAppinfo); + } catch (WxErrorException e) { + logger.error(e.getMessage()); + } catch (Exception e) { + logger.error(e.getMessage()); + } + wxMaService = getWeappServiceByAppInfo(wxAppinfo); + } } } diff --git a/mallinkBApi/src/main/resources/application-dev.yml b/mallinkBApi/src/main/resources/application-dev.yml index d43000b27..57b7e3746 100644 --- a/mallinkBApi/src/main/resources/application-dev.yml +++ b/mallinkBApi/src/main/resources/application-dev.yml @@ -23,7 +23,6 @@ spring: maxOpenPreparedStatements: 20 #jackson: #date-format: yyyy-MM-dd HH:mm:ss - # REDIS redis: host: 202.165.179.86 @@ -63,8 +62,31 @@ jasypt: encryptor: password: oRqdnDbK5pj3eMmB +wechat: + open: + componentAppId: "wx897e4673286c915d" + componentSecret: "cdfdfda65c45689beb6766c4c427eed2" + componentToken: "formall2018" + componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" + redis: + host: 202.165.179.86 + port: 6379 + password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 500 + max-wait: -1 + min-idle: 10 + fm: exception: false + deploy: 1 + open: false logging: level: diff --git a/mallinkBApi/src/main/resources/application-prod.yml b/mallinkBApi/src/main/resources/application-prod.yml index 69cbb6e34..232cbb284 100644 --- a/mallinkBApi/src/main/resources/application-prod.yml +++ b/mallinkBApi/src/main/resources/application-prod.yml @@ -65,8 +65,31 @@ aws: access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) +wechat: + open: + componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) + componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) + componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) + componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 + fm: exception: true + deploy: 3 + open: true logging: level: diff --git a/mallinkBApi/src/main/resources/application-test.yml b/mallinkBApi/src/main/resources/application-test.yml index 4141683a9..51ba81bc2 100644 --- a/mallinkBApi/src/main/resources/application-test.yml +++ b/mallinkBApi/src/main/resources/application-test.yml @@ -65,8 +65,31 @@ aws: access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) +wechat: + open: + componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) + componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) + componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) + componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 + fm: exception: true + deploy: 2 + open: true logging: level: diff --git a/mallinkCApi/src/main/java/com/iformall/CApplication.java b/mallinkCApi/src/main/java/com/iformall/CApplication.java index d2717e841..c3d60da7e 100644 --- a/mallinkCApi/src/main/java/com/iformall/CApplication.java +++ b/mallinkCApi/src/main/java/com/iformall/CApplication.java @@ -21,11 +21,19 @@ public class CApplication { @Value("${fm.exception}") private boolean fmException; + @Value("${fm.open}") + private boolean fmOpen; + @Bean public boolean isFmException() { return fmException; } + @Bean + public boolean isFmOpen() { + return fmOpen; + } + public static void main(String[] args) { SpringApplication.run(CApplication.class, args); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java index c2a168b7f..bb4a0896f 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java @@ -9,6 +9,7 @@ import com.iformall.exception.MallinkException; import com.iformall.service.WxAppinfoService; import com.iformall.service.WxCUserBasicInfoService; import com.iformall.service.WxCUserService; +import com.iformall.service.wechat.FmOpenService; import com.iformall.utils.Constant; import com.iformall.utils.IPUtil; import com.iformall.utils.MaUtil; @@ -29,12 +30,18 @@ import java.util.List; @RestController public class BaseController { + @Autowired + private boolean isFmOpen; + @Autowired private WxCUserService wxCUserService; @Autowired private WxAppinfoService wxAppinfoService; + @Autowired + private FmOpenService openService; + @Autowired private WxCUserBasicInfoService wxCUserBasicInfoService; @@ -88,17 +95,25 @@ public class BaseController { } public WxMaService getWeappService(String appId) { - WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); - if (appinfo == null) { - return null; + if(isFmOpen) { + return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); + } else { + WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); + if (appinfo == null) { + return null; + } + WxMaService service = MaUtil.getWeappService(appinfo); + return service; } - WxMaService service = MaUtil.getWeappService(appinfo); - return service; + } public WxMaService getWeappServiceByAppInfo(WxAppinfo appinfo) { - WxMaService service = MaUtil.getWeappService(appinfo); - return service; + if(!isFmOpen) { + WxMaService service = MaUtil.getWeappService(appinfo); + return service; + } + return null; } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index 484832a74..782ce710c 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -18,6 +18,7 @@ import com.iformall.enums.EnumAssignTagsTrigger; import com.iformall.enums.EnumLevelConfigDiscountStatus; import com.iformall.enums.EnumScoreType; import com.iformall.service.*; +import com.iformall.service.wechat.FmOpenService; import com.iformall.utils.Constant; import com.iformall.utils.IPUtil; import io.swagger.annotations.Api; @@ -47,6 +48,9 @@ import java.util.Map; public class WxUserGrantController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Autowired + private boolean isFmOpen; + @Autowired private WxCUserTokenService userTokenService; @@ -71,6 +75,9 @@ public class WxUserGrantController extends BaseController { @Autowired WxAppinfoService wxAppinfoService; + @Autowired + private FmOpenService openService; + @Autowired WxMerchantService wxMerchantService; @@ -108,19 +115,25 @@ public class WxUserGrantController extends BaseController { if(wxAppinfo == null) { return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } - WxMaService wxMaService = getWeappServiceByAppInfo(wxAppinfo); + WxMaService wxMaService = null; - if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { - // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 - updateAppAccessToken(wxAppinfo, wxMaService); + if(isFmOpen) { + wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); + } else { wxMaService = getWeappServiceByAppInfo(wxAppinfo); - } else { - // 检查token是否已过期, 1小时就重新获取 - Date curDate = new Date(); - if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { + if(StringUtils.isBlank(wxAppinfo.getAccessToken())) { + // 如果没有accessToken,主动获取保存到数据库中,下次访问可以拿来使用 updateAppAccessToken(wxAppinfo, wxMaService); wxMaService = getWeappServiceByAppInfo(wxAppinfo); + + } else { + // 检查token是否已过期, 1小时就重新获取 + Date curDate = new Date(); + if(curDate.getTime() > wxAppinfo.getLastTokenTime().getTime() + Constant.C_EXPIRE) { + updateAppAccessToken(wxAppinfo, wxMaService); + wxMaService = getWeappServiceByAppInfo(wxAppinfo); + } } } diff --git a/mallinkCApi/src/main/resources/application-dev.yml b/mallinkCApi/src/main/resources/application-dev.yml index a412f6cab..e38fa70ce 100644 --- a/mallinkCApi/src/main/resources/application-dev.yml +++ b/mallinkCApi/src/main/resources/application-dev.yml @@ -58,6 +58,26 @@ aws: access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) +wechat: + open: + componentAppId: "wx897e4673286c915d" + componentSecret: "cdfdfda65c45689beb6766c4c427eed2" + componentToken: "formall2018" + componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" + redis: + host: 202.165.179.86 + port: 6379 + password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 500 + max-wait: -1 + min-idle: 10 jasypt: encryptor: @@ -65,6 +85,8 @@ jasypt: fm: exception: false + deploy: 1 + open: true logging: level: diff --git a/mallinkCApi/src/main/resources/application-prod.yml b/mallinkCApi/src/main/resources/application-prod.yml index ccb70a731..8fed514f7 100644 --- a/mallinkCApi/src/main/resources/application-prod.yml +++ b/mallinkCApi/src/main/resources/application-prod.yml @@ -65,10 +65,31 @@ aws: access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) - +wechat: + open: + componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) + componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) + componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) + componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 fm: exception: true + deploy: 3 + open: true logging: level: diff --git a/mallinkCApi/src/main/resources/application-test.yml b/mallinkCApi/src/main/resources/application-test.yml index 9a8511358..c1a7c0ef6 100644 --- a/mallinkCApi/src/main/resources/application-test.yml +++ b/mallinkCApi/src/main/resources/application-test.yml @@ -65,8 +65,31 @@ aws: access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) +wechat: + open: + componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) + componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) + componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) + componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 + fm: exception: true + deploy: 2 + open: true logging: level: diff --git a/mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java b/mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java index a341691ce..c4eb13fb2 100644 --- a/mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java +++ b/mallinkMQConsumer/src/main/java/com/iformall/ConsumerApplication.java @@ -20,13 +20,21 @@ import tk.mybatis.spring.annotation.MapperScan; @EnableEncryptableProperties public class ConsumerApplication { - @Value("${fm.exception}") - private boolean fmException; + @Value("${fm.exception}") + private boolean fmException; - @Bean - public boolean isFmException() { - return fmException; - } + @Value("${fm.open}") + private boolean fmOpen; + + @Bean + public boolean isFmException() { + return fmException; + } + + @Bean + public boolean isFmOpen() { + return fmOpen; + } public static void main(String[] args) { diff --git a/mallinkMQConsumer/src/main/resources/application-dev.yml b/mallinkMQConsumer/src/main/resources/application-dev.yml index 554af1227..ec10f5a5b 100644 --- a/mallinkMQConsumer/src/main/resources/application-dev.yml +++ b/mallinkMQConsumer/src/main/resources/application-dev.yml @@ -77,6 +77,26 @@ aws: access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) +wechat: + open: + componentAppId: "wx897e4673286c915d" + componentSecret: "cdfdfda65c45689beb6766c4c427eed2" + componentToken: "formall2018" + componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" + redis: + host: 202.165.179.86 + port: 6379 + password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 500 + max-wait: -1 + min-idle: 10 jasypt: encryptor: @@ -84,6 +104,8 @@ jasypt: fm: exception: false + deploy: 1 + open: false logging: level: diff --git a/mallinkMQConsumer/src/main/resources/application-prod.yml b/mallinkMQConsumer/src/main/resources/application-prod.yml index 2f0b29d9b..5010adb19 100644 --- a/mallinkMQConsumer/src/main/resources/application-prod.yml +++ b/mallinkMQConsumer/src/main/resources/application-prod.yml @@ -66,10 +66,31 @@ aws: access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) - +wechat: + open: + componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) + componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) + componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) + componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 fm: exception: true + deploy: 3 + open: true logging: level: diff --git a/mallinkMQConsumer/src/main/resources/application-test.yml b/mallinkMQConsumer/src/main/resources/application-test.yml index f3c9256e4..e1c673b7a 100644 --- a/mallinkMQConsumer/src/main/resources/application-test.yml +++ b/mallinkMQConsumer/src/main/resources/application-test.yml @@ -66,8 +66,31 @@ aws: access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) +wechat: + open: + componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) + componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) + componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) + componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 + fm: exception: true + deploy: 2 + open: true logging: level: diff --git a/mallinkSchedule/src/main/java/com/iformall/ScheduleApplication.java b/mallinkSchedule/src/main/java/com/iformall/ScheduleApplication.java index b9396d4e2..9ad8515f7 100644 --- a/mallinkSchedule/src/main/java/com/iformall/ScheduleApplication.java +++ b/mallinkSchedule/src/main/java/com/iformall/ScheduleApplication.java @@ -20,13 +20,21 @@ import tk.mybatis.spring.annotation.MapperScan; @EnableEncryptableProperties public class ScheduleApplication { - @Value("${fm.exception}") - private boolean fmException; + @Value("${fm.exception}") + private boolean fmException; - @Bean - public boolean isFmException() { - return fmException; - } + @Value("${fm.open}") + private boolean fmOpen; + + @Bean + public boolean isFmException() { + return fmException; + } + + @Bean + public boolean isFmOpen() { + return fmOpen; + } public static void main(String[] args) { diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/WeChatAccessTokenSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/WeChatAccessTokenSchedule.java index 1692671e1..c54cf27c8 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/WeChatAccessTokenSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/WeChatAccessTokenSchedule.java @@ -19,6 +19,9 @@ public class WeChatAccessTokenSchedule { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Autowired + private boolean isFmOpen; + @Autowired WxAppinfoMapper wxAppinfoMapper; @@ -27,12 +30,14 @@ public class WeChatAccessTokenSchedule { public void getAccessTokens() { logger.info("微信访问AccessToken获取定时任务启动"); + if(!isFmOpen) { - WxAppinfo appinfoQ = new WxAppinfo(); - List appList = wxAppinfoMapper.findList(appinfoQ); + WxAppinfo appinfoQ = new WxAppinfo(); + List appList = wxAppinfoMapper.findList(appinfoQ); - for (WxAppinfo appinfo : appList) { - resetAccessToken(appinfo); + for (WxAppinfo appinfo : appList) { + resetAccessToken(appinfo); + } } logger.info("微信访问AccessToken获取定时任务结束"); diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/WxAppVisitSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/WxAppVisitSchedule.java index 7c4f1a442..a8bd3762a 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/WxAppVisitSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/WxAppVisitSchedule.java @@ -5,6 +5,7 @@ import java.util.*; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitTrend; +import com.iformall.service.wechat.FmOpenService; import com.iformall.utils.MaUtil; import me.chanjar.weixin.common.error.WxErrorException; import org.apache.commons.lang3.StringUtils; @@ -24,12 +25,18 @@ import com.iformall.service.WxUserVisitService; @Component public class WxAppVisitSchedule { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private boolean isFmOpen; - @Autowired - private WxUserVisitService wxUserVisitService; + @Autowired + private WxUserVisitService wxUserVisitService; - @Autowired - private WxAppinfoService WxAppinfoService; + @Autowired + private WxAppinfoService WxAppinfoService; + + @Autowired + private FmOpenService openService; @Scheduled(cron = "0 0 9 * * ? ") //早晨9点做一次,获取前一日,微信时间为GMT @@ -96,7 +103,12 @@ public class WxAppVisitSchedule { } private void getData(Date lastDate,WxAppinfo appInfo) throws Exception { - WxMaService wxMaService = MaUtil.getWeappService(appInfo); + WxMaService wxMaService = null; + if(isFmOpen) { + wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appInfo.getAppId()); + } else { + wxMaService = MaUtil.getWeappService(appInfo); + } try { List vtList = wxMaService.getAnalysisService().getDailyVisitTrend(lastDate, lastDate); logger.info(vtList.toString()); diff --git a/mallinkSchedule/src/main/resources/application-dev.yml b/mallinkSchedule/src/main/resources/application-dev.yml index fd0290da1..604233da8 100644 --- a/mallinkSchedule/src/main/resources/application-dev.yml +++ b/mallinkSchedule/src/main/resources/application-dev.yml @@ -60,6 +60,26 @@ aws: access: ENC(3gx5ghDFBqGrEhO3Wf8aYmXsnwHO7Cj3HNKJGOeUj0o=) secret: ENC(HVKIJwCJKVXLlUpGlQPwNqJOlnpxn4xYuy91SH0seTSm2uAttIQHvA49fXWWax90v5wloIk0QuU=) +wechat: + open: + componentAppId: "wx897e4673286c915d" + componentSecret: "cdfdfda65c45689beb6766c4c427eed2" + componentToken: "formall2018" + componentAesKey: "htKq8EjBMPNndfZQK9JiFojFaqFwFpw42VfeWFtx7HN" + redis: + host: 202.165.179.86 + port: 6379 + password: ENC(aYJ3Wr2UWtkORRQjjrWWpz2ZeTISsHOA) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 500 + max-wait: -1 + min-idle: 10 jasypt: encryptor: @@ -67,6 +87,8 @@ jasypt: fm: exception: false + deploy: 1 + open: false logging: level: diff --git a/mallinkSchedule/src/main/resources/application-prod.yml b/mallinkSchedule/src/main/resources/application-prod.yml index 65fa94c2b..4bec7fa2c 100644 --- a/mallinkSchedule/src/main/resources/application-prod.yml +++ b/mallinkSchedule/src/main/resources/application-prod.yml @@ -66,10 +66,31 @@ aws: access: ENC(a6SN1sZ1enNL49ypiOXkg/pPPAnZD8H4buQFTTKN08s=) secret: ENC(5P5ff4bTMJUbXVR4ZsM03UHzOKZ4+Zg5Iutcdkyp/Quny/oXg+A4KpfwEyGarlLu3vQMJahGP5M=) - +wechat: + open: + componentAppId: ENC(b3JG0MUZgQfz5Zj+DC2ZM1zDeLOiGTmmeokfe2O8kaM=) + componentSecret: ENC(QVyc4BPGdnSjXGs2ivgpDBE1v8wPWHLLRMYI7Vv8uYwC0SiZHQz0QpyyQV/b48Pb) + componentToken: ENC(rkxj0733WxFFDLgA9x01m2s5Fi2L+0PC) + componentAesKey: ENC(EIbJUBpbYOrLb4YQ/HXLQmxlxgAqIp2ZmpnGICC8pu5xiTz3Cqfkbwd2S8raCcK/IvYcX2GmedI=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(8gYU47Fu93NUJPhwPCiPbAT+6VFA1YDx1egK4Z0Nl6w=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 fm: exception: true + deploy: 3 + open: true logging: level: diff --git a/mallinkSchedule/src/main/resources/application-test.yml b/mallinkSchedule/src/main/resources/application-test.yml index 4965fb3df..4b3f13e67 100644 --- a/mallinkSchedule/src/main/resources/application-test.yml +++ b/mallinkSchedule/src/main/resources/application-test.yml @@ -66,8 +66,31 @@ aws: access: ENC(NCLcmjwKpAWdn/abD17OKIY7yKepVLWzEpqRYUlURCw=) secret: ENC(TRcZqql0Rq5PExlMeH/4WiZ/i02b8FXKmLTBChJmbluTa1uoLS9LrHyNEMrqe1DK+QgOAdvqGBo=) +wechat: + open: + componentAppId: ENC(hnH31XdNzArfMfikKgBFpqQuJUl6rVOPFFcAVyb595o=) + componentSecret: ENC(t/GUVX5L+U7LCwSvZ5WmxAnmTMrc/Uy1nljsrokuzzsBL2j6BEVnrS/n7DCdGc/G) + componentToken: ENC(gUF1m0YgCCI2IY54fX6sGLZVlCswA8tG) + componentAesKey: ENC(TYHcrIkICtfrCfGq4HW6s1b/pHf7OD2uyPN11SzJNB0acqJ/4JVX1nuljo/cAtgMG4O05TImLQc=) + redis: + host: 127.0.0.1 + port: 6379 + password: ENC(QFwqv3NshvvGhFPiP8rwhvbnxk+rFSqhJi8Pw6TogSg=) + timeout: 3600 + expire: 1800 #30分钟 + database: 2 + defaultExpiration: 2592000 # 默认生命周期30天 + jedis: + pool: + max-active: 100 + max-idle: 100 + max-wait: -1 + min-idle: 10 + fm: exception: true + deploy: 2 + open: true logging: level: diff --git a/mallinkService/src/main/java/com/iformall/common/MipHttpClientBuilder.java b/mallinkService/src/main/java/com/iformall/common/FmHttpClientBuilder.java similarity index 97% rename from mallinkService/src/main/java/com/iformall/common/MipHttpClientBuilder.java rename to mallinkService/src/main/java/com/iformall/common/FmHttpClientBuilder.java index e8083e6cc..1ed1a3fc4 100644 --- a/mallinkService/src/main/java/com/iformall/common/MipHttpClientBuilder.java +++ b/mallinkService/src/main/java/com/iformall/common/FmHttpClientBuilder.java @@ -37,8 +37,8 @@ import java.util.concurrent.atomic.AtomicBoolean; * * @author Andy.Huo */ -public class MipHttpClientBuilder implements ApacheHttpClientBuilder { - protected final Logger log = LoggerFactory.getLogger(MipHttpClientBuilder.class); +public class FmHttpClientBuilder implements ApacheHttpClientBuilder { + protected final Logger log = LoggerFactory.getLogger(FmHttpClientBuilder.class); private final AtomicBoolean prepared = new AtomicBoolean(false); private int connectionRequestTimeout = 3000; private int connectionTimeout = 5000; @@ -85,11 +85,11 @@ public class MipHttpClientBuilder implements ApacheHttpClientBuilder { private IdleConnectionMonitorThread idleConnectionMonitorThread; private HttpClientBuilder httpClientBuilder; - private MipHttpClientBuilder() { + private FmHttpClientBuilder() { } - public static MipHttpClientBuilder get() { - return new MipHttpClientBuilder(); + public static FmHttpClientBuilder get() { + return new FmHttpClientBuilder(); } @Override diff --git a/mallinkService/src/main/java/com/iformall/config/WechatOpenProperties.java b/mallinkService/src/main/java/com/iformall/config/WechatOpenProperties.java new file mode 100644 index 000000000..e19dfc4eb --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/config/WechatOpenProperties.java @@ -0,0 +1,69 @@ +package com.iformall.config; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Stormeye + */ +@ConfigurationProperties(prefix = "wechat.open") +public class WechatOpenProperties { + /** + * 设置微信三方平台的appid + */ + private String componentAppId; + + /** + * 设置微信三方平台的app secret + */ + private String componentSecret; + + /** + * 设置微信三方平台的token + */ + private String componentToken; + + /** + * 设置微信三方平台的EncodingAESKey + */ + private String componentAesKey; + + public String getComponentAppId() { + return componentAppId; + } + + public void setComponentAppId(String componentAppId) { + this.componentAppId = componentAppId; + } + + public String getComponentSecret() { + return componentSecret; + } + + public void setComponentSecret(String componentSecret) { + this.componentSecret = componentSecret; + } + + public String getComponentToken() { + return componentToken; + } + + public void setComponentToken(String componentToken) { + this.componentToken = componentToken; + } + + public String getComponentAesKey() { + return componentAesKey; + } + + public void setComponentAesKey(String componentAesKey) { + this.componentAesKey = componentAesKey; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, + ToStringStyle.MULTI_LINE_STYLE); + } +} diff --git a/mallinkService/src/main/java/com/iformall/config/WechatRedisProperies.java b/mallinkService/src/main/java/com/iformall/config/WechatRedisProperies.java new file mode 100644 index 000000000..1a84a3482 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/config/WechatRedisProperies.java @@ -0,0 +1,124 @@ +package com.iformall.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import redis.clients.jedis.JedisPoolConfig; +import redis.clients.jedis.Protocol; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLParameters; +import javax.net.ssl.SSLSocketFactory; + +/** + * Stormeye + */ +@ConfigurationProperties(prefix = "wechat.redis") +public class WechatRedisProperies extends JedisPoolConfig { + private String host = Protocol.DEFAULT_HOST; + private int port = Protocol.DEFAULT_PORT; + private String password; + private int database = 1; + private int connectionTimeout = Protocol.DEFAULT_TIMEOUT; + private int soTimeout = Protocol.DEFAULT_TIMEOUT; + private String clientName; + private boolean ssl; + private SSLSocketFactory sslSocketFactory; + private SSLParameters sslParameters; + private HostnameVerifier hostnameVerifier; + + public boolean isSsl() { + return ssl; + } + + public void setSsl(boolean ssl) { + this.ssl = ssl; + } + + public SSLSocketFactory getSslSocketFactory() { + return sslSocketFactory; + } + + public void setSslSocketFactory(SSLSocketFactory sslSocketFactory) { + this.sslSocketFactory = sslSocketFactory; + } + + public SSLParameters getSslParameters() { + return sslParameters; + } + + public void setSslParameters(SSLParameters sslParameters) { + this.sslParameters = sslParameters; + } + + public HostnameVerifier getHostnameVerifier() { + return hostnameVerifier; + } + + public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { + this.hostnameVerifier = hostnameVerifier; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + if (host == null || "".equals(host)) { + host = Protocol.DEFAULT_HOST; + } + this.host = host; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + if ("".equals(password)) { + password = null; + } + this.password = password; + } + + public int getDatabase() { + return database; + } + + public void setDatabase(int database) { + this.database = database; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + if ("".equals(clientName)) { + clientName = null; + } + this.clientName = clientName; + } + + public int getConnectionTimeout() { + return connectionTimeout; + } + + public void setConnectionTimeout(int connectionTimeout) { + this.connectionTimeout = connectionTimeout; + } + + public int getSoTimeout() { + return soTimeout; + } + + public void setSoTimeout(int soTimeout) { + this.soTimeout = soTimeout; + } +} diff --git a/mallinkService/src/main/java/com/iformall/domain/dto/WxCouponMerchantDto.java b/mallinkService/src/main/java/com/iformall/domain/dto/WxCouponMerchantDto.java new file mode 100644 index 000000000..ef736ae5f --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/dto/WxCouponMerchantDto.java @@ -0,0 +1,36 @@ +package com.iformall.domain.dto; + +import java.io.Serializable; + + + +public class WxCouponMerchantDto implements Serializable { + private static final long serialVersionUID = 1L; + Long merchantId; + String parameter; + Integer business; + + public Long getMerchantId() { + return merchantId; + } + + public void setMerchantId(Long merchantId) { + this.merchantId = merchantId; + } + + public String getParameter() { + return parameter; + } + + public void setParameter(String parameter) { + this.parameter = parameter; + } + + public Integer getBusiness() { + return business; + } + + public void setBusiness(Integer business) { + this.business = business; + } +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index bcab26929..a478393a7 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -71,7 +71,7 @@ public class WxCoupon implements Serializable { @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") private String tenantId; /**券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,100.消费卡)**/ - @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,10.积分券,11积分停车券,100.消费卡)",name="type") + @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51积分停车券,100.消费卡)",name="type") private Integer type; /**封面图**/ @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java index 09ac9f2cf..06023f246 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCreditHistory.java @@ -51,7 +51,7 @@ public class WxCreditHistory implements Serializable { @io.swagger.annotations.ApiModelProperty(value="每笔积分明细",name="creditNum") private Integer creditNum; /**积分类型*/ - @io.swagger.annotations.ApiModelProperty(value="积分类型",name="creditType") + @io.swagger.annotations.ApiModelProperty(value="积分类型 1每日登录,2消费,3绑车牌,4连接WIFI,5微信用户昵称授权,6微信用户手机授权,7完善个人信息,8积分导入,10消费积分,11积分兑换",name="creditType") private Integer creditType; /**创建日期*/ @io.swagger.annotations.ApiModelProperty(value="创建日期",name="createDate") @@ -77,6 +77,9 @@ public class WxCreditHistory implements Serializable { /**花费*/ @io.swagger.annotations.ApiModelProperty(value="花费",name="spend") private Integer spend; + /**兑换用途*/ + @io.swagger.annotations.ApiModelProperty(value="兑换用途",name="changePurpose") + private String changePurpose; diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxAuthorizerInfoMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxAuthorizerInfoMapper.java index ddd61732d..51df5195e 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxAuthorizerInfoMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxAuthorizerInfoMapper.java @@ -9,9 +9,19 @@ public interface WxAuthorizerInfoMapper extends CommonMapper findList(WxAuthorizerInfo wxAuthorizerInfo); + List findWeappList(); + + List findWxMpList(); + List findVoList(WxWeappInfo wxWeappInfo); - void updateReleaseInfo(WxAuthorizerInfo wxAuthorizerInfo); + WxWeappInfo findVo(WxWeappInfo wxWeappInfo); + + int updateReleaseInfo(WxAuthorizerInfo wxAuthorizerInfo); + + int updateRefreshToken(WxAuthorizerInfo wxAuthorizerInfo); + + int updateAccessToken(WxAuthorizerInfo wxAuthorizerInfo); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxComponentVerifyTicketMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxComponentVerifyTicketMapper.java index 72d6514de..db9f2055f 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxComponentVerifyTicketMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxComponentVerifyTicketMapper.java @@ -7,10 +7,8 @@ import com.iformall.domain.po.WxComponentVerifyTicket; public interface WxComponentVerifyTicketMapper extends CommonMapper { List findList(WxComponentVerifyTicket wxComponentVerifyTicket); - - - - + int updateAccessToken(WxComponentVerifyTicket wxComponentVerifyTicket); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java b/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java index de26477ef..1ee68a763 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java @@ -63,13 +63,6 @@ public interface WxAppinfoService { */ void deleteById(Long id); - - /** - * 更新accessToken - * @param appId - */ - void ctokenUpdate(String appId); - /** * 位置码/导购码生成 */ diff --git a/mallinkService/src/main/java/com/iformall/service/impl/SendSmartAppMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/SendSmartAppMsgServiceImpl.java index 6c22ef120..4c5a02b41 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/SendSmartAppMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/SendSmartAppMsgServiceImpl.java @@ -8,6 +8,7 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.WxTemplateMsgMapper; import com.iformall.service.MsgSendService; import com.iformall.service.WxAppinfoService; +import com.iformall.service.wechat.FmOpenService; import com.iformall.utils.MaUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,18 +25,28 @@ import java.util.List; public class SendSmartAppMsgServiceImpl implements MsgSendService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired + private boolean isFmOpen; + @Autowired private WxTemplateMsgMapper wxTemplateMsgMapper; @Autowired private WxAppinfoService wxAppinfoService; + @Autowired + private FmOpenService openService; + @Override public void send(BaseMsg baseMsg) throws Exception{ SmartAppMsg smartAppMsg = (SmartAppMsg)baseMsg; WxTemplateMsg msg = null; WxMaTemplateMessage templateMessage; - WxAppinfo appInfo = wxAppinfoService.getByAppId(smartAppMsg.getAppId()); - WxMaService wxMaService = MaUtil.getWeappService(appInfo); + WxMaService wxMaService = null; + if(isFmOpen) { + wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(smartAppMsg.getAppId()); + } else { + WxAppinfo appInfo = wxAppinfoService.getByAppId(smartAppMsg.getAppId()); + wxMaService = MaUtil.getWeappService(appInfo); + } //查询信息模板 WxTemplateMsg msgQ = new WxTemplateMsg(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java index ea0e7b226..cd231cafb 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java @@ -87,43 +87,6 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { wxAppinfoMapper.deleteByPrimaryKey(id); } - - /** - * 租户c端小程序更新token - * @param tenantId - */ - @Override - public void ctokenUpdate(String tenantId) { - WxAppinfo appQ = new WxAppinfo(); - appQ.setTenantId(tenantId); - appQ.setType(EnumAppType.C.getCode()); - List appList = wxAppinfoMapper.findList(appQ); - if (appList.size() <= 0) { - return; - } - WxAppinfo appinfo = appList.get(0); - if(appinfo == null) { - return; - } - // get access_token - WxMaService wxMaService = MaUtil.getWeappService(appinfo); - if(wxMaService == null) { - return; - } - - String access_token = ""; - try{ - access_token = wxMaService.getAccessToken(); - } catch (Exception e) { - logger.error(e.getMessage()); - } - Date date = new Date(); - // update db - appinfo.setAccessToken(access_token); - appinfo.setLastTokenTime(date); - wxAppinfoMapper.updateByPrimaryKeySelective(appinfo); - } - private void downFile(String filePath, String filename, HttpServletResponse response, HttpServletRequest req) throws IOException { try { response.reset(); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index 64b09e76b..bfe638825 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; import cn.binarywang.wx.miniapp.bean.WxMaTemplateMessage; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.google.common.collect.Lists; @@ -445,13 +446,25 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { WxAppinfo wxAppinfo = wxAppinfoService.getCAppInfo(couponOrder.getTenantId()); WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(wxAppinfo.getPayId()); + Integer subsidyNum; + String parameter = couponMerchant.getParameter(); + JSONObject jParameter; + try { + jParameter = JSONObject.parseObject(parameter); + } catch (Exception e) { + jParameter = null; + } - // 本张券的补贴额 - Integer subsidyFee = coupon.getSubsidyNum(); - if (subsidyFee > 0) { + if (jParameter != null) { + subsidyNum = jParameter.getIntValue("subsidyNum"); + } else { + // 本张券的补贴额 + subsidyNum = coupon.getSubsidyNum(); + } + if (subsidyNum > 0) { // 有补贴时入库 - Double dSubChargeFee = Math.ceil(subsidyFee * 1.0D * payAccount.getRate() / 10000); - Integer realSubsidyFee = subsidyFee - dSubChargeFee.intValue(); + Double dSubChargeFee = Math.ceil(subsidyNum * 1.0D * payAccount.getRate() / 10000); + Integer realSubsidyFee = subsidyNum - dSubChargeFee.intValue(); Double priceChargeFee = Math.ceil(coupon.getSalePrice() * 1.0D * payAccount.getRate() / 10000); Integer realPayment = coupon.getSalePrice() - priceChargeFee.intValue(); @@ -463,11 +476,11 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { merchantSubsidy.setOrderType(EnumOrderType.COUPON.getCode()); merchantSubsidy.setMerchantId(merchantId); merchantSubsidy.setCouponOrderId(couponOrder.getId()); - merchantSubsidy.setCouponType(EnumCouponType.COUPON_MULTIMCH.getCode()); + merchantSubsidy.setCouponType(couponOrder.getCouponType()); merchantSubsidy.setOrderPayment(coupon.getPrice()); merchantSubsidy.setReceiverPayment(coupon.getSalePrice()); merchantSubsidy.setRealPayment(realPayment); - merchantSubsidy.setSubsidy(subsidyFee); + merchantSubsidy.setSubsidy(subsidyNum); merchantSubsidy.setRealSubsidy(realSubsidyFee); merchantSubsidy.setStatus(EnumMerchantSubsidyStatus.NOT_SUBSIDY.getCode()); merchantSubsidy.setCreateDate(new Date()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 4911762b5..5b36ad415 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo; import com.iformall.common.ErrorCode; import com.iformall.common.IdWorker; import com.iformall.common.ResultData; +import com.iformall.domain.dto.WxCouponMerchantDto; import com.iformall.domain.po.WxCoupon; import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxCouponMerchant; @@ -14,6 +15,7 @@ import com.iformall.domain.vo.WxCouponCVo; import com.iformall.domain.vo.WxCouponStatisVo; import com.iformall.domain.vo.WxMerchantVo; import com.iformall.enums.*; +import com.iformall.exception.MallinkException; import com.iformall.mapper.WxCouponChannelMapper; import com.iformall.mapper.WxCouponMapper; import com.iformall.mapper.WxCouponMerchantMapper; @@ -157,6 +159,22 @@ public class WxCouponServiceImpl implements WxCouponService { return Integer.valueOf(merchantParam.getString("businessId")); } + private WxCouponMerchantDto parseMerchantParam(JSONObject merchantParam){ + WxCouponMerchantDto wxCouponMerchantDto = new WxCouponMerchantDto(); + try { + wxCouponMerchantDto.setMerchantId(parseMerchantId(merchantParam)); + wxCouponMerchantDto.setParameter(parseParameter(merchantParam)); + wxCouponMerchantDto.setBusiness(parseBusiness(merchantParam)); + }catch (Exception e) { + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); + } + if (wxCouponMerchantDto.getBusiness()==null || wxCouponMerchantDto.getMerchantId()==null) { + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR); + } + return wxCouponMerchantDto; + } + + @Override @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) public ResultData saveOrUpdate(WxCoupon record) { @@ -190,47 +208,44 @@ public class WxCouponServiceImpl implements WxCouponService { if (record.getId() == null) { // check 卡券补贴设置 - if(record.getType().equals(EnumCouponType.COUPON_MULTIMCH.getCode()) || - record.getType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { - Integer subsidyType = record.getSubsidyType(); - Integer subsidyNum = record.getSubsidyNum(); - if(subsidyType == null) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写补贴类型"); - } - if(subsidyNum == null) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写补贴金额"); - } - if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_COUPON.getCode())) { + Integer subsidyType = record.getSubsidyType(); + Integer subsidyNum = record.getSubsidyNum(); + if(subsidyType != null && subsidyNum != null) { + if (subsidyType.equals(EnumCouponSubsidyType.WECHAT_COUPON.getCode())) { // 微信 立减 - if(subsidyNum > record.getSalePrice()) { + if (subsidyNum > record.getSalePrice()) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); } - } else if(subsidyType.equals(EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode())) { + } else if (subsidyType.equals(EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode())) { // 线下补贴 int subsidy_num = record.getPrice() - record.getSalePrice(); - if(subsidyNum > subsidy_num) { + if (subsidyNum > subsidy_num) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); } - } else if(subsidyType.equals(EnumCouponSubsidyType.WECHAT_MCHPAY.getCode())) { + } else if (subsidyType.equals(EnumCouponSubsidyType.WECHAT_MCHPAY.getCode())) { // TODO 微信转账到银行卡 } + } else if ((subsidyType == null && subsidyNum != null) + || (subsidyType != null && subsidyNum == null)){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); } record.setId(idWorker.nextId()); - if (record.getMerchantParams() != null) { - List merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); + List merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); + if (merchantParamList != null) { List businessList= new ArrayList<>(); merchantParamList.forEach(merchantParam -> { WxCouponMerchant cm = new WxCouponMerchant(); + WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam); cm.setId(idWorker.nextId()); - cm.setMerchantId(parseMerchantId(merchantParam)); - cm.setParameter(parseParameter(merchantParam)); + cm.setMerchantId(wxCouponMerchantDto.getMerchantId()); + cm.setParameter(wxCouponMerchantDto.getParameter()); cm.setProductId(record.getId()); cm.setCreateDate(new Date()); cm.setUpdateDate(new Date()); cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); - businessList.add(parseBusiness(merchantParam)); + businessList.add(wxCouponMerchantDto.getBusiness()); wxCouponMerchantMapper.insertSelective(cm); }); if (businessList.stream().distinct().count() > 1) { @@ -257,27 +272,27 @@ public class WxCouponServiceImpl implements WxCouponService { List businessList= new ArrayList<>(); merchantParamList.stream().forEach(merchantParam -> { WxCouponMerchant cm = new WxCouponMerchant(); - cm.setMerchantId(parseMerchantId(merchantParam)); + WxCouponMerchantDto wxCouponMerchantDto = parseMerchantParam(merchantParam); + cm.setMerchantId(wxCouponMerchantDto.getMerchantId()); cm.setProductId(record.getId()); WxCouponMerchant rcm = wxCouponMerchantMapper.selectOne(cm); if (rcm != null) { - rcm.setMerchantId(Long.valueOf(parseMerchantId(merchantParam))); - rcm.setParameter(parseParameter(merchantParam)); + rcm.setParameter(wxCouponMerchantDto.getParameter()); rcm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); rcm.setUpdateDate(new Date()); wxCouponMerchantMapper.updateByPrimaryKeySelective(rcm); }else { cm.setId(idWorker.nextId()); cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); - cm.setParameter(parseParameter(merchantParam)); + cm.setParameter(wxCouponMerchantDto.getParameter()); cm.setCreateDate(new Date()); cm.setUpdateDate(new Date()); wxCouponMerchantMapper.insertSelective(cm); } - businessList.add(Integer.valueOf(parseBusiness(merchantParam))); + businessList.add(Integer.valueOf(wxCouponMerchantDto.getBusiness())); oldList.removeIf( old->old.getProductId().equals(record.getId()) && - old.getMerchantId().equals(Long.valueOf(parseMerchantId(merchantParam)))); + old.getMerchantId().equals(wxCouponMerchantDto.getMerchantId())); }); oldList.stream().forEach(old->{ diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java index 3146d7211..e76c60b2e 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java @@ -24,6 +24,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.iformall.common.IdWorker; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; @Service @Slf4j @@ -129,6 +131,7 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { } @Override + @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) public ResultData saveOrUpdate(WxCreditHistory record) { WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId()); WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId()); @@ -137,7 +140,14 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { return new ResultData(ErrorCode.USER_IS_EMPTY); } //获取当前用户总积分 - int currentCreditAmount = wxCreditHistoryMapper.creditAmount(record.getCUserId()); + //int currentCreditAmount = wxCreditHistoryMapper.creditAmount(record.getCUserId()); + int currentCreditAmount = 0; + //获取当前用户总积分规则:优先获取wxCUserBasicInfo中数据 若不存在 再获取wxCUser表中数据 + if (wxCUserBasicInfo != null && wxCUserBasicInfo.getCredit() > 0) { + currentCreditAmount = wxCUserBasicInfo.getCredit(); + } else if (wxCUser != null && wxCUser.getCredit() > 0) { + currentCreditAmount = wxCUser.getCredit(); + } //计算出需要新增或减少的积分 int creditChangeNum = creditIncrement(record); @@ -155,7 +165,14 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { record.setId(idWorker.nextId()); wxCreditHistoryMapper.insertSelective(record); //将计算出来新的总积分 更新到两张用户表里 - updateCredit(wxCUser,wxCUserBasicInfo,record.getCreditAmount()); + if (wxCUser != null) { + wxCUser.setCredit(record.getCreditAmount()); + wxCUserMapper.updateByPrimaryKeySelective(wxCUser); + } + if (wxCUserBasicInfo != null) { + wxCUserBasicInfo.setCredit(record.getCreditAmount()); + wxCUserBasicInfoMapper.updateByPrimaryKeySelective(wxCUserBasicInfo); + } } else { //wxCreditHistoryMapper.updateByPrimaryKeySelective(record); } @@ -327,20 +344,4 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { return addCreditNumber; } - /** - * 更新两个表中的最新总积分 - * @param creditAmount 用户最新总积分 - */ - private void updateCredit(WxCUser wxCUser, WxCUserBasicInfo wxCUserBasicInfo, int creditAmount) { - if (wxCUser != null) { - wxCUser.setCredit(creditAmount); - wxCUserMapper.updateByPrimaryKeySelective(wxCUser); - } - if (wxCUserBasicInfo != null) { - wxCUserBasicInfo.setCredit(creditAmount); - wxCUserBasicInfoMapper.updateByPrimaryKeySelective(wxCUserBasicInfo); - } - } - - } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 1b714e908..5ff020ac0 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -269,7 +269,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { long merchantId = idWorker.nextId(); //保存商户商铺的关联 List shopidlist = wxMerchant.getShopids(); - if (!shopidlist.isEmpty()) { + if (shopidlist.isEmpty()) { return new ResultData(ErrorCode.SHOP_NOT_SELECTED); } //先检查是否存在已出租的商铺 @@ -296,6 +296,8 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxMerchantShop.setId(idWorker.nextId()); wxMerchantShop.setMerchantId(merchantId); wxMerchantShop.setTenantId(wxMerchant.getTenantId()); + wxMerchantShop.setShopId(shopid); + wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); Date shopdate = new Date(); wxMerchantShop.setUpdateDate(shopdate); wxMerchantShop.setCreateDate(shopdate); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 7f645d97a..7282b8534 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -198,9 +198,18 @@ public class WxRentContractServiceImpl implements WxRentContractService { BigDecimal payRatio = new BigDecimal(record.getPayRatio() == null ? 0 : record.getPayRatio()).divide(new BigDecimal(10000)); BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); record.setPrice(price.multiply(hundred).intValue()); + } else { + if (StringUtils.isNotEmpty(record.getPriceStr())) { + record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue()); + } else { + record.setPrice(0); + } + } + if (StringUtils.isNotEmpty(record.getDepositStr())) { + record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).intValue()); + } else { + record.setDeposit(0); } - record.setPrice(record.getPrice() == null ? 0 : record.getPrice()); - record.setDeposit(record.getDeposit() == null ? 0 : record.getDeposit()); Date date = new Date(); record.setCreatetime(date); @@ -397,9 +406,19 @@ public class WxRentContractServiceImpl implements WxRentContractService { BigDecimal payRatio = new BigDecimal(record.getPayRatio() == null ? 0 : record.getPayRatio()).divide(new BigDecimal(10000)); BigDecimal price = revenue.multiply(payRatio).setScale(2, RoundingMode.HALF_EVEN); record.setPrice(price.multiply(hundred).intValue()); + } else { + if (StringUtils.isNotEmpty(record.getPriceStr())) { + record.setPrice(new BigDecimal(record.getPriceStr()).multiply(new BigDecimal(100)).intValue()); + } else { + record.setPrice(0); + } + } + + if (StringUtils.isNotEmpty(record.getDepositStr())) { + record.setDeposit(new BigDecimal(record.getDepositStr()).multiply(new BigDecimal(100)).intValue()); + } else { + record.setDeposit(0); } - record.setPrice(record.getPrice() == null ? 0 : record.getPrice()); - record.setDeposit(record.getDeposit() == null ? 0 : record.getDeposit()); record.setUpdatetime(new Date()); @@ -564,7 +583,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { int[] priceArr = new int[arraySize]; for (int i = 0; i < arraySize; i++) { JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - priceArr[i] = new BigDecimal(rentInfoObject.getIntValue("price")).multiply(new BigDecimal(100)).intValue(); + priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).intValue(); } priceList.add(priceArr); //大于一年 @@ -577,7 +596,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { for (int j = 0; j < arraySize; j++) { rentInfoObject = rentInfoArray.getJSONObject(j); adjustRatio = rentInfoObject.getJSONArray("adjustRatio"); - BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getIntValue(i)).divide(new BigDecimal(100))); + BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply); priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).intValue(); } @@ -612,7 +631,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { int[] ints = priceList.get(i); for (int j = 0; j < ints.length; j++) { JSONObject rentInfoObject = rentInfoArray.getJSONObject(j); - shopInfo.put(rentInfoObject.getString("shopNumber"), ints[j]); + String s = new BigDecimal(ints[j]).divide(new BigDecimal(100)).toPlainString(); + shopInfo.put(rentInfoObject.getString("shopNumber"), s); } shopInfos.add(shopInfo); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java index dda1a7aa3..c70dd7076 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java @@ -13,13 +13,13 @@ import com.iformall.domain.po.WxCouponChannel; import com.iformall.domain.po.WxScreenAd; import com.iformall.domain.vo.WxCouponCVo; import com.iformall.enums.EnumCouponChannelType; -import com.iformall.enums.EnumCouponType; import com.iformall.enums.EnumScreenAdType; import com.iformall.mapper.WxCampaignMapper; import com.iformall.mapper.WxCouponChannelMapper; import com.iformall.mapper.WxScreenAdMapper; import com.iformall.service.WxAppinfoService; import com.iformall.service.WxScreenAdService; +import com.iformall.service.wechat.FmOpenService; import com.iformall.utils.MaUtil; import me.chanjar.weixin.common.error.WxErrorException; import org.slf4j.Logger; @@ -33,6 +33,9 @@ import java.util.List; @Service public class WxScreenAdServiceImpl implements WxScreenAdService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private boolean isFmOpen; @Autowired WxScreenAdMapper wxScreenAdMapper; @@ -40,6 +43,9 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { @Autowired WxAppinfoService wxAppinfoService; + @Autowired + private FmOpenService openService; + @Autowired WxCouponChannelMapper wxCouponChannelMapper; @@ -162,12 +168,18 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { private static String QRCODE_JUMP_CMD_COUPON = "JC"; private static String QRCODE_JUMP_CMD_GROUP = "JG"; private static String QRCODE_JUMP_CMD_CAMPGIN = "JB"; + private byte[] getQrcode(Long id, int type, int subType, WxAppinfo appInfo) throws Exception { if(appInfo == null) { logger.error("QRCODE get error: appinfo is null"); return null; } - WxMaService wxMaService = MaUtil.getWeappService(appInfo); + WxMaService wxMaService = null; + if(isFmOpen) { + wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appInfo.getAppId()); + } else { + wxMaService = MaUtil.getWeappService(appInfo); + } String scene = ""; if (EnumScreenAdType.COUPON.getCode().equals(type)) { diff --git a/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java b/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java new file mode 100644 index 000000000..eb5228cc1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java @@ -0,0 +1,253 @@ +package com.iformall.service.wechat; + +import com.iformall.common.FmHttpClientBuilder; +import com.iformall.domain.po.WxAuthorizerInfo; +import com.iformall.domain.po.WxComponentVerifyTicket; +import com.iformall.mapper.WxAuthorizerInfoMapper; +import com.iformall.mapper.WxComponentVerifyTicketMapper; +import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; +import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage; +import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import redis.clients.jedis.Jedis; +import redis.clients.jedis.JedisPool; +import redis.clients.util.Pool; + +import java.util.Date; + +public class FmOpenInRedisDBConfigStorage extends WxOpenInMemoryConfigStorage { + private final static String COMPONENT_VERIFY_TICKET_KEY = "wechat_component_verify_ticket:"; + private final static String COMPONENT_ACCESS_TOKEN_KEY = "wechat_component_access_token:"; + + private final static String AUTHORIZER_REFRESH_TOKEN_KEY = "wechat_authorizer_refresh_token:"; + private final static String AUTHORIZER_ACCESS_TOKEN_KEY = "wechat_authorizer_access_token:"; + private final static String JSAPI_TICKET_KEY = "wechat_jsapi_ticket:"; + private final static String CARD_API_TICKET_KEY = "wechat_card_api_ticket:"; + + protected final Pool jedisPool; + private WxComponentVerifyTicketMapper wxComponentVerifyTicketMapper; + private WxAuthorizerInfoMapper wxAuthorizerInfoMapper; + + + /** + * redis 存储的 key 的前缀,可为空 + */ + private String keyPrefix; + private String componentVerifyTicketKey; + private String componentAccessTokenKey; + private String authorizerRefreshTokenKey; + private String authorizerAccessTokenKey; + private String jsapiTicketKey; + private String cardApiTicket; + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + + public FmOpenInRedisDBConfigStorage(Pool jedisPool) { + this.jedisPool = jedisPool; + } + + public FmOpenInRedisDBConfigStorage(Pool jedisPool, String keyPrefix) { + this.jedisPool = jedisPool; + this.keyPrefix = keyPrefix; + } + + public FmOpenInRedisDBConfigStorage(JedisPool jedisPool, WxComponentVerifyTicketMapper componentVerifyTicketMapper, WxAuthorizerInfoMapper authorizerInfoMapper) { + this.jedisPool = jedisPool; + this.wxComponentVerifyTicketMapper = componentVerifyTicketMapper; + this.wxAuthorizerInfoMapper = authorizerInfoMapper; + } + + @Override + public void setComponentAppId(String componentAppId) { + super.setComponentAppId(componentAppId); + String prefix = StringUtils.isBlank(keyPrefix) ? "" : + (StringUtils.endsWith(keyPrefix, ":") ? keyPrefix : (keyPrefix + ":")); + componentVerifyTicketKey = prefix + COMPONENT_VERIFY_TICKET_KEY.concat(componentAppId); + componentAccessTokenKey = prefix + COMPONENT_ACCESS_TOKEN_KEY.concat(componentAppId); + authorizerRefreshTokenKey = prefix + AUTHORIZER_REFRESH_TOKEN_KEY.concat(componentAppId); + authorizerAccessTokenKey = prefix + AUTHORIZER_ACCESS_TOKEN_KEY.concat(componentAppId); + this.jsapiTicketKey = JSAPI_TICKET_KEY.concat(componentAppId); + this.cardApiTicket = CARD_API_TICKET_KEY.concat(componentAppId); + } + + @Override + public String getComponentVerifyTicket() { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.get(this.componentVerifyTicketKey); + } + } + + @Override + public void setComponentVerifyTicket(String componentVerifyTicket) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.set(this.componentVerifyTicketKey, componentVerifyTicket); + } + } + + @Override + public String getComponentAccessToken() { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.get(this.componentAccessTokenKey); + } + } + + @Override + public boolean isComponentAccessTokenExpired() { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.ttl(this.componentAccessTokenKey) < 2; + } + } + + @Override + public void expireComponentAccessToken(){ + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.expire(this.componentAccessTokenKey, 0); + } + } + + @Override + public void updateComponentAccessTokent(String componentAccessToken, int expiresInSeconds) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.setex(this.componentAccessTokenKey, expiresInSeconds - 200, componentAccessToken); + + WxComponentVerifyTicket ticket = new WxComponentVerifyTicket(); + ticket.setComponentAppid(getComponentAppId()); + ticket.setAccessToken(componentAccessToken); + ticket.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (expiresInSeconds * 1000)))); + int num = wxComponentVerifyTicketMapper.updateAccessToken(ticket); + logger.info("updateComponentVerifyTicketAccessToken rows: " + num); + } + } + + private String getKey(String prefix, String appId) { + return prefix.endsWith(":") ? prefix.concat(appId) : prefix.concat(":").concat(appId); + } + + @Override + public String getAuthorizerRefreshToken(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.get(this.getKey(this.authorizerRefreshTokenKey, appId)); + } + } + + @Override + public void setAuthorizerRefreshToken(String appId, String authorizerRefreshToken) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.set(this.getKey(this.authorizerRefreshTokenKey, appId), authorizerRefreshToken); + + WxAuthorizerInfo authorizerInfo = new WxAuthorizerInfo(); + authorizerInfo.setAuthorizerAppid(appId); + authorizerInfo.setRefreshToken(authorizerRefreshToken); + int num = wxAuthorizerInfoMapper.updateRefreshToken(authorizerInfo); + logger.info("setAuthorizerRefreshToken " + appId + " rows: " + num); + } + } + + @Override + public String getAuthorizerAccessToken(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.get(this.getKey(this.authorizerAccessTokenKey, appId)); + } + } + + @Override + public boolean isAuthorizerAccessTokenExpired(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.ttl(this.getKey(this.authorizerAccessTokenKey, appId)) < 2; + } + } + + @Override + public void expireAuthorizerAccessToken(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.expire(this.getKey(this.authorizerAccessTokenKey, appId), 0); + } + } + + @Override + public void updateAuthorizerAccessToken(String appId, WxOpenAuthorizerAccessToken authorizerAccessToken) { + this.updateAuthorizerAccessToken(appId, authorizerAccessToken.getAuthorizerAccessToken(), authorizerAccessToken.getExpiresIn()); + + WxAuthorizerInfo authorizerInfo = new WxAuthorizerInfo(); + authorizerInfo.setAuthorizerAppid(appId); + authorizerInfo.setAccessToken(authorizerAccessToken.getAuthorizerAccessToken()); + authorizerInfo.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (authorizerAccessToken.getExpiresIn() * 1000)))); + int num = wxAuthorizerInfoMapper.updateAccessToken(authorizerInfo); + logger.info("updateAuthorizerAccessToken " + appId + " rows: " + num); + } + + @Override + public void updateAuthorizerAccessToken(String appId, String authorizerAccessToken, int expiresInSeconds) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.setex(this.getKey(this.authorizerAccessTokenKey, appId), expiresInSeconds - 200, authorizerAccessToken); + } + } + + @Override + public String getJsapiTicket(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.get(this.getKey(this.jsapiTicketKey, appId)); + } + } + + @Override + public boolean isJsapiTicketExpired(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.ttl(this.getKey(this.jsapiTicketKey, appId)) < 2; + } + } + + @Override + public void expireJsapiTicket(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.expire(this.getKey(this.jsapiTicketKey, appId), 0); + } + } + + @Override + public void updateJsapiTicket(String appId, String jsapiTicket, int expiresInSeconds) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.setex(this.getKey(this.jsapiTicketKey, appId), expiresInSeconds - 200, jsapiTicket); + } + + // TODO update to DB + } + + @Override + public String getCardApiTicket(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.get(this.getKey(this.cardApiTicket, appId)); + } + } + + @Override + public boolean isCardApiTicketExpired(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + return jedis.ttl(this.getKey(this.cardApiTicket, appId)) < 2; + } + } + + @Override + public void expireCardApiTicket(String appId) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.expire(this.getKey(this.cardApiTicket, appId), 0); + } + } + + @Override + public void updateCardApiTicket(String appId, String cardApiTicket, int expiresInSeconds) { + try (Jedis jedis = this.jedisPool.getResource()) { + jedis.setex(this.getKey(this.cardApiTicket, appId), expiresInSeconds - 200, cardApiTicket); + } + + // TODO update to DB + } + + @Override + public ApacheHttpClientBuilder getApacheHttpClientBuilder() { + return FmHttpClientBuilder.get(); + } +} diff --git a/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenService.java b/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenService.java new file mode 100644 index 000000000..d267024a1 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenService.java @@ -0,0 +1,73 @@ +package com.iformall.service.wechat; + +import com.iformall.config.WechatOpenProperties; +import com.iformall.config.WechatRedisProperies; +import com.iformall.mapper.WxAuthorizerInfoMapper; +import com.iformall.mapper.WxComponentVerifyTicketMapper; +import me.chanjar.weixin.open.api.impl.WxOpenMessageRouter; +import me.chanjar.weixin.open.api.impl.WxOpenServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.stereotype.Service; +import redis.clients.jedis.JedisPool; + +import javax.annotation.PostConstruct; + +/** + * Stormeye WU + */ +@Service +@EnableConfigurationProperties({WechatOpenProperties.class, WechatRedisProperies.class}) +public class FmOpenService extends WxOpenServiceImpl { + private Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + private WechatOpenProperties wechatProperties; + @Autowired + private WechatRedisProperies redisProperies; + + @Autowired + private WxComponentVerifyTicketMapper componentVerifyTicketMapper; + + @Autowired + private WxAuthorizerInfoMapper authorizerInfoMapper; + + private static JedisPool pool; + private WxOpenMessageRouter wxOpenMessageRouter; + + @PostConstruct + public void init() { + FmOpenInRedisDBConfigStorage configStorage = new FmOpenInRedisDBConfigStorage(getJedisPool(), componentVerifyTicketMapper, authorizerInfoMapper); + configStorage.setComponentAppId(wechatProperties.getComponentAppId()); + configStorage.setComponentAppSecret(wechatProperties.getComponentSecret()); + configStorage.setComponentToken(wechatProperties.getComponentToken()); + configStorage.setComponentAesKey(wechatProperties.getComponentAesKey()); + setWxOpenConfigStorage(configStorage); + wxOpenMessageRouter = new WxOpenMessageRouter(this); + wxOpenMessageRouter.rule().handler((wxMpXmlMessage, map, wxMpService, wxSessionManager) -> { + logger.info("\n接收到 {} 公众号请求消息,内容:{}", wxMpService.getWxMpConfigStorage().getAppId(), wxMpXmlMessage); + return null; + }).next(); + } + + public WxOpenMessageRouter getWxOpenMessageRouter() { + return wxOpenMessageRouter; + } + + private JedisPool getJedisPool() { + if (pool == null) { + synchronized (FmOpenService.class) { + if (pool == null) { + pool = new JedisPool(redisProperies, redisProperies.getHost(), + redisProperies.getPort(), redisProperies.getConnectionTimeout(), + redisProperies.getSoTimeout(), redisProperies.getPassword(), + redisProperies.getDatabase(), redisProperies.getClientName(), + redisProperies.isSsl(), redisProperies.getSslSocketFactory(), + redisProperies.getSslParameters(), redisProperies.getHostnameVerifier()); + } + } + } + return pool; + } +} diff --git a/mallinkService/src/main/java/com/iformall/utils/MaUtil.java b/mallinkService/src/main/java/com/iformall/utils/MaUtil.java index ee85be9f8..83e813084 100644 --- a/mallinkService/src/main/java/com/iformall/utils/MaUtil.java +++ b/mallinkService/src/main/java/com/iformall/utils/MaUtil.java @@ -3,7 +3,7 @@ package com.iformall.utils; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig; -import com.iformall.common.MipHttpClientBuilder; +import com.iformall.common.FmHttpClientBuilder; import com.iformall.domain.po.WxAppinfo; import org.apache.commons.lang3.StringUtils; @@ -20,7 +20,7 @@ public class MaUtil { config.setAccessToken(appinfo.getAccessToken()); config.setExpiresTime(appinfo.getLastTokenTime().getTime()+appinfo.getExpiresIn()*1000); } - config.setApacheHttpClientBuilder(MipHttpClientBuilder.get()); + config.setApacheHttpClientBuilder(FmHttpClientBuilder.get()); WxMaService service = new WxMaServiceImpl(); service.setWxMaConfig(config); return service; diff --git a/mallinkService/src/main/resources/mapper/WxAuthorizerInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxAuthorizerInfoMapper.xml index f2c6efed2..13e351fe9 100644 --- a/mallinkService/src/main/resources/mapper/WxAuthorizerInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxAuthorizerInfoMapper.xml @@ -246,6 +246,14 @@ + +