台站信息判空问题修改

探测器判空问题修改
This commit is contained in:
qiaoqinzheng 2023-05-26 16:56:00 +08:00
parent 18f8173a04
commit 1ffd4731ce
3 changed files with 23 additions and 18 deletions

View File

@ -47,8 +47,8 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
Page<GardsDetectors> page = new Page<>(queryRequest.getPageNo(), queryRequest.getPageSize());
Page<GardsDetectors> detectorsPage = this.baseMapper.findPage(page, gardsDetectors);
detectorsPage.getRecords().forEach(item->{
if (CollectionUtils.isNotEmpty(stationMap)) {
String stationValue = stationMap.get(item.getStationId());
if (CollectionUtils.isNotEmpty(stationMap) && Objects.nonNull(item.getStationId())) {
String stationValue = stationMap.get(item.getStationId().toString());
if (StringUtils.isNotBlank(stationValue)){
item.setStationName(stationValue);
}
@ -69,8 +69,8 @@ public class GardsDetectorsServiceImpl extends ServiceImpl<GardsDetectorsMapper,
if (Objects.isNull(gardsDetectors)) {
throw new RuntimeException("当前数据不存在");
}
if (CollectionUtils.isNotEmpty(stationMap)){
String stationValue = stationMap.get(gardsDetectors.getStationId());
if (CollectionUtils.isNotEmpty(stationMap) && Objects.nonNull(gardsDetectors.getStationId())){
String stationValue = stationMap.get(gardsDetectors.getStationId().toString());
if (StringUtils.isNotBlank(stationValue)){
gardsDetectors.setStationName(stationValue);
}

View File

@ -47,14 +47,14 @@ public class GardsSampleDataServiceImpl extends ServiceImpl<GardsSampleDataMappe
queryWrapper.le(Objects.nonNull(gardsSampleData.getCollectStop()) ,GardsSampleData::getCollectStop, gardsSampleData.getCollectStop());
Page<GardsSampleData> sampleDataPage = this.baseMapper.selectPage(page, queryWrapper);
sampleDataPage.getRecords().forEach(item->{
if (CollectionUtils.isNotEmpty(stationMap)){
String stationValue = stationMap.get(item.getStationId());
if (CollectionUtils.isNotEmpty(stationMap) && Objects.nonNull(item.getStationId())){
String stationValue = stationMap.get(item.getStationId().toString());
if (StringUtils.isNotBlank(stationValue)){
item.setStationName(stationValue);
}
}
if (CollectionUtils.isNotEmpty(detectorsMap)){
String detectorValue = detectorsMap.get(item.getDetectorId());
if (CollectionUtils.isNotEmpty(detectorsMap) && Objects.nonNull(item.getDetectorId())){
String detectorValue = detectorsMap.get(item.getDetectorId().toString());
if (StringUtils.isNotBlank(detectorValue)){
item.setDetectorsName(detectorValue);
}

View File

@ -96,12 +96,15 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl
if (CollectionUtils.isNotEmpty(sysTaskStations)){
//遍历所有台站信息并赋值台站名称
for (SysTaskStation taskStation:sysTaskStations) {
//通过台站id查询台站code
String stationValue = stationMap.get(taskStation.getStationId());
//如果台站数量大于0则说明有对应的台站信息
if (StringUtils.isNotBlank(stationValue)){
taskStation.setStationName(stationValue);
if (StringUtils.isNotBlank(taskStation.getStationId())){
//通过台站id查询台站code
String stationValue = stationMap.get(taskStation.getStationId());
//如果台站数量大于0则说明有对应的台站信息
if (StringUtils.isNotBlank(stationValue)){
taskStation.setStationName(stationValue);
}
}
}
//遍历排版任务信息
for (SysTaskVo taskVo:sysTaskVos) {
@ -151,11 +154,13 @@ public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> impl
if (CollectionUtils.isNotEmpty(taskStations)){
//遍历所有台站信息并赋值台站名称
for (SysTaskStation taskStation:taskStations) {
//通过stream流获取当前台站id对应的台站信息
String stationValue = stationMap.get(taskStation.getStationId());
//如果台站数量大于0则说明有对应的台站信息
if (StringUtils.isNotBlank(stationValue)){
taskStation.setStationName(stationValue);
if (StringUtils.isNotBlank(taskStation.getStationId())){
//通过stream流获取当前台站id对应的台站信息
String stationValue = stationMap.get(taskStation.getStationId());
//如果台站数量大于0则说明有对应的台站信息
if (StringUtils.isNotBlank(stationValue)){
taskStation.setStationName(stationValue);
}
}
}
for (SysTask sysTask:sysTasks) {