6 天以前 | dengzedong | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | dongyukun | ![]() |
6 天以前 | dongyukun | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | dengzedong | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | dongyukun | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | dongyukun | ![]() |
6 天以前 | dongyukun | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | dengzedong | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | dongyukun | ![]() |
6 天以前 | dongyukun | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
6 天以前 | 潘志宝 | ![]() |
ansteel-biz/db/mysql.sql
@@ -251,6 +251,9 @@ ADD COLUMN `node_code` varchar(50) NULL DEFAULT NULL COMMENT '节点编号'; ALTER TABLE `t_power_net_factor` ADD COLUMN `cur_a` varchar(50) NULL DEFAULT NULL COMMENT '当前电流' AFTER `node_name`; 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 '有功上限'; @@ -258,6 +261,10 @@ 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 '无功上限'; ALTER TABLE `t_power_net_factor` ADD COLUMN `cos_limit_l` varchar(50) NULL DEFAULT NULL COMMENT '功率因数下限'; ALTER TABLE `t_power_net_factor` ADD COLUMN `cos_limit_h` varchar(50) NULL DEFAULT NULL COMMENT '功率因数上限'; -- ---------------------------- -- 电力功率因数-发电机组实时状态 @@ -723,12 +730,12 @@ -- ---------------------------- 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 '测点', `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 '排序', `sort` int NULL DEFAULT NULL COMMENT '排序', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='功率因数-母线电压状态'; @@ -769,4 +776,27 @@ PRIMARY KEY (`id`), key uk_p_code (p_code), UNIQUE key uk_node_code (node_code) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='电力下拉关系表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='电力下拉关系表'; -- ---------------------------- -- 煤气预测析配置 -- ---------------------------- DROP TABLE IF EXISTS `t_gas_pred_conf`; CREATE TABLE `t_gas_pred_conf` ( `id` varchar(36) NOT NULL COMMENT 'id', `chart_code` varchar(50) NULL DEFAULT NULL COMMENT '预测图编号', `user_type` varchar(50) NULL DEFAULT NULL COMMENT '用户类型(发生,消耗)', `item_no` varchar(50) NULL DEFAULT NULL COMMENT '预测项编号', `item_name` varchar(50) NULL DEFAULT NULL COMMENT '预测项名称', `out_key` varchar(50) NULL DEFAULT NULL COMMENT '预测项输出key', `out_name` varchar(50) NULL DEFAULT NULL COMMENT '预测项输出名称', `is_default_load` int DEFAULT NULL COMMENT '是否默认加载', `sort` int NULL DEFAULT NULL COMMENT '排序', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC COMMENT '煤气预测析配置'; ALTER TABLE `t_gas_pred_conf` ADD COLUMN `out_id` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '预测项输出id' AFTER `item_name`, ADD COLUMN `is_default_load` int DEFAULT NULL COMMENT '是否默认加载' AFTER `out_name`; ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/CokingController.java
@@ -97,21 +97,9 @@ calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MINUTE, 0); int hour = calendar.get(Calendar.HOUR_OF_DAY); String analyClass = ""; if (hour >= 8 && hour < 16) { analyDate = DateUtils.format(calendar.getTime()); analyClass = "甲班"; } else if (hour >= 16 && hour < 24) { analyDate = DateUtils.format(calendar.getTime()); analyClass = "乙班"; } else if (hour >= 0 && hour < 8) { calendar.add(Calendar.DAY_OF_YEAR, -1); analyDate = DateUtils.format(calendar.getTime()); analyClass = "丙班"; } calendar.add(Calendar.DAY_OF_YEAR, -1); analyDate = DateUtils.format(calendar.getTime()); params.put("analyDate", analyDate); params.put("analyClass", analyClass); } List<CokingAnalyIndEntity> list = cokingAnalyIndService.list(params); return success(ConvertUtils.sourceToTarget(list, CokingAnalyIndDTO.class)); ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/DataController.java
@@ -1,24 +1,15 @@ 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.PreDataBarLineReqVO; 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 lombok.extern.slf4j.Slf4j; 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; @@ -49,6 +40,13 @@ return CommonResult.success(respVO); } @PostMapping("/predict-data/chartsByOutIds") @Operation(summary = "根据outId查询预测数据") public CommonResult<List<PreDataViewSimpleDTO>> getPreDataByOutIds(@RequestBody PreDataBarLineReqVO reqVO) { List<PreDataViewSimpleDTO> respVO = dataService.getPreDataByOutIds(reqVO); return CommonResult.success(respVO); } @PostMapping("/plan-data/charts") @Operation(summary = "计划数据图表") public CommonResult<Map<String, Object>> getPlanDataChart(@RequestBody PlanDataChartReqVO reqVO) { ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/GasController.java
对比新文件 @@ -0,0 +1,39 @@ package com.iailab.module.ansteel.api.controller.admin; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.module.ansteel.api.dto.PowerNetFactorDTO; import com.iailab.module.ansteel.gas.entity.GasPredConfEntity; import com.iailab.module.ansteel.gas.service.GasPredConfService; import com.iailab.module.ansteel.power.entity.PowerNetFactorEntity; import io.swagger.v3.oas.annotations.Operation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; /** * 煤气接口 * * @author DongYukun * @Description * @createTime 2025年05月07日 */ @Slf4j @RestController @RequestMapping("/ansteel/api/gas") public class GasController { @Autowired private GasPredConfService gasPredConfService; @GetMapping("/pred-conf/list") @Operation(summary = "煤气预测配置") public CommonResult<List<GasPredConfEntity>> getGasPredConfList(@RequestParam Map<String, Object> params) { return CommonResult.success(gasPredConfService.list(params)); } } ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java
@@ -83,9 +83,11 @@ @GetMapping("/net-factor/list") @Operation(summary = "功率因数-电网拓扑") public CommonResult<List<PowerNetFactorDTO>> getPowerNetFactorList(@RequestParam Map<String, Object> params) { List<PowerNetFactorEntity> list = powerNetFactorService.list(params); log.info("功率因数电网拓扑"); List<PowerNetFactorDTO> result = new ArrayList<>(); if (CollectionUtils.isEmpty(result)) { List<PowerNetFactorEntity> list = powerNetFactorService.list(params); if (CollectionUtils.isEmpty(list)) { log.info("list is empty"); return success(result); } Calendar calendar = Calendar.getInstance(); @@ -103,14 +105,25 @@ boolean cosFlag = false; try { List<String> points = new ArrayList<>(); if (StringUtils.isNotBlank(entity.getCurA())) { points.add(entity.getCurA()); } if (StringUtils.isNotBlank(entity.getCurP())) { points.add(entity.getCurP()); } if (StringUtils.isNotBlank(entity.getCurQ())) { points.add(entity.getCurQ()); } if (StringUtils.isNotBlank(entity.getCurCos())) { points.add(entity.getCurCos()); } log.info("points=" + points); if (!CollectionUtils.isEmpty(points)) { Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); log.info("pointsRealValue=" + pointsRealValue); if (pointsRealValue.get(entity.getCurA()) != null) { powerNetFactorDTO.setCurA(new BigDecimal(pointsRealValue.get(entity.getCurA()).toString())); } if (pointsRealValue.get(entity.getCurP()) != null) { powerNetFactorDTO.setCurP(new BigDecimal(pointsRealValue.get(entity.getCurP()).toString())); } @@ -124,6 +137,7 @@ } } catch (Exception ex) { log.info(entity.getNodeName() + "获取当前值异常" + ex.getMessage()); ex.printStackTrace(); } try { @@ -155,43 +169,53 @@ } } catch (Exception ex) { log.info(entity.getNodeName() + "获取预测值异常," + ex.getMessage()); ex.printStackTrace(); } // 设置电流状态 powerNetFactorDTO.setStatus(0); if (powerNetFactorDTO.getCurA() != null) { BigDecimal curA = powerNetFactorDTO.getCurA(); if (entity.getLimitL() != null && curA.compareTo(entity.getLimitL()) < 0) { powerNetFactorDTO.setStatus(1); } else if (entity.getLimitH() != null && curA.compareTo(entity.getLimitH()) > 0) { powerNetFactorDTO.setStatus(1); } } // 设置功率因数状态 powerNetFactorDTO.setQstatus(0); 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 { powerNetFactorDTO.setStatus(0); if (entity.getCosLimitL() != null && curCos.compareTo(entity.getCosLimitL()) < 0) { powerNetFactorDTO.setQstatus(1); } else if (entity.getCosLimitH() != null && curCos.compareTo(entity.getCosLimitH()) > 0) { powerNetFactorDTO.setQstatus(1); } } // 设置有功预警状态 powerNetFactorDTO.setPstatus(0); if (powerNetFactorDTO.getCurP() != null) { BigDecimal curP = powerNetFactorDTO.getCurP(); if (entity.getPLimitH() != null && curP.compareTo(entity.getPLimitL()) < 0) { powerNetFactorDTO.setStatus(1); if (entity.getPLimitL() != null && curP.compareTo(entity.getPLimitL()) < 0) { powerNetFactorDTO.setPstatus(1); } else if (entity.getPLimitH() != null && curP.compareTo(entity.getPLimitH()) > 0) { powerNetFactorDTO.setStatus(1); } else { powerNetFactorDTO.setStatus(0); powerNetFactorDTO.setPstatus(1); } } // 设置无功预警状态 powerNetFactorDTO.setQstatus(0); if (powerNetFactorDTO.getCurQ() != null) { BigDecimal curQ = powerNetFactorDTO.getCurQ(); if (entity.getQLimitH() != null && curQ.compareTo(entity.getQLimitL()) < 0) { powerNetFactorDTO.setStatus(1); if (entity.getQLimitL() != null && curQ.compareTo(entity.getQLimitL()) < 0) { powerNetFactorDTO.setQstatus(1); } else if (entity.getQLimitH() != null && curQ.compareTo(entity.getQLimitH()) > 0) { powerNetFactorDTO.setStatus(1); } else { powerNetFactorDTO.setStatus(0); powerNetFactorDTO.setQstatus(1); } } result.add(powerNetFactorDTO); } return success(result); } @@ -570,11 +594,12 @@ } @PostMapping("/demand-query/list") @Operation(summary = "负荷移植-功率因数查询") public CommonResult<List<PowerNetDropdownDTO>> getDemandDropdownList(@RequestBody PowerDemandQueryDTO queryDto) { List<PowerNetDropdownDTO> result = new ArrayList<>(); @Operation(summary = "负荷移植-需量值查询") public CommonResult<List<PowerDemandQueryRespDTO>> getDemandDropdownList(@RequestBody PowerDemandQueryDTO queryDto) { List<PowerDemandQueryRespDTO> result = new ArrayList<>(); if (StringUtils.isBlank(queryDto.getCode())) { log.info("code isBlank"); return success(result); } log.info("code=" + queryDto.getCode()); if (StringUtils.isBlank(queryDto.getNodeCode())) { @@ -585,25 +610,42 @@ log.info("PowerDemandEntity is null"); return success(result); } Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.SECOND, 0); Date startTime = queryDto.getStartTime(); Date endTime = queryDto.getEndTime(); if (endTime == null) { endTime = calendar.getTime(); } if (startTime == null) { calendar.add(Calendar.DAY_OF_YEAR, -1); startTime = calendar.getTime(); } Map<String, Object> params0 = new HashMap<>(); params0.put("groupName", entity.getName()); List<PowerNetDropdownEntity> list = powerNetDropdownService.list(params0); List<String> points = list.stream().map(item -> { return item.getCurCos(); }).collect(Collectors.toList()); if (queryDto.getCurCos() == null) { List<PowerNetDropdownEntity> dropdownList = powerNetDropdownService.list(params0); List<String> pointNos = new ArrayList<>(); for (PowerNetDropdownEntity netDropdown : dropdownList) { if (StringUtils.isNotBlank(netDropdown.getExt1())) { pointNos.add(netDropdown.getExt1()); } } if (StringUtils.isBlank(queryDto.getNodeCode()) || queryDto.getCurDemand() == null) { log.info("查询当前值"); Map<String, Object> pointsRealValue = new HashMap<>(); if (!CollectionUtils.isEmpty(points)) { pointsRealValue = dataPointApi.queryPointsRealValue(points); if (!CollectionUtils.isEmpty(pointNos)) { pointsRealValue = dataPointApi.queryPointsRealValue(pointNos); } for (PowerNetDropdownEntity netDropdown : list) { PowerNetDropdownDTO dto = ConvertUtils.sourceToTarget(netDropdown, PowerNetDropdownDTO.class); BigDecimal curCos = BigDecimal.ZERO; if (pointsRealValue.get(netDropdown.getCurCos()) != null) { curCos = new BigDecimal(pointsRealValue.get(netDropdown.getCurCos()).toString()); for (PowerNetDropdownEntity netDropdown : dropdownList) { PowerDemandQueryRespDTO dto = ConvertUtils.sourceToTarget(netDropdown, PowerDemandQueryRespDTO.class); BigDecimal demand = null; if (pointsRealValue.get(netDropdown.getExt1()) != null) { demand = new BigDecimal(pointsRealValue.get(netDropdown.getExt1()).toString()); } dto.setCurCos(curCos); dto.setCurDemand(demand); dto.setDataTime(calendar.getTime()); result.add(dto); } } else { @@ -619,19 +661,7 @@ return success(result); } ApiPointsValueQueryDTO valueQueryDTO = new ApiPointsValueQueryDTO(); valueQueryDTO.setPointNos(points); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.SECOND, 0); Date startTime = queryDto.getStartTime(); Date endTime = queryDto.getEndTime(); if (endTime == null) { endTime = calendar.getTime(); } if (startTime == null) { calendar.add(Calendar.DAY_OF_YEAR, -1); startTime = calendar.getTime(); } valueQueryDTO.setPointNos(pointNos); valueQueryDTO.setStart(startTime); valueQueryDTO.setEnd(endTime); Map<String, List<Map<String, Object>>> pointsHisValues = dataPointApi.queryPointsHistoryValue(valueQueryDTO); @@ -643,7 +673,7 @@ ApiPointValueQueryDTO pointValueQueryDTO = new ApiPointValueQueryDTO(); pointValueQueryDTO.setStart(startTime); pointValueQueryDTO.setEnd(endTime); pointValueQueryDTO.setPointNo(powerNetDropdownEntity.getCurCos()); pointValueQueryDTO.setPointNo(powerNetDropdownEntity.getExt1()); List<ApiPointValueDTO> hisValue = dataPointApi.queryPointHistoryValue(pointValueQueryDTO); if (CollectionUtils.isEmpty(hisValue)) { log.info("hisValue is null"); @@ -651,28 +681,35 @@ ApiPointValueDTO curValue = null; Collections.reverse(hisValue); for (ApiPointValueDTO valueDTO : hisValue) { curValue = valueDTO; if ((queryDto.getCurCos().doubleValue() - valueDTO.getV()) <= 0.0001) { if ((queryDto.getCurDemand().doubleValue() - valueDTO.getV()) <= 0.0001) { curValue = valueDTO; log.info("curValue is find"); break; } } if (curValue == null) { log.info("curValue is null"); for (PowerNetDropdownEntity netDropdown : dropdownList){ PowerDemandQueryRespDTO dto = ConvertUtils.sourceToTarget(netDropdown, PowerDemandQueryRespDTO.class); if (dto.getNodeCode().equals(nodeCode)) { dto.setCurDemand(queryDto.getCurDemand()); } result.add(dto); } return success(result); } log.info("curValue=" + curValue); for (PowerNetDropdownEntity netDropdown : list) { PowerNetDropdownDTO dto = ConvertUtils.sourceToTarget(netDropdown, PowerNetDropdownDTO.class); for (PowerNetDropdownEntity netDropdown : dropdownList) { PowerDemandQueryRespDTO dto = ConvertUtils.sourceToTarget(netDropdown, PowerDemandQueryRespDTO.class); if (!CollectionUtils.isEmpty(pointsHisValues.get(netDropdown.getExt1()))) { Map<String, BigDecimal> pointValueMap = new HashMap<>(); pointsHisValues.get(netDropdown.getExt1()).forEach(item -> { pointValueMap.put(item.get("time").toString(), DecimalUtil.toBigDecimal(item.get("value"))); if (CollectionUtils.isEmpty(pointsHisValues.get(netDropdown.getCurCos()))) { continue; }); dto.setCurDemand(pointValueMap.get(DateUtils.format(curValue.getT(),DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND))); dto.setDataTime(curValue.getT()); } Map<String, BigDecimal> pointValueMap = new HashMap<>(); pointsHisValues.get(netDropdown.getCurCos()).forEach(item -> { pointValueMap.put(item.get("time").toString(), DecimalUtil.toBigDecimal(item.get("value"))); }); dto.setCurCos(pointValueMap.get(DateUtils.format(curValue.getT(),DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND))); result.add(dto); } } @@ -680,7 +717,7 @@ } @PostMapping("/net-factor/history") @Operation(summary = "功率因数-根据nodeName获取最近1440min历史数据,月最大,最小值") @Operation(summary = "功率因数-电网拓扑功率历史") public CommonResult<PowerHistoryDTO> getPowerHistoryData(@RequestBody PowerNetFactorHisReqDTO dto) { log.info("PowerNetFactorHisReqDTO=" + JSONObject.toJSONString(dto)); PowerHistoryDTO result = new PowerHistoryDTO(); @@ -758,6 +795,98 @@ 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); } @PostMapping("/net-factor/history-list") @Operation(summary = "功率因数-电网拓扑功率历史(多code)") public CommonResult<LinkedHashMap<String, PowerHistoryDTO>> getPowerHistoryList(@RequestBody PowerNetFactorHisReqDTO dto) { log.info("PowerNetFactorHisReqDTO=" + JSONObject.toJSONString(dto)); LinkedHashMap<String, PowerHistoryDTO> result = new LinkedHashMap<>(); List<String> nodeCodeList = dto.getNodeCodeList(); if (CollectionUtils.isEmpty(nodeCodeList)) { return CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST); } String queryType = dto.getQueryType(); if (StringUtils.isBlank(queryType)) { return CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST); } Calendar calendar0 = Calendar.getInstance(); calendar0.set(Calendar.MILLISECOND, 0); calendar0.set(Calendar.SECOND, 0); Date end0 = dto.getEndTime() == null ? calendar0.getTime() : dto.getEndTime(); calendar0.add(Calendar.MINUTE, -1440); Date start0 = dto.getStartTime() == null ? calendar0.getTime() : dto.getStartTime(); Calendar calendar1 = Calendar.getInstance(); calendar1.set(Calendar.DAY_OF_MONTH, 1); calendar1.set(Calendar.HOUR_OF_DAY, 0); calendar1.set(Calendar.MINUTE, 0); calendar1.set(Calendar.SECOND, 0); calendar1.set(Calendar.MILLISECOND, 0); Date start1 = calendar1.getTime(); List<String> categories = DateUtils.getTimeScale(start0, end0, 60); for (String nodeCode : nodeCodeList) { PowerHistoryDTO powerHistoryDTO = new PowerHistoryDTO(); PowerNetFactorQuery powerNetFactorQuery = null; PowerNetFactorEntity powerNetFactorEntity = powerNetFactorService.getByNodeCode(nodeCode); PowerNetDropdownEntity powerNetDropdownEntity = powerNetDropdownService.getByNodeCode(nodeCode); if (powerNetFactorEntity != null) { powerNetFactorQuery = ConvertUtils.sourceToTarget(powerNetFactorEntity, PowerNetFactorQuery.class); } else if (powerNetDropdownEntity != null) { powerNetFactorQuery = ConvertUtils.sourceToTarget(powerNetDropdownEntity, PowerNetFactorQuery.class); } if (powerNetFactorQuery == null) { log.info("powerNetFactor is null"); continue; } log.info("开始查询,"); ApiPointValueQueryDTO apiPointValueQueryDTO = new ApiPointValueQueryDTO(); String pointNo = ""; switch (queryType.toUpperCase()) { case "P": pointNo = powerNetFactorQuery.getCurP(); break; case "Q": pointNo = powerNetFactorQuery.getCurQ(); break; case "COS": pointNo = powerNetFactorQuery.getCurCos(); break; default: break; } //查询图表 apiPointValueQueryDTO.setPointNo(pointNo); apiPointValueQueryDTO.setEnd(end0); apiPointValueQueryDTO.setStart(start0); List<ApiPointValueDTO> chartData = dataPointApi.queryPointHistoryValue(apiPointValueQueryDTO); List<Object[]> dataList = new ArrayList<>(); for (ApiPointValueDTO pv : chartData) { Object[] data = new Object[2]; data[0] = DateUtils.format(pv.getT(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); data[1] = pv.getV(); dataList.add(data); } powerHistoryDTO.setDataList(dataList); //查询月最大最小值 ApiPointValueQueryDTO apiPointValueQueryDTO1 = new ApiPointValueQueryDTO(); apiPointValueQueryDTO1.setStart(start1); apiPointValueQueryDTO1.setEnd(new Date()); apiPointValueQueryDTO1.setPointNo(pointNo); List<ApiPointValueDTO> monthChartData = dataPointApi.queryPointHistoryValue(apiPointValueQueryDTO1); if (!CollectionUtils.isEmpty(monthChartData)) { List<Double> monthValues = monthChartData.stream().map(item -> item.getV()).collect(Collectors.toList()); powerHistoryDTO.setMax(monthValues.stream().max(Double::compareTo).get()); powerHistoryDTO.setMin(monthValues.stream().min(Double::compareTo).get()); } result.put(nodeCode, powerHistoryDTO); } return success(result); } @@ -883,20 +1012,28 @@ } for (String code : dto.getCodeList()) { PowerDemandEntity powerDemand = powerDemandService.getByCode(code); if (powerDemand == null) { PowerNetFactorQuery powerNetFactorQuery = new PowerNetFactorQuery(); PowerDemandEntity powerDemandEntity = powerDemandService.getByCode(code); PowerNetDropdownEntity powerNetDropdownEntity = powerNetDropdownService.getByNodeCode(code); if (powerDemandEntity != null) { powerNetFactorQuery.setCurP(powerDemandEntity.getActivePower()); powerNetFactorQuery.setCurDem(powerDemandEntity.getCurDemand()); } else if (powerNetDropdownEntity != null) { powerNetFactorQuery.setCurP(powerNetDropdownEntity.getCurP()); powerNetFactorQuery.setCurDem(powerNetDropdownEntity.getExt1()); } else { log.info("未找到code对应的数据: {}", dto.getCode()); return success(new LinkedHashMap<>()); continue; } String queryType = dto.getQueryType().toUpperCase(); String pointNo; switch (queryType.toUpperCase()) { case "D": pointNo = powerDemand.getCurDemand(); pointNo = powerNetFactorQuery.getCurDem(); break; case "P": pointNo = powerDemand.getActivePower(); pointNo = powerNetFactorQuery.getCurP(); break; default: throw new IllegalArgumentException("不支持的queryType: " + queryType); ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerDemandQueryDTO.java
@@ -23,11 +23,8 @@ @Schema(description = "节点编码") private String nodeCode; @Schema(description = "节点名称") private String nodeName; @Schema(description = "当前功率因数") private BigDecimal curCos; @Schema(description = "当前需量") private BigDecimal curDemand; @Schema(description = "开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerDemandQueryRespDTO.java
对比新文件 @@ -0,0 +1,34 @@ package com.iailab.module.ansteel.api.dto; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; /** * 需量查询结果 * * @author PanZhibao * @Description * @createTime 2025年05月07日 */ @Data public class PowerDemandQueryRespDTO implements Serializable { private static final long serialVersionUID = 1L; @Schema(description = "节点编码") private String nodeCode; @Schema(description = "节点名称") private String nodeName; @Schema(description = "当前需量") private BigDecimal curDemand; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @Schema(description = "数据时间") private Date dataTime; } ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorDTO.java
@@ -1,5 +1,6 @@ package com.iailab.module.ansteel.api.dto; import com.alibaba.fastjson.annotation.JSONField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -28,6 +29,9 @@ @Schema(description = "节点名称") private String nodeName; @Schema(description = "当前电流") private BigDecimal curA; @Schema(description = "当前有功") private BigDecimal curP; @@ -55,17 +59,18 @@ @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; private Integer pstatus; @Schema(description = "无功是否超限(0:正常,1:超限)") private Integer qStatus; private Integer qstatus; @Schema(description = "功率因数是否超限(0:正常,1:超限)") private Integer cosStatus; } ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorHisReqDTO.java
@@ -5,6 +5,7 @@ import java.io.Serializable; import java.util.Date; import java.util.List; /** * @author PanZhibao @@ -17,6 +18,8 @@ private String nodeCode; private List<String> nodeCodeList; private String queryType; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PowerNetFactorQuery.java
@@ -25,4 +25,9 @@ * 当前功率因数 */ private String curCos; /** * 当前需量 */ private String curDem; } ansteel-biz/src/main/java/com/iailab/module/ansteel/api/dto/PreDataViewSimpleDTO.java
对比新文件 @@ -0,0 +1,35 @@ package com.iailab.module.ansteel.api.dto; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import java.util.List; /** * @author DongYukun * @Description * @createTime 2025年05月07日 */ @Schema(description = "RPC 模型 - 预测数据 DTO") @Data public class PreDataViewSimpleDTO implements Serializable { private static final long serialVersionUID = 1L; @Schema(description = "预测项名称") private String itemName; @Schema(description = "预测时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date predictTime; @Schema(description = "当时预测值") private List<Object[]> curData; @Schema(description = "真实值") private List<Object[]> realData; } ansteel-biz/src/main/java/com/iailab/module/ansteel/api/service/DataService.java
@@ -1,6 +1,7 @@ package com.iailab.module.ansteel.api.service; import com.iailab.module.ansteel.api.dto.*; import com.iailab.module.model.api.mcs.dto.PreDataBarLineReqVO; import com.iailab.module.model.api.mcs.dto.PreDataSingleChartReqVO; import com.iailab.module.model.api.mcs.dto.StAlarmAndSuggestReqVO; @@ -35,4 +36,6 @@ List<PowerControlDetDTO> getPowerControlDetList(Map<String, Object> params); List<Object[]> getHistoryValue(Map<String, Object> params); List<PreDataViewSimpleDTO> getPreDataByOutIds(PreDataBarLineReqVO reqVO); } ansteel-biz/src/main/java/com/iailab/module/ansteel/api/service/impl/DataServiceImpl.java
@@ -400,14 +400,14 @@ 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); } 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); } else { startTime = DateUtils.parse(params.get("startTime").toString(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); } switch (ProcessConfDataTypeEnum.getEumByCode(dataType)) { @@ -443,4 +443,19 @@ } return dataList; } @Override public List<PreDataViewSimpleDTO> getPreDataByOutIds(PreDataBarLineReqVO reqVO) { PreDataBarLineRespVO preDataBarLineRespVO = mcsApi.getPreDataCharts(reqVO); List<PreDataViewSimpleDTO> preDataViewSimpleDTOList = new ArrayList<>(); preDataBarLineRespVO.getDataViewList().forEach(item -> { PreDataViewSimpleDTO preDataViewSimpleDTO = new PreDataViewSimpleDTO(); preDataViewSimpleDTO.setItemName(item.getResultName()); preDataViewSimpleDTO.setPredictTime(preDataBarLineRespVO.getPredictTime()); preDataViewSimpleDTO.setCurData(item.getCurData()); preDataViewSimpleDTO.setRealData(item.getRealData()); preDataViewSimpleDTOList.add(preDataViewSimpleDTO); }); return preDataViewSimpleDTOList; } } ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/service/impl/CokingAnalyIndServiceImpl.java
@@ -28,10 +28,8 @@ @Override public List<CokingAnalyIndEntity> list(Map<String, Object> params) { String analyDate = (String) params.get("analyDate"); String analyClass = (String) params.get("analyClass"); QueryWrapper<CokingAnalyIndEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq(StringUtils.isNotBlank(analyDate),"analy_date", analyDate) .eq(StringUtils.isNotBlank(analyClass),"analy_class", analyClass) .orderByAsc("sort"); return cokingAnalyIndDao.selectList(queryWrapper); } ansteel-biz/src/main/java/com/iailab/module/ansteel/coking/service/impl/CokingOverviewServiceImpl.java
@@ -72,7 +72,7 @@ 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") queryWrapperMonth.select("sub_process_type","SUM(steam_p)*30/count(*) as steam_p","SUM(dj_steam_p)*30/count(*) as dj_steam_p","SUM(steam_c)*30/count(*) as steam_c","SUM(steam_only_c)*30/count(*) as steam_only_c","SUM(steam_v)*30/count(*) as steam_v","SUM(gas_p)*30/count(*) as gas_p","SUM(gas_c)*30/count(*) as gas_c","SUM(power_c)*30/count(*) as power_c","SUM(power_only_c)*30/count(*) as power_only_c","SUM(power_c_standard)*30/count(*) as power_c_standard","SUM(idle_time)*30/count(*) as idle_time","SUM(bfg_c)*30/count(*) as bfg_c","SUM(cog_p)*30/count(*) as cog_p","SUM(cog_c)*30/count(*) as cog_c","SUM(bfg_only_c)*30/count(*) as bfg_only_c","SUM(cog_only_c)*30/count(*) as cog_only_c","SUM(gxls)*30/count(*) as gxls") .groupBy("sub_process_type"); List<CokingOverviewEntity> monthList = cokingOverviewDao.selectList(queryWrapperMonth); ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/dao/GasPredConfDao.java
对比新文件 @@ -0,0 +1,15 @@ package com.iailab.module.ansteel.gas.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.module.ansteel.gas.entity.GasPredConfEntity; import org.apache.ibatis.annotations.Mapper; /** * @author dyk * @Description * @createTime 2025年05月07日 */ @Mapper public interface GasPredConfDao extends BaseDao<GasPredConfEntity> { } ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/entity/GasPredConfEntity.java
对比新文件 @@ -0,0 +1,64 @@ package com.iailab.module.ansteel.gas.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * 煤气预测配置 * * @author DongYukun * @Description * @createTime 2025年5月7日 */ @Data @TableName("t_gas_pred_conf") public class GasPredConfEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private String id; /** * 预测图编号 */ private String chartCode; /** * 用户类型(发生,消耗) */ private String userType; /** * 预测项编号 */ private String itemNo; /** * 预测项名称 */ private String itemName; /** * 预测项输出id */ private String outId; /** * 预测项输出key */ private String outKey; /** * 预测项输出名称 */ private String outName; /** * 是否默认加载 */ private Integer isDefaultLoad; /** * 排序 */ private String sort; } ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/package-info.java
对比新文件 @@ -0,0 +1 @@ package com.iailab.module.ansteel.gas; ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/service/GasPredConfService.java
对比新文件 @@ -0,0 +1,15 @@ package com.iailab.module.ansteel.gas.service; import com.iailab.module.ansteel.gas.entity.GasPredConfEntity; import java.util.List; import java.util.Map; /** * @author dyk * @Description * @createTime 2025年05月07日 */ public interface GasPredConfService { List<GasPredConfEntity> list(Map<String, Object> params); } ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/service/impl/GasPredConfServiceImpl.java
对比新文件 @@ -0,0 +1,36 @@ package com.iailab.module.ansteel.gas.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.module.ansteel.gas.dao.GasPredConfDao; import com.iailab.module.ansteel.gas.entity.GasPredConfEntity; import com.iailab.module.ansteel.gas.service.GasPredConfService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * @author dyk * @Description * @createTime 2025年04月18日 */ @Slf4j @Service public class GasPredConfServiceImpl implements GasPredConfService { @Resource private GasPredConfDao gasPredConfDao; @Override public List<GasPredConfEntity> list(Map<String, Object> params) { String chartCode = (String) params.get("chartCode"); QueryWrapper<GasPredConfEntity> queryWrapper = new QueryWrapper<>(); queryWrapper.eq(StringUtils.isNotBlank(chartCode), "chart_code", chartCode); queryWrapper.orderByAsc("sort"); return gasPredConfDao.selectList(queryWrapper); } } ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunCokingMainTask.java
@@ -69,6 +69,8 @@ continue; } List<CokingProcessMainEntity> processMainEntities = new ArrayList<>(list.size()); // 历史最优计算方向,正数取最大值,负数取最小值 Map<String,Double> directionMap = new HashMap<>(list.size()); for (CokingProcessConfEntity conf : list) { if (StringUtils.isBlank(conf.getDataType())) { logger.info("DataType is Empty"); @@ -95,32 +97,10 @@ processMainEntity.setStandValue(standValue == null ? BigDecimal.ZERO : BigDecimal.valueOf(standValue)); Double theoryValue = getConfValue("DATAPOINT",conf.getExt2()); processMainEntity.setTheoryValue(theoryValue == null ? BigDecimal.ZERO : BigDecimal.valueOf(theoryValue)); // 计算 月累计 calendar.add(Calendar.DAY_OF_YEAR, -29); String clock_30 = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); List<CokingProcessMainEntity> historyList_30 = cokingProcessMainService.historyList(clock_30, clock, "day",conf.getIndCode()); historyList_30.add(processMainEntity); double monthValue = historyList_30.stream().mapToDouble(e -> e.getRealValue().doubleValue()).sum(); processMainEntity.setMonthValue(BigDecimal.valueOf(monthValue)); // 计算 历史平均 calendar.add(Calendar.DAY_OF_YEAR, -60); String clock_90 = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); List<CokingProcessMainEntity> historyList_90 = cokingProcessMainService.historyList(clock_90, clock, "day",conf.getIndCode()); historyList_90.add(processMainEntity); double avgValue = historyList_90.stream().mapToDouble(e -> e.getRealValue().doubleValue()).average().orElse(0.0); processMainEntity.setAvgValue(BigDecimal.valueOf(avgValue)); // 历史最优 double baseValue = 0.0; if (conf.getExt3() == null || Double.valueOf(conf.getExt3()) > 0.0) { baseValue = historyList_90.stream().mapToDouble(e -> e.getRealValue().doubleValue()).max().orElse(0.0); }else { baseValue = historyList_90.stream().mapToDouble(e -> e.getRealValue().doubleValue()).min().orElse(0.0); // 历史最优计算方向 if (conf.getExt3() != null) { directionMap.put(conf.getIndCode(),Double.valueOf(conf.getExt3())); } processMainEntity.setBaseValue(BigDecimal.valueOf(baseValue)); processMainEntities.add(processMainEntity); } // 计算吨焦产煤气,吨焦产蒸汽,吨焦耗煤气 @@ -142,10 +122,6 @@ // 干熄焦蒸汽产生 BigDecimal mainGxjzqcs = resultCodeMap.get("main_gxjzqcs").getRealValue(); e.setRealValue(mainGxjzqcs.divide(jtcl,2,BigDecimal.ROUND_HALF_UP)); e.setRealValue(e.getAvgValue()); e.setAvgValue(e.getAvgValue().divide(jtcl,2,BigDecimal.ROUND_HALF_UP)); } // 吨焦耗煤气 if (e.getIndCode().equals("main_djhmq") && resultCodeMap.containsKey("main_glmqxh") && resultCodeMap.containsKey("main_jlmqxh")) { @@ -158,6 +134,37 @@ }); } } // 计算 统计值 processMainEntities.forEach(processMainEntity -> { // 计算 月累计 calendar.add(Calendar.DAY_OF_YEAR, -28); String clock_30 = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); List<CokingProcessMainEntity> historyList_30 = cokingProcessMainService.historyList(clock_30, clock, "day",processMainEntity.getIndCode()); historyList_30.add(processMainEntity); double monthValue = historyList_30.stream().mapToDouble(e -> e.getRealValue().doubleValue()).average().orElse(0.0) * 30; processMainEntity.setMonthValue(BigDecimal.valueOf(monthValue)); // 计算 历史平均 calendar.add(Calendar.DAY_OF_YEAR, -60); String clock_90 = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); List<CokingProcessMainEntity> historyList_90 = cokingProcessMainService.historyList(clock_90, clock, "day",processMainEntity.getIndCode()); historyList_90.add(processMainEntity); double avgValue = historyList_90.stream().mapToDouble(e -> e.getRealValue().doubleValue()).average().orElse(0.0); processMainEntity.setAvgValue(BigDecimal.valueOf(avgValue)); // 历史最优 double baseValue = 0.0; if (!directionMap.containsKey(processMainEntity.getIndCode()) || directionMap.get(processMainEntity.getIndCode()) > 0.0) { baseValue = historyList_90.stream().mapToDouble(e -> e.getRealValue().doubleValue()).max().orElse(0.0); }else { baseValue = historyList_90.stream().mapToDouble(e -> e.getRealValue().doubleValue()).min().orElse(0.0); } processMainEntity.setBaseValue(BigDecimal.valueOf(baseValue)); }); cokingProcessMainService.save(processMainEntities); } } catch (Exception ex) { ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPeakValleyFlatTask.java
@@ -54,20 +54,22 @@ 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(); cal.add(Calendar.DAY_OF_YEAR, -27); Date monthStartTime_29 = cal.getTime(); cal.add(Calendar.DAY_OF_YEAR, -2); Date monthStartTime_30 = cal.getTime(); //计算昨日的峰/谷累积量 double value = getSumValue(entry.getValue(), 1, calendar); //计算昨日总电耗 double totalValue = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTime, endTime); double totalValue = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTime, endTime,1440,60); //计算前三十日峰/谷累积量 double valueMonth = getSumValueTotal(entry.getValue().get(0).getPointNoTotal(), monthStartTime, startTime)+value; //计算前29日峰/谷累积量 + 今日 double valueMonth = getSumValueTotal(entry.getValue().get(0).getPointNoTotal(), monthStartTime_29, endTime,29,1)+value; //计算前三十日总电耗 double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), monthStartTime, endTime); double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), monthStartTime_30, endTime,1440 * 30,60); logger.info("name:"+entry.getValue().get(0).getName()+";value:"+value+";totalValue:"+totalValue+";valueMonth:"+valueMonth+";totalValueMonth:"+totalValueMonth); @@ -182,15 +184,18 @@ throw new RuntimeException("查询测点异常"); } //补全数据 valueList = fillMissingData(valueList, startTime, endTime); // valueList = fillMissingData(valueList, startTime, endTime); // 计算 startTime和endTime中有多少个点 long total = (endTime.getTime() - startTime.getTime()) / (60 * 1000); double sum = valueList.stream().filter(e -> Double.compare(e.getV(), 0.0) > 0).mapToDouble(ApiPointValueDTO::getV).average().orElse(0.0) * Long.valueOf(total).doubleValue(); //累加 double sum = valueList.stream().mapToDouble(ApiPointValueDTO::getV).sum(); // double sum = valueList.stream().mapToDouble(ApiPointValueDTO::getV).sum(); value = value + sum; } return value / 60; } private double getSumValueTotal(String pointNo, Date startTime, Date endTime) { private double getSumValueTotal(String pointNo, Date startTime, Date endTime,Integer total,Integer divide) { ApiPointValueQueryDTO dto = new ApiPointValueQueryDTO(); dto.setPointNo(pointNo); dto.setStart(startTime); @@ -199,8 +204,10 @@ //查找数据 List<ApiPointValueDTO> valueList = dataPointApi.queryPointHistoryValue(dto); //补全数据 valueList = fillMissingData(valueList, startTime, endTime); // valueList = fillMissingData(valueList, startTime, endTime); double value = valueList.stream().filter(e -> Double.compare(e.getV(), 0.0) > 0).mapToDouble(ApiPointValueDTO::getV).average().orElse(0.0) * Double.valueOf(total); //累加 return valueList.stream().mapToDouble(ApiPointValueDTO::getV).sum() / 60; return value / divide; } } ansteel-biz/src/main/java/com/iailab/module/ansteel/power/entity/PowerNetFactorEntity.java
@@ -36,6 +36,10 @@ */ private String nodeName; /** * 当前电流 */ private String curA; /** * 当前有功 */ private String curP; @@ -107,4 +111,14 @@ * 无功上限 */ private BigDecimal qLimitH; /** * 功率因数下限 */ private BigDecimal cosLimitL; /** * 功率因数上限 */ private BigDecimal cosLimitH; } ansteel-biz/src/main/resources/application.yaml
@@ -181,6 +181,7 @@ - t_power_voltage_status - t_peak_valley_flat - t_coking_overview_ind - t_gas_pred_conf swagger: title: 鞍钢鲅鱼圈能源管控系统 description: 鞍钢鲅鱼圈能源管控系统 doc/鞍钢数据接口文档_dev_pan.docBinary files differ
doc/鞍钢数据接口文档_master.docBinary files differ