查询台站运行管理树形结构,增加深拷贝集合的方法
This commit is contained in:
parent
bf6b784e78
commit
ed5ca585b1
|
@ -23,9 +23,11 @@ import org.jeecg.modules.system.entity.GardsNuclearfacility;
|
||||||
import org.jeecg.modules.system.entity.GardsStations;
|
import org.jeecg.modules.system.entity.GardsStations;
|
||||||
import org.jeecg.modules.mapper.StationOperationMapper;
|
import org.jeecg.modules.mapper.StationOperationMapper;
|
||||||
import org.jeecg.modules.service.IStationOperationService;
|
import org.jeecg.modules.service.IStationOperationService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -206,6 +208,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
||||||
if (Objects.isNull(radius)) {
|
if (Objects.isNull(radius)) {
|
||||||
result.error500("请传入半径");
|
result.error500("请传入半径");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
if (CollectionUtils.isNotEmpty(stationIds)){
|
if (CollectionUtils.isNotEmpty(stationIds)){
|
||||||
//查询全部台站信息
|
//查询全部台站信息
|
||||||
HashMap<String, Object> stationInfoMap = (HashMap<String, Object>) redisUtil.get("stationInfoMap");
|
HashMap<String, Object> stationInfoMap = (HashMap<String, Object>) redisUtil.get("stationInfoMap");
|
||||||
|
@ -235,8 +238,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
||||||
GardsStations point = (GardsStations)stationInfoMap.get(stationId);
|
GardsStations point = (GardsStations)stationInfoMap.get(stationId);
|
||||||
stationsList.add(point);
|
stationsList.add(point);
|
||||||
//声明一个数组存储对应的核设施经纬度信息
|
//声明一个数组存储对应的核设施经纬度信息
|
||||||
List<Point> nuclearFacilityPoints = new ArrayList<>();
|
List<Point> nuclearFacilityPoints = deepCopy(nuclearPoints);
|
||||||
nuclearFacilityPoints.addAll(nuclearPoints);
|
|
||||||
//获取当前查询的台站名称
|
//获取当前查询的台站名称
|
||||||
String stationName = point.getStationCode();
|
String stationName = point.getStationCode();
|
||||||
//获取当前查询的经度 即 圆心位置经度信息
|
//获取当前查询的经度 即 圆心位置经度信息
|
||||||
|
@ -272,17 +274,47 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
|
||||||
p.setRadius(String.valueOf(radiusR));
|
p.setRadius(String.valueOf(radiusR));
|
||||||
p.setStationName(stationName);
|
p.setStationName(stationName);
|
||||||
}
|
}
|
||||||
|
if (CollectionUtils.isNotEmpty(nuclearFacilityPoints)){
|
||||||
resultList.add(nuclearFacilityPoints);
|
resultList.add(nuclearFacilityPoints);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
map.put("GIS", stationsList.stream().distinct().collect(Collectors.toList()));
|
map.put("GIS", stationsList.stream().distinct().collect(Collectors.toList()));
|
||||||
map.put("table", resultList);
|
map.put("table", resultList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
result.setSuccess(true);
|
result.setSuccess(true);
|
||||||
result.setResult(map);
|
result.setResult(map);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过序列化的方式对list进行深复制
|
||||||
|
*
|
||||||
|
* @param src
|
||||||
|
* @param <T>
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
* @throws ClassNotFoundException
|
||||||
|
*/
|
||||||
|
public static <T> List<T> deepCopy(List<T> src) throws IOException, ClassNotFoundException {
|
||||||
|
|
||||||
|
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream out = new ObjectOutputStream(byteOut);
|
||||||
|
out.writeObject(src);
|
||||||
|
|
||||||
|
ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
|
||||||
|
ObjectInputStream in = new ObjectInputStream(byteIn);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
List<T> dest = (List<T>) in.readObject();
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result getDataReceivingStatus(List<String> stationIds) {
|
public Result getDataReceivingStatus(List<String> stationIds) {
|
||||||
Result result = new Result();
|
Result result = new Result();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user