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
9a8e6f2a
Commit
9a8e6f2a
authored
Feb 24, 2025
by
zhoushiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://106.120.201.126:14725/signal/traffic-signal-platform
parents
2240007d
2a2ad463
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
375 additions
and
52 deletions
+375
-52
SignalSynchronizationTask.java
...in/java/net/wanji/web/task/SignalSynchronizationTask.java
+64
-0
application-docker.properties
...-service/src/main/resources/application-docker.properties
+5
-5
StrategyControlController.java
...i/opt/synthesis/controller/StrategyControlController.java
+26
-0
StrategyControlService.java
...t/wanji/opt/synthesis/service/StrategyControlService.java
+5
-0
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+173
-23
StrategyLockSendVO.java
...ce/src/main/java/net/wanji/opt/vo/StrategyLockSendVO.java
+21
-0
StrategyNameCrossVO.java
...e/src/main/java/net/wanji/opt/vo/StrategyNameCrossVO.java
+8
-1
SignalStatusServiceImpl.java
...nji/utc/hisense/service/impl/SignalStatusServiceImpl.java
+11
-2
StaticInfoServiceImpl.java
...wanji/utc/hisense/service/impl/StaticInfoServiceImpl.java
+18
-17
OkHttpClientUtil.java
...ain/java/net/wanji/utc/hisense/util/OkHttpClientUtil.java
+6
-2
SignalStatusTask.java
...ce/src/main/java/net/wanji/utc/task/SignalStatusTask.java
+2
-2
ApiModelPropertyUtils.java
...c/main/java/net/wanji/utc/util/ApiModelPropertyUtils.java
+36
-0
No files found.
signal-control-service/src/main/java/net/wanji/web/task/SignalSynchronizationTask.java
0 → 100644
View file @
9a8e6f2a
package
net
.
wanji
.
web
.
task
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.dao.mapper.BaseCrossInfoMapper
;
import
net.wanji.databus.po.BaseCrossInfoPO
;
import
net.wanji.databus.vo.CrossInfoVO
;
import
net.wanji.web.service.impl.PlanSendServiceImpl
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.joda.time.LocalDateTime
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author zhouleilei
* 信号机同步任务
* @date 2025/02/18 11:35
*/
//@Component
//@RequiredArgsConstructor
@Slf4j
public
class
SignalSynchronizationTask
{
@Autowired
private
BaseCrossInfoMapper
baseCrossInfoMapper
;
@Autowired
private
PlanSendServiceImpl
planSendService
;
@Scheduled
(
fixedRate
=
1
*
1000
)
public
void
syncSignalStatus
()
{
log
.
info
(
"===开始同步,当前时间:{}"
,
LocalDateTime
.
now
());
CrossInfoVO
crossInfoVO
=
new
CrossInfoVO
();
crossInfoVO
.
setIsSignal
(
1
);
List
<
BaseCrossInfoPO
>
baseCrossInfoPOS
=
baseCrossInfoMapper
.
selectAll
(
crossInfoVO
);
List
<
String
>
errorCrossIds
=
new
ArrayList
<>();
List
<
String
>
okCrossIds
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
baseCrossInfoPOS
))
{
baseCrossInfoPOS
.
forEach
(
po
->
{
CrossIdBO
crossIdBO
=
new
CrossIdBO
();
crossIdBO
.
setCrossId
(
po
.
getId
());
try
{
JsonViewObject
jsonViewObject
=
planSendService
.
syncScheme
(
crossIdBO
);
if
(
jsonViewObject
.
getCode
()
==
200
)
{
okCrossIds
.
add
(
po
.
getId
());
log
.
info
(
"路口同步成功,路口号:{},时间:{}"
,
po
.
getId
(),
LocalDateTime
.
now
());
}
else
{
errorCrossIds
.
add
(
po
.
getId
());
log
.
error
(
"路口同步失败路口号:{},时间:{}"
,
po
.
getId
(),
LocalDateTime
.
now
());
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
});
}
log
.
info
(
"===同步完成,当前时间:{},成功路口:{},失败路口:{}"
,
LocalDateTime
.
now
(),
okCrossIds
,
errorCrossIds
);
System
.
exit
(
0
);
}
}
signal-feign-service/src/main/resources/application-docker.properties
View file @
9a8e6f2a
utc.service.url
=
http://173.17.0.1:32000/utc
utc.dt.service.url
=
http://173.17.0.1:39002/utc-dt
utc.hisense.service.url
=
http://173.17.0.1:39003/utc-hisense
control.url
=
http://173.17.0.1:32001/web
ehualu.url
=
http://173.17.0.1:30015
\ No newline at end of file
utc.service.url
=
http://192.168.150.1:32000/utc
utc.dt.service.url
=
http://192.168.150.1:39002/utc-dt
utc.hisense.service.url
=
http://192.168.150.1:39003/utc-hisense
control.url
=
http://192.168.150.1:32001/web
ehualu.url
=
http://192.168.150.1:30015
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/controller/StrategyControlController.java
View file @
9a8e6f2a
...
...
@@ -9,6 +9,7 @@ import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import
net.wanji.opt.synthesis.pojo.vo.StrategyControlVO
;
import
net.wanji.opt.synthesis.pojo.vo.StrategyFactoryQueryVO
;
import
net.wanji.opt.synthesis.service.StrategyControlService
;
import
net.wanji.opt.vo.StrategyLockSendVO
;
import
net.wanji.opt.vo.StrategyNameCrossVO
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.ws.rs.core.MediaType
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -153,6 +155,30 @@ public class StrategyControlController {
return
strategyControlService
.
strategyFactoryList
(
vo
);
}
@ApiOperation
(
value
=
"策略管理-路口详情-策略锁定"
,
notes
=
"策略管理-路口详情-策略锁定"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/strategyLockSend"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
StrategyNameCrossVO
.
class
),
})
public
JsonViewObject
strategyLockCrossInfo
(
@RequestBody
StrategyLockSendVO
strategyLockSendVO
)
throws
Exception
{
return
strategyControlService
.
strategyLockSend
(
strategyLockSendVO
);
}
@ApiOperation
(
value
=
"策略管理-路口详情-策略恢复"
,
notes
=
"策略管理-路口详情-策略恢复"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/strategyLockRecoverSend"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
StrategyNameCrossVO
.
class
),
})
public
JsonViewObject
strategyLockRecoverSend
(
@RequestBody
StrategyLockSendVO
strategyLockSendVO
)
throws
Exception
{
return
strategyControlService
.
strategyLockRecoverSend
(
strategyLockSendVO
);
}
@ApiOperation
(
value
=
"策略管理-路口详情-优化策略查询"
,
notes
=
"策略管理-路口详情-优化策略查询"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/StrategyControlService.java
View file @
9a8e6f2a
...
...
@@ -6,6 +6,7 @@ import net.wanji.opt.synthesis.pojo.StrategyControlDetailList;
import
net.wanji.opt.synthesis.pojo.StrategyFactoryEntity
;
import
net.wanji.opt.synthesis.pojo.vo.StrategyControlVO
;
import
net.wanji.opt.synthesis.pojo.vo.StrategyFactoryQueryVO
;
import
net.wanji.opt.vo.StrategyLockSendVO
;
import
java.util.List
;
...
...
@@ -39,4 +40,8 @@ public interface StrategyControlService {
JsonViewObject
strategyFactoryDel
(
List
<
Integer
>
ids
)
throws
Exception
;
JsonViewObject
strategyNameCrossInfo
(
String
crossId
)
throws
Exception
;
JsonViewObject
strategyLockSend
(
StrategyLockSendVO
strategyLockSendVO
)
throws
Exception
;
JsonViewObject
strategyLockRecoverSend
(
StrategyLockSendVO
strategyLockSendVO
)
throws
Exception
;
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
9a8e6f2a
This diff is collapsed.
Click to expand it.
signal-optimize-service/src/main/java/net/wanji/opt/vo/StrategyLockSendVO.java
0 → 100644
View file @
9a8e6f2a
package
net
.
wanji
.
opt
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author duanruiming
* @date 2025/02/15 14:51
* @description 策略管理-地图路口详情-策略锁定实体
*/
@Data
@ApiModel
(
value
=
"StrategyLockSendVO"
,
description
=
"策略管理-地图路口详情-策略锁定实体"
)
public
class
StrategyLockSendVO
{
@ApiModelProperty
(
name
=
"路口ID"
,
notes
=
""
)
private
String
crossId
;
@ApiModelProperty
(
name
=
"锁定时间"
,
notes
=
""
)
private
Double
lockTime
;
@ApiModelProperty
(
name
=
"策略编号"
,
notes
=
""
)
private
String
strategyNo
;
}
signal-optimize-service/src/main/java/net/wanji/opt/vo/StrategyNameCrossVO.java
View file @
9a8e6f2a
...
...
@@ -14,5 +14,12 @@ import java.util.List;
@ApiModel
(
value
=
"StrategyNameCrossVO"
,
description
=
"策略管理-路口详情-优化策略返回实体"
)
public
class
StrategyNameCrossVO
{
private
String
currentName
;
private
List
<
String
>
strategyNames
;
private
String
strategyNo
;
private
List
<
Detail
>
details
;
@Data
public
static
class
Detail
{
private
String
strategyName
;
private
String
strategyNo
;
}
}
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/service/impl/SignalStatusServiceImpl.java
View file @
9a8e6f2a
...
...
@@ -273,9 +273,18 @@ public class SignalStatusServiceImpl implements SignalStatusService {
log
.
error
(
"海信灯态推送百度失败:{}"
,
e
.
getMessage
());
}
try
{
HisenseLightStatusPojo
hisenseLightStatusPojo
=
hisenseLightStatusPojos
.
get
(
0
);
String
bodyStr
=
hisenseLightStatusPojo
.
getBody
();
List
<
HisenseLightStatusPojo
.
Body
>
bodies
=
jackson
.
readValue
(
bodyStr
,
new
TypeReference
<
List
<
HisenseLightStatusPojo
.
Body
>>()
{});
for
(
HisenseLightStatusPojo
.
Body
body
:
bodies
)
{
HisenseLightStatusPojo
.
ContentBody
content
=
body
.
getContent
();
String
crossId
=
content
.
getCrossId
();
if
(
StringUtils
.
equalsIgnoreCase
(
"255136"
,
crossId
))
{
OkHttpClientUtil
.
jsonPost
(
yiGouUrl
,
jackson
.
writeValueAsString
(
hisenseLightStatusPojos
));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"海信灯态推送易购失败:{}"
,
e
.
getMessage
()
);
log
.
error
(
"海信灯态推送易购失败:{}"
,
e
);
}
}
...
...
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/service/impl/StaticInfoServiceImpl.java
View file @
9a8e6f2a
...
...
@@ -806,36 +806,37 @@ public class StaticInfoServiceImpl implements StaticInfoService {
element
.
addElement
(
HttpConstants
.
MESSAGETYPE
).
setText
(
HttpConstants
.
MESSAGETYPE_30
);
Element
messageContent
=
(
Element
)
document
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
);
messageContent
.
addElement
(
HttpConstants
.
SPOT
).
setText
(
crossInfoPOExt
.
getCode
());
//获取当前运行的方案号
/*
//获取当前运行的方案号 从灯态中获取
Integer integer = planMap.get(crossSchemeRingsDTO.getCrossId());
/*if (ObjectUtil.isEmpty(integer)){
CoordinationStatus coordinationStatus = crossPlan(crossSchemeRingsDTO.getCrossId());
if (ObjectUtil.isEmpty(coordinationStatus)) {
if (ObjectUtil.isEmpty(integer)){
//获取方案号失败
log.error("请求方案环图前,获取当前运行方案号失败,crossId:{}", crossSchemeRingsDTO.getCrossId());
log.error("请求方案环图前,获取当前运行方案号失败,
没有该路口的灯态信息,
crossId:{}", crossSchemeRingsDTO.getCrossId());
return null;
} else if ("255".equals(coordinationStatus.getCoordPatternStatus())
) {
} else if (255 == integer
) {
//黃闪
CrossSchemeRings crossSchemeRings = new CrossSchemeRings();
crossSchemeRings.setSpot(crossSchemeRingsDTO.getCrossId());
crossSchemeRings.setPattern(coordinationStatus.getCoordPatternStatus(
));
crossSchemeRings.setPattern(String.valueOf(integer
));
return crossSchemeRings;
}
integer = Integer.valueOf(coordinationStatus.getCoordPatternStatus());
}*/
if
(
ObjectUtil
.
isEmpty
(
integer
)){
messageContent.addElement(HttpConstants.PATTERN).setText(String.valueOf(integer));*/
//获取当前运行的方案号 从海信视图获取
CoordinationStatus
coordinationStatus
=
crossPlan
(
crossSchemeRingsDTO
.
getCrossId
());
if
(
ObjectUtil
.
isEmpty
(
coordinationStatus
))
{
//获取方案号失败
log
.
error
(
"请求方案环图前,获取当前运行方案号失败,没有该路口的灯态信息,
crossId:{}"
,
crossSchemeRingsDTO
.
getCrossId
());
log
.
error
(
"请求方案环图前,获取当前运行方案号失败,
crossId:{}"
,
crossSchemeRingsDTO
.
getCrossId
());
return
null
;
}
else
if
(
255
==
integer
)
{
}
else
if
(
"255"
.
equals
(
coordinationStatus
.
getCoordPatternStatus
())
)
{
//黃闪
CrossSchemeRings
crossSchemeRings
=
new
CrossSchemeRings
();
crossSchemeRings
.
setSpot
(
crossSchemeRingsDTO
.
getCrossId
());
crossSchemeRings
.
setPattern
(
String
.
valueOf
(
integer
));
crossSchemeRings
.
setPattern
(
coordinationStatus
.
getCoordPatternStatus
(
));
return
crossSchemeRings
;
}
messageContent
.
addElement
(
HttpConstants
.
PATTERN
).
setText
(
coordinationStatus
.
getCoordPatternStatus
());
messageContent
.
addElement
(
HttpConstants
.
PATTERN
).
setText
(
String
.
valueOf
(
integer
));
//给海信发送http请求
String
post
=
OkHttpClientUtil
.
xmlPost
(
hisenseUrl
,
document
.
asXML
());
...
...
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/util/OkHttpClientUtil.java
View file @
9a8e6f2a
...
...
@@ -6,6 +6,7 @@ import net.wanji.common.utils.tool.StringUtils;
import
okhttp3.*
;
import
java.io.IOException
;
import
java.util.concurrent.TimeUnit
;
/**
* @ClassName OkHttpClient
...
...
@@ -48,7 +49,10 @@ public class OkHttpClientUtil {
return
null
;
}
// 创建 OkHttpClient 实例
OkHttpClient
client
=
new
OkHttpClient
();
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
connectTimeout
(
30
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
30
,
TimeUnit
.
SECONDS
)
.
build
();
// 创建请求体
RequestBody
body
=
RequestBody
.
create
(
json
,
MediaType
.
get
(
"application/json; charset=utf-8"
));
// 创建请求
...
...
@@ -66,7 +70,7 @@ public class OkHttpClientUtil {
}
}
catch
(
Exception
e
)
{
log
.
error
(
"OkHttpClientUtil远程服务url:{}, 调用异常:{}"
,
url
,
e
.
getMessage
());
throw
new
Exception
();
throw
new
Exception
(
e
);
}
return
null
;
}
...
...
signal-utc-service/src/main/java/net/wanji/utc/task/SignalStatusTask.java
View file @
9a8e6f2a
...
...
@@ -325,8 +325,8 @@ public class SignalStatusTask {
}
else
{
Integer
countDown
=
null
;
if
(
phaseMap
.
get
(
dir
)
instanceof
Map
)
{
Map
<
Integer
,
Integer
>
turnMap
=
(
Map
<
Integer
,
Integer
>)
phaseMap
.
get
(
dir
);
countDown
=
turnMap
.
get
(
turn
);
Map
<
String
,
Integer
>
turnMap
=
(
Map
<
String
,
Integer
>)
phaseMap
.
get
(
dir
);
countDown
=
turnMap
.
get
(
String
.
valueOf
(
turn
)
);
}
else
{
countDown
=
(
Integer
)
phaseMap
.
get
(
key
);
}
...
...
signal-utc-service/src/main/java/net/wanji/utc/util/ApiModelPropertyUtils.java
0 → 100644
View file @
9a8e6f2a
package
net
.
wanji
.
utc
.
util
;
import
cn.hutool.core.util.ObjectUtil
;
import
io.swagger.annotations.ApiModelProperty
;
import
net.wanji.databus.dao.entity.BaseCrossSchemePO
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @ClassName ApiModelPropertyUtils
* @Description 通过反射打印 属性的注解
* @Author zhouleilei
* @Date 2025/2/12 17:22
*/
public
class
ApiModelPropertyUtils
{
public
static
void
main
(
String
[]
args
)
{
// GreenwaveScenePO areaIndex = new GreenwaveScenePO();
// System.out.println(areaIndex.toString().replaceAll("=null",""));
// 替换为你的类
Class
<
BaseCrossSchemePO
>
clazz
=
BaseCrossSchemePO
.
class
;
List
<
String
>
list
=
new
ArrayList
<>();
// 遍历所有字段
for
(
Field
field
:
clazz
.
getDeclaredFields
())
{
// 获取 @ApiModelProperty 注解
ApiModelProperty
apiModelProperty
=
field
.
getAnnotation
(
ApiModelProperty
.
class
);
if
(
apiModelProperty
!=
null
)
{
System
.
out
.
print
(
field
.
getName
()
+
"\t"
);
System
.
out
.
println
(
ObjectUtil
.
isNotEmpty
(
apiModelProperty
.
value
())?
apiModelProperty
.
value
():
apiModelProperty
.
name
());
// list.add(apiModelProperty.value());
// 你可以继续打印其他属性如 notes, required 等
}
}
}
}
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