| @@ -220,6 +220,12 @@ public class WxRentContract extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "1按租赁日生产2按计租日生成账单", name = "rentStartType") | @io.swagger.annotations.ApiModelProperty(value = "1按租赁日生产2按计租日生成账单", name = "rentStartType") | ||||
| private Integer rentStartType; | private Integer rentStartType; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "租金录入方式1合铺录入2分铺录入", name = "rent_input_way") | |||||
| private Integer rentInputWay; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "年租金调整方式1按比例2按金额", name = "adjust_ratio_way") | |||||
| private Integer adjustRatioWay; | |||||
| // public Integer getAdjustPeriod() { | // public Integer getAdjustPeriod() { | ||||
| // if(EnumPriceUnit.D.getCode().equals(this.getPriceUnit()) && EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode().equals(adjustPeriod)){ | // if(EnumPriceUnit.D.getCode().equals(this.getPriceUnit()) && EnumRentContractAdjustPeriod.ADJUST_PERIOD_MONTH.getCode().equals(adjustPeriod)){ | ||||
| // return EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); | // return EnumRentContractAdjustPeriod.ADJUST_PERIOD_DAY.getCode(); | ||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumRentContractAdjustRatioWay { | |||||
| RATIO(1, "按比例"), | |||||
| MONEY(2, "按金额"),; | |||||
| public static EnumRentContractAdjustRatioWay getEnum(Integer code) { | |||||
| for (EnumRentContractAdjustRatioWay value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumRentContractAdjustRatioWay(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,37 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public enum EnumRentContractRentInputWay { | |||||
| WHOLE(1, "合铺录入"), | |||||
| PART(2, "分铺录入"),; | |||||
| public static EnumRentContractRentInputWay getEnum(Integer code) { | |||||
| for (EnumRentContractRentInputWay value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumRentContractRentInputWay(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -761,7 +761,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| //计算租金,每年-每个店铺租金 | //计算租金,每年-每个店铺租金 | ||||
| public List<long[]> computePrice(String rentInfo,Integer priceUnit) { | |||||
| public List<long[]> computePrice(String rentInfo, WxRentContract wxRentContract) { | |||||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | ||||
| int arraySize = rentInfoArray.size(); | int arraySize = rentInfoArray.size(); | ||||
| @@ -777,18 +777,32 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(0); | JSONObject rentInfoObject = rentInfoArray.getJSONObject(0); | ||||
| JSONArray adjustRatio = rentInfoObject.getJSONArray("adjustRatio"); | JSONArray adjustRatio = rentInfoObject.getJSONArray("adjustRatio"); | ||||
| int adjustRatioSize = adjustRatio.size(); | int adjustRatioSize = adjustRatio.size(); | ||||
| for (int i = 0; i < adjustRatioSize; i++) { | |||||
| long[] priceArrs = new long[arraySize]; | |||||
| for (int j = 0; j < arraySize; j++) { | |||||
| rentInfoObject = rentInfoArray.getJSONObject(j); | |||||
| adjustRatio = rentInfoObject.getJSONArray("adjustRatio"); | |||||
| BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); | |||||
| BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply); | |||||
| priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||||
| //判断年租金调整方式 | |||||
| if (wxRentContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.RATIO.getCode())) { | |||||
| for (int i = 0; i < adjustRatioSize; i++) { | |||||
| long[] priceArrs = new long[arraySize]; | |||||
| for (int j = 0; j < arraySize; j++) { | |||||
| rentInfoObject = rentInfoArray.getJSONObject(j); | |||||
| adjustRatio = rentInfoObject.getJSONArray("adjustRatio"); | |||||
| BigDecimal multiply = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); | |||||
| BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(multiply); | |||||
| priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||||
| } | |||||
| priceList.add(priceArrs); | |||||
| } | |||||
| } else { | |||||
| for (int i = 0; i < adjustRatioSize; i++) { | |||||
| long[] priceArrs = new long[arraySize]; | |||||
| for (int j = 0; j < arraySize; j++) { | |||||
| rentInfoObject = rentInfoArray.getJSONObject(j); | |||||
| adjustRatio = rentInfoObject.getJSONArray("adjustRatio"); | |||||
| BigDecimal price = new BigDecimal(priceList.get(i)[j]).add(new BigDecimal(adjustRatio.getString(i))); | |||||
| priceArrs[j] = price.setScale(0, RoundingMode.HALF_EVEN).longValue(); | |||||
| } | |||||
| priceList.add(priceArrs); | |||||
| } | } | ||||
| priceList.add(priceArrs); | |||||
| } | } | ||||
| return priceList; | return priceList; | ||||
| } | } | ||||
| @@ -797,10 +811,11 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| long[] priceArrs = null; | long[] priceArrs = null; | ||||
| List<Map<String, Object>> shopInfos = new ArrayList<>(); | List<Map<String, Object>> shopInfos = new ArrayList<>(); | ||||
| if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) && | if (wxRentContract.getRentShopType().equals(EnumRentShopType.SHOP.getCode()) && | ||||
| wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode()) && | |||||
| !wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | !wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | ||||
| String rentInfo = wxRentContract.getRentInfo(); | String rentInfo = wxRentContract.getRentInfo(); | ||||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | ||||
| List<long[]> priceList = computePrice(rentInfo,wxRentContract.getPriceUnit()); | |||||
| List<long[]> priceList = computePrice(rentInfo, wxRentContract); | |||||
| size = priceList.size(); | size = priceList.size(); | ||||
| priceArrs = new long[size]; | priceArrs = new long[size]; | ||||
| for (int i = 0; i < size; i++) { | for (int i = 0; i < size; i++) { | ||||
| @@ -1693,7 +1708,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| adjustRatioList.add(adjustRatioStr.toString()); | adjustRatioList.add(adjustRatioStr.toString()); | ||||
| } | } | ||||
| List<long[]> priceList = computePrice(rentInfo,wxRentContract.getPriceUnit()); | |||||
| List<long[]> priceList = computePrice(rentInfo, wxRentContract); | |||||
| int size = priceList.size(); | int size = priceList.size(); | ||||
| priceArrs = new long[size]; | priceArrs = new long[size]; | ||||
| for (int i = 0; i < size; i++) { | for (int i = 0; i < size; i++) { | ||||
| @@ -48,7 +48,10 @@ | |||||
| <result column="rent_price" property="rentPrice"/> | <result column="rent_price" property="rentPrice"/> | ||||
| <result column="subject_name" property="subjectName"/> | <result column="subject_name" property="subjectName"/> | ||||
| <result column="rent_start_type" property="rentStartType"/> | <result column="rent_start_type" property="rentStartType"/> | ||||
| <result column="rent_input_way" property="rentInputWay"/> | |||||
| <result column="adjust_ratio_way" property="adjustRatioWay"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| @@ -58,7 +61,8 @@ | |||||
| `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | `pay_account`,`filename`,`lease`,`type`,`revenue`,`adjust_ratio`,`adjust_period`,`pay_ratio`, | ||||
| `start_date`,`end_date`, | `start_date`,`end_date`, | ||||
| `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`, | `apply_status`,`bank_name`,`rent_shop_type`,`fix_start_date`,`fix_end_date`, | ||||
| `business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type | |||||
| `business_type`,`rent_info`, `file_names`,price_unit,rent_price,`subject_name`,rent_start_type, | |||||
| `rent_input_way`,`adjust_ratio_way` | |||||
| </sql> | </sql> | ||||
| @@ -118,7 +122,8 @@ | |||||
| rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name | rc.start_date startDate,rc.end_date endDate,br.`name` brandName,rc.apply_status applyStatus,rc.bank_name | ||||
| bankName,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate | bankName,rc.rent_shop_type rentShopType,rc.fix_start_date fixStartDate,rc.fix_end_date fixEndDate | ||||
| ,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names | ,rc.business_type businessType,rc.adjust_period adjustPeriod,rc.rent_info rentInfo, rc.file_names | ||||
| fileNames,rc.price_unit,rc.subject_name subjectName | |||||
| fileNames,rc.price_unit,rc.subject_name subjectName,rc.`rent_input_way` rentInputWay,rc.`adjust_ratio_way` | |||||
| adjustRatioWay | |||||
| from wx_rent_contract rc | from wx_rent_contract rc | ||||
| left join wx_shop s on rc.shop_id=s.id | left join wx_shop s on rc.shop_id=s.id | ||||
| left join wx_mall_floor f on s.floor=f.id | left join wx_mall_floor f on s.floor=f.id | ||||