| @@ -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<String, String> 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(),"未找到对应的支付数据"); | |||
| } | |||
| @@ -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); | |||
| @@ -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() { | |||
| @@ -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; | |||
| } | |||
| @@ -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); | |||
| } | |||
| @@ -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","未找到支付配置"); | |||
| @@ -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); | |||
| } | |||
| @@ -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<String,Object> 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){ | |||
| @@ -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"); | |||
| @@ -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); | |||
| @@ -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<WxAppinfo> 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); | |||
| } | |||
| @@ -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<WxAppinfo> appList = wxAppinfoMapper.selectList(new QueryWrapper(appinfoQ)); | |||
| List<WxAppinfo> appList = wxAppinfoService.getList(appinfoQ); | |||
| if (appList.size() > 0) { | |||
| appInfo = appList.get(0); | |||
| } | |||
| @@ -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); | |||
| @@ -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); | |||
| @@ -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); | |||
| @@ -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<String,Object> paramMap = new HashMap<>(); | |||
| paramMap.put("token",payAccount.getNotifyToken()); | |||
| paramMap.put("timestamp",timestamp); | |||
| @@ -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(); | |||