| | |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `clock` varchar(20) NULL DEFAULT NULL COMMENT '查询时间', |
| | | `info_type` varchar(10) NULL DEFAULT NULL COMMENT '信息类型(0:生产情况,1:能源发生,2:能源消耗)', |
| | | `ind_code` varchar(50) NULL DEFAULT NULL COMMENT '数据编码', |
| | | `ind_name` varchar(50) NULL DEFAULT NULL COMMENT '数据名称', |
| | | `ind_unit` varchar(50) NULL DEFAULT NULL COMMENT '数据单位', |
| | | `ind_value` varchar(50) NULL DEFAULT NULL COMMENT '数据值', |
| | | `sort` int NULL DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | key idx_clock (clock) |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC COMMENT '焦化工序日生产信息'; |
| | | |
| | | -- ---------------------------- |
| | |
| | | ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `rel_id` varchar(36) NULL DEFAULT NULL COMMENT '关联ID', |
| | | `process` varchar(20) NULL DEFAULT NULL COMMENT '工序名称', |
| | | `ex_obj` varchar(20) NULL DEFAULT NULL COMMENT '异常对象', |
| | | `clock` varchar(20) NULL DEFAULT NULL COMMENT '查询时间', |
| | | `data_type` varchar(20) NULL DEFAULT NULL COMMENT '数据类型', |
| | | `point_no` varchar(20) NULL DEFAULT NULL COMMENT '异常点位编号', |
| | | `point_name` varchar(20) NULL DEFAULT NULL COMMENT '异常点位名称', |
| | | `ex_date` datetime NULL DEFAULT NULL COMMENT '异常时间', |
| | | `ex_type` varchar(20) NULL DEFAULT NULL COMMENT '异常原因', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | `ex_time` datetime NULL DEFAULT NULL COMMENT '异常时间', |
| | | `ex_type` varchar(200) NULL DEFAULT NULL COMMENT '异常原因', |
| | | `create_date` datetime 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 '焦化工序数据异常'; |
| | | |
| | | -- ---------------------------- |
| | |
| | | `sort` varchar(50) DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='月最大需量,实测需量,有功功率'; |
| | | |
| | | ALTER TABLE `t_power_demand` |
| | | ADD COLUMN `code` varchar(50) NULL DEFAULT NULL COMMENT '编号'; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 负荷移植-调整后的功率因数与无功倒送量 |
| | | -- ---------------------------- |
| | |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | @Autowired |
| | | private CokingTraceChartService cokingTraceChartService; |
| | | |
| | | @Autowired |
| | | private CokingTraceDataService cokingTraceDataService; |
| | | |
| | | @Resource |
| | | private DataPointApi dataPointApi; |
| | | |
| | |
| | | private IndItemApi indItemApi; |
| | | |
| | | @GetMapping("/analy-ind/list") |
| | | @Operation(summary = "焦化工序-指标分析") |
| | | @Operation(summary = "焦化总图-指标分析") |
| | | public CommonResult<List<CokingAnalyIndDTO>> getCokingAnalyIndList(@RequestParam Map<String, Object> params) { |
| | | List<CokingAnalyIndEntity> list = cokingAnalyIndService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingAnalyIndDTO.class)); |
| | | } |
| | | |
| | | @GetMapping("/analy-trend/list") |
| | | @Operation(summary = "焦化工序-趋势分析") |
| | | @Operation(summary = "焦化工序-趋势分析(废弃)") |
| | | public CommonResult<List<CokingAnalyTrendDTO>> getCokingAnalyTrendList(@RequestParam Map<String, Object> params) { |
| | | List<CokingAnalyTrendEntity> list = cokingAnalyTrendService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingAnalyTrendDTO.class)); |
| | | } |
| | | |
| | | @GetMapping("/process-child/list") |
| | | @Operation(summary = "焦化工序-子工序指标") |
| | | @Operation(summary = "焦化总图-子工序指标") |
| | | public CommonResult<List<CokingProcessChildDTO>> getCokingProcessChildList(@RequestParam Map<String, Object> params) { |
| | | List<CokingProcessChildEntity> list = cokingProcessChildService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingProcessChildDTO.class)); |
| | | } |
| | | |
| | | @GetMapping("/process-main/list") |
| | | @Operation(summary = "焦化工序-主工序指标") |
| | | @Operation(summary = "焦化总图-主工序指标") |
| | | public CommonResult<List<CokingProcessMainDTO>> getCokingProcessMainList(@RequestParam Map<String, Object> params) { |
| | | List<CokingProcessMainEntity> list = cokingProcessMainService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingProcessMainDTO.class)); |
| | | } |
| | | |
| | | @GetMapping("/prod-day/list") |
| | | @Operation(summary = "焦化工序-日生产信息") |
| | | @Operation(summary = "焦化总图-日生产信息") |
| | | public CommonResult<List<CokingProdDayDTO>> getCokingProdDayList(@RequestParam Map<String, Object> params) { |
| | | List<CokingProdDayEntity> list = cokingProdDayService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingProdDayDTO.class)); |
| | | } |
| | | |
| | | @GetMapping("/ex-data/list") |
| | | @Operation(summary = "焦化总图-异常数据") |
| | | public CommonResult<List<CokingTraceDataDTO>> getExDataList(@RequestParam Map<String, Object> params) { |
| | | String clock = (String) params.get("clock"); |
| | | if (StringUtils.isBlank(clock)) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | clock = DateUtils.format(calendar.getTime(), "yyyy-MM-dd"); |
| | | params.put("clock", clock); |
| | | } |
| | | |
| | | List<CokingTraceDataEntity> list = cokingTraceDataService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingTraceDataDTO.class)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/overview/list") |
| | | @Operation(summary = "各工序-概况") |
| | | @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); |
| | | } |
| | | |
| | | @GetMapping("/overview/abnormal-data") |
| | | @Operation(summary = "各工序-异常数据") |
| | | public CommonResult<List<CokingTraceDataDTO>> getAbnormalData(@RequestParam Map<String, Object> params) { |
| | | String processType = (String) params.get("processType"); |
| | | if (StringUtils.isBlank(processType)) { |
| | | return success(new ArrayList<>()); |
| | | } |
| | | |
| | | String clock = (String) params.get("clock"); |
| | | if (StringUtils.isBlank(clock)) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | clock = DateUtils.format(calendar.getTime(), "yyyy-MM-dd"); |
| | | params.put("clock", clock); |
| | | } |
| | | List<CokingTraceDataEntity> list = cokingTraceDataService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingTraceDataDTO.class)); |
| | | } |
| | | |
| | | @GetMapping("/trace-suggest/list") |
| | | @Operation(summary = "焦化工序-异常溯源及优化建议") |
| | | public CommonResult<List<CokingTraceSuggestDTO>> getTraceSuggestList(@RequestParam Map<String, Object> params) { |
| | |
| | | List<ApiPointValueDTO> monthChartData = dataPointApi.queryPointHistoryValue(apiPointValueQueryDTO); |
| | | List<Double> monthValues = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(monthChartData)) { |
| | | monthValues = monthChartData.stream().map(item -> { |
| | | return item.getV(); |
| | | }).collect(Collectors.toList()); |
| | | |
| | | monthValues = monthChartData.stream().map(item -> item.getV()).collect(Collectors.toList()); |
| | | result.setMax(monthValues.stream().max(Double::compareTo).get()); |
| | | result.setMin(monthValues.stream().min(Double::compareTo).get()); |
| | | } |
| | |
| | | } |
| | | return success(result); |
| | | } |
| | | |
| | | @GetMapping("/demand/history") |
| | | @Operation(summary = "负荷移植-实测需量,有功功率 历史") |
| | | public CommonResult<PowerHistoryDTO> getPowerDemandHistory(@RequestBody PowerDemandHisReqDTO dto) { |
| | | log.info("请求参数: {}", JSONObject.toJSONString(dto)); |
| | | |
| | | // 参数校验 |
| | | if (StringUtils.isBlank(dto.getCode())) { |
| | | return CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST, "code不能为空"); |
| | | } |
| | | if (StringUtils.isBlank(dto.getQueryType())) { |
| | | return CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST, "queryType不能为空"); |
| | | } |
| | | |
| | | PowerDemandEntity powerDemand = powerDemandService.getByCode(dto.getCode()); |
| | | if (powerDemand == null) { |
| | | log.info("未找到code对应的数据: {}", dto.getCode()); |
| | | return success(new PowerHistoryDTO()); |
| | | } |
| | | |
| | | String queryType = dto.getQueryType().toUpperCase(); |
| | | String pointNo; |
| | | switch (queryType.toUpperCase()) { |
| | | case "D": |
| | | pointNo = powerDemand.getCurDemand(); |
| | | break; |
| | | case "P": |
| | | pointNo = powerDemand.getActivePower(); |
| | | break; |
| | | default: |
| | | throw new IllegalArgumentException("不支持的queryType: " + queryType); |
| | | } |
| | | |
| | | // 默认查最近24小时 |
| | | Date end = Optional.ofNullable(dto.getEndTime()).orElseGet(() -> { |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | cal.set(Calendar.SECOND, 0); |
| | | return cal.getTime(); |
| | | }); |
| | | |
| | | Date start = Optional.ofNullable(dto.getStartTime()).orElseGet(() -> { |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.setTime(end); |
| | | cal.add(Calendar.MINUTE, -1440); // 24小时前 |
| | | return cal.getTime(); |
| | | }); |
| | | |
| | | // 查询历史数据 |
| | | ApiPointValueQueryDTO query = new ApiPointValueQueryDTO(); |
| | | query.setPointNo(pointNo); |
| | | query.setStart(start); |
| | | query.setEnd(end); |
| | | |
| | | log.info("开始查询实测需量/有功功率历史数据,测点: {}", pointNo); |
| | | List<ApiPointValueDTO> chartData = dataPointApi.queryPointHistoryValue(query); |
| | | |
| | | // 构建返回结果 |
| | | PowerHistoryDTO result = new PowerHistoryDTO(); |
| | | result.setCategories(DateUtils.getTimeScale(start, end, 60)); |
| | | result.setDataList(chartData.stream() |
| | | .map(pv -> new Object[]{ |
| | | DateUtils.format(pv.getT(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND), |
| | | pv.getV() |
| | | }) |
| | | .collect(Collectors.toList())); |
| | | |
| | | return success(result); |
| | | } |
| | | } |
| | |
| | | @Schema(description = "信息类型(0:生产情况,1:能源发生,2:能源消耗)") |
| | | private String infoType; |
| | | |
| | | @Schema(description = "数据名称") |
| | | @Schema(description = "指标编码") |
| | | private String indCode; |
| | | |
| | | @Schema(description = "指标名称") |
| | | private String indName; |
| | | |
| | | @Schema(description = "数据单位") |
| | |
| | | @Schema(description = "机组名称") |
| | | private String name; |
| | | |
| | | @Schema(description = "编码") |
| | | private String code; |
| | | |
| | | @Schema(description = "月最大需量") |
| | | private String maxDemand; |
| | | |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.api.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author dyk |
| | | * @Description |
| | | * @createTime 2025年04月23日 |
| | | */ |
| | | @Data |
| | | public class PowerDemandHisReqDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String code; |
| | | |
| | | private String queryType; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | } |
| | |
| | | package com.iailab.module.ansteel.coking.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | @Schema(description = "关联ID") |
| | | private String relId; |
| | | |
| | | @Schema(description = "工序名称") |
| | | private String process; |
| | | |
| | | @Schema(description = "异常对象") |
| | | private String exObj; |
| | | |
| | | @Schema(description = "查询时间") |
| | | private String clock; |
| | | |
| | | @Schema(description = "数据类型") |
| | | private String dataType; |
| | | |
| | |
| | | private String pointName; |
| | | |
| | | @Schema(description = "异常时间") |
| | | private Date exDate; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date exTime; |
| | | |
| | | @Schema(description = "异常原因") |
| | | private String exType; |
| | |
| | | |
| | | private String infoType; |
| | | |
| | | private String indCode; |
| | | |
| | | private String indName; |
| | | |
| | | private String indUnit; |
| | |
| | | * 关联ID |
| | | */ |
| | | private String relId; |
| | | |
| | | /** |
| | | * 工序名称 |
| | | */ |
| | | private String process; |
| | | |
| | | /** |
| | | * 异常对象 |
| | | */ |
| | | private String exObj; |
| | | |
| | | /** |
| | | * 查询时间 |
| | | */ |
| | | private String clock; |
| | | /** |
| | | * 数据类型 |
| | | */ |
| | |
| | | /** |
| | | * 异常时间 |
| | | */ |
| | | private Date exDate; |
| | | private Date exTime; |
| | | /** |
| | | * 异常原因 |
| | | */ |
| | | private String exType; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createDate; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | * @since 1.0.0 2025-04-16 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @TableName("t_coking_trace_suggest") |
| | | public class CokingTraceSuggestEntity { |
| | | |
| | |
| | | |
| | | List<CokingAnalyIndEntity> list(Map<String, Object> params); |
| | | |
| | | void save(CokingAnalyIndEntity analyIndEntity); |
| | | void save(List<CokingAnalyIndEntity> entityList); |
| | | } |
| | |
| | | Map<String,List<CokingOverviewDTO>> list(Map<String, Object> params); |
| | | |
| | | void insert(List<CokingOverviewEntity> result); |
| | | |
| | | void deleteByProcessType(String processType, String clock); |
| | | } |
| | |
| | | */ |
| | | public interface CokingTraceDataService { |
| | | List<CokingTraceDataEntity> list(Map<String, Object> params); |
| | | |
| | | void insertList(List<CokingTraceDataEntity> list); |
| | | |
| | | void deleteByExObj(String exObj, String clock); |
| | | } |
| | |
| | | public interface CokingTraceDeviationService { |
| | | List<CokingTraceDeviationEntity> list(Map<String, Object> params); |
| | | |
| | | void save(CokingTraceDeviationEntity deviationEntity); |
| | | void save(List<CokingTraceDeviationEntity> entityList); |
| | | } |
| | |
| | | |
| | | List<CokingTraceIndEntity> list(Map<String, Object> params); |
| | | |
| | | void save(CokingTraceIndEntity cokingTraceIndEntity); |
| | | void save(List<CokingTraceIndEntity> entityList); |
| | | } |
| | |
| | | List<CokingTraceSuggestEntity> list(Map<String, Object> params); |
| | | |
| | | void save(CokingTraceSuggestEntity suggestEntity); |
| | | |
| | | void insert(List<CokingTraceSuggestEntity> suggestEntitieList); |
| | | |
| | | List<CokingTraceSuggestEntity> getAbnormalData(Map<String, Object> params); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void save(CokingAnalyIndEntity analyIndEntity) { |
| | | cokingAnalyIndDao.insert(analyIndEntity); |
| | | public void save(List<CokingAnalyIndEntity> entityList) { |
| | | cokingAnalyIndDao.insert(entityList); |
| | | } |
| | | } |
| | |
| | | public void insert(List<CokingOverviewEntity> result) { |
| | | cokingOverviewDao.insert(result); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByProcessType(String processType, String clock) { |
| | | QueryWrapper<CokingOverviewEntity> queryWrapperDay = new QueryWrapper<>(); |
| | | queryWrapperDay.eq("process_type", processType); |
| | | queryWrapperDay.eq("clock", clock); |
| | | cokingOverviewDao.delete(queryWrapperDay); |
| | | } |
| | | } |
| | |
| | | import com.iailab.module.ansteel.coking.dao.CokingTraceDataDao; |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceDataEntity; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceDataService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<CokingTraceDataEntity> list(Map<String, Object> params) { |
| | | return cokingTraceDataDao.selectList(new QueryWrapper<>()); |
| | | String processType = (String) params.get("processType"); |
| | | String clock = (String) params.get("clock"); |
| | | QueryWrapper<CokingTraceDataEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq(StringUtils.isNotBlank(processType), "ex_obj", processType) |
| | | .eq(StringUtils.isNotBlank(clock), "clock", clock) |
| | | .orderByAsc("create_date"); |
| | | |
| | | return cokingTraceDataDao.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void insertList(List<CokingTraceDataEntity> list) { |
| | | cokingTraceDataDao.insert(list); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByExObj(String exObj, String clock) { |
| | | QueryWrapper<CokingTraceDataEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("ex_obj", exObj) |
| | | .eq("clock", clock); |
| | | cokingTraceDataDao.delete(queryWrapper); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void save(CokingTraceDeviationEntity deviationEntity) { |
| | | cokingTraceDeviationDao.insert(deviationEntity); |
| | | public void save(List<CokingTraceDeviationEntity> entityList) { |
| | | cokingTraceDeviationDao.insert(entityList); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void save(CokingTraceIndEntity cokingTraceIndEntity) { |
| | | cokingTraceIndDao.insert(cokingTraceIndEntity); |
| | | public void save(List<CokingTraceIndEntity> entityList) { |
| | | cokingTraceIndDao.insert(entityList); |
| | | } |
| | | } |
| | |
| | | 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.module.ansteel.coking.dao.CokingTraceSuggestDao; |
| | | import com.iailab.module.ansteel.coking.entity.CokingTraceSuggestEntity; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceSuggestService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | QueryWrapper<CokingTraceSuggestEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("rel_id", relId) |
| | | .eq(StringUtils.isNotBlank(sugObj), "sug_obj", sugObj) |
| | | .orderByAsc("sug_obj"); |
| | | .orderByAsc("create_date"); |
| | | return cokingTraceSuggestDao.selectList(queryWrapper); |
| | | } |
| | | |
| | |
| | | public void save(CokingTraceSuggestEntity suggestEntity) { |
| | | cokingTraceSuggestDao.insert(suggestEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void insert(List<CokingTraceSuggestEntity> suggestEntitieList) { |
| | | cokingTraceSuggestDao.insert(suggestEntitieList); |
| | | } |
| | | |
| | | @Override |
| | | public List<CokingTraceSuggestEntity> getAbnormalData(Map<String, Object> params) { |
| | | String processType = (String) params.get("processType"); |
| | | String clock = (String) params.get("clock"); |
| | | if (StringUtils.isBlank(clock)) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | clock = DateUtils.format(calendar.getTime(), "yyyy-MM-dd"); |
| | | } |
| | | |
| | | QueryWrapper<CokingTraceSuggestEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("sug_obj", processType) |
| | | .eq("clock", clock) |
| | | .orderByAsc("create_date"); |
| | | return cokingTraceSuggestDao.selectList(queryWrapper); |
| | | } |
| | | } |
| | |
| | | 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.*; |
| | |
| | | CokingProcessConfEntity queryParams = new CokingProcessConfEntity(); |
| | | queryParams.setIndType("child"); |
| | | List<CokingProcessConfEntity> list = cokingProcessConfService.list(queryParams); |
| | | if (ObjectUtils.isNotEmpty(list)) { |
| | | // 先建立ext1到sort的映射关系 |
| | | Map<String, Integer> ext1ToSort = list.stream() |
| | | .collect(Collectors.toMap( |
| | | CokingProcessConfEntity::getExt1, |
| | | CokingProcessConfEntity::getSort, |
| | | (oldValue, newValue) -> oldValue)); |
| | | |
| | | // 然后按这个关系排序分组 |
| | | Map<String, List<CokingProcessConfEntity>> groupMap = list.stream() |
| | | .sorted(Comparator.comparing(CokingProcessConfEntity::getSort)) |
| | | .collect(Collectors.collectingAndThen( |
| | | Collectors.groupingBy(CokingProcessConfEntity::getExt1), |
| | | map -> map.entrySet().stream() |
| | | .sorted(Comparator.comparingInt( |
| | | e -> ext1ToSort.get(e.getKey()))) // 按ext1对应的sort值排序 |
| | | .collect(Collectors.toMap( |
| | | Map.Entry::getKey, |
| | | Map.Entry::getValue, |
| | | (a, b) -> a, |
| | | LinkedHashMap::new)))); |
| | | |
| | | logger.info("清理旧数据"); |
| | | cokingProcessChildService.deleteByClock(clock); |
| | | |
| | | AtomicReference<Integer> counter = new AtomicReference<>(1); |
| | | groupMap.forEach((group, confList) -> { |
| | | CokingProcessChildEntity cokingProcessChildEntity = new CokingProcessChildEntity(); |
| | | cokingProcessChildEntity.setInfoType("0"); |
| | | cokingProcessChildEntity.setSort(counter.getAndSet(counter.get() + 1)); |
| | | cokingProcessChildEntity.setCategory("day"); |
| | | cokingProcessChildEntity.setClock(clock); |
| | | CokingProcessConfEntity childConf = confList.get(0); |
| | | cokingProcessChildEntity.setIndType(childConf.getExt3()); |
| | | cokingProcessChildEntity.setIndMain(childConf.getExt4()); |
| | | cokingProcessChildEntity.setIndName(childConf.getExt5()); |
| | | confList.forEach(conf -> { |
| | | List<String> points = new ArrayList<>(); |
| | | points.add(conf.getPointNo()); |
| | | Map<String, Object> stringObjectMap = dataPointApi.queryPointsRealValue(points); |
| | | //保存数据 |
| | | Object value = stringObjectMap.get(conf.getPointNo()); |
| | | if(ObjectUtils.isNotEmpty(value)) { |
| | | if(conf.getExt2().equals(ProcessIndDataTypeEnum.LSPJ.getCode())) { |
| | | cokingProcessChildEntity.setAvgValue(value.toString()); |
| | | } else if(conf.getExt2().equals(ProcessIndDataTypeEnum.LLZ.getCode())) { |
| | | cokingProcessChildEntity.setTheoryValue(value.toString()); |
| | | } else if(conf.getExt2().equals(ProcessIndDataTypeEnum.SJZ.getCode())) { |
| | | cokingProcessChildEntity.setActualValue(value.toString()); |
| | | } else if(conf.getExt2().equals(ProcessIndDataTypeEnum.JZZ.getCode())) { |
| | | cokingProcessChildEntity.setStandValue(value.toString()); |
| | | } else if(conf.getExt2().equals(ProcessIndDataTypeEnum.SSSJ.getCode())) { |
| | | cokingProcessChildEntity.setRealValue(value.toString()); |
| | | } |
| | | } |
| | | }); |
| | | cokingProcessChildService.save(cokingProcessChildEntity); |
| | | }); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | logger.info("子工序配置为空"); |
| | | return; |
| | | } |
| | | // 先建立ext1到sort的映射关系 |
| | | Map<String, Integer> ext1ToSort = list.stream() |
| | | .collect(Collectors.toMap( |
| | | CokingProcessConfEntity::getExt1, |
| | | CokingProcessConfEntity::getSort, |
| | | (oldValue, newValue) -> oldValue)); |
| | | |
| | | // 然后按这个关系排序分组 |
| | | Map<String, List<CokingProcessConfEntity>> groupMap = list.stream() |
| | | .sorted(Comparator.comparing(CokingProcessConfEntity::getSort)) |
| | | .collect(Collectors.collectingAndThen( |
| | | Collectors.groupingBy(CokingProcessConfEntity::getExt1), |
| | | map -> map.entrySet().stream() |
| | | .sorted(Comparator.comparingInt( |
| | | e -> ext1ToSort.get(e.getKey()))) // 按ext1对应的sort值排序 |
| | | .collect(Collectors.toMap( |
| | | Map.Entry::getKey, |
| | | Map.Entry::getValue, |
| | | (a, b) -> a, |
| | | LinkedHashMap::new)))); |
| | | |
| | | logger.info("清理旧数据"); |
| | | cokingProcessChildService.deleteByClock(clock); |
| | | |
| | | AtomicReference<Integer> counter = new AtomicReference<>(1); |
| | | groupMap.forEach((group, confList) -> { |
| | | CokingProcessChildEntity cokingProcessChildEntity = new CokingProcessChildEntity(); |
| | | cokingProcessChildEntity.setInfoType("0"); |
| | | cokingProcessChildEntity.setSort(counter.getAndSet(counter.get() + 1)); |
| | | cokingProcessChildEntity.setCategory("day"); |
| | | cokingProcessChildEntity.setClock(clock); |
| | | CokingProcessConfEntity childConf = confList.get(0); |
| | | cokingProcessChildEntity.setIndType(childConf.getExt3()); |
| | | cokingProcessChildEntity.setIndMain(childConf.getExt4()); |
| | | cokingProcessChildEntity.setIndName(childConf.getExt5()); |
| | | confList.forEach(conf -> { |
| | | List<String> points = new ArrayList<>(); |
| | | points.add(conf.getPointNo()); |
| | | Map<String, Object> stringObjectMap = dataPointApi.queryPointsRealValue(points); |
| | | //保存数据 |
| | | Object value = stringObjectMap.get(conf.getPointNo()); |
| | | if(ObjectUtils.isNotEmpty(value)) { |
| | | if(conf.getExt2().equals(ProcessIndDataTypeEnum.LSPJ.getCode())) { |
| | | cokingProcessChildEntity.setAvgValue(value.toString()); |
| | | } else if(conf.getExt2().equals(ProcessIndDataTypeEnum.LLZ.getCode())) { |
| | | cokingProcessChildEntity.setTheoryValue(value.toString()); |
| | | } else if(conf.getExt2().equals(ProcessIndDataTypeEnum.SJZ.getCode())) { |
| | | cokingProcessChildEntity.setActualValue(value.toString()); |
| | | } else if(conf.getExt2().equals(ProcessIndDataTypeEnum.JZZ.getCode())) { |
| | | cokingProcessChildEntity.setStandValue(value.toString()); |
| | | } else if(conf.getExt2().equals(ProcessIndDataTypeEnum.SSSJ.getCode())) { |
| | | cokingProcessChildEntity.setRealValue(value.toString()); |
| | | } |
| | | } |
| | | }); |
| | | cokingProcessChildService.save(cokingProcessChildEntity); |
| | | }); |
| | | |
| | | } catch (Exception ex) { |
| | | logger.error("RunCokingChildDayTask运行异常"); |
| | |
| | | |
| | | 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.CokingTraceChartEntity; |
| | | 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.CokingTraceChartService; |
| | | import com.iailab.module.ansteel.coking.service.CokingTraceReportService; |
| | | import com.iailab.module.ansteel.coking.entity.*; |
| | | import com.iailab.module.ansteel.coking.service.*; |
| | | 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.ApiIndItemQueryDTO; |
| | | import com.iailab.module.data.api.ind.dto.ApiIndItemValueDTO; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueDTO; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * 备煤工序-概况 |
| | |
| | | private CokingTraceReportService cokingTraceReportService; |
| | | @Resource |
| | | private CokingTraceChartService cokingTraceChartService; |
| | | @Resource |
| | | private CokingTraceSuggestService cokingTraceSuggestService; |
| | | @Resource |
| | | private CokingTraceDataService cokingTraceDataService; |
| | | |
| | | @Override |
| | | public void run(String processTypes) { |
| | |
| | | reportEntity.setReportName(ProcessTypeEnum.getEumByCode(processType).getReportName()); |
| | | reportEntity.setAnalyDate(clock); |
| | | reportEntity.setClock(clock); |
| | | reportEntity.setCreateDate(new Date()); |
| | | cokingTraceReportService.save(reportEntity); |
| | | |
| | | // 整体情况 |
| | |
| | | overviewEntity.setSubProcessType(entry.getKey()); |
| | | overviewEntity.setClock(clock); |
| | | result.add(overviewEntity); |
| | | |
| | | // 清理旧数据 |
| | | cokingOverviewService.deleteByProcessType(processType, clock); |
| | | cokingTraceDataService.deleteByExObj(processType, clock); |
| | | } |
| | | cokingOverviewService.insert(result); |
| | | |
| | | // 指标运行趋势 |
| | | List<CokingProcessConfEntity> indRunTrend = list.stream().filter(e -> e.getInfoType().equals("1")).collect(Collectors.toList()); |
| | | List<CokingTraceChartEntity> cokingTraceChartEntityList = new ArrayList<>(indRunTrend.size()); |
| | | // List<CokingTraceSuggestEntity> suggestEntitieList = new ArrayList<>(); |
| | | List<CokingTraceDataEntity> exDatalist = new ArrayList<>(indRunTrend.size()); |
| | | indRunTrend.forEach(e -> { |
| | | CokingTraceChartEntity cokingTraceChartEntity = new CokingTraceChartEntity(); |
| | | cokingTraceChartEntity.setRelId(relId); |
| | |
| | | cokingTraceChartEntity.setStartTime(clone.getTime()); |
| | | cokingTraceChartEntity.setCreateDate(new Date()); |
| | | cokingTraceChartEntityList.add(cokingTraceChartEntity); |
| | | |
| | | // 异常数据处理 |
| | | exDatalist.addAll(handleAbnormalData(e, cokingTraceChartEntity.getStartTime(), cokingTraceChartEntity.getEndTime(),relId,clock)); |
| | | }); |
| | | cokingTraceChartService.insert(cokingTraceChartEntityList); |
| | | // cokingTraceSuggestService.insert(suggestEntitieList); |
| | | cokingTraceDataService.insertList(exDatalist); |
| | | |
| | | } |
| | | } catch (Exception ex) { |
| | | logger.error("runCokingOverviewTask运行异常"); |
| | | ex.printStackTrace(); |
| | | logger.error("runCokingOverviewTask运行异常",ex); |
| | | } |
| | | logger.info("runCokingOverviewTask运行完成"); |
| | | |
| | | } |
| | | |
| | | private List<CokingTraceDataEntity> handleAbnormalData(CokingProcessConfEntity e, Date startTime, Date endTime, String relId, String clock) { |
| | | List<CokingTraceDataEntity> suggestEntities = new ArrayList<>(); |
| | | switch (ProcessConfDataTypeEnum.getEumByCode(e.getDataType())) { |
| | | case DATAPOINT: |
| | | ApiPointValueQueryDTO queryDTO = new ApiPointValueQueryDTO(); |
| | | queryDTO.setPointNo(e.getPointNo()); |
| | | queryDTO.setStart(startTime); |
| | | queryDTO.setEnd(endTime); |
| | | List<ApiPointValueDTO> pointValues = dataPointApi.queryPointHistoryValue(queryDTO); |
| | | Map<Date, Double> pointValueMap = pointValues.stream().collect(Collectors.toMap(ApiPointValueDTO::getT, ApiPointValueDTO::getV, (e1, e2) -> e1)); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startTime); |
| | | while (!calendar.getTime().after(endTime)) { |
| | | String content = null; |
| | | if (pointValueMap.containsKey(calendar.getTime())) { |
| | | Double value = pointValueMap.get(calendar.getTime()); |
| | | if (value.equals(0.0)) { |
| | | content = DateUtils.format(calendar.getTime()) + " " + e.getIndName() + "数据异常(数据为0)"; |
| | | }else if (value.compareTo(Double.valueOf(e.getExt3())) > 0) { |
| | | content = DateUtils.format(calendar.getTime()) + " " + e.getIndName() + "数据异常(超上限)"; |
| | | }else if (value.compareTo(Double.valueOf(e.getExt4())) < 0) { |
| | | content = DateUtils.format(calendar.getTime()) + " " + e.getIndName() + "数据异常(超下限)"; |
| | | } |
| | | }else { |
| | | content = DateUtils.format(calendar.getTime()) + " " + e.getIndName() + "数据异常(无数据)"; |
| | | } |
| | | if (StringUtils.isNotBlank(content)) { |
| | | CokingTraceDataEntity ctd = new CokingTraceDataEntity(); |
| | | ctd.setId(UUID.randomUUID().toString()); |
| | | ctd.setRelId(relId); |
| | | ctd.setProcess(ProcessTypeEnum.getEumByCode(e.getIndType()).getReportName()); |
| | | ctd.setClock(clock); |
| | | ctd.setExObj(e.getIndType()+"_AD"); |
| | | ctd.setExTime(calendar.getTime()); |
| | | ctd.setExType(content); |
| | | suggestEntities.add(ctd); |
| | | } |
| | | calendar.add(Calendar.DAY_OF_YEAR,1); |
| | | } |
| | | break; |
| | | case IND: |
| | | ApiIndItemQueryDTO query = new ApiIndItemQueryDTO(); |
| | | query.setItemNo(e.getPointNo()); |
| | | query.setStart(startTime); |
| | | query.setEnd(endTime); |
| | | List<ApiIndItemValueDTO> indValues = indItemApi.queryIndItemHistoryValue(query); |
| | | Map<String, Double> indValueMap = indValues.stream().collect(Collectors.toMap(ApiIndItemValueDTO::getDataTime, ind -> Double.valueOf(ind.getDataValue().toString()), (e1, e2) -> e1)); |
| | | Calendar intCalendar = Calendar.getInstance(); |
| | | intCalendar.setTime(startTime); |
| | | while (!intCalendar.getTime().after(endTime)) { |
| | | String content = null; |
| | | String time = DateUtils.format(intCalendar.getTime()); |
| | | if (indValueMap.containsKey(time)) { |
| | | Double value = indValueMap.get(time); |
| | | if (value.equals(0.0)) { |
| | | content = time + " " + e.getIndName() + "数据异常(数据为0)"; |
| | | }else if (value.compareTo(Double.valueOf(e.getExt3())) > 0) { |
| | | content = time + " " + e.getIndName() + "数据异常(超上限)"; |
| | | }else if (value.compareTo(Double.valueOf(e.getExt4())) < 0) { |
| | | content = time + " " + e.getIndName() + "数据异常(超下限)"; |
| | | } |
| | | }else { |
| | | content = time + " " + e.getIndName() + "数据异常(无数据)"; |
| | | } |
| | | if (StringUtils.isNotBlank(content)) { |
| | | CokingTraceDataEntity ctd = new CokingTraceDataEntity(); |
| | | ctd.setId(UUID.randomUUID().toString()); |
| | | ctd.setRelId(relId); |
| | | ctd.setProcess(ProcessTypeEnum.getEumByCode(e.getIndType()).getReportName()); |
| | | ctd.setClock(clock); |
| | | ctd.setExObj(e.getIndType()+"_AD"); |
| | | ctd.setExTime(intCalendar.getTime()); |
| | | ctd.setExType(content); |
| | | suggestEntities.add(ctd); |
| | | // suggestEntities.add(new CokingTraceSuggestEntity(UUID.randomUUID().toString(),relId,ProcessTypeEnum.getEumByCode(e.getIndType()).getReportName(),e.getIndType()+"_AD",clock,content,new Date())); |
| | | } |
| | | intCalendar.add(Calendar.DAY_OF_YEAR,1); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | |
| | | } |
| | | return suggestEntities; |
| | | } |
| | | } |
| | |
| | | import com.iailab.module.ansteel.coking.entity.CokingProdDayEntity; |
| | | 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 com.iailab.module.ansteel.common.enums.ProcessConfDataTypeEnum; |
| | | import com.iailab.module.data.api.ind.IndItemApi; |
| | | import com.iailab.module.data.api.ind.dto.ApiIndItemValueDTO; |
| | |
| | | |
| | | @Resource |
| | | private CokingProdDayService cokingProdDayService; |
| | | |
| | | @Resource |
| | | private CokingTraceIndService cokingTraceIndService; |
| | | |
| | | @Resource |
| | | private DataPointApi dataPointApi; |
| | |
| | | break; |
| | | |
| | | } |
| | | saveProdDay(conf, value, clock); |
| | | saveProdDay(conf, value, clock, conf.getIndCode()); |
| | | } |
| | | } catch (Exception ex) { |
| | | logger.error("RunCokingProdDayTask运行异常"); |
| | |
| | | |
| | | } |
| | | |
| | | private void saveProdDay(CokingProcessConfEntity conf, String value, String clock) { |
| | | CokingProdDayEntity cokingProdDayEntity = new CokingProdDayEntity(); |
| | | cokingProdDayEntity.setInfoType(conf.getInfoType()); |
| | | cokingProdDayEntity.setSort(conf.getSort()); |
| | | cokingProdDayEntity.setIndName(conf.getIndName()); |
| | | cokingProdDayEntity.setIndUnit(conf.getIndUnit()); |
| | | cokingProdDayEntity.setIndValue(value); |
| | | cokingProdDayEntity.setClock(clock); |
| | | cokingProdDayService.save(cokingProdDayEntity); |
| | | private void saveProdDay(CokingProcessConfEntity conf, String value, String clock, String indCode) { |
| | | CokingProdDayEntity entity = new CokingProdDayEntity(); |
| | | entity.setInfoType(conf.getInfoType()); |
| | | entity.setSort(conf.getSort()); |
| | | entity.setIndCode(indCode); |
| | | entity.setIndName(conf.getIndName()); |
| | | entity.setIndUnit(conf.getIndUnit()); |
| | | entity.setIndValue(value); |
| | | entity.setClock(clock); |
| | | cokingProdDayService.save(entity); |
| | | } |
| | | } |
| | |
| | | String coalColoum = result.get("coalColoum"+i).toString(); |
| | | if(StringUtils.isNotBlank(coalColoum)){ |
| | | JSONArray responseArr = JSON.parseArray(coalColoum); |
| | | List<CokingTraceDeviationEntity> entityList = new ArrayList<>(); |
| | | for (int j = 0; j < responseArr.size(); j++) { |
| | | JSONArray element = JSON.parseArray(responseArr.get(j).toString()); |
| | | CokingTraceDeviationEntity deviationEntity = new CokingTraceDeviationEntity(); |
| | |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | | deviationEntity.setCreateDate(new Date()); |
| | | cokingTraceDeviationService.save(deviationEntity); |
| | | entityList.add(deviationEntity); |
| | | } |
| | | cokingTraceDeviationService.save(entityList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void saveAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | String[] analyContent = tMap.get("analyContent").toString().split(";"); |
| | | List<CokingAnalyIndEntity> entityList = new ArrayList<>(); |
| | | for(int i=0;i<analyContent.length;i++){ |
| | | CokingAnalyIndEntity analyIndEntity = new CokingAnalyIndEntity(); |
| | | analyIndEntity.setRelId(tMap.get("relId").toString()); |
| | |
| | | analyIndEntity.setAnalyClass(tMap.get("analyClass").toString()); |
| | | analyIndEntity.setAnalyContent(analyContent[i]); |
| | | analyIndEntity.setSort(i+1); |
| | | cokingAnalyIndService.save(analyIndEntity); |
| | | entityList.add(analyIndEntity); |
| | | } |
| | | cokingAnalyIndService.save(entityList); |
| | | } |
| | | |
| | | public void saveTraceInd(Map<String, Object> tMap,JSONObject result) { |
| | |
| | | logger.info("ConfLis is Empty"); |
| | | return; |
| | | } |
| | | List<CokingTraceIndEntity> entityList = new ArrayList<>(); |
| | | for (CokingTraceConfEntity conf : list) { |
| | | if (StringUtils.isBlank(conf.getDataType())) { |
| | | logger.info("DataType is Empty"); |
| | |
| | | cokingTraceIndEntity.setIndName(conf.getIndName()); |
| | | cokingTraceIndEntity.setIndValue(value); |
| | | cokingTraceIndEntity.setIndUnit(conf.getIndUnit()); |
| | | cokingTraceIndService.save(cokingTraceIndEntity); |
| | | entityList.add(cokingTraceIndEntity); |
| | | } |
| | | cokingTraceIndService.save(entityList); |
| | | } |
| | | |
| | | public void saveTraceChart(Map<String, Object> tMap, JSONObject result,Date startDate,Date endDate) { |
| | | List<CokingTraceChartEntity> entityList = new ArrayList<>(); |
| | | historyPointMap.forEach((key,value) ->{ |
| | | CokingTraceChartEntity cokingTraceChartEntity = new CokingTraceChartEntity(); |
| | | cokingTraceChartEntity.setRelId(tMap.get("relId").toString()); |
| | |
| | | cokingTraceChartEntity.setStartTime(startDate); |
| | | cokingTraceChartEntity.setEndTime(endDate); |
| | | cokingTraceChartEntity.setCreateDate(new Date()); |
| | | cokingTraceChartService.save(cokingTraceChartEntity); |
| | | entityList.add(cokingTraceChartEntity); |
| | | }); |
| | | cokingTraceChartService.insert(entityList); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | public void saveTraceSuggest(Map<String, Object> tMap,JSONObject result) { |
| | | List<CokingTraceSuggestEntity> entityList = new ArrayList<>(); |
| | | for(int i=1;i<=2;i++){ |
| | | String steamTotal = result.get("steamTotal"+i).toString(); |
| | | if(StringUtils.isNotBlank(steamTotal)){ |
| | | CokingTraceSuggestEntity suggestEntity = new CokingTraceSuggestEntity(); |
| | | suggestEntity.setRelId(tMap.get("relId").toString()); |
| | | suggestEntity.setProcess(tMap.get("process").toString()); |
| | | suggestEntity.setSugObj("GXJ"); |
| | | suggestEntity.setSugObj(i+"#"); |
| | | suggestEntity.setClock(tMap.get("clock").toString()); |
| | | suggestEntity.setContent(steamTotal); |
| | | suggestEntity.setCreateDate(new Date()); |
| | | cokingTraceSuggestService.save(suggestEntity); |
| | | entityList.add(suggestEntity); |
| | | } |
| | | } |
| | | cokingTraceSuggestService.insert(entityList); |
| | | } |
| | | |
| | | public void saveTraceDeviation(Map<String, Object> tMap,JSONObject result) { |
| | |
| | | String steamFirstColoum = result.get("steamFirstColoum"+i).toString(); |
| | | if(StringUtils.isNotBlank(steamFirstColoum)){ |
| | | JSONArray responseArr = JSON.parseArray(steamFirstColoum); |
| | | List<CokingTraceDeviationEntity> entityList = new ArrayList<>(); |
| | | 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("GXJ"); |
| | | deviationEntity.setSugObj("1#"); |
| | | deviationEntity.setGroupName(steamFirstColoumMap.get("steamFirstColoum"+i).toString()); |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | | deviationEntity.setCreateDate(new Date()); |
| | | cokingTraceDeviationService.save(deviationEntity); |
| | | entityList.add(deviationEntity); |
| | | } |
| | | cokingTraceDeviationService.save(entityList); |
| | | } |
| | | } |
| | | for(int i=0;i<=5;i++){ |
| | | String steamSecondColoum = result.get("steamSecondColoum"+i).toString(); |
| | | if(StringUtils.isNotBlank(steamSecondColoum)){ |
| | | JSONArray responseArr = JSON.parseArray(steamSecondColoum); |
| | | |
| | | List<CokingTraceDeviationEntity> entityList = new ArrayList<>(); |
| | | 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("GXJ"); |
| | | deviationEntity.setSugObj("2#"); |
| | | deviationEntity.setGroupName(steamSecondColoumMap.get("steamSecondColoum" + i).toString()); |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | | deviationEntity.setCreateDate(new Date()); |
| | | cokingTraceDeviationService.save(deviationEntity); |
| | | entityList.add(deviationEntity); |
| | | } |
| | | cokingTraceDeviationService.save(entityList); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public void saveAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | String[] analyContent = tMap.get("analyContent").toString().split(";"); |
| | | List<CokingAnalyIndEntity> entityList = new ArrayList<>(); |
| | | for(int i=0;i<analyContent.length;i++){ |
| | | CokingAnalyIndEntity analyIndEntity = new CokingAnalyIndEntity(); |
| | | analyIndEntity.setRelId(tMap.get("relId").toString()); |
| | |
| | | analyIndEntity.setAnalyClass(tMap.get("analyClass").toString()); |
| | | analyIndEntity.setAnalyContent(analyContent[i]); |
| | | analyIndEntity.setSort(i+1); |
| | | cokingAnalyIndService.save(analyIndEntity); |
| | | entityList.add(analyIndEntity); |
| | | } |
| | | cokingAnalyIndService.save(entityList); |
| | | } |
| | | |
| | | public void saveTraceInd(Map<String, Object> tMap,JSONObject result) { |
| | |
| | | logger.info("ConfLis is Empty"); |
| | | return; |
| | | } |
| | | List<CokingTraceIndEntity> entityList = new ArrayList<>(); |
| | | for (CokingTraceConfEntity conf : list) { |
| | | if (StringUtils.isBlank(conf.getDataType())) { |
| | | logger.info("DataType is Empty"); |
| | |
| | | cokingTraceIndEntity.setIndName(conf.getIndName()); |
| | | cokingTraceIndEntity.setIndValue(value); |
| | | cokingTraceIndEntity.setIndUnit(conf.getIndUnit()); |
| | | cokingTraceIndService.save(cokingTraceIndEntity); |
| | | |
| | | entityList.add(cokingTraceIndEntity); |
| | | } |
| | | cokingTraceIndService.save(entityList); |
| | | } |
| | | } |
| | |
| | | String chemProdFirstColoum = result.get("chemProdFirstColoum"+i).toString(); |
| | | if(StringUtils.isNotBlank(chemProdFirstColoum)){ |
| | | JSONArray responseArr = JSON.parseArray(chemProdFirstColoum); |
| | | List<CokingTraceDeviationEntity> cokingTraceDeviationEntities = new ArrayList<>(); |
| | | for (int j = 0; j < responseArr.size(); j++) { |
| | | JSONArray element = JSON.parseArray(responseArr.get(j).toString()); |
| | | CokingTraceDeviationEntity deviationEntity = new CokingTraceDeviationEntity(); |
| | |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | | deviationEntity.setCreateDate(new Date()); |
| | | cokingTraceDeviationService.save(deviationEntity); |
| | | cokingTraceDeviationEntities.add(deviationEntity); |
| | | } |
| | | cokingTraceDeviationService.save(cokingTraceDeviationEntities); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void saveAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | String[] analyContent = tMap.get("analyContent").toString().split(";"); |
| | | List<CokingAnalyIndEntity> list = new ArrayList<>(); |
| | | for(int i=0;i<analyContent.length;i++){ |
| | | CokingAnalyIndEntity analyIndEntity = new CokingAnalyIndEntity(); |
| | | analyIndEntity.setRelId(tMap.get("relId").toString()); |
| | |
| | | analyIndEntity.setAnalyClass(tMap.get("analyClass").toString()); |
| | | analyIndEntity.setAnalyContent(analyContent[i]); |
| | | analyIndEntity.setSort(i+1); |
| | | cokingAnalyIndService.save(analyIndEntity); |
| | | list.add(analyIndEntity); |
| | | } |
| | | cokingAnalyIndService.save(list); |
| | | } |
| | | |
| | | public void saveTraceInd(Map<String, Object> tMap,JSONObject result) { |
| | |
| | | logger.info("ConfLis is Empty"); |
| | | return; |
| | | } |
| | | List<CokingTraceIndEntity> cokingTraceIndEntities = new ArrayList<>(); |
| | | for (CokingTraceConfEntity conf : list) { |
| | | if (StringUtils.isBlank(conf.getDataType())) { |
| | | logger.info("DataType is Empty"); |
| | |
| | | cokingTraceIndEntity.setIndName(conf.getIndName()); |
| | | cokingTraceIndEntity.setIndValue(value); |
| | | cokingTraceIndEntity.setIndUnit(conf.getIndUnit()); |
| | | cokingTraceIndService.save(cokingTraceIndEntity); |
| | | cokingTraceIndEntities.add(cokingTraceIndEntity); |
| | | } |
| | | cokingTraceIndService.save(cokingTraceIndEntities); |
| | | } |
| | | |
| | | public void saveTraceChart(Map<String, Object> tMap, JSONObject result,Date startDate,Date endDate) { |
| | |
| | | String cokeColoum = result.get("cokeColoum"+i).toString(); |
| | | if(StringUtils.isNotBlank(cokeColoum)){ |
| | | JSONArray responseArr = JSON.parseArray(cokeColoum); |
| | | List<CokingTraceDeviationEntity> entityList = new ArrayList<>(); |
| | | for (int j = 0; j < responseArr.size(); j++) { |
| | | JSONArray element = JSON.parseArray(responseArr.get(j).toString()); |
| | | CokingTraceDeviationEntity deviationEntity = new CokingTraceDeviationEntity(); |
| | |
| | | deviationEntity.setIndName(steamIndexMaps.get(element.get(0).toString())); |
| | | deviationEntity.setIndValue(element.get(1).toString()); |
| | | deviationEntity.setCreateDate(new Date()); |
| | | cokingTraceDeviationService.save(deviationEntity); |
| | | entityList.add(deviationEntity); |
| | | } |
| | | cokingTraceDeviationService.save(entityList); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void saveAnalyInd(Map<String, Object> tMap,JSONObject result) { |
| | | String[] analyContent = tMap.get("analyContent").toString().split(";"); |
| | | List<CokingAnalyIndEntity> entityList = new ArrayList<>(); |
| | | for(int i=0;i<analyContent.length;i++){ |
| | | CokingAnalyIndEntity analyIndEntity = new CokingAnalyIndEntity(); |
| | | analyIndEntity.setRelId(tMap.get("relId").toString()); |
| | |
| | | analyIndEntity.setAnalyClass(tMap.get("analyClass").toString()); |
| | | analyIndEntity.setAnalyContent(analyContent[i]); |
| | | analyIndEntity.setSort(i+1); |
| | | cokingAnalyIndService.save(analyIndEntity); |
| | | entityList.add(analyIndEntity); |
| | | } |
| | | cokingAnalyIndService.save(entityList); |
| | | } |
| | | |
| | | public void saveTraceInd(Map<String, Object> tMap,JSONObject result) { |
| | |
| | | logger.info("ConfLis is Empty"); |
| | | return; |
| | | } |
| | | List<CokingTraceIndEntity> entityList = new ArrayList<>(); |
| | | for (CokingTraceConfEntity conf : list) { |
| | | if (StringUtils.isBlank(conf.getDataType())) { |
| | | logger.info("DataType is Empty"); |
| | |
| | | cokingTraceIndEntity.setIndName(conf.getIndName()); |
| | | cokingTraceIndEntity.setIndValue(value); |
| | | cokingTraceIndEntity.setIndUnit(conf.getIndUnit()); |
| | | cokingTraceIndService.save(cokingTraceIndEntity); |
| | | entityList.add(cokingTraceIndEntity); |
| | | } |
| | | cokingTraceIndService.save(entityList); |
| | | } |
| | | |
| | | public void saveTraceChart(Map<String, Object> tMap, JSONObject result,Date startDate,Date endDate) { |
| | | List<CokingTraceChartEntity> entityList = new ArrayList<>(); |
| | | historyPointMap.forEach((key,value) ->{ |
| | | CokingTraceChartEntity cokingTraceChartEntity = new CokingTraceChartEntity(); |
| | | cokingTraceChartEntity.setRelId(tMap.get("relId").toString()); |
| | |
| | | cokingTraceChartEntity.setStartTime(startDate); |
| | | cokingTraceChartEntity.setEndTime(endDate); |
| | | cokingTraceChartEntity.setCreateDate(new Date()); |
| | | cokingTraceChartService.save(cokingTraceChartEntity); |
| | | entityList.add(cokingTraceChartEntity); |
| | | }); |
| | | cokingTraceChartService.insert(entityList); |
| | | } |
| | | } |
| | |
| | | public interface PowerDemandService { |
| | | |
| | | List<PowerDemandEntity> list(Map<String, Object> params); |
| | | |
| | | PowerDemandEntity getByCode(String code); |
| | | } |
| | |
| | | import com.iailab.module.ansteel.power.entity.PowerDemandEntity; |
| | | import com.iailab.module.ansteel.power.service.PowerDemandService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | @Override |
| | | public List<PowerDemandEntity> list(Map<String, Object> params) { |
| | | QueryWrapper<PowerDemandEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("code", params.get("code")); |
| | | queryWrapper.orderByAsc("sort"); |
| | | return PowerDemandDao.selectList(queryWrapper); |
| | | |
| | | } |
| | | |
| | | public PowerDemandEntity getByCode(String code) { |
| | | QueryWrapper<PowerDemandEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("code", code); |
| | | return PowerDemandDao.selectOne(queryWrapper); |
| | | |
| | | } |
| | | } |