| | |
| | | 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='电力下拉关系表'; |
| | |
| | | @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()) { |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | * 平时占比 |
| | | */ |
| | | 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<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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | // 保存报告 |
| | | 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); |
| | |
| | | // 保存报告 |
| | | 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); |
| | |
| | | // 保存报告 |
| | | 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); |
| | |
| | | // 保存报告 |
| | | 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); |
| | |
| | | .collect(Collectors.groupingBy(PeakValleyFlatEntity::getPointNo)); |
| | | |
| | | groupedByPointNo.entrySet().stream().forEach(entry -> { |
| | | |
| | | //计算昨日的峰/谷累积量 |
| | | double value = getSumValue(entry.getValue(), 1, calendar); |
| | | |
| | | //计算昨日总电耗 |
| | | Calendar cal = (Calendar) calendar.clone(); |
| | | cal.set(Calendar.MILLISECOND, 0); |
| | | cal.set(Calendar.SECOND, 0); |
| | | cal.set(Calendar.MINUTE, 0); |
| | | cal.set(Calendar.HOUR_OF_DAY, 0); |
| | | Date endTime = calendar.getTime(); |
| | |
| | | Date startTime = cal.getTime(); |
| | | cal.add(Calendar.DAY_OF_YEAR, -29); |
| | | Date monthStartTime = cal.getTime(); |
| | | |
| | | //计算昨日的峰/谷累积量 |
| | | double value = getSumValue(entry.getValue(), 1, calendar); |
| | | |
| | | //计算昨日总电耗 |
| | | double totalValue = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTime, endTime); |
| | | |
| | | //计算前三十日峰/谷累积量 |
| | | double valueMonth = getSumValueTotal(entry.getValue().get(0).getPointNoTotal(), monthStartTime, startTime)+value; |
| | | |
| | | //计算前三十日总电耗 |
| | | double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), monthStartTime, endTime); |
| | | |
| | | logger.info("name:"+entry.getValue().get(0).getName()+";value:"+value+";totalValue:"+totalValue+";valueMonth:"+valueMonth+";totalValueMonth:"+totalValueMonth); |
| | | |
| | | //下发昨日占比 |
| | | ApiPointValueWriteDTO percentDto = new ApiPointValueWriteDTO(); |
| | |
| | | |
| | | //下发昨日峰/谷累积量 |
| | | ApiPointValueWriteDTO totalDto = new ApiPointValueWriteDTO(); |
| | | percentDto.setPointNo(entry.getValue().get(0).getPointNoTotal()); |
| | | percentDto.setValue(value); |
| | | totalDto.setPointNo(entry.getValue().get(0).getPointNoTotal()); |
| | | totalDto.setValue(value); |
| | | dataPointApi.writePointRealValue(totalDto); |
| | | |
| | | //计算前三十日峰/谷累积量 |
| | | double valueMonth = getSumValueTotal(entry.getValue().get(0).getPointNoTotal(), monthStartTime, endTime); |
| | | |
| | | //计算前三十日总电耗 |
| | | double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), monthStartTime, endTime); |
| | | |
| | | //下发前三十日占比 |
| | | ApiPointValueWriteDTO monthDto = new ApiPointValueWriteDTO(); |
| | |
| | | double percentMonth = totalValueMonth == 0 ? 0 : valueMonth / totalValueMonth * 100; |
| | | monthDto.setValue(percentMonth); |
| | | dataPointApi.writePointRealValue(monthDto); |
| | | |
| | | }); |
| | | } catch (Exception ex) { |
| | | logger.error("runPeakValleyFlatTask运行异常", ex); |
| | |
| | | } |
| | | //根据配置获取startTime、endTime |
| | | 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); |
对比新文件 |
| | |
| | | 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 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: |