This commit is contained in:
李文飞 2025-11-19 23:13:23 +08:00
parent eba5d95dca
commit 061a953909
2 changed files with 18 additions and 14 deletions

View File

@ -430,13 +430,13 @@ public class ConBigScreenServiceImpl implements IConBigScreenService {
Date beginOfYear = DateUtil.beginOfYear(new Date()); Date beginOfYear = DateUtil.beginOfYear(new Date());
// 获取本年结束时间 // 获取本年结束时间
Date endOfYear = DateUtil.endOfYear(new Date()); Date endOfYear = DateUtil.endOfYear(new Date());
double newReceivablesDate = receivablesSum(beginOfYear, endOfYear); BigDecimal newReceivablesDate = receivablesSum(beginOfYear, endOfYear);
map.put("newReceivablesDate", newReceivablesDate); map.put("newReceivablesDate", newReceivablesDate);
//计算去年的数据 //计算去年的数据
Date begin = DateUtil.beginOfYear(DateUtil.offset(new Date(), DateField.YEAR, -1)); Date begin = DateUtil.beginOfYear(DateUtil.offset(new Date(), DateField.YEAR, -1));
Date end = DateUtil.endOfYear(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); map.put("LastReceivablesDate", LastReceivablesDate);
return map; return map;
} }
@ -447,37 +447,41 @@ public class ConBigScreenServiceImpl implements IConBigScreenService {
* @param endOfYear * @param endOfYear
* @return * @return
*/ */
private double receivablesSum(Date beginOfYear, Date endOfYear) { private BigDecimal receivablesSum(Date beginOfYear, Date endOfYear) {
//所有销售合同的合同总金额 //所有销售合同的合同总金额
List<ConSaleVo> conSaleVos = conSaleMapper.selectVoList(Wrappers.<ConSale>lambdaQuery().select(ConSale::getId, ConSale::getContractMoney).eq(ConSale::getState, 1).between(true, ConSale::getSignTime, beginOfYear, endOfYear)); List<ConSaleVo> conSaleVos = conSaleMapper.selectVoList(Wrappers.<ConSale>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<ConOtherVo> lastConOtherVos = conOtherMapper.selectVoList(Wrappers.<ConOther>lambdaQuery().eq(ConOther::getState, 1).eq(ConOther::getMoneyType, 1).between(true, ConOther::getSignTime, beginOfYear, endOfYear)); List<ConOtherVo> lastConOtherVos = conOtherMapper.selectVoList(Wrappers.<ConOther>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)) { if (CollUtil.isNotEmpty(lastConOtherVos)) {
List<Long> list = lastConOtherVos.stream().map(ConOtherVo::getId).collect(Collectors.toList()); List<Long> list = lastConOtherVos.stream().map(ConOtherVo::getId).collect(Collectors.toList());
List<ConOtherCollect> conOtherCollects = conOtherCollectMapper.selectList(Wrappers.<ConOtherCollect>lambdaQuery().select(ConOtherCollect::getActualArrivalMoney).in(ConOtherCollect::getOtherId, list)); List<ConOtherCollect> conOtherCollects = conOtherCollectMapper.selectList(Wrappers.<ConOtherCollect>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)) { if (CollUtil.isNotEmpty(conSaleVos)) {
List<Long> list = conSaleVos.stream().map(ConSaleVo::getId).collect(Collectors.toList()); List<Long> list = conSaleVos.stream().map(ConSaleVo::getId).collect(Collectors.toList());
List<ConSaleCollect> collects = conSaleCollectMapper.selectList(Wrappers.<ConSaleCollect>lambdaQuery().select(ConSaleCollect::getActualArrivalMoney).in(ConSaleCollect::getSaleId, list)); List<ConSaleCollect> collects = conSaleCollectMapper.selectList(Wrappers.<ConSaleCollect>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)) { if (CollUtil.isNotEmpty(lastConOtherVos)) {
List<Long> list = lastConOtherVos.stream().map(ConOtherVo::getId).collect(Collectors.toList()); List<Long> list = lastConOtherVos.stream().map(ConOtherVo::getId).collect(Collectors.toList());
List<ConOtherCollect> conOtherCollects = conOtherCollectMapper.selectList(Wrappers.<ConOtherCollect>lambdaQuery().select(ConOtherCollect::getOtherId).in(ConOtherCollect::getOtherId, list)); List<ConOtherCollect> conOtherCollects = conOtherCollectMapper.selectList(Wrappers.<ConOtherCollect>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); log.info("所有销售合同的合同总金额:{},其他合同中回款总金额额:{},所有销售合同的实际回款金额:{},其他合同中回款:{}", contractMoneySum, otherMoney, actualArrivalMone, otheActualArrivalMoney);
//应收款项=所有销售合同的合同总金额+其他合同中回款总金额额-所有销售合同的实际回款金额-其他合同中回款 //应收款项=所有销售合同的合同总金额+其他合同中回款总金额额-所有销售合同的实际回款金额-其他合同中回款
return contractMoneySum+otherMoney-actualArrivalMone-otheActualArrivalMoney; return contractMoneySum.add(otherMoney).subtract(actualArrivalMone).subtract(otheActualArrivalMoney);
} }
@Override @Override
@ -720,7 +724,7 @@ public class ConBigScreenServiceImpl implements IConBigScreenService {
* @return double * @return double
*/ */
private double outgoings(Date begin, Date end) { private double outgoings(Date begin, Date end) {
List<ConPurchaseVo> purchaseVos = conPurchaseMapper.selectVoList(Wrappers.<ConPurchase>lambdaQuery().select(ConPurchase::getContractMoney).eq(ConPurchase::getState, 1).between(true, ConPurchase::getSignTime, begin, end)); List<ConPurchaseVo> purchaseVos = conPurchaseMapper.selectVoList(Wrappers.<ConPurchase>lambdaQuery().select(ConPurchase :: getId).eq(ConPurchase::getState, 1).between(true, ConPurchase::getSignTime, begin, end));
//所有采购合同的实际付款金额汇总 //所有采购合同的实际付款金额汇总

View File

@ -101,8 +101,8 @@ public class ConCityServiceImpl implements IConCityService {
public List<ConCityVo> getTreeSelect() { public List<ConCityVo> getTreeSelect() {
List<ConCityVo> allList = this.getAllList(); List<ConCityVo> allList = this.getAllList();
//Map<Long,List<ConCityVo>> mapList = allList.stream().filter(item -> item.getParentId() != null).collect(Collectors.groupingBy(ConCityVo :: getParentId)); Map<Long,List<ConCityVo>> mapList = allList.stream().filter(item -> item.getParentId() != null).collect(Collectors.groupingBy(ConCityVo :: getParentId));
return buildTreeNode(getParentAreas()); return buildTreeNodeNew(getParentAreas(),mapList);
} }
@Override @Override