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
ac6c36d4
Commit
ac6c36d4
authored
Jun 25, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
db754279
b8331bb4
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
409 additions
and
37 deletions
+409
-37
Constants.java
...c/main/java/net/wanji/com/common/constants/Constants.java
+10
-0
CommandResultSign.java
...in/java/net/wanji/com/common/enums/CommandResultSign.java
+3
-3
SectionControlModeEnum.java
...va/net/wanji/com/common/enums/SectionControlModeEnum.java
+38
-0
ControlCommandController.java
...va/net/wanji/com/controller/ControlCommandController.java
+3
-4
CommandResultSign.java
...va/net/wanji/com/netty/commandsign/CommandResultSign.java
+2
-2
SetAlarmInfoService.java
...anji/com/netty/response/impl/set/SetAlarmInfoService.java
+1
-1
SetBaseInfoService.java
...wanji/com/netty/response/impl/set/SetBaseInfoService.java
+1
-1
SetControlInfoService.java
...ji/com/netty/response/impl/set/SetControlInfoService.java
+1
-1
SetDailyPlanInfoService.java
.../com/netty/response/impl/set/SetDailyPlanInfoService.java
+1
-1
SetDetectorInfoService.java
...i/com/netty/response/impl/set/SetDetectorInfoService.java
+1
-1
SetDeviceInfoService.java
...nji/com/netty/response/impl/set/SetDeviceInfoService.java
+1
-1
SetFaultInfoService.java
...anji/com/netty/response/impl/set/SetFaultInfoService.java
+1
-1
SetLightsGroupInfoService.java
...om/netty/response/impl/set/SetLightsGroupInfoService.java
+1
-1
SetPhaseInfoService.java
...anji/com/netty/response/impl/set/SetPhaseInfoService.java
+1
-1
SetPhaseSecurityInfoService.java
.../netty/response/impl/set/SetPhaseSecurityInfoService.java
+1
-1
SetSchedulesInfoService.java
.../com/netty/response/impl/set/SetSchedulesInfoService.java
+1
-1
SetSchemeInfoService.java
...nji/com/netty/response/impl/set/SetSchemeInfoService.java
+1
-1
SetStageInfoService.java
...anji/com/netty/response/impl/set/SetStageInfoService.java
+1
-1
SetTrafficDataInfoService.java
...om/netty/response/impl/set/SetTrafficDataInfoService.java
+1
-1
ControlCommandService.java
...t/wanji/com/service/controller/ControlCommandService.java
+2
-4
DTControlCommandServiceImpl.java
.../service/controller/impl/DTControlCommandServiceImpl.java
+278
-9
DTStaticInfoServiceImpl.java
.../com/service/controller/impl/DTStaticInfoServiceImpl.java
+2
-1
CommonUtils.java
...service/src/main/java/net/wanji/com/util/CommonUtils.java
+57
-0
No files found.
signal-utc-dt-service/src/main/java/net/wanji/com/common/constants/Constants.java
View file @
ac6c36d4
...
@@ -15,6 +15,8 @@ public class Constants {
...
@@ -15,6 +15,8 @@ public class Constants {
public
static
final
String
COMMAND_TAIL
=
"7d"
;
public
static
final
String
COMMAND_TAIL
=
"7d"
;
// 操作类型, 数据对象id替换
// 操作类型, 数据对象id替换
public
static
final
String
COMMAND_COMMON
=
"010001000000010001%s010105%s000000"
;
public
static
final
String
COMMAND_COMMON
=
"010001000000010001%s010105%s000000"
;
public
static
final
String
COMMAND_SET_COMMON
=
"010001000000010001%s%s0105%s"
;
public
static
final
String
COMMAND_CENTER_COMMON
=
"010001000000010001%s010105%s%s"
;
public
static
final
String
COMMAND_HEART_BEAT_QUERY
=
"01000100000001000170"
;
public
static
final
String
COMMAND_HEART_BEAT_QUERY
=
"01000100000001000170"
;
public
static
final
String
COMMAND_HEART_BEAT_REPLY
=
"80"
;
public
static
final
String
COMMAND_HEART_BEAT_REPLY
=
"80"
;
public
static
final
String
COMMAND_QUERY
=
"10"
;
public
static
final
String
COMMAND_QUERY
=
"10"
;
...
@@ -30,6 +32,14 @@ public class Constants {
...
@@ -30,6 +32,14 @@ public class Constants {
public
static
final
String
COMMAND_DEVICE_STATUS
=
"0d01"
;
public
static
final
String
COMMAND_DEVICE_STATUS
=
"0d01"
;
public
static
final
String
COMMAND_RUNNING_STATUS
=
"0d02"
;
public
static
final
String
COMMAND_RUNNING_STATUS
=
"0d02"
;
public
static
final
String
COMMAND_FAULT_LIST
=
"1001"
;
public
static
final
String
COMMAND_FAULT_LIST
=
"1001"
;
public
static
final
String
COMMAND_SET
=
"30"
;
public
static
final
String
COMMAND_SET_REPLY
=
"40"
;
public
static
final
String
COMMAND_CENTER_COMMON_SIGN
=
"1101"
;
public
static
final
String
COMMAND_CENTER_CONTROL_STAGE
=
"11010201"
;
public
static
final
String
COMMAND_CENTER_CONTROL_SCHEME
=
"11010301"
;
public
static
final
String
COMMAND_CENTER_CONTROL_MODEL
=
"11010401"
;
public
static
final
String
COMMAND_CENTER_CHANNEL_MODEL
=
"1201"
;
/**
/**
* 通过发送报文内容,添加报文长度,crc校验,报文头尾
* 通过发送报文内容,添加报文长度,crc校验,报文头尾
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/common/enums/CommandResultSign.java
View file @
ac6c36d4
...
@@ -36,12 +36,12 @@ public enum CommandResultSign {
...
@@ -36,12 +36,12 @@ public enum CommandResultSign {
SET_STAGE_INFO
(
"3006"
,
"setStageInfoService"
),
SET_STAGE_INFO
(
"3006"
,
"setStageInfoService"
),
SET_PHASE_SECURITY_INFO
(
"3007"
,
"setPhaseSecurityInfoService"
),
SET_PHASE_SECURITY_INFO
(
"3007"
,
"setPhaseSecurityInfoService"
),
SET_SCHEME_INFO
(
"3009"
,
"setSchemeInfoService"
),
SET_SCHEME_INFO
(
"3009"
,
"setSchemeInfoService"
),
SET_DAILY_PLAN_INFO
(
"
3011
"
,
"setDailyPlanInfoService"
),
SET_DAILY_PLAN_INFO
(
"
0b0240
"
,
"setDailyPlanInfoService"
),
SET_SCHEDULES_INFO
(
"
3012
"
,
"setSchedulesInfoService"
),
SET_SCHEDULES_INFO
(
"
090240
"
,
"setSchedulesInfoService"
),
SET_TRAFFIC_DATA_INFO
(
"3014"
,
"setTrafficDataInfoService"
),
SET_TRAFFIC_DATA_INFO
(
"3014"
,
"setTrafficDataInfoService"
),
SET_ALARM_INFO
(
"3015"
,
"setAlarmInfoService"
),
SET_ALARM_INFO
(
"3015"
,
"setAlarmInfoService"
),
SET_FAULT_INFO
(
"3016"
,
"setFaultInfoService"
),
SET_FAULT_INFO
(
"3016"
,
"setFaultInfoService"
),
SET_CONTROL_INFO
(
"
4017
"
,
"setControlInfoService"
);
SET_CONTROL_INFO
(
"
110140
"
,
"setControlInfoService"
);
private
String
hexSign
;
private
String
hexSign
;
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/common/enums/SectionControlModeEnum.java
0 → 100644
View file @
ac6c36d4
package
net
.
wanji
.
com
.
common
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
java.util.Objects
;
/**
* @author duanruiming
* @date 2023/06/21 9:31
*/
@Getter
@AllArgsConstructor
@RequiredArgsConstructor
public
enum
SectionControlModeEnum
{
FIXED_CYCLE
(
1
,
"21"
,
"定周期"
),
GREEN_WAVE
(
2
,
"13"
,
"绿灯"
),
YELLOW_CONTROL
(
3
,
"31"
,
"黄灯"
),
RED_CONTROL
(
4
,
"32"
,
"红灯"
),
CLOSED_CONTROL
(
5
,
"33"
,
"关灯"
),
SELF_CONTROL
(
6
,
"14"
,
"绿闪"
),
FULL_INDUCTION
(
7
,
"31"
,
"黄闪"
),
HALF_INDUCTION
(
8
,
"32"
,
"红闪"
);
private
Integer
wjControl
;
private
String
dtControlHex
;
private
String
message
;
public
static
String
getDtControlMode
(
Integer
wjControlHex
)
{
for
(
ControlModelEnum
value
:
ControlModelEnum
.
values
())
{
if
(
Objects
.
equals
(
wjControlHex
,
value
.
getWjControl
()))
{
return
value
.
getDtControlHex
();
}
}
return
null
;
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/controller/ControlCommandController.java
View file @
ac6c36d4
...
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiImplicitParam;
...
@@ -5,7 +5,6 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
net.wanji.com.common.constants.Constants
;
import
net.wanji.com.service.controller.ControlCommandService
;
import
net.wanji.com.service.controller.ControlCommandService
;
import
net.wanji.common.annotation.aspect.AspectLog
;
import
net.wanji.common.annotation.aspect.AspectLog
;
import
net.wanji.common.enums.BaseEnum
;
import
net.wanji.common.enums.BaseEnum
;
...
@@ -90,7 +89,7 @@ public class ControlCommandController {
...
@@ -90,7 +89,7 @@ public class ControlCommandController {
@ApiOperation
(
value
=
"全红控制-路口全红控制/恢复"
,
notes
=
"全红控制-路口全红控制/恢复"
)
@ApiOperation
(
value
=
"全红控制-路口全红控制/恢复"
,
notes
=
"全红控制-路口全红控制/恢复"
)
@PostMapping
(
"/allRedControl"
)
@PostMapping
(
"/allRedControl"
)
public
JsonViewObject
allRedControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
public
JsonViewObject
allRedControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
return
controlCommandService
.
setSignalControl
(
commandVO
.
getCrossCode
(),
commandVO
.
getCommand
(),
Constants
.
ALL_RED_CONTROL
);
return
controlCommandService
.
setSignalControl
(
commandVO
);
}
}
/**
/**
...
@@ -104,7 +103,7 @@ public class ControlCommandController {
...
@@ -104,7 +103,7 @@ public class ControlCommandController {
@ApiOperation
(
value
=
"黄闪控制-路口黄闪控制/恢复"
,
notes
=
"黄闪控制-路口黄闪控制/恢复"
)
@ApiOperation
(
value
=
"黄闪控制-路口黄闪控制/恢复"
,
notes
=
"黄闪控制-路口黄闪控制/恢复"
)
@PostMapping
(
"/yellowLightControl"
)
@PostMapping
(
"/yellowLightControl"
)
public
JsonViewObject
yellowLightControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
public
JsonViewObject
yellowLightControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
return
controlCommandService
.
setSignalControl
(
commandVO
.
getCrossCode
(),
commandVO
.
getCommand
(),
Constants
.
YELLOW_LIGHT_CONTROL
);
return
controlCommandService
.
setSignalControl
(
commandVO
);
}
}
/**
/**
...
@@ -118,7 +117,7 @@ public class ControlCommandController {
...
@@ -118,7 +117,7 @@ public class ControlCommandController {
@ApiOperation
(
value
=
"关灯控制-路口关灯控制/开灯"
,
notes
=
"关灯控制-路口关灯控制/开灯"
)
@ApiOperation
(
value
=
"关灯控制-路口关灯控制/开灯"
,
notes
=
"关灯控制-路口关灯控制/开灯"
)
@PostMapping
(
"/closeLightControl"
)
@PostMapping
(
"/closeLightControl"
)
public
JsonViewObject
closeLightControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
public
JsonViewObject
closeLightControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
return
controlCommandService
.
setSignalControl
(
commandVO
.
getCrossCode
(),
commandVO
.
getCommand
(),
Constants
.
CLOSE_LIGHT_CONTROL
);
return
controlCommandService
.
setSignalControl
(
commandVO
);
}
}
/**
/**
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/netty/commandsign/CommandResultSign.java
View file @
ac6c36d4
package
net
.
wanji
.
com
.
netty
.
commandsign
;
package
net
.
wanji
.
com
.
netty
.
commandsign
;
import
net.wanji.common.utils.tool
.StringUtils
;
import
org.apache.commons.lang3
.StringUtils
;
/**
/**
* @author duanruiming
* @author duanruiming
...
@@ -12,7 +12,7 @@ public class CommandResultSign {
...
@@ -12,7 +12,7 @@ public class CommandResultSign {
String
sign
=
null
;
String
sign
=
null
;
if
(
StringUtils
.
isNotBlank
(
data
))
{
if
(
StringUtils
.
isNotBlank
(
data
))
{
sign
=
data
.
substring
(
24
,
26
);
sign
=
data
.
substring
(
24
,
26
);
if
(
StringUtils
.
equals
IgnoreCase
(
"80"
,
sign
))
{
if
(
StringUtils
.
equals
(
"80"
,
sign
))
{
return
sign
;
return
sign
;
}
}
sign
=
data
.
substring
(
32
,
36
).
concat
(
sign
);
sign
=
data
.
substring
(
32
,
36
).
concat
(
sign
);
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetAlarmInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetAlarmInfoService
implements
CommandResponseFactory
{
public
class
SetAlarmInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetBaseInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetBaseInfoService
implements
CommandResponseFactory
{
public
class
SetBaseInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetControlInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetControlInfoService
implements
CommandResponseFactory
{
public
class
SetControlInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetDailyPlanInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetDailyPlanInfoService
implements
CommandResponseFactory
{
public
class
SetDailyPlanInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetDetectorInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetDetectorInfoService
implements
CommandResponseFactory
{
public
class
SetDetectorInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetDeviceInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetDeviceInfoService
implements
CommandResponseFactory
{
public
class
SetDeviceInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetFaultInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetFaultInfoService
implements
CommandResponseFactory
{
public
class
SetFaultInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetLightsGroupInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetLightsGroupInfoService
implements
CommandResponseFactory
{
public
class
SetLightsGroupInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetPhaseInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetPhaseInfoService
implements
CommandResponseFactory
{
public
class
SetPhaseInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetPhaseSecurityInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetPhaseSecurityInfoService
implements
CommandResponseFactory
{
public
class
SetPhaseSecurityInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetSchedulesInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetSchedulesInfoService
implements
CommandResponseFactory
{
public
class
SetSchedulesInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetSchemeInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetSchemeInfoService
implements
CommandResponseFactory
{
public
class
SetSchemeInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetStageInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetStageInfoService
implements
CommandResponseFactory
{
public
class
SetStageInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/netty/response/impl/set/SetTrafficDataInfoService.java
View file @
ac6c36d4
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
...
@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public
class
SetTrafficDataInfoService
implements
CommandResponseFactory
{
public
class
SetTrafficDataInfoService
implements
CommandResponseFactory
{
@Override
@Override
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
public
String
getCommandResponse
(
CommandPojo
commandPojo
)
{
return
null
;
return
commandPojo
.
getResponseMsg
()
;
}
}
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/service/controller/ControlCommandService.java
View file @
ac6c36d4
...
@@ -53,13 +53,11 @@ public interface ControlCommandService extends BeanMarkService{
...
@@ -53,13 +53,11 @@ public interface ControlCommandService extends BeanMarkService{
/**
/**
* 设置信号机控制模式
* 设置信号机控制模式
*
*
* @param code 信号机编号
* @param commandVO 信号机编号
* @param command 指令 1 开 0 关
* @param commandType 命令类型
* @return
* @return
* @throws Exception 异常
* @throws Exception 异常
*/
*/
JsonViewObject
setSignalControl
(
String
code
,
Integer
command
,
Integer
commandType
)
throws
Exception
;
JsonViewObject
setSignalControl
(
ControlCommandVO
commandVO
)
throws
Exception
;
/**
/**
* 恢复时间表
* 恢复时间表
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/service/controller/impl/DTControlCommandServiceImpl.java
View file @
ac6c36d4
package
net
.
wanji
.
com
.
service
.
controller
.
impl
;
package
net
.
wanji
.
com
.
service
.
controller
.
impl
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.com.cache.CrossInfoCache
;
import
net.wanji.com.common.constants.Constants
;
import
net.wanji.com.common.enums.ControlModelEnum
;
import
net.wanji.com.common.enums.SectionControlModeEnum
;
import
net.wanji.com.netty.NettyClient
;
import
net.wanji.com.netty.NettyClient
;
import
net.wanji.com.pojo.netty.MessageResultPojo
;
import
net.wanji.com.pojo.netty.MessageResultPojo
;
import
net.wanji.com.service.controller.ControlCommandService
;
import
net.wanji.com.service.controller.ControlCommandService
;
import
net.wanji.com.util.CommonUtils
;
import
net.wanji.common.enums.BaseEnum
;
import
net.wanji.common.enums.BaseEnum
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.databus.po.CrossInfoPO
;
import
net.wanji.databus.vo.*
;
import
net.wanji.databus.vo.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
/**
* @author duanruiming
* @author duanruiming
* @date 2023/05/08 10:43
* @date 2023/05/08 10:43
*/
*/
@Service
@Service
@RequiredArgsConstructor
@Slf4j
public
class
DTControlCommandServiceImpl
implements
ControlCommandService
{
public
class
DTControlCommandServiceImpl
implements
ControlCommandService
{
private
final
CrossInfoCache
crossInfoCache
;
@Override
@Override
public
String
getBeanMark
()
{
public
String
getBeanMark
()
{
return
BaseEnum
.
VendorTypeEnum
.
DT
.
getNick
();
return
BaseEnum
.
VendorTypeEnum
.
DT
.
getNick
();
...
@@ -22,24 +41,209 @@ public class DTControlCommandServiceImpl implements ControlCommandService {
...
@@ -22,24 +41,209 @@ public class DTControlCommandServiceImpl implements ControlCommandService {
@Override
@Override
public
JsonViewObject
schemeSend
(
SchemeSendVO
schemeSendVO
)
throws
Exception
{
public
JsonViewObject
schemeSend
(
SchemeSendVO
schemeSendVO
)
throws
Exception
{
String
hex
=
""
;
String
crossId
=
schemeSendVO
.
getCrossCode
();
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
"ip"
,
5050
,
hex
,
"aabb"
,
300
);
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
crossId
);
return
null
;
List
<
SchemeSendVO
.
Pattern
>
schemeVOList
=
schemeSendVO
.
getPatternList
();
setSchemePhaseStageInfo
(
crossInfoPO
,
schemeVOList
);
return
JsonViewObject
.
newInstance
().
success
(
"下发成功异常"
);
}
private
void
setSchemePhaseStageInfo
(
CrossInfoPO
crossInfoPO
,
List
<
SchemeSendVO
.
Pattern
>
schemeVOList
)
{
setPhaseStageInfo
(
crossInfoPO
,
schemeVOList
);
setSchemeInfo
(
crossInfoPO
,
schemeVOList
);
}
private
void
setSchemeInfo
(
CrossInfoPO
crossInfoPO
,
List
<
SchemeSendVO
.
Pattern
>
schemeVOList
)
{
for
(
SchemeSendVO
.
Pattern
schemeVO
:
schemeVOList
)
{
String
schemeNo
=
schemeVO
.
getPatternNo
();
String
cycle
=
schemeVO
.
getCycle
();
String
offset
=
schemeVO
.
getOffset
();
List
<
SchemeSendVO
.
Pattern
.
Ring
>
rings
=
schemeVO
.
getRings
();
for
(
SchemeSendVO
.
Pattern
.
Ring
ring
:
rings
)
{
String
ringNo
=
ring
.
getRingNo
();
List
<
SchemeSendVO
.
Pattern
.
Ring
.
Phase
>
phaseList
=
ring
.
getPhaseList
();
}
}
}
private
void
setPhaseStageInfo
(
CrossInfoPO
crossInfoPO
,
List
<
SchemeSendVO
.
Pattern
>
schemeVOList
)
{
}
}
@Override
@Override
public
JsonViewObject
planSend
(
PlanSendVO
planSendVO
)
throws
Exception
{
public
JsonViewObject
planSend
(
PlanSendVO
planSendVO
)
throws
Exception
{
return
null
;
String
crossId
=
planSendVO
.
getCrossCode
();
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
crossId
);
List
<
PlanSendVO
.
Plan
>
planList
=
planSendVO
.
getPlanList
();
StringBuilder
sb
=
new
StringBuilder
();
for
(
PlanSendVO
.
Plan
plan
:
planList
)
{
sb
.
append
(
buidDailyPlanHex
(
plan
));
}
// 只下发有效计划返回报错
if
(
planList
.
size
()
<
8
)
{
for
(
int
i
=
planList
.
size
()
+
1
;
i
<=
8
-
planList
.
size
();
i
++)
{
PlanSendVO
.
Plan
plan
=
new
PlanSendVO
.
Plan
();
plan
.
setPlanNo
(
String
.
valueOf
(
i
));
sb
.
append
(
buidDailyPlanHex
(
plan
));
}
}
String
bodyValueLength
=
String
.
format
(
"%02x"
,
planList
.
size
()
*
5
);
// 调度数量 * 属性数量
String
message
=
String
.
format
(
Constants
.
COMMAND_SET_COMMON
,
Constants
.
COMMAND_SET
,
bodyValueLength
,
sb
.
substring
(
0
,
sb
.
length
()
-
4
));
String
planSign
=
StringUtils
.
join
(
Constants
.
COMMAND_DAILYPLAN_CONFIG
,
Constants
.
COMMAND_SET_REPLY
);
String
planMessageHex
=
Constants
.
buildMessage
(
message
);
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
crossInfoPO
.
getIp
(),
crossInfoPO
.
getPort
(),
planMessageHex
,
planSign
,
300
);
if
(
Objects
.
nonNull
(
resultPojo
)
&&
StringUtils
.
isNotBlank
(
resultPojo
.
getHexMessageResult
()))
{
return
JsonViewObject
.
newInstance
().
success
(
"下发计划成功"
);
}
return
JsonViewObject
.
newInstance
().
success
(
"下发计划异常"
);
}
private
String
buidDailyPlanHex
(
PlanSendVO
.
Plan
plan
)
{
String
planNo
=
plan
.
getPlanNo
();
List
<
PlanSendVO
.
Plan
.
Section
>
sectionList
=
plan
.
getSectionList
();
StringBuilder
hourMinuteSb
=
new
StringBuilder
();
StringBuilder
schemeNoSb
=
new
StringBuilder
();
StringBuilder
controlModelSb
=
new
StringBuilder
();
if
(!
CollectionUtils
.
isEmpty
(
sectionList
))
{
for
(
PlanSendVO
.
Plan
.
Section
section
:
sectionList
)
{
String
schemeNo
=
section
.
getPatternNo
();
String
schemeHex
=
String
.
format
(
"%02x"
,
Integer
.
valueOf
(
schemeNo
));
schemeNoSb
.
insert
(
0
,
schemeHex
).
insert
(
0
,
schemeHex
);
// 开始时间结束时间两个时间段,插入两次
String
beginTime
=
section
.
getBeginTime
();
String
startHourMinuteHex
=
CommonUtils
.
getHourMinuteHex
(
beginTime
);
String
endTime
=
section
.
getEndTime
();
String
endHourMinuteHex
=
CommonUtils
.
getHourMinuteHex
(
endTime
);
hourMinuteSb
.
insert
(
0
,
startHourMinuteHex
).
insert
(
0
,
endHourMinuteHex
);
String
controlMode
=
section
.
getControlMode
();
String
dtControlMode
=
SectionControlModeEnum
.
getDtControlMode
(
Integer
.
valueOf
(
controlMode
));
controlModelSb
.
insert
(
0
,
dtControlMode
).
insert
(
0
,
dtControlMode
);
}
}
String
matchStr
=
"0b02%s%s"
;
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
2
;
i
<=
5
;
i
++)
{
// 属性
sb
.
append
(
String
.
format
(
matchStr
,
String
.
format
(
"%02x"
,
i
),
String
.
format
(
"%02x"
,
Integer
.
parseInt
(
planNo
))));
if
(
i
==
2
)
{
sb
.
append
(
"01"
).
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"64"
);
}
if
(
i
==
3
)
{
sb
.
append
(
StringUtils
.
leftPad
(
hourMinuteSb
.
toString
(),
192
,
"0"
)).
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"34"
);
}
if
(
i
==
4
)
{
sb
.
append
(
StringUtils
.
leftPad
(
schemeNoSb
.
toString
(),
96
,
"0"
)).
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"34"
);
}
if
(
i
==
5
)
{
sb
.
append
(
StringUtils
.
leftPad
(
controlModelSb
.
toString
(),
96
,
"0"
)).
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"05"
);
}
}
return
sb
.
toString
();
}
}
@Override
@Override
public
JsonViewObject
scheduleSend
(
ScheduleSendVO
scheduleSendVO
)
throws
Exception
{
public
JsonViewObject
scheduleSend
(
ScheduleSendVO
scheduleSendVO
)
throws
Exception
{
return
null
;
String
crossId
=
scheduleSendVO
.
getCrossCode
();
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
crossId
);
List
<
ScheduleSendVO
.
Schedule
>
schedules
=
scheduleSendVO
.
getSchedules
();
StringBuilder
sb
=
new
StringBuilder
();
for
(
ScheduleSendVO
.
Schedule
schedule
:
schedules
)
{
sb
.
append
(
buildScheduleHex
(
schedule
));
}
String
bodyValueLeght
=
String
.
format
(
"%02x"
,
schedules
.
size
()
*
6
);
// 调度数量 * 属性数量
String
message
=
String
.
format
(
Constants
.
COMMAND_SET_COMMON
,
Constants
.
COMMAND_SET
,
bodyValueLeght
,
sb
.
toString
());
String
scheduleSign
=
StringUtils
.
join
(
"0901"
,
Constants
.
COMMAND_SET_REPLY
);
String
scheduleMessage
=
Constants
.
buildMessage
(
message
);
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
crossInfoPO
.
getIp
(),
crossInfoPO
.
getPort
(),
scheduleMessage
,
scheduleSign
,
300
);
if
(
Objects
.
nonNull
(
resultPojo
)
&&
StringUtils
.
isNotBlank
(
resultPojo
.
getHexMessageResult
()))
{
return
JsonViewObject
.
newInstance
().
success
(
"下发调度成功"
);
}
return
JsonViewObject
.
newInstance
().
success
(
"下发调度异常"
);
}
private
String
buildScheduleHex
(
ScheduleSendVO
.
Schedule
schedule
)
{
String
scheduleNo
=
schedule
.
getScheduleNo
();
Integer
planNo
=
0
;
String
weekHex
=
"00"
;
List
<
ScheduleSendVO
.
Schedule
.
Week
>
weeks
=
schedule
.
getWeeks
();
if
(!
CollectionUtils
.
isEmpty
(
weeks
))
{
List
<
ScheduleSendVO
.
Schedule
.
Week
>
weekSort
=
weeks
.
stream
().
sorted
(
Comparator
.
comparingInt
(
ScheduleSendVO
.
Schedule
.
Week
::
getWeekNum
)).
collect
(
Collectors
.
toList
());
int
[]
weekArray
=
new
int
[
7
];
for
(
ScheduleSendVO
.
Schedule
.
Week
week
:
weekSort
)
{
Integer
weekNum
=
week
.
getWeekNum
();
weekArray
[
weekNum
-
1
]
=
1
;
planNo
=
week
.
getPlanNo
();
}
weekHex
=
CommonUtils
.
getHex4Array
(
weekArray
);
}
String
monthHex
=
"0000"
;
String
dayHex
=
"00000000"
;
List
<
ScheduleSendVO
.
Schedule
.
SpecialDay
>
specialDays
=
schedule
.
getSpecialDays
();
if
(!
CollectionUtils
.
isEmpty
(
specialDays
))
{
int
[]
monthArray
=
new
int
[
12
];
int
[]
dayArray
=
new
int
[
31
];
for
(
ScheduleSendVO
.
Schedule
.
SpecialDay
specialDay
:
specialDays
)
{
String
dateStr
=
specialDay
.
getDateStr
();
monthArray
[
Integer
.
valueOf
(
dateStr
.
substring
(
5
,
7
))
-
1
]
=
1
;
dayArray
[
Integer
.
valueOf
(
dateStr
.
substring
(
8
,
10
))
-
1
]
=
1
;
}
monthHex
=
CommonUtils
.
getHex4Array
(
monthArray
);
dayHex
=
CommonUtils
.
getHex4Array
(
dayArray
);
}
String
matchStr
=
"0c02%s%s"
;
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
2
;
i
<
8
;
i
++)
{
// 数据对象从2-7
sb
.
append
(
String
.
format
(
matchStr
,
String
.
format
(
"%02x"
,
i
),
String
.
format
(
"%02x"
,
Integer
.
valueOf
(
scheduleNo
))));
if
(
i
==
2
)
{
sb
.
append
(
"01"
);
// 一代多路口编号
sb
.
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"05"
);
}
if
(
i
==
3
)
{
sb
.
append
(
"00"
);
// 优先级
sb
.
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"05"
);
}
if
(
i
==
4
)
{
sb
.
append
(
weekHex
);
// 星期二进制转16
sb
.
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"06"
);
}
if
(
i
==
5
)
{
sb
.
append
(
StringUtils
.
leftPad
(
monthHex
,
4
,
"0"
));
sb
.
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"08"
);
}
if
(
i
==
6
)
{
sb
.
append
(
StringUtils
.
leftPad
(
dayHex
,
8
,
"0"
));
sb
.
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"05"
);
}
if
(
i
==
7
)
{
sb
.
append
(
String
.
format
(
"%02x"
,
planNo
));
sb
.
append
(
String
.
format
(
"%02x"
,
i
)).
append
(
"05"
);
}
}
return
sb
.
toString
().
substring
(
0
,
sb
.
length
()
-
4
);
}
}
@Override
@Override
public
JsonViewObject
lockControl
(
ControlCommandVO
commandVO
)
throws
Exception
{
public
JsonViewObject
lockControl
(
ControlCommandVO
commandVO
)
throws
Exception
{
return
null
;
if
(
commandVO
.
getCommand
()
==
0
)
{
setSignalControl
(
commandVO
);
}
else
{
List
<
Integer
>
phaseList
=
commandVO
.
getPhaseList
();
int
stageId
=
0
;
if
(!
CollectionUtils
.
isEmpty
(
phaseList
))
{
stageId
=
phaseList
.
get
(
0
);
}
// 锁定阶段,目前锁定成功,但是阶段还在跳
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
commandVO
.
getCrossCode
());
String
message
=
String
.
format
(
Constants
.
COMMAND_CENTER_COMMON
,
Constants
.
COMMAND_SET
,
Constants
.
COMMAND_CENTER_CONTROL_STAGE
,
String
.
format
(
"%02x"
,
stageId
));
String
lockSign
=
StringUtils
.
join
(
Constants
.
COMMAND_CENTER_COMMON_SIGN
,
Constants
.
COMMAND_SET_REPLY
);
String
lockMessage
=
Constants
.
buildMessage
(
message
);
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
crossInfoPO
.
getIp
(),
crossInfoPO
.
getPort
(),
lockMessage
,
lockSign
,
300
);
if
(
Objects
.
nonNull
(
resultPojo
)
&&
StringUtils
.
isNotBlank
(
resultPojo
.
getHexMessageResult
()))
{
log
.
info
(
"锁定相位成功"
);
}
}
return
JsonViewObject
.
newInstance
().
success
(
"锁定相位成功"
);
}
}
@Override
@Override
...
@@ -48,20 +252,85 @@ public class DTControlCommandServiceImpl implements ControlCommandService {
...
@@ -48,20 +252,85 @@ public class DTControlCommandServiceImpl implements ControlCommandService {
}
}
@Override
@Override
public
JsonViewObject
setSignalControl
(
String
code
,
Integer
command
,
Integer
commandType
)
throws
Exception
{
public
JsonViewObject
setSignalControl
(
ControlCommandVO
commandVO
)
throws
Exception
{
return
null
;
String
controlmodel
=
null
;
if
(
commandVO
.
getCommand
()
==
0
)
{
controlmodel
=
ControlModelEnum
.
FIXED_CYCLE
.
getDtControlHex
();
// 取消控制,设置为固定配时
}
else
{
if
(
commandVO
.
getControlType
()
==
1
)
{
// 全红
controlmodel
=
ControlModelEnum
.
RED_CONTROL
.
getDtControlHex
();
}
if
(
commandVO
.
getControlType
()
==
2
)
{
// 黄闪
controlmodel
=
ControlModelEnum
.
YELLOW_CONTROL
.
getDtControlHex
();
}
if
(
commandVO
.
getControlType
()
==
3
)
{
// 关灯
controlmodel
=
ControlModelEnum
.
CLOSED_CONTROL
.
getDtControlHex
();
}
}
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
commandVO
.
getCrossCode
());
String
message
=
String
.
format
(
Constants
.
COMMAND_CENTER_COMMON
,
Constants
.
COMMAND_SET
,
Constants
.
COMMAND_CENTER_CONTROL_MODEL
,
controlmodel
);
String
controlSign
=
StringUtils
.
join
(
Constants
.
COMMAND_CENTER_COMMON_SIGN
,
Constants
.
COMMAND_SET_REPLY
);
String
controlMessageHex
=
Constants
.
buildMessage
(
message
);
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
crossInfoPO
.
getIp
(),
crossInfoPO
.
getPort
(),
controlMessageHex
,
controlSign
,
300
);
if
(
Objects
.
nonNull
(
resultPojo
)
&&
StringUtils
.
isNotBlank
(
resultPojo
.
getHexMessageResult
()))
{
log
.
info
(
"特殊控制成功,当前控制模式: {}"
,
controlmodel
);
}
return
JsonViewObject
.
newInstance
().
success
(
"特殊控制成功"
);
}
}
@Override
@Override
public
JsonViewObject
recoverSchedule
(
String
code
)
throws
Exception
{
public
JsonViewObject
recoverSchedule
(
String
code
)
throws
Exception
{
return
null
;
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
code
);
String
message
=
String
.
format
(
Constants
.
COMMAND_CENTER_COMMON
,
Constants
.
COMMAND_SET
,
Constants
.
COMMAND_CENTER_CONTROL_MODEL
,
ControlModelEnum
.
FIXED_CYCLE
.
getDtControlHex
());
String
controlSign
=
StringUtils
.
join
(
Constants
.
COMMAND_CENTER_COMMON_SIGN
,
Constants
.
COMMAND_SET_REPLY
);
String
controlMessageHex
=
Constants
.
buildMessage
(
message
);
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
crossInfoPO
.
getIp
(),
crossInfoPO
.
getPort
(),
controlMessageHex
,
controlSign
,
300
);
if
(
Objects
.
nonNull
(
resultPojo
)
&&
StringUtils
.
isNotBlank
(
resultPojo
.
getHexMessageResult
()))
{
log
.
info
(
"恢复时间表"
);
}
return
JsonViewObject
.
newInstance
().
success
(
"恢复时间表"
);
}
}
@Override
@Override
public
JsonViewObject
phaseTimingSend
(
PhaseTimingSendVO
phaseTimingSendVO
)
throws
Exception
{
public
JsonViewObject
phaseTimingSend
(
PhaseTimingSendVO
phaseTimingSendVO
)
throws
Exception
{
String
crossId
=
phaseTimingSendVO
.
getCrossCode
();
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
crossId
);
List
<
PhaseTimingSendVO
.
Phase
>
phaseList
=
phaseTimingSendVO
.
getPhaseList
();
setLights
();
setPhaseLights
();
setPhaseInfo
(
crossInfoPO
,
phaseList
);
return
null
;
return
null
;
}
}
private
void
setPhaseLights
()
{
}
private
void
setLights
()
{
}
private
void
setPhaseInfo
(
CrossInfoPO
crossInfoPO
,
List
<
PhaseTimingSendVO
.
Phase
>
phaseList
)
{
for
(
PhaseTimingSendVO
.
Phase
phase
:
phaseList
)
{
Integer
phaseNo
=
phase
.
getPhaseNo
();
Integer
yellow
=
phase
.
getYellow
();
Integer
allRed
=
phase
.
getAllred
();
String
greenFlash
=
phase
.
getGreenFlash
();
String
maxGreen
=
phase
.
getMaxGreen
();
String
minGreen
=
phase
.
getMinGreen
();
List
<
PhaseTimingSendVO
.
Phase
.
Lane
>
lanes
=
phase
.
getLanes
();
String
matchStr
=
"0402%s%s"
;
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
2
;
i
<=
31
;
i
++)
{
sb
.
append
(
String
.
format
(
matchStr
,
String
.
format
(
"%02x"
,
i
),
String
.
format
(
"%02x"
,
phaseNo
)));
if
(
i
==
2
)
{
sb
.
append
(
""
);
}
}
}
}
@Override
@Override
public
JsonViewObject
phaseDiffSend
()
{
public
JsonViewObject
phaseDiffSend
()
{
return
null
;
return
null
;
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/service/controller/impl/DTStaticInfoServiceImpl.java
View file @
ac6c36d4
...
@@ -136,6 +136,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -136,6 +136,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
for
(
PhaseStageInfoPojo
phaseStageInfoPojo
:
phaseStageInfoPojos
)
{
for
(
PhaseStageInfoPojo
phaseStageInfoPojo
:
phaseStageInfoPojos
)
{
if
(
Objects
.
equals
(
phaseStageId
,
phaseStageInfoPojo
.
getPhaseStageId
()))
{
if
(
Objects
.
equals
(
phaseStageId
,
phaseStageInfoPojo
.
getPhaseStageId
()))
{
List
<
Integer
>
phaseList
=
phaseStageInfoPojo
.
getPhaseList
();
List
<
Integer
>
phaseList
=
phaseStageInfoPojo
.
getPhaseList
();
int
ringNo
=
0
;
for
(
Integer
phaseId
:
phaseList
)
{
for
(
Integer
phaseId
:
phaseList
)
{
CrossPhasePO
crossPhasePO
=
new
CrossPhasePO
();
CrossPhasePO
crossPhasePO
=
new
CrossPhasePO
();
crossPhasePO
.
setCrossId
(
crossId
);
crossPhasePO
.
setCrossId
(
crossId
);
...
@@ -144,7 +145,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -144,7 +145,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
++
sort
;
++
sort
;
crossPhasePO
.
setSort
(
sort
);
crossPhasePO
.
setSort
(
sort
);
crossPhasePO
.
setPlanId
(
schemeInfoPojo
.
getSchemeId
());
crossPhasePO
.
setPlanId
(
schemeInfoPojo
.
getSchemeId
());
crossPhasePO
.
setRingNo
(
1
);
crossPhasePO
.
setRingNo
(
++
ringNo
);
crossPhasePO
.
setGroupNo
(
1
);
crossPhasePO
.
setGroupNo
(
1
);
crossPhasePO
.
setPhaseTime
(
phaseStageTime
);
crossPhasePO
.
setPhaseTime
(
phaseStageTime
);
crossPhasePO
.
setControlMode
(
1
);
crossPhasePO
.
setControlMode
(
1
);
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/util/CommonUtils.java
0 → 100644
View file @
ac6c36d4
package
net
.
wanji
.
com
.
util
;
import
cn.hutool.core.util.HexUtil
;
import
freemarker.template.utility.StringUtil
;
/**
* @author duanruiming
* @date 2023/06/20 15:07
*/
public
class
CommonUtils
{
/**
* 将数组转化为16进制字符串
* @param array
* @return
*/
public
static
String
getHex4Array
(
int
[]
array
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
:
array
)
{
sb
.
append
(
i
);
}
Integer
binary
=
Integer
.
valueOf
(
sb
.
reverse
().
toString
(),
2
);
return
HexUtil
.
toHex
(
binary
);
}
/**
* 将时间转化为16进制 00:00 --> 061E0
* @param time
* @return
*/
public
static
String
getHourMinuteHex
(
String
time
)
{
StringBuffer
sb
=
new
StringBuffer
();
String
[]
split
=
time
.
split
(
":"
);
String
hour
=
String
.
format
(
"%02x"
,
Integer
.
valueOf
(
split
[
0
]));
String
minute
=
String
.
format
(
"%02x"
,
Integer
.
valueOf
(
split
[
1
]));
return
sb
.
append
(
hour
).
append
(
minute
).
toString
();
}
public
static
String
getBinary
(
Integer
param
)
{
int
[]
array
=
new
int
[
64
];
array
[
param
-
1
]
=
1
;
StringBuffer
resultSb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
array
.
length
/
8
;
i
++)
{
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
j
=
0
;
j
<
8
;
j
++)
{
sb
.
append
(
array
[
i
*
8
+
j
]);
}
String
hex
=
String
.
format
(
"%02x"
,
Integer
.
parseInt
(
sb
.
reverse
().
toString
(),
2
));
resultSb
.
insert
(
0
,
hex
);
}
return
StringUtil
.
leftPad
(
resultSb
.
toString
(),
16
,
"0"
);
}
public
static
void
main
(
String
[]
args
)
{
System
.
err
.
println
(
getBinary
(
8
));
}
}
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