From 3aa09c3da4ca76393c484b247827289cf541c6bf Mon Sep 17 00:00:00 2001 From: zhengfangyuan Date: Sat, 31 Dec 2022 19:22:56 +0800 Subject: [PATCH] fix bug --- .../service/helper/WxRentContractHelper.java | 26 +++++++++++-------- .../impl/WxRentContractServiceImpl.java | 6 ++--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java index 856e76607..a7566682f 100644 --- a/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java +++ b/mallinkService/src/main/java/com/iformall/service/helper/WxRentContractHelper.java @@ -73,17 +73,7 @@ public class WxRentContractHelper { if (wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())) { //计算每年租金基数(按面积,分铺录入) //第一年 - JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); - long[] priceArr = new long[rentInfoArray.size()]; - for (int i = 0; i < rentInfoArray.size(); i++) { - JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); - String priceStr = rentInfoObject.getString("price"); - if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) { - priceStr = "0"; - } - priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(100)).longValue(); - } - List priceList = computeRatioByShop(rentInfoArray,wxRentContract.getAdjustRatioWay(),priceArr,"adjustRatio"); + List priceList = computeRentPriceByShop(wxRentContract); return calcuteRatioByPart(priceList, "adjustRatio"); }else { return calcuteRentPriceByJoin(wxRentContract); @@ -92,6 +82,20 @@ public class WxRentContractHelper { return calcuteRentPriceByJoin(wxRentContract); } + public static List computeRentPriceByShop(WxRentContract wxRentContract) { + JSONArray rentInfoArray = JSONArray.parseArray(wxRentContract.getRentInfo()); + long[] priceArr = new long[rentInfoArray.size()]; + for (int i = 0; i < rentInfoArray.size(); i++) { + JSONObject rentInfoObject = rentInfoArray.getJSONObject(i); + String priceStr = rentInfoObject.getString("price"); + if (priceStr == null || priceStr.equalsIgnoreCase("NaN")) { + priceStr = "0"; + } + priceArr[i] = new BigDecimal(priceStr).multiply(new BigDecimal(100)).longValue(); + } + return computeRatioByShop(rentInfoArray,wxRentContract.getAdjustRatioWay(),priceArr,"adjustRatio"); + } + //计算每年租金基数(合铺录入) private static long[] calcuteRentPriceByJoin(WxRentContract wxRentContract) { String adjustRatio = wxRentContract.getAdjustRatio(); 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 5d338e701..c914d3690 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -1186,7 +1186,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { if(wxRentContract.getRentInputWay().equals(EnumRentContractRentInputWay.PART.getCode())){ String rentInfo = wxRentContract.getRentInfo(); JSONArray rentInfoArray = JSONArray.parseArray(rentInfo); - long[] priceList = WxRentContractHelper.computePrice(rentInfo, wxRentContract).get(0); + long[] priceList = WxRentContractHelper.computeRentPriceByShop(wxRentContract).get(0); long sum = Arrays.stream(priceList).sum(); int size = rentInfoArray.size(); for (int i = 0;i < size;i++) { @@ -1403,7 +1403,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { wxBillRent.setStarttime(billTimeVo.getStartDate()); wxBillRent.setEndtime(billTimeVo.getEndDate()); wxBillRent.setReceiveDate(billTimeVo.getReceiveDate()); -```11111111 + wxBillRent.setContractNeedPay(needpay); wxBillRent.setRentPriceInfo(getRentPriceInfo(wxRentContract,needpay)); wxBillRent.setNeedPay(needpay); @@ -2659,7 +2659,7 @@ public class WxRentContractServiceImpl implements WxRentContractService { } adjustRatioList.add(adjustRatioStr.toString()); } - List priceList = WxRentContractHelper.computePrice(rentInfo, wxRentContract); + List priceList = WxRentContractHelper.computeRentPriceByShop(wxRentContract); int size = priceList.size(); priceArrs = new long[size]; for (int i = 0; i < size; i++) {