From f0825bd9dad4e22a4a30b2ca2d816a994bd7e503 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 28 Nov 2022 22:47:49 +0800 Subject: [PATCH] //app test --- .../basic/WxProjectConfigController.java | 11 ++++----- .../controller/sys/HomeController.java | 2 +- .../iformall/controller/BaseController.java | 4 ++-- .../iformall/controller/BaseController.java | 2 +- .../iformall/controller/WxMallController.java | 8 +++---- .../controller/WxOrderController.java | 8 +++---- .../controller/WxUserGrantController.java | 6 ++--- .../controller/callback/TtPayController.java | 12 +++++----- .../controller/callback/TtWebController.java | 2 +- .../iformall/service/WxAppinfoService.java | 3 ++- .../service/impl/WxAppinfoServiceImpl.java | 18 ++++++++++++-- .../service/impl/WxPayBillServiceImpl.java | 24 ++++++++----------- .../msg/impl/SendSmartAppMsgServiceImpl.java | 2 +- .../refund/douyin/TtRefundAdapterService.java | 11 +++++---- .../controller/sys/HomeController.java | 2 +- .../callback/TtOrderCallbackController.java | 4 ++-- .../controller/TtUserGrantController.java | 6 ++--- 17 files changed, 68 insertions(+), 57 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java index bf85af1e8..8b87e0b01 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxProjectConfigController.java @@ -818,10 +818,10 @@ public class WxProjectConfigController extends BaseController { @GetMapping("/ttcallback/query/settings") @SystemControllerLog(description = "") @TenantIgnore - public ResultData ttcallbackQuerySettings(String tenantId,String appid) { + public ResultData ttcallbackQuerySettings(String appid) { logger.debug("[" + getIpAddr() + "] WxProjectConfigController::ttcallbackQuerySettings"); try { - WxAppinfo appinfo = wxAppinfoService.getByAppId(appid,tenantId); + WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appid); if(appinfo == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); } @@ -829,7 +829,7 @@ public class WxProjectConfigController extends BaseController { || !EnumAppType.C.getCode().equals(appinfo.getType())){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); } - WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); if(payAccount == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的支付数据"); } @@ -849,7 +849,6 @@ public class WxProjectConfigController extends BaseController { public ResultData ttcallbackSettings(@RequestBody Map map) { logger.debug("[" + getIpAddr() + "] WxProjectConfigController::ttcallbackSettings"); String appid = map.get("appid"); - String tenantId = map.get("tenantId"); String create_order_callback = map.get("createOrderCallback"); String refund_callback = map.get("refundCallback"); String delivery_qrcode_redirect = map.get("deliveryQrcodeRedirect"); @@ -858,7 +857,7 @@ public class WxProjectConfigController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); } try { - WxAppinfo appinfo = wxAppinfoService.getByAppId(appid,tenantId); + WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appid); if(appinfo == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); } @@ -866,7 +865,7 @@ public class WxProjectConfigController extends BaseController { || !EnumAppType.C.getCode().equals(appinfo.getType())){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); } - WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); if(payAccount == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的支付数据"); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java b/mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java index c72ecbd89..19b6c4f94 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/sys/HomeController.java @@ -255,7 +255,7 @@ public class HomeController extends BaseController { logger.error("appid信息未提供"); return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); } - WxAppinfo appinfo = appinfoService.getByAppId(user.getTenantId()); + WxAppinfo appinfo = appinfoService.getOnlyByAppIdFromRedis(user.getTenantId()); if (appinfo == null) { logger.error("appid未找到"); return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); diff --git a/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java b/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java index 7f12c8de7..86850f3cc 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/BaseController.java @@ -160,11 +160,11 @@ public class BaseController { } public WxAppinfo getAppInfo(String appId) { - return wxAppinfoService.getByAppId(appId); + return wxAppinfoService.getOnlyByAppIdFromRedis(appId); } public WxAppinfo getAppInfo(String appId,String tenantId) { - return wxAppinfoService.getByAppId(appId,tenantId); + return wxAppinfoService.getByAppIdFromRedis(appId,tenantId); } public String getIpAddr() { diff --git a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java index 293322ede..4d0303c84 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/BaseController.java @@ -251,7 +251,7 @@ public class BaseController { if(isFmOpen) { return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); } else { - WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); + WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); if (appinfo == null) { return null; } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxMallController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxMallController.java index 3db2ce979..53c78dd55 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxMallController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxMallController.java @@ -48,7 +48,7 @@ public class WxMallController extends BaseController { @ApiOperation("获取模板类型") @GetMapping("/getAppIcp") public ResultData getAppIcp(String appId) { - WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); + WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); if (appInfo == null) { return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } @@ -60,7 +60,7 @@ public class WxMallController extends BaseController { @ApiOperation("获取模板类型") @GetMapping("/modelType") public ResultData modelType(String appId) { - WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); + WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); if (appInfo == null) { return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } @@ -73,7 +73,7 @@ public class WxMallController extends BaseController { @GetMapping("/getAppIcon") @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) public ResultData getAppIcon(String appId) { - WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); + WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); if (appInfo == null) { return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } @@ -93,7 +93,7 @@ public class WxMallController extends BaseController { @GetMapping("/getWeapNote") @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) public ResultData getWeapNote(String appId) { - WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); + WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); if (appInfo == null) { return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java index dc63d351f..47ade0597 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java @@ -212,8 +212,8 @@ public class WxOrderController extends BaseController { } WxMall mall = mallService.getByTenantId(tenantId); - //验证app todo 想想集团版多小程序和单小程序怎么处理 - WxAppinfo appinfo = wxAppinfoService.getByAppIdFromRedis(app_id,mall.getFinalTenantId()); + //验证app + WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(app_id); if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) || !EnumAppType.C.getCode().equals(appinfo.getType())){ map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); @@ -763,14 +763,14 @@ public class WxOrderController extends BaseController { String tenantId = getTenantId(cp_extra); WxMall mall = mallService.getByTenantId(tenantId); //验证app - WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id); + WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(app_id); if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) || !EnumAppType.C.getCode().equals(appinfo.getType())){ map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); map.put("err_tips",ErrorCode.APP_ID_NOT_FOUND.getMessage()); return map; } - WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); if(payAccount == null){ map.put("err_no",ErrorCode.API_KEY_NOT_FOUND.getCode()); map.put("err_tips","未找到支付配置"); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index d78616034..6c738c394 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -183,7 +183,7 @@ public class WxUserGrantController extends BaseController { //其他参数 String systemInfo = map.get("systemInfo"); - WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(appId); + WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); if(wxAppinfo == null){ return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } @@ -370,7 +370,7 @@ public class WxUserGrantController extends BaseController { } CUser user = getCUser(); if (user != null) { - WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); + WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(user.getAppId()); if(wxAppinfo == null){ return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } @@ -417,7 +417,7 @@ public class WxUserGrantController extends BaseController { if (user == null) { return new ResultData(ErrorCode.USER_IS_EMPTY); } - WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); + WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(user.getAppId()); if(wxAppinfo == null){ return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } diff --git a/mallinkCallback/src/main/java/com/iformall/controller/callback/TtPayController.java b/mallinkCallback/src/main/java/com/iformall/controller/callback/TtPayController.java index 6ede014bf..5e7a1c499 100644 --- a/mallinkCallback/src/main/java/com/iformall/controller/callback/TtPayController.java +++ b/mallinkCallback/src/main/java/com/iformall/controller/callback/TtPayController.java @@ -114,8 +114,8 @@ public class TtPayController extends BaseController { appid = (String) pMap.get("app_id"); String cp_extra = (String) pMap.get("cp_extra"); tenantId = getTenantId(cp_extra); - appinfo = appinfoService.getByAppId(appid,tenantId); - payAccount = payAccountService.getById(appinfo.getPayId()); + appinfo = appinfoService.getOnlyByAppIdFromRedis(appid); + payAccount = payAccountService.getByIdFromRedis(appinfo.getPayId()); TtPayService ttPayService = maUtil.getTtPayService(appinfo, payAccount); String beforeSign = String.format("%s\n%s\n%s\n", @@ -139,8 +139,8 @@ public class TtPayController extends BaseController { appid = (String) pMap.get("appid"); String cp_extra = (String) pMap.get("cp_extra"); tenantId = getTenantId(cp_extra); - appinfo = appinfoService.getByAppId(appid,tenantId); - payAccount = payAccountService.getById(appinfo.getPayId()); + appinfo = appinfoService.getOnlyByAppIdFromRedis(appid); + payAccount = payAccountService.getByIdFromRedis(appinfo.getPayId()); Map paramMap = new HashMap<>(); paramMap.put("token",payAccount.getNotifyToken()); @@ -169,7 +169,7 @@ public class TtPayController extends BaseController { if (StringUtils.isNotBlank(out_order_no)) { try { Long orderId = Long.valueOf(out_order_no); - WxPayOrder wxpayOrder = wxPayOrderService.getById(orderId, appinfo.getTenantId()); + WxPayOrder wxpayOrder = wxPayOrderService.getById(orderId, tenantId); if(wxpayOrder == null){ logger.error("未找到订单"+orderId); resultMap.put("err_tips","未找到订单"); @@ -240,7 +240,7 @@ public class TtPayController extends BaseController { String out_settle_no = (String) pMap.get("out_settle_no"); String status = (String) pMap.get("status"); WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); - wxProfitSharingOrder.setTenantId(appinfo.getTenantId()); + wxProfitSharingOrder.setTenantId(tenantId); wxProfitSharingOrder.setOutSettleNo(Long.parseLong(out_settle_no)); WxProfitSharingOrder one = wxProfitSharingOrderService.findOne(wxProfitSharingOrder); if(one != null){ diff --git a/mallinkCallback/src/main/java/com/iformall/controller/callback/TtWebController.java b/mallinkCallback/src/main/java/com/iformall/controller/callback/TtWebController.java index c5056a84b..01d51661b 100644 --- a/mallinkCallback/src/main/java/com/iformall/controller/callback/TtWebController.java +++ b/mallinkCallback/src/main/java/com/iformall/controller/callback/TtWebController.java @@ -70,7 +70,7 @@ public class TtWebController extends BaseController { } String client_key = (String) parameterMap.get("client_key"); - WxAppinfo appInfo = wxAppinfoService.getByAppId(client_key); + WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(client_key); if(appInfo == null){ resultMap.put("err_code",1000); resultMap.put("err_tips","error"); diff --git a/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java b/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java index 4f2b98aa9..fece4aa9b 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxAppinfoService.java @@ -57,7 +57,7 @@ public interface WxAppinfoService { * @param appId * @return */ - WxAppinfo getByAppId(String appId); + WxAppinfo getOnlyByAppId(String appId); WxAppinfo getByAppId(String appId,String tenantId); /** @@ -84,6 +84,7 @@ public interface WxAppinfoService { */ void deleteById(Long id); + WxAppinfo getOnlyByAppIdFromRedis(String appId); WxAppinfo getByAppIdFromRedis(String appId,String tenantId); WxAppinfo getByIdFromRedis(Long id); 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 45bc0c49d..a2fd805b3 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxAppinfoServiceImpl.java @@ -98,7 +98,7 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { } @Override - public WxAppinfo getByAppId(String appId) { + public WxAppinfo getOnlyByAppId(String appId) { WxAppinfo appinfoQ = new WxAppinfo(); appinfoQ.setAppId(appId); List list = wxAppinfoMapper.findList(appinfoQ); @@ -177,13 +177,27 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { wxAppinfoMapper.deleteById(id); } + @Override + public WxAppinfo getOnlyByAppIdFromRedis(String appId) { + WxAppinfo record = null; + String key = Constant.appinfoPrev + "only" + ":" + appId; + record = RedisCacheUtils.getCacheObject(wxAppinfoRedisTemplate, key, WxAppinfo.class); + if (null == record) { + record = this.getOnlyByAppId(appId); + if(record != null){ + RedisCacheUtils.cache(wxAppinfoRedisTemplate, key, record, 3600*24*7); + } + } + return record; + } + @Override public WxAppinfo getByAppIdFromRedis(String appId,String tenantId) { WxAppinfo record = null; String key = Constant.appinfoPrev + tenantId + ":" + appId; record = RedisCacheUtils.getCacheObject(wxAppinfoRedisTemplate, key, WxAppinfo.class); if (null == record) { - record = this.getByAppId(appId); + record = this.getByAppId(appId,tenantId); if(record != null){ RedisCacheUtils.cache(wxAppinfoRedisTemplate, key, record, 3600*24*7); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java index 86416b0ca..7df0c2028 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPayBillServiceImpl.java @@ -19,11 +19,7 @@ import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; import com.iformall.pay.*; -import com.iformall.service.WxBillAllService; -import com.iformall.service.WxBillSettleService; -import com.iformall.service.WxMerchantBUserService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayBillService; +import com.iformall.service.*; import com.iformall.utils.*; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -45,13 +41,13 @@ public class WxPayBillServiceImpl implements WxPayBillService { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired - WxAppinfoMapper wxAppinfoMapper; + WxAppinfoService wxAppinfoService; @Autowired WxPayAccountBillMapper wxPayAccountBillMapper; @Autowired - WxPayAccountMapper wxPayAccountMapper; + WxPayAccountService wxPayAccountService; @Autowired WxPayBillMapper wxPayBillMapper; @@ -132,7 +128,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { return new ResultData(ErrorCode.BILL_OWE_ZERO); } //获取支付账户信息 - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); Date currentDate = new Date(); String payBillNo; WxPayBill billParam= new WxPayBill(); @@ -362,7 +358,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { private String wechatPayBillQuery(WxAppinfo appInfo, WxPayBill record) { // get payAccount - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); if (payAccount.getType().equals(EnumPayMode.MCH.getCode())) { // 普通商户号模式 WxPayOrderQ payBillQ = new WxPayOrderQ(); @@ -459,7 +455,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { private String wechatPayBillClose(WxAppinfo appInfo, WxPayBill record) { // get payAccount - WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); if (payAccount.getType().equals(EnumPayMode.MCH.getCode())) { // 普通商户号模式 WxPayOrderQ payBillC = new WxPayOrderQ(); @@ -590,21 +586,21 @@ public class WxPayBillServiceImpl implements WxPayBillService { boolean isNormal = true; if (StringUtils.isBlank(subAppId) && StringUtils.isBlank(subMchId)) { // 普通商户号 - appinfo = wxAppinfoMapper.findByAppId(appId,tenantId); + appinfo = wxAppinfoService.getByAppIdFromRedis(appId,tenantId); if (appinfo == null) { throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); } isNormal = true; } else { // 服务号 现在用hmac-sha256 - appinfo = wxAppinfoMapper.findByAppId(subAppId,tenantId); + appinfo = wxAppinfoService.getByAppIdFromRedis(subAppId,tenantId); if (appinfo == null) { throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); } isNormal = false; } - WxPayAccount payAccount = wxPayAccountMapper.selectById(appinfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); if (payAccount == null) { throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); } @@ -801,7 +797,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { WxAppinfo appinfoQ = new WxAppinfo(); appinfoQ.setTenantId(bill.get("tenantId").toString()); appinfoQ.setType(EnumAppType.B.getCode()); - List appList = wxAppinfoMapper.selectList(new QueryWrapper(appinfoQ)); + List appList = wxAppinfoService.getList(appinfoQ); if (appList.size() > 0) { appInfo = appList.get(0); } diff --git a/mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java index 7b51fba43..c0cb8937f 100644 --- a/mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/msg/impl/SendSmartAppMsgServiceImpl.java @@ -76,7 +76,7 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService { return; } if(0 == msg.getOnOff().intValue()){ - WxAppinfo appInfo = wxAppinfoService.getByAppId(smartAppMsg.getAppId(),tenantEntity.getTenantId()); + WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(smartAppMsg.getAppId()); if(EnumTemplateType.TT_SEND_COUPON_REMIND.getCode().equals(msg.getType())){ //发抖音 TtMaService ttappService = maUtil.getTtMaService(appInfo); diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/refund/douyin/TtRefundAdapterService.java b/mallinkService/src/main/java/com/iformall/service/pay/service/refund/douyin/TtRefundAdapterService.java index 88daf18d1..f111864bb 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/refund/douyin/TtRefundAdapterService.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/refund/douyin/TtRefundAdapterService.java @@ -18,11 +18,12 @@ import com.iformall.enums.EnumPayType; import com.iformall.enums.EnumPayWay; import com.iformall.enums.EnumRefundStatus; import com.iformall.exception.MallinkException; -import com.iformall.mapper.WxAppinfoMapper; import com.iformall.mapper.WxPayAccountMapper; import com.iformall.mapper.WxPayOrderMapper; import com.iformall.mapper.WxRefundOrderMapper; +import com.iformall.service.WxAppinfoService; import com.iformall.service.WxOrderService; +import com.iformall.service.WxPayAccountService; import com.iformall.service.pay.service.refund.RefundPayAdapterService; import com.iformall.service.pay.service.refund.entity.RefundAdapterResult; import com.iformall.service.pay.service.refund.entity.RefundNotifyAdapterResult; @@ -158,9 +159,9 @@ public class TtRefundAdapterService implements RefundPayAdapterService{ } @Autowired - WxAppinfoMapper wxAppinfoMapper; + WxAppinfoService wxAppinfoService; @Autowired - WxPayAccountMapper wxPayAccountMapper; + WxPayAccountService wxPayAccountService; @Autowired WxPayOrderMapper wxPayOrderMapper; @Autowired @@ -194,12 +195,12 @@ public class TtRefundAdapterService implements RefundPayAdapterService{ WxRefundOrder refundOrder = wxRefundOrderMapper.selectById(refundOrderId); String appId = paramMap.get("appid"); - WxAppinfo appinfo = wxAppinfoMapper.findByAppId(appId,tenantId); + WxAppinfo appinfo = wxAppinfoService.getByAppIdFromRedis(appId,tenantId); if (appinfo == null) { log.error("未找到appid信息:" + appId); throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); } - WxPayAccount payAccount = wxPayAccountMapper.selectById(appinfo.getPayId()); + WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); if (payAccount == null) { log.error("未找到mch_id信息:" + appId); throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); diff --git a/mallinkTTAdmin/src/main/java/com/iformall/controller/sys/HomeController.java b/mallinkTTAdmin/src/main/java/com/iformall/controller/sys/HomeController.java index ce0fece70..ad1266945 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/controller/sys/HomeController.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/controller/sys/HomeController.java @@ -236,7 +236,7 @@ public class HomeController extends BaseController { logger.error("appid信息未提供"); return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); } - WxAppinfo appinfo = appinfoService.getByAppId(user.getTenantId()); + WxAppinfo appinfo = appinfoService.getOnlyByAppIdFromRedis(user.getTenantId()); if (appinfo == null) { logger.error("appid未找到"); return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); diff --git a/mallinkTTCApi/src/main/java/com/iformall/callback/TtOrderCallbackController.java b/mallinkTTCApi/src/main/java/com/iformall/callback/TtOrderCallbackController.java index 6bf87ad9f..f291b1e36 100644 --- a/mallinkTTCApi/src/main/java/com/iformall/callback/TtOrderCallbackController.java +++ b/mallinkTTCApi/src/main/java/com/iformall/callback/TtOrderCallbackController.java @@ -70,8 +70,8 @@ public class TtOrderCallbackController extends BaseController { String appid = (String) pMap.get("appid"); String cp_orderno = (String) pMap.get("cp_orderno");//开发者传入订单号 String way = (String) pMap.get("way");//2-支付宝,1-微信 - WxAppinfo appinfo = appinfoService.getByAppId(appid); - WxPayAccount payAccount = payAccountService.getById(appinfo.getPayId()); + WxAppinfo appinfo = appinfoService.getOnlyByAppIdFromRedis(appid); + WxPayAccount payAccount = payAccountService.getByIdFromRedis(appinfo.getPayId()); Map paramMap = new HashMap<>(); paramMap.put("token",payAccount.getNotifyToken()); paramMap.put("timestamp",timestamp); diff --git a/mallinkTTCApi/src/main/java/com/iformall/controller/TtUserGrantController.java b/mallinkTTCApi/src/main/java/com/iformall/controller/TtUserGrantController.java index df1deb9d2..7ab1a41f3 100644 --- a/mallinkTTCApi/src/main/java/com/iformall/controller/TtUserGrantController.java +++ b/mallinkTTCApi/src/main/java/com/iformall/controller/TtUserGrantController.java @@ -79,7 +79,7 @@ public class TtUserGrantController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "code不能为空"); } - WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(appId); + WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); if(wxAppinfo == null){ return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } @@ -263,7 +263,7 @@ public class TtUserGrantController extends BaseController { if (user != null) { logger.debug(user.toString()); - WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); + WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(user.getAppId()); TtMaService ttMaService = maUtil.getTtMaService(wxAppinfo); String session_key = user.getSessionKey(); @@ -350,7 +350,7 @@ public class TtUserGrantController extends BaseController { return new ResultData(ErrorCode.USER_IS_EMPTY); } - WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); + WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(user.getAppId()); TtMaService ttMaService = maUtil.getTtMaService(wxAppinfo); String session_key = user.getSessionKey();