diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java index 0d4c8426d..24550c8aa 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -6,6 +6,7 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.WxMerchant; +import com.iformall.domain.po.WxProfitSharingReceiver; import com.iformall.domain.vo.WxMerchantVo; import com.iformall.service.WxMerchantService; import io.swagger.annotations.ApiImplicitParam; @@ -187,4 +188,13 @@ public class WxMerchantController extends BaseController { return wxMerchantService.top(wxMerchant); } + @ApiOperation("更新收款账户状态") + @PostMapping("useAccount") + @SystemControllerLog(description = "商户-更新收款账户状态") + public ResultData useAccount(@RequestBody WxProfitSharingReceiver wxProfitSharingReceiver) { + logger.debug("[" + getIpAddr() + "] WxMerchantController::useAccount"); + wxProfitSharingReceiver.setTenantId(getTenantId()); + return wxMerchantService.useAccount(wxProfitSharingReceiver); + } + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java b/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java index 63d16f207..a800957d7 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java @@ -3,6 +3,7 @@ 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.WxProfitSharingReceiver; import com.iformall.domain.vo.WxMerchantSimpleVo; import com.iformall.domain.vo.WxMerchantVo; @@ -89,4 +90,6 @@ public interface WxMerchantService { ResultData top(WxMerchant wxMerchant); + ResultData useAccount(WxProfitSharingReceiver wxProfitSharingReceiver); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java b/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java index 778af7994..4d5fe0e25 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxProfitSharingReceiverService.java @@ -46,4 +46,7 @@ public interface WxProfitSharingReceiverService { ResultData delReceiver(WxMerchant merchant); ResultData updateReceiver(WxMerchant merchant, WxProfitSharingReceiver receiver); + + void sendMsg(String phone, String account, String merchant, String time, Integer modelType, String tenantId); + } 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 5de9c8f1b..f11d87558 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -15,6 +15,7 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.*; import com.iformall.service.*; import com.iformall.utils.BeanMapping; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -90,6 +91,10 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired WxPropertyContractMapper wxPropertyContractMapper; + @Autowired + WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; + + @Override public PageInfo listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { @@ -644,4 +649,30 @@ public class WxMerchantServiceImpl implements WxMerchantService { wxMerchantMapper.updateByPrimaryKeySelective(wxMerchant); return new ResultData(Result.SUCCESS, "操作成功"); } + + @Override + public ResultData useAccount(WxProfitSharingReceiver wxProfitSharingReceiver) { + WxProfitSharingReceiver profitSharingReceiver = wxProfitSharingReceiverMapper.selectByPrimaryKey(wxProfitSharingReceiver.getId()); + profitSharingReceiver.setIsUse(wxProfitSharingReceiver.getIsUse()); + profitSharingReceiver.setUpdateTime(new Date()); + wxProfitSharingReceiverMapper.updateByPrimaryKeySelective(profitSharingReceiver); + + Long merchantId = profitSharingReceiver.getMerchantId(); + String accout = profitSharingReceiver.getReceiverAccount(); + WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(merchantId); + String linkPhone = wxMerchant.getLinkPhone(); + String merchantName = wxMerchant.getName(); + String tenantId = wxProfitSharingReceiver.getTenantId(); + if (StringUtils.isEmpty(linkPhone)) { + return new ResultData(Result.SUCCESS, "操作成功"); + } + //发信息 + Integer isUse = wxProfitSharingReceiver.getIsUse(); + Integer type = EnumMsgModel.ACCEPT_SHARING_ACCOUNT_NOTIFY_MANAGER.getCode(); + if (isUse.equals(EnumProfitSharingUse.NO.getCode())) { + type = EnumMsgModel.ACCEPT_SHARING_ACCOUNT_NOTIFY_MANAGER.getCode(); + } + wxProfitSharingReceiverService.sendMsg(linkPhone, accout, merchantName, null, type, tenantId); + return new ResultData(Result.SUCCESS, "操作成功"); + } } 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 ff178bb78..548d85a18 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java @@ -215,7 +215,8 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv } } - private void sendMsg(String phone, String account, String merchant, String time, Integer modelType, String tenantId) { + @Override + public void sendMsg(String phone, String account, String merchant, String time, Integer modelType, String tenantId) { // 发送短信 logger.info("》》》》》》》》》》》"); logger.info("商户分账账户发送短信开始");