|
|
@@ -2,7 +2,6 @@ package com.sooka.sponest.monitor.channelrail.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
|
|
import com.sooka.sponest.monitor.channelrail.domain.ChannelRail;
|
|
|
import com.sooka.sponest.monitor.channelrail.mapper.ChannelRailMapper;
|
|
|
import com.sooka.sponest.monitor.channelrail.service.IChannelRailService;
|
|
|
@@ -43,33 +42,30 @@ public class ChannelRailServiceImpl implements IChannelRailService {
|
|
|
List<JSONObject> channels = JSONObject.parseArray(jsonObject.getString("channelInfos"), JSONObject.class);
|
|
|
channels = channels.stream().map(channel -> {
|
|
|
if (channel.getString("channelCode").equals(channelRail.getChannelId())) {
|
|
|
- List<Map<String, Object>> points = new ArrayList<>();
|
|
|
- List<JSONObject> polygons = JSONObject.parseArray(JSONObject.parseObject(channelRail.getJsonData()).getString("polygons"), JSONObject.class);
|
|
|
- polygons.forEach(item -> {
|
|
|
- Map<String, Object> point = new HashMap<>();
|
|
|
- point.put("taskId", jsonObject.getLong("id"));
|
|
|
- point.put("presetPointId", channelRail.getPointId());
|
|
|
- point.put("pointName", channelRail.getPointName());
|
|
|
- List<Map<String, Object>> channelCutInfos = new ArrayList<>();
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("taskId", jsonObject.getLong("id"));
|
|
|
- map.put("pointId", channelRail.getPointId());
|
|
|
- map.put("pointName", channelRail.getPointName());
|
|
|
- map.put("type", channelRail.getType());
|
|
|
- item.remove("lineColor");
|
|
|
- item.remove("fillColor");
|
|
|
- item.remove("lineWidth");
|
|
|
- map.put("areaPoints", item.toJSONString());
|
|
|
- map.put("channelCode", channel.getString("channelCode"));
|
|
|
- map.put("channelName", channel.getString("channelName"));
|
|
|
- channelCutInfos.add(map);
|
|
|
- point.put("channelCutInfos", channelCutInfos);
|
|
|
- point.put("channelCode", channel.getString("channelCode"));
|
|
|
- point.put("channelName", channel.getString("channelName"));
|
|
|
- point.put("pointType", 1);
|
|
|
- points.add(point);
|
|
|
- });
|
|
|
- channel.put("channelPresetPointVOS", points);
|
|
|
+ List<JSONObject> channelPresetPointVOS = JSONObject.parseArray(channel.getString("channelPresetPointVOS"), JSONObject.class);
|
|
|
+ channelPresetPointVOS = channelPresetPointVOS.stream().map(channelPresetPointVO -> {
|
|
|
+ if (channelPresetPointVO.getLong("presetPointId").equals(channelRail.getPointId())) {
|
|
|
+ List<Map<String, Object>> channelCutInfos = new ArrayList<>();
|
|
|
+ List<JSONObject> polygons = JSONObject.parseArray(JSONObject.parseObject(channelRail.getJsonData()).getString("polygons"), JSONObject.class);
|
|
|
+ polygons.forEach(item -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("taskId", jsonObject.getLong("id"));
|
|
|
+ map.put("pointId", channelRail.getPointId());
|
|
|
+ map.put("pointName", channelRail.getPointName());
|
|
|
+ map.put("type", channelRail.getType());
|
|
|
+ item.remove("lineColor");
|
|
|
+ item.remove("fillColor");
|
|
|
+ item.remove("lineWidth");
|
|
|
+ map.put("areaPoints", item.toJSONString());
|
|
|
+ map.put("channelCode", channel.getString("channelCode"));
|
|
|
+ map.put("channelName", channel.getString("channelName"));
|
|
|
+ channelCutInfos.add(map);
|
|
|
+ });
|
|
|
+ channelPresetPointVO.put("channelCutInfos", channelCutInfos);
|
|
|
+ }
|
|
|
+ return channelPresetPointVO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ channel.put("channelPresetPointVOS", channelPresetPointVOS);
|
|
|
}
|
|
|
return channel;
|
|
|
}).collect(Collectors.toList());
|