Commit e886bb8a authored by 黄伟铭's avatar 黄伟铭

Merge remote-tracking branch 'origin/master'

parents 6879bee8 f223e189
......@@ -3,10 +3,9 @@ package net.wanji.opt.controllerv2;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
import net.wanji.opt.servicev2.CrossService;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import net.wanji.opt.vo2.CrossBaseInfoVO;
import net.wanji.opt.vo2.CrossRealTimeAlarmVO;
import net.wanji.opt.vo2.CrossStatusDistributionVO;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -15,7 +14,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author zhengyifan
......@@ -29,7 +30,6 @@ public class CrossController {
@Resource
private CrossService crossService;
//@ApiOperation(value = "路口状态分布", notes = "路口状态分布", response = JsonViewObject.class, httpMethod="GET")
@GetMapping("/getCrossStatusDistribution")
@ApiOperation(httpMethod="GET",value="路口状态分布", notes="路口状态分布")
@ApiImplicitParams({
......@@ -37,7 +37,7 @@ public class CrossController {
@ApiImplicitParam(name = "groupType", value = "时间粒度 0--5分钟 1--15分钟 2--30分钟 3--60分钟", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "date", value = "日期 格式:yyyy-MM-dd", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "objectType", value = "范围 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "directionName", value = "方向 支持 北进口;东进口;南进口;西进口", dataType = "String", defaultValue = "北进口;东进口;南进口;西进口"),
@ApiImplicitParam(name = "directionName", value = "方向 支持 北进口;东进口;南进口;西进口", dataType = "String", defaultValue = ""),
})
@ApiResponses({
......@@ -46,8 +46,9 @@ public class CrossController {
public JsonViewObject getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String directionName) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
Map<String, Object> map = new HashMap<>();
String[] dirs = directionName.split(";");
if (directionName != null) {
String[] dirs = directionName.split(";");
for (String dir : dirs) {
String dirName = "";
switch (dir) {
......@@ -73,6 +74,15 @@ public class CrossController {
return jsonViewObject.fail("路口状态分布查询失败");
}
}
} else {
try {
List<CrossStatusDistributionVO> info = crossService.getCrossStatusDistribution(crossID, date, groupType, objectType, null);
map.put("infoList", info);
} catch (Exception e) {
log.error("监测详情-路口事件详情-路口状态分布: ", e);
return jsonViewObject.fail("路口状态分布查询失败");
}
}
map.put("optTimeList", crossService.getOptTimeList(crossID));
......@@ -100,4 +110,23 @@ public class CrossController {
return jsonViewObject.success(result);
}
@ApiOperation(value = "路口基础信息", notes = "路口基础信息", response = JsonViewObject.class, httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"),
})
@GetMapping(value = "/getCrossBaseInfo")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossBaseInfoVO.class)
})
public JsonViewObject getCrossBaseInfo(String crossID) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
CrossBaseInfoVO result;
try {
result = crossService.getCrossBaseInfos(crossID);
} catch (Exception e) {
log.error("监测详情-路口事件详情-路口基础信息: ", e);
return jsonViewObject.fail("路口基础信息查询失败");
}
return jsonViewObject.success(result);
}
}
package net.wanji.opt.controllerv2.evaluation;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.rest.impl.AbstractRestServerImpl;
import net.wanji.opt.servicev2.evaluation.EventInfoService;
import net.wanji.opt.entity.evaluation.EventInfo;
import net.wanji.common.framework.rest.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiImplicitParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 交通事件信息 接口API
* </p>
* @version 1.0
* @author wangtao
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/event-info")
@Api(value="EventInfoController", description="交通事件信息接口", tags = "交通事件信息")
public class EventInfoController extends AbstractRestServerImpl<EventInfo> implements AbstractRestServer<EventInfo>{
@Autowired
private EventInfoService eventInfoService;
@Override
public EventInfoService getBaseDubboInterface() {
return this.eventInfoService;
}
/**
* 获取所有交通事件信息记录
*
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-获取所有记录", notes = "获取所有交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getAll() {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
List<EventInfo> list = this.getBaseDubboInterface().findAll();
jsonView.success(list);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
@ApiOperation(value = "交通事件信息-根据开始以及结束时间查询交通事件信息", notes = "获取所有交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", required = true, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", required = true, dataType = "String"),
@ApiImplicitParam(name = "crossId", value = "路口id", required = true, dataType = "String"),
})
@GetMapping(value = "getListByStartAndEnd")
public JsonViewObject getListByStartAndEnd(String startTime, String endTime, String crossId){
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
Map<String, Object> map = new HashMap<>();
map.put("startTime",startTime);
map.put("endTime",endTime);
map.put("crossId",crossId);
try {
List<EventInfo> list = this.getBaseDubboInterface().getListByStartAndEnd(map);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
}
/**
* 根据id查询交通事件信息记录
*
* @param id
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-根据id查询记录", notes = "根据id查询交通事件信息记录", response = EventInfo.class, produces = MediaType.APPLICATION_JSON,hidden = true)
@GetMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getById(@PathVariable String id) {
JsonViewObject jsonView = JsonViewObject.newInstance();
long start=System.currentTimeMillis();
try {
EventInfo entity = this.getBaseDubboInterface().findById(id);
jsonView.success(entity);
} catch (DubboProviderException e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("AbstractRestServerImpl getById error, id:{}", id, e);
}
return jsonView;
}
@ApiOperation(value = "交通事件信息-根据条件查询记录", notes = "根据条件查询记录", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@Override
public JsonViewObject getByWhere(@RequestBody EventInfo entity) {
return super.getByWhere(entity);
}
@ApiOperation(value = "交通事件信息-根据条件分页查询记录", notes = "根据条件分页查询记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/byPage", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ResponseBody
public JsonViewObject getPage(@RequestBody Page<EventInfo> page){
return super.getPage(page);
}
/**
* 根据id删除
*
* @param ids
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-根据多个id删除记录", notes = "根据多个id删除记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON ,hidden = true)
@ApiImplicitParams(value = {
@ApiImplicitParam(paramType = "query", name = "ids", dataType = "String", required = true, value = "多个记录id,用逗号分隔", example = "1,2")
})
@GetMapping(value = "/deleting", produces = MediaType.APPLICATION_JSON)
public JsonViewObject deleteByIds(String ids) {
return super.deleteByIds(ids);
}
/**
* 新建记录
*
* @param entity
* @return JsonViewObject
*/
@ApiOperation(value = "交通事件信息-新建记录", notes = "新建记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/creating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject save( @RequestBody EventInfo entity){
return super.save(entity);
}
/**
* 修改记录
*
* @param entity
* @return
*/
@ApiOperation(value = "交通事件信息-修改记录", notes = "修改记录", response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = true)
@PostMapping(value = "/updating", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject update(@RequestBody EventInfo entity){
return super.update(entity);
}
}
package net.wanji.opt.dao.mapper;
import net.wanji.databus.po.CrossDataHistPO;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity;
import net.wanji.opt.synthesis.pojo.*;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -30,4 +26,25 @@ public interface CrossMapper {
* @return
*/
List<CrossRealTimeAlarmEntity> getCrossRealTimeAlarms(String crossID, String time);
/**
* 路口方向信息
*
* @param crossID 路口ID
*/
List<CrossDirectionInfoEntity> getCrossDirectionInfo(String crossID);
/**
* 路口转向信息
*
* @param crossID 路口ID
*/
List<CrossTurnInfoEntity> getCrossTurnInfo(String crossID);
/**
* 路口车道信息
*
* @param crossID 路口ID
*/
List<CrossLaneInfoEntity> getCrossLaneInfo(String crossID);
}
package net.wanji.opt.dao.mapper.evaluation;
import net.wanji.opt.entity.evaluation.EventInfo;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
/**
* <p>
* 交通事件信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
public interface EventInfoMapper extends BaseInterfaceMapper<EventInfo> {
List<EventInfo> getListByStartAndEnd(Map<String, Object> map);
}
package net.wanji.opt.entity.evaluation;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.wanji.common.framework.domain.TrackableEntity;
import java.util.Date;
import java.math.BigDecimal;
/**
* <p>
* 交通事件信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
@Data
@ApiModel(value="EventInfo对象", description="交通事件信息")
public class EventInfo extends TrackableEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
private Long oid;
@ApiModelProperty(value = "车牌号")
private String plateNo;
@ApiModelProperty(value = "参与者类别 1:机动车 2:非机动车 3:行人")
private String objectType;
@ApiModelProperty(value = "可信度")
private Integer confidence;
@ApiModelProperty(value = "检测时间")
private Date detectTime;
@ApiModelProperty(value = "事件等级:1扣分 2 罚款 3警告 0 未知")
private Integer grade;
@ApiModelProperty(value = "事件地点描述")
private String placeDesc;
@ApiModelProperty(value = "发生地点经度")
private BigDecimal lng;
@ApiModelProperty(value = "发生地点纬度")
private BigDecimal lat;
@ApiModelProperty(value = "事件一级类别 事件一级类别 1:机动车事件 2:非机动车事件 3:行人事件")
private String category;
@ApiModelProperty(value = "二级类别")
private String type;
@ApiModelProperty(value = "事件发生时间")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
private Date startTime;
@ApiModelProperty(value = "事件结束时间")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
private Date endTime;
@ApiModelProperty(value = "事件持续时长,单位秒")
private Integer duration;
@ApiModelProperty(value = "事件来源 1:系统检测 2:接处警 3:互联网 4:交管部门 5:大脑")
private String source;
@ApiModelProperty(value = "入库时间")
private Date ruksj;
@ApiModelProperty(value = "车道id")
private String laneId;
@ApiModelProperty(value = "路段id")
private String rid;
@ApiModelProperty(value = "渠化id")
private String segmentId;
@ApiModelProperty(value = "路口id")
private String crossId;
@ApiModelProperty(value = "路口所属绿波编号")
private String greenId;
@ApiModelProperty(value = "关联的事件摄像头信息ID")
private Long cameraOid;
@ApiModelProperty(value = "事件序列号作为主键")
private String eventSerialNumber;
private String dataStatus;
@ApiModelProperty(value = "目标id")
private String globalId;
private Integer stationId;
private String eventId;
@ApiModelProperty(value = "备注")
private String remark;
private String extend;
@ApiModelProperty(value = "分区字段")
private Integer dt;
@ApiModelProperty(value = "视频地址")
private String videoUrls;
@ApiModelProperty(value = "目标具体类型")
private Integer targetType;
@ApiModelProperty(value = "告警状态 0未处理 1分析中 2优化中 3优化完 4已结束")
private Integer alarmStatus;
@ApiModelProperty(value = "优化状态 0 未优化 1-优化过 根据上面告警状态如果有2 3状态认为优化过 ")
private Integer optStatus;
@ApiModelProperty(value = "修改时间")
private Date modifyTime;
@ApiModelProperty(value = "方向 1北...8西北")
private String dir;
@ApiModelProperty(value = "事件转向")
private String turn;
@ApiModelProperty(value = "失衡指数1-10")
private Double unbalanceIndex;
@ApiModelProperty(value = "溢出指数1-10 溢出程度的刻画(没溢出:1,即将溢出:3,溢出:5,溢停:7)")
private Double spilloverIndex;
@ApiModelProperty(value = "交通指数")
private Double trafficIndex;
/*****非数据库字段*******/
private String typeName;
//用于存放日期差-分钟
private String diffTime;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.evaluation.EventInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="net.wanji.opt.entity.evaluation.EventInfo">
<id column="start_time" property="startTime" />
<result column="oid" property="oid" />
<result column="plate_no" property="plateNo" />
<result column="object_type" property="objectType" />
<result column="confidence" property="confidence" />
<result column="detect_time" property="detectTime" />
<result column="grade" property="grade" />
<result column="place_desc" property="placeDesc" />
<result column="lng" property="lng" />
<result column="lat" property="lat" />
<result column="category" property="category" />
<result column="type" property="type" />
<result column="end_time" property="endTime" />
<result column="duration" property="duration" />
<result column="source" property="source" />
<result column="ruksj" property="ruksj" />
<result column="lane_id" property="laneId" />
<result column="rid" property="rid" />
<result column="segment_id" property="segmentId" />
<result column="cross_id" property="crossId" />
<result column="green_id" property="greenId" />
<result column="camera_oid" property="cameraOid" />
<result column="event_serial_number" property="eventSerialNumber" />
<result column="data_status" property="dataStatus" />
<result column="global_id" property="globalId" />
<result column="station_id" property="stationId" />
<result column="event_id" property="eventId" />
<result column="remark" property="remark" />
<result column="extend" property="extend" />
<result column="dt" property="dt" />
<result column="video_urls" property="videoUrls" />
<result column="target_type" property="targetType" />
<result column="alarm_status" property="alarmStatus" />
<result column="opt_status" property="optStatus" />
<result column="modify_time" property="modifyTime" />
<result column="dir" property="dir" />
<result column="turn" property="turn" />
<result column="unbalance_index" property="unbalanceIndex" />
<result column="spillover_index" property="spilloverIndex" />
<result column="traffic_index" property="trafficIndex" />
</resultMap>
<sql id="Table_Name">
t_event_info
</sql>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
oid, plate_no, object_type, confidence, detect_time, grade, place_desc, lng, lat, category, type, start_time, end_time, duration, source, ruksj, lane_id, rid, segment_id, cross_id, green_id, camera_oid, event_serial_number, data_status, global_id, station_id, event_id, remark, extend, dt, video_urls, target_type, alarm_status, opt_status, modify_time, dir, turn, unbalance_index, spillover_index, traffic_index
</sql>
<!--新增操作 -->
<insert id="save" parameterType="net.wanji.opt.entity.evaluation.EventInfo">
insert into
<include refid="Table_Name"/>
(<include refid="Base_Column_List"/>)
values(
#{oid}
,#{plateNo}
,#{objectType}
,#{confidence}
,#{detectTime}
,#{grade}
,#{placeDesc}
,#{lng}
,#{lat}
,#{category}
,#{type}
,#{startTime}
,#{endTime}
,#{duration}
,#{source}
,#{ruksj}
,#{laneId}
,#{rid}
,#{segmentId}
,#{crossId}
,#{greenId}
,#{cameraOid}
,#{eventSerialNumber}
,#{dataStatus}
,#{globalId}
,#{stationId}
,#{eventId}
,#{remark}
,#{extend}
,#{dt}
,#{videoUrls}
,#{targetType}
,#{alarmStatus}
,#{optStatus}
,#{modifyTime}
,#{dir}
,#{turn}
,#{unbalanceIndex}
,#{spilloverIndex}
,#{trafficIndex}
)
</insert>
<!--根据ID查询-->
<select id="findById" resultMap="BaseResultMap" parameterType="String">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
where id = #{id}
</select>
<!--获取数据总数-->
<select id="getCount" parameterType="java.util.Map" resultType="int">
select count(*) from
<include refid="Table_Name"/>
where 1=1
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</select>
<!-- 查询所有数据-->
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!-- 通过条件查询所有数据-->
<select id="findByMap" parameterType="java.util.Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!--分组分页查询-->
<select id="findByPage" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
limit #{startRowNum}, #{pageSize}
</select>
<!--更新-->
<update id="update" parameterType="net.wanji.opt.entity.evaluation.EventInfo">
update
<include refid="Table_Name"/>
<include refid="sql_update"/>
where
start_time = #{startTime}
</update>
<!--根据ID删除-->
<delete id="deleteById" parameterType="String">
delete from
<include refid="Table_Name"/>
where
start_time = #{startTime}
</delete>
<sql id="fuzzySearch">
<if test="keyword != null and keyword !=''">
and (locate(#{keyword,jdbcType=VARCHAR}, s_name)>0
)
</if>
</sql>
<sql id="sql_query">
<if test="oid != null and oid != '' ">
<![CDATA[ and oid = #{oid}]]>
</if>
<if test="plateNo != null and plateNo != '' ">
<![CDATA[ and plate_no = #{plateNo}]]>
</if>
<if test="objectType != null and objectType != '' ">
<![CDATA[ and object_type = #{objectType}]]>
</if>
<if test="confidence != null and confidence != '' ">
<![CDATA[ and confidence = #{confidence}]]>
</if>
<if test="detectTime != null and detectTime != '' ">
<![CDATA[ and detect_time = #{detectTime}]]>
</if>
<if test="grade != null and grade != '' ">
<![CDATA[ and grade = #{grade}]]>
</if>
<if test="placeDesc != null and placeDesc != '' ">
<![CDATA[ and place_desc = #{placeDesc}]]>
</if>
<if test="lng != null and lng != '' ">
<![CDATA[ and lng = #{lng}]]>
</if>
<if test="lat != null and lat != '' ">
<![CDATA[ and lat = #{lat}]]>
</if>
<if test="category != null and category != '' ">
<![CDATA[ and category = #{category}]]>
</if>
<if test="type != null and type != '' ">
<![CDATA[ and type = #{type}]]>
</if>
<if test="startTime != null and startTime != '' ">
<![CDATA[ and start_time = #{startTime}]]>
</if>
<if test="endTime != null and endTime != '' ">
<![CDATA[ and end_time = #{endTime}]]>
</if>
<if test="duration != null and duration != '' ">
<![CDATA[ and duration = #{duration}]]>
</if>
<if test="source != null and source != '' ">
<![CDATA[ and source = #{source}]]>
</if>
<if test="ruksj != null and ruksj != '' ">
<![CDATA[ and ruksj = #{ruksj}]]>
</if>
<if test="laneId != null and laneId != '' ">
<![CDATA[ and lane_id = #{laneId}]]>
</if>
<if test="rid != null and rid != '' ">
<![CDATA[ and rid = #{rid}]]>
</if>
<if test="segmentId != null and segmentId != '' ">
<![CDATA[ and segment_id = #{segmentId}]]>
</if>
<if test="crossId != null and crossId != '' ">
<![CDATA[ and cross_id = #{crossId}]]>
</if>
<if test="greenId != null and greenId != '' ">
<![CDATA[ and green_id = #{greenId}]]>
</if>
<if test="cameraOid != null and cameraOid != '' ">
<![CDATA[ and camera_oid = #{cameraOid}]]>
</if>
<if test="eventSerialNumber != null and eventSerialNumber != '' ">
<![CDATA[ and event_serial_number = #{eventSerialNumber}]]>
</if>
<if test="dataStatus != null and dataStatus != '' ">
<![CDATA[ and data_status = #{dataStatus}]]>
</if>
<if test="globalId != null and globalId != '' ">
<![CDATA[ and global_id = #{globalId}]]>
</if>
<if test="stationId != null and stationId != '' ">
<![CDATA[ and station_id = #{stationId}]]>
</if>
<if test="eventId != null and eventId != '' ">
<![CDATA[ and event_id = #{eventId}]]>
</if>
<if test="remark != null and remark != '' ">
<![CDATA[ and remark = #{remark}]]>
</if>
<if test="extend != null and extend != '' ">
<![CDATA[ and extend = #{extend}]]>
</if>
<if test="dt != null and dt != '' ">
<![CDATA[ and dt = #{dt}]]>
</if>
<if test="videoUrls != null and videoUrls != '' ">
<![CDATA[ and video_urls = #{videoUrls}]]>
</if>
<if test="targetType != null and targetType != '' ">
<![CDATA[ and target_type = #{targetType}]]>
</if>
<if test="alarmStatus != null and alarmStatus != '' ">
<![CDATA[ and alarm_status = #{alarmStatus}]]>
</if>
<if test="optStatus != null and optStatus != '' ">
<![CDATA[ and opt_status = #{optStatus}]]>
</if>
<if test="modifyTime != null and modifyTime != '' ">
<![CDATA[ and modify_time = #{modifyTime}]]>
</if>
<if test="dir != null and dir != '' ">
<![CDATA[ and dir = #{dir}]]>
</if>
<if test="turn != null and turn != '' ">
<![CDATA[ and turn = #{turn}]]>
</if>
<if test="unbalanceIndex != null and unbalanceIndex != '' ">
<![CDATA[ and unbalance_index = #{unbalanceIndex}]]>
</if>
<if test="spilloverIndex != null and spilloverIndex != '' ">
<![CDATA[ and spillover_index = #{spilloverIndex}]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ and traffic_index = #{trafficIndex}]]>
</if>
</sql>
<!--更新操作-->
<sql id="sql_update">
<set>
<if test="oid != null and oid != '' ">
<![CDATA[ oid = #{oid}, ]]>
</if>
<if test="plateNo != null and plateNo != '' ">
<![CDATA[ plate_no = #{plateNo}, ]]>
</if>
<if test="objectType != null and objectType != '' ">
<![CDATA[ object_type = #{objectType}, ]]>
</if>
<if test="confidence != null and confidence != '' ">
<![CDATA[ confidence = #{confidence}, ]]>
</if>
<if test="detectTime != null and detectTime != '' ">
<![CDATA[ detect_time = #{detectTime}, ]]>
</if>
<if test="grade != null and grade != '' ">
<![CDATA[ grade = #{grade}, ]]>
</if>
<if test="placeDesc != null and placeDesc != '' ">
<![CDATA[ place_desc = #{placeDesc}, ]]>
</if>
<if test="lng != null and lng != '' ">
<![CDATA[ lng = #{lng}, ]]>
</if>
<if test="lat != null and lat != '' ">
<![CDATA[ lat = #{lat}, ]]>
</if>
<if test="category != null and category != '' ">
<![CDATA[ category = #{category}, ]]>
</if>
<if test="type != null and type != '' ">
<![CDATA[ type = #{type}, ]]>
</if>
<if test="startTime != null and startTime != '' ">
<![CDATA[ start_time = #{startTime}, ]]>
</if>
<if test="endTime != null and endTime != '' ">
<![CDATA[ end_time = #{endTime}, ]]>
</if>
<if test="duration != null and duration != '' ">
<![CDATA[ duration = #{duration}, ]]>
</if>
<if test="source != null and source != '' ">
<![CDATA[ source = #{source}, ]]>
</if>
<if test="ruksj != null and ruksj != '' ">
<![CDATA[ ruksj = #{ruksj}, ]]>
</if>
<if test="laneId != null and laneId != '' ">
<![CDATA[ lane_id = #{laneId}, ]]>
</if>
<if test="rid != null and rid != '' ">
<![CDATA[ rid = #{rid}, ]]>
</if>
<if test="segmentId != null and segmentId != '' ">
<![CDATA[ segment_id = #{segmentId}, ]]>
</if>
<if test="crossId != null and crossId != '' ">
<![CDATA[ cross_id = #{crossId}, ]]>
</if>
<if test="greenId != null and greenId != '' ">
<![CDATA[ green_id = #{greenId}, ]]>
</if>
<if test="cameraOid != null and cameraOid != '' ">
<![CDATA[ camera_oid = #{cameraOid}, ]]>
</if>
<if test="eventSerialNumber != null and eventSerialNumber != '' ">
<![CDATA[ event_serial_number = #{eventSerialNumber}, ]]>
</if>
<if test="dataStatus != null and dataStatus != '' ">
<![CDATA[ data_status = #{dataStatus}, ]]>
</if>
<if test="globalId != null and globalId != '' ">
<![CDATA[ global_id = #{globalId}, ]]>
</if>
<if test="stationId != null and stationId != '' ">
<![CDATA[ station_id = #{stationId}, ]]>
</if>
<if test="eventId != null and eventId != '' ">
<![CDATA[ event_id = #{eventId}, ]]>
</if>
<if test="remark != null and remark != '' ">
<![CDATA[ remark = #{remark}, ]]>
</if>
<if test="extend != null and extend != '' ">
<![CDATA[ extend = #{extend}, ]]>
</if>
<if test="dt != null and dt != '' ">
<![CDATA[ dt = #{dt}, ]]>
</if>
<if test="videoUrls != null and videoUrls != '' ">
<![CDATA[ video_urls = #{videoUrls}, ]]>
</if>
<if test="targetType != null and targetType != '' ">
<![CDATA[ target_type = #{targetType}, ]]>
</if>
<if test="alarmStatus != null and alarmStatus != '' ">
<![CDATA[ alarm_status = #{alarmStatus}, ]]>
</if>
<if test="optStatus != null and optStatus != '' ">
<![CDATA[ opt_status = #{optStatus}, ]]>
</if>
<if test="modifyTime != null and modifyTime != '' ">
<![CDATA[ modify_time = #{modifyTime}, ]]>
</if>
<if test="dir != null and dir != '' ">
<![CDATA[ dir = #{dir}, ]]>
</if>
<if test="turn != null and turn != '' ">
<![CDATA[ turn = #{turn}, ]]>
</if>
<if test="unbalanceIndex != null and unbalanceIndex != '' ">
<![CDATA[ unbalance_index = #{unbalanceIndex}, ]]>
</if>
<if test="spilloverIndex != null and spilloverIndex != '' ">
<![CDATA[ spillover_index = #{spilloverIndex}, ]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ traffic_index = #{trafficIndex}, ]]>
</if>
</set>
</sql>
</mapper>
......@@ -2,10 +2,10 @@ package net.wanji.opt.servicev2;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import net.wanji.opt.vo2.CrossBaseInfoVO;
import net.wanji.opt.vo2.CrossStatusDistributionVO;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -40,4 +40,11 @@ public interface CrossService {
* @return
*/
List<CrossStatusDisOptTimeEntity> getOptTimeList(String crossID);
/**
* 获取路口基础信息————方向、转向、车道信息
*/
CrossBaseInfoVO getCrossBaseInfos(String crossID);
}
package net.wanji.opt.servicev2.evaluation;
import net.wanji.opt.entity.evaluation.EventInfo;
import net.wanji.common.framework.dubbointerface.BaseDubboInterface;
import java.util.List;
import java.util.Map;
/**
* <p>
* 交通事件信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
public interface EventInfoService extends BaseDubboInterface<EventInfo> {
List<EventInfo> getListByStartAndEnd(Map<String, Object> map);
}
package net.wanji.opt.servicev2.evaluation.impl;
import net.wanji.common.framework.dubbointerface.impl.BaseDubboInterfaceImpl;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.evaluation.EventInfo;
import net.wanji.opt.servicev2.evaluation.EventInfoService;
import net.wanji.opt.dao.mapper.evaluation.EventInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* <p>
* 交通事件信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
@Slf4j
@Component
@Service
public class EventInfoServiceImpl extends BaseDubboInterfaceImpl<EventInfo> implements EventInfoService {
@Resource
private EventInfoMapper eventInfoMapper;
@Override
public BaseInterfaceMapper<EventInfo> getBaseInterfaceMapper() {
return this.eventInfoMapper;
}
public List<EventInfo> getListByStartAndEnd(Map<String, Object> map){
return this.eventInfoMapper.getListByStartAndEnd(map);
}
}
......@@ -7,8 +7,8 @@ import net.wanji.opt.dao.mapper.CrossMapper;
import net.wanji.opt.dao.mapper.GreenwaveHistoryMapper;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
import net.wanji.opt.servicev2.CrossService;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity;
import net.wanji.opt.synthesis.pojo.CrossStatusDisOptTimeEntity;
import net.wanji.opt.synthesis.pojo.*;
import net.wanji.opt.vo2.CrossBaseInfoVO;
import net.wanji.opt.vo2.CrossStatusDistributionVO;
import org.springframework.stereotype.Service;
......@@ -95,4 +95,26 @@ public class CrossServiceImpl implements CrossService {
public List<CrossStatusDisOptTimeEntity> getOptTimeList(String crossID) {
return crossMapper.getOptTimes(crossID);
}
/**
* 路口基础信息————方向、转向、车道信息
*
* @param crossID 路口ID
*/
@Override
public CrossBaseInfoVO getCrossBaseInfos(String crossID) {
List<CrossBaseInfoVO> crossBaseInfoVOS = new ArrayList<>();
List<CrossDirectionInfoEntity> directionInfoEntities = crossMapper.getCrossDirectionInfo(crossID);
List<CrossTurnInfoEntity> turnInfoEntities = crossMapper.getCrossTurnInfo(crossID);
List<CrossLaneInfoEntity> laneInfoEntities = crossMapper.getCrossLaneInfo(crossID);
CrossBaseInfoVO crossBaseInfoVO = new CrossBaseInfoVO();
crossBaseInfoVO.setCrossID(crossID);
crossBaseInfoVO.setDirectionInfo(directionInfoEntities);
crossBaseInfoVO.setTurnInfo(turnInfoEntities);
crossBaseInfoVO.setLaneInfo(laneInfoEntities);
return crossBaseInfoVO;
}
}
package net.wanji.opt.servicev2.implv2;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
......@@ -19,6 +18,7 @@ import net.wanji.databus.dao.mapper.GreenwaveHistMapper;
import net.wanji.databus.po.CrossDataHistPO;
import net.wanji.databus.po.CrossSchemeRings;
import net.wanji.databus.vo.LightsStatusVO2;
import net.wanji.opt.cache.BaseCrossInfoCache;
import net.wanji.opt.common.RedisUtils;
import net.wanji.opt.common.enums.EventInfoTypeEnum;
import net.wanji.opt.common.enums.GreenBeltDirEnum;
......@@ -70,6 +70,8 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
private RedisUtils redisUtil;
@Resource
private BaseCrossSchemeMapper baseCrossSchemeMapper;
@Resource
private BaseCrossInfoCache baseCrossInfoCache;
private static List<OptMonitoringVO> greenListCache = new ArrayList<>(10);
private static List<OptMonitoringVO> crossListCache = new ArrayList<>(80);
......@@ -409,10 +411,14 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
for (GreenwaveCrossPO greenwaveCrossPO : greenwaveCrossPOS) {
String crossId = greenwaveCrossPO.getCrossId();
String crossName = baseCrossInfoCache.getCrossName(crossId);
GreenOptCrossOffsetVO.CrossOffsetDetail oriOffsetDetail = getOriOffsetDetail(crossId);
oriOffsetDetail.setCrossName(crossName);
oriOffsetDetails.add(oriOffsetDetail);
GreenOptCrossOffsetVO.CrossOffsetDetail curOffsetDetail = getCurOffsetDetail(crossId, oriOffsetDetail);
curOffsetDetail.setCrossName(crossName);
curOffsetDetails.add(curOffsetDetail);
}
......
package net.wanji.opt.synthesis.pojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "CrossDirectionInfoEntity", description = "路口基础信息-方向")
public class CrossDirectionInfoEntity {
@ApiModelProperty(value = "方向")
private Integer dir;
@ApiModelProperty(value = "方向描述")
private String dirName;
}
package net.wanji.opt.synthesis.pojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "CrossLaneInfoEntity", description = "路口车道信息")
public class CrossLaneInfoEntity {
@ApiModelProperty(value = "车道编号")
private Integer sort;
@ApiModelProperty(value = "车道方向")
private Integer dir;
@ApiModelProperty(value = "车道转向")
private Integer turn;
@ApiModelProperty(value = "车道名称")
private String LaneName;
}
package net.wanji.opt.synthesis.pojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "CrossTurnInfoEntity", description = "路口转向信息")
public class CrossTurnInfoEntity {
@ApiModelProperty(value = "转向")
private String turn;
@ApiModelProperty(value = "转向描述")
private String turnName;
}
package net.wanji.opt.vo2;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.opt.synthesis.pojo.CrossDirectionInfoEntity;
import net.wanji.opt.synthesis.pojo.CrossLaneInfoEntity;
import net.wanji.opt.synthesis.pojo.CrossTurnInfoEntity;
import java.util.List;
@Data
@ApiModel(value = "CrossBaseInfoVO", description = "路口基础信息-方向 转向 车道")
public class CrossBaseInfoVO {
@ApiModelProperty(value = "路口编号")
private String crossID;
@ApiModelProperty(value = "方向信息")
private List<CrossDirectionInfoEntity> directionInfo;
@ApiModelProperty(value = "转向信息")
private List<CrossTurnInfoEntity> turnInfo;
@ApiModelProperty(value = "车道信息")
private List<CrossLaneInfoEntity> laneInfo;
}
......@@ -23,6 +23,8 @@ public class GreenOptCrossOffsetVO {
public static class CrossOffsetDetail {
@ApiModelProperty(value = "路口编号")
private String crossId;
@ApiModelProperty(value = "路口名称")
private String crossName;
@ApiModelProperty(value = "方案相位差")
private Integer offset;
@ApiModelProperty(value = "方案号")
......
......@@ -103,4 +103,83 @@
</if>
) b
</select>
<select id="getCrossDirectionInfo" parameterType="String"
resultType="net.wanji.opt.synthesis.pojo.CrossDirectionInfoEntity">
select t.dir_type dir,
(
case t.dir_type
when 1 then '北'
when 2 then '东'
when 3 then '东'
when 4 then '南'
when 5 then '南'
when 6 then '西'
when 7 then '西'
when 8 then '北'
end
) dirName
from t_base_cross_dir_info t
where 1 = 1
and t.cross_id = #{corssID}
and t.in_out_type = 1
</select>
<select id="getCrossTurnInfo" parameterType="String" resultType="net.wanji.opt.synthesis.pojo.CrossTurnInfoEntity">
select distinct t2.turn_type turn,
(
case t2.turn_type
when 'u' then '掉头'
when 'l' then '左转'
when 's' then '直行'
when 'r' then '右转'
end
) turnName
from t_base_cross_turn_info t2
where 1 = 1
and t2.cross_id = #{corssID}
</select>
<select id="getCrossLaneInfo" parameterType="String" resultType="net.wanji.opt.synthesis.pojo.CrossLaneInfoEntity">
select distinct t3.sort,
t3.dir,
t3.turn,
CONCAT(
(
case t3.dir
when 1 then '北'
when 2 then '东'
when 3 then '东'
when 4 then '南'
when 5 then '南'
when 6 then '西'
when 7 then '西'
when 8 then '北'
end
)
,
(
case t3.dir
when 1 then '左转'
when 2 then '直行'
when 3 then '右转'
when 4 then '掉头'
when 5 then '直左'
when 6 then '直右'
when 7 then '左直右'
when 8 then '左右'
when 9 then '左转掉头'
when 10 then '直行掉头'
when 11 then '右转掉头'
when 12 then '左直掉头'
when 13 then '直右掉头'
when 14 then '左直右掉头'
when 15 then '左右掉头'
end
)
, t3.sort) laneName
from t_base_lane_info t3
where 1 = 1
and t3.cross_id = #{crossID}
</select>
</mapper>
......@@ -296,7 +296,7 @@
WHERE dt = CURDATE()
AND type IN ('701', '702', '703', '707')
AND start_time <![CDATA[ < ]]> NOW()
AND IFNULL(end_time, NOW()) <![CDATA[ < ]]> NOW()
AND IFNULL(end_time, NOW()) <![CDATA[ > ]]> NOW()
GROUP BY cross_id
) latest_event ON t1.id = latest_event.cross_id
LEFT JOIN t_event_info t2
......@@ -305,7 +305,7 @@
AND t2.dt = CURDATE()
AND t2.type IN ('701', '702', '703', '707')
AND t2.start_time <![CDATA[ < ]]> NOW()
AND IFNULL(t2.end_time, NOW()) <![CDATA[ < ]]> NOW()
AND IFNULL(t2.end_time, NOW()) <![CDATA[ > ]]> NOW()
WHERE t1.is_signal = 1
ORDER BY t2.start_time DESC
</select>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.evaluation.EventInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="net.wanji.opt.entity.evaluation.EventInfo">
<id column="start_time" property="startTime" />
<result column="oid" property="oid" />
<result column="plate_no" property="plateNo" />
<result column="object_type" property="objectType" />
<result column="confidence" property="confidence" />
<result column="detect_time" property="detectTime" />
<result column="grade" property="grade" />
<result column="place_desc" property="placeDesc" />
<result column="lng" property="lng" />
<result column="lat" property="lat" />
<result column="category" property="category" />
<result column="type" property="type" />
<result column="end_time" property="endTime" />
<result column="duration" property="duration" />
<result column="source" property="source" />
<result column="ruksj" property="ruksj" />
<result column="lane_id" property="laneId" />
<result column="rid" property="rid" />
<result column="segment_id" property="segmentId" />
<result column="cross_id" property="crossId" />
<result column="green_id" property="greenId" />
<result column="camera_oid" property="cameraOid" />
<result column="event_serial_number" property="eventSerialNumber" />
<result column="data_status" property="dataStatus" />
<result column="global_id" property="globalId" />
<result column="station_id" property="stationId" />
<result column="event_id" property="eventId" />
<result column="remark" property="remark" />
<result column="extend" property="extend" />
<result column="dt" property="dt" />
<result column="video_urls" property="videoUrls" />
<result column="target_type" property="targetType" />
<result column="alarm_status" property="alarmStatus" />
<result column="opt_status" property="optStatus" />
<result column="modify_time" property="modifyTime" />
<result column="dir" property="dir" />
<result column="turn" property="turn" />
<result column="unbalance_index" property="unbalanceIndex" />
<result column="spillover_index" property="spilloverIndex" />
<result column="traffic_index" property="trafficIndex" />
</resultMap>
<sql id="Table_Name">
t_event_info
</sql>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
oid, plate_no, object_type, confidence, detect_time, grade, place_desc, lng, lat, category, type, start_time, end_time, duration, source, ruksj, lane_id, rid, segment_id, cross_id, green_id, camera_oid, event_serial_number, data_status, global_id, station_id, event_id, remark, extend, dt, video_urls, target_type, alarm_status, opt_status, modify_time, dir, turn, unbalance_index, spillover_index, traffic_index
</sql>
<!--新增操作 -->
<insert id="save" parameterType="net.wanji.opt.entity.evaluation.EventInfo">
insert into
<include refid="Table_Name"/>
(<include refid="Base_Column_List"/>)
values(
#{oid}
,#{plateNo}
,#{objectType}
,#{confidence}
,#{detectTime}
,#{grade}
,#{placeDesc}
,#{lng}
,#{lat}
,#{category}
,#{type}
,#{startTime}
,#{endTime}
,#{duration}
,#{source}
,#{ruksj}
,#{laneId}
,#{rid}
,#{segmentId}
,#{crossId}
,#{greenId}
,#{cameraOid}
,#{eventSerialNumber}
,#{dataStatus}
,#{globalId}
,#{stationId}
,#{eventId}
,#{remark}
,#{extend}
,#{dt}
,#{videoUrls}
,#{targetType}
,#{alarmStatus}
,#{optStatus}
,#{modifyTime}
,#{dir}
,#{turn}
,#{unbalanceIndex}
,#{spilloverIndex}
,#{trafficIndex}
)
</insert>
<!--根据ID查询-->
<select id="findById" resultMap="BaseResultMap" parameterType="String">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
where id = #{id}
</select>
<!--获取数据总数-->
<select id="getCount" parameterType="java.util.Map" resultType="int">
select count(*) from
<include refid="Table_Name"/>
where 1=1
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</select>
<!-- 查询所有数据-->
<select id="findAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!-- 通过条件查询所有数据-->
<select id="findByMap" parameterType="java.util.Map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
</select>
<!--分组分页查询-->
<select id="findByPage" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
<include refid="Table_Name"/>
<where>
<include refid="sql_query"/>
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
limit #{startRowNum}, #{pageSize}
</select>
<!--更新-->
<update id="update" parameterType="net.wanji.opt.entity.evaluation.EventInfo">
update
<include refid="Table_Name"/>
<include refid="sql_update"/>
where
start_time = #{startTime}
</update>
<!--根据ID删除-->
<delete id="deleteById" parameterType="String">
delete from
<include refid="Table_Name"/>
where
start_time = #{startTime}
</delete>
<sql id="fuzzySearch">
<if test="keyword != null and keyword !=''">
and (locate(#{keyword,jdbcType=VARCHAR}, s_name)>0
)
</if>
</sql>
<sql id="sql_query">
<if test="oid != null and oid != '' ">
<![CDATA[ and oid = #{oid}]]>
</if>
<if test="plateNo != null and plateNo != '' ">
<![CDATA[ and plate_no = #{plateNo}]]>
</if>
<if test="objectType != null and objectType != '' ">
<![CDATA[ and object_type = #{objectType}]]>
</if>
<if test="confidence != null and confidence != '' ">
<![CDATA[ and confidence = #{confidence}]]>
</if>
<if test="detectTime != null and detectTime != '' ">
<![CDATA[ and detect_time = #{detectTime}]]>
</if>
<if test="grade != null and grade != '' ">
<![CDATA[ and grade = #{grade}]]>
</if>
<if test="placeDesc != null and placeDesc != '' ">
<![CDATA[ and place_desc = #{placeDesc}]]>
</if>
<if test="lng != null and lng != '' ">
<![CDATA[ and lng = #{lng}]]>
</if>
<if test="lat != null and lat != '' ">
<![CDATA[ and lat = #{lat}]]>
</if>
<if test="category != null and category != '' ">
<![CDATA[ and category = #{category}]]>
</if>
<if test="type != null and type != '' ">
<![CDATA[ and type = #{type}]]>
</if>
<if test="startTime != null and startTime != '' ">
<![CDATA[ and start_time = #{startTime}]]>
</if>
<if test="endTime != null and endTime != '' ">
<![CDATA[ and end_time = #{endTime}]]>
</if>
<if test="duration != null and duration != '' ">
<![CDATA[ and duration = #{duration}]]>
</if>
<if test="source != null and source != '' ">
<![CDATA[ and source = #{source}]]>
</if>
<if test="ruksj != null and ruksj != '' ">
<![CDATA[ and ruksj = #{ruksj}]]>
</if>
<if test="laneId != null and laneId != '' ">
<![CDATA[ and lane_id = #{laneId}]]>
</if>
<if test="rid != null and rid != '' ">
<![CDATA[ and rid = #{rid}]]>
</if>
<if test="segmentId != null and segmentId != '' ">
<![CDATA[ and segment_id = #{segmentId}]]>
</if>
<if test="crossId != null and crossId != '' ">
<![CDATA[ and cross_id = #{crossId}]]>
</if>
<if test="greenId != null and greenId != '' ">
<![CDATA[ and green_id = #{greenId}]]>
</if>
<if test="cameraOid != null and cameraOid != '' ">
<![CDATA[ and camera_oid = #{cameraOid}]]>
</if>
<if test="eventSerialNumber != null and eventSerialNumber != '' ">
<![CDATA[ and event_serial_number = #{eventSerialNumber}]]>
</if>
<if test="dataStatus != null and dataStatus != '' ">
<![CDATA[ and data_status = #{dataStatus}]]>
</if>
<if test="globalId != null and globalId != '' ">
<![CDATA[ and global_id = #{globalId}]]>
</if>
<if test="stationId != null and stationId != '' ">
<![CDATA[ and station_id = #{stationId}]]>
</if>
<if test="eventId != null and eventId != '' ">
<![CDATA[ and event_id = #{eventId}]]>
</if>
<if test="remark != null and remark != '' ">
<![CDATA[ and remark = #{remark}]]>
</if>
<if test="extend != null and extend != '' ">
<![CDATA[ and extend = #{extend}]]>
</if>
<if test="dt != null and dt != '' ">
<![CDATA[ and dt = #{dt}]]>
</if>
<if test="videoUrls != null and videoUrls != '' ">
<![CDATA[ and video_urls = #{videoUrls}]]>
</if>
<if test="targetType != null and targetType != '' ">
<![CDATA[ and target_type = #{targetType}]]>
</if>
<if test="alarmStatus != null and alarmStatus != '' ">
<![CDATA[ and alarm_status = #{alarmStatus}]]>
</if>
<if test="optStatus != null and optStatus != '' ">
<![CDATA[ and opt_status = #{optStatus}]]>
</if>
<if test="modifyTime != null and modifyTime != '' ">
<![CDATA[ and modify_time = #{modifyTime}]]>
</if>
<if test="dir != null and dir != '' ">
<![CDATA[ and dir = #{dir}]]>
</if>
<if test="turn != null and turn != '' ">
<![CDATA[ and turn = #{turn}]]>
</if>
<if test="unbalanceIndex != null and unbalanceIndex != '' ">
<![CDATA[ and unbalance_index = #{unbalanceIndex}]]>
</if>
<if test="spilloverIndex != null and spilloverIndex != '' ">
<![CDATA[ and spillover_index = #{spilloverIndex}]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ and traffic_index = #{trafficIndex}]]>
</if>
</sql>
<!--更新操作-->
<sql id="sql_update">
<set>
<if test="oid != null and oid != '' ">
<![CDATA[ oid = #{oid}, ]]>
</if>
<if test="plateNo != null and plateNo != '' ">
<![CDATA[ plate_no = #{plateNo}, ]]>
</if>
<if test="objectType != null and objectType != '' ">
<![CDATA[ object_type = #{objectType}, ]]>
</if>
<if test="confidence != null and confidence != '' ">
<![CDATA[ confidence = #{confidence}, ]]>
</if>
<if test="detectTime != null and detectTime != '' ">
<![CDATA[ detect_time = #{detectTime}, ]]>
</if>
<if test="grade != null and grade != '' ">
<![CDATA[ grade = #{grade}, ]]>
</if>
<if test="placeDesc != null and placeDesc != '' ">
<![CDATA[ place_desc = #{placeDesc}, ]]>
</if>
<if test="lng != null and lng != '' ">
<![CDATA[ lng = #{lng}, ]]>
</if>
<if test="lat != null and lat != '' ">
<![CDATA[ lat = #{lat}, ]]>
</if>
<if test="category != null and category != '' ">
<![CDATA[ category = #{category}, ]]>
</if>
<if test="type != null and type != '' ">
<![CDATA[ type = #{type}, ]]>
</if>
<if test="startTime != null and startTime != '' ">
<![CDATA[ start_time = #{startTime}, ]]>
</if>
<if test="endTime != null and endTime != '' ">
<![CDATA[ end_time = #{endTime}, ]]>
</if>
<if test="duration != null and duration != '' ">
<![CDATA[ duration = #{duration}, ]]>
</if>
<if test="source != null and source != '' ">
<![CDATA[ source = #{source}, ]]>
</if>
<if test="ruksj != null and ruksj != '' ">
<![CDATA[ ruksj = #{ruksj}, ]]>
</if>
<if test="laneId != null and laneId != '' ">
<![CDATA[ lane_id = #{laneId}, ]]>
</if>
<if test="rid != null and rid != '' ">
<![CDATA[ rid = #{rid}, ]]>
</if>
<if test="segmentId != null and segmentId != '' ">
<![CDATA[ segment_id = #{segmentId}, ]]>
</if>
<if test="crossId != null and crossId != '' ">
<![CDATA[ cross_id = #{crossId}, ]]>
</if>
<if test="greenId != null and greenId != '' ">
<![CDATA[ green_id = #{greenId}, ]]>
</if>
<if test="cameraOid != null and cameraOid != '' ">
<![CDATA[ camera_oid = #{cameraOid}, ]]>
</if>
<if test="eventSerialNumber != null and eventSerialNumber != '' ">
<![CDATA[ event_serial_number = #{eventSerialNumber}, ]]>
</if>
<if test="dataStatus != null and dataStatus != '' ">
<![CDATA[ data_status = #{dataStatus}, ]]>
</if>
<if test="globalId != null and globalId != '' ">
<![CDATA[ global_id = #{globalId}, ]]>
</if>
<if test="stationId != null and stationId != '' ">
<![CDATA[ station_id = #{stationId}, ]]>
</if>
<if test="eventId != null and eventId != '' ">
<![CDATA[ event_id = #{eventId}, ]]>
</if>
<if test="remark != null and remark != '' ">
<![CDATA[ remark = #{remark}, ]]>
</if>
<if test="extend != null and extend != '' ">
<![CDATA[ extend = #{extend}, ]]>
</if>
<if test="dt != null and dt != '' ">
<![CDATA[ dt = #{dt}, ]]>
</if>
<if test="videoUrls != null and videoUrls != '' ">
<![CDATA[ video_urls = #{videoUrls}, ]]>
</if>
<if test="targetType != null and targetType != '' ">
<![CDATA[ target_type = #{targetType}, ]]>
</if>
<if test="alarmStatus != null and alarmStatus != '' ">
<![CDATA[ alarm_status = #{alarmStatus}, ]]>
</if>
<if test="optStatus != null and optStatus != '' ">
<![CDATA[ opt_status = #{optStatus}, ]]>
</if>
<if test="modifyTime != null and modifyTime != '' ">
<![CDATA[ modify_time = #{modifyTime}, ]]>
</if>
<if test="dir != null and dir != '' ">
<![CDATA[ dir = #{dir}, ]]>
</if>
<if test="turn != null and turn != '' ">
<![CDATA[ turn = #{turn}, ]]>
</if>
<if test="unbalanceIndex != null and unbalanceIndex != '' ">
<![CDATA[ unbalance_index = #{unbalanceIndex}, ]]>
</if>
<if test="spilloverIndex != null and spilloverIndex != '' ">
<![CDATA[ spillover_index = #{spilloverIndex}, ]]>
</if>
<if test="trafficIndex != null and trafficIndex != '' ">
<![CDATA[ traffic_index = #{trafficIndex}, ]]>
</if>
</set>
</sql>
<select id="getListByStartAndEnd" parameterType="java.util.Map" resultMap="BaseResultMap">
SELECT start_time,
end_time,
ABS(TIMESTAMPDIFF( SECOND, start_time, end_time )) AS diffTime,
info.type,
c.label as typeName
FROM t_event_info info
LEFT JOIN t_config_event_category c ON info.type = c.event_type
WHERE start_time >= #{startTime}
AND #{endTime} >= end_time
AND cross_id = #{crossId}
AND IFNULL(end_time, '') != ''
ORDER BY
start_time DESC
</select>
</mapper>
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