定版bug修改
This commit is contained in:
@@ -60,7 +60,9 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -194,26 +196,38 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
@Override
|
||||
public CommunicateVO getComFlagInfoData(String id, String searchBeginTime, String searchEndTime) {
|
||||
CommunicateVO communicateVOList = new CommunicateVO();
|
||||
String devId = lineMapper.getDevIndex(id);
|
||||
Device device = deviceMapper.selectById(devId);
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
List<PqsCommunicate> communicateList = getCommunicate(devId, searchBeginTime, searchEndTime);
|
||||
CommunicateVO communicateVOList = new CommunicateVO();
|
||||
DateTime begin = DateUtil.beginOfDay(DateUtil.parse(searchBeginTime));
|
||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(searchEndTime));
|
||||
DateTime login = DateUtil.parse(device.getLoginTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
||||
if (end.isBefore(login)) {
|
||||
//结束时间比终端投运时间前,则直接返回空
|
||||
return communicateVOList;
|
||||
}
|
||||
if(begin.isBefore(login)){
|
||||
//开始时间大于投运时间,取投运时间
|
||||
begin = login;
|
||||
}
|
||||
|
||||
List<PqsCommunicate> communicateList = getCommunicate(devId, begin, end);
|
||||
List<String> updateTime = new ArrayList<>();
|
||||
List<Integer> comType = new ArrayList<>();
|
||||
//开始时间
|
||||
Boolean beginFly = false;
|
||||
boolean beginFly = false;
|
||||
if (CollUtil.isNotEmpty(communicateList)) {
|
||||
if (!communicateList.get(0).getTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())) {
|
||||
if (!communicateList.get(0).getTime().equals(begin.toInstant())) {
|
||||
beginFly = true;
|
||||
}
|
||||
} else {
|
||||
beginFly = true;
|
||||
}
|
||||
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (beginFly) {
|
||||
Instant instant = DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant();
|
||||
Instant instant = begin.toInstant();
|
||||
Long time = instant.toEpochMilli();
|
||||
|
||||
String timeText = df.format(time);
|
||||
updateTime.add(timeText);
|
||||
//取反(正常来时,有变动才会有数据)
|
||||
@@ -242,7 +256,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
String format = times.format(date);
|
||||
Instant endTime = DateUtil.parse(searchEndTime + " " + format).toInstant();
|
||||
|
||||
Boolean endFly = false;
|
||||
boolean endFly = false;
|
||||
if (CollUtil.isNotEmpty(communicateList)) {
|
||||
if (!communicateList.get(communicateList.size() - 1).getTime().equals(endTime)) {
|
||||
endFly = true;
|
||||
@@ -751,7 +765,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
List<String> ids = result.stream().map(LineDetail::getId).distinct().collect(Collectors.toList());
|
||||
List<Line> lineList = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId, ids).eq(Line::getState, DataStateEnum.ENABLE.getCode()));
|
||||
Map<String, Line> lineMap = lineList.stream().collect(Collectors.toMap(Line::getId, Function.identity()));
|
||||
result.forEach(item->item.setMonitorName(lineMap.getOrDefault(item.getId(),new Line()).getName()));
|
||||
result.forEach(item -> item.setMonitorName(lineMap.getOrDefault(item.getId(), new Line()).getName()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -760,17 +774,17 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
public List<PollutionSubstationDTO> getPowerStationByMonitorIds(List<String> ids) {
|
||||
List<PollutionSubstationDTO> result = new ArrayList<>();
|
||||
List<LineDetail> lineDetailList = lineDetailMapper.selectList(new LambdaQueryWrapper<LineDetail>().in(LineDetail::getId, ids));
|
||||
List<LineDetail> userLedgerList = lineDetailList.stream().filter(it->StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
List<LineDetail> powerLedgerList = lineDetailList.stream().filter(it->StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
List<LineDetail> userLedgerList = lineDetailList.stream().filter(it -> StrUtil.isNotBlank(it.getObjId())).collect(Collectors.toList());
|
||||
List<LineDetail> powerLedgerList = lineDetailList.stream().filter(it -> StrUtil.isBlank(it.getObjId())).collect(Collectors.toList());
|
||||
|
||||
if(CollUtil.isNotEmpty(userLedgerList)){
|
||||
List<String> objIds = userLedgerList.stream().map(LineDetail::getObjId).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(userLedgerList)) {
|
||||
List<String> objIds = userLedgerList.stream().map(LineDetail::getObjId).distinct().collect(Collectors.toList());
|
||||
List<NewUserReportVO> newUserReportVOList = userLedgerFeignClient.getUserReportByIds(objIds).getData();
|
||||
Map<String,NewUserReportVO> map = newUserReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId,Function.identity()));
|
||||
Map<String, NewUserReportVO> map = newUserReportVOList.stream().collect(Collectors.toMap(NewUserReportVO::getId, Function.identity()));
|
||||
|
||||
List<DictData> dictDataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String,DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
map.forEach((objId,item)->{
|
||||
Map<String, DictData> dictDataMap = dictDataList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
map.forEach((objId, item) -> {
|
||||
PollutionSubstationDTO pollutionSubstationDTO = new PollutionSubstationDTO();
|
||||
pollutionSubstationDTO.setPowerFlag(PowerFlagEnum.NO_GRID_SIDE.getCode());
|
||||
pollutionSubstationDTO.setId(objId);
|
||||
@@ -782,11 +796,11 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
});
|
||||
|
||||
}
|
||||
if(CollUtil.isNotEmpty(powerLedgerList)){
|
||||
if (CollUtil.isNotEmpty(powerLedgerList)) {
|
||||
List<Line> lineList = lineMapper.selectList(new LambdaQueryWrapper<Line>().in(Line::getId, powerLedgerList.stream().map(LineDetail::getId).distinct().collect(Collectors.toList())).eq(Line::getState, DataStateEnum.ENABLE.getCode()));
|
||||
List<String> stationIds = lineList.stream().map(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).collect(Collectors.toList());
|
||||
List<String> stationIds = lineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]).collect(Collectors.toList());
|
||||
List<SubstationDTO> stationList = substationMapper.getSubstationById(stationIds);
|
||||
stationList.forEach(item->{
|
||||
stationList.forEach(item -> {
|
||||
PollutionSubstationDTO pollutionSubstationDTO = new PollutionSubstationDTO();
|
||||
pollutionSubstationDTO.setPowerFlag(PowerFlagEnum.GRID_SIDE.getCode());
|
||||
pollutionSubstationDTO.setId(item.getId());
|
||||
@@ -881,10 +895,9 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
return child.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<PqsCommunicate> getCommunicate(String devId, String startTime, String endTime) {
|
||||
public List<PqsCommunicate> getCommunicate(String devId, DateTime startTime, DateTime endTime) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||
influxQueryWrapper.between(InfluxDbSqlConstant.TIME, DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(), DateUtil.endOfDay(DateUtil.parse(endTime)).toString())
|
||||
.eq(PqsCommunicate::getDevId, devId);
|
||||
influxQueryWrapper.eq(PqsCommunicate::getDevId, devId).between(InfluxDbSqlConstant.TIME, startTime.toString(), endTime.toString());
|
||||
return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -901,8 +914,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
}
|
||||
NewUserReportVO newUserReportVO;
|
||||
for (AreaLineInfoVO areaLineInfoVO : resList) {
|
||||
if(StrUtil.isNotBlank(areaLineInfoVO.getObjId())){
|
||||
if(userReportVOMap.containsKey(areaLineInfoVO.getObjId())){
|
||||
if (StrUtil.isNotBlank(areaLineInfoVO.getObjId())) {
|
||||
if (userReportVOMap.containsKey(areaLineInfoVO.getObjId())) {
|
||||
newUserReportVO = userReportVOMap.get(areaLineInfoVO.getObjId());
|
||||
areaLineInfoVO.setSubId(newUserReportVO.getId());
|
||||
areaLineInfoVO.setSubName(newUserReportVO.getProjectName());
|
||||
|
||||
Reference in New Issue
Block a user