Commit 2a074ed6 authored by duanruiming's avatar duanruiming

Merge remote-tracking branch 'origin/master'

parents d68c1478 d63e071a
...@@ -42,7 +42,7 @@ public class CrossIndexController { ...@@ -42,7 +42,7 @@ public class CrossIndexController {
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TBaseCrossInfo.class), @ApiResponse(code = 200, message = "OK", response = TBaseCrossInfo.class),
}) })
public JsonViewObject crossInfoList() { public JsonViewObject crossInfoList(@RequestParam(defaultValue = "") Integer areaId) {
List<TBaseCrossInfo> baseCrossInfoPOS = crossIndexService.crossInfoList(); List<TBaseCrossInfo> baseCrossInfoPOS = crossIndexService.crossInfoList();
return JsonViewObject.newInstance().success(baseCrossInfoPOS); return JsonViewObject.newInstance().success(baseCrossInfoPOS);
} }
......
...@@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.servicev2.CrossService; import net.wanji.opt.servicev2.CrossService;
import net.wanji.opt.synthesis.pojo.CrossRealTimeAlarmEntity; 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.CrossBaseInfoVO;
import net.wanji.opt.vo2.CrossRealTimeAlarmVO; import net.wanji.opt.vo2.CrossRealTimeAlarmVO;
import net.wanji.opt.vo2.CrossStatusDistributionVO; import net.wanji.opt.vo2.CrossStatusDistributionVO;
...@@ -14,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -14,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -37,58 +37,25 @@ public class CrossController { ...@@ -37,58 +37,25 @@ public class CrossController {
@ApiImplicitParam(name = "groupType", value = "时间粒度 0--5分钟 1--15分钟 2--30分钟 3--60分钟", required = true, dataType = "String", paramType = "query"), @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 = "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 = "objectType", value = "范围 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "directionName", value = "方向 支持 北进口;东进口;南进口;西进口", dataType = "String", defaultValue = ""), @ApiImplicitParam(name = "condition", value = "筛选条件", dataType = "String", paramType = "query"),
}) })
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossStatusDistributionVO.class), @ApiResponse(code = 200, message = "OK", response = CrossStatusDistributionVO.class),
}) })
public JsonViewObject getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String directionName) { public JsonViewObject getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String condition) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
Map<String, Object> map = new HashMap<>();
if (directionName != null) {
String[] dirs = directionName.split(";");
for (String dir : dirs) {
String dirName = "";
switch (dir) {
case "北进口":
dirName = "northList";
break;
case "南进口":
dirName = "southList";
break;
case "西进口":
dirName = "westList";
break;
case "东进口":
dirName = "eastList";
break;
}
try { try {
List<CrossStatusDistributionVO> info = crossService.getCrossStatusDistribution(crossID, date, groupType, objectType, dir); Map<String, Object> result = crossService.getCrossStatusDistribution(crossID, date, groupType, objectType, condition);
map.put(dirName, info); List<CrossStatusDisOptTimeEntity> optTimes = crossService.getOptTimeList(crossID);
} catch (Exception e) { result.put("optTimesList", optTimes);
log.error("监测详情-路口事件详情-路口状态分布: ", e); return jsonViewObject.success(result);
return jsonViewObject.fail("路口状态分布查询失败");
}
}
} else {
try {
List<CrossStatusDistributionVO> info = crossService.getCrossStatusDistribution(crossID, date, groupType, objectType, null);
map.put("infoList", info);
} catch (Exception e) { } catch (Exception e) {
log.error("监测详情-路口事件详情-路口状态分布: ", e); log.error("监测详情-路口事件详情-路口状态分布: ", e);
return jsonViewObject.fail("路口状态分布查询失败"); return jsonViewObject.fail("路口状态分布查询失败");
} }
} }
map.put("optTimeList", crossService.getOptTimeList(crossID));
return jsonViewObject.success(map);
}
@ApiOperation(value = "路口实时告警", notes = "路口实时告警", response = JsonViewObject.class, httpMethod="GET") @ApiOperation(value = "路口实时告警", notes = "路口实时告警", response = JsonViewObject.class, httpMethod="GET")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "crossID", value = "路口ID", required = true, dataType = "String", paramType = "query"),
......
...@@ -6,16 +6,24 @@ import io.swagger.annotations.ApiImplicitParams; ...@@ -6,16 +6,24 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaCrossProblemAnalysisResult; import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaCrossProblemAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaGreenProblemAnalysisResult; import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaGreenProblemAnalysisResult;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemOverview; import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemOverview;
import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemTrendAnalysisResult; import net.wanji.opt.controllerv2.judgeanalysis.design.response.areaproblem.AreaProblemTrendAnalysisResult;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemCrossDayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -26,25 +34,39 @@ import javax.ws.rs.core.MediaType; ...@@ -26,25 +34,39 @@ import javax.ws.rs.core.MediaType;
* @since 2025-03-13 * @since 2025-03-13
*/ */
@Api(tags = "研判分析-区域问题分析") @Api(tags = "研判分析-区域问题分析")
@Slf4j
@RestController @RestController
@RequestMapping("/analysis-area-problem") @RequestMapping("/analysis-area-problem")
public class AnalysisProblemAreaDayController { public class AnalysisProblemAreaDayController {
@Autowired
private AnalysisProblemCrossDayService analysisProblemCrossDayService;
@ApiOperation(value = "区域-问题数量总览", response = JsonViewObject.class, @ApiOperation(value = "区域-问题数量总览", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/overview") @GetMapping(value = "/overview")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "1"), @ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "12"),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "int", defaultValue = ""), @ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "startTime", value = "开始时间", required = false, dataType = "String"), @ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
@ApiImplicitParam(name = "endTime", value = "结束时间", required = false, dataType = "String"),
}) })
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class), @ApiResponse(code = 200, message = "OK", response = AreaProblemOverview.class),
}) })
public JsonViewObject areaProblemOverview(String timeType,String areaId, String startTime, String endTime) { public JsonViewObject areaProblemOverview(String areaId, Integer startTime, Integer endTime) {
return JsonViewObject.newInstance().success(null); JsonViewObject jsonView = JsonViewObject.newInstance();
try {
Map<String, Object> map = new HashMap<>();
map.put("areaId", areaId);
map.put("startTime", startTime);
map.put("endTime", endTime);
List<AnalysisProblemCrossDay> list = analysisProblemCrossDayService.selectCountByType(map);
jsonView.success(list);
} catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonView;
} }
...@@ -53,34 +75,31 @@ public class AnalysisProblemAreaDayController { ...@@ -53,34 +75,31 @@ public class AnalysisProblemAreaDayController {
@GetMapping(value = "/trend") @GetMapping(value = "/trend")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "1"), @ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "1"),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "int", defaultValue = ""), @ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "startTime", value = "开始时间", required = false, dataType = "String", defaultValue = ""), @ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
@ApiImplicitParam(name = "endTime", value = "结束时间", required = false, dataType = "String", defaultValue = ""),
}) })
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaProblemTrendAnalysisResult.class), @ApiResponse(code = 200, message = "OK", response = AreaProblemTrendAnalysisResult.class),
}) })
public JsonViewObject trend(String timeType,String areaId) { public JsonViewObject trend(String areaId, Integer startTime, Integer endTime) {
return JsonViewObject.newInstance().success(null); return JsonViewObject.newInstance().success(null);
} }
@ApiOperation(value = "区域-路口问题数量分析", response = JsonViewObject.class, @ApiOperation(value = "区域-路口问题数量分析", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "eventType", value = "事件代码 701:路口空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = ""), @ApiImplicitParam(name = "eventType", value = "事件代码 701:路口空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "1"), @ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "1"),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "int", defaultValue = ""), @ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "startTime", value = "开始时间", required = false, dataType = "String"), @ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
@ApiImplicitParam(name = "endTime", value = "结束时间", required = false, dataType = "String"),
}) })
@GetMapping(value = "/cross-problem-number") @GetMapping(value = "/cross-problem-number")
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaCrossProblemAnalysisResult.class), @ApiResponse(code = 200, message = "OK", response = AreaCrossProblemAnalysisResult.class),
}) })
public JsonViewObject crossProblemNumber(String eventType,String timeType,String areaId) { public JsonViewObject crossProblemNumber(String eventType, String areaId, Integer startTime, Integer endTime) {
return JsonViewObject.newInstance().success(null); return JsonViewObject.newInstance().success(null);
} }
...@@ -90,15 +109,14 @@ public class AnalysisProblemAreaDayController { ...@@ -90,15 +109,14 @@ public class AnalysisProblemAreaDayController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "eventType", value = "事件代码 705:干线缓行 706:干线拥堵 ", required = true, dataType = "String", defaultValue = ""), @ApiImplicitParam(name = "eventType", value = "事件代码 705:干线缓行 706:干线拥堵 ", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "1"), @ApiImplicitParam(name = "areaId", value = "区域ID", required = true, dataType = "String", defaultValue = "1"),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "int", defaultValue = ""), @ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "startTime", value = "开始时间", required = false, dataType = "String"), @ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
@ApiImplicitParam(name = "endTime", value = "结束时间", required = false, dataType = "String"),
}) })
@GetMapping(value = "/green-problem-number") @GetMapping(value = "/green-problem-number")
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = AreaGreenProblemAnalysisResult.class), @ApiResponse(code = 200, message = "OK", response = AreaGreenProblemAnalysisResult.class),
}) })
public JsonViewObject greenProblemNumber(String eventType,String timeType,String areaId) { public JsonViewObject greenProblemNumber(String eventType, String areaId, Integer startTime, Integer endTime) {
return JsonViewObject.newInstance().success(null); return JsonViewObject.newInstance().success(null);
} }
......
...@@ -43,7 +43,9 @@ public class AnalysisProblemGreenDayController { ...@@ -43,7 +43,9 @@ public class AnalysisProblemGreenDayController {
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "String", defaultValue = ""), @ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "String", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "String", defaultValue = "20250318"),
}) })
@GetMapping(value = "/overview") @GetMapping(value = "/overview")
@ApiResponses({ @ApiResponses({
...@@ -58,7 +60,9 @@ public class AnalysisProblemGreenDayController { ...@@ -58,7 +60,9 @@ public class AnalysisProblemGreenDayController {
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "String", defaultValue = ""), @ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "String", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "String", defaultValue = "20250318"),
}) })
@GetMapping(value = "/trend") @GetMapping(value = "/trend")
@ApiResponses({ @ApiResponses({
...@@ -74,7 +78,9 @@ public class AnalysisProblemGreenDayController { ...@@ -74,7 +78,9 @@ public class AnalysisProblemGreenDayController {
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "String", defaultValue = ""), @ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "String", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "String", defaultValue = "20250318"),
}) })
@GetMapping(value = "/detail") @GetMapping(value = "/detail")
@ApiResponses({ @ApiResponses({
...@@ -89,8 +95,10 @@ public class AnalysisProblemGreenDayController { ...@@ -89,8 +95,10 @@ public class AnalysisProblemGreenDayController {
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "String", defaultValue = ""), @ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = true, dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = "") @ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = ""),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "String", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "String", defaultValue = "20250318"),
}) })
@GetMapping(value = "/cross-trend") @GetMapping(value = "/cross-trend")
@ApiResponses({ @ApiResponses({
......
...@@ -2,6 +2,7 @@ package net.wanji.opt.dao.mapper.judgeanalysis; ...@@ -2,6 +2,7 @@ package net.wanji.opt.dao.mapper.judgeanalysis;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay; import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import java.util.List; import java.util.List;
import java.util.Map;
import net.wanji.opt.entity.judgeanalysis.CrossPoint; import net.wanji.opt.entity.judgeanalysis.CrossPoint;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -86,5 +87,19 @@ public interface AnalysisProblemCrossDayMapper extends BaseMapper<AnalysisProble ...@@ -86,5 +87,19 @@ public interface AnalysisProblemCrossDayMapper extends BaseMapper<AnalysisProble
*/ */
Integer insertAnalysisProblemCrossDay(); Integer insertAnalysisProblemCrossDay();
/**
* 新增表t_analysis_problem_cross_dir_hour信息
* @param
*/
Integer insertAnalysisProblemCrossHour();
/***
* 根据类型统计对应数量
* @param map
* @return
*/
List<AnalysisProblemCrossDay> selectCountByType(Map<String, Object> map);
} }
...@@ -48,6 +48,12 @@ public interface AnalysisProblemGreenDayMapper extends BaseMapper<AnalysisProble ...@@ -48,6 +48,12 @@ public interface AnalysisProblemGreenDayMapper extends BaseMapper<AnalysisProble
*/ */
Integer insertAnalysisProblemGreenDay(); Integer insertAnalysisProblemGreenDay();
/**
* 新增表t_analysis_problem_green_hour信息
* @param
*/
Integer insertAnalysisProblemGreenHour();
/** /**
* 根据条件查询表t_analysis_problem_green_day信息 * 根据条件查询表t_analysis_problem_green_day信息
* @param * @param
......
...@@ -73,4 +73,11 @@ public class AnalysisProblemCrossDay implements Serializable { ...@@ -73,4 +73,11 @@ public class AnalysisProblemCrossDay implements Serializable {
private LocalDateTime insertTime; private LocalDateTime insertTime;
/***非数据库字段****/
//类型名称
private String typeName;
//数量统计
private String countNumber;
} }
<?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.judgeanalysis.AnalysisProblemCrossDayMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
id, area_id, event_category, event_type, event_number, event_total_time, window_start_time, window_end_time, cross_id, dt, insert_time
</sql>
<!-- 通用条件列 -->
<sql id="AnalysisProblemCrossDayByCondition">
<if test="id!=null and id!=''">
AND id = #{id}
</if>
<if test="areaId!=null and areaId!=''">
AND area_id = #{areaId}
</if>
<if test="eventCategory!=null and eventCategory!=''">
AND event_category = #{eventCategory}
</if>
<if test="eventType!=null and eventType!=''">
AND event_type = #{eventType}
</if>
<if test="eventNumber!=null and eventNumber!=''">
AND event_number = #{eventNumber}
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
AND event_total_time = #{eventTotalTime}
</if>
<if test="windowStartTime!=null">
AND window_start_time = #{windowStartTime}
</if>
<if test="windowEndTime!=null">
AND window_end_time = #{windowEndTime}
</if>
<if test="crossId!=null and crossId!=''">
AND cross_id = #{crossId}
</if>
<if test="dt!=null and dt!=''">
AND dt = #{dt}
</if>
<if test="insertTime!=null">
AND insert_time = #{insertTime}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="AnalysisProblemCrossDaySetColumns">
<if test="areaId!=null and areaId!=''">
area_id = #{areaId},
</if>
<if test="eventCategory!=null and eventCategory!=''">
event_category = #{eventCategory},
</if>
<if test="eventType!=null and eventType!=''">
event_type = #{eventType},
</if>
<if test="eventNumber!=null and eventNumber!=''">
event_number = #{eventNumber},
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
event_total_time = #{eventTotalTime},
</if>
<if test="windowStartTime!=null">
window_start_time = #{windowStartTime},
</if>
<if test="windowEndTime!=null">
window_end_time = #{windowEndTime},
</if>
<if test="crossId!=null and crossId!=''">
cross_id = #{crossId},
</if>
<if test="dt!=null and dt!=''">
dt = #{dt},
</if>
<if test="insertTime!=null">
insert_time = #{insertTime},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="AnalysisProblemCrossDayMap" type="net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay">
<id column="id" property="id"/>
<result column="area_id" property="areaId"/>
<result column="event_category" property="eventCategory"/>
<result column="event_type" property="eventType"/>
<result column="event_number" property="eventNumber"/>
<result column="event_total_time" property="eventTotalTime"/>
<result column="window_start_time" property="windowStartTime"/>
<result column="window_end_time" property="windowEndTime"/>
<result column="cross_id" property="crossId"/>
<result column="dt" property="dt"/>
<result column="insert_time" property="insertTime"/>
</resultMap>
<!-- 查询表t_analysis_problem_cross_day所有信息 -->
<select id="findAllAnalysisProblemCrossDay" resultMap="AnalysisProblemCrossDayMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_cross_day
</select>
<!-- 根据主键id查询表t_analysis_problem_cross_day信息 -->
<select id="findAnalysisProblemCrossDayByid" resultMap="AnalysisProblemCrossDayMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_cross_day
WHERE id=#{id}
</select>
<!-- 根据条件查询表t_analysis_problem_cross_day信息 -->
<select id="findAnalysisProblemCrossDayByCondition" resultMap="AnalysisProblemCrossDayMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_cross_day
WHERE 1=1
<include refid="AnalysisProblemCrossDayByCondition" />
</select>
<!-- 根据主键id删除表t_analysis_problem_cross_day信息 -->
<delete id="deleteAnalysisProblemCrossDayByid">
DELETE FROM
t_analysis_problem_cross_day
WHERE id=#{id}
</delete>
<!-- 根据主键id更新表t_analysis_problem_cross_day信息 -->
<update id="updateAnalysisProblemCrossDayByid" parameterType="net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay">
UPDATE t_analysis_problem_cross_day
<set>
<include refid="AnalysisProblemCrossDaySetColumns"/>
</set>
WHERE
id=#{id}
</update>
<!-- 新增表t_analysis_problem_cross_day信息 -->
<insert id="addAnalysisProblemCrossDay">
INSERT INTO t_analysis_problem_cross_day (
id
,area_id
,event_category
,event_type
,event_number
,event_total_time
,window_start_time
,window_end_time
,cross_id
,dt
,insert_time
) VALUES (
#{id}
,#{areaId}
,#{eventCategory}
,#{eventType}
,#{eventNumber}
,#{eventTotalTime}
,#{windowStartTime}
,#{windowEndTime}
,#{crossId}
,#{dt}
,#{insertTime}
)
</insert>
</mapper>
<?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.judgeanalysis.AnalysisProblemGreenDayMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
id, area_id, event_category, event_type, event_number, event_total_time, window_start_time, window_end_time, green_id, dt, insert_time
</sql>
<!-- 通用条件列 -->
<sql id="AnalysisProblemGreenDayByCondition">
<if test="id!=null and id!=''">
AND id = #{id}
</if>
<if test="areaId!=null and areaId!=''">
AND area_id = #{areaId}
</if>
<if test="eventCategory!=null and eventCategory!=''">
AND event_category = #{eventCategory}
</if>
<if test="eventType!=null and eventType!=''">
AND event_type = #{eventType}
</if>
<if test="eventNumber!=null and eventNumber!=''">
AND event_number = #{eventNumber}
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
AND event_total_time = #{eventTotalTime}
</if>
<if test="windowStartTime!=null">
AND window_start_time = #{windowStartTime}
</if>
<if test="windowEndTime!=null">
AND window_end_time = #{windowEndTime}
</if>
<if test="greenId!=null and greenId!=''">
AND green_id = #{greenId}
</if>
<if test="dt!=null and dt!=''">
AND dt = #{dt}
</if>
<if test="insertTime!=null">
AND insert_time = #{insertTime}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="AnalysisProblemGreenDaySetColumns">
<if test="areaId!=null and areaId!=''">
area_id = #{areaId},
</if>
<if test="eventCategory!=null and eventCategory!=''">
event_category = #{eventCategory},
</if>
<if test="eventType!=null and eventType!=''">
event_type = #{eventType},
</if>
<if test="eventNumber!=null and eventNumber!=''">
event_number = #{eventNumber},
</if>
<if test="eventTotalTime!=null and eventTotalTime!=''">
event_total_time = #{eventTotalTime},
</if>
<if test="windowStartTime!=null">
window_start_time = #{windowStartTime},
</if>
<if test="windowEndTime!=null">
window_end_time = #{windowEndTime},
</if>
<if test="greenId!=null and greenId!=''">
green_id = #{greenId},
</if>
<if test="dt!=null and dt!=''">
dt = #{dt},
</if>
<if test="insertTime!=null">
insert_time = #{insertTime},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="AnalysisProblemGreenDayMap" type="net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenDay">
<id column="id" property="id"/>
<result column="area_id" property="areaId"/>
<result column="event_category" property="eventCategory"/>
<result column="event_type" property="eventType"/>
<result column="event_number" property="eventNumber"/>
<result column="event_total_time" property="eventTotalTime"/>
<result column="window_start_time" property="windowStartTime"/>
<result column="window_end_time" property="windowEndTime"/>
<result column="green_id" property="greenId"/>
<result column="dt" property="dt"/>
<result column="insert_time" property="insertTime"/>
</resultMap>
<!-- 查询表t_analysis_problem_green_day所有信息 -->
<select id="findAllAnalysisProblemGreenDay" resultMap="AnalysisProblemGreenDayMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_green_day
</select>
<!-- 根据主键id查询表t_analysis_problem_green_day信息 -->
<select id="findAnalysisProblemGreenDayByid" resultMap="AnalysisProblemGreenDayMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_green_day
WHERE id=#{id}
</select>
<!-- 根据条件查询表t_analysis_problem_green_day信息 -->
<select id="findAnalysisProblemGreenDayByCondition" resultMap="AnalysisProblemGreenDayMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_analysis_problem_green_day
WHERE 1=1
<include refid="AnalysisProblemGreenDayByCondition" />
</select>
<!-- 根据主键id删除表t_analysis_problem_green_day信息 -->
<delete id="deleteAnalysisProblemGreenDayByid">
DELETE FROM
t_analysis_problem_green_day
WHERE id=#{id}
</delete>
<!-- 根据主键id更新表t_analysis_problem_green_day信息 -->
<update id="updateAnalysisProblemGreenDayByid" parameterType="net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenDay">
UPDATE t_analysis_problem_green_day
<set>
<include refid="AnalysisProblemGreenDaySetColumns"/>
</set>
WHERE
id=#{id}
</update>
<!-- 新增表t_analysis_problem_green_day信息 -->
<insert id="addAnalysisProblemGreenDay">
INSERT INTO t_analysis_problem_green_day (
id
,area_id
,event_category
,event_type
,event_number
,event_total_time
,window_start_time
,window_end_time
,green_id
,dt
,insert_time
) VALUES (
#{id}
,#{areaId}
,#{eventCategory}
,#{eventType}
,#{eventNumber}
,#{eventTotalTime}
,#{windowStartTime}
,#{windowEndTime}
,#{greenId}
,#{dt}
,#{insertTime}
)
</insert>
</mapper>
...@@ -6,6 +6,7 @@ import net.wanji.opt.vo2.CrossBaseInfoVO; ...@@ -6,6 +6,7 @@ import net.wanji.opt.vo2.CrossBaseInfoVO;
import net.wanji.opt.vo2.CrossStatusDistributionVO; import net.wanji.opt.vo2.CrossStatusDistributionVO;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -21,10 +22,23 @@ public interface CrossService { ...@@ -21,10 +22,23 @@ public interface CrossService {
* @param date 日期 * @param date 日期
* @param groupType 时间粒度 参数要求:0--5分钟 1--15分钟 2--30分钟 3--60分钟 * @param groupType 时间粒度 参数要求:0--5分钟 1--15分钟 2--30分钟 3--60分钟
* @param objectType 范围 参数要求:1--方向级 2--转向级 3--车道级 4--路口级 * @param objectType 范围 参数要求:1--方向级 2--转向级 3--车道级 4--路口级
* @param directionName 方向 * @param condition 筛选条件-根据范围参数确定
* @return 包含状态分布信息列表与优化时间列表 * @return 包含状态分布信息列表与优化时间列表
*/ */
List<CrossStatusDistributionVO> getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String directionName); Map<String, Object> getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String condition);
/**
* 获取路口状态分布_单状态
*
* @param crossID 路口ID
* @param date 日期
* @param groupType 时间粒度 参数要求:0--5分钟 1--15分钟 2--30分钟 3--60分钟
* @param objectType 范围 参数要求:1--方向级 2--转向级 3--车道级 4--路口级
* @param condition 筛选条件-根据范围参数确定
* @return 包含状态分布信息列表与优化时间列表
*/
List<CrossStatusDistributionVO> getCrossStatusDistribution_SingleCondition(String crossID, String date, String groupType, Integer objectType, String condition);
/** /**
* 获取路口实时告警 * 获取路口实时告警
......
...@@ -2,7 +2,6 @@ package net.wanji.opt.servicev2.implv2; ...@@ -2,7 +2,6 @@ package net.wanji.opt.servicev2.implv2;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.BaseEnum; import net.wanji.common.enums.BaseEnum;
import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.dao.mapper.CrossMapper; import net.wanji.opt.dao.mapper.CrossMapper;
import net.wanji.opt.dao.mapper.GreenwaveHistoryMapper; import net.wanji.opt.dao.mapper.GreenwaveHistoryMapper;
import net.wanji.opt.po.base.CrossLaneDataHistPoExtend; import net.wanji.opt.po.base.CrossLaneDataHistPoExtend;
...@@ -13,10 +12,7 @@ import net.wanji.opt.vo2.CrossStatusDistributionVO; ...@@ -13,10 +12,7 @@ import net.wanji.opt.vo2.CrossStatusDistributionVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -33,27 +29,71 @@ public class CrossServiceImpl implements CrossService { ...@@ -33,27 +29,71 @@ public class CrossServiceImpl implements CrossService {
@Resource @Resource
private GreenwaveHistoryMapper greenwaveHistoryMapper; private GreenwaveHistoryMapper greenwaveHistoryMapper;
@Override
public Map<String, Object> getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String condition) {
Map<String, Object> resultMap = new HashMap<>();
if (objectType == 1) {
// 方向级
// condition是方向--1 3 5 7
String[] conditions = condition.split(";");
for (String c : conditions) {
List<CrossStatusDistributionVO> list = getCrossStatusDistribution_SingleCondition(crossID, date, groupType, objectType, c);
resultMap.put(c + "List", list);
}
} else if (objectType == 2) {
// 转向级
// condition是转向--dir:l dir:r dir:n dir:u
String[] conditions = condition.split(";");
for (String c : conditions) {
List<CrossStatusDistributionVO> list = getCrossStatusDistribution_SingleCondition(crossID, date, groupType, objectType, c);
String[] cs = c.split(":");
String namePart1 = BaseEnum.SignalDirectionEnum.getNameByCode(Integer.parseInt(cs[0]));
String namePart2 = BaseEnum.TurnTypeEnum.getNameByCode(Integer.parseInt(cs[1]));
String name = namePart1 + namePart2;
resultMap.put(name, list);
}
} else if (objectType == 3) {
// 车道级
// condition是dir:turn:laneNum
String[] conditions = condition.split(";");
for (String c : conditions) {
List<CrossStatusDistributionVO> list = getCrossStatusDistribution_SingleCondition(crossID, date, groupType, objectType, c);
String[] cs = c.split(":");
String namePart1 = BaseEnum.SignalDirectionEnum.getNameByCode(Integer.parseInt(cs[0]));
String namePart2 = BaseEnum.TurnTypeEnum.getNameByCode(Integer.parseInt(cs[1]));
String namePart3 = cs[2];
String name = namePart1 + namePart2 + namePart3;
resultMap.put(name, list);
}
} else if (objectType == 4) {
// 路口级
// 无condition
List<CrossStatusDistributionVO> list = getCrossStatusDistribution_SingleCondition(crossID, date, groupType, objectType, "");
resultMap.put("cross_list", list);
}
return resultMap;
}
/** /**
* 路口状态分布 * 路口状态分布_单条件
* *
* @param crossID 路口ID * @param crossID 路口ID
* @param date 日期 * @param date 日期
* @param groupType 时间粒度 参数要求:0--5分钟 1--15分钟 2--30分钟 3--60分钟 * @param groupType 时间粒度 参数要求:0--5分钟 1--15分钟 2--30分钟 3--60分钟
* @param objectType 范围 参数要求:1--方向级 2--转向级 3--车道级 4--路口级 * @param objectType 范围 参数要求:1--方向级 2--转向级 3--车道级 4--路口级
* @param directionName 方向 东南西北 * @param condition 条件
* @return
*/ */
@Override @Override
public List<CrossStatusDistributionVO> getCrossStatusDistribution(String crossID, String date, String groupType, Integer objectType, String directionName) { public List<CrossStatusDistributionVO> getCrossStatusDistribution_SingleCondition(String crossID, String date, String groupType, Integer objectType, String condition) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("crossId", crossID); params.put("crossId", crossID);
params.put("startDate", date + " 00:00:00"); params.put("startDate", date + " 00:00:00");
params.put("endDate", date + " 23:59:59"); params.put("endDate", date + " 23:59:59");
params.put("groupType", groupType); params.put("groupType", groupType);
params.put("objectType", objectType); params.put("objectType", objectType);
if (StringUtils.isNotBlank(directionName)) { // 方向级时多传一个dir参数
params.put("dir", BaseEnum.SignalDirectionEnum.getCodeByName(directionName.substring(0, directionName.indexOf("进口")))); if (objectType == 1) params.put("dir", condition);
}
List<CrossLaneDataHistPoExtend> firstList = greenwaveHistoryMapper.findCrossObjectIndex(params); List<CrossLaneDataHistPoExtend> firstList = greenwaveHistoryMapper.findCrossObjectIndex(params);
List<CrossStatusDistributionVO> results = new ArrayList<>(); List<CrossStatusDistributionVO> results = new ArrayList<>();
...@@ -73,9 +113,22 @@ public class CrossServiceImpl implements CrossService { ...@@ -73,9 +113,22 @@ public class CrossServiceImpl implements CrossService {
cd.setLaneNo(c.getLaneNo()); cd.setLaneNo(c.getLaneNo());
results.add(cd); results.add(cd);
} }
// 根据筛选条件筛选一次结果
if (objectType == 2) {
// 转向级
String[] con = condition.split(":");
results.removeIf(c -> c.getDirType() != Integer.parseInt(con[0]));
results.removeIf(c -> !Objects.equals(c.getTurnType(), BaseEnum.TurnTypeEnum.getIntCodeByStrCode(con[1])));
} else if (objectType == 3) {
// 车道级
String[] con = condition.split(":");
results.removeIf(c -> c.getDirType() != Integer.parseInt(con[0]));
results.removeIf(c -> c.getTurnType() != Integer.parseInt(con[1]));
results.removeIf(c -> c.getLaneNo() != Integer.parseInt(con[2]));
}
return results; return results;
} }
...@@ -117,4 +170,5 @@ public class CrossServiceImpl implements CrossService { ...@@ -117,4 +170,5 @@ public class CrossServiceImpl implements CrossService {
return crossBaseInfoVO; return crossBaseInfoVO;
} }
} }
...@@ -33,7 +33,6 @@ public class TrunkLineImpl implements TrunkLineService { ...@@ -33,7 +33,6 @@ public class TrunkLineImpl implements TrunkLineService {
List<TrunkLineCrossProblemEntity> list= trunkLineMapper.getTrunkLineCrossProblem(greenID, time); List<TrunkLineCrossProblemEntity> list= trunkLineMapper.getTrunkLineCrossProblem(greenID, time);
TrunkLineCrossProblemEntity ioDir = trunkLineMapper.getIODir(greenID); TrunkLineCrossProblemEntity ioDir = trunkLineMapper.getIODir(greenID);
List<TrunkLineCrossProblemVO> voList = new ArrayList<>(); List<TrunkLineCrossProblemVO> voList = new ArrayList<>();
Map<String, String> IOdirMap = getDir(ioDir.getInDir(), ioDir.getOutDir());
for (TrunkLineCrossProblemEntity e : list) { for (TrunkLineCrossProblemEntity e : list) {
TrunkLineCrossProblemVO vo = new TrunkLineCrossProblemVO(); TrunkLineCrossProblemVO vo = new TrunkLineCrossProblemVO();
...@@ -46,39 +45,16 @@ public class TrunkLineImpl implements TrunkLineService { ...@@ -46,39 +45,16 @@ public class TrunkLineImpl implements TrunkLineService {
String temp = e.getDirection().substring(1, e.getDirection().length() - 1); String temp = e.getDirection().substring(1, e.getDirection().length() - 1);
temp = temp.replace("\"", ""); temp = temp.replace("\"", "");
String[] temp1 = temp.split(","); String[] temp1 = temp.split(",");
Map<String, Integer> directionMap = new HashMap<>();
for (String s : temp1) {
directionMap.put(s, directionMap.getOrDefault(s, 0) + 1);
}
Integer count = directionMap.getOrDefault(IOdirMap.get("dir"), 0); String[] dirStatus = getDirStatus(ioDir.getInDir(), ioDir.getOutDir(), temp1, e.getStatus());
vo.setDir_1_name(dirStatus[0]);
vo.setStatus_1_name(dirStatus[1]);
vo.setDir_2_name(dirStatus[2]);
vo.setStatus_2_name(dirStatus[3]);
if (count == 0) { // 不匹配
vo.setStatus_1(0);
vo.setStatus_2(0);
vo.setStatus_1_name("正常");
vo.setStatus_2_name("正常");
vo.setDir_1_name(IOdirMap.get("dirName"));
vo.setDir_2_name(IOdirMap.get("dirNameReverse"));
} else if (count == 1) { // 匹配一项
vo.setStatus_1(e.getStatus());
vo.setStatus_2(0);
vo.setStatus_2_name(getStatusName(e.getStatus()));
vo.setStatus_1_name("正常");
vo.setDir_1_name(IOdirMap.get("dirName"));
vo.setDir_2_name(IOdirMap.get("dirNameReverse"));
} else if (count == 2) { // 匹配两项
vo.setStatus_1(e.getStatus());
vo.setStatus_2(e.getStatus());
vo.setStatus_1_name(getStatusName(e.getStatus()));
vo.setStatus_2_name(getStatusName(e.getStatus()));
vo.setDir_1_name(IOdirMap.get("dirName"));
vo.setDir_2_name(IOdirMap.get("dirNameReverse"));
}
voList.add(vo); voList.add(vo);
} else { } else {
vo.setStatus_1(0); Map<String, String> IOdirMap = getDirName(ioDir.getInDir(), ioDir.getOutDir());
vo.setStatus_2(0);
vo.setStatus_1_name("正常"); vo.setStatus_1_name("正常");
vo.setStatus_2_name("正常"); vo.setStatus_2_name("正常");
vo.setDir_1_name(IOdirMap.get("dirName")); vo.setDir_1_name(IOdirMap.get("dirName"));
...@@ -91,31 +67,21 @@ public class TrunkLineImpl implements TrunkLineService { ...@@ -91,31 +67,21 @@ public class TrunkLineImpl implements TrunkLineService {
return voList; return voList;
} }
private Map<String, String> getDir(Integer inDir, Integer outDir) { private Map<String, String> getDirName(Integer inDir, Integer outDir) {
// 1 北 3 东 5 南 7 西
// 0 北向南 2东向西 4 西向东 6 南向北
Map<String, String> result = new HashMap<>(); Map<String, String> result = new HashMap<>();
if (inDir == 5 && outDir == 1) { // 南向北 if (inDir == 5 && outDir == 1 || inDir == 1 && outDir == 5) { // 南向北
result.put("dir", "6"); result.put("dir", "6");
result.put("dirReverse", "0");
result.put("dirName", "南向北"); result.put("dirName", "南向北");
result.put("dirNameReverse", "北向南"); result.put("dirNameReverse", "北向南");
return result; return result;
} else if (inDir == 7 && outDir == 3) { // 西向东 } else if (inDir == 7 && outDir == 3 || inDir == 3 && outDir == 7) { // 西向东
result.put("dir", "4"); result.put("dir", "4");
result.put("dirReverse", "2");
result.put("dirName", "西向东"); result.put("dirName", "西向东");
result.put("dirNameReverse", "东向西"); result.put("dirNameReverse", "东向西");
return result; return result;
} else if (inDir == 3 && outDir == 7) { // 东向西
result.put("dir", "2");
result.put("dirName", "东向西");
result.put("dirNameReverse", "西向东");
return result;
} else if (inDir == 1 && outDir == 5) { // 北向南
result.put("dir", "0");
result.put("dirName", "北向南");
result.put("dirNameReverse", "南向北");
return result;
} }
return Collections.emptyMap(); return Collections.emptyMap();
} }
...@@ -136,4 +102,45 @@ public class TrunkLineImpl implements TrunkLineService { ...@@ -136,4 +102,45 @@ public class TrunkLineImpl implements TrunkLineService {
} }
return ""; return "";
} }
/**
* @param inDir 进口方向
* @param outDir 出口方向
* @param dirs 方向数组
* @param status 状态
* @return 方向状态数组[方向1, 状态1, 方向2, 状态2]
*/
private String[] getDirStatus(Integer inDir, Integer outDir, String[] dirs, Integer status) {
Map<String, String> IODirMap = getDirName(inDir, outDir);
String[] result = new String[4];
if (Arrays.asList(dirs).contains(IODirMap.get("dir"))
&& Arrays.asList(dirs).contains(IODirMap.get("dirReverse"))
) {
result[0] = IODirMap.get("dirName");
result[1] = getStatusName(status);
result[2] = IODirMap.get("dirNameReverse");
result[3] = getStatusName(status);
} else if (Arrays.asList(dirs).contains(IODirMap.get("dirReverse"))
&& !Arrays.asList(dirs).contains(IODirMap.get("dir"))) {
result[0] = IODirMap.get("dirName");
result[1] = getStatusName(0);
result[2] = IODirMap.get("dirNameReverse");
result[3] = getStatusName(status);
} else if (Arrays.asList(dirs).contains(IODirMap.get("dir"))
&& !Arrays.asList(dirs).contains(IODirMap.get("dirReverse"))) {
result[0] = IODirMap.get("dirName");
result[1] = getStatusName(status);
result[2] = IODirMap.get("dirNameReverse");
result[3] = getStatusName(0);
} else {
result[0] = IODirMap.get("dirName");
result[1] = getStatusName(0);
result[2] = IODirMap.get("dirNameReverse");
result[3] = getStatusName(0);
}
return result;
}
} }
...@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects;
/** /**
* <p> * <p>
...@@ -56,4 +58,6 @@ public interface AnalysisProblemCrossDayService extends IService<AnalysisProblem ...@@ -56,4 +58,6 @@ public interface AnalysisProblemCrossDayService extends IService<AnalysisProblem
* @return * @return
*/ */
void updateCrossAreaIdByCondition(); void updateCrossAreaIdByCondition();
List<AnalysisProblemCrossDay> selectCountByType(Map<String, Object> map);
} }
...@@ -9,9 +9,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -9,9 +9,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.*;
import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Geometry;
/** /**
...@@ -118,5 +123,10 @@ import org.locationtech.jts.geom.Geometry; ...@@ -118,5 +123,10 @@ import org.locationtech.jts.geom.Geometry;
} }
public List<AnalysisProblemCrossDay> selectCountByType(Map<String, Object> map){
return analysisProblemCrossDayMapper.selectCountByType(map);
}
} }
...@@ -41,7 +41,7 @@ public class BaseAreaInfoServiceImpl implements BaseAreaInfoService { ...@@ -41,7 +41,7 @@ public class BaseAreaInfoServiceImpl implements BaseAreaInfoService {
List<BaseAreaInfoPO> list = baseAreaInfoMapper.selectByType(type); List<BaseAreaInfoPO> list = baseAreaInfoMapper.selectByType(type);
if (list.size() > 0){ if (list.size() > 0){
list.stream().forEach(item ->{ list.stream().forEach(item ->{
List<BaseAreaInfoPO> areaInfoPOList = baseAreaInfoMapper.selectListByParentCode(item.getId()); List<BaseAreaInfoPO> areaInfoPOList = baseAreaInfoMapper.selectByParentCode(item.getId());
if (areaInfoPOList.size() > 0){ if (areaInfoPOList.size() > 0){
item.setAreaInfoPOList(areaInfoPOList); item.setAreaInfoPOList(areaInfoPOList);
} }
......
...@@ -9,6 +9,8 @@ import lombok.Data; ...@@ -9,6 +9,8 @@ import lombok.Data;
public class CrossTurnInfoEntity { public class CrossTurnInfoEntity {
@ApiModelProperty(value = "转向") @ApiModelProperty(value = "转向")
private String turn; private String turn;
@ApiModelProperty(value = "转向描述") @ApiModelProperty(value = "方向")
private String turnName; private String dir;
@ApiModelProperty(value = "转向方向描述")
private String turnDirName;
} }
package net.wanji.opt.task;
import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemGreenDayMapper;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemGreenDay;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.List;
@Component
@Configurable
@EnableScheduling
@Slf4j
@Profile("!dev")
public class AnalysisProblemHourTask {
@Autowired
private AnalysisProblemCrossDayMapper analysisProblemCrossDayMapper;
@Autowired
private AnalysisProblemGreenDayMapper analysisProblemGreenDayMapper;
@Scheduled(cron = "0 1/60 * * * *")
@PostConstruct
public void task(){
analysisProblemCrossDayMapper.insertAnalysisProblemCrossHour();
analysisProblemGreenDayMapper.insertAnalysisProblemGreenHour();
}
}
...@@ -11,18 +11,14 @@ public class TrunkLineCrossProblemVO { ...@@ -11,18 +11,14 @@ public class TrunkLineCrossProblemVO {
private String crossID; private String crossID;
@ApiModelProperty(value = "路口名称") @ApiModelProperty(value = "路口名称")
private String name; private String name;
@ApiModelProperty(value = "状态1")
private Integer status_1;
@ApiModelProperty(value = "状态2")
private Integer status_2;
@ApiModelProperty(value = "状态1名称")
private String status_1_name;
@ApiModelProperty(value = "状态2名称")
private String status_2_name;
@ApiModelProperty(value = "方向1") @ApiModelProperty(value = "方向1")
private String dir_1_name; private String dir_1_name;
@ApiModelProperty(value = "状态1名称")
private String status_1_name;
@ApiModelProperty(value = "方向2") @ApiModelProperty(value = "方向2")
private String dir_2_name; private String dir_2_name;
@ApiModelProperty(value = "状态2名称")
private String status_2_name;
@ApiModelProperty(value = "路口坐标") @ApiModelProperty(value = "路口坐标")
private String wkt; private String wkt;
......
...@@ -62,15 +62,18 @@ ...@@ -62,15 +62,18 @@
<select id="getCrossRealTimeAlarms" parameterType="String" resultMap="CrossRealTimeAlarmsResultMap"> <select id="getCrossRealTimeAlarms" parameterType="String" resultMap="CrossRealTimeAlarmsResultMap">
select select
a.type , a.type ,
MAX(a.start_time) as startTime , a.start_time startTime ,
SUBSTR(a.dir, 2, length(a.dir)-2) as dir SUBSTR(a.dir, 2, length(a.dir)-2) as dir
from from
t_event_info a t_event_info a
where 1=1 where 1=1
and a.cross_id = #{crossID} and a.start_time = (select MAX(start_time) from t_event_info
where cross_id = #{crossID}
<if test="time != null and time != ''"> <if test="time != null and time != ''">
and a.start_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s') and start_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
</if> </if>
)
and a.cross_id = #{crossID}
union union
select select
'' as type, '' as type,
...@@ -127,6 +130,20 @@ ...@@ -127,6 +130,20 @@
<select id="getCrossTurnInfo" parameterType="String" resultType="net.wanji.opt.synthesis.pojo.CrossTurnInfoEntity"> <select id="getCrossTurnInfo" parameterType="String" resultType="net.wanji.opt.synthesis.pojo.CrossTurnInfoEntity">
select distinct t2.turn_type turn, select distinct t2.turn_type turn,
t2.in_dir dir,
CONCAT(
(
case t2.in_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 t2.turn_type case t2.turn_type
when 'u' then '掉头' when 'u' then '掉头'
...@@ -134,10 +151,11 @@ ...@@ -134,10 +151,11 @@
when 's' then '直行' when 's' then '直行'
when 'r' then '右转' when 'r' then '右转'
end end
) turnName )
) turnDirName
from t_base_cross_turn_info t2 from t_base_cross_turn_info t2
where 1 = 1 where 1 = 1
and t2.cross_id = #{corssID} and t2.cross_id = #{crossID}
</select> </select>
<select id="getCrossLaneInfo" parameterType="String" resultType="net.wanji.opt.synthesis.pojo.CrossLaneInfoEntity"> <select id="getCrossLaneInfo" parameterType="String" resultType="net.wanji.opt.synthesis.pojo.CrossLaneInfoEntity">
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
select a.cross_id,b.name,SUBSTR(b.location , 7 , LENGTH(b.location) - 7) as wkt,a.status,a.direction , a.start_time select a.cross_id,b.name,SUBSTR(b.location , 7 , LENGTH(b.location) - 7) as wkt,a.status,a.direction , a.start_time
from t_cross_data_hist a from t_cross_data_hist a
left join t_base_cross_info b on a.cross_id = b.id left join t_base_cross_info b on a.cross_id = b.id
where a.cross_id in (select cross_id from t_greenwave_cross where green_id = 1) where a.cross_id in (select cross_id from t_greenwave_cross where green_id = #{greenID})
<if test="time == null or time == '' "> <if test="time == null or time == '' ">
and DATE_FORMAT(a.start_time, '%Y-%m-%d %H:%i:00')= DATE_FORMAT(FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(DATE_SUB(now(),INTERVAL 5 MINUTE)) / 300 ) * 300), '%Y-%m-%d %H:%i:00') and DATE_FORMAT(a.start_time, '%Y-%m-%d %H:%i:00')= DATE_FORMAT(FROM_UNIXTIME(FLOOR(UNIX_TIMESTAMP(DATE_SUB(now(),INTERVAL 5 MINUTE)) / 300 ) * 300), '%Y-%m-%d %H:%i:00')
</if> </if>
......
...@@ -208,10 +208,31 @@ ...@@ -208,10 +208,31 @@
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now() DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now()
from t_event_info a from t_event_info a
left join t_base_cross_info b on a.cross_id = b.id left join t_base_cross_info b on a.cross_id = b.id
where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (701,702,703) where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (701,702,703,707)
group by a.cross_id, b.area_id,a.category,a.type group by a.cross_id, b.area_id,a.category,a.type
</insert> </insert>
<!-- 新增表t_analysis_problem_cross_dir_hour信息 -->
<insert id="insertAnalysisProblemCrossHour">
insert into t_analysis_problem_cross_dir_hour (id,cross_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time)
select uuid(), d.cross_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2,
DATE_FORMAT(now(),'%Y%m%d') as dt , now()
from
(select DISTINCT b.cross_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir
from
(select a.cross_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir
from t_event_info a
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and a.type in (701,702,703,707) ) b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1
)) d
left join t_base_cross_info e on d.cross_id = e.id
group by d.cross_id, e.area_id,d.category,d.type,d.dir
</insert>
<!-- 根据条件查询表t_analysis_problem_cross_day信息 --> <!-- 根据条件查询表t_analysis_problem_cross_day信息 -->
<select id="checkData" resultMap="AnalysisProblemCrossDayMap"> <select id="checkData" resultMap="AnalysisProblemCrossDayMap">
SELECT dt SELECT dt
...@@ -219,4 +240,36 @@ ...@@ -219,4 +240,36 @@
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')
</select> </select>
<select id="selectCountByType" parameterType="map" resultMap="AnalysisProblemCrossDayMap">
SELECT sum(event_number) as event_number,
tapcd.event_type,
tec.label as typeName
FROM t_analysis_problem_cross_day tapcd
LEFT JOIN t_config_event_category tec ON tapcd.event_type = tec.event_type
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt; #{endTime}
</if>
<if test="areaId != null and areaId != ''">
and tapcd.area_id = #{areaId}
</if>
GROUP BY tapcd.event_type
union
SELECT sum(event_number) as event_number,
tapcd.event_type,
tec.label as typeName
FROM t_analysis_problem_green_day tapcd
LEFT JOIN t_config_event_category tec ON tapcd.event_type = tec.event_type
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt; #{endTime}
</if>
<if test="areaId != null and areaId != ''">
and tapcd.area_id = #{areaId}
</if>
GROUP BY tapcd.event_type
</select>
</mapper> </mapper>
...@@ -171,10 +171,31 @@ ...@@ -171,10 +171,31 @@
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now() DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now()
from t_event_info a from t_event_info a
left join t_greenwave_info b on a.green_id = b.id left join t_greenwave_info b on a.green_id = b.id
where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (705,706,707) and a.green_id != '' where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (705,706) and a.green_id != ''
group by a.cross_id, b.area_id,a.category,a.type group by a.cross_id, b.area_id,a.category,a.type
</insert> </insert>
<!-- 新增表t_analysis_problem_green_hour信息 -->
<insert id="insertAnalysisProblemGreenHour">
insert into t_analysis_problem_green_hour (id,green_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time)
select uuid(), d.green_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2,
DATE_FORMAT(now(),'%Y%m%d') as dt , now()
from
(select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir
from
(select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir
from t_event_info a
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and a.type in (705,706) and a.green_id != '') b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
LENGTH( b.dir ) - LENGTH( REPLACE(b.dir,',','') ) + 1
)) d
left join t_greenwave_info e on d.green_id = e.id
group by d.green_id, e.area_id,d.category,d.type,d.dir
</insert>
<!-- 根据条件查询表t_analysis_problem_green_day信息 --> <!-- 根据条件查询表t_analysis_problem_green_day信息 -->
<select id="checkData" resultMap="AnalysisProblemGreenDayMap"> <select id="checkData" resultMap="AnalysisProblemGreenDayMap">
SELECT dt SELECT dt
......
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