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("] "); }); //总计