diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/mapper/BusMaterialsorderMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/mapper/BusMaterialsorderMapper.java index 9b6443ec..db39ddf6 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/mapper/BusMaterialsorderMapper.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/mapper/BusMaterialsorderMapper.java @@ -20,7 +20,7 @@ public interface BusMaterialsorderMapper extends BaseMapperPlus grossOutput( @Param("projectId") Long projectId, @Param("statusArr") String[] statusArr, - @Param("startYue") String startYue, - @Param("endYue") String endYue); + @Param("month") String month, + @Param("type") int type); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusMaterialsorderServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusMaterialsorderServiceImpl.java index 435fb606..b7233c27 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusMaterialsorderServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusMaterialsorderServiceImpl.java @@ -230,24 +230,14 @@ public class BusMaterialsorderServiceImpl extends ServiceImpl list = baseMapper.grossOutput(projectId, arr, startYue,endYue); + List list = baseMapper.grossOutput(projectId, arr, month,type); //计算出所有的订单数量 BigDecimal resBigDecimal = new BigDecimal(0); for (GrossOutputRes grossOutputRes : list) { diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutTableController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutTableController.java index a6edc136..9ba064f1 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutTableController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutTableController.java @@ -71,6 +71,7 @@ public class OutTableController extends BaseController { private final IBusMaterialsorderService busMaterialsorderService; + BigDecimal parseUnit = new BigDecimal("10000"); /** * 施工产值报表(计划 VS 实际) @@ -109,7 +110,7 @@ public class OutTableController extends BaseController { //构建返回数据 List outMonthlyConstructionVos = new ArrayList<>(); - BigDecimal parseUnit = new BigDecimal("10000"); + for (BusProjectVo busProjectVo : rows){ OutMonthlyConstructionVo vo = new OutMonthlyConstructionVo(); @@ -126,35 +127,34 @@ public class OutTableController extends BaseController { BigDecimal totalValue = BigDecimal.ZERO; BigDecimal estimatedTotalValue = BigDecimal.ZERO; BigDecimal monthlyEstimatedValue = BigDecimal.ZERO; - for (PgsProgressCategory category : collect) { + List planAudits = outMonthPlanAudits.stream().filter(plan -> plan.getProjectId().equals(busProjectVo.getId())).toList(); - List 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) { - YearMonth planMonth = YearMonth.parse(planAudit.getPlanMonth(), formatter); - // 比较大小 - if (planMonth.isBefore(yearMonth)) { - estimatedTotalValue=estimatedTotalValue.add(planAudit.getConstructionValue()); - } else if (yearMonth.isAfter(planMonth)) { - - } else { - estimatedTotalValue = estimatedTotalValue.add(planAudit.getConstructionValue()); - monthlyEstimatedValue = planAudit.getConstructionValue(); - } - } - - //计算价格 - if ("1".equals(category.getUnitType())) { - // 数量类型: total * unitPrice - 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); - } - } + } else { + estimatedTotalValue = estimatedTotalValue.add(planAudit.getConstructionValue()); + monthlyEstimatedValue = planAudit.getConstructionValue(); + } + } +// for (PgsProgressCategory category : collect) { +// //计算价格 +// if ("1".equals(category.getUnitType())) { +// // 数量类型: total * unitPrice +// 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.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); } @@ -275,28 +274,30 @@ public class OutTableController extends BaseController { BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null); vo.setTotalCompletionOutputValue(constructionValue); }else if ("3".equals(bo.getValueType())) { - //采购完工产值 todo: 掉罗成的接口 -// BigDecimal purchaseValue = bigDecimal; -// vo.setTotalCompletionOutputValue(purchaseValue); + //采购完工产值 + BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,null,0); + vo.setTotalCompletionOutputValue(purchaseValue); }else{ //设计完工产值 BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,null); //施工完工产值 BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,null); - //采购完工产值 todo: 掉罗成的接口 - -// BigDecimal purchaseValue = bigDecimal; - -// vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue)); + //采购完工产值 + BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,null,0); + vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue)); } - //结算产值 BigDecimal settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,bo.getValueType(),null); vo.setTotalSettlementOutputValue(settlementValue); vo.setCompletionUnsettledAmount(vo.getTotalSettlementOutputValue().subtract(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); } @@ -335,10 +336,9 @@ public class OutTableController extends BaseController { BigDecimal designValue = monthPlanService.getDesignValueByProjectId(projectVoId,bo.getMonth()); //施工完工产值 BigDecimal constructionValue = constructionValueService.getCompleteValue(projectVoId,bo.getMonth()); - //采购完工产值 todo: 掉罗成的接口 -// BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,bo.getMonth()); - -// vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue)); + //采购完工产值 + BigDecimal purchaseValue = busMaterialsorderService.grossOutput(projectVoId,bo.getMonth(),0); + vo.setTotalCompletionOutputValue( designValue.add(constructionValue).add(purchaseValue)); //分包结算产值 BigDecimal settlementValue = settlementValueSubcontractService.getValueByProjectId(projectVoId,null,bo.getMonth()); @@ -348,6 +348,13 @@ public class OutTableController extends BaseController { BigDecimal ownerSettlementValue = settlementValueOwnerService.getValueByProjectId(projectVoId,bo.getMonth()); 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); } @@ -417,15 +424,23 @@ public class OutTableController extends BaseController { vo.setAccumulatedCompletionValue(accumulatedCompleteValue); }else if("2".equals(bo.getValueType())){ - //todo: 掉罗成的接口 -// busMaterialsorderService.grossOutput(projectVoId,bo.getMonth()) - vo.setMonthCompletionValue(BigDecimal.ZERO); + + vo.setMonthCompletionValue(busMaterialsorderService.grossOutput(projectVo.getId(),bo.getMonth(),1)); + vo.setAccumulatedCompletionValue(BigDecimal.ZERO); } vo.setValueDifference(vo.getMonthCompletionValue().subtract(vo.getMonthEstimatedValue())); 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); } @@ -435,7 +450,7 @@ public class OutTableController extends BaseController { rspData.setRows(vos); rspData.setTotal(busProjectVoTableDataInfo.getTotal()); - return TableDataInfo.build(); + return rspData; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutConstructionValueServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutConstructionValueServiceImpl.java index dacfeae6..1e5c76d5 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutConstructionValueServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutConstructionValueServiceImpl.java @@ -175,7 +175,11 @@ public class OutConstructionValueServiceImpl extends ServiceImpl - - and DATE_FORMAT(a.actual_arrival, '%Y-%m') = #{yue} + + and DATE_FORMAT(a.actual_arrival, '%Y-%m') = #{month} + + and DATE_FORMAT(a.actual_arrival, '%Y-%m') <= #{month} +