Commit 23a1e45d authored by duanruiming's avatar duanruiming

[update] 事件方向转向数据结构优化

parent 43fab979
......@@ -2,10 +2,10 @@ package net.wanji.datacenter.pojo.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author duanruiming
......@@ -17,7 +17,7 @@ public class EventDataDTO {
private String eventId;
private String crossId;
private String eventType;
private String direction;
private List<String> direction;
private Double eventLongitude;
private Double eventLatitude;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
......@@ -30,7 +30,7 @@ public class EventDataDTO {
/**
* add 20250107
*/
private String turn;
private List<String> turn;
private Double unbalanceIndex;
private Double spilloverIndex;
......
......@@ -12,12 +12,11 @@ import net.wanji.datacenter.pojo.po.EventInfoPO;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.*;
/**
* @author duanruiming
......@@ -63,7 +62,8 @@ public class EventDataServiceImpl implements EventDataService {
}
@NotNull
private static EventInfoPO getEventInfoPO(EventDataDTO eventDataDTO) {
private static EventInfoPO getEventInfoPO(EventDataDTO eventDataDTO) throws Exception{
ObjectMapper mapper = JacksonUtils.getInstance();
Map<String, Integer> crossIdGreenIdMap = CrossGreenWaveInfoCache.crossIdGreenIdMap;
EventInfoPO eventInfoPO = new EventInfoPO();
String crossId = eventDataDTO.getCrossId();
......@@ -82,7 +82,15 @@ public class EventDataServiceImpl implements EventDataService {
eventInfoPO.setLng(eventInfoPO.getLng());
eventInfoPO.setCategory(eventDataDTO.getEventLevel());
eventInfoPO.setPlaceDesc(eventDataDTO.getEventType());
eventInfoPO.setDir(eventDataDTO.getDirection());
List<String> directions = eventDataDTO.getDirection();
List<Integer> dirs = new ArrayList<>(directions.size());
if (!CollectionUtils.isEmpty(directions)) {
directions.forEach(item -> {
dirs.add(Integer.valueOf(item) + 1);
});
}
eventInfoPO.setDir(mapper.writeValueAsString(dirs));
eventInfoPO.setTurn(mapper.writeValueAsString(eventDataDTO.getTurn()));
eventInfoPO.setRuksj(new Date());
eventInfoPO.setAlarmStatus(eventDataDTO.getEventStatus());
// 默认未优化
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment