| @@ -731,7 +731,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| //计算租金,每年-每个店铺租金 | //计算租金,每年-每个店铺租金 | ||||
| public List<long[]> computePrice(String rentInfo) { | |||||
| public List<long[]> computePrice(String rentInfo,Integer priceUnit) { | |||||
| JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); | ||||
| int arraySize = rentInfoArray.size(); | int arraySize = rentInfoArray.size(); | ||||
| @@ -740,7 +740,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| long[] priceArr = new long[arraySize]; | long[] priceArr = new long[arraySize]; | ||||
| for (int i = 0; i < arraySize; i++) { | for (int i = 0; i < arraySize; i++) { | ||||
| JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); | ||||
| priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue(); | |||||
| //年 需要除12 | |||||
| if(EnumPriceUnit.Y.getCode().equals(priceUnit)){ | |||||
| BigDecimal yprice = new BigDecimal(rentInfoObject.getString("price")).divide(new BigDecimal(12),2, BigDecimal.ROUND_HALF_DOWN); | |||||
| priceArr[i] = yprice.multiply(new BigDecimal(100)).longValue(); | |||||
| }else{ | |||||
| priceArr[i] = new BigDecimal(rentInfoObject.getString("price")).multiply(new BigDecimal(100)).longValue(); | |||||
| } | |||||
| } | } | ||||
| priceList.add(priceArr); | priceList.add(priceArr); | ||||
| //大于一年 | //大于一年 | ||||
| @@ -770,7 +777,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| !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); | |||||
| List<long[]> priceList = computePrice(rentInfo,wxRentContract.getPriceUnit()); | |||||
| 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++) { | ||||
| @@ -1744,7 +1751,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| } | } | ||||
| adjustRatioList.add(adjustRatioStr.toString()); | adjustRatioList.add(adjustRatioStr.toString()); | ||||
| } | } | ||||
| List<long[]> priceList = computePrice(rentInfo); | |||||
| List<long[]> priceList = computePrice(rentInfo,wxRentContract.getPriceUnit()); | |||||
| 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++) { | ||||