|
|
@ -1,14 +1,18 @@ |
|
|
|
package com.hnac.hzims.scheduled.service.operation.impl; |
|
|
|
package com.hnac.hzims.scheduled.service.operation.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
|
|
|
|
import com.hnac.hzims.EquipmentConstants; |
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.access.constants.AccessConstants; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.defect.constants.DefectConstant; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; |
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyInfoVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyInfoVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyTaskVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyTaskVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.NextDutyInfoVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.NextDutyInfoVo; |
|
|
@ -27,11 +31,9 @@ import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; |
|
|
|
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO; |
|
|
|
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; |
|
|
|
import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; |
|
|
|
import com.xxl.job.core.log.XxlJobLogger; |
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.poi.ss.formula.functions.T; |
|
|
|
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
@ -50,7 +52,6 @@ import java.net.HttpURLConnection; |
|
|
|
import java.net.URL; |
|
|
|
import java.net.URL; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.sql.Time; |
|
|
|
import java.sql.Time; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalTime; |
|
|
|
import java.time.LocalTime; |
|
|
@ -100,7 +101,13 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
public String device_cache_cofig_final; |
|
|
|
public String device_cache_cofig_final; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.region.areaDutyInfoKey}") |
|
|
|
@Value("${hzims.operation.region.areaDutyInfoKey}") |
|
|
|
private String area_duty_cofig_final; |
|
|
|
private String area_duty_cache_final; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.region.deviceClassifyKey}") |
|
|
|
|
|
|
|
private String device_classify_cache_final; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.realIdKey}") |
|
|
|
|
|
|
|
public String real_cache_final; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 集团总指标-首页数据 |
|
|
|
* 集团总指标-首页数据 |
|
|
@ -192,7 +199,7 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
this.dutyRunCondition(startDate,endDate,singlet,areaDutyVo); |
|
|
|
this.dutyRunCondition(startDate,endDate,singlet,areaDutyVo); |
|
|
|
areaDutyVoList.add(areaDutyVo); |
|
|
|
areaDutyVoList.add(areaDutyVo); |
|
|
|
}); |
|
|
|
}); |
|
|
|
redisTemplate.opsForValue().set(area_duty_cofig_final, areaDutyVoList); |
|
|
|
redisTemplate.opsForValue().set(area_duty_cache_final, areaDutyVoList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -243,6 +250,55 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
return target; |
|
|
|
return target; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 设备分类 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param param |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void loaddDeviceClassify(String param) { |
|
|
|
|
|
|
|
// 获取所有设备
|
|
|
|
|
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
|
|
|
|
// 实时数据
|
|
|
|
|
|
|
|
String json = (String) redisTemplate.opsForValue().get(real_cache_final); |
|
|
|
|
|
|
|
Map<String, String> realMap = null; |
|
|
|
|
|
|
|
if (StringUtil.isNotBlank(json)) { |
|
|
|
|
|
|
|
realMap = JSONObject.parseObject(json, new TypeReference<Map<String, String>>() {}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<String,List<String>> deviceClassifyMap = new HashMap<>(); |
|
|
|
|
|
|
|
List<String> deviceCodeList = devices.stream().map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
// 故障
|
|
|
|
|
|
|
|
List<OperPhenomenonEntity> operPhenomenonEntityList = phenomenonService.list(new QueryWrapper<OperPhenomenonEntity>() {{ |
|
|
|
|
|
|
|
in("EM_CODE", deviceCodeList); |
|
|
|
|
|
|
|
ne("IS_DEFECT", DefectConstant.IsDefectStatusEnum.IS_DEFECT.getStatus()); |
|
|
|
|
|
|
|
ne("CONCLUSION_STATUS", DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
List<String> faultList = operPhenomenonEntityList.stream().map(OperPhenomenonEntity::getEmCode).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
deviceClassifyMap.put(HomePageConstant.FAULT,faultList); |
|
|
|
|
|
|
|
// 检修
|
|
|
|
|
|
|
|
List<OperAccessTaskEntity> operAccessTaskEntityList = accessService.list(new QueryWrapper<OperAccessTaskEntity>() {{ |
|
|
|
|
|
|
|
in("EM_CODE", deviceCodeList); |
|
|
|
|
|
|
|
ne("STATUS", AccessConstants.ACCESS_TASK_STATUS_4); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
List<String> overhaulList = operAccessTaskEntityList.stream().map(OperAccessTaskEntity::getEmCode).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<String> overhaulOldList = devices.stream().filter(o-> !faultList.contains(o.getEmCode()) && !overhaulList.contains(o.getEmCode()) && (Func.isNotEmpty(o.getRunStatus()) && EquipmentConstants.RunStatus.access.getStatus().equals(o.getRunStatus()))) |
|
|
|
|
|
|
|
.map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
overhaulList.addAll(overhaulOldList); |
|
|
|
|
|
|
|
deviceClassifyMap.put(HomePageConstant.OVERHAUL,overhaulList); |
|
|
|
|
|
|
|
// 运行
|
|
|
|
|
|
|
|
List<EminfoAndEmParamVo> runDeviceList = devices.stream().filter(o-> !faultList.contains(o.getEmCode()) && !overhaulList.contains(o.getEmCode())).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<String> runList = this.runDevice(runDeviceList,realMap); |
|
|
|
|
|
|
|
deviceClassifyMap.put(HomePageConstant.RUN,runList); |
|
|
|
|
|
|
|
// 备用
|
|
|
|
|
|
|
|
List<String> spareList = devices.stream().filter(o-> !faultList.contains(o.getEmCode()) && !overhaulList.contains(o.getEmCode()) && !runList.contains(o.getEmCode()) && Func.isNotEmpty(o.getRunStatus()) |
|
|
|
|
|
|
|
&& EquipmentConstants.RunStatus.spare.getStatus().equals(o.getRunStatus())) |
|
|
|
|
|
|
|
.map(EminfoAndEmParamVo::getEmCode).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
deviceClassifyMap.put(HomePageConstant.SPARE,spareList); |
|
|
|
|
|
|
|
redisTemplate.opsForValue().set(device_classify_cache_final, deviceClassifyMap); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 风电指标 |
|
|
|
* 风电指标 |
|
|
|
* @return |
|
|
|
* @return |
|
|
@ -1127,9 +1183,9 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 当班运行数据 |
|
|
|
* 当班运行数据 |
|
|
|
* @param start |
|
|
|
* @param startTime |
|
|
|
* @param end |
|
|
|
* @param endTime |
|
|
|
* @param childList |
|
|
|
* @param areas |
|
|
|
* @param areaDutyVo |
|
|
|
* @param areaDutyVo |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void dutyRunCondition(Date startTime, Date endTime, List<Long> areas,AreaDutyVo areaDutyVo) { |
|
|
|
private void dutyRunCondition(Date startTime, Date endTime, List<Long> areas,AreaDutyVo areaDutyVo) { |
|
|
@ -1182,4 +1238,34 @@ public class ShowServiceImpl implements ShowService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取运行设备列表 |
|
|
|
|
|
|
|
* @param runDeviceList |
|
|
|
|
|
|
|
* @param realMap |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<String> runDevice(List<EminfoAndEmParamVo> runDeviceList, Map<String, String> realMap) { |
|
|
|
|
|
|
|
return runDeviceList.stream().map(o ->{ |
|
|
|
|
|
|
|
Map<String,String> points = o.getPoint(); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(points)){ |
|
|
|
|
|
|
|
return "0"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String realId = points.get(HomePageConstant.JOINT_RELAY); |
|
|
|
|
|
|
|
if(StringUtil.isEmpty(realId)){ |
|
|
|
|
|
|
|
return "0"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(MapUtils.isEmpty(realMap)){ |
|
|
|
|
|
|
|
return "0"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String value = realMap.get(realId); |
|
|
|
|
|
|
|
if(StringUtil.isEmpty(value)){ |
|
|
|
|
|
|
|
return "0"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (value.contains("1") || "1.0".equals(value)) { |
|
|
|
|
|
|
|
return o.getEmCode(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "0"; |
|
|
|
|
|
|
|
}).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |