From e202349e95614193c493559e32aa7773c8f39bd9 Mon Sep 17 00:00:00 2001 From: xhxu Date: Tue, 12 Jul 2022 11:14:57 +0800 Subject: [PATCH] //tt share --- .../controller/basic/TtPoiPlanController.java | 2 +- .../basic/WxMerchantController.java | 55 ++++++++++-- .../mapper/WxProfitSharingReceiverMapper.java | 5 +- .../iformall/service/WxMerchantService.java | 2 +- .../service/impl/WxMerchantServiceImpl.java | 88 +++++++++++++------ .../mapper/WxProfitSharingReceiverMapper.xml | 9 +- .../basic/WxMerchantController.java | 16 ++-- 7 files changed, 127 insertions(+), 50 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java index d387033f0..844abd315 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtPoiPlanController.java @@ -107,7 +107,7 @@ public class TtPoiPlanController extends BaseController { } @ApiOperation("分页列表接口") - @GetMapping("takeRate") + @GetMapping("takeRateList") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) 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 54a328b00..3d325760b 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -16,9 +16,11 @@ import com.iformall.domain.po.WxProfitSharingReceiver; import com.iformall.domain.vo.WxMerchantTradeDetailVo; import com.iformall.domain.vo.WxMerchantTradeVo; import com.iformall.domain.vo.WxMerchantVo; +import com.iformall.douyin.pay.enums.AppAddSubMerchantUrlType; import com.iformall.enums.EnumAppPlat; import com.iformall.enums.EnumMerchantStatus; import com.iformall.enums.EnumPayWay; +import com.iformall.enums.EnumYesOrNo; import com.iformall.service.*; import com.iformall.utils.Constant; import io.swagger.annotations.ApiImplicitParam; @@ -273,14 +275,14 @@ 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.updateTenantInfo(getTenantInfo()); - return wxMerchantService.useAccount(wxProfitSharingReceiver); - } +// @ApiOperation("更新收款账户状态") +// @PostMapping("useAccount") +// @SystemControllerLog(description = "商户-更新收款账户状态") +// public ResultData useAccount(@RequestBody WxProfitSharingReceiver wxProfitSharingReceiver) { +// logger.debug("[" + getIpAddr() + "] WxMerchantController::useAccount"); +// wxProfitSharingReceiver.updateTenantInfo(getTenantInfo()); +// return wxMerchantService.useAccount(wxProfitSharingReceiver); +// } @ApiOperation("查看是否存在商户名称相同记录") @GetMapping("/hasMerchant") @@ -362,6 +364,43 @@ public class WxMerchantController extends BaseController { return wxProfitSharingReceiverService.updateTtReceiver(merchant,appInfo.getAppId(),payAcount.getApiKey()); } + + @ApiOperation("获取进件/余额页面") + @GetMapping("/getTtReceiverUrl") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) + public ResultData getTtReceiver(Long id,Integer urlType) { + logger.debug("[" + getIpAddr() + "] WxMerchantController::getTtReceiver"); + if(urlType == null || id == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"请检查传递参数"); + } + + WxMerchant merchant = wxMerchantService.selectById(id); + if(merchant == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); + } + AppAddSubMerchantUrlType anEnum = AppAddSubMerchantUrlType.getEnum(urlType); + if(anEnum == null){ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); + } + + WxAppinfo appInfo = wxAppinfoService.getCAppInfo(getTenantInfo(), EnumAppPlat.TOUTIAO); + if(appInfo == null) { + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxPayAccount payAcount = payAccountService.getById(appInfo.getPayId()); + if(payAcount == null){ + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + if(anEnum.equals(AppAddSubMerchantUrlType.improt_URL)){ + return wxProfitSharingReceiverService.getTtReceiverImprotURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); + }else if(anEnum.equals(AppAddSubMerchantUrlType.Balance_URL)){ + return wxProfitSharingReceiverService.getTtReceiverBalanceURL(merchant,appInfo.getAppId(),payAcount.getApiKey()); + }else{ + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"请检查传递参数"); + } + + } + @ApiOperation("修改可用状态") @GetMapping("/updateTtReceiverIsUse") @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java index bca55de5b..b8dabefad 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java @@ -10,7 +10,6 @@ public interface WxProfitSharingReceiverMapper extends CommonMapper findMerchantIdList(WxProfitSharingReceiver wxProfitSharingReceiver); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java b/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java index 5ad5eda4c..24e523edc 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java @@ -147,7 +147,7 @@ public interface WxMerchantService { ResultData top(WxMerchant wxMerchant); - ResultData useAccount(WxProfitSharingReceiver wxProfitSharingReceiver); +// ResultData useAccount(WxProfitSharingReceiver wxProfitSharingReceiver); boolean hasMerchant(WxMerchant wxMerchant); boolean hasMerchantEncode(WxMerchant wxMerchant); 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 7d0d3c061..5fe29b389 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -919,31 +919,31 @@ public class WxMerchantServiceImpl implements WxMerchantService { return new ResultData(Result.SUCCESS, "操作成功"); } - @Override - public ResultData useAccount(WxProfitSharingReceiver wxProfitSharingReceiver) { - WxProfitSharingReceiver profitSharingReceiver = wxProfitSharingReceiverMapper.selectById(wxProfitSharingReceiver.getId()); - profitSharingReceiver.setIsUse(wxProfitSharingReceiver.getIsUse()); - profitSharingReceiver.setUpdateTime(new Date()); - wxProfitSharingReceiverMapper.updateById(profitSharingReceiver); - - Long merchantId = profitSharingReceiver.getMerchantId(); - String accout = profitSharingReceiver.getReceiverAccount(); - WxMerchant wxMerchant = wxMerchantMapper.selectById(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.REJECT_SHARING_ACCOUNT_NOTIFY_MANAGER.getCode(); - } - wxProfitSharingReceiverService.sendMsg(linkPhone, accout, merchantName, null, type, wxMerchant); - return new ResultData(Result.SUCCESS, "操作成功"); - } +// @Override +// public ResultData useAccount(WxProfitSharingReceiver wxProfitSharingReceiver) { +// WxProfitSharingReceiver profitSharingReceiver = wxProfitSharingReceiverMapper.selectById(wxProfitSharingReceiver.getId()); +// profitSharingReceiver.setIsUse(wxProfitSharingReceiver.getIsUse()); +// profitSharingReceiver.setUpdateTime(new Date()); +// wxProfitSharingReceiverMapper.updateById(profitSharingReceiver); +// +// Long merchantId = profitSharingReceiver.getMerchantId(); +// String accout = profitSharingReceiver.getReceiverAccount(); +// WxMerchant wxMerchant = wxMerchantMapper.selectById(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.REJECT_SHARING_ACCOUNT_NOTIFY_MANAGER.getCode(); +// } +// wxProfitSharingReceiverService.sendMsg(linkPhone, accout, merchantName, null, type, wxMerchant); +// return new ResultData(Result.SUCCESS, "操作成功"); +// } @Override public boolean hasMerchant(WxMerchant wxMerchant) { @@ -999,6 +999,18 @@ public class WxMerchantServiceImpl implements WxMerchantService { } } } + + List isUseMerchantIds = new ArrayList(); + if(record.getIsUse() != null){ + WxProfitSharingReceiver wxProfitSharingReceiver = new WxProfitSharingReceiver(); + wxProfitSharingReceiver.updateTenantInfo(record); + wxProfitSharingReceiver.setSharingType(EnumProfitSharingType.PROFIT_SHARING_TYPE_DOUYIN.getCode()); + wxProfitSharingReceiver.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); + wxProfitSharingReceiver.setPlat(EnumAppPlat.TOUTIAO.getCode()); + wxProfitSharingReceiver.setIsUse(EnumProfitSharingUse.YES.getCode()); + isUseMerchantIds = wxProfitSharingReceiverMapper.findMerchantIdList(wxProfitSharingReceiver); + } + List merchantIds = new ArrayList(); String phone = StringUtils.trimToNull(record.getPhone()); if (null != phone) { @@ -1025,10 +1037,20 @@ public class WxMerchantServiceImpl implements WxMerchantService { merchantIds.addAll(floorMerchantIds); } } + + if(EnumProfitSharingUse.YES.getCode().equals(record.getIsUse())){ + if(merchantIds.size() > 0){ + merchantIds.retainAll(isUseMerchantIds); + }else{ + merchantIds.addAll(isUseMerchantIds); + } + } + if (merchantIds.size() > 0 ) { record.setIds(merchantIds); } - + + List noMerchantIds = new ArrayList(); Integer rentShopType = record.getRentShopType(); if (null != rentShopType) { WxRentContract rentContractQ = new WxRentContract(); @@ -1036,9 +1058,21 @@ public class WxMerchantServiceImpl implements WxMerchantService { rentContractQ.setStatuss(EnumRentContractStatus.getValidStatus()); List usedMerchantIds = wxRentContractMapper.getMerchantIdsByStatuss(rentContractQ); if (null != usedMerchantIds && usedMerchantIds.size() >0 ) { - record.setNotInids(usedMerchantIds); + noMerchantIds.addAll(usedMerchantIds); +// record.setNotInids(usedMerchantIds); } } + if(EnumProfitSharingUse.NO.getCode().equals(record.getIsUse())){ + if(noMerchantIds.size() > 0){ + noMerchantIds.retainAll(isUseMerchantIds); + }else{ + noMerchantIds.addAll(isUseMerchantIds); + } + } + + if(noMerchantIds.size() > 0){ + record.setNotInids(noMerchantIds); + } } @Override diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml index 26617cf05..166ad52d3 100644 --- a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml @@ -125,8 +125,13 @@ limit 0,1 - - + + + diff --git a/mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java b/mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java index f9871e2a1..9916b91c8 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -265,14 +265,14 @@ 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.updateTenantInfo(getTenantInfo()); - return wxMerchantService.useAccount(wxProfitSharingReceiver); - } +// @ApiOperation("更新收款账户状态") +// @PostMapping("useAccount") +// @SystemControllerLog(description = "商户-更新收款账户状态") +// public ResultData useAccount(@RequestBody WxProfitSharingReceiver wxProfitSharingReceiver) { +// logger.debug("[" + getIpAddr() + "] WxMerchantController::useAccount"); +// wxProfitSharingReceiver.updateTenantInfo(getTenantInfo()); +// return wxMerchantService.useAccount(wxProfitSharingReceiver); +// } @ApiOperation("查看是否存在商户名称相同记录") @GetMapping("/hasMerchant")