| | |
| | | -- ---------------------------- |
| | | -- 焦化工序-能耗整体情况 |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_coking_trace_energy`; |
| | | CREATE TABLE `t_coking_trace_energy` |
| | | ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `rel_id` varchar(36) NULL DEFAULT NULL COMMENT '关联ID', |
| | | `type` varchar(20) NULL DEFAULT NULL COMMENT '类型', |
| | | `clock` varchar(20) NULL DEFAULT NULL COMMENT '查询时间', |
| | | `steam_p` decimal(10, 4) NULL DEFAULT NULL COMMENT '蒸汽发生', |
| | | `steam_c` decimal(10, 4) NULL DEFAULT NULL COMMENT '蒸汽消耗', |
| | | `gas_p` decimal(10, 4) NULL DEFAULT NULL COMMENT '煤气发生', |
| | | `gas_c` decimal(10, 4) NULL DEFAULT NULL COMMENT '煤气消耗', |
| | | `power_c` decimal(10, 4) NULL DEFAULT NULL COMMENT '电力消耗', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | key idx_rel_id (rel_id) |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC COMMENT '焦化工序能耗整体情况'; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 焦化工序-能耗整体情况 |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_coking_trace_energy`; |
| | | CREATE TABLE `t_coking_trace_energy` |
| | | ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `rel_id` varchar(36) NULL DEFAULT NULL COMMENT '关联ID', |
| | | `type` varchar(20) NULL DEFAULT NULL COMMENT '类型', |
| | | `clock` varchar(20) NULL DEFAULT NULL COMMENT '查询时间', |
| | | `steam_p` decimal(10, 4) NULL DEFAULT NULL COMMENT '蒸汽发生', |
| | | `steam_c` decimal(10, 4) NULL DEFAULT NULL COMMENT '蒸汽消耗', |
| | | `gas_p` decimal(10, 4) NULL DEFAULT NULL COMMENT '煤气发生', |
| | | `gas_c` decimal(10, 4) NULL DEFAULT NULL COMMENT '煤气消耗', |
| | | `power_c` decimal(10, 4) NULL DEFAULT NULL COMMENT '电力消耗', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | key idx_rel_id (rel_id) |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC COMMENT '焦化工序能耗整体情况'; |
| | | DROP TABLE IF EXISTS `t_coking_overview`; |
| | | CREATE TABLE `t_coking_overview` ( |
| | | `id` varchar(36) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id', |
| | | `rel_id` varchar(36) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关联ID', |
| | | `process_type` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '工序类型', |
| | | `sub_process_type` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '子工序类型', |
| | | `clock` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '查询时间', |
| | | `steam_p` decimal(10,4) DEFAULT NULL COMMENT '蒸汽发生', |
| | | `steam_c` decimal(10,4) DEFAULT NULL COMMENT '蒸汽消耗', |
| | | `steam_v` decimal(10,4) DEFAULT NULL COMMENT '蒸汽量', |
| | | `gas_p` decimal(10,4) DEFAULT NULL COMMENT '煤气发生', |
| | | `gas_c` decimal(10,4) DEFAULT NULL COMMENT '煤气消耗', |
| | | `power_c` decimal(10,4) DEFAULT NULL COMMENT '电力消耗', |
| | | `idle_time` decimal(10,4) DEFAULT NULL COMMENT '空转时间', |
| | | `bfg_c` decimal(10,4) DEFAULT NULL COMMENT 'BFG消耗', |
| | | `cog_p` decimal(10,4) DEFAULT NULL COMMENT 'COG回收', |
| | | `cog_c` decimal(10,4) DEFAULT NULL COMMENT 'COG消耗', |
| | | `bfg_only_c` decimal(10,4) DEFAULT NULL COMMENT 'BFG单耗', |
| | | `cog_only_c` decimal(10,4) DEFAULT NULL COMMENT 'COG单耗', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE KEY `process_type_clock_unique` (`process_type`,`sub_process_type`,`clock`), |
| | | KEY `idx_rel_id` (`rel_id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='工序概况情况'; |
| | | |
| | | -- ---------------------------- |
| | | -- 焦化工序-指标值溯源 |
| | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.ansteel.api.dto.*; |
| | | import com.iailab.module.ansteel.coking.dto.CokingTraceEnergyDTO; |
| | | import com.iailab.module.ansteel.coking.dto.CokingOverviewDTO; |
| | | import com.iailab.module.ansteel.coking.dto.CokingTraceIndDTO; |
| | | import com.iailab.module.ansteel.coking.dto.CokingTraceSuggestDTO; |
| | | import com.iailab.module.ansteel.coking.entity.*; |
| | |
| | | private CokingProdDayService cokingProdDayService; |
| | | |
| | | @Autowired |
| | | private CokingTraceEnergyService cokingTraceEnergyService; |
| | | private CokingOverviewService cokingOverviewService; |
| | | |
| | | @Autowired |
| | | private CokingTraceSuggestService cokingTraceSuggestService; |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/trace-energy/list") |
| | | @Operation(summary = "焦化工序-能耗整体情况") |
| | | public CommonResult<Map<String,List<CokingTraceEnergyDTO>>> getEnergyConsumptionList(@RequestParam Map<String, Object> params) { |
| | | Map<String,List<CokingTraceEnergyDTO>> result = cokingTraceEnergyService.list(params); |
| | | @GetMapping("/overview/list") |
| | | @Operation(summary = "各工序-概况") |
| | | public CommonResult<Map<String,List<CokingOverviewDTO>>> getOverviewList(@RequestParam Map<String, Object> params) { |
| | | Map<String,List<CokingOverviewDTO>> result = cokingOverviewService.list(params); |
| | | return success(result); |
| | | } |
| | | |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.coking.dao; |
| | | |
| | | import com.iailab.framework.common.dao.BaseDao; |
| | | import com.iailab.module.ansteel.coking.entity.CokingOverviewEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @description: |
| | | * @author: dzd |
| | | * @date: 2025/4/21 13:56 |
| | | **/ |
| | | @Mapper |
| | | public interface CokingOverviewDao extends BaseDao<CokingOverviewEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.coking.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @description: 工序概况情况 |
| | | * @author: dzd |
| | | * @date: 2025/4/21 11:50 |
| | | **/ |
| | | @Data |
| | | public class CokingOverviewDTO { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | /** |
| | | * 关联ID |
| | | */ |
| | | private String relId; |
| | | /** |
| | | * 工序类型 |
| | | */ |
| | | private String processType; |
| | | /** |
| | | * 工序类型名称 |
| | | */ |
| | | private String processTypeName; |
| | | /** |
| | | * 子工序类型 |
| | | */ |
| | | private String subProcessType; |
| | | /** |
| | | * 子工序类型名称 |
| | | */ |
| | | private String subProcessTypeName; |
| | | /** |
| | | * 查询时间 |
| | | */ |
| | | private String clock; |
| | | /** |
| | | * 蒸汽发生 |
| | | */ |
| | | private BigDecimal steamP; |
| | | /** |
| | | * 蒸汽消耗 |
| | | */ |
| | | private BigDecimal steamC; |
| | | /** |
| | | * 蒸汽量 |
| | | */ |
| | | private BigDecimal steamV; |
| | | /** |
| | | * 煤气发生 |
| | | */ |
| | | private BigDecimal gasP; |
| | | /** |
| | | * 煤气消耗 |
| | | */ |
| | | private BigDecimal gasC; |
| | | /** |
| | | * 电力消耗 |
| | | */ |
| | | private BigDecimal powerC; |
| | | /** |
| | | * 空转时间 |
| | | */ |
| | | private BigDecimal idleTime; |
| | | /** |
| | | * BFG消耗 |
| | | */ |
| | | private BigDecimal bfgC; |
| | | /** |
| | | * cog回收 |
| | | */ |
| | | private BigDecimal cogP; |
| | | /** |
| | | * cog消耗 |
| | | */ |
| | | private BigDecimal cogC; |
| | | |
| | | /** |
| | | * BFG单耗 |
| | | */ |
| | | private BigDecimal bfgOnlyC; |
| | | |
| | | /** |
| | | * cog单耗 |
| | | */ |
| | | private BigDecimal cogOnlyC; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.coking.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @description: 工序概况情况 |
| | | * @author: dzd |
| | | * @date: 2025/4/21 11:50 |
| | | **/ |
| | | @Data |
| | | @TableName("t_coking_overview") |
| | | public class CokingOverviewEntity { |
| | | |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | /** |
| | | * 关联ID |
| | | */ |
| | | private String relId; |
| | | /** |
| | | * 工序类型 |
| | | */ |
| | | private String processType; |
| | | /** |
| | | * 子工序类型 |
| | | */ |
| | | private String subProcessType; |
| | | /** |
| | | * 查询时间 |
| | | */ |
| | | private String clock; |
| | | /** |
| | | * 蒸汽发生 |
| | | */ |
| | | private BigDecimal steamP; |
| | | /** |
| | | * 蒸汽消耗 |
| | | */ |
| | | private BigDecimal steamC; |
| | | /** |
| | | * 蒸汽量 |
| | | */ |
| | | private BigDecimal steamV; |
| | | /** |
| | | * 煤气发生 |
| | | */ |
| | | private BigDecimal gasP; |
| | | /** |
| | | * 煤气消耗 |
| | | */ |
| | | private BigDecimal gasC; |
| | | /** |
| | | * 电力消耗 |
| | | */ |
| | | private BigDecimal powerC; |
| | | /** |
| | | * 空转时间 |
| | | */ |
| | | private BigDecimal idleTime; |
| | | /** |
| | | * BFG消耗 |
| | | */ |
| | | private BigDecimal bfgC; |
| | | /** |
| | | * COG回收 |
| | | */ |
| | | private BigDecimal cogP; |
| | | /** |
| | | * COG消耗 |
| | | */ |
| | | private BigDecimal cogC; |
| | | |
| | | /** |
| | | * BFG单耗 |
| | | */ |
| | | private BigDecimal bfgOnlyC; |
| | | |
| | | /** |
| | | * cog单耗 |
| | | */ |
| | | private BigDecimal cogOnlyC; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.coking.service; |
| | | |
| | | |
| | | import com.iailab.module.ansteel.coking.dto.CokingOverviewDTO; |
| | | import com.iailab.module.ansteel.coking.entity.CokingOverviewEntity; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @description: 概况 |
| | | * @author: dzd |
| | | * @date: 2025/4/21 10:15 |
| | | **/ |
| | | public interface CokingOverviewService { |
| | | Map<String,List<CokingOverviewDTO>> list(Map<String, Object> params); |
| | | |
| | | void insert(List<CokingOverviewEntity> result); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.coking.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.ansteel.coking.dao.CokingOverviewDao; |
| | | import com.iailab.module.ansteel.coking.dto.CokingOverviewDTO; |
| | | import com.iailab.module.ansteel.coking.entity.CokingOverviewEntity; |
| | | import com.iailab.module.ansteel.coking.service.CokingOverviewService; |
| | | import com.iailab.module.ansteel.common.enums.ProcessTypeEnum; |
| | | import com.iailab.module.ansteel.common.enums.SubProcessTypeEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class CokingOverviewServiceImpl implements CokingOverviewService { |
| | | @Resource |
| | | private CokingOverviewDao cokingOverviewDao; |
| | | |
| | | @Override |
| | | public Map<String, List<CokingOverviewDTO>> list(Map<String, Object> params) { |
| | | Map<String,List<CokingOverviewDTO>> result = new HashMap<>(2); |
| | | |
| | | String processType = (String) params.get("processType"); |
| | | if (StringUtils.isBlank(processType)) { |
| | | return result; |
| | | } |
| | | |
| | | String clock = (String) params.get("clock"); |
| | | String month; |
| | | if (StringUtils.isBlank(clock)) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | clock = DateUtils.format(calendar.getTime(), "yyyy-MM-dd"); |
| | | month = DateUtils.format(calendar.getTime(), "yyyy-MM"); |
| | | }else { |
| | | Date parse = DateUtils.parse(clock, "yyyy-MM-dd"); |
| | | month = DateUtils.format(parse, "yyyy-MM"); |
| | | } |
| | | |
| | | // 天数据 |
| | | QueryWrapper<CokingOverviewEntity> queryWrapperDay = new QueryWrapper<>(); |
| | | queryWrapperDay.eq("process_type", processType); |
| | | queryWrapperDay.eq("clock", clock); |
| | | List<CokingOverviewEntity> dayList = cokingOverviewDao.selectList(queryWrapperDay); |
| | | List<CokingOverviewDTO> dayDTOList = ConvertUtils.sourceToTarget(dayList, CokingOverviewDTO.class); |
| | | String processName = ProcessTypeEnum.getEumByCode(processType).getProcess(); |
| | | dayDTOList.forEach(e -> { |
| | | e.setProcessTypeName(processName); |
| | | e.setSubProcessTypeName(SubProcessTypeEnum.getEumByCode(e.getSubProcessType()).getProcess()); |
| | | }); |
| | | result.put("day", dayDTOList); |
| | | |
| | | // 月数据 |
| | | QueryWrapper<CokingOverviewEntity> queryWrapperMonth = new QueryWrapper<>(); |
| | | queryWrapperMonth.eq("process_type", processType); |
| | | queryWrapperMonth.like("clock", month); |
| | | queryWrapperMonth.select("sub_process_type","SUM(steam_p) as steam_p","SUM(steam_c) as steam_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(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") |
| | | .groupBy("sub_process_type"); |
| | | |
| | | List<CokingOverviewEntity> monthList = cokingOverviewDao.selectList(queryWrapperMonth); |
| | | monthList.forEach(e -> e.setClock(month)); |
| | | List<CokingOverviewDTO> monthDTOList = ConvertUtils.sourceToTarget(monthList, CokingOverviewDTO.class); |
| | | monthDTOList.forEach(e -> { |
| | | e.setProcessTypeName(processName); |
| | | e.setSubProcessTypeName(SubProcessTypeEnum.getEumByCode(e.getSubProcessType()).getProcess()); |
| | | }); |
| | | result.put("month", monthDTOList); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void insert(List<CokingOverviewEntity> result) { |
| | | cokingOverviewDao.insert(result); |
| | | } |
| | | } |
| | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @description: 工序 |
| | | * @description: 工序类型 |
| | | * @author: dzd |
| | | * @date: 2025/4/17 15:58 |
| | | * @date: 2025/4/21 10:17 |
| | | **/ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ProcessTypeEnum { |
| | | GL("GL", "鼓冷"), |
| | | LA("LA", "硫铵"), |
| | | CB("CB", "粗苯"), |
| | | TL("TL", "脱硫"), |
| | | GXJ_1("GXJ_1", "1#干熄焦"), |
| | | GXJ_2("GXJ_2", "2#干熄焦"), |
| | | GXJ_3("GXJ_3", "3#干熄焦"), |
| | | ALL("ALL", "总体"); |
| | | BM("bm", "备煤", "备煤工序-概况"), |
| | | LJ("lj", "炼焦", "炼焦工序-概况"), |
| | | GXJ("gxj", "干熄焦", "干熄焦工序-概况"), |
| | | HC("hc", "化产", "化产工序-概况"), |
| | | MQ("mq", "煤气", "焦化能源介质概况-煤气"), |
| | | ZQ("zq", "蒸汽", "焦化能源介质概况-蒸汽"), |
| | | DL("dl", "电力", "焦化能源介质概况-电力"), |
| | | UNKNOW("unkuow", "未知", "未知"); |
| | | private String code; |
| | | private String desc; |
| | | private String process; |
| | | private String reportName; |
| | | |
| | | public static ProcessTypeEnum getEumByCode(Integer code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | public static ProcessTypeEnum getEumByCode(String code) { |
| | | for (ProcessTypeEnum statusEnum : ProcessTypeEnum.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | return UNKNOW; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @description: 子工序类型 |
| | | * @author: dzd |
| | | * @date: 2025/4/17 15:58 |
| | | **/ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum SubProcessTypeEnum { |
| | | YFSJ("YFSJ", "预粉碎机"), |
| | | FSJ("FSJ", "粉碎机"), |
| | | PSJ("PSJ", "破碎机"), |
| | | JL_12("JL_12", "1#2#焦炉"), |
| | | JL_34("JL_34", "3#4#焦炉"), |
| | | GL("GL", "鼓冷"), |
| | | LA("LA", "硫铵"), |
| | | CB("CB", "粗苯"), |
| | | TL("TL", "脱硫"), |
| | | GXJ_1("GXJ_1", "1#干熄焦"), |
| | | GXJ_2("GXJ_2", "2#干熄焦"), |
| | | GXJ_3("GXJ_3", "3#干熄焦"), |
| | | BMGX("BMGX", "备煤工序"), |
| | | JLLQ("JLLQ", "焦炉炉区"), |
| | | GXJ("GXJ", "干熄焦"), |
| | | HCHS("HCHS", "化产回收"), |
| | | ZT("ZT", "总体"); |
| | | private String code; |
| | | private String process; |
| | | |
| | | public static SubProcessTypeEnum getEumByCode(String code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (SubProcessTypeEnum statusEnum : SubProcessTypeEnum.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.job.task; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.coking.entity.CokingOverviewEntity; |
| | | import com.iailab.module.ansteel.coking.entity.CokingProcessConfEntity; |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceReportEntity; |
| | | import com.iailab.module.ansteel.coking.service.CokingOverviewService; |
| | | import com.iailab.module.ansteel.coking.service.CokingProcessConfService; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceReportService; |
| | | import com.iailab.module.ansteel.common.enums.ProcessConfDataTypeEnum; |
| | | import com.iailab.module.ansteel.common.enums.ProcessTypeEnum; |
| | | import com.iailab.module.data.api.ind.IndItemApi; |
| | | import com.iailab.module.data.api.ind.dto.ApiIndItemValueDTO; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 备煤工序-概况 |
| | | * |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年04月21日 |
| | | */ |
| | | @Slf4j |
| | | @Component("runCokingOverviewTask") |
| | | public class RunCokingOverviewTask implements ITask{ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Resource |
| | | private CokingProcessConfService cokingProcessConfService; |
| | | @Resource |
| | | private CokingOverviewService cokingOverviewService; |
| | | @Resource |
| | | private DataPointApi dataPointApi; |
| | | @Resource |
| | | private IndItemApi indItemApi; |
| | | @Resource |
| | | private CokingTraceReportService cokingTraceReportService; |
| | | |
| | | @Override |
| | | public void run(String processTypes) { |
| | | logger.info("runCokingOverviewTask,参数为:{}", processTypes); |
| | | try { |
| | | |
| | | String[] split = processTypes.split(","); |
| | | |
| | | for (String processType : split) { |
| | | CokingProcessConfEntity queryParams = new CokingProcessConfEntity(); |
| | | queryParams.setIndType(processType); |
| | | List<CokingProcessConfEntity> list = cokingProcessConfService.list(queryParams); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | logger.info("ConfLis is Empty"); |
| | | return; |
| | | } |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | String clock = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); |
| | | // 插入溯源报告 |
| | | CokingTraceReportEntity reportEntity = new CokingTraceReportEntity(); |
| | | String relId = UUID.randomUUID().toString(); |
| | | reportEntity.setId(relId); |
| | | reportEntity.setProcess(ProcessTypeEnum.getEumByCode(processType).getProcess()); |
| | | reportEntity.setReportName(ProcessTypeEnum.getEumByCode(processType).getReportName()); |
| | | reportEntity.setAnalyDate(clock); |
| | | reportEntity.setClock(clock); |
| | | cokingTraceReportService.save(reportEntity); |
| | | |
| | | // 按照子工序类型分组 |
| | | Map<String, List<CokingProcessConfEntity>> processTypeMap = list.stream().collect(Collectors.groupingBy(CokingProcessConfEntity::getExt2)); |
| | | // 结果 <子工序类型,<数据key,数据value>> |
| | | List<CokingOverviewEntity> result = new ArrayList<>(processTypeMap.size()); |
| | | |
| | | for (Map.Entry<String, List<CokingProcessConfEntity>> entry : processTypeMap.entrySet()) { |
| | | Map<String,Double> values = new HashMap<>(entry.getValue().size()); |
| | | for (CokingProcessConfEntity conf : entry.getValue()) { |
| | | if (StringUtils.isBlank(conf.getDataType())) { |
| | | logger.info("DataType is Empty"); |
| | | continue; |
| | | } |
| | | if (StringUtils.isBlank(conf.getPointNo())) { |
| | | logger.info("PointNo is Empty"); |
| | | continue; |
| | | } |
| | | Double value = 0.0; |
| | | switch (ProcessConfDataTypeEnum.getEumByCode(conf.getDataType())) { |
| | | case DATAPOINT: |
| | | List<String> points = new ArrayList<>(); |
| | | points.add(conf.getPointNo()); |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | value = Double.valueOf(pointsRealValue.get(conf.getPointNo()).toString()); |
| | | break; |
| | | case IND: |
| | | List<ApiIndItemValueDTO> indValues = indItemApi.queryIndItemDefaultValue(conf.getPointNo()); |
| | | if (!CollectionUtils.isEmpty(indValues)) { |
| | | value = Double.valueOf(indValues.get(indValues.size() - 1).getDataValue().toString()); |
| | | } |
| | | break; |
| | | case MODEL: |
| | | break; |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | values.put(conf.getExt1(),value); |
| | | } |
| | | CokingOverviewEntity overviewEntity = new CokingOverviewEntity(); |
| | | BeanUtil.fillBeanWithMap(values,overviewEntity,true); |
| | | overviewEntity.setId(UUID.randomUUID().toString()); |
| | | overviewEntity.setRelId(relId); |
| | | overviewEntity.setProcessType(processType); |
| | | overviewEntity.setSubProcessType(entry.getKey()); |
| | | overviewEntity.setClock(clock); |
| | | result.add(overviewEntity); |
| | | } |
| | | cokingOverviewService.insert(result); |
| | | } |
| | | } catch (Exception ex) { |
| | | logger.error("runCokingOverviewTask运行异常"); |
| | | ex.printStackTrace(); |
| | | } |
| | | logger.info("runCokingOverviewTask运行完成"); |
| | | |
| | | } |
| | | } |
| | |
| | | name: ansteel-server |
| | | |
| | | profiles: |
| | | active: test |
| | | active: dev |
| | | |
| | | cloud: |
| | | nacos: |
| | |
| | | - t_coking_trace_conf |
| | | - t_coking_trace_data |
| | | - t_coking_trace_deviation |
| | | - t_coking_trace_energy |
| | | - t_coking_trace_report |
| | | - t_coking_trace_suggest |
| | | - t_coking_overview |
| | | - t_coking_trace_ind |
| | | swagger: |
| | | title: 鞍钢鲅鱼圈能源管控系统 |
| | | description: 鞍钢鲅鱼圈能源管控系统 |
| | | version: ${iailab.info.version} |
| | | log-path: D:\DLUT\ansteel |
| | | log-path: . |
| | | |
| | | debug: false |