Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
Jone 3 months ago
parent
commit
6d1538f547
  1. 15
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StartStopScheduledTask.java
  2. 27
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java
  3. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/StartStopDurationService.java
  4. 9
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/StartStopDurationServiceImpl.java

15
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/StartStopScheduledTask.java

@ -12,6 +12,7 @@ import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import static com.hnac.hzims.operational.main.constant.ScheduledConstant.START_STOP_TIME_RECORD;
import static com.hnac.hzims.operational.main.constant.ScheduledConstant.THIS_DAY_START_STOP_RECORD; import static com.hnac.hzims.operational.main.constant.ScheduledConstant.THIS_DAY_START_STOP_RECORD;
@ -39,4 +40,18 @@ public class StartStopScheduledTask {
service.thisDayStartStopRecord(param); service.thisDayStartStopRecord(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
/**
* 设备开停机时间记录
*/
@XxlJob(START_STOP_TIME_RECORD)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> startStopTimeRecord() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.startStopTimeRecord(param);
return new ReturnT<>("SUCCESS");
}
} }

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

@ -23,10 +23,7 @@ import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.*;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.mqtt.producer.IMqttSender; import org.springblade.mqtt.producer.IMqttSender;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -228,15 +225,19 @@ public class AlarmServiceImpl implements AlarmService {
List<SoeData> soes = result.getData().getRecords(); List<SoeData> soes = result.getData().getRecords();
// 查询当天数据中断告警记录 // 查询当天数据中断告警记录
List<InterruptionEntity> saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); List<InterruptionEntity> saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
List<InterruptionEntity> entities = soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{ List<InterruptionEntity> entities = soes.stream().filter(
o -> (CollectionUtil.isEmpty(saves) || !saves.stream().map(itr -> itr.getStationId() + itr.getRealId() + itr.getAlarmTime()).collect(Collectors.toList()).contains(o.getStation() + o.getRealId() + o.getTs()))
&& StringUtil.isNotBlank(o.getStation())).map(soe->{
InterruptionEntity entity = new InterruptionEntity(); InterruptionEntity entity = new InterruptionEntity();
List<StationEntity> soeStations = stations.stream().filter(o->o.getCode().equals(soe.getStation())).collect(Collectors.toList()); Optional<StationEntity> optional = stations.stream().filter(o->o.getCode().equals(soe.getStation())).findFirst();
if(!CollectionUtil.isEmpty(soeStations)){ if(optional.isPresent()){
entity.setStationId(soeStations.get(0).getCode()); entity.setStationId(optional.get().getCode());
entity.setStationName(soeStations.get(0).getName()); entity.setStationName(optional.get().getName());
entity.setCreateDept(soeStations.get(0).getRefDept()); entity.setCreateDept(optional.get().getRefDept());
entity.setTenantId(soeStations.get(0).getTenantId()); entity.setTenantId(optional.get().getTenantId());
entity.setCreateUser(soeStations.get(0).getCreateUser()); entity.setCreateUser(optional.get().getCreateUser());
}else{
entity.setStationId(soe.getStation());
} }
entity.setAlarmId(soe.getId()); entity.setAlarmId(soe.getId());
entity.setRealId(soe.getRealId()); entity.setRealId(soe.getRealId());
@ -248,8 +249,6 @@ public class AlarmServiceImpl implements AlarmService {
if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){ if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){
entity.setStatus(1); entity.setStatus(1);
} }
return entity; return entity;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if(CollectionUtil.isEmpty(entities)){ if(CollectionUtil.isEmpty(entities)){

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/StartStopDurationService.java

@ -9,4 +9,6 @@ import com.hnac.hzims.equipment.entity.StartStopDurationEntity;
public interface StartStopDurationService extends IService<StartStopDurationEntity> { public interface StartStopDurationService extends IService<StartStopDurationEntity> {
void thisDayStartStopRecord(String param); void thisDayStartStopRecord(String param);
void startStopTimeRecord(String param);
} }

9
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/StartStopDurationServiceImpl.java

@ -149,6 +149,15 @@ public class StartStopDurationServiceImpl extends ServiceImpl<StartStopDurationM
} }
/** /**
* 设备开停机时长记录
* @param param
*/
@Override
public void startStopTimeRecord(String param) {
}
/**
* 过滤相邻开关机状态相同数据 * 过滤相邻开关机状态相同数据
* @param sources * @param sources
* @return * @return

Loading…
Cancel
Save