|
|
|
@@ -80,7 +80,7 @@ public class WxRentContractHelper { |
|
|
|
priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(rentArea)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
} |
|
|
|
|
|
|
|
List<String[]> priceList = computeRatioByShop(Constant.default_long_decimal_size,rentInfoArray,wxRentContract.getBussinessManagementFeeRatioWay(),priceArr,feeRatioField); |
|
|
|
List<String[]> priceList = computeRatioByShop(Constant.default_long_decimal_size,rentInfoArray,wxRentContract.getBussinessManagementFeeRatioWay(),priceArr,feeRatioField,wxRentContract.getRentArea()); |
|
|
|
if (null != priceList) { |
|
|
|
return calcuteRatioByPart(priceList, feeRatioField); |
|
|
|
}else { |
|
|
|
@@ -95,7 +95,7 @@ public class WxRentContractHelper { |
|
|
|
rentArea = "0"; |
|
|
|
} |
|
|
|
String ratioFirstYearPrice = new BigDecimal(fee).multiply(new BigDecimal(rentArea)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
return calcuteRatioByJoin(Constant.default_long_decimal_size,ratioWay, ratio, ratioFirstYearPrice); |
|
|
|
return calcuteRatioByJoin(Constant.default_long_decimal_size,ratioWay, ratio, ratioFirstYearPrice,wxRentContract.getRentArea()); |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
@@ -125,6 +125,10 @@ public class WxRentContractHelper { |
|
|
|
for (int i = 1; i < size; i++) { |
|
|
|
priceArr[i] = new BigDecimal(integers.get(i)).divide(new BigDecimal(100)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
} |
|
|
|
}else if (wxPropertyContract.getAdjustRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ |
|
|
|
for (int i = 1; i < size; i++) { |
|
|
|
priceArr[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(wxPropertyContract.getRentArea())).divide(new BigDecimal(100)).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
} |
|
|
|
}else { |
|
|
|
for (int i = 1; i < size; i++) { |
|
|
|
priceArr[i] = wxPropertyContract.getPrice(); |
|
|
|
@@ -175,7 +179,7 @@ public class WxRentContractHelper { |
|
|
|
} |
|
|
|
priceArr[i] = priceStr; |
|
|
|
} |
|
|
|
return computeRatioByShop(Constant.default_long_decimal_size,rentInfoArray,wxRentContract.getAdjustRatioWay(),priceArr,"adjustRatio"); |
|
|
|
return computeRatioByShop(Constant.default_long_decimal_size,rentInfoArray,wxRentContract.getAdjustRatioWay(),priceArr,"adjustRatio",wxRentContract.getRentArea()); |
|
|
|
} |
|
|
|
|
|
|
|
//计算每年租金基数值(合铺录入),具体计算在合同创建时,会根据合同的PriceUnit来根据此基数来计算 |
|
|
|
@@ -259,6 +263,16 @@ public class WxRentContractHelper { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}else if (adjustRatioWay.equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ |
|
|
|
for (int i = 1; i < size; i++) { |
|
|
|
String _update = ""; |
|
|
|
if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { |
|
|
|
_update = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(wxRentContract.getRentArea())).toPlainString(); |
|
|
|
}else { |
|
|
|
_update = new BigDecimal(integers.get(i)).multiply(new BigDecimal(wxRentContract.getRentArea())).toPlainString(); |
|
|
|
} |
|
|
|
priceArrs[i] = new BigDecimal(_update).setScale(Constant.default_long_decimal_size, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (isCalcuted) { |
|
|
|
//租金和联营取高 |
|
|
|
@@ -321,13 +335,17 @@ public class WxRentContractHelper { |
|
|
|
} |
|
|
|
revenuePriceArrs[i] = _p.toPlainString(); |
|
|
|
} |
|
|
|
}else if (wxRentContract.getRevenueRatioWay().equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())){ |
|
|
|
for (int i = 1; i < size; i++) { |
|
|
|
revenuePriceArrs[i] = new BigDecimal(revenueYears.get(i)).multiply(new BigDecimal(wxRentContract.getRevenue())).toPlainString(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return revenuePriceArrs; |
|
|
|
} |
|
|
|
|
|
|
|
//合铺计算某项计费 |
|
|
|
private static String[] calcuteRatioByJoin(Integer decimalSize,Integer ratioWay,String ratio,String ratioFirstYearPrice) { |
|
|
|
private static String[] calcuteRatioByJoin(Integer decimalSize,Integer ratioWay,String ratio,String ratioFirstYearPrice,String rentArea) { |
|
|
|
List<Integer> integers = JSONArray.parseArray(ratio, Integer.class); |
|
|
|
integers.add(0, 0); |
|
|
|
int size = integers.size(); |
|
|
|
@@ -355,6 +373,10 @@ public class WxRentContractHelper { |
|
|
|
BigDecimal _p = priceD.multiply(new BigDecimal(integers.get(i))).divide(new BigDecimal(100)); |
|
|
|
priceArrs[i] = _p.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
} |
|
|
|
}else if (ratioWay.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())){ |
|
|
|
for (int i = 1; i < size; i++) { |
|
|
|
priceArrs[i] = new BigDecimal(integers.get(i)).multiply(new BigDecimal(rentArea)).setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
} |
|
|
|
} |
|
|
|
return priceArrs; |
|
|
|
} |
|
|
|
@@ -376,20 +398,20 @@ public class WxRentContractHelper { |
|
|
|
} |
|
|
|
|
|
|
|
//计算某项金额,每年-每个店铺金额 |
|
|
|
public static List<String[]> computeRatioByShop(Integer decimalSize,JSONArray rentInfoArray, Integer ratioWayType,String[] firstYearPrces,String ratioKey) { |
|
|
|
public static List<String[]> computeRatioByShop(Integer decimalSize,JSONArray rentInfoArray, Integer ratioWayType,String[] firstYearPrces,String ratioKey,String rentArea) { |
|
|
|
List<String[]> priceList = new ArrayList<>(); |
|
|
|
priceList.add(firstYearPrces); //每个店铺每月租金 |
|
|
|
//大于一年 |
|
|
|
JSONObject rentInfoObject = rentInfoArray.getJSONObject(0); |
|
|
|
JSONArray adjustRatio = rentInfoObject.getJSONArray(ratioKey);//[100,200] |
|
|
|
if (null != adjustRatio) { |
|
|
|
return computeRatioFromRentInfo(decimalSize,priceList, rentInfoArray, ratioWayType, adjustRatio.size(), ratioKey); |
|
|
|
return computeRatioFromRentInfo(decimalSize,priceList, rentInfoArray, ratioWayType, adjustRatio.size(), ratioKey,rentArea); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
//计算年调整后的某项计费 |
|
|
|
private static List<String[]> computeRatioFromRentInfo(Integer decimalSize,List<String[]> priceList,JSONArray rentInfoArray, Integer ratioWayType,int ratioYears,String ratioKey ) { |
|
|
|
private static List<String[]> computeRatioFromRentInfo(Integer decimalSize,List<String[]> priceList,JSONArray rentInfoArray, Integer ratioWayType,int ratioYears,String ratioKey,String rentArea ) { |
|
|
|
//循环多年的调整比例,如3年。[10,20,30] |
|
|
|
for (int i = 0; i < ratioYears; i++) { |
|
|
|
String[] priceArrs = new String[rentInfoArray.size()]; |
|
|
|
@@ -410,6 +432,9 @@ public class WxRentContractHelper { |
|
|
|
}else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.FIX_RATIO.getCode())) { |
|
|
|
BigDecimal price = new BigDecimal(priceList.get(i)[j]).multiply(new BigDecimal(adjustRatio.getString(i)).divide(new BigDecimal(100))); |
|
|
|
priceArrs[j] = price.setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
}else if (ratioWayType.equals(EnumRentContractAdjustRatioWay.FIX_UNIT_PRICE.getCode())) { |
|
|
|
BigDecimal price = new BigDecimal(adjustRatio.getString(i)).multiply(new BigDecimal(100)); |
|
|
|
priceArrs[j] = price.multiply(new BigDecimal(rentArea)).setScale(decimalSize, RoundingMode.HALF_UP).toPlainString(); |
|
|
|
} |
|
|
|
} |
|
|
|
priceList.add(priceArrs); |
|
|
|
|