Merge remote-tracking branch 'origin/master'
| | |
| | | */ |
| | | private BigDecimal idleTime; |
| | | /** |
| | | * 运行时间 |
| | | */ |
| | | private BigDecimal runTime; |
| | | /** |
| | | * 作业率 |
| | | */ |
| | | private BigDecimal workRatio; |
| | | /** |
| | | * BFG消耗/总耗 |
| | | */ |
| | | private BigDecimal bfgC; |
| | |
| | | */ |
| | | private BigDecimal idleTime; |
| | | /** |
| | | * 运行时间 |
| | | */ |
| | | private BigDecimal runTime; |
| | | /** |
| | | * 作业率 |
| | | */ |
| | | private BigDecimal workRatio; |
| | | /** |
| | | * BFG消耗/总耗 |
| | | */ |
| | | private BigDecimal bfgC; |
| | |
| | | QueryWrapper<CokingOverviewEntity> queryWrapperMonth = new QueryWrapper<>(); |
| | | queryWrapperMonth.eq("process_type", processType); |
| | | queryWrapperMonth.between("clock", monthStartClock,clock); |
| | | queryWrapperMonth.select("sub_process_type","ROUND(AVG(steam_p)*30, 2) as steam_p","ROUND(AVG(dj_steam_p)*30, 2) as dj_steam_p","ROUND(AVG(steam_c)*30, 2) as steam_c","ROUND(AVG(steam_only_c)*30, 2) as steam_only_c","ROUND(AVG(steam_v)*30, 2) as steam_v","ROUND(AVG(gas_p)*30, 2) as gas_p","ROUND(AVG(gas_c)*30, 2) as gas_c","ROUND(AVG(power_c)*30, 2) as power_c","ROUND(AVG(power_only_c)*30, 2) as power_only_c","ROUND(AVG(power_c_standard)*30, 2) as power_c_standard","ROUND(AVG(idle_time)*30, 0) as idle_time","ROUND(AVG(bfg_c)*30, 2) as bfg_c","ROUND(AVG(cog_p)*30, 2) as cog_p","ROUND(AVG(cog_c)*30, 2) as cog_c","ROUND(AVG(bfg_only_c)*30, 2) as bfg_only_c","ROUND(AVG(cog_only_c)*30, 2) as cog_only_c","ROUND(AVG(gxls)*30, 0) as gxls") |
| | | queryWrapperMonth.select("sub_process_type","ROUND(AVG(steam_p)*30, 2) as steam_p","ROUND(AVG(dj_steam_p)*30, 2) as dj_steam_p","ROUND(AVG(steam_c)*30, 2) as steam_c","ROUND(AVG(steam_only_c)*30, 2) as steam_only_c","ROUND(AVG(steam_v)*30, 2) as steam_v","ROUND(AVG(gas_p)*30, 2) as gas_p","ROUND(AVG(gas_c)*30, 2) as gas_c","ROUND(AVG(power_c)*30, 2) as power_c","ROUND(AVG(power_only_c)*30, 2) as power_only_c","ROUND(AVG(power_c_standard)*30, 2) as power_c_standard","ROUND(AVG(idle_time)*30, 0) as idle_time","ROUND(AVG(bfg_c)*30, 2) as bfg_c","ROUND(AVG(cog_p)*30, 2) as cog_p","ROUND(AVG(cog_c)*30, 2) as cog_c","ROUND(AVG(bfg_only_c)*30, 2) as bfg_only_c","ROUND(AVG(cog_only_c)*30, 2) as cog_only_c","ROUND(AVG(gxls)*30, 0) as gxls","ROUND(AVG(run_time)*30, 0) as run_time","ROUND(AVG(work_ratio), 2) as work_ratio") |
| | | .groupBy("sub_process_type"); |
| | | |
| | | List<CokingOverviewEntity> monthList = cokingOverviewDao.selectList(queryWrapperMonth); |
| | |
| | | PSJ("PSJ", "破碎机"), |
| | | JL_12("JL_12", "1#2#焦炉"), |
| | | JL_34("JL_34", "3#4#焦炉"), |
| | | TX_12("TX_12", "1#2#脱硝"), |
| | | TX_34("TX_34", "3#4#脱硝"), |
| | | GL("GL", "鼓冷"), |
| | | LA("LA", "硫铵"), |
| | | CB("CB", "粗苯"), |
| | |
| | | package com.iailab.module.ansteel.plant.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.ansteel.plant.dao.PlantChartConfDao; |
| | | import com.iailab.module.ansteel.plant.entity.PlantChartConfEntity; |
| | | import com.iailab.module.ansteel.plant.service.PlantChartConfService; |
| | |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Resource |
| | | private DataPointApi dataPointApi; |
| | | |
| | | private String timeFormat = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| | | |
| | | @Override |
| | | public PlantChartDataVO getPlantChartData(Map tMap) { |
| | | int granularity = 60; |
| | | PlantChartDataVO result = new PlantChartDataVO(); |
| | | if(ObjectUtils.isEmpty(tMap.get("indType")) || ObjectUtils.isEmpty(tMap.get("indCode"))){ |
| | | logger.info("输入参数为空"); |
| | |
| | | } |
| | | QueryWrapper<PlantChartConfEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("ind_type",tMap.get("indType")); |
| | | queryWrapper.eq("indCode",tMap.get("indCode")); |
| | | queryWrapper.eq("ind_code", tMap.get("indCode")); |
| | | List<PlantChartConfEntity> plantChartConfList = plantChartConfDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(plantChartConfList)) { |
| | | log.info("plantChartConfList is null"); |
| | | return result; |
| | | } |
| | | if("year".equals(tMap.get("indType"))){ |
| | | granularity = 60*1440; |
| | | } |
| | | Date[] timeArray = calResultTime(tMap.get("indType").toString()); |
| | | Date startTime = timeArray[0]; |
| | | Date endTime = timeArray[1]; |
| | | List<String> categories = DateUtils.getTimeScale(startTime, endTime, granularity, timeFormat); |
| | | |
| | | PlantChartConfEntity plantChartConfEntity = plantChartConfList.get(0); |
| | | result.setIndType(tMap.get("indType").toString()); |
| | | result.setIndCode(plantChartConfEntity.getIndCode()); |
| | | result.setIndName(plantChartConfEntity.getIndName()); |
| | | result.setStartTime(startTime); |
| | | result.setEndTime(endTime); |
| | | result.setCategories(categories); |
| | | // 筛选DATAPOINT一次性查询出全部 |
| | | List<String> pointNos = Stream.of(plantChartConfEntity.getIndAvg(),plantChartConfEntity.getIndTheory(),plantChartConfEntity.getIndOptimal(),plantChartConfEntity.getIndReal()).collect(Collectors.toList()); |
| | | List<String> pointNos = Stream.of(plantChartConfEntity.getIndAvg(), plantChartConfEntity.getIndTheory(), plantChartConfEntity.getIndOptimal(), plantChartConfEntity.getIndReal(), plantChartConfEntity.getIndPower()).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(pointNos)) { |
| | | ApiPointsValueQueryDTO queryDTO = new ApiPointsValueQueryDTO(); |
| | | queryDTO.setPointNos(pointNos); |
| | |
| | | log.info("pointsHisValues is null"); |
| | | return result; |
| | | } |
| | | result.setIndCode(plantChartConfEntity.getIndCode()); |
| | | result.setIndName(plantChartConfEntity.getIndName()); |
| | | |
| | | result.setIndAvgHisList(pointsHisValues.get(plantChartConfEntity.getIndAvg())); |
| | | result.setIndTheoryHisList(pointsHisValues.get(plantChartConfEntity.getIndTheory())); |
| | | result.setIndOptimalHisList(pointsHisValues.get(plantChartConfEntity.getIndOptimal())); |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private Date[] calResultTime(String indType) { |
| | | Date[] result = new Date[2]; |
| | | Date startTime = null; |
| | | Date endTime = null; |
| | | if("day".equals(indType)) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.add(Calendar.HOUR_OF_DAY, -8); |
| | | startTime = calendar.getTime(); |
| | | |
| | | calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | endTime = calendar.getTime(); |
| | | |
| | | }else if("year".equals(indType)) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | startTime = calendar.getTime(); |
| | | |
| | | calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | endTime = calendar.getTime(); |
| | | } |
| | | |
| | | result[0] = startTime; |
| | | result[1] = endTime; |
| | | return result; |
| | | } |
| | | } |
| | |
| | | package com.iailab.module.ansteel.plant.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public class PlantChartDataVO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String id; |
| | | private String indType; |
| | | |
| | | private String indCode; |
| | | |
| | | private String indName; |
| | | |
| | | private String indType; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date startTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endTime; |
| | | |
| | | List<String> categories; |
| | | |
| | | private List<Map<String, Object>> indAvgHisList; |
| | | |