Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
signal
traffic-signal-platform
Commits
2d8d14d1
Commit
2d8d14d1
authored
Jan 13, 2025
by
zhoushiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
场景详细评价平均指标
parent
92d4f9ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
107 additions
and
5 deletions
+107
-5
GreenwaveHistRestServer.java
...ava/net/wanji/opt/controller/GreenwaveHistRestServer.java
+10
-4
CrossLaneDataHistPoExtend.java
...java/net/wanji/opt/po/base/CrossLaneDataHistPoExtend.java
+4
-0
GreenwaveHistProvider.java
...ain/java/net/wanji/opt/service/GreenwaveHistProvider.java
+12
-0
GreenwaveHistProviderImpl.java
...net/wanji/opt/service/impl/GreenwaveHistProviderImpl.java
+80
-0
GreenwaveHistMapper.xml
...service/src/main/resources/mapper/GreenwaveHistMapper.xml
+1
-1
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/GreenwaveHistRestServer.java
View file @
2d8d14d1
...
@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.MediaType
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
/**
/**
* <p>
* <p>
...
@@ -239,10 +240,10 @@ public class GreenwaveHistRestServer {
...
@@ -239,10 +240,10 @@ public class GreenwaveHistRestServer {
@GetMapping
(
"/findCrossObjectIndex"
)
@GetMapping
(
"/findCrossObjectIndex"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"路口进口【方向级、转向级、车道级】->分粒度指标趋势"
,
notes
=
""
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"路口进口【方向级、转向级、车道级】->分粒度指标趋势"
,
notes
=
""
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"crossId"
,
value
=
"路口ID"
,
required
=
true
,
dataType
=
"String"
,
defaultValue
=
"13
MOD0B5SI
0"
),
@ApiImplicitParam
(
name
=
"crossId"
,
value
=
"路口ID"
,
required
=
true
,
dataType
=
"String"
,
defaultValue
=
"13
O1V0B5SB
0"
),
@ApiImplicitParam
(
name
=
"groupType"
,
value
=
"时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度 4:天粒度 5:按时间范围直接做平均【不分粒度】"
,
required
=
true
,
dataType
=
"Integer"
,
defaultValue
=
"1"
),
@ApiImplicitParam
(
name
=
"groupType"
,
value
=
"时间粒度类型 0:5分钟粒度 1:15分钟粒度 2:30分钟粒度 3:小时粒度 4:天粒度 5:按时间范围直接做平均【不分粒度】"
,
required
=
true
,
dataType
=
"Integer"
,
defaultValue
=
"1"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"截止时间,格式:yyyy-MM-dd HH:mm:ss"
,
required
=
true
,
dataType
=
"String"
,
defaultValue
=
"202
4-12-04
00:00:00"
),
@ApiImplicitParam
(
name
=
"startTime"
,
value
=
"截止时间,格式:yyyy-MM-dd HH:mm:ss"
,
required
=
true
,
dataType
=
"String"
,
defaultValue
=
"202
5-01-13
00:00:00"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"截止时间,格式:yyyy-MM-dd HH:mm:ss"
,
required
=
true
,
dataType
=
"String"
,
defaultValue
=
"202
4-12-04
23:59:59"
),
@ApiImplicitParam
(
name
=
"endTime"
,
value
=
"截止时间,格式:yyyy-MM-dd HH:mm:ss"
,
required
=
true
,
dataType
=
"String"
,
defaultValue
=
"202
5-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"
),
})
})
@ApiResponses
({
@ApiResponses
({
...
@@ -253,7 +254,12 @@ public class GreenwaveHistRestServer {
...
@@ -253,7 +254,12 @@ public class GreenwaveHistRestServer {
JsonViewObject
jsonView
=
JsonViewObject
.
newInstance
();
JsonViewObject
jsonView
=
JsonViewObject
.
newInstance
();
try
{
try
{
JSONObject
list
=
greenwaveHistProvider
.
findGreenWaveCrossLaneIndex
(
crossId
,
startTime
,
endTime
,
groupType
,
objectType
);
JSONObject
list
=
null
;
if
(
Objects
.
equals
(
"5"
,
groupType
))
{
list
=
greenwaveHistProvider
.
findCrossAvgIndex
(
crossId
,
startTime
,
endTime
,
groupType
,
objectType
);
}
else
{
list
=
greenwaveHistProvider
.
findGreenWaveCrossLaneIndex
(
crossId
,
startTime
,
endTime
,
groupType
,
objectType
);
}
jsonView
.
success
(
list
);
jsonView
.
success
(
list
);
}
catch
(
DubboProviderException
e
)
{
}
catch
(
DubboProviderException
e
)
{
jsonView
.
fail
(
I18nResourceBundle
.
getConstants
(
"GET_FAILED_MSG"
));
jsonView
.
fail
(
I18nResourceBundle
.
getConstants
(
"GET_FAILED_MSG"
));
...
...
signal-optimize-service/src/main/java/net/wanji/opt/po/base/CrossLaneDataHistPoExtend.java
View file @
2d8d14d1
...
@@ -23,9 +23,13 @@ public class CrossLaneDataHistPoExtend {
...
@@ -23,9 +23,13 @@ public class CrossLaneDataHistPoExtend {
//方向
//方向
@ApiModelProperty
(
value
=
"方向"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"方向"
,
notes
=
""
)
private
Integer
dirType
;
private
Integer
dirType
;
@ApiModelProperty
(
value
=
"方向描述"
,
notes
=
""
)
private
String
dirTypeName
;
//转向功能
//转向功能
@ApiModelProperty
(
value
=
"转向功能"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"转向功能"
,
notes
=
""
)
private
Integer
turnType
;
private
Integer
turnType
;
@ApiModelProperty
(
value
=
"转向功能描述"
,
notes
=
""
)
private
String
turnTypeName
;
//交通指数
//交通指数
@ApiModelProperty
(
value
=
"交通指数"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"交通指数"
,
notes
=
""
)
private
Double
trafficIndex
;
private
Double
trafficIndex
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/GreenwaveHistProvider.java
View file @
2d8d14d1
...
@@ -128,4 +128,16 @@ public interface GreenwaveHistProvider extends BaseDubboInterface<GreenwaveHist>
...
@@ -128,4 +128,16 @@ public interface GreenwaveHistProvider extends BaseDubboInterface<GreenwaveHist>
* @throws DubboProviderException
* @throws DubboProviderException
*/
*/
JSONObject
findCrossExitRoadDirInfo
(
String
crossId
,
String
startTime
,
String
endTime
,
String
groupType
,
Integer
objectType
)
throws
DubboProviderException
;
JSONObject
findCrossExitRoadDirInfo
(
String
crossId
,
String
startTime
,
String
endTime
,
String
groupType
,
Integer
objectType
)
throws
DubboProviderException
;
/**
*
* @param crossId
* @param startTime
* @param endTime
* @param groupType
* @param objectType
* @return
* @throws DubboProviderException
*/
JSONObject
findCrossAvgIndex
(
String
crossId
,
String
startTime
,
String
endTime
,
String
groupType
,
Integer
objectType
)
throws
DubboProviderException
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/GreenwaveHistProviderImpl.java
View file @
2d8d14d1
...
@@ -2,6 +2,7 @@ package net.wanji.opt.service.impl;
...
@@ -2,6 +2,7 @@ package net.wanji.opt.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.models.auth.In
;
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.enums.TurnConvertEnum
;
import
net.wanji.common.enums.TurnConvertEnum
;
...
@@ -514,6 +515,85 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
...
@@ -514,6 +515,85 @@ public class GreenwaveHistProviderImpl extends BaseDubboInterfaceImpl<GreenwaveH
return
jsonObject
;
return
jsonObject
;
}
}
@Override
public
JSONObject
findCrossAvgIndex
(
String
crossId
,
String
startTime
,
String
endTime
,
String
groupType
,
Integer
objectType
)
throws
DubboProviderException
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"crossId"
,
crossId
);
params
.
put
(
"startDate"
,
startTime
);
params
.
put
(
"endDate"
,
endTime
);
params
.
put
(
"groupType"
,
groupType
);
params
.
put
(
"objectType"
,
objectType
);
//存放时段
Set
<
String
>
sortedSet
=
EsDateIndexUtil
.
getTimeGranularityAxis
(
groupType
,
startTime
,
endTime
);
//======================================================================================================//
//存放所有数据
List
<
Map
<
String
,
Object
>>
allList
=
new
ArrayList
<>();
List
<
CrossLaneDataHistPoExtend
>
list
=
greenwaveHistoryMapper
.
findGreenWaveCrossLaneIndex
(
params
);
list
=
list
.
stream
().
sorted
(
Comparator
.
comparing
(
o
->
o
.
getStartTime
())).
collect
(
Collectors
.
toList
());
//按时间分组分组
Map
<
String
,
List
<
CrossLaneDataHistPoExtend
>>
groupByDir
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getCrossId
()
+
"_"
+
o
.
getDirType
(),
TreeMap:
:
new
,
Collectors
.
toList
()));
Set
<
String
>
hasDataScopeList
=
new
HashSet
<>();
BottomMenuBO
bo
=
new
BottomMenuBO
();
bo
.
setCrossId
(
crossId
);
bo
.
setScope
(
objectType
);
List
<
String
>
scopeList
=
mainlineEvaluateService
.
bottomMenu
(
bo
);
for
(
Map
.
Entry
<
String
,
List
<
CrossLaneDataHistPoExtend
>>
entry
:
groupByDir
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
[]
sps
=
key
.
split
(
"_"
);
String
cid
=
sps
[
0
];
String
dirType
=
sps
[
1
];
String
dirName
=
BaseEnum
.
SignalDirectionEnum
.
getNameByCode
(
Integer
.
valueOf
(
dirType
));
String
dirTurnDesc
=
dirName
+
"进口"
;
Map
<
String
,
Object
>
mapList
=
new
HashMap
<>();
List
<
CrossLaneDataHistPoExtend
>
value
=
entry
.
getValue
().
stream
().
sorted
(
Comparator
.
comparing
(
o
->
o
.
getTurnType
())).
collect
(
Collectors
.
toList
());
value
.
forEach
(
o
->{
if
(
Objects
.
equals
(
2
,
objectType
)
||
Objects
.
equals
(
3
,
objectType
))
{
o
.
setTurnTypeName
(
TurnConvertEnum
.
getDescByKey
(
o
.
getTurnType
()));
hasDataScopeList
.
add
(
dirTurnDesc
+
o
.
getTurnTypeName
());
}
else
{
hasDataScopeList
.
add
(
dirTurnDesc
);
}
});
if
(
Objects
.
nonNull
(
scopeList
))
{
//补充
for
(
String
scopeName1
:
scopeList
)
{
if
(!
hasDataScopeList
.
contains
(
scopeName1
)
&&
scopeName1
.
indexOf
(
dirTurnDesc
)
>
0
)
{
CrossLaneDataHistPoExtend
tmp
=
new
CrossLaneDataHistPoExtend
();
tmp
.
setTurnTypeName
(
scopeName1
.
substring
(
dirTurnDesc
.
length
()));
tmp
.
setTurnType
(
TurnConvertEnum
.
getKeyByCode
(
tmp
.
getTurnTypeName
()));
value
.
add
(
tmp
);
}
}
}
value
=
value
.
stream
().
sorted
(
Comparator
.
comparing
(
o
->
o
.
getLaneId
()+
"_"
+
o
.
getTurnType
())).
collect
(
Collectors
.
toList
());
mapList
.
put
(
"scopeCode"
,
key
);
mapList
.
put
(
"dirName"
,
dirTurnDesc
);
mapList
.
put
(
"list"
,
value
);
allList
.
add
(
mapList
);
}
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"timeList"
,
sortedSet
);
jsonObject
.
put
(
"dataList"
,
allList
);
jsonObject
.
put
(
"scopeList"
,
scopeList
);
return
jsonObject
;
}
@Override
@Override
public
JSONObject
findCrossExitRoadLaneInfo
(
String
crossId
,
String
startTime
,
String
endTime
,
String
groupType
)
{
public
JSONObject
findCrossExitRoadLaneInfo
(
String
crossId
,
String
startTime
,
String
endTime
,
String
groupType
)
{
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
...
...
signal-optimize-service/src/main/resources/mapper/GreenwaveHistMapper.xml
View file @
2d8d14d1
...
@@ -284,7 +284,7 @@
...
@@ -284,7 +284,7 @@
</when>
</when>
<!-- 转向级 -->
<!-- 转向级 -->
<when
test=
"objectType==2"
>
<when
test=
"objectType==2"
>
t.in_dir as dir_type,
t.in_dir
+1
as dir_type,
t.turn_type,
t.turn_type,
null as lane_id,
null as lane_id,
null as service_level,
null as service_level,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment