1.添加登录模块
This commit is contained in:
@@ -11,6 +11,7 @@ import com.njcn.influx.mapper.PqDeviceMapper;
|
||||
import com.njcn.influx.mapper.RmpEventDetailPOMapper;
|
||||
import com.njcn.influx.service.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -29,6 +30,9 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class OracleMonitorStatusToMysqlServiceImpl implements OracleMonitorStatusToMysqlService {
|
||||
|
||||
@Value("${business.type}")
|
||||
private Integer systemType;
|
||||
|
||||
private final RmpEventDetailPOMapper rmpEventDetailPOMapper;
|
||||
private final IPqDeviceBakService pqDeviceBakService;
|
||||
private final PqDeviceMapper pqDeviceMapper;
|
||||
@@ -54,48 +58,53 @@ public class OracleMonitorStatusToMysqlServiceImpl implements OracleMonitorStatu
|
||||
Map<Long, String> oracleDevMysql = list.stream().collect(Collectors.toMap(PqDeviceBak::getDevId, PqDeviceBak::getId));
|
||||
List<PqDevice> pqDevices = pqDeviceMapper.selectList(null);
|
||||
//pq的设备表更改通信状态
|
||||
List<PqDeviceMysql> tempList = new ArrayList<>();
|
||||
pqDevices.stream().forEach(temp->{
|
||||
String id ="";
|
||||
if (!IdMappingCache.DevIdMapping.containsKey(temp.getDevIndex()+"")){
|
||||
return;
|
||||
}else {
|
||||
id=IdMappingCache.DevIdMapping.get(temp.getDevIndex()+"");
|
||||
}
|
||||
pqDeviceMysqlService.update(new LambdaUpdateWrapper<PqDeviceMysql>()
|
||||
.set(PqDeviceMysql::getRunFlag,temp.getDevFlag())
|
||||
.set(PqDeviceMysql::getComFlag,temp.getStatus())
|
||||
.set(PqDeviceMysql::getUpdateTime,temp.getUpdateTime())
|
||||
.eq(PqDeviceMysql::getId,id));
|
||||
|
||||
});
|
||||
|
||||
Map<Integer, List<Long>> oracleDevMap = pqDevices.stream().collect(Collectors.groupingBy(PqDevice::getDevFlag
|
||||
, Collectors.mapping(PqDevice::getDevIndex, Collectors.toList())));
|
||||
oracleDevMap.forEach((key, value) -> {
|
||||
List<String> info = new ArrayList<>();
|
||||
for (Long aLong : value) {
|
||||
if (oracleDevMysql.containsKey(aLong)) {
|
||||
info.add(oracleDevMysql.get(aLong));
|
||||
if(systemType == 0){
|
||||
List<PqDeviceMysql> tempList = new ArrayList<>();
|
||||
pqDevices.stream().forEach(temp->{
|
||||
String id ="";
|
||||
if (!IdMappingCache.DevIdMapping.containsKey(temp.getDevIndex()+"")){
|
||||
return;
|
||||
}else {
|
||||
id=IdMappingCache.DevIdMapping.get(temp.getDevIndex()+"");
|
||||
}
|
||||
}
|
||||
String devStatus = devStatusId(key, devDicList);
|
||||
String monitorStatus = monitorStatusId(key, monitorDicList);
|
||||
if (StrUtil.isNotBlank(devStatus) && CollUtil.isNotEmpty(info)) {
|
||||
//修改终端状态
|
||||
pmsTerminalService.update(new LambdaUpdateWrapper<PmsTerminal>()
|
||||
.set(PmsTerminal::getTerminalState, devStatusId(key, devDicList))
|
||||
.in(PmsTerminal::getId, info)
|
||||
);
|
||||
}
|
||||
if (StrUtil.isNotBlank(monitorStatus) && CollUtil.isNotEmpty(info)) {
|
||||
//修改监测点状态
|
||||
pmsMonitorService.update(new LambdaUpdateWrapper<PmsMonitor>()
|
||||
.set(PmsMonitor::getMonitorState, monitorStatusId(key, monitorDicList))
|
||||
.in(PmsMonitor::getTerminalId, info)
|
||||
);
|
||||
}
|
||||
});
|
||||
pqDeviceMysqlService.update(new LambdaUpdateWrapper<PqDeviceMysql>()
|
||||
.set(PqDeviceMysql::getRunFlag,temp.getDevFlag())
|
||||
.set(PqDeviceMysql::getComFlag,temp.getStatus())
|
||||
.set(PqDeviceMysql::getUpdateTime,temp.getUpdateTime())
|
||||
.eq(PqDeviceMysql::getId,id));
|
||||
|
||||
});
|
||||
}else {
|
||||
Map<Integer, List<Long>> oracleDevMap = pqDevices.stream().collect(Collectors.groupingBy(PqDevice::getDevFlag
|
||||
, Collectors.mapping(PqDevice::getDevIndex, Collectors.toList())));
|
||||
oracleDevMap.forEach((key, value) -> {
|
||||
List<String> info = new ArrayList<>();
|
||||
for (Long aLong : value) {
|
||||
if (oracleDevMysql.containsKey(aLong)) {
|
||||
info.add(oracleDevMysql.get(aLong));
|
||||
}
|
||||
}
|
||||
String devStatus = devStatusId(key, devDicList);
|
||||
String monitorStatus = monitorStatusId(key, monitorDicList);
|
||||
if (StrUtil.isNotBlank(devStatus) && CollUtil.isNotEmpty(info)) {
|
||||
//修改终端状态
|
||||
pmsTerminalService.update(new LambdaUpdateWrapper<PmsTerminal>()
|
||||
.set(PmsTerminal::getTerminalState, devStatusId(key, devDicList))
|
||||
.in(PmsTerminal::getId, info)
|
||||
);
|
||||
}
|
||||
if (StrUtil.isNotBlank(monitorStatus) && CollUtil.isNotEmpty(info)) {
|
||||
//修改监测点状态
|
||||
pmsMonitorService.update(new LambdaUpdateWrapper<PmsMonitor>()
|
||||
.set(PmsMonitor::getMonitorState, monitorStatusId(key, monitorDicList))
|
||||
.in(PmsMonitor::getTerminalId, info)
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user