Browse Source

#检修库bug修改

zhongwei
yang_shj 8 months ago
parent
commit
d8c3a829ec
  1. 12
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java
  2. 5
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java
  3. 13
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmService.java
  4. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java
  5. 117
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java
  6. 244
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java
  7. 80
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java
  8. 39
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java
  9. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java
  10. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/dto/BusinessFileDto.java
  11. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/dto/ScanDto.java
  12. 160
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/ScanServiceImpl.java
  13. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  14. BIN
      hzims-service/operational/src/main/resources/template/excel/access_import_template.xlsx

12
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java

@ -1,6 +1,7 @@
package com.hnac.hzims.scheduled.scheduled; package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService; import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.alarm.AlarmService;
import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService; import com.hnac.hzims.scheduled.service.alarm.InterruptionAlarmService;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
@ -25,10 +26,7 @@ import static com.hnac.hzims.operational.main.constant.MainConstants.*;
public class AlarmScheduledTask { public class AlarmScheduledTask {
@Autowired @Autowired
private AlarmQueryService alarmQueryService; private AlarmService alarmService;
@Autowired
private InterruptionAlarmService interruptionService;
/** /**
@ -41,7 +39,7 @@ public class AlarmScheduledTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"); param = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
} }
alarmQueryService.clearHistoryAlarm(param); alarmService.clearHistoryAlarm(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
@ -55,7 +53,7 @@ public class AlarmScheduledTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
alarmQueryService.startStopAlarm(param); alarmService.startStopAlarm(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
@ -70,7 +68,7 @@ public class AlarmScheduledTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
interruptionService.interruption(param); alarmService.interruption(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
} }

5
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java

@ -10,11 +10,10 @@ import java.util.List;
*/ */
public interface AlarmQueryService extends BaseService<AlarmEntity> { public interface AlarmQueryService extends BaseService<AlarmEntity> {
void startStopAlarm(String param); void clear(String param);
void clearHistoryAlarm(String param);
List<String> bells(List<String> codes); List<String> bells(List<String> codes);
List<String> aborts(List<String> codes); List<String> aborts(List<String> codes);
} }

13
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmService.java

@ -0,0 +1,13 @@
package com.hnac.hzims.scheduled.service.alarm;
/**
* @author ysj
*/
public interface AlarmService {
void startStopAlarm(String param);
void clearHistoryAlarm(String param);
void interruption(String param);
}

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/InterruptionAlarmService.java

@ -8,5 +8,5 @@ import org.springblade.core.mp.base.BaseService;
*/ */
public interface InterruptionAlarmService extends BaseService<InterruptionEntity> { public interface InterruptionAlarmService extends BaseService<InterruptionEntity> {
void interruption(String param);
} }

117
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java

@ -34,127 +34,12 @@ import java.util.stream.Collectors;
public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, AlarmEntity> implements AlarmQueryService { public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, AlarmEntity> implements AlarmQueryService {
private final StationService stationService;
private final RedisTemplate redisTemplate;
private final static String start_stop_cache_final = "hzims:operation:start:stop:key";
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
/**
* 开停机告警
* @param param
*/
@Override
public void startStopAlarm(String param) {
// 获取站点开关机状态
Map<String,Integer> startStopMap = (HashMap<String, Integer>) redisTemplate.opsForValue().get(start_stop_cache_final);
// 查询接入水电站点
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>()
.eq(StationEntity::getDataOrigin,0)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 获取站点设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if(CollectionUtil.isEmpty(reals)){
return;
}
Map<String,Integer> refresh = new HashMap<>();
// 实时设备遍历
reals.forEach(real->{
// 过滤站点
List<StationEntity> list = stations.stream().filter(item -> item.getRefDept().equals(real.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return;
}
// 确定站点
StationEntity station = list.get(0);
// 数据初始化记录
if(CollectionUtil.isEmpty(startStopMap)){
if(Math.abs(real.getActivePower()) > 0){
refresh.put(real.getDeviceCode(),1);
}else{
refresh.put(real.getDeviceCode(),0);
}
return;
}
// 比对开机状态
if(Math.abs(real.getActivePower()) > 0){
if(startStopMap.get(real.getDeviceCode()) == 0){
refresh.put(real.getDeviceCode(),1);
// 记录开机告警
this.saveStartStopAlarm(station,real,1);
}else{
refresh.put(real.getDeviceCode(),0);
}
}else{
if(startStopMap.get(real.getDeviceCode()) == 1){
refresh.put(real.getDeviceCode(),0);
// 记录关机告警
this.saveStartStopAlarm(station,real,0);
}else{
refresh.put(real.getDeviceCode(),1);
}
}
});
redisTemplate.opsForValue().set(start_stop_cache_final,refresh);
}
/**
* 清理历史告警数据
* @param param
*/
@Override @Override
public void clearHistoryAlarm(String param) { public void clear(String param) {
this.baseMapper.clear(param); this.baseMapper.clear(param);
} }
/** /**
* 保存站点设备开关机告警
* @param station
* @param real
* @param state
*/
private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real, int state) {
AlarmEntity alarm = new AlarmEntity();
alarm.setStationId(station.getCode());
alarm.setStationName(station.getName());
alarm.setDeviceCode(real.getDeviceCode());
alarm.setDeviceName(real.getDeviceName());
alarm.setAlarmId(station.getCode() + "_" + Func.randomUUID());
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_关机");
alarm.setAlarmSource(AlarmConstants.START_STOP_WARNING);
alarm.setAlarmType(AlarmConstants.STOP);
if(state == 1){
alarm.setAlarmType(AlarmConstants.START);
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_开机");
}
alarm.setStatus(0);
alarm.setAlarmTime(new Date());
alarm.setIsRightTabulation(0);
alarm.setIsShowAlert(1);
alarm.setIsSmallBell(1);
alarm.setIsMask(1);
alarm.setIsBroadcast(0);
alarm.setIsPlatformMessage(1);
alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);
alarm.setTenantId(station.getTenantId());
alarm.setCreateDept(station.getRefDept());
alarm.setCreateUser(station.getCreateUser());
alarm.setUpdateUser(station.getUpdateUser());
alarm.setUpdateTime(station.getUpdateTime());
this.save(alarm);
}
/**
* 查询站点铃铛 * 查询站点铃铛
* @param codes * @param codes
* @return * @return

244
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java

@ -0,0 +1,244 @@
package com.hnac.hzims.scheduled.service.alarm.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.config.constants.AlarmConstants;
import com.hnac.hzims.alarm.config.entity.AlarmEntity;
import com.hnac.hzims.business.interruption.constants.InterruptionConstants;
import com.hnac.hzims.business.interruption.entity.InterruptionEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.alarm.AlarmService;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ysj
*/
@AllArgsConstructor
@Service
@Slf4j
public class AlarmServiceImpl implements AlarmService {
private final StationService stationService;
private final AlarmQueryService alarmQueryService;
private final InterruptionAlarmServiceImpl interruptionAlarmService;
private final ISoeClient soeClient;
private final RedisTemplate redisTemplate;
private final static String start_stop_cache_final = "hzims:operation:start:stop:key";
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
/**
* 开停机告警
* @param param
*/
@Override
public void startStopAlarm(String param) {
// 获取站点开关机状态
Map<String,Integer> startStopMap = (HashMap<String, Integer>) redisTemplate.opsForValue().get(start_stop_cache_final);
// 查询接入水电站点
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>()
.eq(StationEntity::getDataOrigin,0)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 获取站点设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if(CollectionUtil.isEmpty(reals)){
return;
}
Map<String,Integer> refresh = new HashMap<>();
// 实时设备遍历
reals.forEach(real->{
// 过滤站点
List<StationEntity> list = stations.stream().filter(item -> item.getRefDept().equals(real.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return;
}
// 确定站点
StationEntity station = list.get(0);
// 数据初始化记录
if(CollectionUtil.isEmpty(startStopMap)){
if(Math.abs(real.getActivePower()) > 0){
refresh.put(real.getDeviceCode(),1);
}else{
refresh.put(real.getDeviceCode(),0);
}
return;
}
// 比对开机状态
if(Math.abs(real.getActivePower()) > 0){
if(startStopMap.get(real.getDeviceCode()) == 0){
refresh.put(real.getDeviceCode(),1);
// 记录开机告警
this.saveStartStopAlarm(station,real,1);
}else{
refresh.put(real.getDeviceCode(),0);
}
}else{
if(startStopMap.get(real.getDeviceCode()) == 1){
refresh.put(real.getDeviceCode(),0);
// 记录关机告警
this.saveStartStopAlarm(station,real,0);
}else{
refresh.put(real.getDeviceCode(),1);
}
}
});
redisTemplate.opsForValue().set(start_stop_cache_final,refresh);
}
/**
* 清理历史告警数据
* @param param
*/
@Override
public void clearHistoryAlarm(String param) {
this.alarmQueryService.clear(param);
}
/**
* 保存站点设备开关机告警
* @param station
* @param real
* @param state
*/
private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real, int state) {
AlarmEntity alarm = new AlarmEntity();
alarm.setStationId(station.getCode());
alarm.setStationName(station.getName());
alarm.setDeviceCode(real.getDeviceCode());
alarm.setDeviceName(real.getDeviceName());
alarm.setAlarmId(station.getCode() + "_" + Func.randomUUID());
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_关机");
alarm.setAlarmSource(AlarmConstants.START_STOP_WARNING);
alarm.setAlarmType(AlarmConstants.STOP);
if(state == 1){
alarm.setAlarmType(AlarmConstants.START);
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_开机");
}
alarm.setStatus(0);
alarm.setAlarmTime(new Date());
alarm.setIsRightTabulation(0);
alarm.setIsShowAlert(1);
alarm.setIsSmallBell(1);
alarm.setIsMask(1);
alarm.setIsBroadcast(0);
alarm.setIsPlatformMessage(1);
alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);
alarm.setTenantId(station.getTenantId());
alarm.setCreateDept(station.getRefDept());
alarm.setCreateUser(station.getCreateUser());
alarm.setUpdateUser(station.getUpdateUser());
alarm.setUpdateTime(station.getUpdateTime());
this.alarmQueryService.save(alarm);
}
/**
* 数据中断告警
* @param param
*/
@Override
public void interruption(String param) {
// 查询接入站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getDataOrigin,"0")
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 查询告警数据: 间隔10分钟
SoeQueryConditionByStation query = new SoeQueryConditionByStation();
query.setTypes(InterruptionConstants.INTERRUPTION_TYPE);
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
Calendar calendar = Calendar.getInstance();
query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
calendar.add(Calendar.MINUTE,-360);
query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
query.setNeedPage(false);
query.setPage(1);
query.setLimit(1000);
Result<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query);
// 未查询到告警信息
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())) {
return;
}
// 中断告警数据
List<SoeData> soes = result.getData().getRecords();
// 查询当天数据中断告警记录
List<InterruptionEntity> saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 批量保存中断告警数据
this.interruptionAlarmService.saveBatch(soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{
InterruptionEntity entity = new InterruptionEntity();
List<StationEntity> soeStations = stations.stream().filter(o->o.getCode().equals(soe.getStation())).collect(Collectors.toList());
if(!CollectionUtil.isEmpty(soeStations)){
entity.setStationId(soeStations.get(0).getCode());
entity.setStationName(soeStations.get(0).getName());
entity.setCreateDept(soeStations.get(0).getRefDept());
entity.setTenantId(soeStations.get(0).getTenantId());
}
entity.setAlarmId(soe.getId());
entity.setRealId(soe.getRealId());
entity.setSoeExplain(soe.getSoeExplain());
entity.setType(soe.getSoeType());
entity.setAlarmTime(soe.getTs());
entity.setStatus(0);
// 通讯中断恢复
if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){
entity.setStatus(1);
}
return entity;
}).collect(Collectors.toList()));
}
/**
* 查询当天数据中断告警记录
* @param stations
* @return
*/
private List<InterruptionEntity> saveInterruptions(List<String> stations) {
Calendar calendar = Calendar.getInstance();
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
return this.interruptionAlarmService.list(Wrappers.<InterruptionEntity>lambdaQuery()
.in(InterruptionEntity::getStationId,stations)
.ge(InterruptionEntity::getCreateTime,start)
.le(InterruptionEntity::getCreateTime,end)
);
}
}

80
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/InterruptionAlarmServiceImpl.java

@ -36,85 +36,5 @@ import java.util.stream.Collectors;
@DS("alarm") @DS("alarm")
public class InterruptionAlarmServiceImpl extends BaseServiceImpl<InterruptionAlrmMapper, InterruptionEntity> implements InterruptionAlarmService { public class InterruptionAlarmServiceImpl extends BaseServiceImpl<InterruptionAlrmMapper, InterruptionEntity> implements InterruptionAlarmService {
private final StationService stationService;
private final ISoeClient soeClient;
/**
* 数据中断告警
* @param param
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void interruption(String param) {
// 查询接入站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getDataOrigin,"0")
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 查询告警数据: 间隔10分钟
SoeQueryConditionByStation query = new SoeQueryConditionByStation();
query.setTypes(InterruptionConstants.INTERRUPTION_TYPE);
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
Calendar calendar = Calendar.getInstance();
query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
calendar.add(Calendar.MINUTE,-10);
query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
query.setNeedPage(false);
query.setPage(1);
query.setLimit(1000);
Result<HzPage<SoeData>> result = soeClient.getByStationsAndTime(query);
// 未查询到告警信息
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())) {
return;
}
// 中断告警数据
List<SoeData> soes = result.getData().getRecords();
// 查询当天数据中断告警记录
List<InterruptionEntity> saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 批量保存中断告警数据
this.saveBatch(soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{
InterruptionEntity entity = new InterruptionEntity();
List<StationEntity> soeStations = stations.stream().filter(o->o.getCode().equals(soe.getStation())).collect(Collectors.toList());
if(!CollectionUtil.isEmpty(soeStations)){
entity.setStationId(soeStations.get(0).getCode());
entity.setStationName(soeStations.get(0).getName());
entity.setCreateDept(soeStations.get(0).getRefDept());
entity.setTenantId(soeStations.get(0).getTenantId());
}
entity.setAlarmId(soe.getId());
entity.setRealId(soe.getRealId());
entity.setSoeExplain(soe.getSoeExplain());
entity.setType(soe.getSoeType());
entity.setAlarmTime(soe.getTs());
entity.setStatus(0);
// 通讯中断恢复
if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){
entity.setStatus(1);
}
return entity;
}).collect(Collectors.toList()));
}
/**
* 查询当天数据中断告警记录
* @param stations
* @return
*/
private List<InterruptionEntity> saveInterruptions(List<String> stations) {
Calendar calendar = Calendar.getInstance();
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
return this.list(Wrappers.<InterruptionEntity>lambdaQuery()
.in(InterruptionEntity::getStationId,stations)
.ge(InterruptionEntity::getCreateTime,start)
.le(InterruptionEntity::getCreateTime,end)
);
}
} }

39
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java

@ -1,6 +1,7 @@
package com.hnac.hzinfo.inspect.task.service.impl; package com.hnac.hzinfo.inspect.task.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
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.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -10,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.safeproduct.Constants; import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity; import com.hnac.hzims.safeproduct.entity.ImsMonCameraInfoEntity;
import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient; import com.hnac.hzims.safeproduct.feign.IImsMonCameraInfoClient;
@ -51,6 +53,7 @@ import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -60,6 +63,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -100,6 +104,9 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
@Autowired @Autowired
private TaskNoUserDataScopeMapper taskNoUserDataScopeMapper; private TaskNoUserDataScopeMapper taskNoUserDataScopeMapper;
@Autowired
private RedisTemplate redisTemplate;
/** /**
* 正在调用开始任务的id集合 * 正在调用开始任务的id集合
*/ */
@ -526,11 +533,41 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
@Override @Override
public BladePage<TaskVo> page(TaskDTO taskDTO) { public BladePage<TaskVo> page(TaskDTO taskDTO) {
List<TaskVo> inspects = (List<TaskVo>) redisTemplate.opsForValue().get("inspect_list" + taskDTO.getCurrent() + taskDTO.getSize());
Long total = (Long) redisTemplate.opsForValue().get("inspect_list_total");
if(ObjectUtil.isEmpty(inspects) || ObjectUtil.isEmpty(total)){
Query query=new Query(); Query query=new Query();
query.setSize(taskDTO.getSize()); query.setSize(taskDTO.getSize());
query.setCurrent(taskDTO.getCurrent()); query.setCurrent(taskDTO.getCurrent());
IPage<TaskVo> pages = Condition.getPage(query); IPage<TaskVo> pages = Condition.getPage(query);
List<TaskVo> list = this.baseMapper.getAllPageList(pages,taskDTO); List<TaskVo> list = this.baseMapper.getAllPageList(pages,taskDTO);
List<TaskVo> limit = list.stream().peek(taskVo -> {
// 获取机器人信息
if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) ) {
if (Func.isNotEmpty( ObjectUtil.isNotEmpty(taskVo.getUserId()))) {
taskVo.setRobot(robotService.getDetailByUserId(taskVo.getUserId()));
}
}
}).collect(Collectors.toList());
pages.setRecords(limit);
redisTemplate.opsForValue().set("inspect_list" + taskDTO.getCurrent() + taskDTO.getSize(),limit);
redisTemplate.expire("inspect_list" + taskDTO.getCurrent() + taskDTO.getSize(),30, TimeUnit.SECONDS);
redisTemplate.opsForValue().set("inspect_list_total",pages.getTotal());
redisTemplate.expire("inspect_list_total",30, TimeUnit.SECONDS);
return BladePage.of(pages);
}
BladePage page = new BladePage();
page.setRecords(inspects);
page.setCurrent(taskDTO.getCurrent());
page.setSize(taskDTO.getSize());
page.setTotal(total);
return page;
/* Query query = new Query();
query.setSize(taskDTO.getSize());
query.setCurrent(taskDTO.getCurrent());
IPage<TaskVo> pages = Condition.getPage(query);
List<TaskVo> list = this.baseMapper.getAllPageList(pages,taskDTO);
list = list.stream().map(taskVo -> { list = list.stream().map(taskVo -> {
// 获取机器人信息 // 获取机器人信息
if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) ) { if (taskVo.getAutoVideo().equals(PlanContants.InspectTypeEnum.ROBOT.getVal()) ) {
@ -547,7 +584,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, TaskEntity> imp
}).collect(Collectors.toList()); }).collect(Collectors.toList());
pages.setRecords(list); pages.setRecords(list);
BladePage<TaskVo> bladePage = BladePage.of(pages); BladePage<TaskVo> bladePage = BladePage.of(pages);
return bladePage; return bladePage;*/
} }
private void getQueryWrapper(TaskDTO taskDTO, LambdaQueryWrapper<TaskEntity> queryWrapper) { private void getQueryWrapper(TaskDTO taskDTO, LambdaQueryWrapper<TaskEntity> queryWrapper) {

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessLibraryServiceImpl.java

@ -22,6 +22,7 @@ import com.hnac.hzims.operational.util.PdfUtils;
import com.hnac.hzims.safeproduct.feign.IDangerSourceClient; import com.hnac.hzims.safeproduct.feign.IDangerSourceClient;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
@ -187,6 +188,7 @@ public class OperAccessLibraryServiceImpl extends BaseServiceImpl<OperAccessLibr
continue; continue;
} }
OperAccessLibraryEntity library = new OperAccessLibraryEntity(); OperAccessLibraryEntity library = new OperAccessLibraryEntity();
row.getCell(1).setCellType(CellType.STRING);
library.setEmName(row.getCell(1).getStringCellValue()); library.setEmName(row.getCell(1).getStringCellValue());
library.setGradeCode(DictCache.getValue("gradeCode",row.getCell(2).getStringCellValue())); library.setGradeCode(DictCache.getValue("gradeCode",row.getCell(2).getStringCellValue()));
library.setLastServiceTime(row.getCell(3).getDateCellValue()); library.setLastServiceTime(row.getCell(3).getDateCellValue());
@ -199,6 +201,9 @@ public class OperAccessLibraryServiceImpl extends BaseServiceImpl<OperAccessLibr
this.save(library); this.save(library);
libraryId = library.getId(); libraryId = library.getId();
} }
//设置单元格类型
row.getCell(6).setCellType(CellType.STRING);
row.getCell(7).setCellType(CellType.STRING);
if(StringUtils.isNotEmpty(row.getCell(6).getStringCellValue()) if(StringUtils.isNotEmpty(row.getCell(6).getStringCellValue())
&& StringUtils.isNotEmpty(row.getCell(7).getStringCellValue())){ && StringUtils.isNotEmpty(row.getCell(7).getStringCellValue())){
OperAccessLibraryDetailEntity detail = new OperAccessLibraryDetailEntity(); OperAccessLibraryDetailEntity detail = new OperAccessLibraryDetailEntity();

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/dto/BusinessFileDto.java

@ -2,7 +2,6 @@ package com.hnac.hzims.operational.main.dto;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -25,7 +24,7 @@ public class BusinessFileDto {
private int operAccessTaskEntityCount; private int operAccessTaskEntityCount;
@ApiModelProperty(value = "消缺单") @ApiModelProperty(value = "消缺单")
private List<MainOperPhenomenonVo> operPhenomenonEntityList; private List<OperPhenomenonEntity> operPhenomenonEntityList;
@ApiModelProperty(value = "日常维护") @ApiModelProperty(value = "日常维护")
private List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList; private List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList;

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/dto/ScanDto.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.main.dto;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity; import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -30,7 +31,7 @@ public class ScanDto {
private int emInfoEntityCount; private int emInfoEntityCount;
@ApiModelProperty(value = "消缺单") @ApiModelProperty(value = "消缺单")
private List<OperDefectEntity> operDefectEntityList; private List<OperPhenomenonEntity> operDefectEntityList;
@ApiModelProperty(value = "日常维护") @ApiModelProperty(value = "日常维护")
private List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList; private List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList;

160
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/ScanServiceImpl.java

@ -4,37 +4,27 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient; import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.monitor.feign.IMonitorClient; import com.hnac.hzims.monitor.feign.IMonitorClient;
import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService; import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperDefectService; import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.vo.MainOperPhenomenonVo;
import com.hnac.hzims.operational.main.dto.BusinessFileDto; import com.hnac.hzims.operational.main.dto.BusinessFileDto;
import com.hnac.hzims.operational.main.dto.ScanDto; import com.hnac.hzims.operational.main.dto.ScanDto;
import com.hnac.hzims.operational.main.service.IScanService; import com.hnac.hzims.operational.main.service.IScanService;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.feign.IFlowClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
@Slf4j @Slf4j
@ -59,16 +49,12 @@ public class ScanServiceImpl implements IScanService {
@Override @Override
public ScanDto getData(String emCode) { public ScanDto getData(String emCode) {
ScanDto scanDto = new ScanDto(); ScanDto scanDto = new ScanDto();
//日常维护任务 //日常维护任务
List<OperMaintenanceTaskEntity> maintenanceTaskEntityList = maintenanceTaskService.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{ List<OperMaintenanceTaskEntity> maintenanceTaskEntityList = maintenanceTaskService.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
and(o -> o.eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_1).
or().eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_2).
or().eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_3).
or().eq(OperMaintenanceTaskEntity::getStatus, MaintenanceConstant.TASK_STATUS_4));
orderByDesc(OperMaintenanceTaskEntity::getCreateTime);
eq(OperMaintenanceTaskEntity::getEmCode, emCode); eq(OperMaintenanceTaskEntity::getEmCode, emCode);
ne(OperMaintenanceTaskEntity::getFlowTaskName,"结束");
orderByDesc(OperMaintenanceTaskEntity::getCreateTime);
}}); }});
if(CollectionUtil.isNotEmpty(maintenanceTaskEntityList)){ if(CollectionUtil.isNotEmpty(maintenanceTaskEntityList)){
scanDto.setOperMaintenanceTaskEntityCount(maintenanceTaskEntityList.size()); scanDto.setOperMaintenanceTaskEntityCount(maintenanceTaskEntityList.size());
@ -76,130 +62,25 @@ public class ScanServiceImpl implements IScanService {
} }
//检修任务 //检修任务
List<OperAccessTaskEntity> accessTaskEntityList = accessTaskService.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{ List<OperAccessTaskEntity> accessTaskEntityList = accessTaskService.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{
and(o -> o.eq(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_1).
or().eq(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_2).
or().eq(OperAccessTaskEntity::getStatus, AccessConstants.ACCESS_TASK_STATUS_3));
orderByDesc(OperAccessTaskEntity::getCreateTime);
eq(OperAccessTaskEntity::getEmCode, emCode); eq(OperAccessTaskEntity::getEmCode, emCode);
ne(OperAccessTaskEntity::getStatus, 4);
orderByDesc(OperAccessTaskEntity::getCreateTime);
}}); }});
if(CollectionUtil.isNotEmpty(maintenanceTaskEntityList)){ if(CollectionUtil.isNotEmpty(maintenanceTaskEntityList)){
scanDto.setOperAccessTaskEntityCount(accessTaskEntityList.size()); scanDto.setOperAccessTaskEntityCount(accessTaskEntityList.size());
scanDto.setOperAccessTaskEntityList(accessTaskEntityList); scanDto.setOperAccessTaskEntityList(accessTaskEntityList);
} }
//消缺单 //消缺单
List<OperDefectEntity> defectList = defectService.getDefectByEmCodeList(emCode); List<OperPhenomenonEntity> phenomenons = phenomenonService.list(new LambdaQueryWrapper<OperPhenomenonEntity>(){{
if (CollectionUtil.isNotEmpty(defectList)) { eq(OperPhenomenonEntity::getEmCode,emCode);
scanDto.setOperDefectEntityCount(defectList.size()); isNull(OperPhenomenonEntity::getHandleTaskId);
scanDto.setOperDefectEntityList(defectList); orderByDesc(OperPhenomenonEntity::getCreateTime);
} }});
if (CollectionUtil.isNotEmpty(phenomenons)) {
scanDto.setOperDefectEntityCount(phenomenons.size());
/*List<String> defectList = new ArrayList<>(); scanDto.setOperDefectEntityList(phenomenons);
List<String> maintenanceList = new ArrayList<>();
List<String> accesss = new ArrayList<>();
Date date = new Date();
log.info("--------------------开始时间--------:"+ DateUtil.format(date,DateUtil.PATTERN_DATETIME));
R<BladePage> defectAll = flowClient.todoList(CATEGORY_ID, null, 1, 9999);
if (defectAll.isSuccess()) {
BladePage data = defectAll.getData();
if (ObjectUtil.isNotEmpty(data) && CollectionUtil.isNotEmpty(data.getRecords())) {
List<Map> records = defectAll.getData().getRecords();
for (Map defect : records) {
if (defect.get("processDefinitionName").equals("巡检问题处理流程")) {
defectList.add(defect.get("businessId").toString());
} else if (defect.get("processDefinitionName").equals("日常维护流程")) {
maintenanceList.add(defect.get("businessId").toString());
} else if (defect.get("processDefinitionName").equals("检修任务执行流程")) {
accesss.add(defect.get("businessId").toString());
}
}
}
}
//消缺单
if (CollectionUtil.isNotEmpty(defectList)) {
List<OperDefectEntity> defectList1 = defectService.getDefectList(emCode, defectList);
if (CollectionUtil.isNotEmpty(defectList1)) {
scanDto.setOperDefectEntityCount(defectList1.size());
scanDto.setOperDefectEntityList(defectList1);
}
}
//日常维护任务
if (CollectionUtil.isNotEmpty(maintenanceList)) {
List<OperMaintenanceTaskEntity> operMaintenanceTaskEntities = maintenanceTaskService.getByEmCode(emCode, maintenanceList);
if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntities)) {
scanDto.setOperMaintenanceTaskEntityCount(operMaintenanceTaskEntities.size());
scanDto.setOperMaintenanceTaskEntityList(operMaintenanceTaskEntities);
}
}
//检修任务
if (CollectionUtil.isNotEmpty(accesss)) {
List<OperAccessTaskEntity> operAccessTaskEntities = accessTaskService.getByEmCode(emCode, accesss);
if (CollectionUtil.isNotEmpty(operAccessTaskEntities)) {
scanDto.setOperAccessTaskEntityCount(operAccessTaskEntities.size());
scanDto.setOperAccessTaskEntityList(operAccessTaskEntities);
}
}*/
/*//消缺单
R<BladePage> defectBladePageR = flowClient.todoList(CATEGORY_ID, "巡检问题处理流程", 1, 999);
log.info("defectBladePageR--------------------:" + defectBladePageR);
if (defectBladePageR.isSuccess()) {
List<Map> defects = defectBladePageR.getData().getRecords();
if (CollectionUtil.isNotEmpty(defects)) {
for (Map defect : defects) {
defectList.add(defect.get("businessId").toString());
}
if (CollectionUtil.isNotEmpty(defectList)) {
List<OperDefectEntity> defectList1 = defectService.getDefectList(emCode, defectList);
if (CollectionUtil.isNotEmpty(defectList1)) {
scanDto.setOperDefectEntityCount(defectList1.size());
scanDto.setOperDefectEntityList(defectList1);
}
}
}
}
//日常维护任务
R<BladePage> maintenanceBladePageR = flowClient.todoList(CATEGORY_ID, "日常维护流程", 1, 999);
List<Map> maintenances = maintenanceBladePageR.getData().getRecords();
if (CollectionUtil.isNotEmpty(maintenances)) {
for (Map maintenance : maintenances) {
log.info("------------------待办--------------------" + maintenance.get("businessId").toString());
maintenanceList.add(maintenance.get("businessId").toString());
}
if (CollectionUtil.isNotEmpty(maintenanceList)) {
List<OperMaintenanceTaskEntity> operMaintenanceTaskEntities = maintenanceTaskService.getByEmCode(emCode, maintenanceList);
if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntities)) {
scanDto.setOperMaintenanceTaskEntityCount(operMaintenanceTaskEntities.size());
scanDto.setOperMaintenanceTaskEntityList(operMaintenanceTaskEntities);
}
}
}
//检修任务
R<BladePage> accessBladePageR = flowClient.todoList(CATEGORY_ID, "检修任务执行流程", 1, 999);
List<Map> records = accessBladePageR.getData().getRecords();
if (CollectionUtil.isNotEmpty(records)) {
for (Map record : records) {
log.info("------------------待办--------------------" + record.get("businessId").toString());
accesss.add(record.get("businessId").toString());
}
if (CollectionUtil.isNotEmpty(accesss)) {
List<OperAccessTaskEntity> operAccessTaskEntities = accessTaskService.getByEmCode(emCode, accesss);
if (CollectionUtil.isNotEmpty(operAccessTaskEntities)) {
scanDto.setOperAccessTaskEntityCount(operAccessTaskEntities.size());
scanDto.setOperAccessTaskEntityList(operAccessTaskEntities);
}
} }
}*/
return scanDto; return scanDto;
} }
@Override @Override
public ScanDto getRealDataTimeAndDeviceFile(String emCode){ public ScanDto getRealDataTimeAndDeviceFile(String emCode){
@ -233,7 +114,7 @@ public class ScanServiceImpl implements IScanService {
//日常维护任务 //日常维护任务
List<OperMaintenanceTaskEntity> list = maintenanceTaskService.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{ List<OperMaintenanceTaskEntity> list = maintenanceTaskService.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
eq(OperMaintenanceTaskEntity::getEmCode, emCode); eq(OperMaintenanceTaskEntity::getEmCode, emCode);
eq(OperMaintenanceTaskEntity::getStatus, 5); eq(OperMaintenanceTaskEntity::getFlowTaskName, "结束");
}}); }});
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
dto.setOperMaintenanceTaskEntityCount(list.size()); dto.setOperMaintenanceTaskEntityCount(list.size());
@ -249,15 +130,14 @@ public class ScanServiceImpl implements IScanService {
dto.setOperAccessTaskEntityList(list1); dto.setOperAccessTaskEntityList(list1);
} }
//消缺单 //消缺单
/*List<OperPhenomenonEntity> list2 = phenomenonService.list(new LambdaQueryWrapper<OperPhenomenonEntity>() {{ List<OperPhenomenonEntity> phenomenons = phenomenonService.list(new LambdaQueryWrapper<OperPhenomenonEntity>(){{
eq(OperPhenomenonEntity::getEmCode,emCode); eq(OperPhenomenonEntity::getEmCode,emCode);
eq(OperPhenomenonEntity::getConclusionStatus, 1); isNotNull(OperPhenomenonEntity::getHandleTaskId);
}});*/ orderByDesc(OperPhenomenonEntity::getCreateTime);
}});
List<MainOperPhenomenonVo> listByStatus = phenomenonService.getListByStatus(emCode, DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()); if (CollectionUtil.isNotEmpty(phenomenons)) {
if (CollectionUtil.isNotEmpty(listByStatus)) { dto.setOperPhenomenonEntityList(phenomenons);
dto.setOperPhenomenonEntityCount(listByStatus.size()); dto.setOperPhenomenonEntityCount(phenomenons.size());
dto.setOperPhenomenonEntityList(listByStatus);
} }
return dto; return dto;

22
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -54,6 +54,7 @@ import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -64,6 +65,7 @@ import java.text.DecimalFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -85,6 +87,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
private final IEmInfoClient emInfoClient; private final IEmInfoClient emInfoClient;
private final ISysClient sysClient; private final ISysClient sysClient;
private final RedisTemplate redisTemplate;
@Override @Override
public R doSave(OperMaintenanceTaskDTO req) { public R doSave(OperMaintenanceTaskDTO req) {
req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999))); req.setTaskCode(this.genTaskCode(RandomUtils.nextInt(0, 999)));
@ -101,12 +105,28 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
@Override @Override
public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) { public R<IPage<OperMaintenanceTaskVO>> list(OperMaintenanceTaskDTO req) {
List<OperMaintenanceTaskVO> tasks = (List<OperMaintenanceTaskVO>) redisTemplate.opsForValue().get("main_list" + req.getCurrent() + req.getSize());
Long total = (Long) redisTemplate.opsForValue().get("main_list_total");
if(ObjectUtil.isEmpty(tasks) || ObjectUtil.isEmpty(total)){
Query query=new Query(); Query query=new Query();
query.setSize(req.getSize()); query.setSize(req.getSize());
query.setCurrent(req.getCurrent()); query.setCurrent(req.getCurrent());
Wrapper<OperMaintenanceTaskEntity> queryWrapper = getQueryWrapper(req); Wrapper<OperMaintenanceTaskEntity> queryWrapper = getQueryWrapper(req);
IPage pages = super.page(Condition.getPage(query), queryWrapper); IPage pages = super.page(Condition.getPage(query), queryWrapper);
pages.setRecords(OperMaintenanceTaskWrapper.build().listVO(pages.getRecords())); List<OperMaintenanceTaskVO> list = OperMaintenanceTaskWrapper.build().listVO(pages.getRecords());
pages.setRecords(list);
redisTemplate.opsForValue().set("main_list" + req.getCurrent() + req.getSize() , list);
redisTemplate.expire("main_list" + req.getCurrent() + req.getSize(),30, TimeUnit.SECONDS);
redisTemplate.opsForValue().set("main_list_total" , pages.getTotal());
redisTemplate.expire("main_list_total",30, TimeUnit.SECONDS);
return R.data(pages);
}
Query query=new Query();
query.setSize(req.getSize());
query.setCurrent(req.getCurrent());
IPage pages = Condition.getPage(query);
pages.setTotal(total);
pages.setRecords(tasks);
return R.data(pages); return R.data(pages);
} }

BIN
hzims-service/operational/src/main/resources/template/excel/access_import_template.xlsx

Binary file not shown.
Loading…
Cancel
Save