| @@ -3,3 +3,9 @@ ADD COLUMN `revenue_ratio` int(1) NOT NULL DEFAULT 1 COMMENT '是否设置保底 | |||
| ALTER TABLE `mallink`.`wx_rent_contract` | |||
| ADD COLUMN `revenue_year` JSON COMMENT '每年保底营业额' AFTER `revenue_ratio`; | |||
| ALTER TABLE `mallink`.`wx_rent_contract` | |||
| ADD COLUMN `revenue_ratio_way` int(1) COMMENT '联营扣点调整方式1按比例2按金额(仅联营面积取高时用)' AFTER `adjust_ratio_way`; | |||
| ALTER TABLE `mallink`.`wx_rent_contract` | |||
| ADD COLUMN `revenue_ratio_set` JSON COMMENT '联营扣点调整比率(仅联营面积取高时用)' AFTER `revenue_ratio_way`; | |||
| @@ -287,6 +287,9 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "调整比例", name = "adjustRatio") | |||
| private String adjustRatio; | |||
| @io.swagger.annotations.ApiModelProperty(value = "联营扣点调整比率(仅联营面积取高时用)", name = "revenueRatioSet") | |||
| private String revenueRatioSet; | |||
| @io.swagger.annotations.ApiModelProperty(value = "计租周期 1日2月", name = "adjustPeriod") | |||
| private Integer adjustPeriod; | |||
| @@ -371,6 +374,9 @@ public class WxRentContract extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "年租金调整方式1按比例2按金额", name = "adjust_ratio_way") | |||
| private Integer adjustRatioWay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "联营扣点调整方式1按比例2按金额(仅联营面积取高时用)", name = "revenueRatioWay") | |||
| private Integer revenueRatioWay; | |||
| @io.swagger.annotations.ApiModelProperty(value = "操作类型1区分租赁物业2合并租赁物业3金茂", name = "operationType") | |||
| private Integer operationType; | |||
| @@ -1121,6 +1121,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| priceArrs[0] = price; | |||
| BigDecimal priceD = new BigDecimal(price); | |||
| //联营保底营业额。 | |||
| String revenueYear = wxRentContract.getRevenueYear(); | |||
| List<Long> revenueYears = null; | |||
| if (!StringUtils.isBlank(revenueYear)) { | |||
| @@ -1130,6 +1131,72 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| } | |||
| revenueYears.add(0,0L); | |||
| //联营面积取高时,联营扣点调整比率设置 | |||
| long[] revenuePriceArrs = new long[size]; | |||
| if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { | |||
| revenuePriceArrs[0] = price; | |||
| BigDecimal revenuePriceD = new BigDecimal(price); | |||
| //联营扣点调整比率 | |||
| String revenueRationSet = wxRentContract.getRevenueRatioSet(); | |||
| List<Long> revenueRationSets = null; | |||
| if (!StringUtils.isBlank(revenueRationSet)) { | |||
| revenueRationSets = JSONArray.parseArray(revenueRationSet, Long.class); | |||
| }else { | |||
| revenueRationSets = new ArrayList<Long>(); | |||
| } | |||
| revenueRationSets.add(0,0L); | |||
| if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { | |||
| for (int i = 1; i < size; i++) { | |||
| //联营扣点算法 | |||
| if (revenueYears.size() == size && revenueRationSets.size() == size) { | |||
| BigDecimal _p = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(revenueRationSets.get(i))).divide(new BigDecimal(10000)); | |||
| revenuePriceD = revenuePriceD.add(_p); | |||
| } | |||
| revenuePriceArrs[i] = revenuePriceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| } | |||
| } else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.MONEY.getCode())) { | |||
| for (int i = 1; i < size; i++) { | |||
| if (revenueYears.size() == size && revenueRationSets.size() == size) { | |||
| revenuePriceD = revenuePriceD.add(new BigDecimal(revenueRationSets.get(i))); | |||
| } | |||
| revenuePriceArrs[i] = revenuePriceD.setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| } | |||
| } else if (wxRentContract.getRevenueRatioWay().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())) { | |||
| revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| continue; | |||
| } | |||
| if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) { | |||
| revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| continue; | |||
| } | |||
| } | |||
| revenuePriceArrs[i] = new BigDecimal(revenueRationSets.get(i)).setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| } | |||
| }else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ | |||
| for (int i = 1; i < size; i++) { | |||
| BigDecimal _p = new BigDecimal(0) ; | |||
| if (revenueYears.size() == size && revenueRationSets.size() == size) { | |||
| _p = new BigDecimal(revenueRationSets.get(i)).multiply(new BigDecimal(revenueYears.get(i))).multiply(_p); | |||
| } | |||
| if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||
| if (EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())) { | |||
| revenuePriceArrs[i] = _p.multiply(new BigDecimal(12)).setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| continue; | |||
| } | |||
| if (EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())) { | |||
| revenuePriceArrs[i] = _p.multiply(new BigDecimal(wxRentContract.getReceivePeriod())).setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| continue; | |||
| } | |||
| } | |||
| revenuePriceArrs[i] = _p.setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| } | |||
| } | |||
| } | |||
| if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { | |||
| for (int i = 1; i < size; i++) { | |||
| BigDecimal _p = priceD; | |||
| @@ -1178,6 +1245,15 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| priceArrs[i] = _p.setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||
| } | |||
| } | |||
| //租金和联营取高 | |||
| if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { | |||
| for (int i = 0 ; i < priceArrs.length; i ++) { | |||
| if (priceArrs[i] < revenuePriceArrs[i]) { | |||
| priceArrs[i] = revenuePriceArrs[i]; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| int month = 12; | |||
| @@ -62,6 +62,8 @@ | |||
| <result column="revenue" jdbcType="INTEGER" property="revenue"/> | |||
| <result column="revenue_ratio" jdbcType="INTEGER" property="revenueRatio"/> | |||
| <result column="revenue_year" jdbcType="VARCHAR" property="revenueYear"/> | |||
| <result column="revenue_ratio_way" jdbcType="INTEGER" property="revenueRatioWay"/> | |||
| <result column="revenue_ratio_set" jdbcType="VARCHAR" property="revenueRatioSet"/> | |||
| <result column="adjust_ratio" jdbcType="VARCHAR" property="adjustRatio"/> | |||
| <result column="adjust_period" jdbcType="INTEGER" property="adjustPeriod"/> | |||
| <result column="pay_ratio" jdbcType="INTEGER" property="payRatio"/> | |||
| @@ -125,7 +127,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`,`revenue_ratio`,`revenue_year`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | |||
| `pay_account`,`filename`,`lease`,`type`,`revenue`,`revenue_ratio`,`revenue_year`,`revenue_ratio_way`,`revenue_ratio_set`,`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, | |||
| @@ -492,7 +494,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.`revenue_ratio`,rc.`revenue_year`,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.`revenue_ratio_way`,rc.`revenue_ratio_set`,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, | |||
| @@ -517,7 +519,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.`revenue_ratio`,rc.`revenue_year`,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.`revenue_ratio_way`,rc.`revenue_ratio_set`,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, | |||