From 069048a2ecd4fb7df5c656bd218f74ec4e69be3f Mon Sep 17 00:00:00 2001 From: luozukai Date: Mon, 29 Apr 2019 18:01:51 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=A1=E6=89=B9=E6=B5=81][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9][=E4=BF=AE=E6=94=B9=E9=A2=84=E8=A7=88=E8=B4=A6?= =?UTF-8?q?=E5=8D=95=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxRentContractController.java | 28 +++++++++++--- .../iformall/mapper/WxRentContractMapper.java | 2 + .../service/WxRentContractService.java | 1 + .../impl/WxPropertyContractServiceImpl.java | 2 +- .../impl/WxRentContractServiceImpl.java | 37 ++++++++++++------- .../resources/mapper/WxRentContractMapper.xml | 5 +++ 6 files changed, 55 insertions(+), 20 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java index 9671ca442..e0086ef88 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxRentContractController.java @@ -7,9 +7,13 @@ import com.iformall.common.ResultData; import com.iformall.domain.po.WxBillRent; import com.iformall.domain.po.WxPayAccountBill; import com.iformall.domain.po.WxRentContract; +import com.iformall.domain.po.WxShop; +import com.iformall.enums.EnumRentShopType; +import com.iformall.enums.EnumShopType; import com.iformall.service.WxBillRentService; import com.iformall.service.WxPayAccountBillService; import com.iformall.service.WxRentContractService; +import com.iformall.service.WxShopService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import org.apache.commons.lang3.StringUtils; @@ -35,9 +39,10 @@ public class WxRentContractController extends BaseController { private WxRentContractService wxRentContractService; @Autowired private WxBillRentService wxBillRentService; - @Autowired private WxPayAccountBillService payAccountBillService; + @Autowired + private WxShopService wxShopService; @GetMapping("list") @ApiImplicitParams({ @@ -59,7 +64,11 @@ public class WxRentContractController extends BaseController { public ResultData add(@RequestBody WxRentContract wxRentContract) { logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); wxRentContract.setTenantId(getTenantId()); - if(wxRentContract.getMonthHandleType() != null){ + + //目前只有多经点位租赁合同 + WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); + if(wxRentContract.getMonthHandleType() != null && wxRentContract.getMonthHandleType().intValue()==3 + && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); } return wxRentContractService.save(wxRentContract, getUser().getId(),getUser().getName()); @@ -70,7 +79,10 @@ public class WxRentContractController extends BaseController { public ResultData update(@RequestBody WxRentContract wxRentContract) { logger.debug("[" + getIpAddr() + "] WxRentContractController::update"); wxRentContract.setTenantId(getTenantId()); - if(wxRentContract.getMonthHandleType() != null){ + //目前只有多经点位租赁合同 + WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); + if(wxRentContract.getMonthHandleType() != null && wxRentContract.getMonthHandleType().intValue()==3 + && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); } return wxRentContractService.update(wxRentContract, getUser().getId(),getUser().getName()); @@ -81,7 +93,10 @@ public class WxRentContractController extends BaseController { public ResultData updateMoney(@RequestBody WxRentContract wxRentContract) { logger.debug("[" + getIpAddr() + "] WxRentContractController::updateMoney"); wxRentContract.setTenantId(getTenantId()); - if(wxRentContract.getMonthHandleType() != null){ + //目前只有多经点位租赁合同 + WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); + if(wxRentContract.getMonthHandleType() != null && wxRentContract.getMonthHandleType().intValue()==3 + && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); } return wxRentContractService.update(wxRentContract, getUser().getId(),getUser().getName()); @@ -92,7 +107,10 @@ public class WxRentContractController extends BaseController { public ResultData updateFile(@RequestBody WxRentContract wxRentContract) { logger.debug("[" + getIpAddr() + "] WxRentContractController::updateFile"); wxRentContract.setTenantId(getTenantId()); - if(wxRentContract.getMonthHandleType() != null){ + //目前只有多经点位租赁合同 + WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); + if(wxRentContract.getMonthHandleType() != null && wxRentContract.getMonthHandleType().intValue()==3 + && EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ wxRentContract.setAdjustPeriod(wxRentContract.getMonthHandleType()); } return wxRentContractService.updateFile(wxRentContract, getUser().getId(),getUser().getName()); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java index 2772d041b..709a3d5d4 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java @@ -57,4 +57,6 @@ public interface WxRentContractMapper extends CommonMapper int hasContractNumber(WxRentContract wxRentContract); + Integer getShopType(WxRentContract wxRentContract); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java index ed547746b..4f8145a37 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentContractService.java @@ -83,4 +83,5 @@ public interface WxRentContractService { ResultData hasContractNumber(WxRentContract wxRentContract); + Integer getShopType(WxRentContract wxRentContract); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index f5b52d197..c65587309 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -309,7 +309,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService wxPropertyContract.setDeposit(record.getDeposit()); wxPropertyContract.setReceivePeriod(record.getReceivePeriod()); wxPropertyContract.setPayAccount(record.getPayAccount()); - billList = buildProperty(new WxMerchant(),userId,wxPropertyContract,EnumIsPreview.YES.getCode()); + billList = buildProperty(new WxMerchant(),userId,record,EnumIsPreview.YES.getCode()); record.setPreviewBillRentList(billList); } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index 76f201643..ce3c11178 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -13,10 +13,7 @@ import com.iformall.domain.po.*; import com.iformall.enums.*; import com.iformall.exception.MallinkException; import com.iformall.mapper.*; -import com.iformall.service.WxFlowRecordService; -import com.iformall.service.WxFlowService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxRentContractService; +import com.iformall.service.*; import com.iformall.utils.Constant; import com.iformall.utils.DateUtils; import org.apache.commons.collections.map.HashedMap; @@ -98,6 +95,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { @Autowired WxMerchantShopMapper wxMerchantShopMapper; + @Autowired + WxShopService wxShopService; @Override public Map listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { @@ -127,17 +126,23 @@ public class WxRentContractServiceImpl implements WxRentContractService { } wxRentContract.setPrice(wxRentContract.getPrice() != null ? wxRentContract.getPrice() : 0); wxRentContract.setDeposit(wxRentContract.getDeposit() != null ? wxRentContract.getDeposit() : 0); - //handle adjustPeriod 1日 2月 monthHandleType 2按账单周期 3按自然月 - if(wxRentContract.getAdjustPeriod().intValue() == 1){ - wxRentContract.setAdjustPeriod(1); - wxRentContract.setMonthHandleType(null); - }else if(wxRentContract.getAdjustPeriod().intValue() == 2){ - wxRentContract.setAdjustPeriod(2); - wxRentContract.setMonthHandleType(2); - }else if(wxRentContract.getAdjustPeriod().intValue() == 3){ - wxRentContract.setAdjustPeriod(2); - wxRentContract.setMonthHandleType(3); + + //目前只有多经点位租赁合同 + WxShop wxShop = wxShopService.getById(wxRentContract.getShopId()); + if(EnumRentShopType.POINT.getCode().equals(wxShop.getType())){ + //handle adjustPeriod 1日 2月 monthHandleType 2按账单周期 3按自然月 + if(wxRentContract.getAdjustPeriod().intValue() == 1){ + wxRentContract.setAdjustPeriod(1); + wxRentContract.setMonthHandleType(null); + }else if(wxRentContract.getAdjustPeriod().intValue() == 2){ + wxRentContract.setAdjustPeriod(2); + wxRentContract.setMonthHandleType(2); + }else if(wxRentContract.getAdjustPeriod().intValue() == 3){ + wxRentContract.setAdjustPeriod(2); + wxRentContract.setMonthHandleType(3); + } } + result.put("wxRentContract", wxRentContract); //关联的商户 if (wxRentContract.getMerchantId() != null) { @@ -2032,6 +2037,10 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxRentContractMapper.updateApplyStatus(wxRentContract); } + @Override + public Integer getShopType(WxRentContract wxRentContract) { + return wxRentContractMapper.getShopType(wxRentContract); + } } diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 3387e44a7..ce7328f3e 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -271,5 +271,10 @@ + +