From dce4c7ff45ebf8adbd6356cedba7f052fc688c98 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Wed, 23 Oct 2019 16:50:30 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=88=E5=90=8C=E7=B1=BB=E5=9E=8B]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WxPropertyContractController.java | 7 ++- .../contract/WxRentContractController.java | 12 ++++-- .../V201910231605__ALTER_CONTRACT.sql | 14 ++++++ .../domain/po/WxPropertyContract.java | 4 ++ .../iformall/domain/po/WxRentContract.java | 3 +- .../java/com/iformall/enums/EnumContract.java | 6 +-- .../WxRentPropertyContractService.java | 2 + .../WxRentPropertyContractServiceImpl.java | 43 +++++++++++++++++++ 8 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V201910231605__ALTER_CONTRACT.sql diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java index a967c151f..4cdbb764a 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxPropertyContractController.java @@ -9,12 +9,14 @@ import com.iformall.domain.po.MallUserInfo; import com.iformall.domain.po.WxBillProperty; import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.WxPropertyContract; +import com.iformall.enums.EnumContractType; import com.iformall.enums.EnumIsPreview; import com.iformall.enums.EnumRentStartType; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxPropertyContractMapper; import com.iformall.service.WxBillPropertyService; import com.iformall.service.WxPropertyContractService; +import com.iformall.service.WxRentPropertyContractService; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import org.slf4j.Logger; @@ -39,6 +41,8 @@ public class WxPropertyContractController extends BaseController { private WxBillPropertyService wxBillPropertyService; @Autowired private WxPropertyContractMapper wxPropertyContractMapper; + @Autowired + private WxRentPropertyContractService wxRentPropertyContractService; private Logger logger = LoggerFactory.getLogger(WxPropertyContractController.class); @@ -65,7 +69,8 @@ public class WxPropertyContractController extends BaseController { MallUserInfo user = getUser(); wxPropertyContract.setTenantId(user.getTenantId()); wxPropertyContract.setAdjustPeriodHandle(); - + Integer contractType = wxRentPropertyContractService.getContractType(wxPropertyContract.getRentShopType(), wxPropertyContract.getOperationType(), EnumContractType.PROPERTY.getCode()); + wxPropertyContract.setContractType(contractType); if(wxPropertyContract.getRentStartType()!=null && wxPropertyContract.getRentStartType().equals(EnumRentStartType.STARTTIME.getCode())){ wxPropertyContract.setRentalStartDate(wxPropertyContract.getStartDate()); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java index 3f0437f22..65320c031 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/contract/WxRentContractController.java @@ -7,6 +7,7 @@ import com.iformall.common.Result; import com.iformall.common.ResultData; import com.iformall.controller.base.BaseController; import com.iformall.domain.po.*; +import com.iformall.enums.EnumContractType; import com.iformall.enums.EnumFromType; import com.iformall.enums.EnumIsPreview; import com.iformall.enums.EnumRentStartType; @@ -14,10 +15,7 @@ import com.iformall.exception.MallinkException; import com.iformall.mapper.WxBillPropertyMapper; import com.iformall.mapper.WxBillRentMapper; import com.iformall.mapper.WxRentContractMapper; -import com.iformall.service.WxBillRentService; -import com.iformall.service.WxMerchantService; -import com.iformall.service.WxPayAccountBillService; -import com.iformall.service.WxRentContractService; +import com.iformall.service.*; import com.iformall.utils.DateUtils; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -59,6 +57,10 @@ public class WxRentContractController extends BaseController { WxBillRentMapper wxBillRentMapper; @Autowired WxBillPropertyMapper wxBillPropertyMapper; + + @Autowired + private WxRentPropertyContractService wxRentPropertyContractService; + @GetMapping("autolatePay") @SystemControllerLog(description = "autolatePay") public ResultData autolatePay(String startDate, String endDate) throws Exception{ @@ -130,6 +132,8 @@ public class WxRentContractController extends BaseController { @SystemControllerLog(description = "租赁合同-添加") public ResultData add(@RequestBody WxRentContract wxRentContract) { logger.debug("[" + getIpAddr() + "] WxRentContractController::add"); + Integer contractType = wxRentPropertyContractService.getContractType(wxRentContract.getRentShopType(), wxRentContract.getOperationType(), EnumContractType.RENT.getCode()); + wxRentContract.setContractType(contractType); if(StringUtils.isBlank(wxRentContract.getBusDiscountRatio())){ wxRentContract.setBusDiscountTime(new Integer(0)); } diff --git a/mallinkAdmin/src/main/resources/db/migration/V201910231605__ALTER_CONTRACT.sql b/mallinkAdmin/src/main/resources/db/migration/V201910231605__ALTER_CONTRACT.sql new file mode 100644 index 000000000..6a10d00d8 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201910231605__ALTER_CONTRACT.sql @@ -0,0 +1,14 @@ +alter table wx_rent_contract +add column contract_type smallint(2) not null default 0 comment '合同类型1店铺租金合同5店铺租金物业合同3多经租金合同6多经租金物业合同'; +alter table wx_property_contract +add column contract_type smallint(2) not null default 0 comment '合同类型2店铺物业合同4多经物业合同5店铺租金物业合同6多经租金物业合同'; + +update wx_rent_contract set contract_type=1 where rent_shop_type=1 and operation_type=1; +update wx_rent_contract set contract_type=3 where rent_shop_type=2 and operation_type=1; +update wx_rent_contract set contract_type=5 where rent_shop_type=1 and operation_type=2; +update wx_rent_contract set contract_type=6 where rent_shop_type=2 and operation_type=2; + +update wx_property_contract set contract_type=2 where rent_shop_type=1 and operation_type=1; +update wx_property_contract set contract_type=4 where rent_shop_type=2 and operation_type=1; +update wx_property_contract set contract_type=5 where rent_shop_type=1 and operation_type=2; +update wx_property_contract set contract_type=6 where rent_shop_type=2 and operation_type=2; \ No newline at end of file diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java index b9ab1b49e..df8b8b8b8 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxPropertyContract.java @@ -198,4 +198,8 @@ public class WxPropertyContract extends BaseEntity { this.adjustPeriod = EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); } } + + @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") + private Integer contractType; + } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java index 8a45046fe..3a9e06e29 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -250,7 +250,8 @@ public class WxRentContract extends BaseEntity { } - + @io.swagger.annotations.ApiModelProperty(value = "合同类型", name = "contractType") + private Integer contractType; } diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumContract.java b/mallinkService/src/main/java/com/iformall/enums/EnumContract.java index 7941501c6..d10a7f020 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumContract.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumContract.java @@ -9,10 +9,10 @@ public enum EnumContract { SHOP_RENT(1, "店铺租赁合同"), SHOP_PROPERTY(3, "店铺物业合同"), - SHOP_PROPERTY_RENT(5, "店铺租赁物业合同"), + SHOP_RENT_PROPERTY(5, "店铺租赁物业合同"), POINT_RENT(2, "多经租赁合同"), - POIN_PROPERTY(4, "多经物业合同"), - SHOP_RENT_PROPERTY(6, "多经租赁物业合同"),; + POINT_PROPERTY(4, "多经物业合同"), + POINT_RENT_PROPERTY(6, "多经租赁物业合同"),; public static EnumContract getEnum(Integer code) { for (EnumContract value : values()) { diff --git a/mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java b/mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java index 25328a067..2cb1f12c5 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRentPropertyContractService.java @@ -18,4 +18,6 @@ public interface WxRentPropertyContractService { ResultData insertRentForCreate(WxRentContract wxRentContract); + Integer getContractType(Integer rentShopType, Integer operationType, Integer contract); + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java index 3f4cc33c8..87e18b897 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentPropertyContractServiceImpl.java @@ -8,6 +8,10 @@ import com.iformall.domain.po.WxBillProperty; import com.iformall.domain.po.WxPropertyContract; import com.iformall.domain.po.WxRentContract; import com.iformall.domain.vo.WxRentPropertyContractVo; +import com.iformall.enums.EnumContract; +import com.iformall.enums.EnumContractOperationType; +import com.iformall.enums.EnumContractType; +import com.iformall.enums.EnumRentShopType; import com.iformall.exception.MallinkException; import com.iformall.mapper.WxPropertyContractMapper; import com.iformall.mapper.WxRentContractMapper; @@ -88,6 +92,45 @@ public class WxRentPropertyContractServiceImpl implements WxRentPropertyContract public ResultData insertRentForCreate(WxRentContract wxRentContract) { return null; } + + @Override + public Integer getContractType(Integer rentShopType, Integer operationType, Integer contract) { + //店铺租赁合同 + if (contract.equals(EnumContractType.RENT.getCode()) + && rentShopType.equals(EnumRentShopType.SHOP.getCode()) + && operationType.equals(EnumContractOperationType.PART.getCode())) { + return EnumContract.SHOP_RENT.getCode(); + } + //多经租赁合同 + if (contract.equals(EnumContractType.RENT.getCode()) + && rentShopType.equals(EnumRentShopType.POINT.getCode()) + && operationType.equals(EnumContractOperationType.PART.getCode())) { + return EnumContract.POINT_RENT.getCode(); + } + //店铺物业合同 + if (contract.equals(EnumContractType.PROPERTY.getCode()) + && rentShopType.equals(EnumRentShopType.SHOP.getCode()) + && operationType.equals(EnumContractOperationType.PART.getCode())) { + return EnumContract.SHOP_PROPERTY.getCode(); + } + //多经物业合同 + if (contract.equals(EnumContractType.PROPERTY.getCode()) + && rentShopType.equals(EnumRentShopType.POINT.getCode()) + && operationType.equals(EnumContractOperationType.PART.getCode())) { + return EnumContract.POINT_PROPERTY.getCode(); + } + //店铺租赁物业合同 + if (rentShopType.equals(EnumRentShopType.SHOP.getCode()) + && operationType.equals(EnumContractOperationType.WHOLE.getCode())) { + return EnumContract.SHOP_RENT_PROPERTY.getCode(); + } + //多经租赁物业合同 + if (rentShopType.equals(EnumRentShopType.POINT.getCode()) + && operationType.equals(EnumContractOperationType.WHOLE.getCode())) { + return EnumContract.POINT_RENT_PROPERTY.getCode(); + } + return 0; + } }