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
a38fb65a
Commit
a38fb65a
authored
Sep 21, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 优化海信灯态倒计时
parent
97d6a8db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
9 deletions
+49
-9
DataBrainDirEnum.java
.../net/wanji/utc/hisense/common/enums/DataBrainDirEnum.java
+8
-8
HisensePhaseCountDownTask.java
...net/wanji/utc/hisense/task/HisensePhaseCountDownTask.java
+41
-1
No files found.
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/common/enums/DataBrainDirEnum.java
View file @
a38fb65a
...
...
@@ -14,14 +14,14 @@ import java.util.Objects;
@AllArgsConstructor
@RequiredArgsConstructor
public
enum
DataBrainDirEnum
{
ZERO
(
0
,
5
),
ONE
(
1
,
6
),
TWO
(
2
,
7
),
THREE
(
3
,
8
),
FOUR
(
4
,
1
),
FIVE
(
5
,
2
),
SIX
(
6
,
3
),
SEVEN
(
7
,
4
);
ZERO
(
0
,
1
),
ONE
(
1
,
2
),
TWO
(
2
,
3
),
THREE
(
3
,
4
),
FOUR
(
4
,
5
),
FIVE
(
5
,
6
),
SIX
(
6
,
7
),
SEVEN
(
7
,
8
);
private
Integer
hisenseDir
;
private
Integer
wjLightsDir
;
...
...
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/task/HisensePhaseCountDownTask.java
View file @
a38fb65a
package
net
.
wanji
.
utc
.
hisense
.
task
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.utils.tool.StringUtils
;
import
net.wanji.databus.dao.entity.CrossPhasePO
;
import
net.wanji.databus.dao.entity.CrossSchemePO
;
import
net.wanji.databus.dao.mapper.CrossPhaseMapper
;
import
net.wanji.databus.dao.mapper.CrossSchemeMapper
;
import
net.wanji.databus.vo.LightsStatusVO
;
import
net.wanji.utc.hisense.cache.SignalDataCache
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
...
...
@@ -14,8 +22,14 @@ import java.util.Objects;
* @date 2023/09/20 14:25
*/
@Component
@Slf4j
public
class
HisensePhaseCountDownTask
{
@Resource
private
CrossPhaseMapper
crossPhaseMapper
;
@Resource
private
CrossSchemeMapper
crossSchemeMapper
;
@Scheduled
(
fixedRate
=
1000
,
initialDelay
=
1000
)
public
void
phaseTimeCountDown
()
{
Map
<
String
,
LightsStatusVO
>
runningStateInfoCache4DataBrain
=
SignalDataCache
.
runningStateInfoCache4DataBrain
;
...
...
@@ -26,8 +40,34 @@ public class HisensePhaseCountDownTask {
LightsStatusVO
lightsStatusVO
=
entry
.
getValue
();
String
schemeStartTime
=
lightsStatusVO
.
getSchemeStartTime
();
Long
lastPhaseTimeStamp
=
runningStatusStampMap
.
get
(
crossId
);
String
phaseId
=
lightsStatusVO
.
getPhaseId
();
String
schemeId
=
lightsStatusVO
.
getSchemeId
();
// log.error("当前相位号:{},上一时间戳:{},当前时间时间戳:{}", crossId, lastPhaseTimeStamp, schemeStartTime);
// log.error("当前路口参数:{}", entry);
if
(
Objects
.
nonNull
(
lastPhaseTimeStamp
)
&&
StringUtils
.
equalsIgnoreCase
(
schemeStartTime
,
String
.
valueOf
(
lastPhaseTimeStamp
)))
{
lightsStatusVO
.
setCycleCountDown
(
lightsStatusVO
.
getCycleCountDown
()
-
1
);
CrossSchemePO
crossSchemePO
=
crossSchemeMapper
.
selectByCrossIdAndSchemeNo
(
crossId
,
Integer
.
valueOf
(
schemeId
));
if
(
lightsStatusVO
.
getCyclePhaseCountDown
()
==
0
&&
Objects
.
nonNull
(
crossSchemePO
))
{
List
<
CrossPhasePO
>
crossPhasePOS
=
crossPhaseMapper
.
selectByCrossIdAndPlanId
(
crossId
,
String
.
valueOf
(
crossSchemePO
.
getId
()));
Integer
nextPhaseTime
=
0
;
String
nextPhaseId
=
"0"
;
if
(!
CollectionUtils
.
isEmpty
(
crossPhasePOS
))
{
for
(
int
i
=
0
;
i
<
crossPhasePOS
.
size
();
i
++)
{
if
(
StringUtils
.
equalsIgnoreCase
(
phaseId
,
crossPhasePOS
.
get
(
i
).
getPhaseNo
()))
{
if
(
i
==
crossPhasePOS
.
size
()
-
1
)
{
nextPhaseTime
=
crossPhasePOS
.
get
(
0
).
getPhaseTime
();
nextPhaseId
=
"1"
;
}
else
{
nextPhaseTime
=
crossPhasePOS
.
get
(
i
+
1
).
getPhaseTime
();
nextPhaseId
=
crossPhasePOS
.
get
(
i
+
1
).
getPhaseNo
();
}
}
}
}
lightsStatusVO
.
setPhaseId
(
nextPhaseId
);
lightsStatusVO
.
setCyclePhaseCountDown
(
nextPhaseTime
);
}
else
{
lightsStatusVO
.
setCyclePhaseCountDown
(
lightsStatusVO
.
getCyclePhaseCountDown
()
-
1
);
}
runningStateInfoCache4DataBrain
.
put
(
crossId
,
lightsStatusVO
);
}
}
...
...
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