| @@ -818,10 +818,10 @@ public class WxProjectConfigController extends BaseController { | |||||
| @GetMapping("/ttcallback/query/settings") | @GetMapping("/ttcallback/query/settings") | ||||
| @SystemControllerLog(description = "") | @SystemControllerLog(description = "") | ||||
| @TenantIgnore | @TenantIgnore | ||||
| public ResultData ttcallbackQuerySettings(String tenantId,String appid) { | |||||
| public ResultData ttcallbackQuerySettings(String appid) { | |||||
| logger.debug("[" + getIpAddr() + "] WxProjectConfigController::ttcallbackQuerySettings"); | logger.debug("[" + getIpAddr() + "] WxProjectConfigController::ttcallbackQuerySettings"); | ||||
| try { | try { | ||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appid,tenantId); | |||||
| WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appid); | |||||
| if(appinfo == null){ | if(appinfo == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); | ||||
| } | } | ||||
| @@ -829,7 +829,7 @@ public class WxProjectConfigController extends BaseController { | |||||
| || !EnumAppType.C.getCode().equals(appinfo.getType())){ | || !EnumAppType.C.getCode().equals(appinfo.getType())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); | ||||
| } | } | ||||
| WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); | |||||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); | |||||
| if(payAccount == null){ | if(payAccount == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的支付数据"); | 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) { | public ResultData ttcallbackSettings(@RequestBody Map<String, String> map) { | ||||
| logger.debug("[" + getIpAddr() + "] WxProjectConfigController::ttcallbackSettings"); | logger.debug("[" + getIpAddr() + "] WxProjectConfigController::ttcallbackSettings"); | ||||
| String appid = map.get("appid"); | String appid = map.get("appid"); | ||||
| String tenantId = map.get("tenantId"); | |||||
| String create_order_callback = map.get("createOrderCallback"); | String create_order_callback = map.get("createOrderCallback"); | ||||
| String refund_callback = map.get("refundCallback"); | String refund_callback = map.get("refundCallback"); | ||||
| String delivery_qrcode_redirect = map.get("deliveryQrcodeRedirect"); | String delivery_qrcode_redirect = map.get("deliveryQrcodeRedirect"); | ||||
| @@ -858,7 +857,7 @@ public class WxProjectConfigController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | ||||
| } | } | ||||
| try { | try { | ||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appid,tenantId); | |||||
| WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appid); | |||||
| if(appinfo == null){ | if(appinfo == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); | ||||
| } | } | ||||
| @@ -866,7 +865,7 @@ public class WxProjectConfigController extends BaseController { | |||||
| || !EnumAppType.C.getCode().equals(appinfo.getType())){ | || !EnumAppType.C.getCode().equals(appinfo.getType())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); | ||||
| } | } | ||||
| WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); | |||||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); | |||||
| if(payAccount == null){ | if(payAccount == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的支付数据"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的支付数据"); | ||||
| } | } | ||||
| @@ -255,7 +255,7 @@ public class HomeController extends BaseController { | |||||
| logger.error("appid信息未提供"); | logger.error("appid信息未提供"); | ||||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | ||||
| } | } | ||||
| WxAppinfo appinfo = appinfoService.getByAppId(user.getTenantId()); | |||||
| WxAppinfo appinfo = appinfoService.getOnlyByAppIdFromRedis(user.getTenantId()); | |||||
| if (appinfo == null) { | if (appinfo == null) { | ||||
| logger.error("appid未找到"); | logger.error("appid未找到"); | ||||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | ||||
| @@ -160,11 +160,11 @@ public class BaseController { | |||||
| } | } | ||||
| public WxAppinfo getAppInfo(String appId) { | public WxAppinfo getAppInfo(String appId) { | ||||
| return wxAppinfoService.getByAppId(appId); | |||||
| return wxAppinfoService.getOnlyByAppIdFromRedis(appId); | |||||
| } | } | ||||
| public WxAppinfo getAppInfo(String appId,String tenantId) { | public WxAppinfo getAppInfo(String appId,String tenantId) { | ||||
| return wxAppinfoService.getByAppId(appId,tenantId); | |||||
| return wxAppinfoService.getByAppIdFromRedis(appId,tenantId); | |||||
| } | } | ||||
| public String getIpAddr() { | public String getIpAddr() { | ||||
| @@ -251,7 +251,7 @@ public class BaseController { | |||||
| if(isFmOpen) { | if(isFmOpen) { | ||||
| return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | return openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | ||||
| } else { | } else { | ||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(appId); | |||||
| WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); | |||||
| if (appinfo == null) { | if (appinfo == null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -48,7 +48,7 @@ public class WxMallController extends BaseController { | |||||
| @ApiOperation("获取模板类型") | @ApiOperation("获取模板类型") | ||||
| @GetMapping("/getAppIcp") | @GetMapping("/getAppIcp") | ||||
| public ResultData getAppIcp(String appId) { | public ResultData getAppIcp(String appId) { | ||||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); | |||||
| WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); | |||||
| if (appInfo == null) { | if (appInfo == null) { | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -60,7 +60,7 @@ public class WxMallController extends BaseController { | |||||
| @ApiOperation("获取模板类型") | @ApiOperation("获取模板类型") | ||||
| @GetMapping("/modelType") | @GetMapping("/modelType") | ||||
| public ResultData modelType(String appId) { | public ResultData modelType(String appId) { | ||||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); | |||||
| WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); | |||||
| if (appInfo == null) { | if (appInfo == null) { | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -73,7 +73,7 @@ public class WxMallController extends BaseController { | |||||
| @GetMapping("/getAppIcon") | @GetMapping("/getAppIcon") | ||||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) | @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) | ||||
| public ResultData getAppIcon(String appId) { | public ResultData getAppIcon(String appId) { | ||||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); | |||||
| WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); | |||||
| if (appInfo == null) { | if (appInfo == null) { | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -93,7 +93,7 @@ public class WxMallController extends BaseController { | |||||
| @GetMapping("/getWeapNote") | @GetMapping("/getWeapNote") | ||||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) | @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) | ||||
| public ResultData getWeapNote(String appId) { | public ResultData getWeapNote(String appId) { | ||||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); | |||||
| WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); | |||||
| if (appInfo == null) { | if (appInfo == null) { | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -212,8 +212,8 @@ public class WxOrderController extends BaseController { | |||||
| } | } | ||||
| WxMall mall = mallService.getByTenantId(tenantId); | 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()) | if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) | ||||
| || !EnumAppType.C.getCode().equals(appinfo.getType())){ | || !EnumAppType.C.getCode().equals(appinfo.getType())){ | ||||
| map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); | map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); | ||||
| @@ -763,14 +763,14 @@ public class WxOrderController extends BaseController { | |||||
| String tenantId = getTenantId(cp_extra); | String tenantId = getTenantId(cp_extra); | ||||
| WxMall mall = mallService.getByTenantId(tenantId); | WxMall mall = mallService.getByTenantId(tenantId); | ||||
| //验证app | //验证app | ||||
| WxAppinfo appinfo = wxAppinfoService.getByAppId(app_id); | |||||
| WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(app_id); | |||||
| if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) | if(appinfo == null || !EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) | ||||
| || !EnumAppType.C.getCode().equals(appinfo.getType())){ | || !EnumAppType.C.getCode().equals(appinfo.getType())){ | ||||
| map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); | map.put("err_no",ErrorCode.APP_ID_NOT_FOUND.getCode()); | ||||
| map.put("err_tips",ErrorCode.APP_ID_NOT_FOUND.getMessage()); | map.put("err_tips",ErrorCode.APP_ID_NOT_FOUND.getMessage()); | ||||
| return map; | return map; | ||||
| } | } | ||||
| WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); | |||||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); | |||||
| if(payAccount == null){ | if(payAccount == null){ | ||||
| map.put("err_no",ErrorCode.API_KEY_NOT_FOUND.getCode()); | map.put("err_no",ErrorCode.API_KEY_NOT_FOUND.getCode()); | ||||
| map.put("err_tips","未找到支付配置"); | map.put("err_tips","未找到支付配置"); | ||||
| @@ -183,7 +183,7 @@ public class WxUserGrantController extends BaseController { | |||||
| //其他参数 | //其他参数 | ||||
| String systemInfo = map.get("systemInfo"); | String systemInfo = map.get("systemInfo"); | ||||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(appId); | |||||
| WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); | |||||
| if(wxAppinfo == null){ | if(wxAppinfo == null){ | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -370,7 +370,7 @@ public class WxUserGrantController extends BaseController { | |||||
| } | } | ||||
| CUser user = getCUser(); | CUser user = getCUser(); | ||||
| if (user != null) { | if (user != null) { | ||||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); | |||||
| WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(user.getAppId()); | |||||
| if(wxAppinfo == null){ | if(wxAppinfo == null){ | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -417,7 +417,7 @@ public class WxUserGrantController extends BaseController { | |||||
| if (user == null) { | if (user == null) { | ||||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | return new ResultData(ErrorCode.USER_IS_EMPTY); | ||||
| } | } | ||||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); | |||||
| WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(user.getAppId()); | |||||
| if(wxAppinfo == null){ | if(wxAppinfo == null){ | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -114,8 +114,8 @@ public class TtPayController extends BaseController { | |||||
| appid = (String) pMap.get("app_id"); | appid = (String) pMap.get("app_id"); | ||||
| String cp_extra = (String) pMap.get("cp_extra"); | String cp_extra = (String) pMap.get("cp_extra"); | ||||
| tenantId = getTenantId(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); | TtPayService ttPayService = maUtil.getTtPayService(appinfo, payAccount); | ||||
| String beforeSign = String.format("%s\n%s\n%s\n", | String beforeSign = String.format("%s\n%s\n%s\n", | ||||
| @@ -139,8 +139,8 @@ public class TtPayController extends BaseController { | |||||
| appid = (String) pMap.get("appid"); | appid = (String) pMap.get("appid"); | ||||
| String cp_extra = (String) pMap.get("cp_extra"); | String cp_extra = (String) pMap.get("cp_extra"); | ||||
| tenantId = getTenantId(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<>(); | Map<String,Object> paramMap = new HashMap<>(); | ||||
| paramMap.put("token",payAccount.getNotifyToken()); | paramMap.put("token",payAccount.getNotifyToken()); | ||||
| @@ -169,7 +169,7 @@ public class TtPayController extends BaseController { | |||||
| if (StringUtils.isNotBlank(out_order_no)) { | if (StringUtils.isNotBlank(out_order_no)) { | ||||
| try { | try { | ||||
| Long orderId = Long.valueOf(out_order_no); | Long orderId = Long.valueOf(out_order_no); | ||||
| WxPayOrder wxpayOrder = wxPayOrderService.getById(orderId, appinfo.getTenantId()); | |||||
| WxPayOrder wxpayOrder = wxPayOrderService.getById(orderId, tenantId); | |||||
| if(wxpayOrder == null){ | if(wxpayOrder == null){ | ||||
| logger.error("未找到订单"+orderId); | logger.error("未找到订单"+orderId); | ||||
| resultMap.put("err_tips","未找到订单"); | resultMap.put("err_tips","未找到订单"); | ||||
| @@ -240,7 +240,7 @@ public class TtPayController extends BaseController { | |||||
| String out_settle_no = (String) pMap.get("out_settle_no"); | String out_settle_no = (String) pMap.get("out_settle_no"); | ||||
| String status = (String) pMap.get("status"); | String status = (String) pMap.get("status"); | ||||
| WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); | WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); | ||||
| wxProfitSharingOrder.setTenantId(appinfo.getTenantId()); | |||||
| wxProfitSharingOrder.setTenantId(tenantId); | |||||
| wxProfitSharingOrder.setOutSettleNo(Long.parseLong(out_settle_no)); | wxProfitSharingOrder.setOutSettleNo(Long.parseLong(out_settle_no)); | ||||
| WxProfitSharingOrder one = wxProfitSharingOrderService.findOne(wxProfitSharingOrder); | WxProfitSharingOrder one = wxProfitSharingOrderService.findOne(wxProfitSharingOrder); | ||||
| if(one != null){ | if(one != null){ | ||||
| @@ -70,7 +70,7 @@ public class TtWebController extends BaseController { | |||||
| } | } | ||||
| String client_key = (String) parameterMap.get("client_key"); | String client_key = (String) parameterMap.get("client_key"); | ||||
| WxAppinfo appInfo = wxAppinfoService.getByAppId(client_key); | |||||
| WxAppinfo appInfo = wxAppinfoService.getOnlyByAppIdFromRedis(client_key); | |||||
| if(appInfo == null){ | if(appInfo == null){ | ||||
| resultMap.put("err_code",1000); | resultMap.put("err_code",1000); | ||||
| resultMap.put("err_tips","error"); | resultMap.put("err_tips","error"); | ||||
| @@ -57,7 +57,7 @@ public interface WxAppinfoService { | |||||
| * @param appId | * @param appId | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxAppinfo getByAppId(String appId); | |||||
| WxAppinfo getOnlyByAppId(String appId); | |||||
| WxAppinfo getByAppId(String appId,String tenantId); | WxAppinfo getByAppId(String appId,String tenantId); | ||||
| /** | /** | ||||
| @@ -84,6 +84,7 @@ public interface WxAppinfoService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| WxAppinfo getOnlyByAppIdFromRedis(String appId); | |||||
| WxAppinfo getByAppIdFromRedis(String appId,String tenantId); | WxAppinfo getByAppIdFromRedis(String appId,String tenantId); | ||||
| WxAppinfo getByIdFromRedis(Long id); | WxAppinfo getByIdFromRedis(Long id); | ||||
| @@ -98,7 +98,7 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxAppinfo getByAppId(String appId) { | |||||
| public WxAppinfo getOnlyByAppId(String appId) { | |||||
| WxAppinfo appinfoQ = new WxAppinfo(); | WxAppinfo appinfoQ = new WxAppinfo(); | ||||
| appinfoQ.setAppId(appId); | appinfoQ.setAppId(appId); | ||||
| List<WxAppinfo> list = wxAppinfoMapper.findList(appinfoQ); | List<WxAppinfo> list = wxAppinfoMapper.findList(appinfoQ); | ||||
| @@ -177,13 +177,27 @@ public class WxAppinfoServiceImpl implements WxAppinfoService { | |||||
| wxAppinfoMapper.deleteById(id); | 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 | @Override | ||||
| public WxAppinfo getByAppIdFromRedis(String appId,String tenantId) { | public WxAppinfo getByAppIdFromRedis(String appId,String tenantId) { | ||||
| WxAppinfo record = null; | WxAppinfo record = null; | ||||
| String key = Constant.appinfoPrev + tenantId + ":" + appId; | String key = Constant.appinfoPrev + tenantId + ":" + appId; | ||||
| record = RedisCacheUtils.getCacheObject(wxAppinfoRedisTemplate, key, WxAppinfo.class); | record = RedisCacheUtils.getCacheObject(wxAppinfoRedisTemplate, key, WxAppinfo.class); | ||||
| if (null == record) { | if (null == record) { | ||||
| record = this.getByAppId(appId); | |||||
| record = this.getByAppId(appId,tenantId); | |||||
| if(record != null){ | if(record != null){ | ||||
| RedisCacheUtils.cache(wxAppinfoRedisTemplate, key, record, 3600*24*7); | RedisCacheUtils.cache(wxAppinfoRedisTemplate, key, record, 3600*24*7); | ||||
| } | } | ||||
| @@ -19,11 +19,7 @@ import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.pay.*; | 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 com.iformall.utils.*; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -45,13 +41,13 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| WxAppinfoMapper wxAppinfoMapper; | |||||
| WxAppinfoService wxAppinfoService; | |||||
| @Autowired | @Autowired | ||||
| WxPayAccountBillMapper wxPayAccountBillMapper; | WxPayAccountBillMapper wxPayAccountBillMapper; | ||||
| @Autowired | @Autowired | ||||
| WxPayAccountMapper wxPayAccountMapper; | |||||
| WxPayAccountService wxPayAccountService; | |||||
| @Autowired | @Autowired | ||||
| WxPayBillMapper wxPayBillMapper; | WxPayBillMapper wxPayBillMapper; | ||||
| @@ -132,7 +128,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||||
| return new ResultData(ErrorCode.BILL_OWE_ZERO); | return new ResultData(ErrorCode.BILL_OWE_ZERO); | ||||
| } | } | ||||
| //获取支付账户信息 | //获取支付账户信息 | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||||
| Date currentDate = new Date(); | Date currentDate = new Date(); | ||||
| String payBillNo; | String payBillNo; | ||||
| WxPayBill billParam= new WxPayBill(); | WxPayBill billParam= new WxPayBill(); | ||||
| @@ -362,7 +358,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||||
| private String wechatPayBillQuery(WxAppinfo appInfo, WxPayBill record) { | private String wechatPayBillQuery(WxAppinfo appInfo, WxPayBill record) { | ||||
| // get payAccount | // get payAccount | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||||
| if (payAccount.getType().equals(EnumPayMode.MCH.getCode())) { | if (payAccount.getType().equals(EnumPayMode.MCH.getCode())) { | ||||
| // 普通商户号模式 | // 普通商户号模式 | ||||
| WxPayOrderQ payBillQ = new WxPayOrderQ(); | WxPayOrderQ payBillQ = new WxPayOrderQ(); | ||||
| @@ -459,7 +455,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||||
| private String wechatPayBillClose(WxAppinfo appInfo, WxPayBill record) { | private String wechatPayBillClose(WxAppinfo appInfo, WxPayBill record) { | ||||
| // get payAccount | // get payAccount | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appInfo.getPayId()); | |||||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||||
| if (payAccount.getType().equals(EnumPayMode.MCH.getCode())) { | if (payAccount.getType().equals(EnumPayMode.MCH.getCode())) { | ||||
| // 普通商户号模式 | // 普通商户号模式 | ||||
| WxPayOrderQ payBillC = new WxPayOrderQ(); | WxPayOrderQ payBillC = new WxPayOrderQ(); | ||||
| @@ -590,21 +586,21 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||||
| boolean isNormal = true; | boolean isNormal = true; | ||||
| if (StringUtils.isBlank(subAppId) && StringUtils.isBlank(subMchId)) { | if (StringUtils.isBlank(subAppId) && StringUtils.isBlank(subMchId)) { | ||||
| // 普通商户号 | // 普通商户号 | ||||
| appinfo = wxAppinfoMapper.findByAppId(appId,tenantId); | |||||
| appinfo = wxAppinfoService.getByAppIdFromRedis(appId,tenantId); | |||||
| if (appinfo == null) { | if (appinfo == null) { | ||||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| isNormal = true; | isNormal = true; | ||||
| } else { | } else { | ||||
| // 服务号 现在用hmac-sha256 | // 服务号 现在用hmac-sha256 | ||||
| appinfo = wxAppinfoMapper.findByAppId(subAppId,tenantId); | |||||
| appinfo = wxAppinfoService.getByAppIdFromRedis(subAppId,tenantId); | |||||
| if (appinfo == null) { | if (appinfo == null) { | ||||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| isNormal = false; | isNormal = false; | ||||
| } | } | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appinfo.getPayId()); | |||||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); | |||||
| if (payAccount == null) { | if (payAccount == null) { | ||||
| throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); | throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); | ||||
| } | } | ||||
| @@ -801,7 +797,7 @@ public class WxPayBillServiceImpl implements WxPayBillService { | |||||
| WxAppinfo appinfoQ = new WxAppinfo(); | WxAppinfo appinfoQ = new WxAppinfo(); | ||||
| appinfoQ.setTenantId(bill.get("tenantId").toString()); | appinfoQ.setTenantId(bill.get("tenantId").toString()); | ||||
| appinfoQ.setType(EnumAppType.B.getCode()); | appinfoQ.setType(EnumAppType.B.getCode()); | ||||
| List<WxAppinfo> appList = wxAppinfoMapper.selectList(new QueryWrapper(appinfoQ)); | |||||
| List<WxAppinfo> appList = wxAppinfoService.getList(appinfoQ); | |||||
| if (appList.size() > 0) { | if (appList.size() > 0) { | ||||
| appInfo = appList.get(0); | appInfo = appList.get(0); | ||||
| } | } | ||||
| @@ -76,7 +76,7 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService { | |||||
| return; | return; | ||||
| } | } | ||||
| if(0 == msg.getOnOff().intValue()){ | 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())){ | if(EnumTemplateType.TT_SEND_COUPON_REMIND.getCode().equals(msg.getType())){ | ||||
| //发抖音 | //发抖音 | ||||
| TtMaService ttappService = maUtil.getTtMaService(appInfo); | TtMaService ttappService = maUtil.getTtMaService(appInfo); | ||||
| @@ -18,11 +18,12 @@ import com.iformall.enums.EnumPayType; | |||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.enums.EnumRefundStatus; | import com.iformall.enums.EnumRefundStatus; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxAppinfoMapper; | |||||
| import com.iformall.mapper.WxPayAccountMapper; | import com.iformall.mapper.WxPayAccountMapper; | ||||
| import com.iformall.mapper.WxPayOrderMapper; | import com.iformall.mapper.WxPayOrderMapper; | ||||
| import com.iformall.mapper.WxRefundOrderMapper; | import com.iformall.mapper.WxRefundOrderMapper; | ||||
| import com.iformall.service.WxAppinfoService; | |||||
| import com.iformall.service.WxOrderService; | 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.RefundPayAdapterService; | ||||
| import com.iformall.service.pay.service.refund.entity.RefundAdapterResult; | import com.iformall.service.pay.service.refund.entity.RefundAdapterResult; | ||||
| import com.iformall.service.pay.service.refund.entity.RefundNotifyAdapterResult; | import com.iformall.service.pay.service.refund.entity.RefundNotifyAdapterResult; | ||||
| @@ -158,9 +159,9 @@ public class TtRefundAdapterService implements RefundPayAdapterService{ | |||||
| } | } | ||||
| @Autowired | @Autowired | ||||
| WxAppinfoMapper wxAppinfoMapper; | |||||
| WxAppinfoService wxAppinfoService; | |||||
| @Autowired | @Autowired | ||||
| WxPayAccountMapper wxPayAccountMapper; | |||||
| WxPayAccountService wxPayAccountService; | |||||
| @Autowired | @Autowired | ||||
| WxPayOrderMapper wxPayOrderMapper; | WxPayOrderMapper wxPayOrderMapper; | ||||
| @Autowired | @Autowired | ||||
| @@ -194,12 +195,12 @@ public class TtRefundAdapterService implements RefundPayAdapterService{ | |||||
| WxRefundOrder refundOrder = wxRefundOrderMapper.selectById(refundOrderId); | WxRefundOrder refundOrder = wxRefundOrderMapper.selectById(refundOrderId); | ||||
| String appId = paramMap.get("appid"); | String appId = paramMap.get("appid"); | ||||
| WxAppinfo appinfo = wxAppinfoMapper.findByAppId(appId,tenantId); | |||||
| WxAppinfo appinfo = wxAppinfoService.getByAppIdFromRedis(appId,tenantId); | |||||
| if (appinfo == null) { | if (appinfo == null) { | ||||
| log.error("未找到appid信息:" + appId); | log.error("未找到appid信息:" + appId); | ||||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| WxPayAccount payAccount = wxPayAccountMapper.selectById(appinfo.getPayId()); | |||||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); | |||||
| if (payAccount == null) { | if (payAccount == null) { | ||||
| log.error("未找到mch_id信息:" + appId); | log.error("未找到mch_id信息:" + appId); | ||||
| throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); | throw new MallinkException(ErrorCode.MCH_INFO_NOT_FOUND); | ||||
| @@ -236,7 +236,7 @@ public class HomeController extends BaseController { | |||||
| logger.error("appid信息未提供"); | logger.error("appid信息未提供"); | ||||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | ||||
| } | } | ||||
| WxAppinfo appinfo = appinfoService.getByAppId(user.getTenantId()); | |||||
| WxAppinfo appinfo = appinfoService.getOnlyByAppIdFromRedis(user.getTenantId()); | |||||
| if (appinfo == null) { | if (appinfo == null) { | ||||
| logger.error("appid未找到"); | logger.error("appid未找到"); | ||||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | ||||
| @@ -70,8 +70,8 @@ public class TtOrderCallbackController extends BaseController { | |||||
| String appid = (String) pMap.get("appid"); | String appid = (String) pMap.get("appid"); | ||||
| String cp_orderno = (String) pMap.get("cp_orderno");//开发者传入订单号 | String cp_orderno = (String) pMap.get("cp_orderno");//开发者传入订单号 | ||||
| String way = (String) pMap.get("way");//2-支付宝,1-微信 | 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<>(); | Map<String,Object> paramMap = new HashMap<>(); | ||||
| paramMap.put("token",payAccount.getNotifyToken()); | paramMap.put("token",payAccount.getNotifyToken()); | ||||
| paramMap.put("timestamp",timestamp); | paramMap.put("timestamp",timestamp); | ||||
| @@ -79,7 +79,7 @@ public class TtUserGrantController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "code不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "code不能为空"); | ||||
| } | } | ||||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(appId); | |||||
| WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appId); | |||||
| if(wxAppinfo == null){ | if(wxAppinfo == null){ | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| @@ -263,7 +263,7 @@ public class TtUserGrantController extends BaseController { | |||||
| if (user != null) { | if (user != null) { | ||||
| logger.debug(user.toString()); | logger.debug(user.toString()); | ||||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); | |||||
| WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(user.getAppId()); | |||||
| TtMaService ttMaService = maUtil.getTtMaService(wxAppinfo); | TtMaService ttMaService = maUtil.getTtMaService(wxAppinfo); | ||||
| String session_key = user.getSessionKey(); | String session_key = user.getSessionKey(); | ||||
| @@ -350,7 +350,7 @@ public class TtUserGrantController extends BaseController { | |||||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | return new ResultData(ErrorCode.USER_IS_EMPTY); | ||||
| } | } | ||||
| WxAppinfo wxAppinfo = wxAppinfoService.getByAppId(user.getAppId()); | |||||
| WxAppinfo wxAppinfo = wxAppinfoService.getOnlyByAppIdFromRedis(user.getAppId()); | |||||
| TtMaService ttMaService = maUtil.getTtMaService(wxAppinfo); | TtMaService ttMaService = maUtil.getTtMaService(wxAppinfo); | ||||
| String session_key = user.getSessionKey(); | String session_key = user.getSessionKey(); | ||||