|
|
|
@@ -288,12 +288,17 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
* @param revenueLong |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public static BigDecimal countPrice(Integer decimalSize,Integer ratio,String revenueLong,int timeType,int period,int from){ |
|
|
|
public static BigDecimal countPrice(Integer decimalSize,String ratio,String revenueLong,int timeType,int period,int from){ |
|
|
|
if (StringUtils.isBlank(revenueLong)) { |
|
|
|
revenueLong = "0"; |
|
|
|
} |
|
|
|
BigDecimal revenue = new BigDecimal(revenueLong); |
|
|
|
BigDecimal payRatio = new BigDecimal(ratio == null ? 0 : ratio).divide(new BigDecimal(10000)); |
|
|
|
BigDecimal payRatio = null; |
|
|
|
if (StringUtils.isBlank(ratio)) { |
|
|
|
payRatio = new BigDecimal(0); |
|
|
|
}else { |
|
|
|
payRatio = new BigDecimal(ratio); |
|
|
|
} |
|
|
|
BigDecimal price; |
|
|
|
if(EnumMissTimeType.YEAR.getCode().equals(timeType) && EnumGetRatioFrom.RENT.getCode().equals(from)){ |
|
|
|
price = revenue.multiply(new BigDecimal(12)).multiply(payRatio).setScale(decimalSize, RoundingMode.HALF_EVEN); |
|
|
|
@@ -322,7 +327,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
BigDecimal revenue = new BigDecimal(revenueLong); |
|
|
|
String e = ratioList.get(i); |
|
|
|
String[] array = e.split(":"); |
|
|
|
Integer ratio = Integer.parseInt(array[1]); |
|
|
|
//Integer ratio = Integer.parseInt(array[1]); |
|
|
|
String ratio = array[1]; |
|
|
|
|
|
|
|
if(e.indexOf("-") >= 0){ |
|
|
|
String[] revenueArray = array[0].split("-"); |
|
|
|
@@ -438,7 +444,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
if(StringUtils.isBlank(record.getRevenue())){ |
|
|
|
record.setPrice("0"); |
|
|
|
}else{ |
|
|
|
if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ |
|
|
|
if(StringUtils.isNotBlank(record.getPayRatio())){ |
|
|
|
record.setPrice(countPrice(Constant.default_long_decimal_size,record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),EnumGetRatioFrom.RENT.getCode()).toPlainString()); |
|
|
|
}else{ |
|
|
|
int dayCount = record.getReceivePeriod() * 30; |
|
|
|
@@ -790,7 +796,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
|
|
|
|
if(!EnumFromType.SWITCH.getCode().equals(from)){ |
|
|
|
if (record.getType() != null && record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { |
|
|
|
if(record.getPayRatio()!=null && record.getPayRatio().intValue() > 0){ |
|
|
|
if(StringUtils.isNotBlank(record.getPayRatio())){ |
|
|
|
record.setPrice(countPrice(Constant.default_long_decimal_size,record.getPayRatio(),record.getRevenue(),EnumMissTimeType.OTHER.getCode(),record.getAdjustPeriod(),from).toPlainString()); |
|
|
|
}else{ |
|
|
|
int dayCount = record.getReceivePeriod() * 30; |
|
|
|
@@ -2729,86 +2735,86 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
// return result; |
|
|
|
// } |
|
|
|
|
|
|
|
public void ratioWay(WxRentContract wxRentContract, Map<String, Object> result, Integer lease, int extralease, int extracount, int paycount, int index, int count, BigDecimal rentPrice) { |
|
|
|
String adjustRatio = wxRentContract.getAdjustRatio(); |
|
|
|
List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class); |
|
|
|
integers.add(0, 0); |
|
|
|
//常规租期 |
|
|
|
for (int i = 0; i <= count; i++) { |
|
|
|
//开始时间 |
|
|
|
Calendar instance = Calendar.getInstance(); |
|
|
|
instance.setTime(wxRentContract.getRentalStartDate()); |
|
|
|
instance.add(Calendar.MONTH, lease * i); |
|
|
|
Date starttime = instance.getTime(); |
|
|
|
String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); |
|
|
|
result.put("rentalStartDate" + i, startdate); |
|
|
|
result.put("rentalStartDateYear" + i, startdate.substring(0, 4)); |
|
|
|
result.put("rentalStartDateMonth" + i, startdate.substring(5, 7)); |
|
|
|
result.put("rentalStartDateDay" + i, startdate.substring(8)); |
|
|
|
//结束时间 |
|
|
|
instance.clear(); |
|
|
|
instance.setTime(starttime); |
|
|
|
instance.add(Calendar.MONTH, lease); |
|
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
Date endtime = instance.getTime(); |
|
|
|
String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); |
|
|
|
result.put("rentalEndDate" + i, enddate); |
|
|
|
result.put("rentalEndDateYear" + i, enddate.substring(0, 4)); |
|
|
|
result.put("rentalEndDateMonth" + i, enddate.substring(5, 7)); |
|
|
|
result.put("rentalEndDateDay" + i, enddate.substring(8)); |
|
|
|
String ratio = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).toPlainString(); |
|
|
|
result.put("adjustRatio" + i, ratio); |
|
|
|
result.put("adjustPeriod" + i, wxRentContract.getAdjustPeriod()); |
|
|
|
Integer tempPayRatio = Optional.ofNullable(wxRentContract.getPayRatio()).orElse(0); |
|
|
|
String payRatio = new BigDecimal(tempPayRatio).divide(new BigDecimal(100)).toPlainString(); |
|
|
|
result.put("payRatio" + i, payRatio); |
|
|
|
|
|
|
|
} |
|
|
|
if (extracount > 0) { |
|
|
|
//额外租期 |
|
|
|
//开始时间 |
|
|
|
Calendar instance = Calendar.getInstance(); |
|
|
|
instance.setTime(wxRentContract.getRentalStartDate()); |
|
|
|
instance.add(Calendar.MONTH, lease * count); |
|
|
|
Date starttime = instance.getTime(); |
|
|
|
String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); |
|
|
|
result.put("rentalStartDate" + count, startdate); |
|
|
|
result.put("rentalStartDateYear" + count, startdate.substring(0, 4)); |
|
|
|
result.put("rentalStartDateMonth" + count, startdate.substring(5, 7)); |
|
|
|
result.put("rentalStartDateDay" + count, startdate.substring(8)); |
|
|
|
//结束时间 |
|
|
|
instance.clear(); |
|
|
|
instance.setTime(starttime); |
|
|
|
instance.add(Calendar.MONTH, extralease); |
|
|
|
instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
Date endtime = instance.getTime(); |
|
|
|
String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); |
|
|
|
result.put("rentalEndDate" + count, enddate); |
|
|
|
result.put("rentalEndDateYear" + count, enddate.substring(0, 4)); |
|
|
|
result.put("rentalEndDateMonth" + count, enddate.substring(5, 7)); |
|
|
|
result.put("rentalEndDateDay" + count, enddate.substring(8)); |
|
|
|
result.put("adjustRatio" + count, wxRentContract.getAdjustRatio()); |
|
|
|
result.put("adjustPeriod" + count, wxRentContract.getAdjustPeriod()); |
|
|
|
Integer tempPayRatio = Optional.ofNullable(wxRentContract.getPayRatio()).orElse(0); |
|
|
|
String payRatio = new BigDecimal(tempPayRatio).divide(new BigDecimal(100)).toPlainString(); |
|
|
|
result.put("payRatio" + count, payRatio); |
|
|
|
|
|
|
|
} |
|
|
|
//无数据租期 |
|
|
|
for (int i = paycount; i <= 10; i++) { |
|
|
|
result.put("rentalStartDate" + i, "/"); |
|
|
|
result.put("rentalStartDateYear" + i, "/"); |
|
|
|
result.put("rentalStartDateMonth" + i, "/"); |
|
|
|
result.put("rentalStartDateDay" + i, "/"); |
|
|
|
result.put("rentalEndDate" + i, "/"); |
|
|
|
result.put("rentalEndDateYear" + i, "/"); |
|
|
|
result.put("rentalEndDateMonth" + i, "/"); |
|
|
|
result.put("rentalEndDateDay" + i, "/"); |
|
|
|
result.put("adjustRatio" + i, "/"); |
|
|
|
result.put("adjustPeriod" + i, "/"); |
|
|
|
result.put("payRatio" + i, "/"); |
|
|
|
} |
|
|
|
} |
|
|
|
// public void ratioWay(WxRentContract wxRentContract, Map<String, Object> result, Integer lease, int extralease, int extracount, int paycount, int index, int count, BigDecimal rentPrice) { |
|
|
|
// String adjustRatio = wxRentContract.getAdjustRatio(); |
|
|
|
// List<Integer> integers = JSONArray.parseArray(adjustRatio, Integer.class); |
|
|
|
// integers.add(0, 0); |
|
|
|
// //常规租期 |
|
|
|
// for (int i = 0; i <= count; i++) { |
|
|
|
// //开始时间 |
|
|
|
// Calendar instance = Calendar.getInstance(); |
|
|
|
// instance.setTime(wxRentContract.getRentalStartDate()); |
|
|
|
// instance.add(Calendar.MONTH, lease * i); |
|
|
|
// Date starttime = instance.getTime(); |
|
|
|
// String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); |
|
|
|
// result.put("rentalStartDate" + i, startdate); |
|
|
|
// result.put("rentalStartDateYear" + i, startdate.substring(0, 4)); |
|
|
|
// result.put("rentalStartDateMonth" + i, startdate.substring(5, 7)); |
|
|
|
// result.put("rentalStartDateDay" + i, startdate.substring(8)); |
|
|
|
// //结束时间 |
|
|
|
// instance.clear(); |
|
|
|
// instance.setTime(starttime); |
|
|
|
// instance.add(Calendar.MONTH, lease); |
|
|
|
// instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
// Date endtime = instance.getTime(); |
|
|
|
// String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); |
|
|
|
// result.put("rentalEndDate" + i, enddate); |
|
|
|
// result.put("rentalEndDateYear" + i, enddate.substring(0, 4)); |
|
|
|
// result.put("rentalEndDateMonth" + i, enddate.substring(5, 7)); |
|
|
|
// result.put("rentalEndDateDay" + i, enddate.substring(8)); |
|
|
|
// String ratio = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).toPlainString(); |
|
|
|
// result.put("adjustRatio" + i, ratio); |
|
|
|
// result.put("adjustPeriod" + i, wxRentContract.getAdjustPeriod()); |
|
|
|
// Integer tempPayRatio = Optional.ofNullable(wxRentContract.getPayRatio()).orElse(0); |
|
|
|
// String payRatio = new BigDecimal(tempPayRatio).divide(new BigDecimal(100)).toPlainString(); |
|
|
|
// result.put("payRatio" + i, payRatio); |
|
|
|
// |
|
|
|
// } |
|
|
|
// if (extracount > 0) { |
|
|
|
// //额外租期 |
|
|
|
// //开始时间 |
|
|
|
// Calendar instance = Calendar.getInstance(); |
|
|
|
// instance.setTime(wxRentContract.getRentalStartDate()); |
|
|
|
// instance.add(Calendar.MONTH, lease * count); |
|
|
|
// Date starttime = instance.getTime(); |
|
|
|
// String startdate = DateUtils.date2String(starttime, "yyyy-MM-dd"); |
|
|
|
// result.put("rentalStartDate" + count, startdate); |
|
|
|
// result.put("rentalStartDateYear" + count, startdate.substring(0, 4)); |
|
|
|
// result.put("rentalStartDateMonth" + count, startdate.substring(5, 7)); |
|
|
|
// result.put("rentalStartDateDay" + count, startdate.substring(8)); |
|
|
|
// //结束时间 |
|
|
|
// instance.clear(); |
|
|
|
// instance.setTime(starttime); |
|
|
|
// instance.add(Calendar.MONTH, extralease); |
|
|
|
// instance.add(Calendar.DAY_OF_MONTH, -1); |
|
|
|
// Date endtime = instance.getTime(); |
|
|
|
// String enddate = DateUtils.date2String(endtime, "yyyy-MM-dd"); |
|
|
|
// result.put("rentalEndDate" + count, enddate); |
|
|
|
// result.put("rentalEndDateYear" + count, enddate.substring(0, 4)); |
|
|
|
// result.put("rentalEndDateMonth" + count, enddate.substring(5, 7)); |
|
|
|
// result.put("rentalEndDateDay" + count, enddate.substring(8)); |
|
|
|
// result.put("adjustRatio" + count, wxRentContract.getAdjustRatio()); |
|
|
|
// result.put("adjustPeriod" + count, wxRentContract.getAdjustPeriod()); |
|
|
|
// Integer tempPayRatio = Optional.ofNullable(wxRentContract.getPayRatio()).orElse(0); |
|
|
|
// String payRatio = new BigDecimal(tempPayRatio).divide(new BigDecimal(100)).toPlainString(); |
|
|
|
// result.put("payRatio" + count, payRatio); |
|
|
|
// |
|
|
|
// } |
|
|
|
// //无数据租期 |
|
|
|
// for (int i = paycount; i <= 10; i++) { |
|
|
|
// result.put("rentalStartDate" + i, "/"); |
|
|
|
// result.put("rentalStartDateYear" + i, "/"); |
|
|
|
// result.put("rentalStartDateMonth" + i, "/"); |
|
|
|
// result.put("rentalStartDateDay" + i, "/"); |
|
|
|
// result.put("rentalEndDate" + i, "/"); |
|
|
|
// result.put("rentalEndDateYear" + i, "/"); |
|
|
|
// result.put("rentalEndDateMonth" + i, "/"); |
|
|
|
// result.put("rentalEndDateDay" + i, "/"); |
|
|
|
// result.put("adjustRatio" + i, "/"); |
|
|
|
// result.put("adjustPeriod" + i, "/"); |
|
|
|
// result.put("payRatio" + i, "/"); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
public void areaWay(WxRentContract wxRentContract, Map<String, Object> result, Integer lease, int extralease, int extracount, int paycount, int index, int count, BigDecimal rentPrice) { |
|
|
|
|
|
|
|
|