From 7d566c6ba6c9c644336d05dd92d00a9a7276e9fc Mon Sep 17 00:00:00 2001 From: gongbiao Date: Wed, 22 May 2019 11:45:30 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=95=86=E6=88=B7=E8=B4=A6=E5=8D=95][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E7=94=9F=E6=88=90=E5=82=AC=E7=BC=B4?= =?UTF-8?q?=E5=8D=95]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxBillAllServiceImpl.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 8ea2a4acd..8c9abbf79 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -620,7 +620,8 @@ public class WxBillAllServiceImpl implements WxBillAllService { String number = "JF" + DateUtils.getSystemTime("yyyyMMddHHmmss"); result.put("number", number); //数据 - if (wxBillAll.getStatus() == null) { + Integer status = wxBillAll.getStatus(); + if (status == null) { List statusList = new ArrayList<>(); statusList.add(EnumBillRentStatus.NOT_PAID.getCode()); statusList.add(EnumBillRentStatus.WAIT_PAY.getCode()); @@ -631,27 +632,33 @@ public class WxBillAllServiceImpl implements WxBillAllService { List list = wxBillAllMapper.list(wxBillAll); if (!list.isEmpty()) { //租金总额 - Long rentSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); + Long rentSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); //物业总额 - Long propertySum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); + Long propertySum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); //押金总额 Long depositSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) - .collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); //水费 - Long waterSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); + Long waterSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); //电费 - Long powerSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); + Long powerSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); //空调费 - Long airConditioningSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); + Long airConditioningSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); //其他费用 - Long otherSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())).collect(Collectors.summingLong(b -> filterHasPay != null ? b.getOwe() : b.getReceivePay())); + Long otherSum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) + .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe())); //押金明细 StringBuffer depositDetail = new StringBuffer(); list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY_DEPOSIT.getCode()) || b.getBillTypeValue().equals(EnumBillTypeParam.ATHER_DEPOSIT.getCode())) .forEach(b -> { - BigDecimal owe = new BigDecimal(filterHasPay != null ? b.getOwe() : b.getReceivePay()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); depositDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); }); @@ -659,7 +666,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { StringBuffer otherDetail = new StringBuffer(); list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) .forEach(b -> { - BigDecimal owe = new BigDecimal(filterHasPay != null ? b.getOwe() : b.getReceivePay()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); + BigDecimal owe = new BigDecimal(status == null && filterHasPay == null ? b.getReceivePay() : b.getOwe()).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); otherDetail.append(b.getName()).append(":[").append(owe.toPlainString()).append("] "); }); //总计