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
28c74a3b
Commit
28c74a3b
authored
Jun 15, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 日计划,调度
parent
c86ce934
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
223 additions
and
64 deletions
+223
-64
Constants.java
...c/main/java/net/wanji/com/common/constants/Constants.java
+3
-1
CommandResultSign.java
...in/java/net/wanji/com/common/enums/CommandResultSign.java
+3
-3
StaticInfoController.java
...n/java/net/wanji/com/controller/StaticInfoController.java
+3
-4
ScheduleInfoPojo.java
...n/java/net/wanji/com/pojo/dtconvert/ScheduleInfoPojo.java
+21
-0
StaticInfoService.java
...a/net/wanji/com/service/controller/StaticInfoService.java
+2
-2
DTStaticInfoServiceImpl.java
.../com/service/controller/impl/DTStaticInfoServiceImpl.java
+189
-44
CrossSchedulesDTO.java
...rc/main/java/net/wanji/databus/dto/CrossSchedulesDTO.java
+2
-10
No files found.
signal-utc-dt-service/src/main/java/net/wanji/com/common/constants/Constants.java
View file @
28c74a3b
...
...
@@ -23,7 +23,9 @@ public class Constants {
public
static
final
String
COMMAND_LIGHT_CONFIG
=
"0302"
;
public
static
final
String
COMMAND_PHASE_STAGE_CONFIG
=
"0602"
;
public
static
final
String
COMMAND_SCHME_CONFIG
=
"0902"
;
public
static
final
String
COMMAND_DAILYPLAN_CONFIG
=
"1102"
;
public
static
final
String
COMMAND_DAILYPLAN_CONFIG
=
"0b02"
;
public
static
final
String
COMMAND_SCHEDULE_CONFIG
=
"0c02"
;
public
static
final
String
COMMAND_RUNNING_STATUS
=
"0d02"
;
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/common/enums/CommandResultSign.java
View file @
28c74a3b
...
...
@@ -19,9 +19,9 @@ public enum CommandResultSign {
GET_STAGE_INFO
(
"060220"
,
"getStageInfoService"
),
GET_PHASE_SECURITY_INFO
(
"2007"
,
"getPhaseSecurityInfoService"
),
GET_SCHEME_INFO
(
"090220"
,
"getSchemeInfoService"
),
GET_DAILY_PLAN_INFO
(
"
11
0220"
,
"getDailyPlanInfoService"
),
GET_SCHEDULES_INFO
(
"
2012
"
,
"getSchedulesInfoService"
),
GET_RUNNING_STATE_INFO
(
"
2013
"
,
"getRunningStateInfoService"
),
GET_DAILY_PLAN_INFO
(
"
0b
0220"
,
"getDailyPlanInfoService"
),
GET_SCHEDULES_INFO
(
"
0c0220
"
,
"getSchedulesInfoService"
),
GET_RUNNING_STATE_INFO
(
"
0d0220
"
,
"getRunningStateInfoService"
),
GET_TRAFFIC_DATA_INFO
(
"2014"
,
"getTrafficDataInfoService"
),
GET_ALARM_INFO
(
"2015"
,
"getAlarmInfoService"
),
GET_FAULT_INFO
(
"2016"
,
"getFaultInfoService"
),
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/controller/StaticInfoController.java
View file @
28c74a3b
...
...
@@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.ws.rs.core.MediaType
;
import
java.util.List
;
import
java.util.Objects
;
/**
...
...
@@ -96,10 +95,10 @@ public class StaticInfoController {
// 命令调用
staticInfoService
.
crossSchedules
(
crossSchedulesDTO
);
// 构造返回值
List
<
String
>
crossIdList
=
crossSchedulesDTO
.
getCrossIdList
();
List
<
CrossSchedulesPO
>
crossSchedulesPOList
=
staticInfoService
.
buildCrossSchedulesResponse
(
crossIdList
);
//
List<String> crossIdList = crossSchedulesDTO.getCrossIdList();
//
List<CrossSchedulesPO> crossSchedulesPOList = staticInfoService.buildCrossSchedulesResponse(crossIdList);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
(
crossSchedulesPOList
);
return
jsonViewObject
.
success
(
null
);
}
}
signal-utc-dt-service/src/main/java/net/wanji/com/pojo/dtconvert/ScheduleInfoPojo.java
0 → 100644
View file @
28c74a3b
package
net
.
wanji
.
com
.
pojo
.
dtconvert
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2023/06/15 15:07
*/
@Data
public
class
ScheduleInfoPojo
{
private
Integer
scheduleId
;
private
Integer
crossId
;
private
Integer
priority
;
private
List
<
Integer
>
week
;
private
List
<
Integer
>
month
;
private
List
<
Integer
>
day
;
private
Integer
dailyPlanId
;
}
signal-utc-dt-service/src/main/java/net/wanji/com/service/controller/StaticInfoService.java
View file @
28c74a3b
...
...
@@ -17,9 +17,9 @@ public interface StaticInfoService extends BeanMarkService {
SchemePhaseLightsVO
schemePhaseLights
(
SchemePhaseLightsDTO
schemePhaseLightsDTO
)
throws
Exception
;
void
planSection
(
PlanSectionDTO
planSectionDTO
)
throws
Exception
;
List
<
PlanSectionVO
>
planSection
(
PlanSectionDTO
planSectionDTO
)
throws
Exception
;
void
crossSchedules
(
CrossSchedulesDTO
crossSchedulesDTO
)
throws
Exception
;
List
<
CrossSchedulesPO
>
crossSchedules
(
CrossSchedulesDTO
crossSchedulesDTO
)
throws
Exception
;
SchemePhaseLightsVO
buildSchemePhaseLightsResponse
(
SchemePhaseLightsDTO
schemePhaseLightsDTO
);
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/service/controller/impl/DTStaticInfoServiceImpl.java
View file @
28c74a3b
...
...
@@ -55,24 +55,9 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
List
<
LightsInfoPojo
>
lightsInfoPojos
=
getLightsInfo
(
crossInfo
);
List
<
PhaseStageInfoPojo
>
phaseStageInfoPojos
=
getPhaseStageInfo
(
crossInfo
);
List
<
SchemeInfoPojo
>
schemeInfoPojos
=
getSchemeInfo
(
crossInfo
);
List
<
DailyPlanInfoPojo
>
dailyPlanInfoPojos
=
getDailyPlanInfo
(
crossInfo
);
return
schemePhaseLightsVO
;
}
private
List
<
DailyPlanInfoPojo
>
getDailyPlanInfo
(
CrossInfoPO
crossInfo
)
{
String
message
=
String
.
format
(
Constants
.
COMMAND_COMMON
,
Constants
.
COMMAND_QUERY
,
Constants
.
COMMAND_DAILYPLAN_CONFIG
);
String
dailyPlanSign
=
Constants
.
COMMAND_DAILYPLAN_CONFIG
.
concat
(
Constants
.
COMMAND_QUERY_REPLY
);
String
dailyPlanHex
=
Constants
.
buildMessage
(
message
);
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
crossInfo
.
getIp
(),
crossInfo
.
getPort
(),
dailyPlanHex
,
dailyPlanSign
,
300
);
return
getDailyPlanPojos
(
resultPojo
);
}
private
List
<
DailyPlanInfoPojo
>
getDailyPlanPojos
(
MessageResultPojo
resultPojo
)
{
// String body = hexMessageResult.substring(32, hexMessageResult.length() - 2);
// int schemeSize = body.length() / 228;
return
null
;
}
private
List
<
SchemeInfoPojo
>
getSchemeInfo
(
CrossInfoPO
crossInfo
)
{
String
message
=
String
.
format
(
Constants
.
COMMAND_COMMON
,
Constants
.
COMMAND_QUERY
,
Constants
.
COMMAND_SCHME_CONFIG
);
String
schemeSign
=
Constants
.
COMMAND_SCHME_CONFIG
.
concat
(
Constants
.
COMMAND_QUERY_REPLY
);
...
...
@@ -140,33 +125,35 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
}
private
static
Map
<
Integer
,
List
<
String
>>
getSchemeIdParamMap
(
String
hexMessageResult
)
{
String
body
=
hexMessageResult
.
substring
(
32
,
hexMessageResult
.
length
()
-
2
);
int
schemeSize
=
body
.
length
()
/
228
;
String
matchStr
=
"0902%s%s"
;
int
schemeId
=
0
;
Map
<
Integer
,
List
<
String
>>
schemeIdParamMap
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
schemeSize
;
i
++)
{
++
schemeId
;
List
<
String
>
paramList
=
new
ArrayList
<>();
// 属性ID数量
for
(
int
j
=
2
;
j
<
9
;
j
++)
{
String
currentMatchStr
=
String
.
format
(
matchStr
,
String
.
format
(
"%02x"
,
j
),
String
.
format
(
"%02x"
,
schemeId
));
int
paramStartIndex
=
body
.
indexOf
(
currentMatchStr
)
+
8
;
String
param
=
null
;
if
(
j
==
2
||
j
==
4
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
2
);
}
else
if
(
j
==
3
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
8
);
}
else
if
(
j
==
5
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
4
);
}
else
if
(
j
==
6
||
j
==
8
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
32
);
}
else
if
(
j
==
7
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
64
);
if
(
StringUtils
.
isNotBlank
(
hexMessageResult
))
{
String
body
=
hexMessageResult
.
substring
(
32
,
hexMessageResult
.
length
()
-
2
);
int
schemeSize
=
body
.
length
()
/
228
;
String
matchStr
=
"0902%s%s"
;
int
schemeId
=
0
;
for
(
int
i
=
0
;
i
<
schemeSize
;
i
++)
{
++
schemeId
;
List
<
String
>
paramList
=
new
ArrayList
<>();
// 属性ID数量
for
(
int
j
=
2
;
j
<
9
;
j
++)
{
String
currentMatchStr
=
String
.
format
(
matchStr
,
String
.
format
(
"%02x"
,
j
),
String
.
format
(
"%02x"
,
schemeId
));
int
paramStartIndex
=
body
.
indexOf
(
currentMatchStr
)
+
8
;
String
param
=
null
;
if
(
j
==
2
||
j
==
4
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
2
);
}
else
if
(
j
==
3
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
8
);
}
else
if
(
j
==
5
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
4
);
}
else
if
(
j
==
6
||
j
==
8
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
32
);
}
else
if
(
j
==
7
)
{
param
=
body
.
substring
(
paramStartIndex
,
paramStartIndex
+
64
);
}
paramList
.
add
(
param
);
}
paramList
.
add
(
param
);
schemeIdParamMap
.
put
(
schemeId
,
paramList
);
}
schemeIdParamMap
.
put
(
schemeId
,
paramList
);
}
return
schemeIdParamMap
;
}
...
...
@@ -321,19 +308,177 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
return
phaseIdParamsMap
;
}
public
static
void
main
(
String
[]
args
)
{
String
body
=
"030202010102050302020201030503020203020405030202040305050302020501060503020206010705030202070208050302020803090503020209010a050302020a010b050302020b020c050302020c030d050302020d010e050302020e010f050302020f02100503020210031105030202110112050302021201130503020213011405030202140115050302021501160503020216011705030202170118050302021801190503020219011a050302021a011b050302021b011c050302021c011d050302021d011e050302021e011f050302021f01200503020220012105030202210122050302022201230503020223012405030202240125050302022501260503020226012705030202270128050302022801290503020229012a050302022a012b050302022b012c050302022c012d050302022d012e050302022e012f050302022f01300503020230013105030202310132050302023201330503020233013405030202340135050302023501360503020236013705030202370138050302023801390503020239013a050302023a013b050302023b013c050302023c013d050302023d013e050302023e013f050302023f01400503020240010f47"
;
@Override
public
List
<
PlanSectionVO
>
planSection
(
PlanSectionDTO
planSectionDTO
)
throws
Exception
{
String
crossId
=
planSectionDTO
.
getCrossId
();
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
crossId
);
List
<
DailyPlanInfoPojo
>
dailyPlanInfoPojos
=
getDailyPlanInfo
(
crossInfoPO
);
return
null
;
}
private
List
<
DailyPlanInfoPojo
>
getDailyPlanInfo
(
CrossInfoPO
crossInfoPO
)
{
String
message
=
String
.
format
(
Constants
.
COMMAND_COMMON
,
Constants
.
COMMAND_QUERY
,
Constants
.
COMMAND_DAILYPLAN_CONFIG
);
String
dailyPlanSign
=
Constants
.
COMMAND_DAILYPLAN_CONFIG
.
concat
(
Constants
.
COMMAND_QUERY_REPLY
);
String
dailyPlanHex
=
Constants
.
buildMessage
(
message
);
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
crossInfoPO
.
getIp
(),
crossInfoPO
.
getPort
(),
dailyPlanHex
,
dailyPlanSign
,
300
);
return
getDailyPlanPojos
(
resultPojo
);
}
@Override
public
void
planSection
(
PlanSectionDTO
planSectionDTO
)
throws
Exception
{
private
List
<
DailyPlanInfoPojo
>
getDailyPlanPojos
(
MessageResultPojo
resultPojo
)
{
List
<
DailyPlanInfoPojo
>
dailyPlanInfoPojos
=
new
ArrayList
<>();
if
(
Objects
.
nonNull
(
resultPojo
)
&&
StringUtils
.
isNotBlank
(
resultPojo
.
getHexMessageResult
()))
{
HashMap
<
Integer
,
List
<
String
>>
paramMap
=
new
HashMap
<>();
String
hexMessageResult
=
resultPojo
.
getHexMessageResult
();
String
body
=
hexMessageResult
.
substring
(
32
,
hexMessageResult
.
length
()
-
2
);
int
dailyPlanSize
=
body
.
length
()
/
434
;
String
matchStr
=
"0b02%s%s"
;
for
(
int
i
=
0
;
i
<
dailyPlanSize
;
i
++)
{
int
paramIndex
=
0
;
// 4个属性
List
<
String
>
paramList
=
new
ArrayList
<>();
for
(
int
j
=
2
;
j
<
6
;
j
++)
{
String
currentMatchStr
=
String
.
format
(
matchStr
,
String
.
format
(
"%02x"
,
j
),
String
.
format
(
"%02x"
,
i
+
1
));
paramIndex
=
body
.
indexOf
(
currentMatchStr
)
+
8
;
String
param
=
""
;
if
(
j
==
2
)
{
param
=
body
.
substring
(
paramIndex
,
paramIndex
+
2
);
}
else
if
(
j
==
3
)
{
param
=
body
.
substring
(
paramIndex
,
paramIndex
+
192
);
}
else
{
param
=
body
.
substring
(
paramIndex
,
paramIndex
+
96
);
}
paramList
.
add
(
param
);
}
paramMap
.
put
(
i
+
1
,
paramList
);
}
dailyPlanInfoPojos
=
convertDailyPlanPojos
(
paramMap
);
}
return
dailyPlanInfoPojos
;
}
private
List
<
DailyPlanInfoPojo
>
convertDailyPlanPojos
(
HashMap
<
Integer
,
List
<
String
>>
paramMap
)
{
List
<
DailyPlanInfoPojo
>
dailyPlanInfoPojos
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Integer
,
List
<
String
>>
entry
:
paramMap
.
entrySet
())
{
Integer
dailyPlanId
=
entry
.
getKey
();
List
<
String
>
value
=
entry
.
getValue
();
if
(!
CollectionUtils
.
isEmpty
(
value
))
{
DailyPlanInfoPojo
dailyPlanInfoPojo
=
new
DailyPlanInfoPojo
();
dailyPlanInfoPojo
.
setDailyPlanId
(
dailyPlanId
);
dailyPlanInfoPojo
.
setCrossId
(
HexUtil
.
hexToInt
(
value
.
get
(
0
)));
List
<
Integer
>
listFromHex
=
getListFromHex
(
value
.
get
(
1
),
2
,
""
);
Collections
.
reverse
(
listFromHex
);
List
<
String
>
startTimeChain
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
listFromHex
.
size
()
/
2
;
i
++)
{
int
minute
=
listFromHex
.
get
(
i
*
2
);
int
hour
=
listFromHex
.
get
(
i
*
2
+
1
);
// 只有第一个时段可以为00:00
if
((
i
!=
0
&&
hour
==
0
))
{
continue
;
}
startTimeChain
.
add
(
StringUtils
.
join
(
String
.
format
(
"%02d"
,
hour
),
":"
,
String
.
format
(
"%02d"
,
minute
)));
}
dailyPlanInfoPojo
.
setStartTimeChain
(
startTimeChain
);
List
<
Integer
>
schemeIdChain
=
getListFromHex
(
value
.
get
(
2
),
2
,
"00"
);
dailyPlanInfoPojo
.
setSchemeIdChain
(
schemeIdChain
);
// 21 ==> 33 定周期
List
<
Integer
>
controlModeChain
=
getListFromHex
(
value
.
get
(
3
),
2
,
"00"
);
dailyPlanInfoPojo
.
setControlModelChain
(
controlModeChain
);
dailyPlanInfoPojos
.
add
(
dailyPlanInfoPojo
);
}
}
return
dailyPlanInfoPojos
.
stream
().
filter
(
dailyPlanInfoPojo
->
!
CollectionUtils
.
isEmpty
(
dailyPlanInfoPojo
.
getSchemeIdChain
())).
collect
(
Collectors
.
toList
());
}
@Override
public
void
crossSchedules
(
CrossSchedulesDTO
crossSchedulesDTO
)
throws
Exception
{
public
List
<
CrossSchedulesPO
>
crossSchedules
(
CrossSchedulesDTO
crossSchedulesDTO
)
throws
Exception
{
String
crossId
=
crossSchedulesDTO
.
getCrossId
();
CrossInfoPO
crossInfoPO
=
crossInfoCache
.
getCrossInfoCache
().
get
(
crossId
);
String
message
=
String
.
format
(
Constants
.
COMMAND_COMMON
,
Constants
.
COMMAND_QUERY
,
Constants
.
COMMAND_SCHEDULE_CONFIG
);
String
scheduleSign
=
Constants
.
COMMAND_SCHEDULE_CONFIG
.
concat
(
Constants
.
COMMAND_QUERY_REPLY
);
String
scheduleHex
=
Constants
.
buildMessage
(
message
);
MessageResultPojo
resultPojo
=
NettyClient
.
sendMessage
(
crossInfoPO
.
getIp
(),
crossInfoPO
.
getPort
(),
scheduleHex
,
scheduleSign
,
300
);
List
<
ScheduleInfoPojo
>
scheduleInfoPojos
=
getSchedulePojos
(
resultPojo
);
return
null
;
}
private
List
<
ScheduleInfoPojo
>
getSchedulePojos
(
MessageResultPojo
resultPojo
)
{
List
<
ScheduleInfoPojo
>
scheduleInfoPojos
=
new
ArrayList
<>();
if
(
Objects
.
nonNull
(
resultPojo
)
&&
StringUtils
.
isNotBlank
(
resultPojo
.
getHexMessageResult
()))
{
HashMap
<
Integer
,
List
<
String
>>
paramMap
=
new
HashMap
<>();
String
hexMessageResult
=
resultPojo
.
getHexMessageResult
();
String
body
=
hexMessageResult
.
substring
(
32
,
hexMessageResult
.
length
()
-
2
);
int
scheduleSize
=
body
.
length
()
/
92
;
String
matchStr
=
"0c02%s%s"
;
int
paramIndex
=
0
;
for
(
int
i
=
0
;
i
<
scheduleSize
;
i
++)
{
List
<
String
>
paramList
=
new
ArrayList
<>();
for
(
int
j
=
2
;
j
<
8
;
j
++)
{
String
currentMatchStr
=
String
.
format
(
matchStr
,
String
.
format
(
"%02x"
,
j
),
String
.
format
(
"%02x"
,
i
+
1
));
paramIndex
=
body
.
indexOf
(
currentMatchStr
)
+
8
;
String
param
=
""
;
if
(
j
==
5
)
{
param
=
body
.
substring
(
paramIndex
,
paramIndex
+
4
);
}
else
if
(
j
==
6
)
{
param
=
body
.
substring
(
paramIndex
,
paramIndex
+
8
);
}
else
{
param
=
body
.
substring
(
paramIndex
,
paramIndex
+
2
);
}
paramList
.
add
(
param
);
}
paramMap
.
put
(
i
+
1
,
paramList
);
}
scheduleInfoPojos
=
convertSchedulePojos
(
paramMap
);
}
return
scheduleInfoPojos
;
}
private
List
<
ScheduleInfoPojo
>
convertSchedulePojos
(
HashMap
<
Integer
,
List
<
String
>>
paramMap
)
{
List
<
ScheduleInfoPojo
>
scheduleInfoPojos
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
Integer
,
List
<
String
>>
entry
:
paramMap
.
entrySet
())
{
Integer
scheduleId
=
entry
.
getKey
();
List
<
String
>
value
=
entry
.
getValue
();
if
(!
CollectionUtils
.
isEmpty
(
value
))
{
ScheduleInfoPojo
scheduleInfoPojo
=
new
ScheduleInfoPojo
();
scheduleInfoPojo
.
setScheduleId
(
scheduleId
);
scheduleInfoPojo
.
setCrossId
(
HexUtil
.
hexToInt
(
value
.
get
(
0
)));
scheduleInfoPojo
.
setPriority
(
HexUtil
.
hexToInt
(
value
.
get
(
1
)));
String
weekStr
=
Integer
.
toBinaryString
(
HexUtil
.
hexToInt
(
value
.
get
(
2
)));
List
<
Integer
>
weekList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
weekStr
.
length
();
i
++)
{
String
week
=
weekStr
.
substring
(
i
,
i
+
1
);
if
(
StringUtils
.
equals
(
"1"
,
week
))
{
weekList
.
add
(
weekStr
.
length
()
-
i
);
}
}
scheduleInfoPojo
.
setWeek
(
weekList
);
String
monthStr
=
Integer
.
toBinaryString
(
HexUtil
.
hexToInt
(
value
.
get
(
3
)));
List
<
Integer
>
monthList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
monthStr
.
length
();
i
++)
{
String
month
=
monthStr
.
substring
(
i
,
i
+
1
);
if
(
StringUtils
.
equals
(
"1"
,
month
))
{
monthList
.
add
(
monthStr
.
length
()
-
i
);
}
}
scheduleInfoPojo
.
setMonth
(
monthList
);
String
dayStr
=
Integer
.
toBinaryString
(
HexUtil
.
hexToInt
(
value
.
get
(
4
)));
List
<
Integer
>
dayList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
dayStr
.
length
();
i
++)
{
String
day
=
dayStr
.
substring
(
i
,
i
+
1
);
if
(
StringUtils
.
equals
(
"1"
,
day
))
{
dayList
.
add
(
dayStr
.
length
()
-
i
);
}
}
scheduleInfoPojo
.
setDay
(
dayList
);
scheduleInfoPojo
.
setDailyPlanId
(
HexUtil
.
hexToInt
(
value
.
get
(
5
)));
scheduleInfoPojos
.
add
(
scheduleInfoPojo
);
}
}
List
<
ScheduleInfoPojo
>
filter
=
scheduleInfoPojos
.
stream
().
filter
(
scheduleInfoPojo
->
Objects
.
nonNull
(
scheduleInfoPojo
.
getDailyPlanId
())).
collect
(
Collectors
.
toList
());
return
filter
;
}
@Override
...
...
wj-databus/src/main/java/net/wanji/databus/dto/CrossSchedulesDTO.java
View file @
28c74a3b
...
...
@@ -5,9 +5,6 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.Pattern
;
import
java.util.List
;
/**
* @author Kent HAN
...
...
@@ -16,12 +13,7 @@ import java.util.List;
@Data
@ApiModel
(
value
=
"CrossSchedulesDTO"
,
description
=
"查询时间表数据输入参数"
)
public
class
CrossSchedulesDTO
{
@ApiModelProperty
(
value
=
"
厂商代码 HK
"
)
@ApiModelProperty
(
value
=
"
路口编号
"
)
@NotBlank
@Pattern
(
regexp
=
"^[A-Z]*$"
,
message
=
"厂商代码只能包含大写英文字母"
)
String
manufacturerCode
;
@ApiModelProperty
(
value
=
"路口列表"
)
@NotEmpty
List
<
String
>
crossIdList
;
private
String
crossId
;
}
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