ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/GasController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/dao/GasPredConfDao.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/entity/GasPredConfEntity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/service/GasPredConfService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ansteel-biz/src/main/java/com/iailab/module/ansteel/gas/service/impl/GasPredConfServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPeakValleyFlatTask.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
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/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,56 @@ 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; /** * 预测项输出key */ private String outKey; /** * 预测项输出名称 */ private String outName; /** * 排序 */ private String sort; } 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/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; } }