Commit e1f7a137 authored by zhoushiguang's avatar zhoushiguang

增加优化事件方向输出

parent 50a30adc
...@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.Objects;
/** /**
* @author duanruiming * @author duanruiming
...@@ -32,7 +33,7 @@ public class CommonUtils { ...@@ -32,7 +33,7 @@ public class CommonUtils {
*/ */
public static String getEventHappenDirName(String dir) { public static String getEventHappenDirName(String dir) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
if (StringUtils.isNotEmpty(dir)) { if (StringUtils.isNotEmpty(dir) && !Objects.equals("null",dir)) {
JSONArray dirArr = JSONArray.parseArray(dir); JSONArray dirArr = JSONArray.parseArray(dir);
for (int i = 0; i < dirArr.size(); i++) { for (int i = 0; i < dirArr.size(); i++) {
String dirName = DirEnum.getName(dirArr.getString(i)); String dirName = DirEnum.getName(dirArr.getString(i));
......
...@@ -42,4 +42,7 @@ public class TEventOptimizeInfoVO { ...@@ -42,4 +42,7 @@ public class TEventOptimizeInfoVO {
@ApiModelProperty(value = "时间数量") @ApiModelProperty(value = "时间数量")
private Integer eventNumber; private Integer eventNumber;
@ApiModelProperty(value = "增加事件方向")
private String dirName;
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.wanji.databus.po.EventOptimizeCountPo; import net.wanji.databus.po.EventOptimizeCountPo;
import net.wanji.opt.common.CommonUtils;
import net.wanji.opt.common.EsDateIndexUtil; import net.wanji.opt.common.EsDateIndexUtil;
import net.wanji.opt.dao.mapper.eventoptimize.TEventOptimizeInfoMapper; import net.wanji.opt.dao.mapper.eventoptimize.TEventOptimizeInfoMapper;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo; import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo;
...@@ -70,6 +71,7 @@ public class TEventOptimizeInfoServiceImpl extends ServiceImpl<TEventOptimizeInf ...@@ -70,6 +71,7 @@ public class TEventOptimizeInfoServiceImpl extends ServiceImpl<TEventOptimizeInf
TEventOptimizeInfoVO tEventOptimizeInfoVO = new TEventOptimizeInfoVO(); TEventOptimizeInfoVO tEventOptimizeInfoVO = new TEventOptimizeInfoVO();
BeanUtils.copyProperties(x, tEventOptimizeInfoVO); BeanUtils.copyProperties(x, tEventOptimizeInfoVO);
tEventOptimizeInfoVO.setEventLabal(getEventLabel1(x.getEventType())); tEventOptimizeInfoVO.setEventLabal(getEventLabel1(x.getEventType()));
tEventOptimizeInfoVO.setDirName(CommonUtils.getEventHappenDirName(x.getDir()));
tEventOptimizeInfoVO.setOptStatus(1); tEventOptimizeInfoVO.setOptStatus(1);
return tEventOptimizeInfoVO; return tEventOptimizeInfoVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
......
...@@ -39,13 +39,15 @@ ...@@ -39,13 +39,15 @@
<!-- 用于方案信号评价-路口优化记录查询(包含当日数据) --> <!-- 用于方案信号评价-路口优化记录查询(包含当日数据) -->
<select id="selectCrossOptimize" parameterType="map" resultType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo"> <select id="selectCrossOptimize" parameterType="map" resultType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo">
SELECT SELECT
cross_id, a.cross_id,
current_algo AS event_type, a.current_algo AS event_type,
issue_time AS opt_start_time, a.issue_time AS opt_start_time,
duration AS opt_duration, a.duration AS opt_duration,
DATE_ADD( issue_time, INTERVAL duration SECOND ) AS opt_end_time DATE_ADD( issue_time, INTERVAL a.duration SECOND ) AS opt_end_time,
(case when current_algo=1 then concat('[',empty_dir,']') else b.dir end) dir
FROM FROM
t_strategy_cross_result t_strategy_cross_result a
left join t_event_info b on a.event_id=b.event_serial_number
WHERE WHERE
1=1 1=1
<if test="startTime != null and endTime != null"> <if test="startTime != null and endTime != null">
...@@ -53,7 +55,7 @@ ...@@ -53,7 +55,7 @@
AND issue_time &lt; #{endTime} AND issue_time &lt; #{endTime}
</if> </if>
<if test="crossId != null" > <if test="crossId != null" >
AND cross_id = #{crossId} AND a.cross_id = #{crossId}
</if> </if>
AND response_code = 200 AND response_code = 200
</select> </select>
......
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