From 50c7b778f12d514ae3a729a3ac4a36d84dda37a6 Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 23 May 2019 15:46:31 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96=E5=90=88=E5=90=8C=E9=9C=80?= =?UTF-8?q?=E6=B1=82][=E4=BF=AE=E6=94=B9][=E8=B0=83=E6=95=B4=E5=B9=B4?= =?UTF-8?q?=E7=9A=84=E7=A7=9F=E4=BB=B7]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxRentContractServiceImpl.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java index c0780d1b8..d9a9c7640 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -731,7 +731,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } //计算租金,每年-每个店铺租金 - public List computePrice(String rentInfo) { + public List computePrice(String rentInfo,Integer priceUnit) { JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); int arraySize = rentInfoArray.size(); @@ -740,7 +740,14 @@ public class WxRentContractServiceImpl implements WxRentContractService { long[] priceArr = new long[arraySize]; for (int i = 0; i < arraySize; 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); //大于一年 @@ -770,7 +777,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { !wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { String rentInfo = wxRentContract.getRentInfo(); JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - List priceList = computePrice(rentInfo); + List priceList = computePrice(rentInfo,wxRentContract.getPriceUnit()); size = priceList.size(); priceArrs = new long[size]; for (int i = 0; i < size; i++) { @@ -1744,7 +1751,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } adjustRatioList.add(adjustRatioStr.toString()); } - List priceList = computePrice(rentInfo); + List priceList = computePrice(rentInfo,wxRentContract.getPriceUnit()); int size = priceList.size(); priceArrs = new long[size]; for (int i = 0; i < size; i++) {