From 49f4b0774fc2b1b6c8c1e8ec5dc05bca7dd4eb61 Mon Sep 17 00:00:00 2001 From: luozukai Date: Thu, 23 May 2019 16:32:06 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=90=88=E5=90=8C][=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=88=E5=90=8C=E9=9C=80=E6=B1=82]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxPropertyContractServiceImpl.java | 24 ++++++++++-------- .../impl/WxRentContractServiceImpl.java | 25 +++++++++++-------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java index cbb8e18fd..4c8696422 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxPropertyContractServiceImpl.java @@ -113,21 +113,25 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService Double rentPrice = rentInfoObject.getDouble("rentPrice"); Long price = wxPropertyContract.getPrice()/100; if(rentPrice == null){ - Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea()); - rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - rentInfoObject.put("rentPrice",rentPrice); + if(wxPropertyContract.getRentArea() != null) { + Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea()); + rentPrice = new BigDecimal((float) price / rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + rentInfoObject.put("rentPrice", rentPrice); + } } } wxPropertyContract.setRentInfo(rentInfoArray.toJSONString()); }else{ if(wxPropertyContract.getRentPrice() == null || "0".equals(wxPropertyContract.getRentPrice())){ - Long price = wxPropertyContract.getPrice()/100; - Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea()); - Double rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - if(rentPrice > 0){ - wxPropertyContract.setRentPrice(rentPrice.toString()); - }else{ - wxPropertyContract.setRentPrice("0"); + if(wxPropertyContract.getRentArea()!=null) { + Long price = wxPropertyContract.getPrice() / 100; + Double rentArea = Double.parseDouble(wxPropertyContract.getRentArea()); + Double rentPrice = new BigDecimal((float) price / rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + if (rentPrice > 0) { + wxPropertyContract.setRentPrice(rentPrice.toString()); + } else { + wxPropertyContract.setRentPrice("0"); + } } } } 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 9e6660f85..1d5ab027b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRentContractServiceImpl.java @@ -136,22 +136,27 @@ public class WxRentContractServiceImpl implements WxRentContractService { Double rentPrice = rentInfoObject.getDouble("rentPrice"); Long price = wxRentContract.getPrice()/100; if(rentPrice == null){ - Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); - rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - rentInfoObject.put("rentPrice",rentPrice); + if(wxRentContract.getRentArea() != null) { + Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); + rentPrice = new BigDecimal((float) price / rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + rentInfoObject.put("rentPrice", rentPrice); + } } } wxRentContract.setRentInfo(rentInfoArray.toJSONString()); }else{ if(wxRentContract.getRentPrice() == null || "0".equals(wxRentContract.getRentPrice())){ - Long price = wxRentContract.getPrice()/100; - Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); - Double rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - if(rentPrice > 0){ - wxRentContract.setRentPrice(rentPrice.toString()); - }else{ - wxRentContract.setRentPrice("0"); + if(wxRentContract.getRentArea() != null){ + Long price = wxRentContract.getPrice()/100; + Double rentArea = Double.parseDouble(wxRentContract.getRentArea()); + Double rentPrice = new BigDecimal((float)price/rentArea).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + if(rentPrice > 0){ + wxRentContract.setRentPrice(rentPrice.toString()); + }else{ + wxRentContract.setRentPrice("0"); + } } + } } if(wxRentContract.getPriceUnit() == null){