Commit 12b47efb authored by zhoushiguang's avatar zhoushiguang

支持按某个方向查询

parent 9abe1678
...@@ -245,12 +245,13 @@ public class GreenwaveHistRestServer { ...@@ -245,12 +245,13 @@ public class GreenwaveHistRestServer {
@ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-13 00:00:00"), @ApiImplicitParam(name = "startTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-13 00:00:00"),
@ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-13 23:59:59"), @ApiImplicitParam(name = "endTime", value = "截止时间,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String",defaultValue = "2025-01-13 23:59:59"),
@ApiImplicitParam(name = "objectType", value = "统计对象类型 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "Integer",defaultValue = "1"), @ApiImplicitParam(name = "objectType", value = "统计对象类型 1:方向级指标 2:转向级指标 3:车道级指标 4:路口级指标", required = true, dataType = "Integer",defaultValue = "1"),
@ApiImplicitParam(name = "directionName", value = "方向", required = false, dataType = "Integer",defaultValue = "北进口"),
}) })
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "成功", response = CrossLaneDataHistPoExtend.class, @ApiResponse(code = 200, message = "成功", response = CrossLaneDataHistPoExtend.class,
responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")}) responseHeaders = {@ResponseHeader(name = "Content-Type", description = "application/json")})
}) })
public JsonViewObject findGreenWaveCrossObjectIndex(String crossId, String startTime, String endTime,String groupType,Integer objectType) { public JsonViewObject findGreenWaveCrossObjectIndex(String crossId, String startTime, String endTime,String groupType,Integer objectType,@RequestParam(defaultValue = "") String directionName) {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
...@@ -258,7 +259,7 @@ public class GreenwaveHistRestServer { ...@@ -258,7 +259,7 @@ public class GreenwaveHistRestServer {
if (Objects.equals("5",groupType)) { if (Objects.equals("5",groupType)) {
list = greenwaveHistProvider.findCrossAvgIndex(crossId,startTime,endTime,groupType,objectType); list = greenwaveHistProvider.findCrossAvgIndex(crossId,startTime,endTime,groupType,objectType);
}else { }else {
list = greenwaveHistProvider.findCrossObjectIndex(crossId,startTime,endTime,groupType,objectType); list = greenwaveHistProvider.findCrossObjectIndex(crossId,startTime,endTime,groupType,objectType,directionName);
} }
jsonView.success(list); jsonView.success(list);
} catch (DubboProviderException e) { } catch (DubboProviderException e) {
......
...@@ -103,7 +103,7 @@ public interface GreenwaveHistProvider extends BaseDubboInterface<GreenwaveHist> ...@@ -103,7 +103,7 @@ public interface GreenwaveHistProvider extends BaseDubboInterface<GreenwaveHist>
* @return * @return
* @throws DubboProviderException * @throws DubboProviderException
*/ */
JSONObject findCrossObjectIndex(String crossId, String startTime, String endTime, String groupType,Integer objectType) throws DubboProviderException; JSONObject findCrossObjectIndex(String crossId, String startTime, String endTime, String groupType,Integer objectType,String dirName) throws DubboProviderException;
/** /**
......
...@@ -401,14 +401,16 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -401,14 +401,16 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
} }
@Override @Override
public JSONObject findCrossObjectIndex(String crossId, String startTime, String endTime, String groupType, Integer objectType) throws DubboProviderException { public JSONObject findCrossObjectIndex(String crossId, String startTime, String endTime, String groupType, Integer objectType,String directionName) throws DubboProviderException {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("crossId", crossId); params.put("crossId", crossId);
params.put("startDate", startTime); params.put("startDate", startTime);
params.put("endDate", endTime); params.put("endDate", endTime);
params.put("groupType", groupType); params.put("groupType", groupType);
params.put("objectType", objectType); params.put("objectType", objectType);
if (StringUtils.isNotBlank(directionName)) {
params.put("dir", BaseEnum.SignalDirectionEnum.getCodeByName(directionName.substring(0, directionName.indexOf("进口"))));
}
//存放时段 //存放时段
Set<String> sortedSet = EsDateIndexUtil.getTimeGranularityAxis(groupType, startTime, endTime); Set<String> sortedSet = EsDateIndexUtil.getTimeGranularityAxis(groupType, startTime, endTime);
//======================================================================================================// //======================================================================================================//
...@@ -515,7 +517,9 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH ...@@ -515,7 +517,9 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
} }
} }
allList = allList.stream().sorted(Comparator.comparing(o -> Integer.valueOf(o.get("dirType").toString()))).collect(Collectors.toList()); allList = allList.stream().sorted(Comparator.comparing(o -> Integer.valueOf(o.get("dirType").toString()))).collect(Collectors.toList());
if (params.get("dir") != null) {
allList = allList.stream().filter(o->Objects.equals(params.get("dir").toString(),o.get("dirType").toString())).collect(Collectors.toList());
}
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("timeList", sortedSet); jsonObject.put("timeList", sortedSet);
jsonObject.put("dataList", allList); jsonObject.put("dataList", allList);
......
...@@ -361,6 +361,28 @@ ...@@ -361,6 +361,28 @@
<!-- AND start_time >= #{startDate} and start_time &lt; #{endDate} --> <!-- AND start_time >= #{startDate} and start_time &lt; #{endDate} -->
and batch_time between UNIX_TIMESTAMP(#{startDate}) and UNIX_TIMESTAMP(#{endDate}) and batch_time between UNIX_TIMESTAMP(#{startDate}) and UNIX_TIMESTAMP(#{endDate})
</if> </if>
<choose>
<!-- 方向级 -->
<when test="objectType==1">
<if test="dir !=null and dir !=null">
and dir_type = #{dir}
</if>
</when>
<!-- 转向级 -->
<when test="objectType==2">
<if test="dir !=null and dir !=null">
and t.in_dir = #{dir}
</if>
</when>
<!-- 车道级 -->
<when test="objectType==3">
<if test="dir !=null and dir !=null">
and t2.dir = #{dir}
</if>
</when>
<otherwise>
</otherwise>
</choose>
) t ) t
<choose> <choose>
<!-- 方向级 --> <!-- 方向级 -->
......
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