鞍钢鲅鱼圈能源管控系统后端代码
潘志宝
7 天以前 5a6b8f6aae658b025d2e6e1127544bc8a95ec7c6
Merge branch 'master' of http://dlindusit.com:53929/r/ansteel
已修改3个文件
84 ■■■■■ 文件已修改
ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/dto/CokingOverviewDTO.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/service/impl/CokingOverviewServiceImpl.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPeakValleyFlatTask.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
}
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,20 +63,38 @@
        });
        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);
        queryWrapperMonth.between("clock", monthStartClock,clock);
        queryWrapperMonth.select("sub_process_type","SUM(steam_p) as steam_p","SUM(dj_steam_p) as dj_steam_p","SUM(steam_c) as steam_c","SUM(steam_only_c) as steam_only_c","SUM(steam_v) as steam_v","SUM(gas_p) as gas_p","SUM(gas_c) as gas_c","SUM(power_c) as power_c","SUM(power_only_c) as power_only_c","SUM(power_c_standard) as power_c_standard","SUM(idle_time) as idle_time","SUM(bfg_c) as bfg_c","SUM(cog_p) as cog_p","SUM(cog_c) as cog_c","SUM(bfg_only_c) as bfg_only_c","SUM(cog_only_c) as cog_only_c","SUM(gxls) as gxls","SUM(fs_ratio) as fs_ratio","SUM(gs_ratio) as gs_ratio","SUM(ps_ratio) as ps_ratio")
        queryWrapperMonth.select("sub_process_type","SUM(steam_p) as steam_p","SUM(dj_steam_p) as dj_steam_p","SUM(steam_c) as steam_c","SUM(steam_only_c) as steam_only_c","SUM(steam_v) as steam_v","SUM(gas_p) as gas_p","SUM(gas_c) as gas_c","SUM(power_c) as power_c","SUM(power_only_c) as power_only_c","SUM(power_c_standard) as power_c_standard","SUM(idle_time) as idle_time","SUM(bfg_c) as bfg_c","SUM(cog_p) as cog_p","SUM(cog_c) as cog_c","SUM(bfg_only_c) as bfg_only_c","SUM(cog_only_c) as cog_only_c","SUM(gxls) as gxls")
                .groupBy("sub_process_type");
        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;
ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPeakValleyFlatTask.java
@@ -46,11 +46,6 @@
                    .collect(Collectors.groupingBy(PeakValleyFlatEntity::getPointNo));
            groupedByPointNo.entrySet().stream().forEach(entry -> {
                //计算昨日的峰/谷累积量
                double value = getSumValue(entry.getValue(), 1, calendar);
                //计算昨日总电耗
                Calendar cal = (Calendar) calendar.clone();
                cal.set(Calendar.MILLISECOND, 0);
                cal.set(Calendar.SECOND, 0);
@@ -61,7 +56,20 @@
                Date startTime = cal.getTime();
                cal.add(Calendar.DAY_OF_YEAR, -29);
                Date monthStartTime = cal.getTime();
                //计算昨日的峰/谷累积量
                double value = getSumValue(entry.getValue(), 1, calendar);
                //计算昨日总电耗
                double totalValue = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTime, endTime);
                //计算前三十日峰/谷累积量
                double valueMonth = getSumValueTotal(entry.getValue().get(0).getPointNoTotal(), monthStartTime, startTime)+value;
                //计算前三十日总电耗
                double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), monthStartTime, endTime);
                logger.info("name:"+entry.getValue().get(0).getName()+";value:"+value+";totalValue:"+totalValue+";valueMonth:"+valueMonth+";totalValueMonth:"+totalValueMonth);
                //下发昨日占比
                ApiPointValueWriteDTO percentDto = new ApiPointValueWriteDTO();
@@ -72,22 +80,15 @@
                //下发昨日峰/谷累积量
                ApiPointValueWriteDTO totalDto = new ApiPointValueWriteDTO();
                percentDto.setPointNo(entry.getValue().get(0).getPointNoTotal());
                percentDto.setValue(totalValue);
                totalDto.setPointNo(entry.getValue().get(0).getPointNoTotal());
                totalDto.setValue(value);
                dataPointApi.writePointRealValue(totalDto);
                //计算前三十日峰/谷累积量
                double valueMonth = getSumValueTotal(entry.getValue().get(0).getPointNoTotal(), monthStartTime, startTime)+totalValue;
                //计算前三十日总电耗
                double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), monthStartTime, endTime);
                //下发前三十日占比
                ApiPointValueWriteDTO monthDto = new ApiPointValueWriteDTO();
                monthDto.setPointNo(entry.getValue().get(0).getPointNoMonth());
                double percentMonth = totalValueMonth == 0 ? 0 : valueMonth / totalValueMonth * 100;
                monthDto.setValue(percentMonth);
                logger.info("name:"+entry.getValue().get(0).getName()+";value:"+value+";valueMonth:"+valueMonth+";totalValueMonth:"+totalValueMonth);
                dataPointApi.writePointRealValue(monthDto);
            });
        } catch (Exception ex) {