| | |
| | | ALTER TABLE `t_power_net_factor` |
| | | ADD COLUMN `node_code` varchar(50) NULL DEFAULT NULL COMMENT '节点编号'; |
| | | |
| | | ALTER TABLE `t_power_net_factor` |
| | | ADD COLUMN `p_limit_l` decimal(9, 3) NULL DEFAULT NULL COMMENT '有功下限'; |
| | | ALTER TABLE `t_power_net_factor` |
| | | ADD COLUMN `p_limit_h` decimal(9, 3) NULL DEFAULT NULL COMMENT '有功上限'; |
| | | ALTER TABLE `t_power_net_factor` |
| | | ADD COLUMN `q_limit_l` varchar(50) NULL DEFAULT NULL COMMENT '无功下限'; |
| | | ALTER TABLE `t_power_net_factor` |
| | | ADD COLUMN `q_limit_h` varchar(50) NULL DEFAULT NULL COMMENT '无功上限'; |
| | | |
| | | -- ---------------------------- |
| | | -- 电力功率因数-发电机组实时状态 |
| | | -- ---------------------------- |
| | |
| | | UNIQUE key uk_code (code) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='调整后的功率因数与无功倒送量'; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 功率因数-母线电压状态 |
| | | -- ---------------------------- |
| | | CREATE TABLE `t_power_voltage_status` |
| | | ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `code` varchar(50), |
| | | `name` varchar(50) DEFAULT NULL COMMENT '机组名称', |
| | | `point` varchar(50) DEFAULT NULL COMMENT '测点', |
| | | `limit_h` decimal(8, 2) DEFAULT NULL COMMENT '阈值', |
| | | `sort` int NULL DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='功率因数-母线电压状态'; |
| | | |
| | | CREATE TABLE `t_coking_overview_ind` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id', |
| | |
| | | -- ---------------------------- |
| | | CREATE TABLE `t_power_net_dropdown` |
| | | ( |
| | | `id` varchar(36) NOT NULL, |
| | | `p_code` varchar(50) DEFAULT NULL COMMENT '父编码', |
| | | `id` varchar(36) NOT NULL, |
| | | `p_code` varchar(50) DEFAULT NULL COMMENT '父编码', |
| | | `group_name` varchar(50) NULL DEFAULT NULL COMMENT '分组名称', |
| | | `node_code` varchar(50) DEFAULT NULL COMMENT '编码', |
| | | `node_name` varchar(50) DEFAULT NULL COMMENT '名称', |
| | | `cur_p` varchar(50) NULL DEFAULT NULL COMMENT '当前有功', |
| | | `cur_q` varchar(50) NULL DEFAULT NULL COMMENT '当前无功', |
| | | `cur_cos` varchar(50) NULL DEFAULT NULL COMMENT '当前功率因数', |
| | | `ext1` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段1', |
| | | `ext2` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段2', |
| | | `ext3` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段3', |
| | | `ext4` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段4', |
| | | `ext5` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段5', |
| | | `sort` int DEFAULT NULL COMMENT '排序', |
| | | `node_code` varchar(50) DEFAULT NULL COMMENT '编码', |
| | | `node_name` varchar(50) DEFAULT NULL COMMENT '名称', |
| | | `cur_p` varchar(50) NULL DEFAULT NULL COMMENT '当前有功', |
| | | `cur_q` varchar(50) NULL DEFAULT NULL COMMENT '当前无功', |
| | | `cur_cos` varchar(50) NULL DEFAULT NULL COMMENT '当前功率因数', |
| | | `ext1` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段1', |
| | | `ext2` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段2', |
| | | `ext3` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段3', |
| | | `ext4` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段4', |
| | | `ext5` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段5', |
| | | `sort` int DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`), |
| | | key uk_p_code (p_code), |
| | | key uk_p_code (p_code), |
| | | UNIQUE key uk_node_code (node_code) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='电力下拉关系表'; |
| | |
| | | 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.TraceProcessTypeEnum; |
| | | 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; |
| | |
| | | @GetMapping("/trace-suggest/list") |
| | | @Operation(summary = "焦化工序-异常溯源及优化建议") |
| | | public CommonResult<List<CokingTraceSuggestDTO>> getTraceSuggestList(@RequestParam Map<String, Object> params) { |
| | | String relId = (String) params.get("relId"); |
| | | String processType = (String) params.get("processType"); |
| | | if (StringUtils.isBlank(relId) && StringUtils.isNotBlank(processType)) { |
| | | // 查找最新的relId |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | String clock = DateUtils.format(calendar.getTime(), "yyyy-MM-dd"); |
| | | CokingAnalyIndEntity analyInd = cokingAnalyIndService.get(TraceProcessTypeEnum.getEumByCode(processType).getProcess(), clock); |
| | | if (analyInd != null) { |
| | | relId = analyInd.getRelId(); |
| | | params.put("relId", relId); |
| | | } else { |
| | | return success(new ArrayList<>()); |
| | | } |
| | | } |
| | | List<CokingTraceSuggestEntity> list = cokingTraceSuggestService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingTraceSuggestDTO.class)); |
| | | } |
| | |
| | | @GetMapping("/trace-ind/list") |
| | | @Operation(summary = "焦化工序-异常溯源指标") |
| | | public CommonResult<List<CokingTraceIndDTO>> getTraceIndList(@RequestParam Map<String, Object> params) { |
| | | String relId = (String) params.get("relId"); |
| | | String processType = (String) params.get("processType"); |
| | | if (StringUtils.isBlank(relId) && StringUtils.isNotBlank(processType)) { |
| | | // 查找最新的relId |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | String clock = DateUtils.format(calendar.getTime(), "yyyy-MM-dd"); |
| | | CokingAnalyIndEntity analyInd = cokingAnalyIndService.get(TraceProcessTypeEnum.getEumByCode(processType).getProcess(), clock); |
| | | if (analyInd != null) { |
| | | relId = analyInd.getRelId(); |
| | | params.put("relId", relId); |
| | | } else { |
| | | return success(new ArrayList<>()); |
| | | } |
| | | } |
| | | List<CokingTraceIndEntity> list = cokingTraceIndService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingTraceIndDTO.class)); |
| | | } |
| | |
| | | @GetMapping("/trace-deviation/list") |
| | | @Operation(summary = "焦化工序-异常溯源影响因素偏差值") |
| | | public CommonResult<List<CokingTraceDeviationDTO>> getTraceDeviationList(@RequestParam Map<String, Object> params) { |
| | | String relId = (String) params.get("relId"); |
| | | String processType = (String) params.get("processType"); |
| | | if (StringUtils.isBlank(relId) && StringUtils.isNotBlank(processType)) { |
| | | // 查找最新的relId |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | String clock = DateUtils.format(calendar.getTime(), "yyyy-MM-dd"); |
| | | CokingAnalyIndEntity analyInd = cokingAnalyIndService.get(TraceProcessTypeEnum.getEumByCode(processType).getProcess(), clock); |
| | | if (analyInd != null) { |
| | | relId = analyInd.getRelId(); |
| | | params.put("relId", relId); |
| | | } else { |
| | | return success(new ArrayList<>()); |
| | | } |
| | | } |
| | | List<CokingTraceDeviationEntity> list = cokingTraceDeviationService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, CokingTraceDeviationDTO.class)); |
| | | } |
| | |
| | | package com.iailab.module.ansteel.api.controller.admin; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.api.dto.*; |
| | | import com.iailab.module.ansteel.api.service.DataService; |
| | | import com.iailab.module.ansteel.coking.dto.CokingTraceChartDTO; |
| | | import com.iailab.module.ansteel.coking.dto.CokingTraceDataDTO; |
| | | import com.iailab.module.ansteel.common.enums.ProcessConfDataTypeEnum; |
| | | 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.dto.ApiPointValueDTO; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO; |
| | | import com.iailab.module.model.api.mcs.dto.PreDataSingleChartReqVO; |
| | | import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestReqVO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | |
| | | return success(dataService.ignoreSuggest(ReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/data/history-value") |
| | | @Operation(summary = "指标/测点历史数据") |
| | | public CommonResult<List<Object[]>> getHistoryValue(@RequestParam Map<String, Object> params) { |
| | | return success(dataService.getHistoryValue(params)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | private PowerNetDropdownService powerNetDropdownService; |
| | | |
| | | @Autowired |
| | | private PowerVoltageStatusService powerVoltageStatusService; |
| | | |
| | | @GetMapping("/net-factor/list") |
| | | @Operation(summary = "功率因数-电网拓扑") |
| | | public CommonResult<List<PowerNetFactorDTO>> getPowerNetFactorList(@RequestParam Map<String, Object> params) { |
| | | List<PowerNetFactorEntity> list = powerNetFactorService.list(params); |
| | | List<PowerNetFactorDTO> result = ConvertUtils.sourceToTarget(list, PowerNetFactorDTO.class); |
| | | List<PowerNetFactorDTO> result = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(result)) { |
| | | return success(result); |
| | | } |
| | |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | |
| | | for (PowerNetFactorDTO dto : result) { |
| | | for (PowerNetFactorEntity entity : list) { |
| | | PowerNetFactorDTO powerNetFactorDTO = new PowerNetFactorDTO(); |
| | | powerNetFactorDTO.setId(entity.getId()); |
| | | powerNetFactorDTO.setGroupName(entity.getGroupName()); |
| | | powerNetFactorDTO.setNodeCode(entity.getNodeCode()); |
| | | powerNetFactorDTO.setNodeName(entity.getNodeName()); |
| | | boolean cosFlag = false; |
| | | try { |
| | | List<String> points = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getCurP())) { |
| | | points.add(dto.getCurP()); |
| | | if (StringUtils.isNotBlank(entity.getCurP())) { |
| | | points.add(entity.getCurP()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCurQ())) { |
| | | points.add(dto.getCurQ()); |
| | | if (StringUtils.isNotBlank(entity.getCurQ())) { |
| | | points.add(entity.getCurQ()); |
| | | } |
| | | if (!CollectionUtils.isEmpty(points)) { |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | if (pointsRealValue.get(dto.getCurP()) != null) { |
| | | dto.setCurP(pointsRealValue.get(dto.getCurP()).toString()); |
| | | if (pointsRealValue.get(entity.getCurP()) != null) { |
| | | powerNetFactorDTO.setCurP(new BigDecimal(pointsRealValue.get(entity.getCurP()).toString())); |
| | | } |
| | | if (pointsRealValue.get(dto.getCurQ()) != null) { |
| | | dto.setCurQ(pointsRealValue.get(dto.getCurQ()).toString()); |
| | | if (pointsRealValue.get(entity.getCurQ()) != null) { |
| | | powerNetFactorDTO.setCurQ(new BigDecimal(pointsRealValue.get(entity.getCurQ()).toString())); |
| | | } |
| | | if (pointsRealValue.get(dto.getCurCos()) != null) { |
| | | dto.setCurCos(pointsRealValue.get(dto.getCurCos()).toString()); |
| | | if (pointsRealValue.get(entity.getCurCos()) != null) { |
| | | powerNetFactorDTO.setCurCos(new BigDecimal(pointsRealValue.get(entity.getCurCos()).toString())); |
| | | cosFlag = true; |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.info(dto.getNodeName() + "获取当前值异常" + ex.getMessage()); |
| | | log.info(entity.getNodeName() + "获取当前值异常" + ex.getMessage()); |
| | | } |
| | | |
| | | try { |
| | | PredictLastValueReqVO reqVO = new PredictLastValueReqVO(); |
| | | reqVO.setPredictTime(calendar.getTime()); |
| | | List<String[]> itemNos = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getPreP())) { |
| | | itemNos.add(dto.getPreP().split(",")); |
| | | if (StringUtils.isNotBlank(entity.getPreP())) { |
| | | itemNos.add(entity.getPreP().split(",")); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreQ())) { |
| | | itemNos.add(dto.getPreQ().split(",")); |
| | | if (StringUtils.isNotBlank(entity.getPreQ())) { |
| | | itemNos.add(entity.getPreQ().split(",")); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreCos())) { |
| | | itemNos.add(dto.getPreCos().split(",")); |
| | | if (StringUtils.isNotBlank(entity.getPreCos())) { |
| | | itemNos.add(entity.getPreCos().split(",")); |
| | | } |
| | | if (!CollectionUtils.isEmpty(itemNos)) { |
| | | reqVO.setItemNos(itemNos); |
| | | log.info("reqVO=" + JSONObject.toJSONString(reqVO)); |
| | | Map<String, BigDecimal> preValues = mcsApi.getPredictValueByTime(reqVO); |
| | | if (StringUtils.isNotBlank(dto.getPreP()) && preValues.get(dto.getPreP()) != null) { |
| | | dto.setPreP(preValues.get(dto.getPreP()).toString()); |
| | | if (StringUtils.isNotBlank(entity.getPreP()) && preValues.get(entity.getPreP()) != null) { |
| | | powerNetFactorDTO.setPreP(new BigDecimal(preValues.get(entity.getPreP()).toString())); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreQ()) && preValues.get(dto.getPreQ()) != null) { |
| | | dto.setPreQ(preValues.get(dto.getPreQ()).toString()); |
| | | if (StringUtils.isNotBlank(entity.getPreQ()) && preValues.get(entity.getPreQ()) != null) { |
| | | powerNetFactorDTO.setPreQ(new BigDecimal(preValues.get(entity.getPreQ()).toString())); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreCos()) && preValues.get(dto.getPreCos()) != null) { |
| | | dto.setPreCos(preValues.get(dto.getPreCos()).toString()); |
| | | if (StringUtils.isNotBlank(entity.getPreCos()) && preValues.get(entity.getPreCos()) != null) { |
| | | powerNetFactorDTO.setPreCos(new BigDecimal(preValues.get(entity.getPreCos()).toString())); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.info(dto.getNodeName() + "获取预测值异常," + ex.getMessage()); |
| | | log.info(entity.getNodeName() + "获取预测值异常," + ex.getMessage()); |
| | | } |
| | | |
| | | // 设置状态 |
| | | if (cosFlag && StringUtils.isNotBlank(dto.getCurCos()) && NumberUtil.isNumber(dto.getCurCos())) { |
| | | BigDecimal curCos = new BigDecimal(dto.getCurCos()); |
| | | if (dto.getLimitL() != null && dto.getLimitH() != null && |
| | | curCos.compareTo(dto.getLimitL()) < 0 || curCos.compareTo(dto.getLimitH()) > 0) { |
| | | dto.setStatus(1); |
| | | // 设置功率因数状态 |
| | | if (cosFlag && powerNetFactorDTO.getCurCos() != null) { |
| | | BigDecimal curCos = powerNetFactorDTO.getCurCos(); |
| | | if (entity.getLimitL() != null && curCos.compareTo(entity.getLimitL()) < 0) { |
| | | powerNetFactorDTO.setStatus(1); |
| | | } else if (entity.getLimitH() != null && curCos.compareTo(entity.getLimitH()) > 0) { |
| | | powerNetFactorDTO.setStatus(1); |
| | | } else { |
| | | dto.setStatus(0); |
| | | powerNetFactorDTO.setStatus(0); |
| | | } |
| | | } |
| | | |
| | | // 设置有功预警状态 |
| | | if (powerNetFactorDTO.getCurP() != null) { |
| | | BigDecimal curP = powerNetFactorDTO.getCurP(); |
| | | if (entity.getPLimitH() != null && curP.compareTo(entity.getPLimitL()) < 0) { |
| | | powerNetFactorDTO.setStatus(1); |
| | | } else if (entity.getPLimitH() != null && curP.compareTo(entity.getPLimitH()) > 0) { |
| | | powerNetFactorDTO.setStatus(1); |
| | | } else { |
| | | powerNetFactorDTO.setStatus(0); |
| | | } |
| | | } |
| | | |
| | | // 设置无功预警状态 |
| | | if (powerNetFactorDTO.getCurQ() != null) { |
| | | BigDecimal curQ = powerNetFactorDTO.getCurQ(); |
| | | if (entity.getQLimitH() != null && curQ.compareTo(entity.getQLimitL()) < 0) { |
| | | powerNetFactorDTO.setStatus(1); |
| | | } else if (entity.getQLimitH() != null && curQ.compareTo(entity.getQLimitH()) > 0) { |
| | | powerNetFactorDTO.setStatus(1); |
| | | } else { |
| | | powerNetFactorDTO.setStatus(0); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (CollectionUtils.isEmpty(dtoList)) { |
| | | return success(result); |
| | | } |
| | | for (PowerNetFactorDTO dto : dtoList) { |
| | | for (PowerNetFactorEntity entity : list) { |
| | | List<String> points = new ArrayList<>(); |
| | | String message = ""; |
| | | if (StringUtils.isNotBlank(dto.getCurQ())) { |
| | | points.add(dto.getCurQ()); |
| | | if (StringUtils.isNotBlank(entity.getCurQ())) { |
| | | points.add(entity.getCurQ()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCurCos())) { |
| | | points.add(dto.getCurCos()); |
| | | if (StringUtils.isNotBlank(entity.getCurCos())) { |
| | | points.add(entity.getCurCos()); |
| | | } |
| | | if (CollectionUtils.isEmpty(points)) { |
| | | continue; |
| | | } |
| | | |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | if (pointsRealValue.get(dto.getCurQ()) != null) { |
| | | BigDecimal curQ = new BigDecimal(pointsRealValue.get(dto.getCurQ()).toString()); |
| | | if (curQ.compareTo(BigDecimal.ZERO) == dto.getCurFlag()) { |
| | | message = dto.getNodeName() + "发生无功返送;"; |
| | | if (pointsRealValue.get(entity.getCurQ()) != null) { |
| | | BigDecimal curQ = new BigDecimal(pointsRealValue.get(entity.getCurQ()).toString()); |
| | | if (curQ.compareTo(BigDecimal.ZERO) == entity.getCurFlag()) { |
| | | message = entity.getNodeName() + "发生无功返送;"; |
| | | } |
| | | } |
| | | if (pointsRealValue.get(dto.getCurCos()) != null) { |
| | | BigDecimal curCos = new BigDecimal(pointsRealValue.get(dto.getCurCos()).toString()); |
| | | if (curCos.compareTo(dto.getLimitH()) > 0) { |
| | | message += dto.getNodeName() + "功率因数超上限"; |
| | | } else if (curCos.compareTo(dto.getLimitL()) < 0) { |
| | | message += dto.getNodeName() + "功率因数超下限"; |
| | | if (pointsRealValue.get(entity.getCurCos()) != null) { |
| | | BigDecimal curCos = new BigDecimal(pointsRealValue.get(entity.getCurCos()).toString()); |
| | | if (entity.getLimitH() != null && curCos.compareTo(entity.getLimitH()) > 0) { |
| | | message += entity.getNodeName() + "功率因数超上限"; |
| | | } else if (entity.getLimitL() != null && curCos.compareTo(entity.getLimitL()) < 0) { |
| | | message += entity.getNodeName() + "功率因数超下限"; |
| | | } |
| | | } |
| | | if (!message.isEmpty()) { |
| | |
| | | } |
| | | |
| | | @PostMapping("/demand/history") |
| | | @Operation(summary = "负荷移植-实测需量,有功功率 历史") |
| | | @Operation(summary = "负荷移植-实测需量有功功率历史") |
| | | public CommonResult<PowerHistoryDTO> getPowerDemandHistory(@RequestBody PowerDemandHisReqDTO dto) { |
| | | log.info("请求参数: {}", JSONObject.toJSONString(dto)); |
| | | |
| | |
| | | return success(result); |
| | | } |
| | | |
| | | @PostMapping("/demand/history-list") |
| | | @Operation(summary = "负荷移植-实测需量有功功率历史(多code)") |
| | | public CommonResult<LinkedHashMap<String, List<Object[]>>> getPowerDemandHistoryList(@RequestBody PowerDemandHisReqDTO dto) { |
| | | log.info("请求参数: {}", JSONObject.toJSONString(dto)); |
| | | LinkedHashMap<String, List<Object[]>> result = new LinkedHashMap<>(); |
| | | |
| | | // 参数校验 |
| | | if (CollectionUtils.isEmpty(dto.getCodeList())) { |
| | | return CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST, "codeList不能为空"); |
| | | } |
| | | if (StringUtils.isBlank(dto.getQueryType())) { |
| | | return CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST, "queryType不能为空"); |
| | | } |
| | | Calendar cal = Calendar.getInstance(); |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | cal.set(Calendar.SECOND, 0); |
| | | Date endTime = dto.getEndTime() == null ? cal.getTime() : dto.getEndTime(); |
| | | Date startTime = dto.getStartTime(); |
| | | if (dto.getStartTime() == null) { |
| | | cal.add(Calendar.DAY_OF_YEAR, -1); |
| | | startTime = cal.getTime(); |
| | | } |
| | | |
| | | for (String code : dto.getCodeList()) { |
| | | PowerDemandEntity powerDemand = powerDemandService.getByCode(code); |
| | | if (powerDemand == null) { |
| | | log.info("未找到code对应的数据: {}", dto.getCode()); |
| | | return success(new LinkedHashMap<>()); |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | |
| | | // 查询历史数据 |
| | | ApiPointValueQueryDTO query = new ApiPointValueQueryDTO(); |
| | | query.setPointNo(pointNo); |
| | | query.setStart(startTime); |
| | | query.setEnd(endTime); |
| | | log.info("开始查询实测需量有功功率历史数据,测点: {}", pointNo); |
| | | List<ApiPointValueDTO> chartData = dataPointApi.queryPointHistoryValue(query); |
| | | List<Object[]> dataList = chartData.stream() |
| | | .map(pv -> new Object[]{ |
| | | DateUtils.format(pv.getT(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND), |
| | | pv.getV() |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | |
| | | result.put(code, dataList); |
| | | } |
| | | |
| | | return success(result); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/voltage/status-list") |
| | | @Operation(summary = "功率因数-母线电压状态") |
| | | public CommonResult<List<PowerVoltageStatusDTO>> getPowerVoltageStatusList(@RequestParam Map<String, Object> params) { |
| | | List<PowerVoltageStatusDTO> result = new ArrayList<>(); |
| | | List<PowerVoltageStatusEntity> list = powerVoltageStatusService.list(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return success(result); |
| | | } |
| | | |
| | | List<String> points = new ArrayList<>(); |
| | | for (PowerVoltageStatusEntity entity : list) { |
| | | if (StringUtils.isBlank(entity.getPoint())) { |
| | | continue; |
| | | } |
| | | points.add(entity.getPoint()); |
| | | } |
| | | Map<String, Object> pointsRealValue = new HashMap<>(); |
| | | if (!CollectionUtils.isEmpty(points)) { |
| | | pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | } |
| | | for (PowerVoltageStatusEntity entity : list) { |
| | | PowerVoltageStatusDTO dto = ConvertUtils.sourceToTarget(entity, PowerVoltageStatusDTO.class); |
| | | dto.setStatus(0); |
| | | BigDecimal value = new BigDecimal(pointsRealValue.get(entity.getPoint()).toString()); |
| | | if (value.compareTo(entity.getLimitH()) > 0) { |
| | | dto.setStatus(1); |
| | | } |
| | | dto.setVoltage(value); |
| | | result.add(dto); |
| | | } |
| | | return success(result); |
| | | } |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author dyk |
| | |
| | | |
| | | private String code; |
| | | |
| | | private List<String> codeList; |
| | | |
| | | private String queryType; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | |
| | | private String nodeName; |
| | | |
| | | @Schema(description = "当前有功") |
| | | private String curP; |
| | | private BigDecimal curP; |
| | | |
| | | @Schema(description = "当前无功") |
| | | private String curQ; |
| | | private BigDecimal curQ; |
| | | |
| | | @Schema(description = "当前功率因数") |
| | | private String curCos; |
| | | private BigDecimal curCos; |
| | | |
| | | @Schema(description = "无功返送(1:大于0是,-1:小于0是)") |
| | | private Integer curFlag; |
| | | |
| | | @Schema(description = "预测有功") |
| | | private String preP; |
| | | private BigDecimal preP; |
| | | |
| | | @Schema(description = "预测无功") |
| | | private String preQ; |
| | | private BigDecimal preQ; |
| | | |
| | | @Schema(description = "预测功率因数") |
| | | private String preCos; |
| | | private BigDecimal preCos; |
| | | |
| | | @Schema(description = "上限") |
| | | private BigDecimal limitH; |
| | |
| | | @Schema(description = "下限") |
| | | private BigDecimal limitL; |
| | | |
| | | @Schema(description = "是否超限(0:正常,1:超限)") |
| | | @Schema(description = "功率因数是否超限(0:正常,1:超限)") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "排序") |
| | | private Integer sort; |
| | | |
| | | @Schema(description = "有功是否超限(0:正常,1:超限)") |
| | | private Integer pStatus; |
| | | |
| | | @Schema(description = "无功是否超限(0:正常,1:超限)") |
| | | private Integer qStatus; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.api.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年05月06日 |
| | | */ |
| | | @Data |
| | | public class PowerVoltageStatusDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "编码") |
| | | private String code; |
| | | |
| | | @Schema(description = "名称") |
| | | private String name; |
| | | |
| | | @Schema(description = "电压值") |
| | | private BigDecimal voltage; |
| | | |
| | | @Schema(description = "电压状态:0无电压,1有电压") |
| | | private Integer status; |
| | | } |
| | |
| | | List<PowerControlMainDTO> getPowerControlMainList(); |
| | | |
| | | List<PowerControlDetDTO> getPowerControlDetList(Map<String, Object> params); |
| | | |
| | | List<Object[]> getHistoryValue(Map<String, Object> params); |
| | | } |
| | |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.ansteel.api.dao.*; |
| | | import com.iailab.module.ansteel.api.dto.*; |
| | | import com.iailab.module.ansteel.common.enums.ProcessConfDataTypeEnum; |
| | | import com.iailab.module.ansteel.power.dao.*; |
| | | import com.iailab.module.ansteel.power.entity.PowerCapacitorStatusEntity; |
| | | import com.iailab.module.ansteel.power.entity.PowerControlDetEntity; |
| | |
| | | import com.iailab.module.ansteel.power.entity.PowerNetFactorEntity; |
| | | import com.iailab.module.ansteel.api.service.DataService; |
| | | import com.iailab.module.ansteel.common.constant.CommonConstant; |
| | | 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.plan.PlanItemApi; |
| | | import com.iailab.module.data.api.plan.dto.ApiPlanDataDTO; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class DataServiceImpl implements DataService { |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | @Autowired |
| | | private IndItemApi indItemApi; |
| | | |
| | | @Autowired |
| | | private McsApi mcsApi; |
| | |
| | | @Override |
| | | public List<MainProcessIndexDTO> getIndexList(Map<String, Object> params) { |
| | | List<MainProcessIndexDTO> list = new ArrayList<>(); |
| | | if("day".equals(params.get("type"))) { |
| | | if ("day".equals(params.get("type"))) { |
| | | list = ConvertUtils.sourceToTarget(mainProcessIndexDayDao.selectList(new QueryWrapper<>()), MainProcessIndexDTO.class); |
| | | }else if("team".equals(params.get("type"))){ |
| | | } else if ("team".equals(params.get("type"))) { |
| | | list = ConvertUtils.sourceToTarget(mainProcessIndexTeamDao.selectList(new QueryWrapper<>()), MainProcessIndexDTO.class); |
| | | } |
| | | if (!CollectionUtils.isEmpty(list)) { |
| | |
| | | PreDataSingleChartRespVO resultOld = mcsApi.getPreDataSingleChart(reqVO); |
| | | PreDataChartRespVO result = ConvertUtils.sourceToTarget(resultOld, PreDataChartRespVO.class); |
| | | PreDataViewDTO preDataView = ConvertUtils.sourceToTarget(resultOld.getDataView(), PreDataViewDTO.class); |
| | | if(trendsDataH != null) { |
| | | if (StringUtils.isNotBlank(trendsDataH)) { |
| | | // 动态上限 |
| | | ApiPointValueQueryDTO pointValueQueryDTO = new ApiPointValueQueryDTO(); |
| | | pointValueQueryDTO.setPointNo(trendsDataH); |
| | | pointValueQueryDTO.setStart(startTime); |
| | | pointValueQueryDTO.setEnd(endTime); |
| | | List<ApiPointValueDTO> trendsDataHList = ConvertUtils.sourceToTarget(dataPointApi.queryPointHistoryValue(pointValueQueryDTO), ApiPointValueDTO.class); |
| | | List<Object[]> newList = new ArrayList<>(); |
| | | trendsDataHList.forEach(item -> { |
| | |
| | | }); |
| | | preDataView.setTrendsDataH(newList); |
| | | } |
| | | if(trendsDataL != null) { |
| | | if (StringUtils.isNotBlank(trendsDataL)) { |
| | | // 动态下限 |
| | | ApiPointValueQueryDTO pointValueQueryDTO = new ApiPointValueQueryDTO(); |
| | | pointValueQueryDTO.setPointNo(trendsDataL); |
| | | pointValueQueryDTO.setStart(startTime); |
| | | pointValueQueryDTO.setEnd(endTime); |
| | | List<ApiPointValueDTO> trendsDataLList = ConvertUtils.sourceToTarget(dataPointApi.queryPointHistoryValue(pointValueQueryDTO), ApiPointValueDTO.class); |
| | | List<Object[]> newList = new ArrayList<>(); |
| | | trendsDataLList.forEach(item -> { |
| | |
| | | } |
| | | |
| | | preDataView.setPreData(resultOld.getDataView().getPreDataL()); |
| | | |
| | | result.setPreDataView(preDataView); |
| | | return result; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询原始计划、修正计划数据 |
| | | * 查询原始计划、修正计划数据 |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getPlanDataChart(PlanDataChartReqVO reqVO) { |
| | |
| | | wrapper.orderByAsc("sort"); |
| | | return ConvertUtils.sourceToTarget(powerControlDetDao.selectList(wrapper), PowerControlDetDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<Object[]> getHistoryValue(Map<String, Object> params) { |
| | | List<Object[]> dataList = new ArrayList<>(); |
| | | |
| | | if (!params.containsKey("dataType") || !params.containsKey("dataNo")) { |
| | | return dataList; |
| | | } |
| | | String dataType = params.get("dataType").toString(); |
| | | String dataNo = params.get("dataNo").toString(); |
| | | |
| | | Date startTime = null; |
| | | Date endTime = null; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | if (!params.containsKey("endTime") || StringUtils.isBlank(params.get("endTime").toString())) { |
| | | endTime = calendar.getTime(); |
| | | }else { |
| | | endTime = DateUtils.parse(params.get("endTime").toString(),DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | } |
| | | if (!params.containsKey("startTime") || StringUtils.isBlank(params.get("startTime").toString())) { |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | startTime = calendar.getTime(); |
| | | }else { |
| | | startTime = DateUtils.parse(params.get("startTime").toString(),DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | } |
| | | |
| | | switch (ProcessConfDataTypeEnum.getEumByCode(dataType)) { |
| | | case DATAPOINT: |
| | | ApiPointValueQueryDTO queryParams1 = new ApiPointValueQueryDTO(); |
| | | queryParams1.setPointNo(dataNo); |
| | | queryParams1.setStart(startTime); |
| | | queryParams1.setEnd(endTime); |
| | | List<com.iailab.module.data.api.point.dto.ApiPointValueDTO> pointHisValue = dataPointApi.queryPointHistoryValue(queryParams1); |
| | | pointHisValue.forEach(item -> { |
| | | Object[] values = new Object[2]; |
| | | values[0] = DateUtils.format(item.getT(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | values[1] = new BigDecimal(item.getV()).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | dataList.add(values); |
| | | }); |
| | | break; |
| | | case IND: |
| | | log.info("IND"); |
| | | ApiIndItemQueryDTO queryParams2 = new ApiIndItemQueryDTO(); |
| | | queryParams2.setItemNo(dataNo); |
| | | queryParams2.setStart(startTime); |
| | | queryParams2.setEnd(endTime); |
| | | List<ApiIndItemValueDTO> indValues = indItemApi.queryIndItemHistoryValue(queryParams2); |
| | | indValues.forEach(item -> { |
| | | Object[] values = new Object[2]; |
| | | values[0] = item.getDataTime(); |
| | | values[1] = item.getDataValue(); |
| | | dataList.add(values); |
| | | }); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dataList; |
| | | } |
| | | } |
| | |
| | | * 平时占比 |
| | | */ |
| | | private BigDecimal psRatio; |
| | | |
| | | // /** |
| | | // * 峰时占比-月累计 |
| | | // */ |
| | | // private BigDecimal fsRatioMonth; |
| | | // |
| | | // /** |
| | | // * 谷时占比-月累计 |
| | | // */ |
| | | // private BigDecimal gsRatioMonth; |
| | | // |
| | | // /** |
| | | // * 平时占比-月累计 |
| | | // */ |
| | | // private BigDecimal psRatioMonth; |
| | | } |
| | |
| | | * 平时占比 |
| | | */ |
| | | private BigDecimal psRatio; |
| | | |
| | | /** |
| | | * 峰时占比-月累计 |
| | | */ |
| | | private BigDecimal fsRatioMonth; |
| | | |
| | | /** |
| | | * 谷时占比-月累计 |
| | | */ |
| | | private BigDecimal gsRatioMonth; |
| | | |
| | | /** |
| | | * 平时占比-月累计 |
| | | */ |
| | | private BigDecimal psRatioMonth; |
| | | } |
| | |
| | | |
| | | List<CokingAnalyIndEntity> list(Map<String, Object> params); |
| | | |
| | | CokingAnalyIndEntity get(String analyType, String analyDate); |
| | | |
| | | void save(List<CokingAnalyIndEntity> entityList); |
| | | |
| | | void delete(String analyType, String analyDate); |
| | |
| | | |
| | | List<CokingTraceSuggestEntity> getAbnormalData(Map<String, Object> params); |
| | | |
| | | void saveTraceSuggest(String relId, String process, String clock, String total, String sugObj); |
| | | void saveTraceSuggest(String relId, String process, String clock, String content, String sugObj); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CokingAnalyIndEntity get(String analyType, String analyDate) { |
| | | QueryWrapper<CokingAnalyIndEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("analy_type", analyType) |
| | | .eq("analy_date", analyDate) |
| | | .orderByDesc("analy_date"); |
| | | |
| | | List<CokingAnalyIndEntity> list = cokingAnalyIndDao.selectList(queryWrapper); |
| | | if (list != null && list.size() > 0) { |
| | | return list.get(0); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void save(List<CokingAnalyIndEntity> entityList) { |
| | | cokingAnalyIndDao.insert(entityList); |
| | | } |
| | |
| | | queryWrapper.eq("analy_type", analyType) |
| | | .eq("analy_date", analyDate); |
| | | cokingAnalyIndDao.delete(queryWrapper); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | }); |
| | | result.put("day", dayDTOList); |
| | | |
| | | Map<String, CokingOverviewEntity> ratioMonth = new HashMap<>(); |
| | | if (processType.equals(ProcessTypeEnum.BM.getCode())) { |
| | | ratioMonth = dayList.stream().collect(Collectors.toMap(CokingOverviewEntity::getSubProcessType, Function.identity(), (e1, e2) -> e1)); |
| | | } |
| | | |
| | | // 月数据 |
| | | QueryWrapper<CokingOverviewEntity> queryWrapperMonth = new QueryWrapper<>(); |
| | | queryWrapperMonth.eq("process_type", processType); |
| | | queryWrapperMonth.between("clock", monthStartClock,clock); |
| | | queryWrapperMonth.select("sub_process_type","SUM(steam_p) as steam_p","SUM(dj_steam_p) as dj_steam_p","SUM(steam_c) as steam_c","SUM(steam_only_c) as steam_only_c","SUM(steam_v) as steam_v","SUM(gas_p) as gas_p","SUM(gas_c) as gas_c","SUM(power_c) as power_c","SUM(power_only_c) as power_only_c","SUM(power_c_standard) as power_c_standard","SUM(idle_time) as idle_time","SUM(bfg_c) as bfg_c","SUM(cog_p) as cog_p","SUM(cog_c) as cog_c","SUM(bfg_only_c) as bfg_only_c","SUM(cog_only_c) as cog_only_c","SUM(gxls) as gxls","SUM(fs_ratio) as fs_ratio","SUM(gs_ratio) as gs_ratio","SUM(ps_ratio) as ps_ratio") |
| | | queryWrapperMonth.select("sub_process_type","SUM(steam_p) as steam_p","SUM(dj_steam_p) as dj_steam_p","SUM(steam_c) as steam_c","SUM(steam_only_c) as steam_only_c","SUM(steam_v) as steam_v","SUM(gas_p) as gas_p","SUM(gas_c) as gas_c","SUM(power_c) as power_c","SUM(power_only_c) as power_only_c","SUM(power_c_standard) as power_c_standard","SUM(idle_time) as idle_time","SUM(bfg_c) as bfg_c","SUM(cog_p) as cog_p","SUM(cog_c) as cog_c","SUM(bfg_only_c) as bfg_only_c","SUM(cog_only_c) as cog_only_c","SUM(gxls) as gxls") |
| | | .groupBy("sub_process_type"); |
| | | |
| | | List<CokingOverviewEntity> monthList = cokingOverviewDao.selectList(queryWrapperMonth); |
| | | monthList.forEach(e -> e.setClock("前30日累计")); |
| | | List<CokingOverviewDTO> monthDTOList = ConvertUtils.sourceToTarget(monthList, CokingOverviewDTO.class); |
| | | monthDTOList.forEach(e -> { |
| | | for (CokingOverviewDTO e : monthDTOList) { |
| | | e.setProcessTypeName(processName); |
| | | e.setSubProcessTypeName(SubProcessTypeEnum.getEumByCode(e.getSubProcessType()).getProcess()); |
| | | }); |
| | | if (processType.equals(ProcessTypeEnum.BM.getCode())) { |
| | | // 月占比用 |
| | | if (ratioMonth.containsKey(e.getSubProcessType())) { |
| | | e.setFsRatio(ratioMonth.get(e.getSubProcessType()).getFsRatioMonth()); |
| | | e.setGsRatio(ratioMonth.get(e.getSubProcessType()).getGsRatioMonth()); |
| | | e.setPsRatio(ratioMonth.get(e.getSubProcessType()).getPsRatioMonth()); |
| | | }else { |
| | | e.setFsRatio(BigDecimal.ZERO); |
| | | e.setGsRatio(BigDecimal.ZERO); |
| | | e.setPsRatio(BigDecimal.ZERO); |
| | | } |
| | | |
| | | } |
| | | } |
| | | result.put("month", monthDTOList); |
| | | |
| | | return result; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | List<String> points = new ArrayList<>(); |
| | | points.add(conf.getPointNo()); |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | value = pointsRealValue.get(conf.getPointNo()).toString(); |
| | | value = new BigDecimal(pointsRealValue.get(conf.getPointNo()).toString()).setScale(2,BigDecimal.ROUND_HALF_UP) .toString(); |
| | | break; |
| | | case IND: |
| | | List<ApiIndItemValueDTO> indValues = indItemApi.queryIndItemDefaultValue(conf.getPointNo()); |
| | | if (!CollectionUtils.isEmpty(indValues)) { |
| | | value = indValues.get(indValues.size() - 1).getDataValue().toString(); |
| | | value = new BigDecimal(indValues.get(indValues.size() - 1).getDataValue().toString()).setScale(2,BigDecimal.ROUND_HALF_UP) .toString(); |
| | | } |
| | | break; |
| | | default: |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void saveTraceSuggest(String relId, String process, String clock, String total, String sugObj) { |
| | | if (StringUtils.isBlank(total)) { |
| | | public void saveTraceSuggest(String relId, String process, String clock, String content, String sugObj) { |
| | | if (StringUtils.isBlank(content)) { |
| | | return; |
| | | } |
| | | CokingTraceSuggestEntity suggestEntity = new CokingTraceSuggestEntity(); |
| | |
| | | suggestEntity.setProcess(process); |
| | | suggestEntity.setSugObj(sugObj); |
| | | suggestEntity.setClock(clock); |
| | | suggestEntity.setContent(total); |
| | | suggestEntity.setContent(content); |
| | | suggestEntity.setCreateDate(new Date()); |
| | | cokingTraceSuggestDao.insert(suggestEntity); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.common.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum TraceProcessTypeEnum { |
| | | |
| | | BM("BM", "备煤工序"), |
| | | LJ("LJ", "炼焦工序"), |
| | | GXJ("GXJ", "干熄焦工序"), |
| | | HC("HC", "化产工序"), |
| | | UNKNOW("unkuow", "未知"); |
| | | |
| | | private String code; |
| | | private String process; |
| | | |
| | | public static TraceProcessTypeEnum getEumByCode(String code) { |
| | | if (StringUtils.isBlank(code)) { |
| | | return UNKNOW; |
| | | } |
| | | for (TraceProcessTypeEnum statusEnum : TraceProcessTypeEnum.values()) { |
| | | if (statusEnum.getCode().equals(code.trim().toUpperCase())) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return UNKNOW; |
| | | } |
| | | } |
| | |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.coking.service.*; |
| | | import com.iailab.module.ansteel.common.constant.CommonConstant; |
| | | import com.iailab.module.ansteel.common.enums.TraceProcessTypeEnum; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mdk.MdkApi; |
| | | import org.slf4j.Logger; |
| | |
| | | @Autowired |
| | | private MdkApi mdkApi; |
| | | |
| | | private final static String process = "备煤工序"; |
| | | private final static String process = TraceProcessTypeEnum.BM.getProcess(); |
| | | |
| | | private final static String reportName = "备煤工序异常溯源"; |
| | | |
| | |
| | | // 保存报告 |
| | | String analyDate = DateUtils.format(startDate); |
| | | String analyContent = clock + " " + result.getString("coalHomeIndexInfo"); |
| | | String content = result.getString(total); |
| | | String relId = cokingTraceReportService.save(process, reportName, analyDate, clock, analyContent); |
| | | |
| | | // 保存一级分析指标 |
| | | cokingAnalyIndService.saveAnalyInd(relId, process, analyDate, analyContent); |
| | | |
| | | // 保存优化建议 |
| | | cokingTraceSuggestService.saveTraceSuggest(relId, process, clock, total, SugObj); |
| | | cokingTraceSuggestService.saveTraceSuggest(relId, process, clock, content, SugObj); |
| | | |
| | | // 保存偏差值 |
| | | cokingTraceDeviationService.saveTraceDeviation(relId, process, clock, result, CommonConstant.COKE_INDEX_CHARTCODE, row, SugObj); |
| | |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.coking.service.*; |
| | | import com.iailab.module.ansteel.common.constant.CommonConstant; |
| | | import com.iailab.module.ansteel.common.enums.TraceProcessTypeEnum; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mdk.MdkApi; |
| | | import org.slf4j.Logger; |
| | |
| | | @Autowired |
| | | private MdkApi mdkApi; |
| | | |
| | | private final static String process = "干熄焦工序"; |
| | | private final static String process = TraceProcessTypeEnum.GXJ.getProcess(); |
| | | |
| | | private final static String reportName = "干熄焦工序异常溯源"; |
| | | |
| | |
| | | // 保存报告 |
| | | String analyDate = DateUtils.format(startDate); |
| | | String analyContent = clock + " " + result.getString("steamHomeIndexInfo"); |
| | | String content = result.getString(total); |
| | | String relId = cokingTraceReportService.save(process, reportName, analyDate, clock, analyContent); |
| | | |
| | | // 保存一级分析指标 |
| | | cokingAnalyIndService.saveAnalyInd(relId, process, analyDate, analyContent); |
| | | |
| | | // 保存优化建议 |
| | | cokingTraceSuggestService.saveTraceSuggest(relId, process, clock, total, SugObj); |
| | | cokingTraceSuggestService.saveTraceSuggest(relId, process, clock, content, SugObj); |
| | | |
| | | // 保存偏差值 |
| | | cokingTraceDeviationService.saveTraceDeviation(relId, process, clock, result, CommonConstant.COKE_INDEX_CHARTCODE, row, SugObj); |
| | |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.coking.service.*; |
| | | import com.iailab.module.ansteel.common.constant.CommonConstant; |
| | | import com.iailab.module.ansteel.common.enums.TraceProcessTypeEnum; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mdk.MdkApi; |
| | | import org.slf4j.Logger; |
| | |
| | | @Autowired |
| | | private MdkApi mdkApi; |
| | | |
| | | private final static String process = "化产工序"; |
| | | private final static String process = TraceProcessTypeEnum.HC.getProcess(); |
| | | |
| | | private final static String reportName = "化产工序异常溯源"; |
| | | |
| | |
| | | // 保存报告 |
| | | String analyDate = DateUtils.format(startDate); |
| | | String analyContent = clock + " " + result.getString("chemProdHomeIndexInfo"); |
| | | String content = result.getString(total); |
| | | String relId = cokingTraceReportService.save(process, reportName, analyDate, clock, analyContent); |
| | | |
| | | // 保存一级分析指标 |
| | | cokingAnalyIndService.saveAnalyInd(relId, process, analyDate, analyContent); |
| | | |
| | | // 保存优化建议 |
| | | cokingTraceSuggestService.saveTraceSuggest(relId, process, clock, total, SugObj); |
| | | cokingTraceSuggestService.saveTraceSuggest(relId, process, clock, content, SugObj); |
| | | |
| | | // 保存偏差值 |
| | | cokingTraceDeviationService.saveTraceDeviation(relId, process, clock, result, CommonConstant.COKE_INDEX_CHARTCODE, row, SugObj); |
| | |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.coking.service.*; |
| | | import com.iailab.module.ansteel.common.constant.CommonConstant; |
| | | import com.iailab.module.ansteel.common.enums.TraceProcessTypeEnum; |
| | | import com.iailab.module.model.api.mdk.MdkApi; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | @Autowired |
| | | private MdkApi mdkApi; |
| | | |
| | | private final static String process = "炼焦工序"; |
| | | private final static String process = TraceProcessTypeEnum.LJ.getProcess(); |
| | | |
| | | private final static String reportName = "炼焦工序异常溯源"; |
| | | |
| | |
| | | // 保存报告 |
| | | String analyDate = DateUtils.format(startDate); |
| | | String analyContent = clock + " " + result.getString("cokeHomeIndexInfo"); |
| | | String content = result.getString(total); |
| | | String relId = cokingTraceReportService.save(process, reportName, analyDate, clock, analyContent); |
| | | |
| | | // 保存一级分析指标 |
| | | cokingAnalyIndService.saveAnalyInd(relId, process, analyDate, analyContent); |
| | | |
| | | // 保存优化建议 |
| | | cokingTraceSuggestService.saveTraceSuggest(relId, process, clock, total, SugObj); |
| | | cokingTraceSuggestService.saveTraceSuggest(relId, process, clock, content, SugObj); |
| | | |
| | | // 保存偏差值 |
| | | cokingTraceDeviationService.saveTraceDeviation(relId, process, clock, result, CommonConstant.COKE_INDEX_CHARTCODE, row, SugObj); |
| | |
| | | |
| | | //根据测点分组 |
| | | Map<String, List<PeakValleyFlatEntity>> groupedByPointNo = list.stream() |
| | | .collect(Collectors.groupingBy(PeakValleyFlatEntity::getPowerNo)); |
| | | .collect(Collectors.groupingBy(PeakValleyFlatEntity::getPointNo)); |
| | | |
| | | groupedByPointNo.entrySet().stream().forEach(entry -> { |
| | | Calendar cal = (Calendar) calendar.clone(); |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | cal.set(Calendar.SECOND, 0); |
| | | cal.set(Calendar.MINUTE, 0); |
| | | cal.set(Calendar.HOUR_OF_DAY, 0); |
| | | Date endTime = calendar.getTime(); |
| | | cal.add(Calendar.DAY_OF_YEAR, -1); |
| | | Date startTime = cal.getTime(); |
| | | cal.add(Calendar.DAY_OF_YEAR, -29); |
| | | Date monthStartTime = cal.getTime(); |
| | | |
| | | //计算昨日的累积量 |
| | | //计算昨日的峰/谷累积量 |
| | | double value = getSumValue(entry.getValue(), 1, calendar); |
| | | |
| | | //计算昨日总电耗 |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | Date endTime = calendar.getTime(); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -1); |
| | | Date startTime = calendar.getTime(); |
| | | double totalValue = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTime,endTime); |
| | | double totalValue = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTime, endTime); |
| | | |
| | | //计算前三十日峰/谷累积量 |
| | | double valueMonth = getSumValueTotal(entry.getValue().get(0).getPointNoTotal(), monthStartTime, startTime)+value; |
| | | |
| | | //计算前三十日总电耗 |
| | | double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), monthStartTime, endTime); |
| | | |
| | | logger.info("name:"+entry.getValue().get(0).getName()+";value:"+value+";totalValue:"+totalValue+";valueMonth:"+valueMonth+";totalValueMonth:"+totalValueMonth); |
| | | |
| | | //下发昨日占比 |
| | | ApiPointValueWriteDTO dto = new ApiPointValueWriteDTO(); |
| | | dto.setPointNo(entry.getValue().get(0).getPointNo()); |
| | | dto.setValue(value/totalValue*100); |
| | | dataPointApi.writePointRealValue(dto); |
| | | ApiPointValueWriteDTO percentDto = new ApiPointValueWriteDTO(); |
| | | percentDto.setPointNo(entry.getValue().get(0).getPointNo()); |
| | | double percent = totalValue == 0 ? 0 : value / totalValue * 100; |
| | | percentDto.setValue(percent); |
| | | dataPointApi.writePointRealValue(percentDto); |
| | | |
| | | if(entry.getValue().get(0).getPointNoMonth()!=null){ |
| | | //计算前三十日累积量 |
| | | double value30 = 0; |
| | | for (int i = 1; i < 31; i++) { |
| | | //计算前三十日累积量 |
| | | value30 = value30 + getSumValue(entry.getValue(), i, calendar); |
| | | } |
| | | //下发昨日峰/谷累积量 |
| | | ApiPointValueWriteDTO totalDto = new ApiPointValueWriteDTO(); |
| | | totalDto.setPointNo(entry.getValue().get(0).getPointNoTotal()); |
| | | totalDto.setValue(value); |
| | | dataPointApi.writePointRealValue(totalDto); |
| | | |
| | | //计算前三十日总电耗 |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -30); |
| | | Date startTimeMonth = calendar.getTime(); |
| | | double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTimeMonth,endTime); |
| | | |
| | | //下发前三十日占比 |
| | | ApiPointValueWriteDTO monthDto = new ApiPointValueWriteDTO(); |
| | | monthDto.setPointNo(entry.getValue().get(0).getPointNoMonth()); |
| | | monthDto.setValue(value30/totalValueMonth*100); |
| | | dataPointApi.writePointRealValue(monthDto); |
| | | } |
| | | //下发前三十日占比 |
| | | ApiPointValueWriteDTO monthDto = new ApiPointValueWriteDTO(); |
| | | monthDto.setPointNo(entry.getValue().get(0).getPointNoMonth()); |
| | | double percentMonth = totalValueMonth == 0 ? 0 : valueMonth / totalValueMonth * 100; |
| | | monthDto.setValue(percentMonth); |
| | | dataPointApi.writePointRealValue(monthDto); |
| | | }); |
| | | } catch (Exception ex) { |
| | | logger.error("runPeakValleyFlatTask运行异常"); |
| | | ex.printStackTrace(); |
| | | logger.error("runPeakValleyFlatTask运行异常", ex); |
| | | } |
| | | } |
| | | |
| | | private Date getTime(String timeStr, int ago, Calendar calendar) { |
| | | Calendar cal = (Calendar) calendar.clone(); |
| | | String[] timeSplit = timeStr.split(":"); |
| | | if (timeSplit.length != 2) { |
| | | throw new IllegalArgumentException("时间配置格式不合法"); |
| | | } |
| | | //根据配置获取startTime、endTime |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(timeSplit[0])); |
| | | calendar.set(Calendar.MINUTE, Integer.parseInt(timeSplit[1])); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -ago); |
| | | return calendar.getTime(); |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | cal.set(Calendar.SECOND, 0); |
| | | cal.set(Calendar.HOUR_OF_DAY, Integer.parseInt(timeSplit[0])); |
| | | cal.set(Calendar.MINUTE, Integer.parseInt(timeSplit[1])); |
| | | cal.add(Calendar.DAY_OF_YEAR, -ago); |
| | | return cal.getTime(); |
| | | } |
| | | |
| | | private List<ApiPointValueDTO> fillMissingData(List<ApiPointValueDTO> valueList, |
| | |
| | | dto.setPointNo(entity.getPowerNo()); |
| | | dto.setStart(startTime); |
| | | dto.setEnd(endTime); |
| | | |
| | | logger.info("开始查询,测点:" + entity.getPowerNo() + "startTime:" + startTime + "endTime:" + endTime); |
| | | List<ApiPointValueDTO> valueList; |
| | | //查找数据 |
| | | List<ApiPointValueDTO> valueList = dataPointApi.queryPointHistoryValue(dto); |
| | | try { |
| | | valueList = dataPointApi.queryPointHistoryValue(dto); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("查询测点异常"); |
| | | } |
| | | //补全数据 |
| | | valueList = fillMissingData(valueList, startTime, endTime); |
| | | //累加 |
| | |
| | | //补全数据 |
| | | valueList = fillMissingData(valueList, startTime, endTime); |
| | | //累加 |
| | | return valueList.stream().mapToDouble(ApiPointValueDTO::getV).sum()/ 60; |
| | | return valueList.stream().mapToDouble(ApiPointValueDTO::getV).sum() / 60; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.power.dao; |
| | | |
| | | import com.iailab.framework.common.dao.BaseDao; |
| | | import com.iailab.module.ansteel.power.entity.PowerVoltageStatusEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年05月06日 |
| | | */ |
| | | @Mapper |
| | | public interface PowerVoltageStatusDao extends BaseDao<PowerVoltageStatusEntity> { |
| | | } |
| | |
| | | */ |
| | | private String pointNoMonth; |
| | | /** |
| | | * 下发测点编码 |
| | | */ |
| | | private String pointNoTotal; |
| | | /** |
| | | * 功率测点编码 |
| | | */ |
| | | private String powerNo; |
| | |
| | | * 排序 |
| | | */ |
| | | private Integer sort; |
| | | |
| | | /** |
| | | * 有功下限 |
| | | */ |
| | | private BigDecimal pLimitL; |
| | | |
| | | /** |
| | | * 有功上限 |
| | | */ |
| | | private BigDecimal pLimitH; |
| | | |
| | | /** |
| | | * 无功下限 |
| | | */ |
| | | private BigDecimal qLimitL; |
| | | |
| | | /** |
| | | * 无功上限 |
| | | */ |
| | | private BigDecimal qLimitH; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.power.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年05月06日 |
| | | */ |
| | | @Data |
| | | @TableName("t_power_voltage_status") |
| | | public class PowerVoltageStatusEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId |
| | | private String id; |
| | | |
| | | private String code; |
| | | |
| | | private String name; |
| | | |
| | | private String point; |
| | | |
| | | private BigDecimal limitH; |
| | | |
| | | private Integer sort; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.power.service; |
| | | |
| | | import com.iailab.module.ansteel.power.entity.PowerVoltageStatusEntity; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年05月06日 |
| | | */ |
| | | public interface PowerVoltageStatusService { |
| | | |
| | | List<PowerVoltageStatusEntity> list(Map<String, Object> params); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.ansteel.power.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.module.ansteel.power.dao.PowerVoltageStatusDao; |
| | | import com.iailab.module.ansteel.power.entity.PowerVoltageStatusEntity; |
| | | import com.iailab.module.ansteel.power.service.PowerVoltageStatusService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2025年05月06日 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class PowerVoltageStatusServiceImpl implements PowerVoltageStatusService { |
| | | |
| | | @Resource |
| | | private PowerVoltageStatusDao powerVoltageStatusDao; |
| | | |
| | | |
| | | @Override |
| | | public List<PowerVoltageStatusEntity> list(Map<String, Object> params) { |
| | | QueryWrapper<PowerVoltageStatusEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.orderByAsc("sort"); |
| | | return powerVoltageStatusDao.selectList(queryWrapper); |
| | | } |
| | | } |
| | |
| | | - t_power_demand |
| | | - t_power_adjusted_factor |
| | | - t_power_net_dropdown |
| | | - t_power_voltage_status |
| | | - t_peak_valley_flat |
| | | - t_coking_overview_ind |
| | | swagger: |