| @@ -371,15 +371,7 @@ public class WxMerchantController extends BaseController { | |||||
| if(merchant == null){ | if(merchant == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||||
| if(appInfo == null) { | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId()); | |||||
| if(payAcount == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| return wxProfitSharingReceiverService.updateTtReceiver(merchant,appInfo.getAppId(),payAcount.getApiKey()); | |||||
| return wxProfitSharingReceiverService.updateTtReceiver(merchant); | |||||
| } | } | ||||
| @@ -400,19 +392,10 @@ public class WxMerchantController extends BaseController { | |||||
| if(anEnum == null){ | if(anEnum == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||||
| if(appInfo == null) { | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId()); | |||||
| if(payAcount == null){ | |||||
| return new ResultData(ErrorCode.API_KEY_NOT_FOUND); | |||||
| } | |||||
| if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | ||||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); | |||||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); | |||||
| }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | ||||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); | |||||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); | |||||
| }else{ | }else{ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| @@ -436,7 +419,7 @@ public class WxMerchantController extends BaseController { | |||||
| if(payAcount == null){ | if(payAcount == null){ | ||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | ||||
| } | } | ||||
| return wxProfitSharingReceiverService.updateTtReceiverIsUse(merchant,appInfo.getAppId(),payAcount.getApiKey()); | |||||
| return wxProfitSharingReceiverService.updateTtReceiverIsUse(merchant); | |||||
| } | } | ||||
| } | } | ||||
| @@ -13,4 +13,11 @@ where type = 0; | |||||
| update `mallink`.`wx_pay_account` set private_key_path = null,cert_serial_no = null,api_v3_key = null | update `mallink`.`wx_pay_account` set private_key_path = null,cert_serial_no = null,api_v3_key = null | ||||
| where type = 0; | where type = 0; | ||||
| update `mallink`.`wx_pay_account` set merchant_api_key = api_key | |||||
| where type = 0; | |||||
| update `mallink`.`wx_pay_account` set api_key = null | |||||
| where type = 0; | |||||
| --清缓存,重启项目 | --清缓存,重启项目 | ||||
| @@ -184,18 +184,10 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); | |||||
| if(appInfo == null) { | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId()); | |||||
| if(payAcount == null){ | |||||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | ||||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); | |||||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); | |||||
| }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | ||||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); | |||||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); | |||||
| }else{ | }else{ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| @@ -45,33 +45,15 @@ public class TtMerchantReciverSchedule { | |||||
| @Scheduled(cron = "0 */30 * * * ?") | @Scheduled(cron = "0 */30 * * * ?") | ||||
| // @Scheduled(cron = "0 */5 * * * *?") //测试五分钟执行 | // @Scheduled(cron = "0 */5 * * * *?") //测试五分钟执行 | ||||
| public void updateMerchantReciverSchedule() { | public void updateMerchantReciverSchedule() { | ||||
| WxMall mallQ = new WxMall(); | |||||
| mallQ.setSaleType(EnumSaleType.TT_ALL_ROUND.getCode()); | |||||
| List<WxMall> mallList = wxMallService.findList(mallQ); | |||||
| if(mallList == null || mallList.isEmpty()){ | |||||
| return; | |||||
| } | |||||
| List<String> tenantIds = mallList.stream().map(m -> m.getTenantId()).collect(Collectors.toList()); | |||||
| List<WxAppinfo> ttAppInfos = getTTAppInfos(); | |||||
| List<String> tenantIds = ttAppInfos.stream().map(appinfo -> appinfo.getTenantId()).collect(Collectors.toList()); | |||||
| List<WxMerchant> merchants = wxMerchantMapper.findByTenantIds(tenantIds); | List<WxMerchant> merchants = wxMerchantMapper.findByTenantIds(tenantIds); | ||||
| if(merchants == null || merchants.isEmpty()){ | if(merchants == null || merchants.isEmpty()){ | ||||
| return; | return; | ||||
| } | } | ||||
| Map<String, String> appIdMap = new HashMap<>(); | |||||
| Map<String, String> payAccountKeyMap = new HashMap<>(); | |||||
| WxAppinfo appQ = new WxAppinfo(); | |||||
| appQ.setType(EnumAppType.C.getCode()); | |||||
| appQ.setPlat(EnumPayWay.PAY_WAY_TT.getPlat().getCode()); | |||||
| List<WxAppinfo> wxAppinfoList = wxAppinfoService.getList(appQ); | |||||
| for (WxAppinfo wxAppinfo:wxAppinfoList) { | |||||
| appIdMap.put(wxAppinfo.getTenantId(),wxAppinfo.getAppId()); | |||||
| WxPayAccount wxPayAccount = payAccountService.getById(wxAppinfo.getPayId()); | |||||
| if(wxPayAccount != null){ | |||||
| payAccountKeyMap.put(wxAppinfo.getTenantId(),wxPayAccount.getApiKey()); | |||||
| } | |||||
| } | |||||
| for (WxMerchant m:merchants) { | for (WxMerchant m:merchants) { | ||||
| // try { | // try { | ||||
| // wxProfitSharingReceiverService.updateTtReceiver(m,appIdMap.get(m.getTenantId()),payAccountKeyMap.get(m.getTenantId())); | // wxProfitSharingReceiverService.updateTtReceiver(m,appIdMap.get(m.getTenantId()),payAccountKeyMap.get(m.getTenantId())); | ||||
| @@ -80,7 +62,7 @@ public class TtMerchantReciverSchedule { | |||||
| // logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e); | // logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e); | ||||
| // } | // } | ||||
| try { | try { | ||||
| wxProfitSharingReceiverService.updateTtReceiverIsUse(m,appIdMap.get(m.getTenantId()),payAccountKeyMap.get(m.getTenantId())); | |||||
| wxProfitSharingReceiverService.updateTtReceiverIsUse(m); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e); | logger.error("TtMerchantReciverSchedule error.updateTtReceiver:"+m.getId(),e); | ||||
| @@ -88,4 +70,12 @@ public class TtMerchantReciverSchedule { | |||||
| } | } | ||||
| } | } | ||||
| private List<WxAppinfo> getTTAppInfos() { | |||||
| WxAppinfo appinfo =new WxAppinfo(); | |||||
| appinfo.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||||
| appinfo.setType(EnumAppType.C.getCode()); | |||||
| appinfo.setEnable(EnumEnableType.Enable.getCode()); | |||||
| return wxAppinfoService.getList(appinfo); | |||||
| } | |||||
| } | } | ||||
| @@ -46,10 +46,8 @@ public class TtOrderQueryCpsSchedule { | |||||
| @Scheduled(cron = "0 5 */1 * * ?") | @Scheduled(cron = "0 5 */1 * * ?") | ||||
| // @Scheduled(cron = "0 0/5 * * * ?") | // @Scheduled(cron = "0 0/5 * * * ?") | ||||
| public void OrderPushErrorTaskSchedule() { | public void OrderPushErrorTaskSchedule() { | ||||
| WxAppinfo appQ = new WxAppinfo(); | |||||
| appQ.setType(EnumAppType.C.getCode()); | |||||
| appQ.setPlat(EnumPayWay.PAY_WAY_TT.getPlat().getCode()); | |||||
| List<WxAppinfo> wxAppinfoList = wxAppinfoService.getList(appQ); | |||||
| List<WxAppinfo> wxAppinfoList = this.getTTAppInfos(); | |||||
| for (WxAppinfo appinfo:wxAppinfoList) { | for (WxAppinfo appinfo:wxAppinfoList) { | ||||
| try{ | try{ | ||||
| WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); | WxPayAccount payAccount = wxPayAccountService.getById(appinfo.getPayId()); | ||||
| @@ -117,4 +115,12 @@ public class TtOrderQueryCpsSchedule { | |||||
| } | } | ||||
| private List<WxAppinfo> getTTAppInfos() { | |||||
| WxAppinfo appinfo =new WxAppinfo(); | |||||
| appinfo.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||||
| appinfo.setType(EnumAppType.C.getCode()); | |||||
| appinfo.setEnable(EnumEnableType.Enable.getCode()); | |||||
| return wxAppinfoService.getList(appinfo); | |||||
| } | |||||
| } | } | ||||
| @@ -54,12 +54,12 @@ public interface WxProfitSharingReceiverService { | |||||
| void sendMsg(String phone, String account, String merchant, String time, Integer modelType, TenantEntity tenantEntity); | void sendMsg(String phone, String account, String merchant, String time, Integer modelType, TenantEntity tenantEntity); | ||||
| ResultData updateTtReceiver(WxMerchant merchant, String appId, String payAccountKey); | |||||
| ResultData updateTtReceiver(WxMerchant merchant); | |||||
| ResultData getTtReceiverImprotURL(WxMerchant merchant, String appId, String payAccountKey); | |||||
| ResultData getTtReceiverImprotURL(WxMerchant merchant); | |||||
| ResultData getTtReceiverBalanceURL(WxMerchant merchant, String appId, String payAccountKey); | |||||
| ResultData getTtReceiverBalanceURL(WxMerchant merchant); | |||||
| ResultData updateTtReceiverIsUse(WxMerchant merchant, String appId, String payAccountKey); | |||||
| ResultData updateTtReceiverIsUse(WxMerchant merchant); | |||||
| } | } | ||||
| @@ -267,14 +267,14 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData updateTtReceiver(WxMerchant merchant, String appId, String payAccountKey) { | |||||
| if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) { | |||||
| public ResultData updateTtReceiver(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | ||||
| //进件页面 | //进件页面 | ||||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||||
| if(improt_URLResult.isSuccess()){ | if(improt_URLResult.isSuccess()){ | ||||
| wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | ||||
| wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); | wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); | ||||
| @@ -282,7 +282,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | ||||
| } | } | ||||
| //余额页面 | //余额页面 | ||||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||||
| if(balance_URLResult.isSuccess()){ | if(balance_URLResult.isSuccess()){ | ||||
| wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | ||||
| wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | ||||
| @@ -294,13 +294,13 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData getTtReceiverImprotURL(WxMerchant merchant, String appId, String payAccountKey) { | |||||
| if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) { | |||||
| public ResultData getTtReceiverImprotURL(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | ||||
| //进件页面 | //进件页面 | ||||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||||
| if(improt_URLResult.isSuccess()){ | if(improt_URLResult.isSuccess()){ | ||||
| wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | ||||
| wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); | wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); | ||||
| @@ -313,13 +313,13 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData getTtReceiverBalanceURL(WxMerchant merchant, String appId, String payAccountKey) { | |||||
| if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) { | |||||
| public ResultData getTtReceiverBalanceURL(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | ||||
| //余额页面 | //余额页面 | ||||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(appId,payAccountKey,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||||
| if(balance_URLResult.isSuccess()){ | if(balance_URLResult.isSuccess()){ | ||||
| wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | ||||
| wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | ||||
| @@ -350,10 +350,19 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData updateTtReceiverIsUse(WxMerchant merchant, String appId, String payAccountKey) { | |||||
| if(merchant == null || StringUtils.isBlank(appId) || StringUtils.isBlank(payAccountKey)) { | |||||
| public ResultData updateTtReceiverIsUse(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(merchant.getTenantId(), EnumAppPlat.TOUTIAO); | |||||
| if(appInfo == null){ | |||||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| WxPayAccount payAcount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||||
| if(payAcount == null){ | |||||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | |||||
| } | |||||
| WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | ||||
| oldReceiver.updateTenantInfo(merchant); | oldReceiver.updateTenantInfo(merchant); | ||||
| oldReceiver.setMerchantId(merchant.getId()); | oldReceiver.setMerchantId(merchant.getId()); | ||||
| @@ -363,7 +372,8 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| if(wxProfitSharingReceiver == null){ | if(wxProfitSharingReceiver == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到分账信息"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到分账信息"); | ||||
| } | } | ||||
| QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appId, payAccountKey, wxProfitSharingReceiver.getReceiverAccount(), wxProfitSharingReceiver.getMerchantId().toString(), null); | |||||
| QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appInfo.getAppId(), payAcount.getMerchantApiKey(), wxProfitSharingReceiver.getReceiverAccount(), wxProfitSharingReceiver.getMerchantId().toString(), null); | |||||
| if(queryMerchantResult != null){ | if(queryMerchantResult != null){ | ||||
| // if(queryMerchantResult.getWx().intValue() != 1){ | // if(queryMerchantResult.getWx().intValue() != 1){ | ||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"微信渠道未进件成功!"); | // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"微信渠道未进件成功!"); | ||||
| @@ -380,10 +390,18 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| } | } | ||||
| } | } | ||||
| private AppAddSubMerchantResult appAddSubMerchant(String appId, String payAccountKey, String merchantId, AppAddSubMerchantUrlType appAddSubMerchantUrlType){ | |||||
| private AppAddSubMerchantResult appAddSubMerchant(TenantEntity tenantEntity, String merchantId, AppAddSubMerchantUrlType appAddSubMerchantUrlType){ | |||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfoFromRedis(tenantEntity.getTenantId(), EnumAppPlat.TOUTIAO); | |||||
| if(appInfo == null){ | |||||
| throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); | |||||
| } | |||||
| WxPayAccount payAcount = wxPayAccountService.getByIdFromRedis(appInfo.getPayId()); | |||||
| if(payAcount == null){ | |||||
| throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND); | |||||
| } | |||||
| AppAddSubMerchant appAddSubMerchant = new AppAddSubMerchant(); | AppAddSubMerchant appAddSubMerchant = new AppAddSubMerchant(); | ||||
| appAddSubMerchant.setAppId(appId); | |||||
| appAddSubMerchant.setSalt(payAccountKey); | |||||
| appAddSubMerchant.setAppId(appInfo.getAppId()); | |||||
| appAddSubMerchant.setSalt(payAcount.getMerchantApiKey()); | |||||
| appAddSubMerchant.setSubMerchantId(merchantId); | appAddSubMerchant.setSubMerchantId(merchantId); | ||||
| appAddSubMerchant.setUrlType(appAddSubMerchantUrlType.getCode()); | appAddSubMerchant.setUrlType(appAddSubMerchantUrlType.getCode()); | ||||
| return DouYinPayHelper.appAddSubMerchant(appAddSubMerchant); | return DouYinPayHelper.appAddSubMerchant(appAddSubMerchant); | ||||
| @@ -248,7 +248,7 @@ public class TtOrderServiceImpl implements TtOrderService { | |||||
| DouYinCreatePreOrder preOrder = new DouYinCreatePreOrder(); | DouYinCreatePreOrder preOrder = new DouYinCreatePreOrder(); | ||||
| preOrder.setAppId(appInfo.getAppId()); | preOrder.setAppId(appInfo.getAppId()); | ||||
| preOrder.setSercrect(appInfo.getSecret()); | preOrder.setSercrect(appInfo.getSecret()); | ||||
| preOrder.setSalt(payAcount.getApiKey()); | |||||
| preOrder.setSalt(payAcount.getMerchantApiKey()); | |||||
| preOrder.setOutOrderNo(order.getId().toString()); | preOrder.setOutOrderNo(order.getId().toString()); | ||||
| preOrder.setTotalAmount(order.getPayment()); | preOrder.setTotalAmount(order.getPayment()); | ||||
| preOrder.setSubject(coupon.getTitle()); | preOrder.setSubject(coupon.getTitle()); | ||||
| @@ -296,7 +296,7 @@ public class TtOrderServiceImpl implements TtOrderService { | |||||
| if(order.getOrderStatus() == EnumTtOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()){ | if(order.getOrderStatus() == EnumTtOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()){ | ||||
| String msg = ""; | String msg = ""; | ||||
| //待付款 | //待付款 | ||||
| OrderQueryResult orderQueryResult = DouYinPayHelper.orderQuery(appInfo.getAppId(), payAccount.getApiKey(), order.getId().toString(), null); | |||||
| OrderQueryResult orderQueryResult = DouYinPayHelper.orderQuery(appInfo.getAppId(), payAccount.getMerchantApiKey(), order.getId().toString(), null); | |||||
| if(orderQueryResult == null){ | if(orderQueryResult == null){ | ||||
| msg = "查询-单号不存在"; | msg = "查询-单号不存在"; | ||||
| }else{ | }else{ | ||||