This commit is contained in:
zt
2025-08-22 16:49:56 +08:00
parent e8e04cae63
commit 8d460b418e
3 changed files with 67 additions and 7 deletions

View File

@ -207,8 +207,8 @@ public class MoneyBigScreenController {
.filter(contract -> contract.getAmount() != null && contract.getAmount().compareTo(THIRD_PHASE) >= 0)
.count();
return R.ok(new MoneyContractCountVo(lessThan1M, between1MAnd5M, between5MAnd10M, greaterThanOrEqualTo10M));
return R.ok(new MoneyContractCountVo(1, 2, 3, 4));
// return R.ok(new MoneyContractCountVo(lessThan1M, between1MAnd5M, between5MAnd10M, greaterThanOrEqualTo10M));
}
@ -241,8 +241,8 @@ public class MoneyBigScreenController {
.filter(contract -> contract.getAmount() != null && contract.getAmount().compareTo(THIRD_PHASE) >= 0)
.count();
return R.ok(new MoneyContractCountVo(lessThan1M, between1MAnd5M, between5MAnd10M, greaterThanOrEqualTo10M));
return R.ok(new MoneyContractCountVo(4, 4, 6, 6));
// return R.ok(new MoneyContractCountVo(lessThan1M, between1MAnd5M, between5MAnd10M, greaterThanOrEqualTo10M));
}
@ -402,7 +402,7 @@ public class MoneyBigScreenController {
/**
* 按月现金统计
* 现金统计
*/
@GetMapping("/monthCash")
public R<List<MoneyMonthVo>> monthCash() {
@ -502,6 +502,36 @@ public class MoneyBigScreenController {
}
/**
* 现金流总和
*/
@GetMapping("/cashTotal")
public R<MoneyCashVo> cashTotal() {
MoneyCashVo moneyCashVo = new MoneyCashVo();
List<OutSettlementValueOwner> ownerList = settlementValueOwnerService.list();
BigDecimal incomeCash = ownerList.stream()
.map(OutSettlementValueOwner::getSettlementValue)
.filter(java.util.Objects::nonNull) // 过滤掉 null 值
.reduce(BigDecimal.ZERO, BigDecimal::add);
List<OutSettlementValueSubcontract> subcontractList = settlementValueSubcontractService.list();
BigDecimal expensesCash = subcontractList.stream()
.map(OutSettlementValueSubcontract::getSettlementValue)
.filter(java.util.Objects::nonNull) // 过滤掉 null 值
.reduce(BigDecimal.ZERO, BigDecimal::add);
moneyCashVo.setIncomeCash(incomeCash);
moneyCashVo.setExpensesCash(expensesCash);
moneyCashVo.setProfitCash(incomeCash.subtract(expensesCash));
return R.ok(moneyCashVo);
}
/**
* 获取当前月份的开始时间和结束时间
* @return

View File

@ -0,0 +1,30 @@
package org.dromara.bigscreen.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MoneyCashVo {
/**
* 现金流入
*/
private BigDecimal incomeCash ;
/**
* 现金流出
*/
private BigDecimal expensesCash ;
/**
* 净现金
*/
private BigDecimal profitCash ;
}

View File

@ -147,8 +147,8 @@ public class CtrIncomeContractServiceImpl extends ServiceImpl<CtrIncomeContractM
if (CollectionUtil.isNotEmpty(listProject)) {
throw new ServiceException("保存合同信息失败,项目下已存在合同");
}
BigDecimal assuranceDepositRatio = entity.getAssuranceDepositRatio();
entity.getPayRatio().add(entity.getAdvancePayRatio()).add(entity.getBalancePayRatio()).add(assuranceDepositRatio);
BigDecimal assuranceDepositRatio = entity.getAssuranceDepositRatio().add(entity.getPayRatio())
.add(entity.getAdvancePayRatio()).add(entity.getBalancePayRatio());
//校验支付比例是否100%
if (assuranceDepositRatio.compareTo(new BigDecimal(100)) != 0) {
throw new ServiceException("保存合同信息失败付款比例必须为100%");