diff --git a/ruoyi-system/src/main/java/com/ruoyi/contract/service/impl/ConBigScreenServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/contract/service/impl/ConBigScreenServiceImpl.java index 205533a..91ce88e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/contract/service/impl/ConBigScreenServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/contract/service/impl/ConBigScreenServiceImpl.java @@ -430,13 +430,13 @@ public class ConBigScreenServiceImpl implements IConBigScreenService { Date beginOfYear = DateUtil.beginOfYear(new Date()); // 获取本年结束时间 Date endOfYear = DateUtil.endOfYear(new Date()); - double newReceivablesDate = receivablesSum(beginOfYear, endOfYear); + BigDecimal newReceivablesDate = receivablesSum(beginOfYear, endOfYear); map.put("newReceivablesDate", newReceivablesDate); //计算去年的数据 Date begin = DateUtil.beginOfYear(DateUtil.offset(new Date(), DateField.YEAR, -1)); Date end = DateUtil.endOfYear(DateUtil.offset(new Date(), DateField.YEAR, -1)); - double LastReceivablesDate = receivablesSum(begin, end); + BigDecimal LastReceivablesDate = receivablesSum(begin, end); map.put("LastReceivablesDate", LastReceivablesDate); return map; } @@ -447,37 +447,41 @@ public class ConBigScreenServiceImpl implements IConBigScreenService { * @param endOfYear * @return */ - private double receivablesSum(Date beginOfYear, Date endOfYear) { + private BigDecimal receivablesSum(Date beginOfYear, Date endOfYear) { //所有销售合同的合同总金额 List conSaleVos = conSaleMapper.selectVoList(Wrappers.lambdaQuery().select(ConSale::getId, ConSale::getContractMoney).eq(ConSale::getState, 1).between(true, ConSale::getSignTime, beginOfYear, endOfYear)); - double contractMoneySum = CollUtil.isNotEmpty(conSaleVos) ? conSaleVos.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getContractMoney()))).mapToDouble(ConSaleVo::getContractMoney).sum() : 0d; + BigDecimal contractMoneySum = CollUtil.isNotEmpty(conSaleVos) ? conSaleVos.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && itx.getContractMoney() != null)) + .map(value -> new BigDecimal(value.getContractMoney().toString()).setScale(2, RoundingMode.HALF_UP)).reduce(BigDecimal.ZERO, BigDecimal::add) : BigDecimal.ZERO; //其他合同中回款总金额额 List lastConOtherVos = conOtherMapper.selectVoList(Wrappers.lambdaQuery().eq(ConOther::getState, 1).eq(ConOther::getMoneyType, 1).between(true, ConOther::getSignTime, beginOfYear, endOfYear)); - double otherMoney = 0d; + BigDecimal otherMoney = BigDecimal.ZERO; if (CollUtil.isNotEmpty(lastConOtherVos)) { List list = lastConOtherVos.stream().map(ConOtherVo::getId).collect(Collectors.toList()); List conOtherCollects = conOtherCollectMapper.selectList(Wrappers.lambdaQuery().select(ConOtherCollect::getActualArrivalMoney).in(ConOtherCollect::getOtherId, list)); - otherMoney = CollUtil.isNotEmpty(conOtherCollects) ? conOtherCollects.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getActualArrivalMoney()))).mapToDouble(ConOtherCollect::getActualArrivalMoney).sum() : 0d; + otherMoney = CollUtil.isNotEmpty(conOtherCollects) ? conOtherCollects.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getActualArrivalMoney()))) + .map(value -> new BigDecimal(value.getActualArrivalMoney().toString()).setScale(2, RoundingMode.HALF_UP)).reduce(BigDecimal.ZERO, BigDecimal::add) : BigDecimal.ZERO; } //所有销售合同的实际回款金额 - double actualArrivalMone = 0d; + BigDecimal actualArrivalMone = BigDecimal.ZERO; if (CollUtil.isNotEmpty(conSaleVos)) { List list = conSaleVos.stream().map(ConSaleVo::getId).collect(Collectors.toList()); List collects = conSaleCollectMapper.selectList(Wrappers.lambdaQuery().select(ConSaleCollect::getActualArrivalMoney).in(ConSaleCollect::getSaleId, list)); //计算本年的数据 - actualArrivalMone = CollUtil.isNotEmpty(collects) ? collects.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getActualArrivalMoney()))).mapToDouble(ConSaleCollect::getActualArrivalMoney).sum() : 0d; + actualArrivalMone = CollUtil.isNotEmpty(collects) ? collects.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getActualArrivalMoney()))) + .map(value -> new BigDecimal(value.getActualArrivalMoney().toString()).setScale(2, RoundingMode.HALF_UP)).reduce(BigDecimal.ZERO, BigDecimal::add) : BigDecimal.ZERO; } //其他合同中回款(约定回款金额汇总) - double otheActualArrivalMoney=0d; + BigDecimal otheActualArrivalMoney=BigDecimal.ZERO; if (CollUtil.isNotEmpty(lastConOtherVos)) { List list = lastConOtherVos.stream().map(ConOtherVo::getId).collect(Collectors.toList()); List conOtherCollects = conOtherCollectMapper.selectList(Wrappers.lambdaQuery().select(ConOtherCollect::getOtherId).in(ConOtherCollect::getOtherId, list)); - otheActualArrivalMoney = CollUtil.isNotEmpty(conOtherCollects) ? conOtherCollects.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getConventionArrivalMoney()))).mapToDouble(ConOtherCollect::getConventionArrivalMoney).sum() : 0d; + otheActualArrivalMoney = CollUtil.isNotEmpty(conOtherCollects) ? conOtherCollects.stream().filter(itx -> (ObjectUtil.isNotEmpty(itx) && ObjectUtil.isNotEmpty(itx.getConventionArrivalMoney()))) + .map(value -> new BigDecimal(value.getConventionArrivalMoney().toString()).setScale(2, RoundingMode.HALF_UP)).reduce(BigDecimal.ZERO, BigDecimal::add) : BigDecimal.ZERO; } log.info("所有销售合同的合同总金额:{},其他合同中回款总金额额:{},所有销售合同的实际回款金额:{},其他合同中回款:{}", contractMoneySum, otherMoney, actualArrivalMone, otheActualArrivalMoney); //应收款项=所有销售合同的合同总金额+其他合同中回款总金额额-所有销售合同的实际回款金额-其他合同中回款 - return contractMoneySum+otherMoney-actualArrivalMone-otheActualArrivalMoney; + return contractMoneySum.add(otherMoney).subtract(actualArrivalMone).subtract(otheActualArrivalMoney); } @Override @@ -720,7 +724,7 @@ public class ConBigScreenServiceImpl implements IConBigScreenService { * @return double */ private double outgoings(Date begin, Date end) { - List purchaseVos = conPurchaseMapper.selectVoList(Wrappers.lambdaQuery().select(ConPurchase::getContractMoney).eq(ConPurchase::getState, 1).between(true, ConPurchase::getSignTime, begin, end)); + List purchaseVos = conPurchaseMapper.selectVoList(Wrappers.lambdaQuery().select(ConPurchase :: getId).eq(ConPurchase::getState, 1).between(true, ConPurchase::getSignTime, begin, end)); //所有采购合同的实际付款金额汇总 diff --git a/ruoyi-system/src/main/java/com/ruoyi/contract/service/impl/ConCityServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/contract/service/impl/ConCityServiceImpl.java index 47b6327..4860364 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/contract/service/impl/ConCityServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/contract/service/impl/ConCityServiceImpl.java @@ -101,8 +101,8 @@ public class ConCityServiceImpl implements IConCityService { public List getTreeSelect() { List allList = this.getAllList(); - //Map> mapList = allList.stream().filter(item -> item.getParentId() != null).collect(Collectors.groupingBy(ConCityVo :: getParentId)); - return buildTreeNode(getParentAreas()); + Map> mapList = allList.stream().filter(item -> item.getParentId() != null).collect(Collectors.groupingBy(ConCityVo :: getParentId)); + return buildTreeNodeNew(getParentAreas(),mapList); } @Override