| @@ -909,105 +909,109 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| result.put("endtime", " "); | |||
| } | |||
| Integer filterHasPay = wxBillAll.getFilterHasPay(); | |||
| List<WxBillAllVo> list = list(wxBillAll); | |||
| if (!list.isEmpty()) { | |||
| //租金总额 | |||
| Long rentSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.RENT.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| //物业总额 | |||
| Long propertySum = list.parallelStream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.PROPERTY.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| //押金总额 | |||
| Long depositSum = list.stream().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 -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| //水费 | |||
| Long waterSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| //电费 | |||
| Long powerSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| //空调费 | |||
| Long airConditioningSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| //其他费用 | |||
| Long otherSum = list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| //押金明细 | |||
| StringBuffer depositDetail = new StringBuffer(); | |||
| list.stream().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 -> { | |||
| //租金 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.RENT.getCode()); | |||
| List<WxBillAllVo> rentList = this.list(wxBillAll); | |||
| Long rentSum = 0l; | |||
| if(!rentList.isEmpty()){ | |||
| rentSum = rentList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| } | |||
| //物业 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY.getCode()); | |||
| List<WxBillAllVo> propertyList = this.list(wxBillAll); | |||
| Long propertySum = 0l; | |||
| if(!propertyList.isEmpty()){ | |||
| propertySum = rentList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| } | |||
| //押金 | |||
| List<WxBillAllVo> depositList = new ArrayList<>(); | |||
| //租赁押金 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.RENT_DEPOSIT.getCode()); | |||
| List<WxBillAllVo> rentDepositList = this.list(wxBillAll); | |||
| depositList.addAll(rentDepositList); | |||
| //物业押金 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.PROPERTY_DEPOSIT.getCode()); | |||
| List<WxBillAllVo> propertyDepositList = this.list(wxBillAll); | |||
| depositList.addAll(propertyDepositList); | |||
| //其他押金 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER_DEPOSIT.getCode()); | |||
| List<WxBillAllVo> otherDepositList = this.list(wxBillAll); | |||
| depositList.addAll(otherDepositList); | |||
| Long depositSum = 0l; | |||
| StringBuffer depositDetail = new StringBuffer();//押金明细 | |||
| if(!depositList.isEmpty()){ | |||
| depositSum = depositList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| depositList.stream().forEach(b -> { | |||
| 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("] "); | |||
| }); | |||
| //其他费用明细 | |||
| StringBuffer otherDetail = new StringBuffer(); | |||
| list.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.ROUTINE.getCode())) | |||
| .forEach(b -> { | |||
| } | |||
| //水电空调费 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.WATER_POWER_AIR.getCode()); | |||
| List<WxBillAllVo> waterPowerAirList = this.list(wxBillAll); | |||
| Long waterSum = 0l, powerSum = 0l, airConditioningSum = 0l; | |||
| if (!waterPowerAirList.isEmpty()) { | |||
| waterSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.WATER.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| powerSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.POWER.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| airConditioningSum = waterPowerAirList.stream().filter(b -> b.getBillTypeValue().equals(EnumBillTypeParam.AIR_CONDITIONING.getCode())) | |||
| .collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| } | |||
| //其他费用 | |||
| wxBillAll.setBillTypeValue(EnumBillQueryType.OTHER.getCode()); | |||
| List<WxBillAllVo> otherList = this.list(wxBillAll); | |||
| Long otherSum = 0l; | |||
| StringBuffer otherDetail = new StringBuffer();//其他费用明细 | |||
| if(!otherList.isEmpty()){ | |||
| otherSum = otherList.stream().collect(Collectors.summingLong(b -> status == null && filterHasPay == null ? b.getReceivePay() + b.getLatePayPrice() + b.getServiceChargePay() : b.getOwe())); | |||
| otherList.stream().forEach(b -> { | |||
| 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("] "); | |||
| }); | |||
| //总计 | |||
| Long summarySum = rentSum + propertySum + depositSum + waterSum + powerSum + airConditioningSum + otherSum; | |||
| BigDecimal rent = new BigDecimal(rentSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal property = new BigDecimal(propertySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal deposit = new BigDecimal(depositSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal water = new BigDecimal(waterSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal power = new BigDecimal(powerSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal airConditioning = new BigDecimal(airConditioningSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal other = new BigDecimal(otherSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal summary = new BigDecimal(summarySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| String summaryUpper = PriceUtil.number2CNMontrayUnit(summary); | |||
| result.put("rent", rent.toPlainString()); | |||
| result.put("property", property.toPlainString()); | |||
| result.put("deposit", deposit.toPlainString()); | |||
| result.put("water", water.toPlainString()); | |||
| result.put("power", power.toPlainString()); | |||
| result.put("airConditioning", airConditioning.toPlainString()); | |||
| result.put("other", other.toPlainString()); | |||
| result.put("summary", summary.toPlainString()); | |||
| result.put("summaryUpper", summaryUpper); | |||
| result.put("depositDetail", StringUtils.isNotEmpty(depositDetail.toString()) ? depositDetail.toString() : " "); | |||
| result.put("otherDetail", StringUtils.isNotEmpty(otherDetail.toString()) ? otherDetail.toString() : " "); | |||
| WxMerchantDto wxMerchantDto = new WxMerchantDto(); | |||
| wxMerchantDto.setId(wxBillAll.getMerchantId()); | |||
| wxMerchantDto.updateTenantInfo(wxMall); | |||
| PageInfo<WxMerchantVo> pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,true); | |||
| List<WxMerchantVo> listCVo = pageInfo.getList(); | |||
| WxMerchantVo wxMerchantVo = listCVo.get(0); | |||
| result.put("merchant", wxMerchantVo.getMerchantName()); | |||
| WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream() | |||
| .filter(s -> StringUtils.isNotEmpty(s.getLinkPhone()) || StringUtils.isNotEmpty(s.getLinkPerson())).findFirst().orElse(null); | |||
| if (wxShopVo != null) { | |||
| String linkPerson = wxShopVo.getLinkPerson(); | |||
| String linkPhone = wxShopVo.getLinkPhone(); | |||
| result.put("linkPerson", StringUtils.isNotEmpty(linkPerson) ? linkPerson : " "); | |||
| result.put("linkPhone", StringUtils.isNotEmpty(linkPhone) ? linkPhone : " "); | |||
| } else { | |||
| result.put("linkPerson", " "); | |||
| result.put("linkPhone", " "); | |||
| } | |||
| } | |||
| //总计 | |||
| Long summarySum = rentSum + propertySum + depositSum + waterSum + powerSum + airConditioningSum + otherSum; | |||
| BigDecimal rent = new BigDecimal(rentSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal property = new BigDecimal(propertySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal deposit = new BigDecimal(depositSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal water = new BigDecimal(waterSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal power = new BigDecimal(powerSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal airConditioning = new BigDecimal(airConditioningSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal other = new BigDecimal(otherSum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| BigDecimal summary = new BigDecimal(summarySum).divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||
| String summaryUpper = PriceUtil.number2CNMontrayUnit(summary); | |||
| result.put("rent", rent.toPlainString()); | |||
| result.put("property", property.toPlainString()); | |||
| result.put("deposit", deposit.toPlainString()); | |||
| result.put("water", water.toPlainString()); | |||
| result.put("power", power.toPlainString()); | |||
| result.put("airConditioning", airConditioning.toPlainString()); | |||
| result.put("other", other.toPlainString()); | |||
| result.put("summary", summary.toPlainString()); | |||
| result.put("summaryUpper", summaryUpper); | |||
| result.put("depositDetail", StringUtils.isNotEmpty(depositDetail.toString()) ? depositDetail.toString() : " "); | |||
| result.put("otherDetail", StringUtils.isNotEmpty(otherDetail.toString()) ? otherDetail.toString() : " "); | |||
| WxMerchantDto wxMerchantDto = new WxMerchantDto(); | |||
| wxMerchantDto.setId(wxBillAll.getMerchantId()); | |||
| wxMerchantDto.updateTenantInfo(wxMall); | |||
| PageInfo<WxMerchantVo> pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,true); | |||
| List<WxMerchantVo> listCVo = pageInfo.getList(); | |||
| WxMerchantVo wxMerchantVo = listCVo.get(0); | |||
| result.put("merchant", wxMerchantVo.getMerchantName()); | |||
| WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream() | |||
| .filter(s -> StringUtils.isNotEmpty(s.getLinkPhone()) || StringUtils.isNotEmpty(s.getLinkPerson())).findFirst().orElse(null); | |||
| if (wxShopVo != null) { | |||
| String linkPerson = wxShopVo.getLinkPerson(); | |||
| String linkPhone = wxShopVo.getLinkPhone(); | |||
| result.put("linkPerson", StringUtils.isNotEmpty(linkPerson) ? linkPerson : " "); | |||
| result.put("linkPhone", StringUtils.isNotEmpty(linkPhone) ? linkPhone : " "); | |||
| } else { | |||
| result.put("merchant", " "); | |||
| result.put("rent", " "); | |||
| result.put("property", " "); | |||
| result.put("deposit", " "); | |||
| result.put("water", " "); | |||
| result.put("power", " "); | |||
| result.put("airConditioning", " "); | |||
| result.put("other", " "); | |||
| result.put("summary", " "); | |||
| result.put("summaryUpper", " "); | |||
| result.put("depositDetail", " "); | |||
| result.put("otherDetail", " "); | |||
| result.put("linkPerson", " "); | |||
| result.put("linkPhone", " "); | |||
| } | |||
| @@ -1022,6 +1026,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response, null); | |||
| } | |||
| @Override | |||
| public void exportSettleBill(WxBillSettle wxBillSettle, HttpServletRequest request, HttpServletResponse response) { | |||
| wxBillSettle = wxBillSettleService.getById(wxBillSettle.getId(), EnumFilterSettle.NO.getCode()); | |||