| @@ -8,11 +8,8 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxAppinfo; | |||||
| import com.iformall.domain.po.WxPayAccount; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||||
| import com.iformall.domain.vo.WxMerchantTradeDetailVo; | import com.iformall.domain.vo.WxMerchantTradeDetailVo; | ||||
| import com.iformall.domain.vo.WxMerchantTradeVo; | import com.iformall.domain.vo.WxMerchantTradeVo; | ||||
| import com.iformall.domain.vo.WxMerchantVo; | import com.iformall.domain.vo.WxMerchantVo; | ||||
| @@ -55,6 +52,10 @@ public class WxMerchantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | private WxProfitSharingReceiverService wxProfitSharingReceiverService; | ||||
| @Autowired | |||||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| @UserDataRuleAnnotation("merchant_list") | @UserDataRuleAnnotation("merchant_list") | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("listVo") | @GetMapping("listVo") | ||||
| @@ -392,7 +393,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(),"请检查传递参数"); | ||||
| } | } | ||||
| return wxProfitSharingReceiverService.updateTtReceiver(merchant); | |||||
| return wxProfitPaymentReceiverService.updateTtReceiver(merchant); | |||||
| } | } | ||||
| @@ -414,9 +415,9 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | ||||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); | |||||
| return wxProfitPaymentReceiverService.getTtReceiverImprotURL(merchant); | |||||
| }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | ||||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); | |||||
| return wxProfitPaymentReceiverService.getTtReceiverBalanceURL(merchant); | |||||
| }else{ | }else{ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| @@ -440,7 +441,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); | |||||
| return wxProfitPaymentReceiverService.updateTtReceiverImportStatus(merchant); | |||||
| } | } | ||||
| @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") | @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") | ||||
| @@ -466,7 +467,7 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号名称不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号名称不能为空"); | ||||
| } | } | ||||
| wxMerchant.updateTenantInfo(getTenantInfo()); | wxMerchant.updateTenantInfo(getTenantInfo()); | ||||
| return wxMerchantService.updateMerchantAccount(wxMerchant,false); | |||||
| return wxMerchantService.updateMerchantAccount(wxMerchant); | |||||
| } | } | ||||
| @ApiOperation("删除分账账户") | @ApiOperation("删除分账账户") | ||||
| @@ -479,7 +480,7 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户分账账户ID不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户分账账户ID不能为空"); | ||||
| } | } | ||||
| receiver.updateTenantInfo(getTenantInfo()); | receiver.updateTenantInfo(getTenantInfo()); | ||||
| return wxProfitSharingReceiverService.delReceiver(receiver, EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode(),false); | |||||
| return wxProfitSharingReceiverService.delReceiver(receiver, EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,6 @@ | |||||
| --创建收款帐号表 | |||||
| --备份分账帐号表 | |||||
| --将微信进件的数据转移到收款帐号表里--并将原数据删除 | |||||
| --将抖音进件的数据转移到收款帐号表里--原数据修改ReceiverType =10 | |||||
| @@ -27,6 +27,9 @@ public class WxMerchantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantService wxMerchantService; | private WxMerchantService wxMerchantService; | ||||
| @Autowired | |||||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| @Autowired | @Autowired | ||||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | private WxProfitSharingReceiverService wxProfitSharingReceiverService; | ||||
| @@ -45,7 +48,7 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(wxMerchantService.findList(getTenantInfo())); | return new ResultData(wxMerchantService.findList(getTenantInfo())); | ||||
| } | } | ||||
| @ApiOperation("查询账户信息") | |||||
| @ApiOperation("微信查询分账信息") | |||||
| @GetMapping("/findAccountById") | @GetMapping("/findAccountById") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData findAccountById(@ModelAttribute WxMerchant wxMerchant) { | public ResultData findAccountById(@ModelAttribute WxMerchant wxMerchant) { | ||||
| @@ -60,18 +63,11 @@ public class WxMerchantController extends BaseController { | |||||
| if(payAccount == null){ | if(payAccount == null){ | ||||
| return new ResultData(ErrorCode.API_KEY_NOT_FOUND); | return new ResultData(ErrorCode.API_KEY_NOT_FOUND); | ||||
| } | } | ||||
| EnumProfitSharingType enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT; | |||||
| if(EnumPayMchType.TOTAL.getCode().equals(payAccount.getMchType())){ | |||||
| enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT; | |||||
| }else if(EnumPayMchType.DIRECT.getCode().equals(payAccount.getMchType())){ | |||||
| enumSharingType = EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2; | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.APP_PLAT_ERROR); | |||||
| } | |||||
| return new ResultData(wxProfitSharingReceiverService.findReceiver(tenantInfo,wxMerchant.getId(), EnumAppPlat.WX,enumSharingType)); | |||||
| return new ResultData(wxProfitSharingReceiverService.findReceiver(tenantInfo,wxMerchant.getId(), EnumAppPlat.WX)); | |||||
| } | } | ||||
| @ApiOperation("查询账户信息") | |||||
| @ApiOperation("抖音查询收款账户信息") | |||||
| @GetMapping("/findTtAccountById") | @GetMapping("/findTtAccountById") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData findTtAccountById(@ModelAttribute WxMerchant wxMerchant) { | public ResultData findTtAccountById(@ModelAttribute WxMerchant wxMerchant) { | ||||
| @@ -80,7 +76,7 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); | ||||
| } | } | ||||
| wxMerchant.updateTenantInfo(getTenantInfo()); | wxMerchant.updateTenantInfo(getTenantInfo()); | ||||
| return new ResultData(wxProfitSharingReceiverService.findReceiver(getTenantInfo(),wxMerchant.getId(), EnumAppPlat.TOUTIAO,EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN)); | |||||
| return new ResultData(wxProfitPaymentReceiverService.findReceiver(getTenantInfo(),wxMerchant.getId(), EnumAppPlat.TOUTIAO,EnumProfitPaymentReceiverType.tt_merchant_number)); | |||||
| } | } | ||||
| @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") | @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") | ||||
| @@ -106,7 +102,7 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号名称不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "账号名称不能为空"); | ||||
| } | } | ||||
| wxMerchant.updateTenantInfo(getTenantInfo()); | wxMerchant.updateTenantInfo(getTenantInfo()); | ||||
| return wxMerchantService.updateMerchantAccount(wxMerchant,true); | |||||
| return wxMerchantService.updateMerchantAccount(wxMerchant); | |||||
| } | } | ||||
| @ApiOperation("删除分账账户") | @ApiOperation("删除分账账户") | ||||
| @@ -121,7 +117,7 @@ public class WxMerchantController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户分账账户ID不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户分账账户ID不能为空"); | ||||
| } | } | ||||
| receiver.updateTenantInfo(getTenantInfo()); | receiver.updateTenantInfo(getTenantInfo()); | ||||
| return wxProfitSharingReceiverService.delReceiver(receiver, EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode(),true); | |||||
| return wxProfitSharingReceiverService.delReceiver(receiver, EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode()); | |||||
| } | } | ||||
| @ApiOperation("查询是否有权限修改账户") | @ApiOperation("查询是否有权限修改账户") | ||||
| @@ -187,9 +183,9 @@ public class WxMerchantController extends BaseController { | |||||
| } | } | ||||
| if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ | ||||
| return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant); | |||||
| return wxProfitPaymentReceiverService.getTtReceiverImprotURL(merchant); | |||||
| }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ | ||||
| return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant); | |||||
| return wxProfitPaymentReceiverService.getTtReceiverBalanceURL(merchant); | |||||
| }else{ | }else{ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | ||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.WxProfitPaymentReceiver; | |||||
| import com.iformall.domain.po.WxProfitSharingReceiver; | import com.iformall.domain.po.WxProfitSharingReceiver; | ||||
| import com.iformall.domain.po.WxProfitSharingReceiverApply; | import com.iformall.domain.po.WxProfitSharingReceiverApply; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| @@ -12,6 +13,7 @@ import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.file.aliyun.AliyunOSS; | import com.iformall.file.aliyun.AliyunOSS; | ||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxProfitPaymentReceiverService; | |||||
| import com.iformall.service.WxProfitSharingReceiverApplyService; | import com.iformall.service.WxProfitSharingReceiverApplyService; | ||||
| import com.iformall.service.WxProfitSharingReceiverService; | import com.iformall.service.WxProfitSharingReceiverService; | ||||
| import com.iformall.utils.ImgYwsqhUtil; | import com.iformall.utils.ImgYwsqhUtil; | ||||
| @@ -44,7 +46,7 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||||
| private WxProfitSharingReceiverApplyService wxProfitSharingReceiverApplyService; | private WxProfitSharingReceiverApplyService wxProfitSharingReceiverApplyService; | ||||
| @Autowired | @Autowired | ||||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantService wxMerchantService; | private WxMerchantService wxMerchantService; | ||||
| @@ -85,7 +87,7 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||||
| if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ | if(merchant == null || EnumMerchantStatus.NOT_VALID.getCode().equals(merchant.getStatus())){ | ||||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID.getCode(),"商户不存在或已停用"); | return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID.getCode(),"商户不存在或已停用"); | ||||
| } | } | ||||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(merchant, merchant.getId(), EnumAppPlat.WX, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); | |||||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(merchant, merchant.getId(), EnumAppPlat.WX, EnumProfitPaymentReceiverType.wx_special_merchant_number); | |||||
| if(receiver != null && MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())){ | if(receiver != null && MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户已进件成功"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户已进件成功"); | ||||
| } | } | ||||
| @@ -90,9 +90,9 @@ public class WxCarController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| WxPayAccountService wxPayAccountService; | WxPayAccountService wxPayAccountService; | ||||
| @Autowired | @Autowired | ||||
| WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||||
| WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| @Autowired | @Autowired | ||||
| @Qualifier("objectCommonRedisTemplate") | @Qualifier("objectCommonRedisTemplate") | ||||
| @@ -470,14 +470,14 @@ public class WxCarController extends BaseController { | |||||
| return new ResultData(Result.ERROR,"未设置停车商户."); | return new ResultData(Result.ERROR,"未设置停车商户."); | ||||
| } | } | ||||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(park, parkMerchant.getId(), EnumAppPlat.WX, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); | |||||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(park, parkMerchant.getId(), EnumAppPlat.WX, EnumProfitPaymentReceiverType.wx_special_merchant_number); | |||||
| if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { | if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { | ||||
| //查询商官商户 | //查询商官商户 | ||||
| WxMerchant adminMerchant = wxMerchantService.findAdmin(park); | WxMerchant adminMerchant = wxMerchantService.findAdmin(park); | ||||
| if (null == adminMerchant) { | if (null == adminMerchant) { | ||||
| return new ResultData(Result.ERROR,"未找到商管商户."); | return new ResultData(Result.ERROR,"未找到商管商户."); | ||||
| } | } | ||||
| receiver = wxProfitSharingReceiverService.findReceiver(park, adminMerchant.getId(), EnumAppPlat.WX, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); | |||||
| receiver = wxProfitPaymentReceiverService.findReceiver(park, adminMerchant.getId(), EnumAppPlat.WX, EnumProfitPaymentReceiverType.wx_special_merchant_number); | |||||
| if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { | if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { | ||||
| return new ResultData(Result.ERROR,"商管商户未设置收款账号."); | return new ResultData(Result.ERROR,"商管商户未设置收款账号."); | ||||
| } | } | ||||
| @@ -37,7 +37,7 @@ public class TtMerchantReciverSchedule { | |||||
| private WxPayAccountService payAccountService; | private WxPayAccountService payAccountService; | ||||
| @Autowired | @Autowired | ||||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||||
| private WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| /** | /** | ||||
| @@ -64,7 +64,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); | |||||
| wxProfitPaymentReceiverService.updateTtReceiverImportStatus(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); | ||||
| @@ -196,20 +196,14 @@ public class WxMerchant extends TenantEntity { | |||||
| return String.join("\n", | return String.join("\n", | ||||
| wxProfitSharingReceiver.stream().map(r->{ | wxProfitSharingReceiver.stream().map(r->{ | ||||
| StringBuffer str = new StringBuffer(); | StringBuffer str = new StringBuffer(); | ||||
| if(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2.getCode().equals(r.getSharingType())){ | |||||
| str.append("微信特约商户号:"); | |||||
| }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode().equals(r.getSharingType())){ | |||||
| str.append("抖音商户号:"); | |||||
| }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_BANK.getCode().equals(r.getSharingType())){ | |||||
| str.append("银行卡号:"); | |||||
| }else if(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode().equals(r.getSharingType())){ | |||||
| if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode().equals(r.getReceiverType())){ | |||||
| if(EnumProfitSharingType.PROFIT_SHARING_TYPE_SYS.getCode().equals(r.getSharingType())){ | |||||
| if(EnumProfitPaymentReceiverType.wx_special_merchant_number.getCode().equals(r.getReceiverType())){ | |||||
| str.append("微信商户号:"); | str.append("微信商户号:"); | ||||
| }else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getCode().equals(r.getReceiverType())){ | |||||
| }else if(EnumProfitPaymentReceiverType.wx_personal_wechatid.getCode().equals(r.getReceiverType())){ | |||||
| str.append("个人微信号(微信已停用):"); | str.append("个人微信号(微信已停用):"); | ||||
| }else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_OPENID.getCode().equals(r.getReceiverType())){ | |||||
| }else if(EnumProfitPaymentReceiverType.wx_personal_openid.getCode().equals(r.getReceiverType())){ | |||||
| str.append("OPENID:"); | str.append("OPENID:"); | ||||
| } else if(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID.getCode().equals(r.getReceiverType())){ | |||||
| } else if(EnumProfitPaymentReceiverType.wx_personal_sub_openid.getCode().equals(r.getReceiverType())){ | |||||
| str.append("OPENID:"); | str.append("OPENID:"); | ||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,94 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.douyin.pay.orderQuery.QueryMerchantResult; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import java.util.Date; | |||||
| @TableName(value = "wx_profit_payment_receiver") | |||||
| @Data | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxProfitPaymentReceiver extends TenantEntity { | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private Long merchantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="收款帐号类型 EnumProfitPaymentReceiverType",name="receiverType") | |||||
| private Integer receiverType; | |||||
| @io.swagger.annotations.ApiModelProperty(value="收款商户号",name="receiverAccount") | |||||
| private String receiverAccount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="说明",name="receiverComments") | |||||
| private String receiverComments; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | |||||
| private Date createTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") | |||||
| private Date updateTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账接收方状态 0,正常 1,停用",name="status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value="平台 EnumAppPlat",name="plat") | |||||
| private Integer plat; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "进件状态", name = "ttImportStatus") | |||||
| private String ttImportStatus; | |||||
| @TableField(exist = false) | |||||
| private Integer wxImportStatus; | |||||
| @TableField(exist = false) | |||||
| private Integer alipayImportStatus; | |||||
| @TableField(exist = false) | |||||
| private Integer hzImportStatus; | |||||
| private QueryMerchantResult getMerchantResult(){ | |||||
| QueryMerchantResult queryMerchantResult = null; | |||||
| try{ | |||||
| if(StringUtils.isNotBlank(this.ttImportStatus)) { | |||||
| queryMerchantResult = JSON.parseObject(this.ttImportStatus, QueryMerchantResult.class); | |||||
| } | |||||
| }catch(Exception e){} | |||||
| if(queryMerchantResult == null){ | |||||
| queryMerchantResult = new QueryMerchantResult(); | |||||
| } | |||||
| return queryMerchantResult; | |||||
| } | |||||
| public Integer getWxImportStatus(){ | |||||
| return getMerchantResult().getWx(); | |||||
| } | |||||
| public Integer getAlipayImportStatus(){ | |||||
| return getMerchantResult().getAlipay(); | |||||
| } | |||||
| public Integer getHzImportStatus(){ | |||||
| return getMerchantResult().getHz(); | |||||
| } | |||||
| @io.swagger.annotations.ApiModelProperty(value = "进件页面", name = "ttImportUrl") | |||||
| private String ttImportUrl; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "余额页面", name = "ttBalanceUrl") | |||||
| private String ttBalanceUrl; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账金额(分)",name="sharingAmount") | |||||
| private Integer sharingAmount; | |||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value="真实费率",name="rateAmount") | |||||
| private Integer rateAmount; | |||||
| @TableField(exist = false) | |||||
| private Integer realRateAmount;//平台手续费 | |||||
| @TableField(exist = false) | |||||
| private Integer commissionAmount;//平台佣金 | |||||
| } | |||||
| @@ -30,7 +30,7 @@ public class WxProfitSharingReceiver extends TenantEntity { | |||||
| private Date createTime; | private Date createTime; | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") | @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") | ||||
| private Date updateTime; | private Date updateTime; | ||||
| @io.swagger.annotations.ApiModelProperty(value="分账类型:1-服务商户分账,2-商户转入银行卡",name="sharingType") | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumProfitSharingType 分账类型:1-服务商户分账,2-商户转入银行卡",name="sharingType") | |||||
| private Integer sharingType; | private Integer sharingType; | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="bankNo") | @io.swagger.annotations.ApiModelProperty(value="",name="bankNo") | ||||
| private String bankNo; | private String bankNo; | ||||
| @@ -0,0 +1,39 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumProfitPaymentReceiverType { | |||||
| wx_special_merchant_number(0, "MERCHANT_ID"),//微信特约商户号 | |||||
| wx_personal_wechatid(1, "PERSONAL_WECHATID"),//微信号 已不支持 | |||||
| wx_personal_openid(2, "PERSONAL_OPENID"),//v2,v3 | |||||
| wx_personal_sub_openid(3, "PERSONAL_SUB_OPENID"), | |||||
| tt_merchant_number(10,"")//抖音商户号 | |||||
| ; | |||||
| public static EnumProfitPaymentReceiverType getEnum(Integer code) { | |||||
| for (EnumProfitPaymentReceiverType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumProfitPaymentReceiverType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -4,11 +4,8 @@ package com.iformall.enums; | |||||
| * Created by Stormeye on 2018/08/09. | * Created by Stormeye on 2018/08/09. | ||||
| */ | */ | ||||
| public enum EnumProfitSharingType { | public enum EnumProfitSharingType { | ||||
| PROFIT_SHARING_TYPE_WECHAT(1, "微信分账"), | |||||
| PROFIT_SHARING_TYPE_BANK(2, "银行卡分账"), | |||||
| PROFIT_SHARING_TYPE_DOUYIN(3, "抖音进件"), | |||||
| PROFIT_SHARING_TYPE_WECHAT_v2(4, "微信特约商户进件"), | |||||
| PROFIT_SHARING_TYPE_SYS(1, "系统分账"), | |||||
| PROFIT_SHARING_TYPE_BANK(2, "银行卡打款"), | |||||
| ; | ; | ||||
| public static EnumProfitSharingType getEnum(Integer code) { | public static EnumProfitSharingType getEnum(Integer code) { | ||||
| @@ -0,0 +1,15 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxProfitPaymentReceiver; | |||||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||||
| import java.util.List; | |||||
| public interface WxProfitPaymentReceiverMapper extends CommonMapper<WxProfitPaymentReceiver, Long> { | |||||
| List<WxProfitPaymentReceiver> findList(WxProfitPaymentReceiver record); | |||||
| WxProfitPaymentReceiver findOne(WxProfitPaymentReceiver record); | |||||
| } | |||||
| @@ -10,5 +10,4 @@ public interface WxProfitSharingReceiverMapper extends CommonMapper<WxProfitShar | |||||
| WxProfitSharingReceiver findOne(WxProfitSharingReceiver wxProfitSharingReceiver); | WxProfitSharingReceiver findOne(WxProfitSharingReceiver wxProfitSharingReceiver); | ||||
| List<Long> findMerchantIdList(WxProfitSharingReceiver wxProfitSharingReceiver); | |||||
| } | } | ||||
| @@ -142,10 +142,9 @@ public interface WxMerchantService { | |||||
| /** | /** | ||||
| * | * | ||||
| * @param wxMerchant | * @param wxMerchant | ||||
| * @param isSync 是否需要同步第三方(微信总分模式需要) | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData updateMerchantAccount(WxMerchant wxMerchant,boolean isSync); | |||||
| ResultData updateMerchantAccount(WxMerchant wxMerchant); | |||||
| ResultData updateMerchantAdmin(WxMerchant wxMerchant); | ResultData updateMerchantAdmin(WxMerchant wxMerchant); | ||||
| @@ -0,0 +1,70 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxProfitPaymentReceiver; | |||||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.enums.EnumAppPlat; | |||||
| import com.iformall.enums.EnumProfitPaymentReceiverType; | |||||
| import com.iformall.enums.EnumProfitSharingType; | |||||
| import java.util.List; | |||||
| public interface WxProfitPaymentReceiverService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxProfitPaymentReceiver> listAsPage(WxProfitPaymentReceiver record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxProfitPaymentReceiver getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxProfitPaymentReceiver record); | |||||
| // /** | |||||
| // * 根据Id删除实体 | |||||
| // * | |||||
| // * @param id | |||||
| // */ | |||||
| // void deleteById(Long id); | |||||
| /** | |||||
| * 获取门店的收款帐号 | |||||
| * @param tenantEntity | |||||
| * @param merchantId | |||||
| * @param plat | |||||
| * @param receiverType | |||||
| * @return | |||||
| */ | |||||
| WxProfitPaymentReceiver findReceiver(TenantEntity tenantEntity, Long merchantId, EnumAppPlat plat, EnumProfitPaymentReceiverType receiverType); | |||||
| ResultData updateReceiver(WxProfitPaymentReceiver receiver); | |||||
| ResultData updateTtReceiver(WxMerchant merchant); | |||||
| ResultData getTtReceiverImprotURL(WxMerchant merchant); | |||||
| ResultData getTtReceiverBalanceURL(WxMerchant merchant); | |||||
| ResultData updateTtReceiverImportStatus(WxMerchant merchant); | |||||
| } | |||||
| @@ -43,30 +43,22 @@ public interface WxProfitSharingReceiverService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat,EnumProfitSharingType sharingType); | |||||
| WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat); | |||||
| List<WxProfitSharingReceiver> findReceivers(TenantEntity tenantEntity,Long merchantId); | List<WxProfitSharingReceiver> findReceivers(TenantEntity tenantEntity,Long merchantId); | ||||
| ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList, boolean isSync); | |||||
| ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList); | |||||
| ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send, boolean isSync); | |||||
| ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send); | |||||
| /** | /** | ||||
| * | * | ||||
| * @param merchant | * @param merchant | ||||
| * @param receiver | * @param receiver | ||||
| * @param isSync 是否需要同步第三方(微信总分模式需要) | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, boolean isSync); | |||||
| ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver); | |||||
| 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); | |||||
| ResultData getTtReceiverImprotURL(WxMerchant merchant); | |||||
| ResultData getTtReceiverBalanceURL(WxMerchant merchant); | |||||
| ResultData updateTtReceiverIsUse(WxMerchant merchant); | |||||
| } | } | ||||
| @@ -1471,9 +1471,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| if(wxPayOrder != null && EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType()) | if(wxPayOrder != null && EnumPayMchType.TOTAL.getCode().equals(wxPayOrder.getMchType()) | ||||
| && EnumPayShare.YES.getCode().equals(wxPayOrder.getShare())){ | && EnumPayShare.YES.getCode().equals(wxPayOrder.getShare())){ | ||||
| WxProfitSharingReceiver receiver = payServiceFactory.getPayShareAdapterService(wxPayOrder.getPayVendor(),couponOrder.getPayVersion()) | WxProfitSharingReceiver receiver = payServiceFactory.getPayShareAdapterService(wxPayOrder.getPayVendor(),couponOrder.getPayVersion()) | ||||
| .getReceiver(mallTenantEntity, merchantId, wxPayOrder.getTtPayWay(),wxPayOrder.getMchType()); | |||||
| .getSharingReceiver(mallTenantEntity, merchantId, wxPayOrder.getTtPayWay(),wxPayOrder.getMchType()); | |||||
| if (null == receiver) { | if (null == receiver) { | ||||
| throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL.getCode(),"当前商户没有配置收款账号。"); | |||||
| throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL.getCode(),"当前商户没有配置分账账号。"); | |||||
| } | } | ||||
| } | } | ||||
| // else if(wxPayOrder != null && EnumPayMchType.DIRECT.getCode().equals(wxPayOrder.getMchType())){ | // else if(wxPayOrder != null && EnumPayMchType.DIRECT.getCode().equals(wxPayOrder.getMchType())){ | ||||
| @@ -2890,7 +2890,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| String merchant_uid = ""; | String merchant_uid = ""; | ||||
| if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){//直连模式记录收款商户 | if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){//直连模式记录收款商户 | ||||
| merchant_id = bUser.getMerchantId(); | merchant_id = bUser.getMerchantId(); | ||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant_id, null, payOrder.getMchType()); | |||||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(payAccount, merchant_id); | |||||
| if(receiver == null){ | if(receiver == null){ | ||||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | ||||
| } | } | ||||
| @@ -890,7 +890,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| //多商户券,抖音 直连 门店只有进件支付宝才能参加活动 todo | //多商户券,抖音 直连 门店只有进件支付宝才能参加活动 todo | ||||
| if(EnumAppPlat.TOUTIAO.equals(plat) && EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode().equals(record.getMerchantType())){ | if(EnumAppPlat.TOUTIAO.equals(plat) && EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode().equals(record.getMerchantType())){ | ||||
| for (WxMerchant merchant:merchantList) { | for (WxMerchant merchant:merchantList) { | ||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(mallTenantEntity, merchant.getId(), null, payMchType.getCode()); | |||||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(mallTenantEntity, merchant.getId()); | |||||
| if (receiver == null) { | if (receiver == null) { | ||||
| badNames.add(merchant.getName()); | badNames.add(merchant.getName()); | ||||
| } | } | ||||
| @@ -975,7 +975,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| //总分模式下不能分账的商户 | //总分模式下不能分账的商户 | ||||
| private boolean toTalPayMchTypeMerchantIsBad(PayShareAdapterService payShareServie,WxPayAccount payAccount, | private boolean toTalPayMchTypeMerchantIsBad(PayShareAdapterService payShareServie,WxPayAccount payAccount, | ||||
| String merchantName,Long merchantId,EnumPayMchType payMchType,EnumAppPlat plat) throws Exception { | String merchantName,Long merchantId,EnumPayMchType payMchType,EnumAppPlat plat) throws Exception { | ||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchantId, null, payMchType.getCode()); | |||||
| WxProfitSharingReceiver receiver = payShareServie.getSharingReceiver(payAccount, merchantId, null, payMchType.getCode()); | |||||
| if (receiver == null) { | if (receiver == null) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -1615,7 +1615,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| if(wxCoupon.getSalePrice() != null && wxCoupon.getSalePrice() > 0) { | if(wxCoupon.getSalePrice() != null && wxCoupon.getSalePrice() > 0) { | ||||
| PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); | PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); | ||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(makeMerchant, makeMerchant.getId(), null, payMchType.getCode()); | |||||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(makeMerchant, makeMerchant.getId()); | |||||
| if (receiver == null) { | if (receiver == null) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); | ||||
| } | } | ||||
| @@ -1873,7 +1873,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| Map<Long,Boolean> merchantAutoShareMap = new HashMap<Long,Boolean>(); | Map<Long,Boolean> merchantAutoShareMap = new HashMap<Long,Boolean>(); | ||||
| for (Long mid:wxCoupon.getMerchantIds()) { | for (Long mid:wxCoupon.getMerchantIds()) { | ||||
| //开通了支付宝就可以 | //开通了支付宝就可以 | ||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, mid, null, payMchType.getCode()); | |||||
| WxProfitSharingReceiver receiver = payShareServie.getSharingReceiver(payAccount, mid, null, payMchType.getCode()); | |||||
| if (null == receiver) { | if (null == receiver) { | ||||
| merchantAutoShareMap.put(mid, false); | merchantAutoShareMap.put(mid, false); | ||||
| }else { | }else { | ||||
| @@ -744,7 +744,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| @Override | @Override | ||||
| public ResultData updateMerchantAccount(WxMerchant wxMerchant,boolean isSync) { | |||||
| public ResultData updateMerchantAccount(WxMerchant wxMerchant) { | |||||
| try { | try { | ||||
| if (wxMerchant.getId() == null) { | if (wxMerchant.getId() == null) { | ||||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | ||||
| @@ -760,7 +760,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| receiver.setReceiverType(wxMerchant.getAccountTypeValue()); | receiver.setReceiverType(wxMerchant.getAccountTypeValue()); | ||||
| receiver.setTrueName(wxMerchant.getAccountName()); | receiver.setTrueName(wxMerchant.getAccountName()); | ||||
| receiver.setParameter(wxMerchant.getAccountParameter()); | receiver.setParameter(wxMerchant.getAccountParameter()); | ||||
| return wxProfitSharingReceiverService.updateReceiver(wxMerchant, receiver, isSync); | |||||
| return wxProfitSharingReceiverService.updateReceiver(wxMerchant, receiver); | |||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("db failed: 账户操作失败, e:" + e.getMessage(),e); | logger.error("db failed: 账户操作失败, e:" + e.getMessage(),e); | ||||
| @@ -427,7 +427,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | ||||
| } | } | ||||
| PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); | PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); | ||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant_id, null, payMchTypeEnum.getCode()); | |||||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(payAccount, merchant_id); | |||||
| if(receiver == null){ | if(receiver == null){ | ||||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | ||||
| } | } | ||||
| @@ -558,7 +558,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| String merchant_uid = ""; | String merchant_uid = ""; | ||||
| if(EnumPayMchType.DIRECT.getCode().equals(record.getMchType())){//直连模式记录收款商户 | if(EnumPayMchType.DIRECT.getCode().equals(record.getMchType())){//直连模式记录收款商户 | ||||
| merchant_id = user.getMerchantId(); | merchant_id = user.getMerchantId(); | ||||
| WxProfitSharingReceiver receiver = payShareServie.getReceiver(payAccount, merchant_id, null, record.getMchType()); | |||||
| WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(payAccount, merchant_id); | |||||
| if(receiver == null){ | if(receiver == null){ | ||||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | ||||
| } | } | ||||
| @@ -0,0 +1,325 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.dto.WxMerchantDto; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.WxMsgRecord; | |||||
| import com.iformall.domain.vo.WxMerchantVo; | |||||
| import com.iformall.douyin.pay.DouYinPayHelper; | |||||
| import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType; | |||||
| import com.iformall.douyin.pay.orderQuery.QueryMerchantResult; | |||||
| import com.iformall.douyin.pay.preOrder.AppAddSubMerchant; | |||||
| import com.iformall.douyin.pay.preOrder.AppAddSubMerchantResult; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxProfitPaymentReceiverMapper; | |||||
| import com.iformall.mq.MqBaseProducer; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.service.pay.PayServiceFactory; | |||||
| import com.iformall.service.pay.service.share.entity.ShareAccountResult; | |||||
| import com.iformall.utils.Constant; | |||||
| import com.iformall.utils.DateUtils; | |||||
| import com.iformall.utils.RedisCacheUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.context.annotation.Lazy; | |||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @Service | |||||
| public class WxProfitPaymentReceiverServiceImpl implements WxProfitPaymentReceiverService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxProfitPaymentReceiverMapper wxProfitPaymentReceiverMapper; | |||||
| @Autowired | |||||
| WxAppinfoService wxAppinfoService; | |||||
| @Autowired | |||||
| WxPayAccountService wxPayAccountService; | |||||
| @Lazy | |||||
| @Autowired | |||||
| WxMerchantService wxMerchantService; | |||||
| @Autowired | |||||
| private MqBaseProducer mqBaseProducer; | |||||
| @Autowired | |||||
| PayServiceFactory payServiceFactory; | |||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> paymentReceicerRedisTemplate; | |||||
| @Override | |||||
| public PageInfo<WxProfitPaymentReceiver> listAsPage(WxProfitPaymentReceiver record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitPaymentReceiverMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxProfitPaymentReceiver getById(Long id) { | |||||
| return wxProfitPaymentReceiverMapper.selectById(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxProfitPaymentReceiver record) { | |||||
| Date date = new Date(); | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateTime(date); | |||||
| record.setUpdateTime(date); | |||||
| wxProfitPaymentReceiverMapper.insert(record); | |||||
| } else { | |||||
| record.setUpdateTime(date); | |||||
| wxProfitPaymentReceiverMapper.updateById(record); | |||||
| this.deleteRedis(record.getId()); | |||||
| } | |||||
| } | |||||
| // @Override | |||||
| // public void deleteById(Long id) { | |||||
| // wxProfitPaymentReceiverMapper.deleteById(id); | |||||
| // } | |||||
| @Override | |||||
| public WxProfitPaymentReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat,EnumProfitPaymentReceiverType receiverType) { | |||||
| WxProfitPaymentReceiver record = null; | |||||
| String key = Constant.paymentReceicerPrev + tenantEntity.getTenantId() | |||||
| + ":" + plat.getCode() | |||||
| + ":" + merchantId | |||||
| + ":" + receiverType.getCode(); | |||||
| record = RedisCacheUtils.getCacheObject(paymentReceicerRedisTemplate, key, WxProfitPaymentReceiver.class); | |||||
| if(record == null){ | |||||
| WxProfitPaymentReceiver receiver = new WxProfitPaymentReceiver(); | |||||
| receiver.updateTenantInfo(tenantEntity); | |||||
| receiver.setMerchantId(merchantId); | |||||
| receiver.setPlat(plat.getCode()); | |||||
| receiver.setReceiverType(receiverType.getCode()); | |||||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| record = wxProfitPaymentReceiverMapper.findOne(receiver); | |||||
| if(record != null){ | |||||
| RedisCacheUtils.cache(paymentReceicerRedisTemplate, key, record, 3600*24*7); | |||||
| } | |||||
| } | |||||
| return record; | |||||
| } | |||||
| @Override | |||||
| public ResultData updateTtReceiver(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||||
| } | |||||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = getTtPaymentReceiver(merchant); | |||||
| //进件页面 | |||||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||||
| if(improt_URLResult.isSuccess()){ | |||||
| wxProfitPaymentReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | |||||
| wxProfitPaymentReceiver.setTtImportUrl(improt_URLResult.getUrl()); | |||||
| }else{ | |||||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | |||||
| } | |||||
| //余额页面 | |||||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||||
| if(balance_URLResult.isSuccess()){ | |||||
| wxProfitPaymentReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | |||||
| wxProfitPaymentReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | |||||
| }else{ | |||||
| logger.error("获取余额页面 error{}"+balance_URLResult.getMsg()); | |||||
| } | |||||
| this.saveOrUpdate(wxProfitPaymentReceiver); | |||||
| return new ResultData(); | |||||
| } | |||||
| @Override | |||||
| public ResultData getTtReceiverImprotURL(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||||
| } | |||||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = getTtPaymentReceiver(merchant); | |||||
| //进件页面 | |||||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||||
| if(improt_URLResult.isSuccess()){ | |||||
| wxProfitPaymentReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | |||||
| wxProfitPaymentReceiver.setTtImportUrl(improt_URLResult.getUrl()); | |||||
| this.saveOrUpdate(wxProfitPaymentReceiver); | |||||
| return new ResultData(wxProfitPaymentReceiver.getTtImportUrl()); | |||||
| }else{ | |||||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public ResultData getTtReceiverBalanceURL(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||||
| } | |||||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = getTtPaymentReceiver(merchant); | |||||
| //余额页面 | |||||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||||
| if(balance_URLResult.isSuccess()){ | |||||
| wxProfitPaymentReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | |||||
| wxProfitPaymentReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | |||||
| this.saveOrUpdate(wxProfitPaymentReceiver); | |||||
| return new ResultData(wxProfitPaymentReceiver.getTtBalanceUrl()); | |||||
| }else{ | |||||
| logger.error("获取余额页面 error{}"+balance_URLResult.getMsg()); | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||||
| } | |||||
| } | |||||
| private WxProfitPaymentReceiver getTtPaymentReceiver(WxMerchant merchant){ | |||||
| WxProfitPaymentReceiver receiver = new WxProfitPaymentReceiver(); | |||||
| receiver.updateTenantInfo(merchant); | |||||
| receiver.setMerchantId(merchant.getId()); | |||||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.tt_merchant_number.getCode()); | |||||
| receiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = wxProfitPaymentReceiverMapper.selectOne(new QueryWrapper(receiver)); | |||||
| if(wxProfitPaymentReceiver == null){ | |||||
| receiver.setReceiverAccount("0"); | |||||
| this.saveOrUpdate(receiver); | |||||
| return receiver; | |||||
| } | |||||
| return wxProfitPaymentReceiver; | |||||
| } | |||||
| @Override | |||||
| public ResultData updateTtReceiverImportStatus(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| 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); | |||||
| } | |||||
| WxProfitPaymentReceiver receiver = new WxProfitPaymentReceiver(); | |||||
| receiver.updateTenantInfo(merchant); | |||||
| receiver.setMerchantId(merchant.getId()); | |||||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.tt_merchant_number.getCode()); | |||||
| receiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| WxProfitPaymentReceiver wxProfitPaymentReceiver = wxProfitPaymentReceiverMapper.selectOne(new QueryWrapper(receiver)); | |||||
| if(wxProfitPaymentReceiver == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到收款信息"); | |||||
| } | |||||
| QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appInfo.getAppId(), payAcount.getMerchantApiKey(), wxProfitPaymentReceiver.getReceiverAccount(), wxProfitPaymentReceiver.getMerchantId().toString(), null); | |||||
| if(queryMerchantResult != null){ | |||||
| wxProfitPaymentReceiver.setTtImportStatus(JSON.toJSONString(queryMerchantResult)); | |||||
| this.saveOrUpdate(wxProfitPaymentReceiver); | |||||
| return new ResultData(); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"查询进件状态出错!"); | |||||
| } | |||||
| } | |||||
| 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.setAppId(appInfo.getAppId()); | |||||
| appAddSubMerchant.setSalt(payAcount.getMerchantApiKey()); | |||||
| appAddSubMerchant.setSubMerchantId(merchantId); | |||||
| appAddSubMerchant.setUrlType(appAddSubMerchantUrlType.getCode()); | |||||
| return DouYinPayHelper.appAddSubMerchant(appAddSubMerchant); | |||||
| } | |||||
| @Override | |||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| public ResultData updateReceiver(WxProfitPaymentReceiver receiver) { | |||||
| if(receiver.getMerchantId() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"缺少商户信息"); | |||||
| } | |||||
| if(receiver.getPlat() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"缺少平台信息"); | |||||
| } | |||||
| if(receiver.getReceiverType() == null){ | |||||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.wx_special_merchant_number.getCode()); | |||||
| } | |||||
| WxProfitPaymentReceiver receiverQ = new WxProfitPaymentReceiver(); | |||||
| receiverQ.updateTenantInfo(receiver); | |||||
| receiverQ.setMerchantId(receiver.getMerchantId()); | |||||
| receiverQ.setReceiverAccount(receiver.getReceiverAccount()); | |||||
| // | |||||
| WxProfitPaymentReceiver paymentReceiver = wxProfitPaymentReceiverMapper.selectOne(new QueryWrapper(receiverQ)); | |||||
| if(paymentReceiver != null){ | |||||
| receiver.setId(paymentReceiver.getId()); | |||||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| this.saveOrUpdate(receiver); | |||||
| }else{ | |||||
| WxProfitPaymentReceiver oldReceiver = new WxProfitPaymentReceiver(); | |||||
| oldReceiver.updateTenantInfo(receiver); | |||||
| oldReceiver.setMerchantId(receiver.getMerchantId()); | |||||
| oldReceiver.setReceiverType(receiver.getReceiverType()); | |||||
| oldReceiver.setPlat(receiver.getPlat()); | |||||
| oldReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| List<WxProfitPaymentReceiver> oldList = wxProfitPaymentReceiverMapper.selectList(new QueryWrapper(oldReceiver)); | |||||
| receiver.setId(null); | |||||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| this.saveOrUpdate(receiver); | |||||
| if(oldList != null && oldList.size() > 0){ | |||||
| for (WxProfitPaymentReceiver delReceiver:oldList) { | |||||
| WxProfitPaymentReceiver del = new WxProfitPaymentReceiver(); | |||||
| del.setId(delReceiver.getId()); | |||||
| del.updateTenantInfo(delReceiver); | |||||
| del.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_INVALID.getCode()); | |||||
| this.saveOrUpdate(del); | |||||
| } | |||||
| } | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| private void deleteRedis(Long id){ | |||||
| WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverMapper.selectById(id); | |||||
| if(receiver != null){ | |||||
| String key = Constant.paymentReceicerPrev + receiver.getTenantId() | |||||
| + ":" + receiver.getPlat() | |||||
| + ":" + receiver.getMerchantId() | |||||
| + ":" + receiver.getReceiverType(); | |||||
| RedisCacheUtils.removeCache(paymentReceicerRedisTemplate, key); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -161,7 +161,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); | merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); | ||||
| WxMerchant merchant = wxMerchantService.findListOne(merchantQ); | WxMerchant merchant = wxMerchantService.findListOne(merchantQ); | ||||
| if(merchant != null && !merchant.getId().equals(payMerchantId)){ | if(merchant != null && !merchant.getId().equals(payMerchantId)){ | ||||
| return payShareAdapterService.getReceiver(tenantEntity, merchant.getId(), ttPayWay, mchType); | |||||
| return payShareAdapterService.getSharingReceiver(tenantEntity, merchant.getId(), ttPayWay, mchType); | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -332,7 +332,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| isSharingResult = true; | isSharingResult = true; | ||||
| }else{ | }else{ | ||||
| isCallSharing = true; | isCallSharing = true; | ||||
| WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(merchant,sharingOrder.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); | |||||
| WxProfitSharingReceiver receiver = payShareAdapterService.getSharingReceiver(merchant,sharingOrder.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); | |||||
| if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.YES.getCode().equals(payOrder.getShare())){ | if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.YES.getCode().equals(payOrder.getShare())){ | ||||
| //总分 分账 抖音不支持 不支持开通 | //总分 分账 抖音不支持 不支持开通 | ||||
| JSONObject jo = new JSONObject(); | JSONObject jo = new JSONObject(); | ||||
| @@ -427,7 +427,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType())){ | if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType())){ | ||||
| //解冻给收款方(广场) | //解冻给收款方(广场) | ||||
| JSONObject jo = new JSONObject(); | JSONObject jo = new JSONObject(); | ||||
| jo.put("type",EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getMessage()); | |||||
| jo.put("type",EnumProfitPaymentReceiverType.wx_special_merchant_number.getMessage()); | |||||
| jo.put("account",payAccount.getSubMchId()); | jo.put("account",payAccount.getSubMchId()); | ||||
| jo.put("amount", shareAmount); | jo.put("amount", shareAmount); | ||||
| jo.put("merchantId",0); | jo.put("merchantId",0); | ||||
| @@ -435,7 +435,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| jo.put("description",0); | jo.put("description",0); | ||||
| receivers.add(jo); | receivers.add(jo); | ||||
| }else if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ | }else if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ | ||||
| WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(sharingOrder,wxComposeChildOrderShare.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); | |||||
| WxProfitPaymentReceiver receiver = payShareAdapterService.getPaymantReceiver(sharingOrder,wxComposeChildOrderShare.getMerchantId()); | |||||
| //解冻给收款方(门店) | //解冻给收款方(门店) | ||||
| JSONObject jo = new JSONObject(); | JSONObject jo = new JSONObject(); | ||||
| jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | ||||
| @@ -39,7 +39,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||||
| WxProfitSharingReceiverApplyMapper wxProfitSharingReceiverApplyMapper; | WxProfitSharingReceiverApplyMapper wxProfitSharingReceiverApplyMapper; | ||||
| @Autowired | @Autowired | ||||
| WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||||
| WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoService wxAppinfoService; | WxAppinfoService wxAppinfoService; | ||||
| @@ -189,21 +189,13 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||||
| receiverApplyUpd.setUpdateTime(new Date()); | receiverApplyUpd.setUpdateTime(new Date()); | ||||
| wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd); | wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd); | ||||
| if(enumApplymentState.equals(EnumSharingReceiverApplymentState.APPLYMENT_STATE_FINISHED)){ | if(enumApplymentState.equals(EnumSharingReceiverApplymentState.APPLYMENT_STATE_FINISHED)){ | ||||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(receiverApply, receiverApply.getMerchantId(), EnumAppPlat.WX, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); | |||||
| WxProfitSharingReceiver receiverUpd = new WxProfitSharingReceiver(); | |||||
| receiverUpd.updateTenantInfo(receiverApply); | |||||
| if(receiver != null){ | |||||
| receiverUpd.setId(receiver.getId()); | |||||
| receiverUpd.setReceiverAccount(receiverApplyUpd.getSubMchid()); | |||||
| }else{ | |||||
| receiverUpd.setPlat(EnumAppPlat.WX.getCode()); | |||||
| receiverUpd.setMerchantId(receiverApply.getMerchantId()); | |||||
| receiverUpd.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode()); | |||||
| receiverUpd.setReceiverAccount(receiverApplyUpd.getSubMchid()); | |||||
| receiverUpd.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2.getCode()); | |||||
| receiverUpd.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| } | |||||
| wxProfitSharingReceiverService.saveOrUpdate(receiverUpd); | |||||
| WxProfitPaymentReceiver receiver = new WxProfitPaymentReceiver(); | |||||
| receiver.updateTenantInfo(receiverApply); | |||||
| receiver.setMerchantId(receiverApply.getMerchantId()); | |||||
| receiver.setPlat(EnumAppPlat.WX.getCode()); | |||||
| receiver.setReceiverType(EnumProfitPaymentReceiverType.tt_merchant_number.getCode()); | |||||
| receiver.setReceiverAccount(receiverApplyUpd.getSubMchid()); | |||||
| wxProfitPaymentReceiverService.updateReceiver(receiver); | |||||
| } | } | ||||
| receiverApply.setSubMchid(receiverApplyUpd.getSubMchid()); | receiverApply.setSubMchid(receiverApplyUpd.getSubMchid()); | ||||
| @@ -124,20 +124,23 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| @Override | @Override | ||||
| public WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat,EnumProfitSharingType sharingType) { | |||||
| public WxProfitSharingReceiver findReceiver(TenantEntity tenantEntity,Long merchantId, EnumAppPlat plat) { | |||||
| WxProfitSharingReceiver record = null; | WxProfitSharingReceiver record = null; | ||||
| String key = Constant.sharingReceicerPrev + tenantEntity.getTenantId() | String key = Constant.sharingReceicerPrev + tenantEntity.getTenantId() | ||||
| + ":" + merchantId | |||||
| + ":" + plat.getCode() + "a" + sharingType.getCode(); | |||||
| + ":" + plat.getCode() | |||||
| + ":" + merchantId; | |||||
| record = RedisCacheUtils.getCacheObject(sharingReceicerRedisTemplate, key, WxProfitSharingReceiver.class); | record = RedisCacheUtils.getCacheObject(sharingReceicerRedisTemplate, key, WxProfitSharingReceiver.class); | ||||
| if(record == null){ | if(record == null){ | ||||
| WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); | WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); | ||||
| receiver.updateTenantInfo(tenantEntity); | receiver.updateTenantInfo(tenantEntity); | ||||
| receiver.setMerchantId(merchantId); | receiver.setMerchantId(merchantId); | ||||
| receiver.setPlat(plat.getCode()); | receiver.setPlat(plat.getCode()); | ||||
| receiver.setSharingType(sharingType.getCode()); | |||||
| receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_SYS.getCode()); | |||||
| receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | ||||
| record = wxProfitSharingReceiverMapper.findOne(receiver); | |||||
| List<WxProfitSharingReceiver> receivers = wxProfitSharingReceiverMapper.findList(receiver); | |||||
| if(receivers != null && receivers.size() > 0){ | |||||
| record = receivers.get(0); | |||||
| } | |||||
| if(record != null){ | if(record != null){ | ||||
| RedisCacheUtils.cache(sharingReceicerRedisTemplate, key, record, 3600*24*7); | RedisCacheUtils.cache(sharingReceicerRedisTemplate, key, record, 3600*24*7); | ||||
| } | } | ||||
| @@ -156,14 +159,14 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList, boolean isSync) { | |||||
| public ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List<WxProfitSharingReceiver> delList) { | |||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(merchant,EnumAppPlat.WX); | WxAppinfo appInfo = wxAppinfoService.getCAppInfo(merchant,EnumAppPlat.WX); | ||||
| WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | ||||
| receiver.updateTenantInfo(merchant); | receiver.updateTenantInfo(merchant); | ||||
| receiver.setMerchantId(merchant.getId()); | receiver.setMerchantId(merchant.getId()); | ||||
| receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||||
| receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_SYS.getCode()); | |||||
| receiver.setId(IdWorker.get().nextId()); | receiver.setId(IdWorker.get().nextId()); | ||||
| Date date = new Date(); | Date date = new Date(); | ||||
| receiver.setCreateTime(date); | receiver.setCreateTime(date); | ||||
| @@ -177,20 +180,18 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| //receiver.setReceiverType(receiverParam.getReceiverType()); | //receiver.setReceiverType(receiverParam.getReceiverType()); | ||||
| //receiver.setTrueName(receiverParam.getTrueName()); | //receiver.setTrueName(receiverParam.getTrueName()); | ||||
| if(isSync){ | |||||
| //添加分账账户 | |||||
| ShareAccountResult createResult = payServiceFactory.getPayShareAdapterService(EnumPayWay.PAY_WAY_WECHAT.getCode(),payAccount.getPayVersion()) | |||||
| .createShareAccount(appInfo, payAccount, receiver); | |||||
| if (!createResult.isSuccess()) { | |||||
| return new ResultData(createResult.getCode(), createResult.getMsg()); | |||||
| } | |||||
| //添加分账账户 | |||||
| ShareAccountResult createResult = payServiceFactory.getPayShareAdapterService(EnumPayWay.PAY_WAY_WECHAT.getCode(),payAccount.getPayVersion()) | |||||
| .createShareAccount(appInfo, payAccount, receiver); | |||||
| if (!createResult.isSuccess()) { | |||||
| return new ResultData(createResult.getCode(), createResult.getMsg()); | |||||
| } | } | ||||
| wxProfitSharingReceiverMapper.insert(receiver); | wxProfitSharingReceiverMapper.insert(receiver); | ||||
| //添加成功才删除账户 | //添加成功才删除账户 | ||||
| for (WxProfitSharingReceiver delReceiver : delList) { | for (WxProfitSharingReceiver delReceiver : delList) { | ||||
| delReceiver(delReceiver, EnumMsgSend.MSG_SEND_NOT_IMMEDIATELY.getCode(),isSync); | |||||
| delReceiver(delReceiver, EnumMsgSend.MSG_SEND_NOT_IMMEDIATELY.getCode()); | |||||
| } | } | ||||
| WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); | ||||
| @@ -269,148 +270,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData updateTtReceiver(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||||
| } | |||||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | |||||
| //进件页面 | |||||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||||
| if(improt_URLResult.isSuccess()){ | |||||
| wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | |||||
| wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); | |||||
| }else{ | |||||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | |||||
| } | |||||
| //余额页面 | |||||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||||
| if(balance_URLResult.isSuccess()){ | |||||
| wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | |||||
| wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | |||||
| }else{ | |||||
| logger.error("获取余额页面 error{}"+balance_URLResult.getMsg()); | |||||
| } | |||||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||||
| return new ResultData(); | |||||
| } | |||||
| @Override | |||||
| public ResultData getTtReceiverImprotURL(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||||
| } | |||||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | |||||
| //进件页面 | |||||
| AppAddSubMerchantResult improt_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.improt_URL); | |||||
| if(improt_URLResult.isSuccess()){ | |||||
| wxProfitSharingReceiver.setReceiverAccount(improt_URLResult.getMerchantId()); | |||||
| wxProfitSharingReceiver.setTtImportUrl(improt_URLResult.getUrl()); | |||||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||||
| return new ResultData(wxProfitSharingReceiver.getTtImportUrl()); | |||||
| }else{ | |||||
| logger.error("获取进件页面 error{}"+improt_URLResult.getMsg()); | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public ResultData getTtReceiverBalanceURL(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); | |||||
| } | |||||
| WxProfitSharingReceiver wxProfitSharingReceiver = getTtSharingReceiver(merchant); | |||||
| //余额页面 | |||||
| AppAddSubMerchantResult balance_URLResult = appAddSubMerchant(merchant,merchant.getId().toString(),AppAddSubMerchantUrlType.Balance_URL); | |||||
| if(balance_URLResult.isSuccess()){ | |||||
| wxProfitSharingReceiver.setReceiverAccount(balance_URLResult.getMerchantId()); | |||||
| wxProfitSharingReceiver.setTtBalanceUrl(balance_URLResult.getUrl()); | |||||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||||
| return new ResultData(wxProfitSharingReceiver.getTtBalanceUrl()); | |||||
| }else{ | |||||
| logger.error("获取余额页面 error{}"+balance_URLResult.getMsg()); | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||||
| } | |||||
| } | |||||
| private WxProfitSharingReceiver getTtSharingReceiver(WxMerchant merchant){ | |||||
| WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | |||||
| oldReceiver.updateTenantInfo(merchant); | |||||
| oldReceiver.setMerchantId(merchant.getId()); | |||||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); | |||||
| oldReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||||
| WxProfitSharingReceiver wxProfitSharingReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver)); | |||||
| if(wxProfitSharingReceiver == null){ | |||||
| wxProfitSharingReceiver = oldReceiver; | |||||
| wxProfitSharingReceiver.setReceiverType(EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getCode()); | |||||
| wxProfitSharingReceiver.setReceiverAccount("0"); | |||||
| // wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.APPLY.getCode()); | |||||
| wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | |||||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||||
| } | |||||
| return wxProfitSharingReceiver; | |||||
| } | |||||
| @Override | |||||
| public ResultData updateTtReceiverIsUse(WxMerchant merchant) { | |||||
| if(merchant == null) { | |||||
| 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(); | |||||
| oldReceiver.updateTenantInfo(merchant); | |||||
| oldReceiver.setMerchantId(merchant.getId()); | |||||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); | |||||
| oldReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); | |||||
| WxProfitSharingReceiver wxProfitSharingReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver)); | |||||
| if(wxProfitSharingReceiver == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到分账信息"); | |||||
| } | |||||
| QueryMerchantResult queryMerchantResult = DouYinPayHelper.queryMerchantStatus(appInfo.getAppId(), payAcount.getMerchantApiKey(), wxProfitSharingReceiver.getReceiverAccount(), wxProfitSharingReceiver.getMerchantId().toString(), null); | |||||
| if(queryMerchantResult != null){ | |||||
| // if(queryMerchantResult.getWx().intValue() != 1){ | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"微信渠道未进件成功!"); | |||||
| // } | |||||
| // if(queryMerchantResult.getAlipay().intValue() != 1){ | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"支付宝渠道未进件成功!"); | |||||
| // } | |||||
| // wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.YES.getCode()); | |||||
| wxProfitSharingReceiver.setTtImportStatus(JSON.toJSONString(queryMerchantResult)); | |||||
| this.saveOrUpdate(wxProfitSharingReceiver); | |||||
| return new ResultData(); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"查询进件状态出错!"); | |||||
| } | |||||
| } | |||||
| 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.setAppId(appInfo.getAppId()); | |||||
| appAddSubMerchant.setSalt(payAcount.getMerchantApiKey()); | |||||
| appAddSubMerchant.setSubMerchantId(merchantId); | |||||
| appAddSubMerchant.setUrlType(appAddSubMerchantUrlType.getCode()); | |||||
| return DouYinPayHelper.appAddSubMerchant(appAddSubMerchant); | |||||
| } | |||||
| @Override | |||||
| public ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send, boolean isSync) { | |||||
| public ResultData delReceiver(WxProfitSharingReceiver receiver, Integer send) { | |||||
| // WxAppinfo appInfo = wxAppinfoService.getCAppInfo(receiver,EnumAppPlat.WX); | // WxAppinfo appInfo = wxAppinfoService.getCAppInfo(receiver,EnumAppPlat.WX); | ||||
| // WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | // WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | ||||
| @@ -434,13 +294,11 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| ))) { | ))) { | ||||
| //还有别的商户使用这个账号,不从微信服务器申请删除 | //还有别的商户使用这个账号,不从微信服务器申请删除 | ||||
| } else { | } else { | ||||
| if(isSync){ | |||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(receiver,EnumAppPlat.WX); | |||||
| WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | |||||
| ShareAccountResult shareResult = payServiceFactory.getPayShareAdapterService(receiver.getPlat(),payAccount.getPayVersion()).deleteShareAccount(appInfo, payAccount, receiver); | |||||
| if (!shareResult.isSuccess()) { | |||||
| return new ResultData(shareResult.getCode(), shareResult.getMsg()); | |||||
| } | |||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(receiver,EnumAppPlat.WX); | |||||
| WxPayAccount payAccount = wxPayAccountService.getById(appInfo.getPayId()); | |||||
| ShareAccountResult shareResult = payServiceFactory.getPayShareAdapterService(receiver.getPlat(),payAccount.getPayVersion()).deleteShareAccount(appInfo, payAccount, receiver); | |||||
| if (!shareResult.isSuccess()) { | |||||
| return new ResultData(shareResult.getCode(), shareResult.getMsg()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -457,12 +315,12 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver,boolean isSync) { | |||||
| public ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver) { | |||||
| WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | WxProfitSharingReceiver oldReceiver = new WxProfitSharingReceiver(); | ||||
| oldReceiver.updateTenantInfo(merchant); | oldReceiver.updateTenantInfo(merchant); | ||||
| oldReceiver.setMerchantId(merchant.getId()); | oldReceiver.setMerchantId(merchant.getId()); | ||||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); | |||||
| oldReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_SYS.getCode()); | |||||
| oldReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | oldReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | ||||
| oldReceiver.setPlat(EnumAppPlat.WX.getCode()); | oldReceiver.setPlat(EnumAppPlat.WX.getCode()); | ||||
| List<WxProfitSharingReceiver> delList = wxProfitSharingReceiverMapper.selectList(new QueryWrapper(oldReceiver)); | List<WxProfitSharingReceiver> delList = wxProfitSharingReceiverMapper.selectList(new QueryWrapper(oldReceiver)); | ||||
| @@ -472,7 +330,7 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| oldReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver)); | oldReceiver = wxProfitSharingReceiverMapper.selectOne(new QueryWrapper(oldReceiver)); | ||||
| if (oldReceiver == null) { | if (oldReceiver == null) { | ||||
| return addReceiver(merchant, receiver, delList, isSync); | |||||
| return addReceiver(merchant, receiver, delList); | |||||
| } else { | } else { | ||||
| oldReceiver.setParameter(receiver.getParameter()); | oldReceiver.setParameter(receiver.getParameter()); | ||||
| oldReceiver.setUpdateTime(new Date()); | oldReceiver.setUpdateTime(new Date()); | ||||
| @@ -486,8 +344,8 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv | |||||
| WxProfitSharingReceiver receiver = wxProfitSharingReceiverMapper.selectById(id); | WxProfitSharingReceiver receiver = wxProfitSharingReceiverMapper.selectById(id); | ||||
| if(receiver != null){ | if(receiver != null){ | ||||
| String key = Constant.sharingReceicerPrev + receiver.getTenantId() | String key = Constant.sharingReceicerPrev + receiver.getTenantId() | ||||
| + ":" + receiver.getMerchantId() | |||||
| + ":" + receiver.getPlat() + "a" + receiver.getSharingType(); | |||||
| + ":" + receiver.getPlat() | |||||
| + ":" + receiver.getMerchantId(); | |||||
| RedisCacheUtils.removeCache(sharingReceicerRedisTemplate, key); | RedisCacheUtils.removeCache(sharingReceicerRedisTemplate, key); | ||||
| } | } | ||||
| } | } | ||||
| @@ -39,6 +39,14 @@ public interface PayShareAdapterService { | |||||
| */ | */ | ||||
| // public PayShareCalculateAmount calculateAmount(Integer payAmount,Integer officialCommissionRate,Integer systemAmount,WxPayAccount payAccount); | // public PayShareCalculateAmount calculateAmount(Integer payAmount,Integer officialCommissionRate,Integer systemAmount,WxPayAccount payAccount); | ||||
| /** | |||||
| * 查询商户的收款账号信息 | |||||
| * @param tenantEntity | |||||
| * @param merchantId | |||||
| * @return | |||||
| */ | |||||
| WxProfitPaymentReceiver getPaymantReceiver(TenantEntity tenantEntity, Long merchantId); | |||||
| /** | /** | ||||
| * 查询商户的收款账号信息 | * 查询商户的收款账号信息 | ||||
| * @param tenantEntity | * @param tenantEntity | ||||
| @@ -46,7 +54,7 @@ public interface PayShareAdapterService { | |||||
| * @param ttPayWay | * @param ttPayWay | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxProfitSharingReceiver getReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType); | |||||
| WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType); | |||||
| /** | /** | ||||
| * 无分账接收方分账 ,钱直接分给小程序方 调用API分账 | * 无分账接收方分账 ,钱直接分给小程序方 调用API分账 | ||||
| @@ -22,6 +22,7 @@ import com.iformall.douyin.payv2.result.ProfitSharingResult; | |||||
| import com.iformall.enums.*; | 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.service.WxProfitPaymentReceiverService; | |||||
| import com.iformall.service.WxProfitSharingReceiverService; | import com.iformall.service.WxProfitSharingReceiverService; | ||||
| import com.iformall.service.order.entity.WxComposeChildOrderShare; | import com.iformall.service.order.entity.WxComposeChildOrderShare; | ||||
| import com.iformall.service.order.util.OrderHelper; | import com.iformall.service.order.util.OrderHelper; | ||||
| @@ -78,6 +79,10 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||||
| @Autowired | @Autowired | ||||
| WxProfitSharingReceiverService wxProfitSharingReceiverService; | WxProfitSharingReceiverService wxProfitSharingReceiverService; | ||||
| @Lazy | |||||
| @Autowired | |||||
| WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| /** | /** | ||||
| * 做为分账的扩展数据 | * 做为分账的扩展数据 | ||||
| * @param payOrder | * @param payOrder | ||||
| @@ -94,6 +99,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||||
| return EnumMerchantSubsidyType.DOUYIN.getCode(); | return EnumMerchantSubsidyType.DOUYIN.getCode(); | ||||
| } | } | ||||
| // @Override | // @Override | ||||
| // public Integer getSharingOrderInitialStatus() { | // public Integer getSharingOrderInitialStatus() { | ||||
| // return EnumProfitSharingOrderStatus.PROFIT_SHARING_UNKNOWN.getCode(); | // return EnumProfitSharingOrderStatus.PROFIT_SHARING_UNKNOWN.getCode(); | ||||
| @@ -308,12 +314,12 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxProfitSharingReceiver getReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | |||||
| public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | |||||
| if(merchantId == null || merchantId.equals(0L)){ | if(merchantId == null || merchantId.equals(0L)){ | ||||
| return null; | return null; | ||||
| } | } | ||||
| WxProfitSharingReceiver record = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.TOUTIAO,EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN); | |||||
| WxProfitSharingReceiver record = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.TOUTIAO); | |||||
| if(ttPayWay != null){ | if(ttPayWay != null){ | ||||
| if(EnumTtPayChannel.WX_PAY.getCode().equals(ttPayWay) | if(EnumTtPayChannel.WX_PAY.getCode().equals(ttPayWay) | ||||
| @@ -334,4 +340,20 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| @Override | |||||
| public WxProfitPaymentReceiver getPaymantReceiver(TenantEntity tenantEntity, Long merchantId) { | |||||
| if(merchantId == null || merchantId.equals(0L)){ | |||||
| return null; | |||||
| } | |||||
| WxProfitPaymentReceiver record = wxProfitPaymentReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.TOUTIAO,EnumProfitPaymentReceiverType.tt_merchant_number); | |||||
| if(record != null && !MerchantImportStatus.improt_success.getCode().equals(record.getWxImportStatus()) | |||||
| && !MerchantImportStatus.improt_success.getCode().equals(record.getAlipayImportStatus()) | |||||
| && !MerchantImportStatus.improt_success.getCode().equals(record.getHzImportStatus())){ | |||||
| log.error("该商户未开通支付"); | |||||
| return null; | |||||
| } | |||||
| return record; | |||||
| } | |||||
| } | } | ||||
| @@ -156,9 +156,14 @@ public class WxPayShareSFTService extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxProfitSharingReceiver getReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | |||||
| public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public WxProfitPaymentReceiver getPaymantReceiver(TenantEntity tenantEntity, Long merchantId) { | |||||
| return null; | |||||
| } | |||||
| } | } | ||||
| @@ -12,6 +12,7 @@ import com.iformall.douyin.pay.enums.MerchantImportStatus; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxProfitPaymentReceiverService; | |||||
| import com.iformall.service.WxProfitSharingReceiverService; | import com.iformall.service.WxProfitSharingReceiverService; | ||||
| import com.iformall.utils.*; | import com.iformall.utils.*; | ||||
| import net.sf.saxon.trans.Err; | import net.sf.saxon.trans.Err; | ||||
| @@ -52,6 +53,10 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||||
| @Autowired | @Autowired | ||||
| WxProfitSharingReceiverService wxProfitSharingReceiverService; | WxProfitSharingReceiverService wxProfitSharingReceiverService; | ||||
| @Autowired | |||||
| WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| final JSONObject statusMap = JSON.parseObject( | final JSONObject statusMap = JSON.parseObject( | ||||
| "{\"ACCEPTED\":3," + | "{\"ACCEPTED\":3," + | ||||
| "\"PROCESSING\": 4," + | "\"PROCESSING\": 4," + | ||||
| @@ -356,17 +361,26 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxProfitSharingReceiver getReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | |||||
| public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | |||||
| if(merchantId == null || merchantId.equals(0L)){ | if(merchantId == null || merchantId.equals(0L)){ | ||||
| return null; | return null; | ||||
| } | } | ||||
| WxProfitSharingReceiver record = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); | |||||
| if(record != null && EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID.getCode().equals(record.getReceiverType())){ | |||||
| WxProfitSharingReceiver record = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX); | |||||
| if(record != null && EnumProfitPaymentReceiverType.wx_personal_wechatid.getCode().equals(record.getReceiverType())){ | |||||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户收款账号存在个人微信号方式,微信已停止支持,请重新设置."); | throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户收款账号存在个人微信号方式,微信已停止支持,请重新设置."); | ||||
| } | } | ||||
| return record; | return record; | ||||
| } | } | ||||
| @Override | |||||
| public WxProfitPaymentReceiver getPaymantReceiver(TenantEntity tenantEntity, Long merchantId) { | |||||
| if(merchantId == null || merchantId.equals(0L)){ | |||||
| return null; | |||||
| } | |||||
| WxProfitPaymentReceiver record = wxProfitPaymentReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitPaymentReceiverType.wx_special_merchant_number); | |||||
| return record; | |||||
| } | |||||
| private static String queryOrderShareAmount(String mchId,String transcationId,String apiKey) { | private static String queryOrderShareAmount(String mchId,String transcationId,String apiKey) { | ||||
| WxProfitSharingP psCmd = new WxProfitSharingP(); | WxProfitSharingP psCmd = new WxProfitSharingP(); | ||||
| psCmd.setMch_id(mchId);//服务商商户id | psCmd.setMch_id(mchId);//服务商商户id | ||||
| @@ -14,6 +14,7 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxProfitPaymentReceiverService; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.RedisCacheUtils; | import com.iformall.utils.RedisCacheUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -52,6 +53,10 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| WxProfitSharingReceiverService wxProfitSharingReceiverService; | WxProfitSharingReceiverService wxProfitSharingReceiverService; | ||||
| @Lazy | |||||
| @Autowired | |||||
| WxProfitPaymentReceiverService wxProfitPaymentReceiverService; | |||||
| @Autowired | @Autowired | ||||
| MaUtil maUtil; | MaUtil maUtil; | ||||
| @@ -79,25 +84,27 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| @Override | @Override | ||||
| public WxProfitSharingReceiver getReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | |||||
| public WxProfitSharingReceiver getSharingReceiver(TenantEntity tenantEntity, Long merchantId, Integer ttPayWay,Integer mchType) { | |||||
| if(merchantId == null || merchantId.equals(0L)){ | if(merchantId == null || merchantId.equals(0L)){ | ||||
| return null; | return null; | ||||
| } | } | ||||
| //直连,必须是特约商户号 | |||||
| if (EnumPayMchType.DIRECT.getCode() == mchType) { | |||||
| return wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); | |||||
| // 总分 | |||||
| }else if (EnumPayMchType.TOTAL.getCode() == mchType) { | |||||
| return wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); | |||||
| } | |||||
| return wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX); | |||||
| // if (null == receiver) { | // if (null == receiver) { | ||||
| // throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); | // throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); | ||||
| // } | // } | ||||
| return null; | |||||
| } | } | ||||
| @Override | |||||
| public WxProfitPaymentReceiver getPaymantReceiver(TenantEntity tenantEntity, Long merchantId) { | |||||
| if(merchantId == null || merchantId.equals(0L)){ | |||||
| return null; | |||||
| } | |||||
| WxProfitPaymentReceiver record = wxProfitPaymentReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitPaymentReceiverType.wx_special_merchant_number); | |||||
| return record; | |||||
| } | |||||
| //无需分账,直接解冻 | //无需分账,直接解冻 | ||||
| @Override | @Override | ||||
| public PayShareResult noReciverShare(WxAppinfo appInfo,WxPayAccount payAccount,WxProfitSharingOrder record) { | public PayShareResult noReciverShare(WxAppinfo appInfo,WxPayAccount payAccount,WxProfitSharingOrder record) { | ||||
| @@ -101,6 +101,7 @@ public class Constant { | |||||
| //获取mall信息 | //获取mall信息 | ||||
| public static final String appinfoPrev = "appinfo:"; | public static final String appinfoPrev = "appinfo:"; | ||||
| public static final String payaccountPrev = "payAccount:"; | public static final String payaccountPrev = "payAccount:"; | ||||
| public static final String paymentReceicerPrev = "paymentReceicer:"; | |||||
| public static final String sharingReceicerPrev = "sharingReceicer:"; | public static final String sharingReceicerPrev = "sharingReceicer:"; | ||||
| public static final String mallinfoPrev = "mallinfo:"; | public static final String mallinfoPrev = "mallinfo:"; | ||||
| public static final String subMallinfoPrev = "mallinfo:subMallinfo:"; | public static final String subMallinfoPrev = "mallinfo:subMallinfo:"; | ||||
| @@ -0,0 +1,102 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxProfitPaymentReceiverMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxProfitPaymentReceiver"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="receiver_type" jdbcType="INTEGER" property="receiverType" /> | |||||
| <result column="receiver_account" jdbcType="VARCHAR" property="receiverAccount" /> | |||||
| <result column="receiver_comments" jdbcType="VARCHAR" property="receiverComments" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||||
| <result column="plat" jdbcType="INTEGER" property="plat" /> | |||||
| <result column="tt_import_status" jdbcType="VARCHAR" property="ttImportStatus" /> | |||||
| <result column="tt_import_url" jdbcType="VARCHAR" property="ttImportUrl" /> | |||||
| <result column="tt_balance_url" jdbcType="VARCHAR" property="ttBalanceUrl" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`, | |||||
| `receiver_type`,`receiver_account`,`receiver_comments`, | |||||
| `create_time`,`update_time`,`status`,`plat`, | |||||
| `tt_import_status`,`tt_import_url`,`tt_balance_url` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != receiverType "> | |||||
| and `receiver_type` = #{receiverType} | |||||
| </if> | |||||
| <if test=" null != receiverAccount and '' != receiverAccount "> | |||||
| and `receiver_account` like concat('%', #{receiverAccount},'%') | |||||
| </if> | |||||
| <if test=" null != receiverComments "> | |||||
| and `receiver_comments` like concat('%', #{receiverComments},'%') | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != plat "> | |||||
| and `plat` = #{plat} | |||||
| </if> | |||||
| <if test=" null != wxImportStatus"> | |||||
| and `tt_import_status` -> '$.wx' = #{wxImportStatus} | |||||
| </if> | |||||
| <if test=" null != alipayImportStatus"> | |||||
| and `tt_import_status` -> '$.alipay' = #{alipayImportStatus} | |||||
| </if> | |||||
| <if test=" null != hzImportStatus"> | |||||
| and `tt_import_status` -> '$.hz' = #{hzImportStatus} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxProfitPaymentReceiver" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_profit_payment_receiver | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <select id="findOne" parameterType="com.iformall.domain.po.WxProfitPaymentReceiver" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_profit_payment_receiver | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| limit 0,1 | |||||
| </select> | |||||
| </mapper> | |||||
| @@ -17,6 +17,7 @@ | |||||
| <result column="bank_code" jdbcType="VARCHAR" property="bankCode" /> | <result column="bank_code" jdbcType="VARCHAR" property="bankCode" /> | ||||
| <result column="status" jdbcType="INTEGER" property="status" /> | <result column="status" jdbcType="INTEGER" property="status" /> | ||||
| <result column="parameter" jdbcType="VARCHAR" property="parameter" /> | <result column="parameter" jdbcType="VARCHAR" property="parameter" /> | ||||
| <result column="plat" jdbcType="INTEGER" property="plat" /> | |||||
| <result column="tt_import_status" jdbcType="VARCHAR" property="ttImportStatus" /> | <result column="tt_import_status" jdbcType="VARCHAR" property="ttImportStatus" /> | ||||
| <result column="tt_import_url" jdbcType="VARCHAR" property="ttImportUrl" /> | <result column="tt_import_url" jdbcType="VARCHAR" property="ttImportUrl" /> | ||||
| @@ -24,7 +25,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`receiver_type`,`receiver_account`,`receiver_comments`,`create_time`,`update_time`,`sharing_type`,`bank_no`,`true_name`,`bank_code`,`status`,`parameter`,`is_use` | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`receiver_type`,`receiver_account`,`receiver_comments`,`create_time`,`update_time`,`sharing_type`,`bank_no`,`true_name`,`bank_code`,`status`,`parameter`,`plat`,`is_use` | |||||
| ,`tt_import_status`,`tt_import_url`,`tt_balance_url` | ,`tt_import_status`,`tt_import_url`,`tt_balance_url` | ||||
| </sql> | </sql> | ||||
| @@ -98,6 +99,10 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != plat "> | |||||
| and `plat` = #{plat} | |||||
| </if> | |||||
| <if test=" null !=isUse "> | <if test=" null !=isUse "> | ||||
| and `is_use` = #{isUse} | and `is_use` = #{isUse} | ||||