This commit is contained in:
zt
2025-08-06 20:20:21 +08:00
parent 054ecd92a1
commit 7b9e3a52f0
8 changed files with 103 additions and 79 deletions

View File

@ -20,7 +20,7 @@ public interface BusMaterialsorderMapper extends BaseMapperPlus<BusMaterialsorde
List<GrossOutputRes> grossOutput( List<GrossOutputRes> grossOutput(
@Param("projectId") Long projectId, @Param("projectId") Long projectId,
@Param("statusArr") String[] statusArr, @Param("statusArr") String[] statusArr,
@Param("startYue") String startYue, @Param("month") String month,
@Param("endYue") String endYue); @Param("type") int type);
} }

View File

@ -230,24 +230,14 @@ public class BusMaterialsorderServiceImpl extends ServiceImpl<BusMaterialsorderM
} }
@Override @Override
public BigDecimal grossOutput(Long projectId, String startYue, String endYue) { public BigDecimal grossOutput(Long projectId, String month,int type) {
//项目id不能为空 //项目id不能为空
if (projectId == null){ if (projectId == null){
throw new RuntimeException("项目ID不能为空"); throw new RuntimeException("项目ID不能为空");
} }
//年月可以为空但是如果有值格式那么就必须是yyyy-MM
if (startYue != null){
if (!startYue.matches("\\d{4}-\\d{2}")){
throw new RuntimeException("年月格式错误");
}
}
if (endYue != null){
if (!endYue.matches("\\d{4}-\\d{2}")){
throw new RuntimeException("年月格式错误");
}
}
final String[] arr = {"1","2","3"}; //到货的几个状态 final String[] arr = {"1","2","3"}; //到货的几个状态
List<GrossOutputRes> list = baseMapper.grossOutput(projectId, arr, startYue,endYue); List<GrossOutputRes> list = baseMapper.grossOutput(projectId, arr, month,type);
//计算出所有的订单数量 //计算出所有的订单数量
BigDecimal resBigDecimal = new BigDecimal(0); BigDecimal resBigDecimal = new BigDecimal(0);
for (GrossOutputRes grossOutputRes : list) { for (GrossOutputRes grossOutputRes : list) {

View File

@ -71,6 +71,7 @@ public class OutTableController extends BaseController {
private final IBusMaterialsorderService busMaterialsorderService; private final IBusMaterialsorderService busMaterialsorderService;
BigDecimal parseUnit = new BigDecimal("10000");
/** /**
* 施工产值报表(计划 VS 实际) * 施工产值报表(计划 VS 实际)
@ -109,7 +110,7 @@ public class OutTableController extends BaseController {
//构建返回数据 //构建返回数据
List<OutMonthlyConstructionVo> outMonthlyConstructionVos = new ArrayList<>(); List<OutMonthlyConstructionVo> outMonthlyConstructionVos = new ArrayList<>();
BigDecimal parseUnit = new BigDecimal("10000");
for (BusProjectVo busProjectVo : rows){ for (BusProjectVo busProjectVo : rows){
OutMonthlyConstructionVo vo = new OutMonthlyConstructionVo(); OutMonthlyConstructionVo vo = new OutMonthlyConstructionVo();
@ -126,35 +127,34 @@ public class OutTableController extends BaseController {
BigDecimal totalValue = BigDecimal.ZERO; BigDecimal totalValue = BigDecimal.ZERO;
BigDecimal estimatedTotalValue = BigDecimal.ZERO; BigDecimal estimatedTotalValue = BigDecimal.ZERO;
BigDecimal monthlyEstimatedValue = BigDecimal.ZERO; BigDecimal monthlyEstimatedValue = BigDecimal.ZERO;
for (PgsProgressCategory category : collect) { List<OutMonthPlanAudit> planAudits = outMonthPlanAudits.stream().filter(plan -> plan.getProjectId().equals(busProjectVo.getId())).toList();
List<OutMonthPlanAudit> planAudits = outMonthPlanAudits.stream().filter(plan -> plan.getProjectId().equals(category.getProjectId())).toList(); for (OutMonthPlanAudit planAudit : planAudits) {
totalValue = totalValue.add(planAudit.getConstructionValue());
YearMonth planMonth = YearMonth.parse(planAudit.getPlanMonth(), formatter);
// 比较大小
if (planMonth.isBefore(yearMonth)) {
estimatedTotalValue=estimatedTotalValue.add(planAudit.getConstructionValue());
} else if (planMonth.isAfter(yearMonth)) {
for (OutMonthPlanAudit planAudit : planAudits) { } else {
YearMonth planMonth = YearMonth.parse(planAudit.getPlanMonth(), formatter); estimatedTotalValue = estimatedTotalValue.add(planAudit.getConstructionValue());
// 比较大小 monthlyEstimatedValue = planAudit.getConstructionValue();
if (planMonth.isBefore(yearMonth)) { }
estimatedTotalValue=estimatedTotalValue.add(planAudit.getConstructionValue()); }
} else if (yearMonth.isAfter(planMonth)) { // for (PgsProgressCategory category : collect) {
// //计算价格
} else { // if ("1".equals(category.getUnitType())) {
estimatedTotalValue = estimatedTotalValue.add(planAudit.getConstructionValue()); // // 数量类型: total * unitPrice
monthlyEstimatedValue = planAudit.getConstructionValue(); // BigDecimal total = category.getTotal() != null ? category.getTotal() : BigDecimal.ZERO;
} // BigDecimal unitPrice = category.getUnitPrice() != null ? category.getUnitPrice() : BigDecimal.ZERO;
} // totalValue = totalValue.add(total.multiply(unitPrice));
//
//计算价格 // } else if ("2".equals(category.getUnitType())) {
if ("1".equals(category.getUnitType())) { // // 百分比类型: 直接使用 unitPrice
// 数量类型: total * unitPrice // totalValue = totalValue.add(category.getUnitPrice() != null ? category.getUnitPrice() : BigDecimal.ZERO);
BigDecimal total = category.getTotal() != null ? category.getTotal() : BigDecimal.ZERO; // }
BigDecimal unitPrice = category.getUnitPrice() != null ? category.getUnitPrice() : BigDecimal.ZERO; // }
totalValue = totalValue.add(total.multiply(unitPrice));
} else if ("2".equals(category.getUnitType())) {
// 百分比类型: 直接使用 unitPrice
totalValue = totalValue.add(category.getUnitPrice() != null ? category.getUnitPrice() : BigDecimal.ZERO);
}
}
//转化单位为万元 //转化单位为万元
vo.setTotalValue(totalValue.divide(parseUnit)); vo.setTotalValue(totalValue.divide(parseUnit));
vo.setEstimatedAccumulatedValue(estimatedTotalValue.divide(parseUnit)); vo.setEstimatedAccumulatedValue(estimatedTotalValue.divide(parseUnit));
@ -213,20 +213,19 @@ public class OutTableController extends BaseController {
} }
} }
vo.setAccumulatedCompletionValue(accumulatedCompletionValue.divide(parseUnit));
vo.setTotalCompletionValue(totalCompletionValue.divide(parseUnit));
vo.setFirstWeekCompletionValue(firstWeekCompletionValue.divide(parseUnit));
vo.setSecondWeekCompletionValue(secondWeekCompletionValue.divide(parseUnit));
vo.setThirdWeekCompletionValue(thirdWeekCompletionValue.divide(parseUnit));
vo.setFourthWeekCompletionValue(fourthWeekCompletionValue.divide(parseUnit));
vo.setFifthWeekCompletionValue(fifthWeekCompletionValue.divide(parseUnit));
vo.setValueDifference(vo.getTotalCompletionValue().subtract(vo.getMonthlyEstimatedValue()));
vo.setValueDifferenceAccumulation(vo.getAccumulatedCompletionValue().subtract(vo.getEstimatedAccumulatedValue()));
vo.setTotalCompletionProgress(BigDecimalUtil.toPercentage(accumulatedCompletionValue, totalValue));
} }
vo.setAccumulatedCompletionValue(accumulatedCompletionValue.divide(parseUnit));
vo.setTotalCompletionValue(totalCompletionValue.divide(parseUnit));
vo.setFirstWeekCompletionValue(firstWeekCompletionValue.divide(parseUnit));
vo.setSecondWeekCompletionValue(secondWeekCompletionValue.divide(parseUnit));
vo.setThirdWeekCompletionValue(thirdWeekCompletionValue.divide(parseUnit));
vo.setFourthWeekCompletionValue(fourthWeekCompletionValue.divide(parseUnit));
vo.setFifthWeekCompletionValue(fifthWeekCompletionValue.divide(parseUnit));
vo.setValueDifference(vo.getTotalCompletionValue().subtract(vo.getMonthlyEstimatedValue()));
vo.setValueDifferenceAccumulation(vo.getAccumulatedCompletionValue().subtract(vo.getEstimatedAccumulatedValue()));
vo.setTotalCompletionProgress(BigDecimalUtil.toPercentage(accumulatedCompletionValue, totalValue));
outMonthlyConstructionVos.add(vo); outMonthlyConstructionVos.add(vo);
} }
@ -275,28 +274,30 @@ public class OutTableController extends BaseController {
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null); BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null);
vo.setTotalCompletionOutputValue(constructionValue); vo.setTotalCompletionOutputValue(constructionValue);
}else if ("3".equals(bo.getValueType())) { }else if ("3".equals(bo.getValueType())) {
//采购完工产值 todo: 掉罗成的接口 //采购完工产值
// BigDecimal purchaseValue = bigDecimal; BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,null,0);
// vo.setTotalCompletionOutputValue(purchaseValue); vo.setTotalCompletionOutputValue(purchaseValue);
}else{ }else{
//设计完工产值 //设计完工产值
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,null); BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,null);
//施工完工产值 //施工完工产值
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null); BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null);
//采购完工产值 todo: 掉罗成的接口 //采购完工产值
BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,null,0);
// BigDecimal purchaseValue = bigDecimal; vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
// vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
} }
//结算产值 //结算产值
BigDecimal settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,bo.getValueType(),null); BigDecimal settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,bo.getValueType(),null);
vo.setTotalSettlementOutputValue(settlementValue); vo.setTotalSettlementOutputValue(settlementValue);
vo.setCompletionUnsettledAmount(vo.getTotalSettlementOutputValue().subtract(vo.getTotalCompletionOutputValue())); vo.setCompletionUnsettledAmount(vo.getTotalSettlementOutputValue().subtract(vo.getTotalCompletionOutputValue()));
vo.setCompletionUnsettledRatio(BigDecimalUtil.toPercentage(vo.getCompletionUnsettledAmount(), vo.getTotalCompletionOutputValue())); vo.setCompletionUnsettledRatio(BigDecimalUtil.toPercentage(vo.getCompletionUnsettledAmount(), vo.getTotalCompletionOutputValue()));
//转换成万元
vo.setTotalCompletionOutputValue(vo.getTotalCompletionOutputValue().divide(parseUnit));
vo.setTotalSettlementOutputValue(vo.getTotalSettlementOutputValue().divide(parseUnit));
vo.setCompletionUnsettledAmount(vo.getCompletionUnsettledAmount().divide(parseUnit));
outComparisonOfCompletionAndSettlementVos.add(vo); outComparisonOfCompletionAndSettlementVos.add(vo);
} }
@ -335,10 +336,9 @@ public class OutTableController extends BaseController {
BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,bo.getMonth()); BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,bo.getMonth());
//施工完工产值 //施工完工产值
BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,bo.getMonth()); BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,bo.getMonth());
//采购完工产值 todo: 掉罗成的接口 //采购完工产值
// BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,bo.getMonth()); BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,bo.getMonth(),0);
vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
// vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue));
//分包结算产值 //分包结算产值
BigDecimal settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,null,bo.getMonth()); BigDecimal settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,null,bo.getMonth());
@ -348,6 +348,13 @@ public class OutTableController extends BaseController {
BigDecimal ownerSettlementValue = settlementValueOwnerService.getValueByProjectId(projectVoId,bo.getMonth()); BigDecimal ownerSettlementValue = settlementValueOwnerService.getValueByProjectId(projectVoId,bo.getMonth());
vo.setOwnerTotalSettlementOutputValue(ownerSettlementValue); vo.setOwnerTotalSettlementOutputValue(ownerSettlementValue);
//转换成万元
vo.setOwnerTotalSettlementOutputValue( ownerSettlementValue.divide(parseUnit));
vo.setSubTotalSettlementOutputValue( settlementValue.divide(parseUnit));
vo.setTotalCompletionOutputValue( vo.getTotalCompletionOutputValue().divide(parseUnit));
vo.setDifferenceValue(vo.getOwnerTotalSettlementOutputValue().subtract(vo.getSubTotalSettlementOutputValue()) );
vos.add(vo); vos.add(vo);
} }
@ -417,15 +424,23 @@ public class OutTableController extends BaseController {
vo.setAccumulatedCompletionValue(accumulatedCompleteValue); vo.setAccumulatedCompletionValue(accumulatedCompleteValue);
}else if("2".equals(bo.getValueType())){ }else if("2".equals(bo.getValueType())){
//todo: 掉罗成的接口
// busMaterialsorderService.grossOutput(projectVoId,bo.getMonth()) vo.setMonthCompletionValue(busMaterialsorderService.grossOutput(projectVo.getId(),bo.getMonth(),1));
vo.setMonthCompletionValue(BigDecimal.ZERO);
vo.setAccumulatedCompletionValue(BigDecimal.ZERO); vo.setAccumulatedCompletionValue(BigDecimal.ZERO);
} }
vo.setValueDifference(vo.getMonthCompletionValue().subtract(vo.getMonthEstimatedValue())); vo.setValueDifference(vo.getMonthCompletionValue().subtract(vo.getMonthEstimatedValue()));
vo.setProjectCompletionRate(BigDecimalUtil.toPercentage(vo.getAccumulatedCompletionValue(), totalValue)); vo.setProjectCompletionRate(BigDecimalUtil.toPercentage(vo.getAccumulatedCompletionValue(), totalValue));
//转换成万元
vo.setMonthEstimatedValue(vo.getMonthEstimatedValue().divide((parseUnit)));
vo.setMonthCompletionValue(vo.getMonthCompletionValue().divide((parseUnit)));
vo.setValueDifference(vo.getValueDifference().divide((parseUnit)));
vo.setAccumulatedCompletionValue(vo.getAccumulatedCompletionValue().divide((parseUnit)));
vo.setTotalValue(vo.getTotalValue().divide((parseUnit)));
vos.add(vo); vos.add(vo);
} }
@ -435,7 +450,7 @@ public class OutTableController extends BaseController {
rspData.setRows(vos); rspData.setRows(vos);
rspData.setTotal(busProjectVoTableDataInfo.getTotal()); rspData.setTotal(busProjectVoTableDataInfo.getTotal());
return TableDataInfo.build(); return rspData;
} }

View File

@ -175,7 +175,11 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
@Override @Override
public BigDecimal getCompleteValue(Long projectId, String month) { public BigDecimal getCompleteValue(Long projectId, String month) {
return baseMapper.getCompleteValue(projectId,month); BigDecimal completeValue = baseMapper.getCompleteValue(projectId, month);
if (completeValue == null) {
completeValue = BigDecimal.ZERO;
}
return completeValue;
} }
/** /**

View File

@ -193,7 +193,11 @@ public class OutMonthPlanServiceImpl extends ServiceImpl<OutMonthPlanMapper, Out
@Override @Override
public BigDecimal getDesignValueByProjectId(Long projectId,String month) { public BigDecimal getDesignValueByProjectId(Long projectId,String month) {
return baseMapper.getDesignValueByProjectId(projectId,month); BigDecimal designValueByProjectId = baseMapper.getDesignValueByProjectId(projectId, month);
if (designValueByProjectId == null) {
designValueByProjectId = BigDecimal.ZERO;
}
return designValueByProjectId;
} }
/** /**

View File

@ -135,6 +135,10 @@ public class OutSettlementValueOwnerServiceImpl extends ServiceImpl<OutSettlemen
@Override @Override
public BigDecimal getValueByProjectId(Long projectId,String month) { public BigDecimal getValueByProjectId(Long projectId,String month) {
return baseMapper.getValueByProjectId(projectId,month); BigDecimal valueByProjectId = baseMapper.getValueByProjectId(projectId, month);
if(valueByProjectId == null){
valueByProjectId = BigDecimal.ZERO;
}
return valueByProjectId;
} }
} }

View File

@ -148,6 +148,10 @@ public class OutSettlementValueSubcontractServiceImpl extends ServiceImpl<OutSet
@Override @Override
public BigDecimal getValueByProjectId(Long projectId,String valueType,String month) { public BigDecimal getValueByProjectId(Long projectId,String valueType,String month) {
return baseMapper.getValueByProjectId(projectId, valueType,month); BigDecimal valueByProjectId = baseMapper.getValueByProjectId(projectId, valueType, month);
if(valueByProjectId==null){
return BigDecimal.ZERO;
}
return valueByProjectId;
} }
} }

View File

@ -21,9 +21,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="endYue != null"> <if test="month != null and type == 0 ">
and DATE_FORMAT(a.actual_arrival, '%Y-%m') = #{yue} and DATE_FORMAT(a.actual_arrival, '%Y-%m') = #{month}
</if> </if>
<if test="month != null and type == 1">
and DATE_FORMAT(a.actual_arrival, '%Y-%m') &lt;= #{month}
</if>
</where> </where>
</select> </select>