From 345b3d36963f128039edf0275d4717fbdc0adc0f Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期二, 06 五月 2025 17:16:14 +0800 Subject: [PATCH] 占比-月累计 --- ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/dto/CokingOverviewDTO.java | 28 ++++++++++++++-------------- ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/service/impl/CokingOverviewServiceImpl.java | 25 +++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/dto/CokingOverviewDTO.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/dto/CokingOverviewDTO.java index 57df1d4..e20022e 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/dto/CokingOverviewDTO.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/dto/CokingOverviewDTO.java @@ -127,18 +127,18 @@ */ private BigDecimal psRatio; - /** - * 峰时占比-月累计 - */ - private BigDecimal fsRatioMonth; - - /** - * 谷时占比-月累计 - */ - private BigDecimal gsRatioMonth; - - /** - * 平时占比-月累计 - */ - private BigDecimal psRatioMonth; +// /** +// * 峰时占比-月累计 +// */ +// private BigDecimal fsRatioMonth; +// +// /** +// * 谷时占比-月累计 +// */ +// private BigDecimal gsRatioMonth; +// +// /** +// * 平时占比-月累计 +// */ +// private BigDecimal psRatioMonth; } \ No newline at end of file diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/service/impl/CokingOverviewServiceImpl.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/service/impl/CokingOverviewServiceImpl.java index 06108d2..47da4b6 100644 --- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/service/impl/CokingOverviewServiceImpl.java +++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/service/impl/CokingOverviewServiceImpl.java @@ -14,7 +14,10 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; @Slf4j @Service @@ -60,6 +63,11 @@ }); result.put("day", dayDTOList); + Map<String, CokingOverviewEntity> ratioMonth = new HashMap<>(); + if (processType.equals(ProcessTypeEnum.BM.getCode())) { + ratioMonth = dayList.stream().collect(Collectors.toMap(CokingOverviewEntity::getSubProcessType, Function.identity(), (e1, e2) -> e1)); + } + // 月数据 QueryWrapper<CokingOverviewEntity> queryWrapperMonth = new QueryWrapper<>(); queryWrapperMonth.eq("process_type", processType); @@ -70,10 +78,23 @@ List<CokingOverviewEntity> monthList = cokingOverviewDao.selectList(queryWrapperMonth); monthList.forEach(e -> e.setClock("前30日累计")); List<CokingOverviewDTO> monthDTOList = ConvertUtils.sourceToTarget(monthList, CokingOverviewDTO.class); - monthDTOList.forEach(e -> { + for (CokingOverviewDTO e : monthDTOList) { e.setProcessTypeName(processName); e.setSubProcessTypeName(SubProcessTypeEnum.getEumByCode(e.getSubProcessType()).getProcess()); - }); + if (processType.equals(ProcessTypeEnum.BM.getCode())) { + // 月占比 + if (ratioMonth.containsKey(e.getSubProcessType())) { + e.setFsRatio(ratioMonth.get(e.getSubProcessType()).getFsRatioMonth()); + e.setGsRatio(ratioMonth.get(e.getSubProcessType()).getGsRatioMonth()); + e.setPsRatio(ratioMonth.get(e.getSubProcessType()).getPsRatioMonth()); + }else { + e.setFsRatio(BigDecimal.ZERO); + e.setGsRatio(BigDecimal.ZERO); + e.setPsRatio(BigDecimal.ZERO); + } + + } + } result.put("month", monthDTOList); return result; -- Gitblit v1.9.3