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
jinan
traffic-signal-platform
Commits
d7edecad
Commit
d7edecad
authored
Mar 19, 2025
by
wangtao
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2a945f39
e752778d
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
144 additions
and
13 deletions
+144
-13
AnalysisProblemCrossDayMapper.java
...o/mapper/judgeanalysis/AnalysisProblemCrossDayMapper.java
+12
-0
AnalysisProblemGreenDayMapper.java
...o/mapper/judgeanalysis/AnalysisProblemGreenDayMapper.java
+13
-0
TrendServiceV2Impl.java
...va/net/wanji/opt/servicev2/implv2/TrendServiceV2Impl.java
+13
-5
AnalysisProblemDayTask.java
.../main/java/net/wanji/opt/task/AnalysisProblemDayTask.java
+55
-0
GreenOptCrossOffsetVO.java
...rc/main/java/net/wanji/opt/vo2/GreenOptCrossOffsetVO.java
+2
-0
StatisticsEventTypeCountTimeVO.java
...ava/net/wanji/opt/vo2/StatisticsEventTypeCountTimeVO.java
+2
-0
HoloEventMapper.xml
...ize-service/src/main/resources/mapper/HoloEventMapper.xml
+4
-4
AnalysisProblemCrossDayMapper.xml
...es/mapper/judgeanalysis/AnalysisProblemCrossDayMapper.xml
+18
-0
AnalysisProblemGreenDayMapper.xml
...es/mapper/judgeanalysis/AnalysisProblemGreenDayMapper.xml
+19
-0
CodeGeneratorMyBatis1.java
wj-gernerator/src/main/java/CodeGeneratorMyBatis1.java
+6
-4
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/judgeanalysis/AnalysisProblemCrossDayMapper.java
View file @
d7edecad
...
...
@@ -73,6 +73,18 @@ public interface AnalysisProblemCrossDayMapper extends BaseMapper<AnalysisProble
* @param
*/
List
<
CrossPoint
>
findAreaPoint
();
/**
* 查询表t_base_area_info信息
* @param
*/
List
<
AnalysisProblemCrossDay
>
checkData
();
/**
* 新增表t_analysis_problem_cross_day信息
* @param
*/
Integer
insertAnalysisProblemCrossDay
();
}
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/judgeanalysis/AnalysisProblemGreenDayMapper.java
View file @
d7edecad
...
...
@@ -41,6 +41,19 @@ public interface AnalysisProblemGreenDayMapper extends BaseMapper<AnalysisProble
* @param analysisProblemGreenDay
*/
Integer
addAnalysisProblemGreenDay
(
AnalysisProblemGreenDay
analysisProblemGreenDay
);
/**
* 新增表t_analysis_problem_green_day信息
* @param
*/
Integer
insertAnalysisProblemGreenDay
();
/**
* 根据条件查询表t_analysis_problem_green_day信息
* @param
*/
List
<
AnalysisProblemGreenDay
>
checkData
();
}
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/implv2/TrendServiceV2Impl.java
View file @
d7edecad
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
);
...
...
@@ -310,10 +312,12 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
if
(
last
.
getCount
()
==
0
||
last
.
getDuration
()
==
0
)
{
continue
;
}
double
countRate
=
(
result
.
getCount
()
-
last
.
getCount
())
/
last
.
getCount
()
*
100
;
double
durationRate
=
(
result
.
getDuration
()
-
last
.
getDuration
())
/
last
.
getCount
()
*
100
;
result
.
setCountRate
((
int
)
countRate
);
result
.
setDurationRate
((
int
)
durationRate
);
double
countOffset
=
(
double
)
result
.
getCount
()
-
last
.
getCount
();
double
durationOffset
=
(
double
)
result
.
getDuration
()
-
last
.
getDuration
();
double
countRate
=
countOffset
/
last
.
getCount
();
double
durationRate
=
durationOffset
/
last
.
getDuration
();
result
.
setCountRate
((
int
)
(
Math
.
round
(
countRate
*
100
)
));
result
.
setDurationRate
((
int
)
(
Math
.
round
(
durationRate
*
100
)
));
}
}
...
...
@@ -407,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
);
}
...
...
signal-optimize-service/src/main/java/net/wanji/opt/task/AnalysisProblemDayTask.java
0 → 100644
View file @
d7edecad
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
net.wanji.opt.servicev2.judgeanalysis.impl.AnalysisProblemCrossDayServiceImpl
;
import
net.wanji.opt.servicev2.judgeanalysis.impl.AnalysisProblemGreenDayServiceImpl
;
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
AnalysisProblemDayTask
{
@Autowired
private
AnalysisProblemCrossDayServiceImpl
analysisProblemCrossDayServiceImpl
;
@Autowired
private
AnalysisProblemCrossDayMapper
analysisProblemCrossDayMapper
;
@Autowired
private
AnalysisProblemGreenDayMapper
analysisProblemGreenDayMapper
;
@Autowired
private
AnalysisProblemGreenDayServiceImpl
nalysisProblemGreenDayServiceImpl
;
@Scheduled
(
cron
=
"0 15 0 ? * *"
)
@PostConstruct
public
void
task
(){
//执行检查路口id是否还有area_id没赋值的数据
analysisProblemCrossDayServiceImpl
.
updateCrossAreaIdByCondition
();
//执行检查绿波id是否还有area_id没赋值的数据
nalysisProblemGreenDayServiceImpl
.
updateGreenAreaIdByCondition
();
//检查昨日数据是否有统计
List
<
AnalysisProblemCrossDay
>
list
=
analysisProblemCrossDayMapper
.
checkData
();
if
(
list
.
isEmpty
())
{
analysisProblemCrossDayMapper
.
insertAnalysisProblemCrossDay
();
}
//检查昨日数据是否有统计
List
<
AnalysisProblemGreenDay
>
list1
=
analysisProblemGreenDayMapper
.
checkData
();
if
(
list1
.
isEmpty
())
{
analysisProblemGreenDayMapper
.
insertAnalysisProblemGreenDay
();
}
}
}
signal-optimize-service/src/main/java/net/wanji/opt/vo2/GreenOptCrossOffsetVO.java
View file @
d7edecad
...
...
@@ -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
=
"方案号"
)
...
...
signal-optimize-service/src/main/java/net/wanji/opt/vo2/StatisticsEventTypeCountTimeVO.java
View file @
d7edecad
...
...
@@ -29,5 +29,7 @@ public class StatisticsEventTypeCountTimeVO {
private
Integer
countRate
;
@ApiModelProperty
(
value
=
"同比比例,上一周同一持续时间次数比例"
)
private
Integer
durationRate
;
@ApiModelProperty
(
value
=
"发生时间"
)
private
String
startTime
;
}
signal-optimize-service/src/main/resources/mapper/HoloEventMapper.xml
View file @
d7edecad
...
...
@@ -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>
...
...
@@ -359,7 +359,7 @@
(
select distinct t1.name, t1.id, ifnull(t2.type, '708') type, t1.wkt,
ifnull(TIMESTAMPDIFF(SECOND, t2.start_time, ifnull(t2.end_time,now())), 0) duration,
DATE_FORMAT(ifnull(t2.start_time, curdate()), '%H:%i:%s') as startTime,
DATE_FORMAT(ifnull(t2.start_time, curdate()), '%
Y年%m月%d日%
H:%i:%s') as startTime,
case
when t2.type = '706' then "干线缓行"
when t2.type = '707' then "干线拥堵"
...
...
@@ -371,7 +371,7 @@
union all
select distinct t1.name, t1.id, ifnull(t2.type, '700') type, REPLACE(SUBSTRING(location, 7, 18), ' ', ',') as wkt,
ifnull(TIMESTAMPDIFF(SECOND, t2.start_time, ifnull(t2.end_time,now())), 0) duration,
DATE_FORMAT(ifnull(t2.start_time, curdate()), '%Y年%m月%d日%H:%i') as startTime,
DATE_FORMAT(ifnull(t2.start_time, curdate()), '%Y年%m月%d日%H:%i
:%s
') as startTime,
case
when t2.type = '701' then "相位空放"
when t2.type = '702' then "路口失衡"
...
...
signal-optimize-service/src/main/resources/mapper/judgeanalysis/AnalysisProblemCrossDayMapper.xml
View file @
d7edecad
...
...
@@ -201,4 +201,22 @@
id=#{id}
</update>
<!-- 新增表t_analysis_problem_cross_day信息 -->
<insert
id=
"insertAnalysisProblemCrossDay"
>
insert into t_analysis_problem_cross_day (id,cross_id,area_id,event_category,event_type,event_number,event_total_time,dt,insert_time)
select UUID(), a.cross_id, b.area_id,a.category,a.type,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now()
from t_event_info a
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)
group by a.cross_id, b.area_id,a.category,a.type
</insert>
<!-- 根据条件查询表t_analysis_problem_cross_day信息 -->
<select
id=
"checkData"
resultMap=
"AnalysisProblemCrossDayMap"
>
SELECT dt
FROM t_analysis_problem_cross_day
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')
</select>
</mapper>
signal-optimize-service/src/main/resources/mapper/judgeanalysis/AnalysisProblemGreenDayMapper.xml
View file @
d7edecad
...
...
@@ -163,4 +163,23 @@
,#{insertTime}
)
</insert>
<!-- 新增表t_analysis_problem_green_day信息 -->
<insert
id=
"insertAnalysisProblemGreenDay"
>
insert into t_analysis_problem_green_day (id,green_id,area_id,event_category,event_type,event_number,event_total_time,dt,insert_time)
select UUID(), a.green_id, b.area_id,a.category,a.type,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now()
from t_event_info a
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 != ''
group by a.cross_id, b.area_id,a.category,a.type
</insert>
<!-- 根据条件查询表t_analysis_problem_green_day信息 -->
<select
id=
"checkData"
resultMap=
"AnalysisProblemGreenDayMap"
>
SELECT dt
FROM t_analysis_problem_green_day
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')
</select>
</mapper>
wj-gernerator/src/main/java/CodeGeneratorMyBatis1.java
View file @
d7edecad
...
...
@@ -69,8 +69,8 @@ public class CodeGeneratorMyBatis1 {
// 全局配置
GlobalConfig
gc
=
new
GlobalConfig
();
String
projectPath
=
"./signal-optimize-service"
;
//
String projectPath = "./wj-gernerator/output";
//
String projectPath = "./signal-optimize-service";
String
projectPath
=
"./wj-gernerator/output"
;
gc
.
setOutputDir
(
projectPath
+
"/src/main/java"
);
gc
.
setAuthor
(
AUTHOR
);
...
...
@@ -144,6 +144,8 @@ public class CodeGeneratorMyBatis1 {
templateConfig
.
setServiceImpl
(
"templates/mybatis1/providerImpl.java"
);
templateConfig
.
setController
(
"templates/mybatis1/restServer.java"
);
//使默认的xml目录不再生成,使用自定义的resource/mapper输出目录
templateConfig
.
setXml
(
null
);
mpg
.
setTemplate
(
templateConfig
);
...
...
@@ -168,10 +170,10 @@ public class CodeGeneratorMyBatis1 {
strategy
.
setFieldPrefix
(
"t_"
,
"s_"
,
"dt_"
,
"i_"
,
"bs_"
);
strategy
.
setTablePrefix
(
"t_"
);
mpg
.
setStrategy
(
strategy
);
mpg
.
setTemplateEngine
(
new
FreemarkerTemplateEngine
());
mpg
.
execute
();
System
.
out
.
println
(
"MyBatis Plus Code Generator Finished!!"
);
...
...
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