diff --git a/mallinkAdmin/src/main/resources/db/migration/V202301200001__contract.sql b/mallinkAdmin/src/main/resources/db/migration/V202301200001__contract.sql new file mode 100644 index 000000000..3b80de8c4 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V202301200001__contract.sql @@ -0,0 +1,5 @@ +ALTER TABLE `mallink`.`wx_rent_contract` +ADD COLUMN `revenue_ratio` int(1) NOT NULL DEFAULT 1 COMMENT '是否设置保底营业额,1-设置 0-不设置' AFTER `revenue`; + +ALTER TABLE `mallink`.`wx_rent_contract` +ADD COLUMN `revenue_year` JSON COMMENT '每年保底营业额' AFTER `revenue_ratio`; 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 fbb256e28..f63800f67 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxRentContract.java @@ -286,15 +286,21 @@ public class WxRentContract extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") private String adjustRatio; - + @io.swagger.annotations.ApiModelProperty(value = "计租周期 1日2月", name = "adjustPeriod") private Integer adjustPeriod; @io.swagger.annotations.ApiModelProperty(value = "支付比例", name = "payRatio") private Integer payRatio; - @io.swagger.annotations.ApiModelProperty(value = "营业额", name = "revenue") + @io.swagger.annotations.ApiModelProperty(value = "保底营业额", name = "revenue") private Long revenue; + + @io.swagger.annotations.ApiModelProperty(value = "是否设置保底营业额", name = "revenueRatio") + private Integer revenueRatio; + + @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") + private String revenueYear; @io.swagger.annotations.ApiModelProperty(value = "计租开始时间", name = "startDate") private Date startDate; diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustRatioWay.java b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustRatioWay.java index eb9af197e..03eee0190 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustRatioWay.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumRentContractAdjustRatioWay.java @@ -9,7 +9,8 @@ public enum EnumRentContractAdjustRatioWay { RATIO(1, "按比例"), MONEY(2, "按金额"), - CUSTOM(3, "自定义"),; + CUSTOM(3, "固定金额"), + FIX_RATIO(4, "固定比率"); public static EnumRentContractAdjustRatioWay getEnum(Integer code) { for (EnumRentContractAdjustRatioWay value : values()) { 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 419c72db0..971f77026 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -319,9 +319,9 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService if (null == record.getDeposit()) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "押金不能为空"); } - if (record.getPrice().longValue() <= 0) { - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "物业费要大于0"); - } +// if (record.getPrice().longValue() <= 0) { +// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "物业费要大于0"); +// } // WxPropertyContract propertyContract = new WxPropertyContract(); // propertyContract.updateTenantInfo(wxRentContract); 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 c52b590a6..dfad3f7fc 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -573,7 +573,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if(CollectionUtils.isEmpty(record.getPreviewBillRentList())) { if (record.getReceivePeriod() != null && record.getLease() != null - && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0)) { + && !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getRevenueRatio().equals(0)) { //删除预账单,重新生成 wxBillRentMapper.deletePreviewBill(record); resultList = buildRent(null, record, EnumIsPreview.YES.getCode(),true); @@ -1110,9 +1110,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { priceArrs = new long[size]; priceArrs[0] = price; BigDecimal priceD = new BigDecimal(price); + + String revenueYear = wxRentContract.getRevenueYear(); + List revenueYears = JSONArray.parseArray(revenueYear, Long.class); + revenueYears.add(0,0L); + if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { for (int i = 1; i < size; i++) { - BigDecimal divide = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); + BigDecimal divide = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(10000)); priceD = priceD.add(divide); priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); } @@ -1121,7 +1126,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { priceD = priceD.add(new BigDecimal(integers.get(i))); priceArrs[i] = priceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); } - } else { + } else if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.CUSTOM.getCode())){ for (int i = 1; i < size; i++) { if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) { @@ -1135,6 +1140,20 @@ public class WxRentContractServiceImpl implements WxRentContractService { } priceArrs[i] = new BigDecimal(integers.get(i)).setScale(0, RoundingMode.HALF_EVEN).longValue(); } + }else if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ + for (int i = 1; i < size; i++) { + if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { + if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) { + priceArrs[i] = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(integers.get(i))).multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue(); + continue; + } + if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) { + priceArrs[i] = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(integers.get(i))).multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue(); + continue; + } + } + priceArrs[i] = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(integers.get(i))).setScale(0, RoundingMode.HALF_EVEN).longValue(); + } } } diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 135d5b072..957e2020a 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -60,6 +60,8 @@ + + @@ -123,7 +125,7 @@ `property_name`,`property_fee`,`fee_cycle`,`water_fee`,`electricity_fees`, `deposit`,cashtype_content_lsit,cashtype_lsit,`pay_date`,`is_del`,`merchant_name`, `brand`,`business_id`,`shop_type`,`shop_type_str`,`updatetime`,`createtime`,`link_person`,`link_phone`,`link_address`, - `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, + `pay_account`,`filename`,`lease`,`type`,`revenue`,`revenue_ratio`,`revenue_year`,`adjust_ratio`,`adjust_period`,`pay_ratio`, `start_date`,`end_date`,`shop_name`,`from_id`, `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`, `business_type`,`rent_info`, `file_names`,price_unit,rent_price,other_rent_price_info,`subject_name`,rent_start_type, @@ -490,7 +492,7 @@ rc.`property_name`,rc.`property_fee`,rc.`fee_cycle`,rc.`water_fee`,rc.`electricity_fees`, rc.`deposit`,rc.cashtype_content_lsit,rc.cashtype_lsit,rc.`pay_date`,rc.`is_del`,rc.`merchant_name`, rc.`brand`,rc.`business_id`,rc.`shop_type`,rc.`shop_type_str`,rc.`updatetime`,rc.`createtime`,rc.`link_person`,rc.`link_phone`,rc.`link_address`, - rc.`pay_account`,rc.`filename`,rc.`lease`,rc.`type`,rc.`revenue`,rc.`adjust_ratio`,rc.`adjust_period`,rc.`pay_ratio`, + rc.`pay_account`,rc.`filename`,rc.`lease`,rc.`type`,rc.`revenue`,rc.`revenue_ratio`,rc.`revenue_year`,rc.`adjust_ratio`,rc.`adjust_period`,rc.`pay_ratio`, rc.`start_date`,rc.`end_date`,rc.`shop_name`,rc.`from_id`, rc.`apply_status`,rc.`bank_name`,rc.`rent_shop_type`,rc.`fix_start_date`,rc.`fix_end_date`, rc.`business_type`,rc.`rent_info`, rc.`file_names`,rc.price_unit,rent_price,rc.other_rent_price_info,rc.`subject_name`,rc.rent_start_type, @@ -515,7 +517,7 @@ rc.`property_name`,rc.`property_fee`,rc.`fee_cycle`,rc.`water_fee`,rc.`electricity_fees`, rc.`deposit`,rc.cashtype_content_lsit,rc.cashtype_lsit,rc.`pay_date`,rc.`is_del`,rc.`merchant_name`, rc.`brand`,rc.`business_id`,rc.`shop_type`,rc.`shop_type_str`,rc.`updatetime`,rc.`createtime`,rc.`link_person`,rc.`link_phone`,rc.`link_address`, - rc.`pay_account`,rc.`filename`,rc.`lease`,rc.`type`,rc.`revenue`,rc.`adjust_ratio`,rc.`adjust_period`,rc.`pay_ratio`, + rc.`pay_account`,rc.`filename`,rc.`lease`,rc.`type`,rc.`revenue`,rc.`revenue_ratio`,rc.`revenue_year`,rc.`adjust_ratio`,rc.`adjust_period`,rc.`pay_ratio`, rc.`start_date`,rc.`end_date`,rc.`shop_name`,rc.`from_id`, rc.`apply_status`,rc.`bank_name`,rc.`rent_shop_type`,rc.`fix_start_date`,rc.`fix_end_date`, rc.`business_type`,rc.`rent_info`, rc.`file_names`,rc.price_unit,rent_price,rc.other_rent_price_info,rc.`subject_name`,rc.rent_start_type,