Merge remote-tracking branch 'origin/master'
# Conflicts:
# ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/CokingController.java
已添加7个文件
已删除10个文件
已修改15个文件
| | |
| | | -- ---------------------------- |
| | | -- 焦化工序-能耗整体情况 |
| | | -- ---------------------------- |
| | | 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.util.date.DateUtils; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.ansteel.api.dto.*; |
| | | 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.dto.*; |
| | | import com.iailab.module.ansteel.coking.entity.*; |
| | | import com.iailab.module.ansteel.coking.service.*; |
| | |
| | | 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; |
| | | } |
| | |
| | | @Schema(description = "信息类型(0:生产情况,1:能源发生,2:能源消耗)") |
| | | private String infoType; |
| | | |
| | | @Schema(description = "指标类型(prod_day,main,child)") |
| | | @Schema(description = "指标类型") |
| | | private String indType; |
| | | |
| | | @Schema(description = "数据类型(测点,指标)") |
| | | private String dataType; |
| | | |
| | | @Schema(description = "测点编码") |
| | | private String pointNo; |
| | | |
| | | @Schema(description = "指标编码") |
| | | private String indCode; |
| | | |
对比新文件 |
| | |
| | | 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; |
| | | } |
| | |
| | | */ |
| | | private String infoType; |
| | | /** |
| | | * 指标类型(prod_day,main,child) |
| | | * 指标类型 |
| | | */ |
| | | private String indType; |
| | | private String indType; |
| | | /** |
| | | * 数据类型(测点,指标) |
| | | */ |
| | | private String dataType; |
| | | /** |
| | | * 测点编码 |
| | | */ |
| | | private String pointNo; |
| | | /** |
| | | * 指标编码 |
| | | */ |
| | |
| | | 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; |
| | |
| | | public class CokingTraceIndEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId |
| | | @TableId(type = IdType.ASSIGN_UUID) |
| | | private String id; |
| | | |
| | | /** |
对比新文件 |
| | |
| | | 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); |
| | | } |
| | |
| | | */ |
| | | public interface CokingTraceChartService { |
| | | List<CokingTraceChartEntity> list(Map<String, Object> params); |
| | | |
| | | void save(CokingTraceChartEntity cokingTraceChartEntity); |
| | | } |
对比新文件 |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | public List<CokingTraceChartEntity> list(Map<String, Object> params) { |
| | | return cokingTraceChartDao.selectList(new QueryWrapper<>()); |
| | | } |
| | | |
| | | @Override |
| | | public void save(CokingTraceChartEntity cokingTraceChartEntity) { |
| | | cokingTraceChartDao.insert(cokingTraceChartEntity); |
| | | } |
| | | } |
| | |
| | | import com.iailab.module.ansteel.coking.dao.CokingTraceConfDao; |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceConfEntity; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceConfService; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<CokingTraceConfEntity> list(Map<String, Object> params) { |
| | | return cokingTraceConfDao.selectList(new QueryWrapper<>()); |
| | | return cokingTraceConfDao.selectList(new QueryWrapper<CokingTraceConfEntity>().eq(ObjectUtils.isNotEmpty(params.get("indType")),"ind_type",params.get("indType"))); |
| | | } |
| | | } |
| | |
| | | String LDG_CHARRCODE = "LDG_PRED01"; |
| | | |
| | | String STEAM_INDEX_CHARTCODE = "STEAM_INDEX"; |
| | | String COKE_INDEX_CHARTCODE = "COKE_INDEX"; |
| | | } |
| | |
| | | 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运行完成"); |
| | | |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.ansteel.job.task; |
| | | |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.coking.entity.CokingAnalyIndEntity; |
| | | import com.iailab.module.ansteel.coking.entity.CokingProcessConfEntity; |
| | | import com.iailab.module.ansteel.coking.entity.CokingProdDayEntity; |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceIndEntity; |
| | | import com.iailab.module.ansteel.coking.service.CokingProcessConfService; |
| | | import com.iailab.module.ansteel.coking.service.CokingProdDayService; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceIndService; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 生成焦化日前生产信息 |
| | |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | String clock = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); |
| | | String clock2 = ""; |
| | | int hour = calendar.get(Calendar.HOUR_OF_DAY); |
| | | if (hour == 0) { |
| | | clock2 = clock.concat("-").concat("A"); |
| | | } else if (hour == 8) { |
| | | clock2 = clock.concat("-").concat("B"); |
| | | } else if (hour == 16) { |
| | | clock2 = clock.concat("-").concat("C"); |
| | | } |
| | | logger.info("清理旧数据"); |
| | | cokingProdDayService.deleteByClock(clock); |
| | | for (CokingProcessConfEntity conf : list) { |
| | |
| | | value = indValues.get(indValues.size() - 1).getDataValue().toString(); |
| | | } |
| | | break; |
| | | case MODEL: |
| | | value = "100"; |
| | | break; |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | saveProdDay(conf, value, clock); |
| | | saveTraceInd(conf, value, clock2); |
| | | } |
| | | } catch (Exception ex) { |
| | | logger.error("RunCokingProdDayTask运行异常"); |
| | |
| | | } |
| | | logger.info("RunCokingProdDayTask运行完成"); |
| | | |
| | | } |
| | | |
| | | private void saveTraceInd(CokingProcessConfEntity conf, String value, String clock) { |
| | | CokingTraceIndEntity cokingTraceIndEntity = new CokingTraceIndEntity(); |
| | | cokingTraceIndEntity.setTitle(conf.getIndType()); |
| | | cokingTraceIndEntity.setClock(clock); |
| | | cokingTraceIndEntity.setIndName(conf.getIndName()); |
| | | cokingTraceIndEntity.setIndValue(value); |
| | | cokingTraceIndEntity.setIndUnit(conf.getIndUnit()); |
| | | cokingTraceIndService.save(cokingTraceIndEntity); |
| | | } |
| | | |
| | | private void saveProdDay(CokingProcessConfEntity conf, String value, String clock) { |
| | |
| | | package com.iailab.module.ansteel.job.task; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.coking.entity.*; |
| | | import com.iailab.module.ansteel.coking.service.*; |
| | | import com.iailab.module.ansteel.common.constant.CommonConstant; |
| | | import com.iailab.module.ansteel.common.enums.ProcessConfDataTypeEnum; |
| | | 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 com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mcs.dto.ChartParamDTO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 炼焦工序异常溯源 |
| | | * 炼焦工序-异常溯源 |
| | | * |
| | | * @author PanZhibao |
| | | * @author lirm |
| | | * @Description |
| | | * @createTime 2025年04月18日 |
| | | * @createTime 2025年04月21日 |
| | | */ |
| | | public class RunCokingTraceModel3Task { |
| | | @Component("runCokingTraceModel3Task") |
| | | public class RunCokingTraceModel3Task implements ITask { |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Autowired |
| | | private CokingTraceReportService cokingTraceReportService; |
| | | |
| | | @Autowired |
| | | private CokingTraceSuggestService cokingTraceSuggestService; |
| | | |
| | | @Autowired |
| | | private CokingTraceDeviationService cokingTraceDeviationService; |
| | | |
| | | @Autowired |
| | | private CokingAnalyIndService cokingAnalyIndService; |
| | | |
| | | @Autowired |
| | | private CokingTraceIndService cokingTraceIndService; |
| | | |
| | | @Autowired |
| | | private CokingTraceConfService cokingTraceConfService; |
| | | |
| | | @Autowired |
| | | private CokingTraceChartService cokingTraceChartService; |
| | | |
| | | @Autowired |
| | | private McsApi mcsApi; |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | @Autowired |
| | | private IndItemApi indItemApi; |
| | | |
| | | private static final HashMap<String, Object> cokeColoumMap = new HashMap<String, Object>() {{ |
| | | put("cokeColoum0", "一级指标-偏差值"); |
| | | put("cokeColoum1", "二级指标-偏差值"); |
| | | put("cokeColoum2", "影响因素1-偏差值"); |
| | | put("cokeColoum3", "影响因素2-偏差值"); |
| | | put("cokeColoum4", "影响因素3-偏差值"); |
| | | put("cokeColoum5", "影响因素n-偏差值"); |
| | | }}; |
| | | |
| | | private static final HashMap<String, Object> historyPointMap = new HashMap<String, Object>() {{ |
| | | put("LJSY001", "荒煤气发生"); |
| | | put("LJSY005", "耗热量"); |
| | | }}; |
| | | |
| | | private static final String jsonStr="{\n" + |
| | | " \"result\": {\n" + |
| | | " \"cokeCOG\":[100.5,99.8],\n" + |
| | | " \"cokeHeat\":[3.7,3.8],\n" + |
| | | " \"cokeIndex\":[[0.8,0.7],[608,608],[1440,1460],[1346,1293],[0.8,0.7],[1372,1293]],\n" + |
| | | " \"cokeTotal\":\"炼焦吨焦耗热量因煤气流量偏高、煤气水分偏低而增加23,经模型计算,延建议调整煤气流量,预计可使吨焦耗热量指标降低17\",\n" + |
| | | " \"cokeColoum0\":[[0,13],[0,42],[0,34]],\n" + |
| | | " \"cokeColoum1\":[[13,12],[12,34],[24,42]],\n" + |
| | | " \"cokeColoum2\":[[27,45],[58,42],[70,31]],\n" + |
| | | " \"cokeColoum3\":[[108,56],[110,89],[185,21]],\n" + |
| | | " \"cokeColoum4\":[[199,13],[200,51],[197,34]],\n" + |
| | | " \"cokeColoum5\":[[147,33],[131,12],[122,13]],\n" + |
| | | " \"cokeHomePage\":[[202,42],[203,13],[204,45],[205,34],[206,17]],\n" + |
| | | " \"cokeHomeIndex\":[[90.4,90.2],[80.3,78],[103,100],[280,270]],\n" + |
| | | " \"cokeHomeIndexInfo\":\"2月18日甲班:吨焦耗热量异常\",\n" + |
| | | " \"cokeHomeErr\":\"2月18日煤气预热器前数据异常(无数据)\"\n" + |
| | | " }\n" + |
| | | "}"; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void run(String params) { |
| | | logger.info("RunCokingTraceModel3Task,参数为:{}", params); |
| | | try { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MINUTE,0); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | String yesterday = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); |
| | | // int hour = calendar.get(Calendar.HOUR_OF_DAY); |
| | | Date startDate = calendar.getTime(); |
| | | calendar.add(Calendar.HOUR, 8); |
| | | Date endDate = calendar.getTime(); |
| | | int hour = 8; |
| | | String clock = ""; |
| | | String analyClass = ""; |
| | | if (hour == 0) { |
| | | clock = yesterday.concat("-").concat("A"); |
| | | analyClass = "甲班"; |
| | | } else if (hour == 8) { |
| | | clock = yesterday.concat("-").concat("B"); |
| | | analyClass = "乙班"; |
| | | } else if (hour == 16) { |
| | | clock = yesterday.concat("-").concat("C"); |
| | | analyClass = "丙班"; |
| | | } |
| | | Map<String, Object> tMap = new HashMap<>(); |
| | | tMap.put("relId", UUID.randomUUID().toString()); |
| | | tMap.put("process", "炼焦工序"); |
| | | tMap.put("reportName", "炼焦工序"); |
| | | tMap.put("analyDate", yesterday); |
| | | tMap.put("analyClass", analyClass); |
| | | tMap.put("clock", clock); |
| | | tMap.put("analyContent", "COG回收量异常;吨焦耗热量异常"); |
| | | tMap.put("startDate", startDate); |
| | | tMap.put("endDate", endDate); |
| | | |
| | | JSONObject jsonObject= JSONObject.parseObject(jsonStr); |
| | | JSONObject result = (JSONObject) JSON.toJSON(jsonObject.get("result")); |
| | | if(!Objects.isNull(result)){ |
| | | saveTraceReport(tMap,result); |
| | | saveTraceSuggest(tMap,result); |
| | | saveTraceDeviation(tMap,result); |
| | | saveAnalyInd(tMap,result); |
| | | saveTraceInd(tMap,result); |
| | | saveTraceChart(tMap,result,startDate,endDate); |
| | | } |
| | | } catch (Exception ex) { |
| | | logger.error("RunCokingTraceModel3Task运行异常"); |
| | | ex.printStackTrace(); |
| | | } |
| | | logger.info("RunCokingTraceModel3Task运行完成"); |
| | | } |
| | | |
| | | private void saveTraceReport(Map<String, Object> tMap,JSONObject result) { |
| | | CokingTraceReportEntity reportEntity = new CokingTraceReportEntity(); |
| | | reportEntity.setId(tMap.get("relId").toString()); |
| | | reportEntity.setProcess(tMap.get("process").toString()); |
| | | reportEntity.setReportName(tMap.get("reportName").toString()); |
| | | reportEntity.setAnalyDate(tMap.get("analyDate").toString()); |
| | | reportEntity.setAnalyClass(tMap.get("analyClass").toString()); |
| | | reportEntity.setClock(tMap.get("clock").toString()); |
| | | reportEntity.setAnalyContent(tMap.get("analyContent").toString()); |
| | | reportEntity.setCreateDate(new Date()); |
| | | cokingTraceReportService.save(reportEntity); |
| | | } |
| | | |
| | | private void saveTraceSuggest(Map<String, Object> tMap,JSONObject result) { |
| | | String cokeTotal = result.get("cokeTotal").toString(); |
| | | if(StringUtils.isNotBlank(cokeTotal)){ |
| | | CokingTraceSuggestEntity suggestEntity = new CokingTraceSuggestEntity(); |
| | | suggestEntity.setRelId(tMap.get("relId").toString()); |
| | | suggestEntity.setProcess(tMap.get("process").toString()); |
| | | suggestEntity.setSugObj("LJ"); |
| | | suggestEntity.setClock(tMap.get("clock").toString()); |
| | | suggestEntity.setContent(cokeTotal); |
| | | suggestEntity.setCreateDate(new Date()); |
| | | cokingTraceSuggestService.save(suggestEntity); |
| | | } |
| | | } |
| | | |
| | | private void saveTraceDeviation(Map<String, Object> tMap,JSONObject result) { |
| | | List<ChartParamDTO> list = mcsApi.getChartParamList(CommonConstant.COKE_INDEX_CHARTCODE); |
| | | Map<String, String> steamIndexMaps = list.stream().collect(Collectors.toMap(ChartParamDTO::getParamCode, e -> e.getParamValue())); |
| | | for(int i=0;i<=5;i++){ |
| | | String cokeColoum = result.get("cokeColoum"+i).toString(); |
| | | if(StringUtils.isNotBlank(cokeColoum)){ |
| | | JSONArray responseArr = JSON.parseArray(cokeColoum); |
| | | for (int j = 0; j < responseArr.size(); j++) { |
| | | JSONArray element = JSON.parseArray(responseArr.get(j).toString()); |
| | | CokingTraceDeviationEntity deviationEntity = new CokingTraceDeviationEntity(); |
| | | deviationEntity.setRelId(tMap.get("relId").toString()); |
| | | deviationEntity.setProcess(tMap.get("process").toString()); |
| | | deviationEntity.setClock(tMap.get("clock").toString()); |
| | | deviationEntity.setSugObj("LJ"); |
| | | deviationEntity.setGroupName(cokeColoumMap.get("cokeColoum"+i).toString()); |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | // deviationEntity.setIndName(element.get(0).toString()); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | | deviationEntity.setCreateDate(new Date()); |
| | | cokingTraceDeviationService.save(deviationEntity); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void saveAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | String[] analyContent = tMap.get("analyContent").toString().split(";"); |
| | | for(int i=0;i<analyContent.length;i++){ |
| | | CokingAnalyIndEntity analyIndEntity = new CokingAnalyIndEntity(); |
| | | analyIndEntity.setRelId(tMap.get("relId").toString()); |
| | | analyIndEntity.setAnalyType(tMap.get("process").toString()); |
| | | analyIndEntity.setAnalyDate(tMap.get("analyDate").toString()); |
| | | analyIndEntity.setAnalyClass(tMap.get("analyClass").toString()); |
| | | analyIndEntity.setAnalyContent(analyContent[i]); |
| | | analyIndEntity.setSort(i+1); |
| | | cokingAnalyIndService.save(analyIndEntity); |
| | | } |
| | | } |
| | | |
| | | private void saveTraceInd(Map<String, Object> tMap,JSONObject result) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("indType","炼焦工序异常溯源"); |
| | | List<CokingTraceConfEntity> list = cokingTraceConfService.list(map); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | logger.info("ConfLis is Empty"); |
| | | return; |
| | | } |
| | | for (CokingTraceConfEntity conf : list) { |
| | | if (StringUtils.isBlank(conf.getDataType())) { |
| | | logger.info("DataType is Empty"); |
| | | continue; |
| | | } |
| | | if (StringUtils.isBlank(conf.getPointNo())) { |
| | | logger.info("PointNo is Empty"); |
| | | continue; |
| | | } |
| | | String value = ""; |
| | | switch (ProcessConfDataTypeEnum.getEumByCode(conf.getDataType())) { |
| | | case DATAPOINT: |
| | | List<String> points = new ArrayList<>(); |
| | | points.add(conf.getPointNo()); |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | value = pointsRealValue.get(conf.getPointNo()).toString(); |
| | | break; |
| | | case IND: |
| | | List<ApiIndItemValueDTO> indValues = indItemApi.queryIndItemDefaultValue(conf.getPointNo()); |
| | | if (!CollectionUtils.isEmpty(indValues)) { |
| | | value = indValues.get(indValues.size() - 1).getDataValue().toString(); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | CokingTraceIndEntity cokingTraceIndEntity = new CokingTraceIndEntity(); |
| | | cokingTraceIndEntity.setRelId(tMap.get("relId").toString()); |
| | | cokingTraceIndEntity.setTitle(conf.getIndType()); |
| | | cokingTraceIndEntity.setClock(tMap.get("clock").toString()); |
| | | cokingTraceIndEntity.setIndName(conf.getIndName()); |
| | | cokingTraceIndEntity.setIndValue(value); |
| | | cokingTraceIndEntity.setIndUnit(conf.getIndUnit()); |
| | | cokingTraceIndService.save(cokingTraceIndEntity); |
| | | } |
| | | } |
| | | |
| | | private void saveTraceChart(Map<String, Object> tMap, JSONObject result,Date startDate,Date endDate) { |
| | | historyPointMap.forEach((key,value) ->{ |
| | | CokingTraceChartEntity cokingTraceChartEntity = new CokingTraceChartEntity(); |
| | | cokingTraceChartEntity.setRelId(tMap.get("relId").toString()); |
| | | cokingTraceChartEntity.setName(value.toString()); |
| | | cokingTraceChartEntity.setClock(tMap.get("clock").toString()); |
| | | cokingTraceChartEntity.setDataNo(key); |
| | | cokingTraceChartEntity.setDataType("DATAPOINT"); |
| | | cokingTraceChartEntity.setStartTime(startDate); |
| | | cokingTraceChartEntity.setEndTime(endDate); |
| | | cokingTraceChartEntity.setCreateDate(new Date()); |
| | | cokingTraceChartService.save(cokingTraceChartEntity); |
| | | }); |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.coking.entity.CokingAnalyIndEntity; |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceDeviationEntity; |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceReportEntity; |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceSuggestEntity; |
| | | import com.iailab.module.ansteel.coking.service.CokingAnalyIndService; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceDeviationService; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceReportService; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceSuggestService; |
| | | import com.iailab.module.ansteel.coking.entity.*; |
| | | import com.iailab.module.ansteel.coking.service.*; |
| | | import com.iailab.module.ansteel.common.constant.CommonConstant; |
| | | import com.iailab.module.ansteel.common.enums.ProcessConfDataTypeEnum; |
| | | 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 com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mcs.dto.ChartParamDTO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 干熄焦工序-异常溯源 |
| | |
| | | private CokingAnalyIndService cokingAnalyIndService; |
| | | |
| | | @Autowired |
| | | private CokingTraceIndService cokingTraceIndService; |
| | | |
| | | @Autowired |
| | | private CokingTraceConfService cokingTraceConfService; |
| | | |
| | | @Autowired |
| | | private McsApi mcsApi; |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | @Autowired |
| | | private IndItemApi indItemApi; |
| | | |
| | | private static final HashMap<String, Object> steamFirstColoumMap = new HashMap<String, Object>() {{ |
| | | put("steamFirstColoum0", "一级指标-偏差值"); |
| | |
| | | logger.info("RunCokingTraceModelTask,参数为:{}", params); |
| | | try { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int hour = calendar.get(Calendar.HOUR_OF_DAY); |
| | | // int hour = calendar.get(Calendar.HOUR_OF_DAY); |
| | | String yesterday = DateUtils.format(DateUtils.addDateDays(new Date(), -1), DateUtils.FORMAT_YEAR_MONTH_DAY); |
| | | String clock = ""; |
| | | String analyClass = ""; |
| | | int hour = 8; |
| | | if (hour == 0) { |
| | | clock = yesterday.concat("-").concat("A"); |
| | | analyClass = "甲班"; |
| | |
| | | saveTraceReport(tMap,result); |
| | | saveTraceSuggest(tMap,result); |
| | | saveTraceDeviation(tMap,result); |
| | | saveTraceAnalyInd(tMap,result); |
| | | saveAnalyInd(tMap,result); |
| | | saveTraceInd(tMap,result); |
| | | } |
| | | } catch (Exception ex) { |
| | | logger.error("RunCokingTraceModelTask运行异常"); |
| | |
| | | } |
| | | |
| | | private void saveTraceDeviation(Map<String, Object> tMap,JSONObject result) { |
| | | // String chartCode = "STEAM_INDEX"; |
| | | // List<ChartParamDTO> list = mcsApi.getChartParamList(chartCode); |
| | | // Map<String, String> steamIndexMaps = list.stream().collect(Collectors.toMap(ChartParamDTO::getParamCode, e -> e.getParamValue())); |
| | | List<ChartParamDTO> list = mcsApi.getChartParamList(CommonConstant.STEAM_INDEX_CHARTCODE); |
| | | Map<String, String> steamIndexMaps = list.stream().collect(Collectors.toMap(ChartParamDTO::getParamCode, e -> e.getParamValue())); |
| | | for(int i=0;i<=5;i++){ |
| | | String steamFirstColoum = result.get("steamFirstColoum"+i).toString(); |
| | | if(StringUtils.isNotBlank(steamFirstColoum)){ |
| | |
| | | deviationEntity.setClock(tMap.get("clock").toString()); |
| | | deviationEntity.setSugObj("1#"); |
| | | deviationEntity.setGroupName(steamFirstColoumMap.get("steamFirstColoum"+i).toString()); |
| | | // deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndName(element.get(0).toString()); |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | | deviationEntity.setCreateDate(new Date()); |
| | | cokingTraceDeviationService.save(deviationEntity); |
| | |
| | | |
| | | } |
| | | |
| | | private void saveTraceAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | CokingAnalyIndEntity analyIndEntity = new CokingAnalyIndEntity(); |
| | | analyIndEntity.setRelId(tMap.get("relId").toString()); |
| | | analyIndEntity.setAnalyType(tMap.get("process").toString()); |
| | | analyIndEntity.setAnalyDate(tMap.get("analyDate").toString()); |
| | | analyIndEntity.setAnalyClass(tMap.get("analyClass").toString()); |
| | | analyIndEntity.setAnalyContent(tMap.get("analyContent").toString()); |
| | | cokingAnalyIndService.save(analyIndEntity); |
| | | private void saveAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | String[] analyContent = tMap.get("analyContent").toString().split(";"); |
| | | for(int i=0;i<analyContent.length;i++){ |
| | | CokingAnalyIndEntity analyIndEntity = new CokingAnalyIndEntity(); |
| | | analyIndEntity.setRelId(tMap.get("relId").toString()); |
| | | analyIndEntity.setAnalyType(tMap.get("process").toString()); |
| | | analyIndEntity.setAnalyDate(tMap.get("analyDate").toString()); |
| | | analyIndEntity.setAnalyClass(tMap.get("analyClass").toString()); |
| | | analyIndEntity.setAnalyContent(analyContent[i]); |
| | | analyIndEntity.setSort(i+1); |
| | | cokingAnalyIndService.save(analyIndEntity); |
| | | } |
| | | } |
| | | |
| | | private void saveTraceInd(Map<String, Object> tMap,JSONObject result) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("indType","干熄焦工序异常溯源"); |
| | | List<CokingTraceConfEntity> list = cokingTraceConfService.list(map); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | logger.info("ConfLis is Empty"); |
| | | return; |
| | | } |
| | | for (CokingTraceConfEntity conf : list) { |
| | | if (StringUtils.isBlank(conf.getDataType())) { |
| | | logger.info("DataType is Empty"); |
| | | continue; |
| | | } |
| | | if (StringUtils.isBlank(conf.getPointNo())) { |
| | | logger.info("PointNo is Empty"); |
| | | continue; |
| | | } |
| | | String value = ""; |
| | | switch (ProcessConfDataTypeEnum.getEumByCode(conf.getDataType())) { |
| | | case DATAPOINT: |
| | | List<String> points = new ArrayList<>(); |
| | | points.add(conf.getPointNo()); |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | value = pointsRealValue.get(conf.getPointNo()).toString(); |
| | | break; |
| | | case IND: |
| | | List<ApiIndItemValueDTO> indValues = indItemApi.queryIndItemDefaultValue(conf.getPointNo()); |
| | | if (!CollectionUtils.isEmpty(indValues)) { |
| | | value = indValues.get(indValues.size() - 1).getDataValue().toString(); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | CokingTraceIndEntity cokingTraceIndEntity = new CokingTraceIndEntity(); |
| | | cokingTraceIndEntity.setRelId(tMap.get("relId").toString()); |
| | | cokingTraceIndEntity.setTitle(conf.getIndType()); |
| | | cokingTraceIndEntity.setClock(tMap.get("clock").toString()); |
| | | cokingTraceIndEntity.setIndName(conf.getIndName()); |
| | | cokingTraceIndEntity.setIndValue(value); |
| | | cokingTraceIndEntity.setIndUnit(conf.getIndUnit()); |
| | | cokingTraceIndService.save(cokingTraceIndEntity); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 |