优化
This commit is contained in:
@ -114,7 +114,7 @@ public class MoneyBigScreenController {
|
||||
.eq(CtrIncomeContract::getProjectId, projectId)
|
||||
.last("limit 1")
|
||||
);
|
||||
if (contract != null) {
|
||||
if (contract != null && contract.getPayRatio()!= null) {
|
||||
actualAmount = actualAmount.add(projectMonthlyAmountMap.get(projectId).multiply(contract.getPayRatio()).divide(HUNDRED));
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ public class MoneyBigScreenController {
|
||||
.last("limit 1")
|
||||
);
|
||||
|
||||
if (contract != null) {
|
||||
if (contract != null && contract.getPayRatio()!= null) {
|
||||
actualAmount = actualAmount.add(projectAmountMap.get(contractCode).multiply(contract.getPayRatio()).divide(HUNDRED));
|
||||
}
|
||||
|
||||
@ -311,16 +311,17 @@ public class MoneyBigScreenController {
|
||||
|
||||
List<MoneyMonthVo> moneyCostVos = new ArrayList<>();
|
||||
|
||||
// 生成包含当前月在内的往前数7个月的月份列表
|
||||
List<YearMonth> last7Months = new ArrayList<>();
|
||||
// 生成当年12个月的月份列表
|
||||
YearMonth currentYearMonth = YearMonth.now();
|
||||
YearMonth firstMonthOfYear = currentYearMonth.withMonth(1); // 当年1月
|
||||
|
||||
for (int i = 6; i >= 0; i--) {
|
||||
last7Months.add(currentYearMonth.minusMonths(i));
|
||||
List<YearMonth> currentYearMonths = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
currentYearMonths.add(firstMonthOfYear.plusMonths(i));
|
||||
}
|
||||
|
||||
// 遍历每个月份,筛选对应的数据
|
||||
for (YearMonth yearMonth : last7Months) {
|
||||
for (YearMonth yearMonth : currentYearMonths) {
|
||||
// 获取该月的第一天和最后一天
|
||||
LocalDate startDate = yearMonth.atDay(1);
|
||||
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||
@ -345,15 +346,13 @@ public class MoneyBigScreenController {
|
||||
BigDecimal incomeAmount = BigDecimal.ZERO;
|
||||
|
||||
for (Long projectId : incomeGroupedByProject.keySet()) {
|
||||
|
||||
CtrIncomeContract contract = incomeContractService.getOne(Wrappers.lambdaQuery(CtrIncomeContract.class)
|
||||
.eq(CtrIncomeContract::getProjectId, projectId)
|
||||
.last("limit 1")
|
||||
);
|
||||
if (contract != null) {
|
||||
if (contract != null && contract.getPayRatio()!= null) {
|
||||
incomeAmount = incomeAmount.add(incomeGroupedByProject.get(projectId).multiply(contract.getPayRatio()).divide(HUNDRED));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 筛选分包商结算数据(应付)并按合同编号分组统计金额
|
||||
@ -376,19 +375,16 @@ public class MoneyBigScreenController {
|
||||
BigDecimal expensesAmount = BigDecimal.ZERO;
|
||||
|
||||
for (String contractCode : expenseGroupedByContract.keySet()) {
|
||||
|
||||
CtrExpensesContract contract = expensesContractService.getOne(Wrappers.lambdaQuery(CtrExpensesContract.class)
|
||||
.eq(CtrExpensesContract::getContractCode, contractCode)
|
||||
.last("limit 1")
|
||||
);
|
||||
|
||||
if (contract != null) {
|
||||
if (contract != null && contract.getPayRatio()!= null) {
|
||||
expensesAmount = expensesAmount.add(expenseGroupedByContract.get(contractCode).multiply(contract.getPayRatio()).divide(HUNDRED));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
MoneyMonthVo monthData = new MoneyMonthVo(
|
||||
yearMonth.toString(),
|
||||
incomeAmount,
|
||||
@ -413,16 +409,17 @@ public class MoneyBigScreenController {
|
||||
|
||||
List<MoneyMonthVo> moneyCostVos = new ArrayList<>();
|
||||
|
||||
// 生成包含当前月在内的往前数7个月的月份列表
|
||||
List<YearMonth> last7Months = new ArrayList<>();
|
||||
// 生成当年12个月的月份列表
|
||||
YearMonth currentYearMonth = YearMonth.now();
|
||||
YearMonth firstMonthOfYear = currentYearMonth.withMonth(1); // 当年1月
|
||||
|
||||
for (int i = 6; i >= 0; i--) {
|
||||
last7Months.add(currentYearMonth.minusMonths(i));
|
||||
List<YearMonth> currentYearMonths = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
currentYearMonths.add(firstMonthOfYear.plusMonths(i));
|
||||
}
|
||||
|
||||
// 遍历每个月份,筛选对应的数据
|
||||
for (YearMonth yearMonth : last7Months) {
|
||||
for (YearMonth yearMonth : currentYearMonths) {
|
||||
// 获取该月的第一天和最后一天
|
||||
LocalDate startDate = yearMonth.atDay(1);
|
||||
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||
@ -447,15 +444,13 @@ public class MoneyBigScreenController {
|
||||
BigDecimal incomeAmount = BigDecimal.ZERO;
|
||||
|
||||
for (Long projectId : incomeGroupedByProject.keySet()) {
|
||||
|
||||
CtrIncomeContract contract = incomeContractService.getOne(Wrappers.lambdaQuery(CtrIncomeContract.class)
|
||||
.eq(CtrIncomeContract::getProjectId, projectId)
|
||||
.last("limit 1")
|
||||
);
|
||||
if (contract != null) {
|
||||
if (contract != null && contract.getPayRatio()!= null) {
|
||||
incomeAmount = incomeAmount.add(incomeGroupedByProject.get(projectId).multiply(contract.getPayRatio()).divide(HUNDRED));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 筛选分包商结算数据(应付)并按合同编号分组统计金额
|
||||
@ -478,16 +473,14 @@ public class MoneyBigScreenController {
|
||||
BigDecimal expensesAmount = BigDecimal.ZERO;
|
||||
|
||||
for (String contractCode : expenseGroupedByContract.keySet()) {
|
||||
|
||||
CtrExpensesContract contract = expensesContractService.getOne(Wrappers.lambdaQuery(CtrExpensesContract.class)
|
||||
.eq(CtrExpensesContract::getContractCode, contractCode)
|
||||
.last("limit 1")
|
||||
);
|
||||
|
||||
if (contract != null) {
|
||||
if (contract != null && contract.getPayRatio()!= null) {
|
||||
expensesAmount = expensesAmount.add(expenseGroupedByContract.get(contractCode).multiply(contract.getPayRatio()).divide(HUNDRED));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MoneyMonthVo monthData = new MoneyMonthVo(
|
||||
@ -501,6 +494,7 @@ public class MoneyBigScreenController {
|
||||
}
|
||||
|
||||
return R.ok(moneyCostVos);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,4 +88,17 @@ public class CtrIncomeContract extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal payRatio;
|
||||
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String contractName;
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private Boolean isUpdate;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -93,4 +93,15 @@ public class CtrIncomeContractBo extends BaseEntity {
|
||||
* 付款比例
|
||||
*/
|
||||
private BigDecimal payRatio;
|
||||
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String contractName;
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private Boolean isUpdate;
|
||||
}
|
||||
|
@ -111,4 +111,15 @@ public class CtrIncomeContractVo implements Serializable {
|
||||
* 付款比例
|
||||
*/
|
||||
private BigDecimal payRatio;
|
||||
|
||||
|
||||
/**
|
||||
* 合同名称
|
||||
*/
|
||||
private String contractName;
|
||||
|
||||
/**
|
||||
* 能否修改
|
||||
*/
|
||||
private Boolean isUpdate;
|
||||
}
|
||||
|
@ -124,6 +124,13 @@ public class CtrExpensesContractServiceImpl extends ServiceImpl<CtrExpensesContr
|
||||
public Boolean updateByBo(CtrExpensesContractBo bo) {
|
||||
CtrExpensesContract update = MapstructUtils.convert(bo, CtrExpensesContract.class);
|
||||
validEntityBeforeSave(update);
|
||||
|
||||
if(CollectionUtil.isNotEmpty(bo.getFileList())){
|
||||
List<CtrFile> convert = MapstructUtils.convert(bo.getFileList(), CtrFile.class);
|
||||
convert.forEach(item -> item.setContractId(update.getId()));
|
||||
fileService.saveBatch(convert);
|
||||
}
|
||||
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,7 @@ public class CtrIncomeContractServiceImpl extends ServiceImpl<CtrIncomeContractM
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(CtrIncomeContractBo bo) {
|
||||
CtrIncomeContract add = MapstructUtils.convert(bo, CtrIncomeContract.class);
|
||||
add.setIsUpdate(false);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if(CollectionUtil.isNotEmpty(bo.getFileList())){
|
||||
@ -123,7 +124,13 @@ public class CtrIncomeContractServiceImpl extends ServiceImpl<CtrIncomeContractM
|
||||
@Override
|
||||
public Boolean updateByBo(CtrIncomeContractBo bo) {
|
||||
CtrIncomeContract update = MapstructUtils.convert(bo, CtrIncomeContract.class);
|
||||
update.setIsUpdate(false);
|
||||
validEntityBeforeSave(update);
|
||||
if(CollectionUtil.isNotEmpty(bo.getFileList())){
|
||||
List<CtrFile> convert = MapstructUtils.convert(bo.getFileList(), CtrFile.class);
|
||||
convert.forEach(item -> item.setContractId(update.getId()));
|
||||
fileService.saveBatch(convert);
|
||||
}
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user