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
e3482be1
Commit
e3482be1
authored
Nov 11, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 调度计划更新
parent
ae30b5f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
19 deletions
+67
-19
StaticInfoServiceImpl.java
...wanji/utc/hisense/service/impl/StaticInfoServiceImpl.java
+67
-19
No files found.
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/service/impl/StaticInfoServiceImpl.java
View file @
e3482be1
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.utils.tool.ScheduleUtil
;
import
net.wanji.common.utils.tool.StringUtils
;
import
net.wanji.common.utils.tool.StringUtils
;
import
net.wanji.databus.dao.entity.CrossSchedulesPO
;
import
net.wanji.databus.dao.entity.CrossSchedulesPO
;
import
net.wanji.databus.dao.mapper.CrossInfoMapper
;
import
net.wanji.databus.dao.mapper.CrossInfoMapper
;
...
@@ -76,7 +77,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
...
@@ -76,7 +77,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
crossInfoPO
.
setCode
(
cIntsID
);
crossInfoPO
.
setCode
(
cIntsID
);
crossInfoPO
.
setName
(
vIntersectionEntity
.
getCIntsName
());
crossInfoPO
.
setName
(
vIntersectionEntity
.
getCIntsName
());
crossInfoPO
.
setIp
(
vIntersectionEntity
.
getCCONTROLLERIP
());
crossInfoPO
.
setIp
(
vIntersectionEntity
.
getCCONTROLLERIP
());
String
[]
array
=
{
String
.
valueOf
(
vIntersectionEntity
.
getLongitude
()),
String
.
valueOf
(
vIntersectionEntity
.
getLatitude
())};
String
[]
array
=
{
String
.
valueOf
(
vIntersectionEntity
.
getLongitude
()),
String
.
valueOf
(
vIntersectionEntity
.
getLatitude
())};
crossInfoPO
.
setLocation
(
StringUtils
.
join
(
array
,
","
));
crossInfoPO
.
setLocation
(
StringUtils
.
join
(
array
,
","
));
crossInfoPO
.
setVersion
(
vIntersectionEntity
.
getCControllerModel
());
crossInfoPO
.
setVersion
(
vIntersectionEntity
.
getCControllerModel
());
crossInfoPO
.
setManufacturerId
(
22
);
crossInfoPO
.
setManufacturerId
(
22
);
...
@@ -99,33 +100,80 @@ public class StaticInfoServiceImpl implements StaticInfoService {
...
@@ -99,33 +100,80 @@ public class StaticInfoServiceImpl implements StaticInfoService {
@Override
@Override
public
List
<
CrossSchedulesPO
>
crossSchedules
(
CrossSchedulesDTO
crossSchedulesDTO
)
throws
Exception
{
public
List
<
CrossSchedulesPO
>
crossSchedules
(
CrossSchedulesDTO
crossSchedulesDTO
)
throws
Exception
{
String
manufacturerCode
=
crossSchedulesDTO
.
getManufacturerCode
();
Map
<
String
,
String
>
codeCrossIdMap
=
getCodeCrossIdMap
(
crossSchedulesDTO
);
// 路口编号列表
List
<
String
>
crossIdList
=
crossSchedulesDTO
.
getCrossIdList
();
List
<
String
>
crossIdList
=
crossSchedulesDTO
.
getCrossIdList
();
if
(!
CollectionUtils
.
isEmpty
(
crossIdList
))
{
// 信号机编号
List
<
CrossSchedulesPO
>
result
=
new
ArrayList
<>(
crossIdList
.
size
());
List
<
String
>
crossCodeList
=
crossInfoMapper
.
selectCrossCodesByIds
(
crossIdList
);
for
(
String
crossId
:
crossIdList
)
{
List
<
CrossSchedulesPO
>
results
=
new
ArrayList
<>(
crossCodeList
.
size
());
if
(!
CollectionUtils
.
isEmpty
(
crossCodeList
))
{
for
(
String
code
:
crossCodeList
)
{
LambdaQueryWrapper
<
VNtcipTimeBaseSchedule
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
VNtcipTimeBaseSchedule
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
VNtcipTimeBaseSchedule:
:
getCIntsID
,
c
rossId
);
queryWrapper
.
eq
(
VNtcipTimeBaseSchedule:
:
getCIntsID
,
c
ode
);
List
<
VNtcipTimeBaseSchedule
>
vNtcipTimeBaseSchedules
=
vNtcipTimeBaseScheduleMapper
.
selectList
(
queryWrapper
);
List
<
VNtcipTimeBaseSchedule
>
vNtcipTimeBaseSchedules
=
vNtcipTimeBaseScheduleMapper
.
selectList
(
queryWrapper
);
if
(!
CollectionUtils
.
isEmpty
(
vNtcipTimeBaseSchedules
))
{
if
(!
CollectionUtils
.
isEmpty
(
vNtcipTimeBaseSchedules
))
{
for
(
VNtcipTimeBaseSchedule
vNtcipTimeBaseSchedule
:
vNtcipTimeBaseSchedules
)
{
for
(
VNtcipTimeBaseSchedule
vNtcipTimeBaseSchedule
:
vNtcipTimeBaseSchedules
)
{
if
(
Objects
.
nonNull
(
vNtcipTimeBaseSchedule
))
{
if
(
Objects
.
nonNull
(
vNtcipTimeBaseSchedule
))
{
CrossSchedulesPO
crossSchedulesPO
=
new
CrossSchedulesPO
();
CrossSchedulesPO
crossSchedulesPO
=
new
CrossSchedulesPO
();
crossSchedulesPO
.
setCrossId
(
c
rossId
);
crossSchedulesPO
.
setCrossId
(
c
odeCrossIdMap
.
get
(
code
)
);
crossSchedulesPO
.
setScheduleNo
(
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleNumber
());
crossSchedulesPO
.
setScheduleNo
(
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleNumber
());
crossSchedulesPO
.
setName
(
"海信调度"
+
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleNumber
());
crossSchedulesPO
.
setName
(
"海信调度"
+
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleNumber
());
if
(
8190
==
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleMonth
())
{
// 海信月份
Integer
nTimeBaseScheduleDay
=
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleDay
();
Integer
hisenseMonth
=
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleMonth
();
//crossSchedulesPO.setWeek();
// 星期
Integer
hisenseWeek
=
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleDay
();
// 日期 2147483647
Integer
hisenseDays
=
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleDate
();
String
monthsStr
=
ScheduleUtil
.
getSchedule
(
hisenseMonth
.
longValue
(),
1
);
String
daysStr
=
ScheduleUtil
.
getSchedule
(
hisenseDays
.
longValue
(),
2
);
String
weekStr
=
ScheduleUtil
.
getSchedule
(
hisenseWeek
.
longValue
(),
3
);
if
(
StringUtils
.
isNotBlank
(
weekStr
))
{
String
[]
weekSplit
=
weekStr
.
split
(
","
);
for
(
String
oneWeek
:
weekSplit
)
{
CrossSchedulesPO
crossSchedulesPOWeek
=
new
CrossSchedulesPO
();
crossSchedulesPOWeek
.
setCrossId
(
codeCrossIdMap
.
get
(
code
));
crossSchedulesPOWeek
.
setScheduleNo
(
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleNumber
());
crossSchedulesPOWeek
.
setName
(
"海信调度"
+
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleNumber
());
crossSchedulesPOWeek
.
setWeek
(
Integer
.
valueOf
(
oneWeek
));
crossSchedulesPOWeek
.
setMonths
(
monthsStr
);
crossSchedulesPOWeek
.
setDays
(
daysStr
);
crossSchedulesPOWeek
.
setPlanId
(
0
);
results
.
add
(
crossSchedulesPOWeek
);
}
}
else
{
// 不执行周调度
CrossSchedulesPO
crossSchedulesPOMonthDays
=
new
CrossSchedulesPO
();
crossSchedulesPOMonthDays
.
setCrossId
(
codeCrossIdMap
.
get
(
code
));
crossSchedulesPOMonthDays
.
setScheduleNo
(
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleNumber
());
crossSchedulesPOMonthDays
.
setName
(
"海信调度"
+
vNtcipTimeBaseSchedule
.
getNTimeBaseScheduleNumber
());
crossSchedulesPOMonthDays
.
setWeek
(
null
);
crossSchedulesPOMonthDays
.
setMonths
(
monthsStr
);
crossSchedulesPOMonthDays
.
setDays
(
daysStr
);
crossSchedulesPOMonthDays
.
setPlanId
(
0
);
results
.
add
(
crossSchedulesPOMonthDays
);
}
}
}
}
}
}
}
}
}
}
}
}
return
null
;
return
results
;
}
/**
* 通过厂商编码,获取map<code 信号机编码, crossId 路口编号></>
*
* @param crossSchedulesDTO
* @return
*/
private
Map
<
String
,
String
>
getCodeCrossIdMap
(
CrossSchedulesDTO
crossSchedulesDTO
)
{
String
manufacturerCode
=
crossSchedulesDTO
.
getManufacturerCode
();
Integer
id
=
manufacturerInfoMapper
.
selectIdByCode
(
manufacturerCode
);
List
<
CrossInfoPO
>
crossInfoPOList
=
crossInfoMapper
.
selectByManufacturerId
(
id
);
List
<
String
>
codeList
=
crossInfoPOList
.
stream
().
map
(
CrossInfoPO:
:
getCode
).
collect
(
Collectors
.
toList
());
Map
<
String
,
String
>
codeCrossIdMap
=
crossInfoPOList
.
stream
().
collect
(
Collectors
.
toMap
(
CrossInfoPO:
:
getCode
,
CrossInfoPO:
:
getId
));
return
codeCrossIdMap
;
}
}
@Override
@Override
...
@@ -140,13 +188,13 @@ public class StaticInfoServiceImpl implements StaticInfoService {
...
@@ -140,13 +188,13 @@ public class StaticInfoServiceImpl implements StaticInfoService {
//给海信发送http请求
//给海信发送http请求
String
post
=
OkHttpClientUtil
.
xmlPost
(
hisenseUrl
,
document
.
asXML
());
String
post
=
OkHttpClientUtil
.
xmlPost
(
hisenseUrl
,
document
.
asXML
());
if
(
StringUtils
.
isBlank
(
post
)){
if
(
StringUtils
.
isBlank
(
post
))
{
log
.
error
(
"请求 5.7. 协调状态 失败"
);
log
.
error
(
"请求 5.7. 协调状态 失败"
);
return
null
;
return
null
;
}
}
Document
postResult
=
DocumentHelper
.
parseText
(
post
);
Document
postResult
=
DocumentHelper
.
parseText
(
post
);
String
result
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_RESULT
).
getText
();
String
result
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_RESULT
).
getText
();
if
(
HttpConstants
.
RESULT_1
.
equals
(
result
)){
if
(
HttpConstants
.
RESULT_1
.
equals
(
result
))
{
//成功
//成功
String
spot
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
).
valueOf
(
"Spot"
);
String
spot
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
).
valueOf
(
"Spot"
);
String
CoordPatternStatus
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
).
valueOf
(
"CoordPatternStatus"
);
String
CoordPatternStatus
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
).
valueOf
(
"CoordPatternStatus"
);
...
@@ -160,7 +208,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
...
@@ -160,7 +208,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
.
build
();
.
build
();
return
coordinationStatus
;
return
coordinationStatus
;
}
else
{
}
else
{
//失败
//失败
log
.
error
(
"请求 5.7. 协调状态 失败"
);
log
.
error
(
"请求 5.7. 协调状态 失败"
);
}
}
...
@@ -180,13 +228,13 @@ public class StaticInfoServiceImpl implements StaticInfoService {
...
@@ -180,13 +228,13 @@ public class StaticInfoServiceImpl implements StaticInfoService {
messageContent
.
addElement
(
HttpConstants
.
PATTERN
).
setText
(
crossSchemeRingsDTO
.
getPattern
());
messageContent
.
addElement
(
HttpConstants
.
PATTERN
).
setText
(
crossSchemeRingsDTO
.
getPattern
());
//给海信发送http请求
//给海信发送http请求
String
post
=
OkHttpClientUtil
.
xmlPost
(
hisenseUrl
,
document
.
asXML
());
String
post
=
OkHttpClientUtil
.
xmlPost
(
hisenseUrl
,
document
.
asXML
());
if
(
StringUtils
.
isBlank
(
post
)){
if
(
StringUtils
.
isBlank
(
post
))
{
log
.
error
(
"请求 5.15.根据方案号获取配时方案环图 失败"
);
log
.
error
(
"请求 5.15.根据方案号获取配时方案环图 失败"
);
return
null
;
return
null
;
}
}
Document
postResult
=
DocumentHelper
.
parseText
(
post
);
Document
postResult
=
DocumentHelper
.
parseText
(
post
);
String
result
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_RESULT
).
getText
();
String
result
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_RESULT
).
getText
();
if
(
HttpConstants
.
RESULT_1
.
equals
(
result
)){
if
(
HttpConstants
.
RESULT_1
.
equals
(
result
))
{
//成功
//成功
String
patternRest
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
).
valueOf
(
"Pattern"
);
String
patternRest
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
).
valueOf
(
"Pattern"
);
String
cycleLen
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
).
valueOf
(
"CycleLen"
);
String
cycleLen
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
).
valueOf
(
"CycleLen"
);
...
@@ -226,7 +274,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
...
@@ -226,7 +274,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
crossSchemeRings
.
setPhaseList
(
phaseList
);
crossSchemeRings
.
setPhaseList
(
phaseList
);
return
crossSchemeRings
;
return
crossSchemeRings
;
}
else
{
}
else
{
//失败
//失败
log
.
error
(
"请求 5.15. 方案环图请求 失败"
);
log
.
error
(
"请求 5.15. 方案环图请求 失败"
);
}
}
...
...
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