From 88d297d0353c73f4e7840234792ec6d5adfc3d34 Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 1 Apr 2022 17:50:58 +0800 Subject: [PATCH] //add sharing --- .../iformall/controller/WxMerchantController.java | 15 ++++++++++++++- .../service/WxProfitSharingReceiverService.java | 3 ++- .../service/impl/WxMerchantServiceImpl.java | 4 ++-- .../impl/WxProfitSharingReceiverServiceImpl.java | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java index f02b29102..231aa4cf2 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxMerchantController.java @@ -5,6 +5,7 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.*; import com.iformall.enums.EnumMsgSend; import com.iformall.enums.EnumPayWay; +import com.iformall.enums.EnumProfitSharingType; import com.iformall.service.WxCUserService; import com.iformall.service.WxMerchantService; import com.iformall.service.WxProfitSharingReceiverService; @@ -47,7 +48,19 @@ public class WxMerchantController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); } wxMerchant.updateTenantInfo(getTenantInfo()); - return new ResultData(wxProfitSharingReceiverService.findReceiver(wxMerchant)); + return new ResultData(wxProfitSharingReceiverService.findReceiver(wxMerchant, EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT)); + } + + @ApiOperation("查询账户信息") + @GetMapping("/findTtAccountById") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) + public ResultData findTtAccountById(@ModelAttribute WxMerchant wxMerchant) { + log.debug("[" + getIpAddr() + "] WxMerchantController::findTtAccountById"); + if (wxMerchant.getId() == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "商户ID不能为空"); + } + wxMerchant.updateTenantInfo(getTenantInfo()); + return new ResultData(wxProfitSharingReceiverService.findReceiver(wxMerchant,EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN)); } @ApiOperation("更新收款账户信息:必填项 id(商户ID) name(商户名称) accountId(账号ID) accountTypeValue(账号类型) accountName(账号名称)") diff --git a/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java b/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java index 3b4336773..62b621414 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java @@ -6,6 +6,7 @@ import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxProfitSharingReceiver; import com.iformall.domain.po.base.TenantEntity; import com.iformall.enums.EnumPayWay; +import com.iformall.enums.EnumProfitSharingType; import java.util.List; @@ -43,7 +44,7 @@ public interface WxProfitSharingReceiverService { */ void deleteById(Long id); - WxProfitSharingReceiver findReceiver(WxMerchant merchant); + WxProfitSharingReceiver findReceiver(WxMerchant merchant, EnumProfitSharingType sharingType); ResultData addReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver, List delList,EnumPayWay payWay); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 1ced0ef68..c81932c07 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -317,7 +317,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxMerchant.setUsers(userList); //分账信息 - WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(wxMerchant); + WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(wxMerchant,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); if (receiver != null) { wxMerchant.setWxProfitSharingReceiver(receiver); wxMerchant.setAccountId(receiver.getReceiverAccount()); @@ -872,7 +872,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { list.stream().forEach(m->{ //分账信息 - WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(m); + WxProfitSharingReceiver receiver = wxProfitSharingReceiverService.findReceiver(m,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); if (receiver != null) { m.setAccountId(receiver.getReceiverAccount()); m.setAccountName(receiver.getTrueName()); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java index 1c1200415..4d21a81aa 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java @@ -115,11 +115,11 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv //todo 微信和抖音分账可能存在两个分账信息 @Override - public WxProfitSharingReceiver findReceiver(WxMerchant merchant) { + public WxProfitSharingReceiver findReceiver(WxMerchant merchant, EnumProfitSharingType sharingType) { WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); receiver.updateTenantInfo(merchant); receiver.setMerchantId(merchant.getId()); -// receiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT.getCode()); + receiver.setSharingType(sharingType.getCode()); receiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); List list = wxProfitSharingReceiverMapper.findList(receiver); if(list != null && list.size() > 0){