Commit 069bd307 authored by 黄伟铭's avatar 黄伟铭

修正

parent 2234ed09
......@@ -29,7 +29,9 @@ public class CrossController {
@Resource
private CrossService crossService;
@ApiOperation(value = "路口状态分布", notes = "路口状态分布", response = JsonViewObject.class, httpMethod="GET")
//@ApiOperation(value = "路口状态分布", notes = "路口状态分布", response = JsonViewObject.class, httpMethod="GET")
@GetMapping("/getCrossStatusDistribution")
@ApiOperation(httpMethod="GET",value="路口状态分布", notes="路口状态分布")
@ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "groupType", value = "时间粒度 0--5分钟 1--15分钟 2--30分钟 3--60分钟", required = true, dataType = "String", paramType = "query"),
......@@ -37,11 +39,11 @@ public class CrossController {
@ApiImplicitParam(name = "objectType", value = "范围 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "directionName", value = "方向", required = false, dataType = "String",defaultValue = "北进口"),
})
@GetMapping(value = "/getCrossStatusDistribution")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossStatusDistributionVO.class),
})
public JsonViewObject getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, @RequestParam(defaultValue = "") String directionName, HttpMethod httpMethod) {
public JsonViewObject getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, @RequestParam(defaultValue = "") String directionName) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
Map<String, List<?>> result;
try {
......
......@@ -8,6 +8,7 @@ import net.wanji.opt.po.base.EventStatisticPo;
import net.wanji.opt.servicev2.TrendServiceV2;
import net.wanji.opt.servicev2.TrunkLineService;
import net.wanji.opt.servicev2.TrunkLineStatusDisService;
import net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity;
import net.wanji.opt.vo2.*;
import org.springframework.web.bind.annotation.*;
......@@ -57,14 +58,19 @@ public class TrunkLineController {
@GetMapping("/problemDescribe")
@ApiOperation(httpMethod="GET",value="干线问题描述", notes="干线问题描述", response = JsonViewObject.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "greenID", value = "干线ID", required = true, dataType = "String",defaultValue = ""),
@ApiImplicitParam(name = "time", value = "日期", required = false, dataType = "String",defaultValue = ""),
})
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = TrunkLineProblemDescribeVO.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
})
public JsonViewObject problemDescribe() {
public JsonViewObject problemDescribe(String greenID , String time ) {
try {
JsonViewObject object = JsonViewObject.newInstance();
List<TrunkLineProblemDescribeVO> list = trunkLineService.getTrunkLineProblemDescribe();
List<TrunkLineProblemDescribeEntity> list = trunkLineService.getTrunkLineProblemDescribe(greenID,time);
return object.success(list);
} catch (Exception e) {
log.error("监测详情-干线详情-干线问题描述: ", e);
......
package net.wanji.opt.dao.mapper;
import io.lettuce.core.dynamic.annotation.Param;
import net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity;
import java.util.List;
......@@ -16,5 +17,5 @@ public interface TrunkLineMapper{
* 获取干线问题描述
* @return
*/
List<TrunkLineProblemDescribeEntity> getTrunkLineProblemDescribe();
List<TrunkLineProblemDescribeEntity> getTrunkLineProblemDescribe(@Param("greenID") String greenID , @Param("time") String time);
}
package net.wanji.opt.servicev2;
import net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity;
import net.wanji.opt.vo2.TrunkLineProblemDescribeVO;
import java.util.List;
......@@ -14,5 +15,5 @@ public interface TrunkLineService {
* 获取干线事件描述
* @return
*/
List<TrunkLineProblemDescribeVO> getTrunkLineProblemDescribe();
List<TrunkLineProblemDescribeEntity> getTrunkLineProblemDescribe(String greenID , String time);
}
......@@ -18,19 +18,9 @@ public class TrunkLineImpl implements TrunkLineService {
private TrunkLineMapper trunkLineMapper;
@Override
public List<TrunkLineProblemDescribeVO> getTrunkLineProblemDescribe() {
List<TrunkLineProblemDescribeEntity> list = trunkLineMapper.getTrunkLineProblemDescribe();
List<TrunkLineProblemDescribeVO> result = new ArrayList<>();
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < list.size(); i+=2) {
TrunkLineProblemDescribeVO vo = getTrunkLineProblemDescribeVO(list, i);
result.add(vo);
}
return result;
public List<TrunkLineProblemDescribeEntity> getTrunkLineProblemDescribe(String greenID , String time) {
List<TrunkLineProblemDescribeEntity> list = trunkLineMapper.getTrunkLineProblemDescribe(greenID,time);
return list;
}
@NotNull
......
......@@ -2,33 +2,35 @@
<!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.TrunkLineMapper">
<resultMap id="tlProblemDescribe" type="net.wanji.opt.synthesis.pojo.TrunkLineProblemDescribeEntity">
<id column="greenID" property="greenID"/>
<result column="greenID" property="greenID"/>
<result column="time" property="time" />
<result column="status" property="status"/>
<result column="dir" property="dir"/>
<result column="status_cn" property="statusCN"/>
</resultMap>
<select id="getTrunkLineProblemDescribe" resultMap="tlProblemDescribe">
select
a.green_id greenID,
max(a.start_time) time,
a.status,
a.road_direction dir,
(
case
a.status
when 1 then '畅通'
when 2 then '缓行'
when 3 then '拥堵'
when 4 then '严重拥堵'
when 5 then '未知'
end
) status_cn
<select id="getTrunkLineProblemDescribe" parameterType="String" resultMap="tlProblemDescribe">
select b.greenID ,b.status ,b.time , (
case
b.status
when 1 then '畅通'
when 2 then '缓行'
when 3 then '拥堵'
when 4 then '严重拥堵'
when 5 then '畅通'
end
) status_cn
from
t_greenwave_hist a
group by
a.green_id,
a.road_direction
(select DISTINCT
a.green_id as greenID,
max(a.start_time) time,
max(a.status) as status
from
t_greenwave_hist a
where a.green_id = #{greenID}
<if test="time != null and time != '' ">
and DATE_FORMAT(start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> DATE_FORMAT(#{time},'%Y-%m-%d %H:%i:%s')
</if>
) b
</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