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
512673fb
Commit
512673fb
authored
Dec 08, 2022
by
wuxiaokai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
控制指令接口-方案下发、计划下发、时间表下发
parent
75c8d89f
Changes
26
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
792 additions
and
545 deletions
+792
-545
Result.java
...tc-service/src/main/java/net/wanji/utc/common/Result.java
+4
-0
ControlCommandController.java
...va/net/wanji/utc/controller/ControlCommandController.java
+8
-11
DownloadPlanSpandsDTO.java
...main/java/net/wanji/utc/dto/hk/DownloadPlanSpandsDTO.java
+58
-0
DownloadScheduleDTO.java
...c/main/java/net/wanji/utc/dto/hk/DownloadScheduleDTO.java
+30
-0
DownloadTimeSpandsDTO.java
...main/java/net/wanji/utc/dto/hk/DownloadTimeSpandsDTO.java
+61
-0
CrossPhaseMapper.java
.../src/main/java/net/wanji/utc/mapper/CrossPhaseMapper.java
+2
-0
CrossPlanMapper.java
...e/src/main/java/net/wanji/utc/mapper/CrossPlanMapper.java
+2
-0
CrossSectionMapper.java
...rc/main/java/net/wanji/utc/mapper/CrossSectionMapper.java
+2
-0
ControlCommandService.java
.../net/wanji/utc/service/control/ControlCommandService.java
+3
-2
HKControlCommandServiceImpl.java
...t/wanji/utc/service/impl/HKControlCommandServiceImpl.java
+300
-125
FieldUtil.java
...c-service/src/main/java/net/wanji/utc/util/FieldUtil.java
+0
-3
PlanSendVO.java
...tc-service/src/main/java/net/wanji/utc/vo/PlanSendVO.java
+50
-16
ScheduleSendVO.java
...ervice/src/main/java/net/wanji/utc/vo/ScheduleSendVO.java
+66
-0
SchemeSendVO.java
...-service/src/main/java/net/wanji/utc/vo/SchemeSendVO.java
+179
-0
PlanSendVO.java
...e/src/main/java/net/wanji/utc/vo/plansend/PlanSendVO.java
+0
-31
SectionPlan.java
.../src/main/java/net/wanji/utc/vo/plansend/SectionPlan.java
+0
-38
SectionPlanVo.java
...rc/main/java/net/wanji/utc/vo/plansend/SectionPlanVo.java
+0
-20
SpecialDay.java
...e/src/main/java/net/wanji/utc/vo/plansend/SpecialDay.java
+0
-27
TimeSlice.java
...ce/src/main/java/net/wanji/utc/vo/plansend/TimeSlice.java
+0
-47
Week.java
...service/src/main/java/net/wanji/utc/vo/plansend/Week.java
+0
-15
ScheduleSendVO.java
...in/java/net/wanji/utc/vo/schedulesend/ScheduleSendVO.java
+0
-28
SignalLightStateVo.java
...main/java/net/wanji/utc/vo/signal/SignalLightStateVo.java
+0
-108
SignalRingVo.java
...e/src/main/java/net/wanji/utc/vo/signal/SignalRingVo.java
+0
-74
CrossPhaseMapper.xml
...tc-service/src/main/resources/mapper/CrossPhaseMapper.xml
+11
-0
CrossPlanMapper.xml
...utc-service/src/main/resources/mapper/CrossPlanMapper.xml
+8
-0
CrossSectionMapper.xml
...-service/src/main/resources/mapper/CrossSectionMapper.xml
+8
-0
No files found.
signal-utc-service/src/main/java/net/wanji/utc/common/Result.java
View file @
512673fb
...
...
@@ -65,6 +65,10 @@ public class Result<T> implements Serializable {
return
Result
.
response
(
SUCCESS
.
getResultCode
(),
SUCCESS
.
getResultMsg
(),
content
);
}
public
static
<
T
>
Result
<
T
>
success
(
String
message
)
{
return
Result
.
response
(
SUCCESS
.
getResultCode
(),
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
state
,
String
message
,
T
content
)
{
return
Result
.
response
(
state
,
message
,
content
);
}
...
...
signal-utc-service/src/main/java/net/wanji/utc/controller/ControlCommandController.java
View file @
512673fb
...
...
@@ -7,10 +7,10 @@ import net.wanji.utc.common.Result;
import
net.wanji.utc.service.control.ControlCommandService
;
import
net.wanji.utc.vo.PhaseLockVO
;
import
net.wanji.utc.vo.PlanSendVO
;
import
net.wanji.utc.vo.schedulesend.ScheduleSendVO
;
import
net.wanji.utc.vo.SchemeSendVO
;
import
net.wanji.utc.vo.ScheduleSendVO
;
import
net.wanji.utc.vo.timeplan.TimePlanVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
...
...
@@ -29,22 +29,19 @@ import static net.wanji.utc.common.constant.Constants.*;
@Api
(
value
=
"控制指令接口"
,
description
=
"控制指令接口"
,
tags
=
"控制指令接口"
)
public
class
ControlCommandController
{
@Value
(
"${signal.mock}"
)
private
boolean
mock
;
@Autowired
private
ControlCommandService
hkControlCommandService
;
/**
* 信号机方案下发
*
* @param
plan
SendVO 方案下发VO
* @param
scheme
SendVO 方案下发VO
* @return {@link Result}<{@link T}>
*/
@ApiOperation
(
value
=
"
方案下发-基础方案下发"
,
notes
=
"
方案下发-基础方案下发"
)
@ApiOperation
(
value
=
"
信号机方案下发-基础方案下发"
,
notes
=
"信号机
方案下发-基础方案下发"
)
@PostMapping
(
"/schemeSend"
)
public
<
T
>
Result
<
T
>
schemeSend
(
@RequestBody
PlanSendVO
plan
SendVO
)
throws
Exception
{
return
hkControlCommandService
.
planSend
(
plan
SendVO
);
public
<
T
>
Result
<
T
>
schemeSend
(
@RequestBody
SchemeSendVO
scheme
SendVO
)
throws
Exception
{
return
hkControlCommandService
.
schemeSend
(
scheme
SendVO
);
}
/**
...
...
signal-utc-service/src/main/java/net/wanji/utc/dto/hk/DownloadPlanSpandsDTO.java
0 → 100644
View file @
512673fb
package
net
.
wanji
.
utc
.
dto
.
hk
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* 海康下发信号机方案DTO
*
* @author wuxiaokai
* @date 2022/12/6 16:49:23
*/
@Setter
@Getter
public
class
DownloadPlanSpandsDTO
{
private
String
crossCode
;
private
List
<
Pattern
>
patternList
;
@Setter
@Getter
public
static
class
Pattern
{
private
String
patternNo
;
private
String
patternName
;
private
String
coordPhase
;
private
String
offset
;
private
String
cycle
;
private
List
<
Ring
>
rings
;
@Setter
@Getter
public
static
class
Ring
{
private
String
ringNo
;
private
List
<
Phase
>
phaseList
;
@Setter
@Getter
public
static
class
Phase
{
private
String
phaseNo
;
private
String
phaseName
;
private
String
phaseLength
;
private
String
phaseSequence
;
private
List
<
Lane
>
lanes
;
@Setter
@Getter
public
static
class
Lane
{
private
String
laneNo
;
private
String
direction
;
private
String
turn
;
}
}
}
}
}
signal-utc-service/src/main/java/net/wanji/utc/dto/hk/DownloadScheduleDTO.java
0 → 100644
View file @
512673fb
package
net
.
wanji
.
utc
.
dto
.
hk
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* 海康下发信号机日期DTO
*
* @author wuxiaokai
* @date 2022/11/23 14:11:09
*/
@Setter
@Getter
public
class
DownloadScheduleDTO
{
private
String
crossCode
;
private
List
<
Schedule
>
schedules
;
@Setter
@Getter
public
static
class
Schedule
{
private
Integer
scheduleNo
;
private
Integer
isPeriod
;
private
List
<
String
>
dates
;
private
List
<
String
>
weeks
;
private
Integer
planNo
;
}
}
signal-utc-service/src/main/java/net/wanji/utc/dto/hk/DownloadTimeSpandsDTO.java
0 → 100644
View file @
512673fb
package
net
.
wanji
.
utc
.
dto
.
hk
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* 海康信号机计划下发DTO
*
* @author wuxiaokai
* @date 2022/12/8 10:49:29
*/
@Setter
@Getter
public
class
DownloadTimeSpandsDTO
{
private
List
<
Data
>
data
;
@Setter
@Getter
public
static
class
Data
{
private
String
crossCode
;
private
List
<
Plan
>
planList
;
@Setter
@Getter
public
static
class
Plan
{
/**
* 计划号
*/
private
String
planNo
;
/**
* 时段列表
*/
private
List
<
Section
>
sectionList
;
@Setter
@Getter
public
static
class
Section
{
/**
* 时段号
*/
private
String
timeSecNo
;
/**
* 方案号
*/
private
String
patternNo
;
/**
* 控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪
*/
private
String
controlType
;
/**
* 开始时间
*/
private
String
beginTime
;
}
}
}
}
signal-utc-service/src/main/java/net/wanji/utc/mapper/CrossPhaseMapper.java
View file @
512673fb
...
...
@@ -12,6 +12,8 @@ import java.util.List;
public
interface
CrossPhaseMapper
{
void
deleteBatch
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"schemeId"
)
String
schemeId
);
void
insertBatch
(
@Param
(
"entities"
)
List
<
CrossPhasePO
>
crossPhasePOList
);
void
insertOne
(
CrossPhasePO
crossPhasePO
);
List
<
CrossPhasePO
>
selectByCrossIdAndPlanId
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"planId"
)
String
planId
);
...
...
signal-utc-service/src/main/java/net/wanji/utc/mapper/CrossPlanMapper.java
View file @
512673fb
...
...
@@ -14,6 +14,8 @@ public interface CrossPlanMapper {
void
insertOne
(
CrossPlanPO
crossPlanPO
);
void
insertBatch
(
@Param
(
"entities"
)
List
<
CrossPlanPO
>
crossPlanPOList
);
Integer
selectIdByNo
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"planNo"
)
Integer
planNo
);
List
<
CrossPlanPO
>
selectByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
...
...
signal-utc-service/src/main/java/net/wanji/utc/mapper/CrossSectionMapper.java
View file @
512673fb
...
...
@@ -15,6 +15,8 @@ public interface CrossSectionMapper {
void
insertOne
(
CrossSectionPO
crossSectionPO
);
void
insertBatch
(
@Param
(
"entities"
)
List
<
CrossSectionPO
>
crossSectionPOList
);
List
<
CrossSectionPO
>
selectByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
List
<
CrossSectionPO
>
selectByCrossIdAndPlanId
(
@Param
(
"crossId"
)
String
crossId
,
...
...
signal-utc-service/src/main/java/net/wanji/utc/service/control/ControlCommandService.java
View file @
512673fb
...
...
@@ -3,7 +3,8 @@ package net.wanji.utc.service.control;
import
net.wanji.utc.common.Result
;
import
net.wanji.utc.vo.PhaseLockVO
;
import
net.wanji.utc.vo.PlanSendVO
;
import
net.wanji.utc.vo.schedulesend.ScheduleSendVO
;
import
net.wanji.utc.vo.SchemeSendVO
;
import
net.wanji.utc.vo.ScheduleSendVO
;
import
net.wanji.utc.vo.timeplan.TimePlanVO
;
import
java.util.List
;
...
...
@@ -19,7 +20,7 @@ public interface ControlCommandService {
/**
* 方案下发
*/
<
T
>
Result
<
T
>
schemeSend
(
)
;
<
T
>
Result
<
T
>
schemeSend
(
SchemeSendVO
schemeSendVO
)
throws
Exception
;
/**
* 计划下发
...
...
signal-utc-service/src/main/java/net/wanji/utc/service/impl/HKControlCommandServiceImpl.java
View file @
512673fb
...
...
@@ -3,30 +3,27 @@ package net.wanji.utc.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.hikvision.artemis.sdk.ArtemisHttpUtil
;
import
com.hikvision.artemis.sdk.config.ArtemisConfig
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.utc.common.Result
;
import
net.wanji.utc.common.baseentity.BaseCrossInfo
;
import
net.wanji.utc.common.commonentity.HttpRequest
;
import
net.wanji.utc.common.exception.ControlException
;
import
net.wanji.utc.common.typeenum.BasicEnum
;
import
net.wanji.utc.common.typeenum.DateStyle
;
import
net.wanji.utc.dto.hk.DownloadPlanSpandsDTO
;
import
net.wanji.utc.dto.hk.DownloadScheduleDTO
;
import
net.wanji.utc.dto.hk.DownloadTimeSpandsDTO
;
import
net.wanji.utc.entity.SignalRunring
;
import
net.wanji.utc.mapper.CrossInfoMapper
;
import
net.wanji.utc.mapper.CrossPhaseMapper
;
import
net.wanji.utc.mapper.ManufacturerApiInfoMapper
;
import
net.wanji.utc.mapper.ManufacturerInfoMapper
;
import
net.wanji.utc.po.CrossInfoPO
;
import
net.wanji.utc.po.CrossPhasePO
;
import
net.wanji.utc.po.ManufacturerInfoPO
;
import
net.wanji.utc.mapper.*
;
import
net.wanji.utc.po.*
;
import
net.wanji.utc.service.control.ControlCommandService
;
import
net.wanji.utc.service.runninginfo.HkLightsStatusService
;
import
net.wanji.utc.util.FieldUtil
;
import
net.wanji.utc.util.ListUtil
;
import
net.wanji.utc.vo.LightsStatusVO
;
import
net.wanji.utc.vo.PhaseLockVO
;
import
net.wanji.utc.vo.PlanSendVO
;
import
net.wanji.utc.vo.schedulesend.ScheduleSendVO
;
import
net.wanji.utc.util.PathUtil
;
import
net.wanji.utc.vo.*
;
import
net.wanji.utc.vo.timeplan.Phase
;
import
net.wanji.utc.vo.timeplan.Ring
;
import
net.wanji.utc.vo.timeplan.TimePlanVO
;
...
...
@@ -34,7 +31,12 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
import
java.util.stream.Collectors
;
import
static
net
.
wanji
.
utc
.
common
.
ResultEnum
.
BODY_NOT_MATCH
;
...
...
@@ -64,147 +66,322 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
private
CrossInfoMapper
crossInfoMapper
;
@Resource
private
ManufacturerInfoMapper
manufacturerInfo
Mapper
;
private
CrossSchemeMapper
crossScheme
Mapper
;
@Override
public
<
T
>
Result
<
T
>
schemeSend
()
{
return
null
;
}
@Resource
private
CrossPlanMapper
crossPlanMapper
;
@Resource
private
CrossSectionMapper
crossSectionMapper
;
@Resource
private
CrossSchedulesMapper
crossSchedulesMapper
;
@Resource
private
ManufacturerInfoMapper
manufacturerInfoMapper
;
@Override
public
<
T
>
Result
<
T
>
planSend
(
PlanSendVO
plan
SendVO
)
throws
Exception
{
CrossInfoPO
crossInfoPo
=
crossInfoMapper
.
selectByCode
(
planSendVO
.
get
Code
());
public
<
T
>
Result
<
T
>
schemeSend
(
SchemeSendVO
scheme
SendVO
)
throws
Exception
{
CrossInfoPO
crossInfoPo
=
crossInfoMapper
.
selectByCode
(
schemeSendVO
.
getCross
Code
());
if
(
crossInfoPo
==
null
)
{
throw
new
ControlException
(
BODY_NOT_MATCH
.
getResultCode
(),
"参数错误,信号机ID不正确。"
);
}
// 厂商ID
Integer
manufacturerId
=
crossInfoPo
.
getManufacturerId
();
if
(
manufacturerId
.
equals
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
()))
{
Map
<
String
,
Object
>
fieldMap
=
FieldUtil
.
fieldMethod
(
planSendVO
);
// 下发时段方案
// 厂商 HK
ManufacturerInfoPO
manufacturerInfoPO
=
manufacturerInfoMapper
.
selectById
(
crossInfoPo
.
getManufacturerId
());
if
(
manufacturerInfoPO
.
getCode
().
equals
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
()))
{
// 1、组装参数, 下发海康信号机
DownloadPlanSpandsDTO
dto
=
new
DownloadPlanSpandsDTO
();
dto
.
setCrossCode
(
schemeSendVO
.
getCrossCode
());
List
<
DownloadPlanSpandsDTO
.
Pattern
>
patternList
=
new
ArrayList
<>();
schemeSendVO
.
getPatternList
().
forEach
(
pattern
->
{
DownloadPlanSpandsDTO
.
Pattern
pattern1
=
new
DownloadPlanSpandsDTO
.
Pattern
();
pattern1
.
setPatternNo
(
pattern
.
getPatternNo
());
pattern1
.
setPatternName
(
pattern
.
getPatternName
());
pattern1
.
setCoordPhase
(
pattern
.
getCoordPhase
());
pattern1
.
setOffset
(
pattern
.
getOffset
());
pattern1
.
setCycle
(
pattern
.
getCycle
());
List
<
DownloadPlanSpandsDTO
.
Pattern
.
Ring
>
rings
=
new
ArrayList
<>();
pattern
.
getRings
().
forEach
(
ring
->
{
DownloadPlanSpandsDTO
.
Pattern
.
Ring
ring1
=
new
DownloadPlanSpandsDTO
.
Pattern
.
Ring
();
ring1
.
setRingNo
(
ring
.
getRingNo
());
List
<
DownloadPlanSpandsDTO
.
Pattern
.
Ring
.
Phase
>
phaseList
=
new
ArrayList
<>();
ring
.
getPhaseList
().
forEach
(
phase
->
{
DownloadPlanSpandsDTO
.
Pattern
.
Ring
.
Phase
phase1
=
new
DownloadPlanSpandsDTO
.
Pattern
.
Ring
.
Phase
();
phase1
.
setPhaseNo
(
phase
.
getPhaseNo
());
phase1
.
setPhaseName
(
phase
.
getPhaseName
());
phase1
.
setPhaseLength
(
phase
.
getPhaseTime
());
phase1
.
setPhaseSequence
(
phase
.
getSort
());
phase1
.
setLanes
(
Lists
.
newArrayList
());
phaseList
.
add
(
phase1
);
});
ring1
.
setPhaseList
(
phaseList
);
rings
.
add
(
ring1
);
});
pattern1
.
setRings
(
rings
);
patternList
.
add
(
pattern1
);
});
dto
.
setPatternList
(
patternList
);
// 下发信号机方案
Map
<
String
,
Object
>
fieldMap
=
FieldUtil
.
fieldMethod
(
dto
);
Map
<
String
,
String
>
path
=
PathUtil
.
getPathMapByApiCode
(
"downloadPlanSpands"
);
String
strResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
getPathMapByApiCode
(
"downloadTimeSpands"
)
,
path
,
JSON
.
toJSONString
(
fieldMap
),
null
,
null
,
"application/json"
,
null
);
JSONObject
obj
=
JSON
.
parseObject
(
strResult
);
if
(
obj
.
getInteger
(
HK_CODE_KEY
).
equals
(
HK_SUCCESS_CODE
))
{
return
Result
.
success
();
// 入库操作
List
<
CrossSchemePO
>
crossSchemePOList
=
new
ArrayList
<>();
schemeSendVO
.
getPatternList
().
forEach
(
pattern
->
{
CrossSchemePO
crossSchemePO
=
new
CrossSchemePO
();
crossSchemePO
.
setSchemeNo
(
pattern
.
getPatternNo
());
crossSchemePO
.
setName
(
pattern
.
getPatternName
());
crossSchemePO
.
setCrossId
(
schemeSendVO
.
getCrossCode
());
crossSchemePO
.
setCycle
(
Integer
.
parseInt
(
pattern
.
getCycle
()));
crossSchemePO
.
setCoordPhase
(
Integer
.
parseInt
(
pattern
.
getCoordPhase
()));
crossSchemePO
.
setOffset
(
Integer
.
parseInt
(
pattern
.
getOffset
()));
crossSchemePO
.
setSource
(
2
);
crossSchemePO
.
setIsDeleted
(
0
);
crossSchemePOList
.
add
(
crossSchemePO
);
pattern
.
getRings
().
forEach
(
ring
->
{
List
<
CrossPhasePO
>
crossPhasePOList
=
new
ArrayList
<>();
ring
.
getPhaseList
().
forEach
(
phase
->
{
CrossPhasePO
crossPhasePO
=
new
CrossPhasePO
();
crossPhasePO
.
setPhaseNo
(
phase
.
getPhaseNo
());
crossPhasePO
.
setName
(
phase
.
getPhaseName
());
crossPhasePO
.
setSort
(
Integer
.
parseInt
(
phase
.
getSort
()));
crossPhasePO
.
setCrossId
(
schemeSendVO
.
getCrossCode
());
crossPhasePO
.
setPlanId
(
Integer
.
parseInt
(
pattern
.
getPatternNo
()));
crossPhasePO
.
setRingNo
(
Integer
.
parseInt
(
ring
.
getRingNo
()));
crossPhasePO
.
setControlMode
(
Integer
.
parseInt
(
phase
.
getControlMode
()));
crossPhasePO
.
setPhaseTime
(
Integer
.
parseInt
(
phase
.
getPhaseTime
()));
crossPhasePO
.
setGreenTime
(
Integer
.
parseInt
(
phase
.
getGreenTime
()));
crossPhasePO
.
setGreenFlashTime
(
Integer
.
parseInt
(
phase
.
getGreenFlashTime
()));
crossPhasePO
.
setPedFlashTime
(
Integer
.
parseInt
(
phase
.
getPedFlashTime
()));
crossPhasePO
.
setYellowTime
(
Integer
.
parseInt
(
phase
.
getYellowTime
()));
crossPhasePO
.
setRedTime
(
Integer
.
parseInt
(
phase
.
getRedTime
()));
crossPhasePO
.
setMinGreenTime
(
Integer
.
parseInt
(
phase
.
getMinGreenTime
()));
crossPhasePO
.
setMaxGreenTime
(
Integer
.
parseInt
(
phase
.
getMaxGreenTime
()));
crossPhasePOList
.
add
(
crossPhasePO
);
});
// 入库路口相位表
crossPhaseMapper
.
insertBatch
(
crossPhasePOList
);
});
});
// 入库信号方案表
crossSchemeMapper
.
insertBatch
(
crossSchemePOList
);
return
Result
.
success
(
"下发信号机方案成功"
);
}
return
Result
.
error
(
"下发
指令
失败"
);
return
Result
.
error
(
"下发
信号机方案
失败"
);
}
else
{
// todo else
return
null
;
}
}
private
Map
<
String
,
String
>
getPathMapByApiCode
(
String
apiCode
)
{
Map
<
String
,
String
>
res
=
new
HashMap
<>();
HttpRequest
httpRequest
=
new
HttpRequest
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
(),
apiCode
);
res
.
put
(
"http://"
,
artemisPath
+
httpRequest
.
getUrl
());
return
res
;
}
@Override
public
<
T
>
Result
<
T
>
scheduleSend
(
ScheduleSendVO
param
)
throws
Exception
{
CrossInfoPO
crossInfoPo
=
crossInfoMapper
.
selectByCode
(
p
aram
.
get
Code
());
public
<
T
>
Result
<
T
>
planSend
(
PlanSendVO
planSendVO
)
throws
Exception
{
CrossInfoPO
crossInfoPo
=
crossInfoMapper
.
selectByCode
(
p
lanSendVO
.
getCross
Code
());
if
(
crossInfoPo
==
null
)
{
throw
new
ControlException
(
BODY_NOT_MATCH
.
getResultCode
(),
"参数错误,信号机ID不正确。"
);
}
Integer
manufacturerId
=
crossInfoPo
.
getManufacturerId
();
param
.
setManufacturerCode
(
String
.
valueOf
(
manufacturerId
));
if
(
manufacturerId
.
equals
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
()))
{
return
downloadSchedule
(
param
);
// 厂商 HK
ManufacturerInfoPO
manufacturerInfoPO
=
manufacturerInfoMapper
.
selectById
(
crossInfoPo
.
getManufacturerId
());
if
(
manufacturerInfoPO
.
getCode
().
equals
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
()))
{
// 1、下发信号机计划拼接参数
DownloadTimeSpandsDTO
downloadTimeSpandsDTO
=
new
DownloadTimeSpandsDTO
();
List
<
DownloadTimeSpandsDTO
.
Data
>
dataList
=
new
ArrayList
<>();
DownloadTimeSpandsDTO
.
Data
data
=
new
DownloadTimeSpandsDTO
.
Data
();
data
.
setCrossCode
(
planSendVO
.
getCrossCode
());
List
<
DownloadTimeSpandsDTO
.
Data
.
Plan
>
planList
=
new
ArrayList
<>();
planSendVO
.
getPlanList
().
forEach
(
plan
->
{
DownloadTimeSpandsDTO
.
Data
.
Plan
plan1
=
new
DownloadTimeSpandsDTO
.
Data
.
Plan
();
plan1
.
setPlanNo
(
plan
.
getPlanNo
());
List
<
DownloadTimeSpandsDTO
.
Data
.
Plan
.
Section
>
sectionList
=
new
ArrayList
<>();
plan
.
getSectionList
().
forEach
(
section
->
{
DownloadTimeSpandsDTO
.
Data
.
Plan
.
Section
section1
=
new
DownloadTimeSpandsDTO
.
Data
.
Plan
.
Section
();
section1
.
setTimeSecNo
(
section
.
getSectionNo
());
section1
.
setPatternNo
(
section
.
getPatternNo
());
section1
.
setControlType
(
section
.
getControlMode
());
section1
.
setBeginTime
(
section
.
getBeginTime
());
sectionList
.
add
(
section1
);
});
plan1
.
setSectionList
(
sectionList
);
planList
.
add
(
plan1
);
});
data
.
setPlanList
(
planList
);
dataList
.
add
(
data
);
downloadTimeSpandsDTO
.
setData
(
dataList
);
// 1、下发信号机计划
Map
<
String
,
Object
>
fieldMap
=
FieldUtil
.
fieldMethod
(
downloadTimeSpandsDTO
);
Map
<
String
,
String
>
path
=
PathUtil
.
getPathMapByApiCode
(
"downloadTimeSpands"
);
String
strResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
path
,
JSON
.
toJSONString
(
fieldMap
),
null
,
null
,
"application/json"
,
null
);
JSONObject
obj
=
JSON
.
parseObject
(
strResult
);
if
(
obj
.
getInteger
(
HK_CODE_KEY
).
equals
(
HK_SUCCESS_CODE
))
{
// 2、入库操作
List
<
CrossPlanPO
>
crossPlanPOList
=
new
ArrayList
<>();
planSendVO
.
getPlanList
().
forEach
(
plan
->
{
CrossPlanPO
crossPlanPO
=
new
CrossPlanPO
();
crossPlanPO
.
setPlanNo
(
plan
.
getPlanNo
());
crossPlanPO
.
setName
(
plan
.
getPlanDescribe
());
crossPlanPO
.
setCrossId
(
planSendVO
.
getCrossCode
());
crossPlanPOList
.
add
(
crossPlanPO
);
List
<
CrossSectionPO
>
crossSectionPOList
=
new
ArrayList
<>();
plan
.
getSectionList
().
forEach
(
section
->
{
CrossSectionPO
crossSectionPO
=
new
CrossSectionPO
();
crossSectionPO
.
setSectionNo
(
section
.
getSectionNo
());
crossSectionPO
.
setStartTime
(
section
.
getBeginTime
());
crossSectionPO
.
setEndTime
(
section
.
getEndTime
());
crossSectionPO
.
setCrossId
(
planSendVO
.
getCrossCode
());
crossSectionPO
.
setPlanId
(
Integer
.
parseInt
(
plan
.
getPlanNo
()));
crossSectionPO
.
setControlMode
(
Integer
.
parseInt
(
section
.
getControlMode
()));
crossSectionPO
.
setScemeId
(
Integer
.
parseInt
(
section
.
getPatternNo
()));
crossSectionPOList
.
add
(
crossSectionPO
);
});
// 入库路口时段表
crossSectionMapper
.
insertBatch
(
crossSectionPOList
);
});
// 入库路口计划表
crossPlanMapper
.
insertBatch
(
crossPlanPOList
);
return
Result
.
success
(
"下发信号机计划成功"
);
}
return
Result
.
error
(
"下发信号机计划失败"
);
}
else
{
// todo else
return
null
;
}
}
private
<
T
>
Result
<
T
>
downloadSchedule
(
ScheduleSendVO
param
)
throws
Exception
{
JSONArray
jsonBody
=
new
JSONArray
();
jsonBody
.
add
(
param
.
getCode
());
// 通过获取当前运行的日期数据,获取最新的日期方案id
@Override
public
<
T
>
Result
<
T
>
scheduleSend
(
ScheduleSendVO
param
)
throws
Exception
{
CrossInfoPO
crossInfoPo
=
crossInfoMapper
.
selectByCode
(
param
.
getCrossCode
());
if
(
crossInfoPo
==
null
)
{
throw
new
ControlException
(
BODY_NOT_MATCH
.
getResultCode
(),
"参数错误,信号机ID不正确。"
);
}
// 厂商 HK
ManufacturerInfoPO
manufacturerInfoPO
=
manufacturerInfoMapper
.
selectById
(
crossInfoPo
.
getManufacturerId
());
if
(
manufacturerInfoPO
.
getCode
().
equals
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
()))
{
// 1、通过获取当前运行的日期数据,获取最新的日期方案id
JSONArray
body
=
new
JSONArray
();
body
.
add
(
param
.
getCrossCode
());
Map
<
String
,
String
>
path
=
PathUtil
.
getPathMapByApiCode
(
"uploadDate"
);
String
strResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
getPathMapByApiCode
(
"uploadDate"
)
,
jsonB
ody
.
toString
(),
null
,
null
,
"application/json"
,
null
);
JSONObject
obj
=
JSON
.
parseObject
(
strResult
);
//
日期 id
int
id
=
0
;
if
(
obj
.
getInteger
(
HK_CODE_KEY
).
equals
(
HK_SUCCESS_CODE
))
{
path
,
b
ody
.
toString
(),
null
,
null
,
"application/json"
,
null
);
JSONObject
object
=
JSON
.
parseObject
(
strResult
);
//
日期 id
int
id
=
1
;
if
(
object
.
getInteger
(
HK_CODE_KEY
).
equals
(
HK_SUCCESS_CODE
))
{
// 获取日期列表
JSONArray
schedulesArray
=
obj
.
getJSONArray
(
"data"
).
getJSONObject
(
0
).
getJSONArray
(
"schedules"
);
JSONArray
schedulesArray
=
object
.
getJSONArray
(
"data"
).
getJSONObject
(
0
).
getJSONArray
(
"schedules"
);
JSONObject
scheduleObj
=
schedulesArray
.
getJSONObject
(
schedulesArray
.
size
()
-
1
);
id
=
scheduleObj
.
getInteger
(
"id"
);
}
//拼接参数
JSONArray
schedulesArrayParam
=
new
JSONArray
();
// 获取传入的星期数组
JSONArray
weeks
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
param
.
getWeeks
()));
// 获取传入的特殊日期数组
JSONArray
specialDays
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
param
.
getSpecialDays
()));
if
(
null
!=
weeks
)
{
//去重,获取所有的运行方案号
Set
<
String
>
set
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
weeks
.
size
();
i
++)
{
String
sectionPlanId
=
weeks
.
getJSONObject
(
i
).
getString
(
"sectionplanid"
);
set
.
add
(
sectionPlanId
);
}
if
(
null
!=
specialDays
)
{
for
(
int
i
=
0
;
i
<
specialDays
.
size
();
i
++)
{
String
sectionPlanId
=
specialDays
.
getJSONObject
(
i
).
getString
(
"sectionplanid"
);
set
.
add
(
sectionPlanId
);
}
// 下发信号机日期拼接参数
DownloadScheduleDTO
dto
=
new
DownloadScheduleDTO
();
dto
.
setCrossCode
(
param
.
getCrossCode
());
List
<
DownloadScheduleDTO
.
Schedule
>
schedules
=
new
ArrayList
<>();
for
(
ScheduleSendVO
.
Schedule
schedule
:
param
.
getSchedules
())
{
List
<
ScheduleSendVO
.
Schedule
.
Week
>
scheduleWeeks
=
schedule
.
getWeeks
();
List
<
ScheduleSendVO
.
Schedule
.
SpecialDay
>
scheduleDays
=
schedule
.
getSpecialDays
();
if
(
null
!=
scheduleWeeks
&&
scheduleWeeks
.
size
()
>
0
)
{
// 去重,获取所有的运行方案号
Set
<
Integer
>
planNos
=
new
HashSet
<>();
scheduleWeeks
.
forEach
(
week
->
planNos
.
add
(
week
.
getPlanNo
()));
if
(
null
!=
scheduleDays
&&
scheduleDays
.
size
()
>
0
)
{
scheduleDays
.
forEach
(
specialDay
->
planNos
.
add
(
specialDay
.
getPlanNo
()));
}
int
num
=
0
;
for
(
String
planNo
:
set
)
{
JSONObject
schedulesObjectParam
=
new
JSONObject
();
List
<
Integer
>
weeksListParam
=
new
ArrayList
<>();
// 遍历星期列表,拼接星期集合参数
for
(
int
i
=
0
;
i
<
weeks
.
size
();
i
++)
{
JSONObject
week
=
weeks
.
getJSONObject
(
i
);
String
weekNum
=
week
.
getString
(
"weeknum"
);
String
sectionplanid
=
week
.
getString
(
"sectionplanid"
);
if
(
planNo
.
equals
(
sectionplanid
))
{
weeksListParam
.
add
(
Integer
.
valueOf
(
weekNum
));
}
}
// 遍历特殊日期列表,拼接特殊日期集合参数
if
(
null
!=
specialDays
)
{
List
<
String
>
specialDaysListParam
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
specialDays
.
size
();
i
++)
{
JSONObject
specialDay
=
specialDays
.
getJSONObject
(
i
);
String
datestr
=
specialDay
.
getString
(
"datestr"
);
String
sectionplanid
=
specialDay
.
getString
(
"sectionplanid"
);
if
(
planNo
.
equals
(
sectionplanid
))
{
specialDaysListParam
.
add
(
datestr
);
}
}
schedulesObjectParam
.
put
(
"dates"
,
specialDaysListParam
);
//0 说明 dates 内的日期是日期集合,1 说明是dates 内的数据是日期范围
schedulesObjectParam
.
put
(
"isPeriod"
,
0
);
}
//scheduleNo 日期号 ,支持返回【1~128】
if
(
id
+
set
.
size
()
>
128
)
{
schedulesObjectParam
.
put
(
"scheduleNo"
,
128
-
set
.
size
()
-
(++
num
));
for
(
Integer
planNo
:
planNos
)
{
DownloadScheduleDTO
.
Schedule
schedule1
=
new
DownloadScheduleDTO
.
Schedule
();
// scheduleNo 日期号 ,支持返回【1~128】
if
(
id
+
planNos
.
size
()
>
128
)
{
schedule1
.
setScheduleNo
(
128
-
planNos
.
size
()
-
(++
num
));
}
else
{
schedulesObjectParam
.
put
(
"scheduleNo"
,
id
+
(++
num
));
}
schedulesObjectParam
.
put
(
"planNo"
,
planNo
);
schedulesObjectParam
.
put
(
"weeks"
,
weeksListParam
);
schedulesArrayParam
.
add
(
schedulesObjectParam
);
}
}
JSONObject
bodyObjectParam
=
new
JSONObject
();
bodyObjectParam
.
put
(
"crossCode"
,
param
.
getCode
());
bodyObjectParam
.
put
(
"schedules"
,
schedulesArrayParam
);
// 下发路口运行计划方案
schedule1
.
setScheduleNo
(
id
+
(++
num
));
}
// 0 说明 dates 内的日期是日期集合,1 说明是dates 内的数据是日期范围
schedule1
.
setIsPeriod
(
0
);
// 特殊日期列表
List
<
String
>
dates
=
new
ArrayList
<>();
schedule
.
getSpecialDays
().
forEach
(
specialDay
->
{
if
(
specialDay
.
getPlanNo
().
equals
(
planNo
))
{
dates
.
add
(
specialDay
.
getDateStr
());
}
});
schedule1
.
setDates
(
dates
);
// 星期列表
List
<
String
>
weeks
=
new
ArrayList
<>();
schedule
.
getWeeks
().
forEach
(
week
->
{
if
(
week
.
getPlanNo
().
equals
(
planNo
))
{
weeks
.
add
(
String
.
valueOf
(
week
.
getWeekNum
()));
}
});
schedule1
.
setWeeks
(
weeks
);
schedule1
.
setPlanNo
(
planNo
);
schedules
.
add
(
schedule1
);
}
}
}
dto
.
setSchedules
(
schedules
);
// 2、下发时间表
Map
<
String
,
Object
>
fieldMap
=
FieldUtil
.
fieldMethod
(
dto
);
Map
<
String
,
String
>
downloadSchedulePath
=
PathUtil
.
getPathMapByApiCode
(
"downloadTimeSpands"
);
String
updateResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
getPathMapByApiCode
(
"downloadSchedule"
),
bodyObjectParam
.
toJSONString
(),
null
,
null
,
"application/json"
,
null
);
JSONObject
updateObject
=
JSON
.
parseObject
(
updateResult
);
if
(
updateObject
.
getInteger
(
HK_CODE_KEY
).
equals
(
HK_SUCCESS_CODE
))
{
return
Result
.
success
();
downloadSchedulePath
,
JSON
.
toJSONString
(
fieldMap
),
null
,
null
,
"application/json"
,
null
);
JSONObject
obj
=
JSON
.
parseObject
(
updateResult
);
if
(
obj
.
getInteger
(
HK_CODE_KEY
).
equals
(
HK_SUCCESS_CODE
))
{
// 1、入库操作
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
DateStyle
.
YYYY_MM_DD
.
getValue
());
ArrayList
<
CrossSchedulesPO
>
crossSchedulesPOS
=
new
ArrayList
<>();
param
.
getSchedules
().
forEach
(
schedule
->
{
schedule
.
getWeeks
().
forEach
(
week
->
{
CrossSchedulesPO
schedulesPO
=
new
CrossSchedulesPO
();
if
(
week
.
getWeekNum
()
>=
6
)
{
schedulesPO
.
setName
(
"周末"
);
}
else
{
schedulesPO
.
setName
(
"工作日"
);
}
schedulesPO
.
setCrossId
(
param
.
getCrossCode
());
schedulesPO
.
setPlanId
(
week
.
getPlanNo
());
schedulesPO
.
setWeek
(
week
.
getWeekNum
());
schedulesPO
.
setSpecialDate
(
null
);
crossSchedulesPOS
.
add
(
schedulesPO
);
});
schedule
.
getSpecialDays
().
forEach
(
specialDay
->
{
CrossSchedulesPO
schedulesPO
=
new
CrossSchedulesPO
();
schedulesPO
.
setName
(
"特殊日期"
);
schedulesPO
.
setCrossId
(
param
.
getCrossCode
());
schedulesPO
.
setPlanId
(
specialDay
.
getPlanNo
());
schedulesPO
.
setWeek
(
null
);
try
{
schedulesPO
.
setSpecialDate
(
sdf
.
parse
(
specialDay
.
getDateStr
()));
}
catch
(
ParseException
e
)
{
schedulesPO
.
setSpecialDate
(
null
);
}
crossSchedulesPOS
.
add
(
schedulesPO
);
});
});
// 入库时间表
crossSchedulesMapper
.
insertBatch
(
crossSchedulesPOS
);
return
Result
.
success
(
"时间表下发成功"
);
}
return
Result
.
error
(
"时间表下发失败"
);
}
else
{
// todo else
return
null
;
}
return
Result
.
error
(
"下发指令失败"
);
}
@Override
...
...
@@ -254,7 +431,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
* @param laneNoMap 转向和方向与车道关系集合
*/
private
void
getPhaseRelationLanes
(
String
crossCode
,
Map
<
Integer
,
JSONArray
>
laneArrayMap
,
Map
<
String
,
Integer
>
laneNoMap
)
throws
Exception
{
Map
<
String
,
String
>
path
=
getPathMapByApiCode
(
"queryPhaseRlatLanes"
);
Map
<
String
,
String
>
path
=
PathUtil
.
getPathMapByApiCode
(
"queryPhaseRlatLanes"
);
Map
<
String
,
String
>
queryMap
=
new
HashMap
<>();
queryMap
.
put
(
"crossCode"
,
crossCode
);
String
strResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
path
,
null
,
queryMap
,
null
,
"application/json"
,
null
);
...
...
@@ -304,9 +481,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
throw
new
ControlException
(
BODY_NOT_MATCH
.
getResultCode
(),
"参数错误,信号机ID不正确。"
);
}
Integer
manufacturerId
=
crossInfoPo
.
getManufacturerId
();
ManufacturerInfoPO
manufacturerInfoPO
=
manufacturerInfoMapper
.
selectById
(
manufacturerId
);
String
manufacturerCode
=
manufacturerInfoPO
.
getCode
();
if
(
manufacturerCode
.
equals
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
()))
{
if
(
manufacturerId
.
equals
(
BasicEnum
.
ManufacturerEnum
.
HK
.
getCode
()))
{
Integer
runningMode
=
command
.
equals
(
TRUE
)
?
commandType
:
NORMAL_RUNNING_CONTROL
;
return
controlSignal
(
code
,
runningMode
);
}
else
{
...
...
@@ -404,7 +579,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
bodyObjectParam
.
put
(
"patternList"
,
patternArrayParam
);
//获取下发配时方案的url
String
strResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
getPathMapByApiCode
(
"updateTimePlans"
),
PathUtil
.
getPathMapByApiCode
(
"updateTimePlans"
),
bodyObjectParam
.
toJSONString
(),
null
,
null
,
"application/json"
,
null
);
JSONObject
obj
=
JSON
.
parseObject
(
strResult
);
return
HK_SUCCESS_CODE
.
equals
(
obj
.
getInteger
(
HK_CODE_KEY
));
...
...
@@ -455,7 +630,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
private
<
T
>
Result
<
T
>
setSignalControl
(
Map
<
String
,
Object
>
param
)
{
try
{
String
strResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
getPathMapByApiCode
(
"SetSignalControl"
),
PathUtil
.
getPathMapByApiCode
(
"SetSignalControl"
),
JSON
.
toJSONString
(
param
),
null
,
null
,
"application/json"
,
null
);
JSONObject
obj
=
JSON
.
parseObject
(
strResult
);
if
(
HK_SUCCESS_CODE
.
equals
(
obj
.
getInteger
(
HK_CODE_KEY
)))
{
...
...
@@ -499,7 +674,7 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
}
};
String
strResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
getPathMapByApiCode
(
"SetSignalControl"
),
PathUtil
.
getPathMapByApiCode
(
"SetSignalControl"
),
JSON
.
toJSONString
(
param
),
null
,
null
,
"application/json"
,
null
);
JSONObject
object
=
JSON
.
parseObject
(
strResult
);
if
(
HK_SUCCESS_CODE
.
equals
(
object
.
getInteger
(
HK_CODE_KEY
)))
{
...
...
signal-utc-service/src/main/java/net/wanji/utc/util/FieldUtil.java
View file @
512673fb
package
net
.
wanji
.
utc
.
util
;
import
com.alibaba.fastjson.JSON
;
import
net.wanji.utc.vo.PlanSendVO
;
import
java.lang.reflect.Field
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
signal-utc-service/src/main/java/net/wanji/utc/vo/PlanSendVO.java
View file @
512673fb
package
net
.
wanji
.
utc
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
net.wanji.utc.common.baseentity.BaseCrossInfo
;
...
...
@@ -7,34 +8,67 @@ import net.wanji.utc.common.baseentity.BaseCrossInfo;
import
java.util.List
;
/**
* 信号机计划下发VO
*
* @author wuxiaokai
* @date 2022/11/24 15:55:08
*/
@Setter
@Getter
public
class
PlanSendVO
extends
BaseCrossInfo
{
public
class
PlanSendVO
{
private
List
<
Data
>
data
;
@Setter
@Getter
private
static
class
Data
{
@ApiModelProperty
(
value
=
"路口编号"
,
notes
=
"路口编号"
)
private
String
crossCode
;
@ApiModelProperty
(
value
=
"计划列表"
,
notes
=
"计划列表"
)
private
List
<
Plan
>
planList
;
@Setter
@Getter
private
static
class
Plan
{
public
static
class
Plan
{
/**
* 计划号
*/
@ApiModelProperty
(
value
=
"计划号"
,
notes
=
"计划号"
)
private
String
planNo
;
/**
* 计划描述
*/
@ApiModelProperty
(
value
=
"计划描述"
,
notes
=
"计划描述"
)
private
String
planDescribe
;
/**
* 时段列表
*/
@ApiModelProperty
(
value
=
"时段列表"
,
notes
=
"时段列表"
)
private
List
<
Section
>
sectionList
;
@Setter
@Getter
private
static
class
Section
{
private
String
timeSecNo
;
private
String
patternNo
;
public
static
class
Section
{
/**
* 时段号
*/
@ApiModelProperty
(
value
=
"时段号"
,
notes
=
"时段号"
)
private
String
sectionNo
;
/**
* 开始时间
*/
@ApiModelProperty
(
value
=
"开始时间"
,
notes
=
"开始时间"
)
private
String
beginTime
;
}
/**
* 结束时间
*/
@ApiModelProperty
(
value
=
"结束时间"
,
notes
=
"结束时间"
)
private
String
endTime
;
/**
* 控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪
*/
@ApiModelProperty
(
value
=
"控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪"
,
notes
=
""
)
private
String
controlMode
;
/**
* 方案号
*/
@ApiModelProperty
(
value
=
"方案号"
,
notes
=
""
)
private
String
patternNo
;
}
}
}
signal-utc-service/src/main/java/net/wanji/utc/vo/ScheduleSendVO.java
0 → 100644
View file @
512673fb
package
net
.
wanji
.
utc
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* 时间表下发VO
*
* @author wuxiaokai
* @date 2022/11/23 14:11:09
*/
@Setter
@Getter
public
class
ScheduleSendVO
{
@ApiModelProperty
(
value
=
"路口编号"
,
notes
=
"路口编号"
)
private
String
crossCode
;
@ApiModelProperty
(
value
=
"时间表"
,
notes
=
"时间表"
)
private
List
<
Schedule
>
schedules
;
@Setter
@Getter
public
static
class
Schedule
{
/**
* 星期列表
*/
@ApiModelProperty
(
value
=
"星期列表"
,
notes
=
"星期列表"
)
private
List
<
Week
>
weeks
;
/**
* 特殊日期列表
*/
@ApiModelProperty
(
value
=
"特殊日期列表"
,
notes
=
"特殊日期列表"
)
private
List
<
SpecialDay
>
specialDays
;
@Setter
@Getter
public
static
class
Week
{
@ApiModelProperty
(
value
=
"星期"
,
notes
=
"星期"
)
private
Integer
weekNum
;
@ApiModelProperty
(
value
=
"计划号"
,
notes
=
"计划号"
)
private
Integer
planNo
;
}
@Setter
@Getter
public
static
class
SpecialDay
{
/**
* 日期 2019-05-01
*/
@ApiModelProperty
(
value
=
"日期"
,
notes
=
"日期"
)
private
String
dateStr
;
/**
* 计划号
*/
@ApiModelProperty
(
value
=
"计划号"
,
notes
=
"计划号"
)
private
Integer
planNo
;
}
}
}
signal-utc-service/src/main/java/net/wanji/utc/vo/SchemeSendVO.java
0 → 100644
View file @
512673fb
package
net
.
wanji
.
utc
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* 信号机方案下发VO
*
* @author wuxiaokai
* @date 2022/12/6 16:14:27
*/
@Setter
@Getter
public
class
SchemeSendVO
{
@ApiModelProperty
(
value
=
"路口编号"
,
notes
=
"路口编号"
)
private
String
crossCode
;
@ApiModelProperty
(
value
=
"方案列表"
,
notes
=
"方案列表"
)
private
List
<
Pattern
>
patternList
;
/**
* 方案
*/
@Setter
@Getter
public
static
class
Pattern
{
/**
* 方案号
*/
@ApiModelProperty
(
value
=
"方案号"
,
notes
=
""
)
private
String
patternNo
;
/**
* 方案名称
*/
@ApiModelProperty
(
value
=
"方案名称"
,
notes
=
""
)
private
String
patternName
;
/**
* 方案周期
*/
@ApiModelProperty
(
value
=
"方案周期"
,
notes
=
""
)
private
String
cycle
;
/**
* 协调相位号
*/
@ApiModelProperty
(
value
=
"协调相位号"
,
notes
=
""
)
private
String
coordPhase
;
/**
* 协调相位差
*/
@ApiModelProperty
(
value
=
"协调相位差"
,
notes
=
"协调相位差"
)
private
String
offset
;
@ApiModelProperty
(
value
=
"环列表"
,
notes
=
"环列表"
)
private
List
<
Ring
>
rings
;
@Setter
@Getter
public
static
class
Ring
{
@ApiModelProperty
(
value
=
"环号"
,
notes
=
"环号"
)
private
String
ringNo
;
@ApiModelProperty
(
value
=
"相位列表"
,
notes
=
"相位列表"
)
private
List
<
Phase
>
phaseList
;
/**
* 相位
*/
@Setter
@Getter
public
static
class
Phase
{
/**
* 相位号
*/
@ApiModelProperty
(
value
=
"相位号"
,
notes
=
""
)
private
String
phaseNo
;
/**
* 相位名称
*/
@ApiModelProperty
(
value
=
"相位名称"
,
notes
=
""
)
private
String
phaseName
;
/**
* 相位序号
*/
@ApiModelProperty
(
value
=
"相位序号"
,
notes
=
""
)
private
String
sort
;
/**
* 控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪
*/
@ApiModelProperty
(
value
=
"控制模式:1定周期;2绿灯;3黄灯;4红灯;5关灯;6绿闪;7黄闪;8红闪"
,
notes
=
""
)
private
String
controlMode
;
/**
* 最小绿灯时间
*/
@ApiModelProperty
(
value
=
"最小绿灯时间"
,
notes
=
""
)
private
String
minGreenTime
;
/**
* 最大绿灯时间
*/
@ApiModelProperty
(
value
=
"最大绿灯时间"
,
notes
=
""
)
private
String
maxGreenTime
;
/**
* 相位时间
*/
@ApiModelProperty
(
value
=
"相位时间"
,
notes
=
""
)
private
String
phaseTime
;
/**
* 绿灯时间
*/
@ApiModelProperty
(
value
=
"绿灯时间"
,
notes
=
""
)
private
String
greenTime
;
/**
* 绿闪时间
*/
@ApiModelProperty
(
value
=
"绿闪时间"
,
notes
=
""
)
private
String
greenFlashTime
;
/**
* 行闪时间
*/
@ApiModelProperty
(
value
=
"行闪时间"
,
notes
=
""
)
private
String
pedFlashTime
;
/**
* 黄灯时间
*/
@ApiModelProperty
(
value
=
"黄灯时间"
,
notes
=
""
)
private
String
yellowTime
;
/**
* 红灯时间
*/
@ApiModelProperty
(
value
=
"红灯时间"
,
notes
=
""
)
private
String
redTime
;
}
@Setter
@Getter
public
static
class
Lights
{
/**
* 灯组号
*/
@ApiModelProperty
(
value
=
"灯组号"
,
notes
=
""
)
private
String
lightsNo
;
/**
* 灯组名称
*/
@ApiModelProperty
(
value
=
"灯组名称"
,
notes
=
""
)
private
String
name
;
/**
* 灯组类型:1箭头;2圆饼,3行人
*/
@ApiModelProperty
(
value
=
"灯组类型:1箭头2圆饼3行人"
,
notes
=
""
)
private
String
type
;
/**
* 灯组方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北
*/
@ApiModelProperty
(
value
=
"灯组方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北"
,
notes
=
""
)
private
String
dir
;
/**
* 灯组转向:1左转;2右转;3直行;4左掉头;5直左;6直右;7右掉头;8向左合流;9向右合流;10左转加掉头;11右转加掉头;12直行加左掉头;13直行加右掉头;14左转右转;15左直右;16左转右转加掉头;17左直掉头;18左直右掉头;20行人
*/
@ApiModelProperty
(
value
=
"灯组转向:1左转;2右转;3直行;4左掉头;5直左;6直右;7右掉头;8向左合流;9向右合流;10左转加掉头;11右转加掉头;12直行加左掉头;13直行加右掉头;14左转右转;15左直右;16左转右转加掉头;17左直掉头;18左直右掉头;20行人"
,
notes
=
""
)
private
String
turn
;
/**
* 行人进出口:1进口;2出口,3进出口
*/
@ApiModelProperty
(
value
=
"行人进出口:1进口2出口,3进出口"
,
notes
=
""
)
private
String
inOutType
;
}
}
}
}
signal-utc-service/src/main/java/net/wanji/utc/vo/plansend/PlanSendVO.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
plansend
;
import
lombok.Data
;
import
net.wanji.utc.common.baseentity.BaseCrossInfo
;
import
java.util.List
;
/**
* 计划下发VO
*
* @author wuxiaokai
* @date 2022/11/21 17:10:43
*/
@Data
public
class
PlanSendVO
extends
BaseCrossInfo
{
/**
* 星期
*/
private
List
<
Week
>
weeks
;
/**
* 特殊日期
*/
private
List
<
SpecialDay
>
specialDays
;
/**
* 日时段方案数据对象列表
*/
private
List
<
SectionPlan
>
sectionPlans
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/plansend/SectionPlan.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
plansend
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author wanji
* @version 1.0
* @Description: [路口时段方案实体]
* Created on 2019/4/22 16:20
*/
@Data
@ApiModel
(
value
=
"SectionPlan"
,
description
=
"路口时段方案实体"
)
public
class
SectionPlan
{
/**
* 时段方案编号
*/
@ApiModelProperty
(
value
=
"时段方案编号"
)
private
String
sectionPlanId
;
/**
* 时段方案描述
*/
@ApiModelProperty
(
value
=
"时段方案描述"
)
private
String
sectionPlanDesc
;
/**
* 时段数据列表
*/
@ApiModelProperty
(
value
=
"时段数据列表"
)
private
List
<
TimeSlice
>
timeSlices
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/plansend/SectionPlanVo.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
plansend
;
import
lombok.Data
;
import
net.wanji.utc.common.baseentity.BaseCrossInfo
;
import
java.util.List
;
/**
* @author wanji
* @version 1.0
* @Description: [路口时段方案Vo]
* Created on 2019/4/22 16:17
*/
@Data
public
class
SectionPlanVo
extends
BaseCrossInfo
{
//日时段方案数据对象列表
private
List
<
SectionPlan
>
sectionPlans
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/plansend/SpecialDay.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
plansend
;
import
lombok.Data
;
/**
* 特殊日期
*
* @author wuxiaokai
* @date 2022/11/21 17:13:08
*/
@Data
public
class
SpecialDay
{
/**
* 日期 2019-05-01
*/
private
String
dateStr
;
/**
* 时段方案编号
*/
private
Integer
sectionPlanId
;
/**
* 星期
*/
private
Integer
weekNum
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/plansend/TimeSlice.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
plansend
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author wanji
* @version 1.0
* @Description: [时段数据实体]
* Created on 2019/4/22 16:22
*/
@Data
@ApiModel
(
value
=
"Timeslice"
,
description
=
"时段数据实体"
)
public
class
TimeSlice
{
/**
* 时段编号
*/
@ApiModelProperty
(
value
=
"时段编号"
)
private
String
timeSliceId
;
/**
* 时段描述
*/
@ApiModelProperty
(
value
=
"时段描述"
)
private
String
timeSliceDesc
;
/**
* 时段顺序号
*/
@ApiModelProperty
(
value
=
"时段顺序号"
)
private
Integer
timeSliceOrderId
;
/**
* 开始时间,格式 HH:MI:00
*/
@ApiModelProperty
(
value
=
"开始时间,格式 HH:MI:00"
)
private
String
startTime
;
/**
* 配时方案编号
*/
@ApiModelProperty
(
value
=
"配时方案编号"
)
private
String
timePlanId
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/plansend/Week.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
plansend
;
import
lombok.Data
;
/**
* @author wuxiaokai
* @date 2022/11/21 17:12:33
*/
@Data
public
class
Week
{
private
Integer
weekNum
;
private
Integer
sectionPlanId
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/schedulesend/ScheduleSendVO.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
schedulesend
;
import
lombok.Data
;
import
net.wanji.utc.common.baseentity.BaseCrossInfo
;
import
net.wanji.utc.vo.plansend.SpecialDay
;
import
net.wanji.utc.vo.plansend.Week
;
import
java.util.List
;
/**
* 时间表下发VO
*
* @author wuxiaokai
* @date 2022/11/23 14:11:09
*/
@Data
public
class
ScheduleSendVO
extends
BaseCrossInfo
{
/**
* 星期
*/
private
List
<
Week
>
weeks
;
/**
* 特殊日期
*/
private
List
<
SpecialDay
>
specialDays
;
}
signal-utc-service/src/main/java/net/wanji/utc/vo/signal/SignalLightStateVo.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
signal
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
net.wanji.utc.common.baseentity.BaseCrossInfo
;
import
java.util.List
;
import
java.util.Map
;
/**
* 信号灯态基础信息实体
*/
@Data
public
class
SignalLightStateVo
extends
BaseCrossInfo
{
/**
* 运行模式
*/
@ApiModelProperty
(
value
=
"运行模式 `2=手动锁定当前相位`,`3=手动全红`,`4=手动黄闪`,`5=手动关灯`,"
+
"`6=全红闪控制`,`7=全黄控制`,`8=正常按计划运行`,`9=手动步进控制`,`10=自动步进控制`,`11=恢复时间表`,`255=临时控制方案`"
)
private
String
runMode
;
/**
* 控制模式
*/
@ApiModelProperty
(
value
=
"控制模式"
)
private
String
controlMode
;
/**
* 相位方案号
*/
@ApiModelProperty
(
value
=
"相位方案号"
)
private
String
phasePlanId
;
/**
* 相位配时方案
*/
@ApiModelProperty
(
value
=
"相位配时方案"
)
private
String
timePlanId
;
/**
* 方案开始时间
*/
@ApiModelProperty
(
value
=
"方案开始时间"
)
private
String
planStartTime
;
/**
* 方案运行时间
*/
@ApiModelProperty
(
value
=
"方案运行时间"
)
private
Integer
runTime
;
/**
* 相位周期剩余时长
*/
@ApiModelProperty
(
value
=
"相位周期剩余时长"
)
private
Integer
cycleCountDown
;
/**
* 相位周期时长
*/
@ApiModelProperty
(
value
=
"相位周期时长"
)
private
Integer
cycleLen
;
/**
* 运行环数组
*/
private
List
<
SignalRingVo
>
rings
;
/**
* 当前相位号
*/
@ApiModelProperty
(
value
=
"当前相位号"
)
private
String
phaseId
;
/**
* 当前方案号
*/
@ApiModelProperty
(
value
=
"当前方案号"
)
private
String
planId
;
/**
* 灯组状态
*/
@ApiModelProperty
(
value
=
"灯组状态"
)
private
Map
<
String
,
Object
>
dirLampGroupMap
;
/**
* 相位对象:key:相位编号,value:绿灯时长
*/
@ApiModelProperty
(
value
=
"相位对象:key相位编号,value绿灯时长"
)
private
Map
<
String
,
Object
>
phaseMap
;
public
void
setCycleCountDown
(
Integer
cycleCountDown
)
{
if
(
null
==
cycleCountDown
)
{
this
.
cycleCountDown
=
-
1
;
}
else
{
this
.
cycleCountDown
=
cycleCountDown
;
}
}
public
Integer
getCycleCountDown
()
{
if
(
null
==
cycleCountDown
)
{
return
-
1
;
}
return
cycleCountDown
;
}
}
signal-utc-service/src/main/java/net/wanji/utc/vo/signal/SignalRingVo.java
deleted
100644 → 0
View file @
75c8d89f
package
net
.
wanji
.
utc
.
vo
.
signal
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 信号机运行环数实体
*/
@Data
@ApiModel
(
value
=
"SignalRingVo"
,
description
=
"信号机运行环数实体"
)
public
class
SignalRingVo
{
//绿灯1
@ApiModelProperty
(
value
=
"绿灯1时长"
)
private
Integer
oneTime
;
//绿灯2
@ApiModelProperty
(
value
=
"绿灯2时长"
)
private
Integer
twoTime
;
//绿灯3
@ApiModelProperty
(
value
=
"绿灯3时长"
)
private
Integer
threeTime
;
//黄灯4
@ApiModelProperty
(
value
=
"黄灯4时长"
)
private
Integer
fourTime
;
//红灯5
@ApiModelProperty
(
value
=
"红灯5时长"
)
private
Integer
fiveTime
;
//环号
@ApiModelProperty
(
value
=
"环号"
)
private
String
ringNo
;
//当前相位编号
@ApiModelProperty
(
value
=
"当前相位编号"
)
private
String
phaseId
;
//相位时长
@ApiModelProperty
(
value
=
"相位时长"
)
private
Integer
phaseLen
;
//相位剩余时长
@ApiModelProperty
(
value
=
"相位剩余时长"
)
private
Integer
phaseLeft
;
//当前步号
@ApiModelProperty
(
value
=
"当前步号"
)
private
Integer
stepNo
;
//当前步类型
@ApiModelProperty
(
value
=
"当前步类型"
)
private
Integer
stepType
;
//当前步长
@ApiModelProperty
(
value
=
"当前步长"
)
private
Integer
stepLen
;
//当前步剩余时间
@ApiModelProperty
(
value
=
"当前步剩余时间"
)
private
Integer
stepLeft
;
//下一相位id
@ApiModelProperty
(
value
=
"下一相位id"
)
private
String
nextPhaseId
;
//相位顺序号
@ApiModelProperty
(
value
=
"相位顺序号"
)
private
Integer
phaseOrderId
;
/**
* 当前灯色
*/
@ApiModelProperty
(
value
=
"当前灯色"
)
private
Integer
lampStatus
;
/**
* 当前说明
* 11 灭灯
* 21 红灯
* 22 黄灯
* 23 绿灯
* 31 红黄
*/
@ApiModelProperty
(
value
=
"当前灯色"
)
private
String
lampStatusName
;
}
signal-utc-service/src/main/resources/mapper/CrossPhaseMapper.xml
View file @
512673fb
...
...
@@ -27,6 +27,17 @@
values (#{phaseNo},#{name},#{sort},#{crossId},#{planId},#{ringNo},#{controlMode},#{phaseTime},#{greenTime},#{greenFlashTime},#{pedFlashTime},#{yellowTime},#{redTime},#{minGreenTime},#{maxGreenTime})
</insert>
<insert
id=
"insertBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_cross_phase(phase_no,name,sort,cross_id,plan_id,ring_no,control_mode,phase_time,green_time,
green_flash_time,ped_flash_time,yellow_time,red_time,min_green_time,max_green_time)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.phaseNo},#{entity.name},#{entity.sort},#{entity.crossId},#{entity.planId},#{entity.ringNo},
#{entity.controlMode},#{entity.phaseTime},#{entity.greenTime},#{entity.greenFlashTime},#{entity.pedFlashTime},
#{entity.yellowTime},#{entity.redTime},#{entity.minGreenTime},#{entity.maxGreenTime})
</foreach>
</insert>
<delete
id=
"deleteBatch"
>
delete from t_cross_phase
where cross_id = #{crossId} and plan_id = #{schemeId}
...
...
signal-utc-service/src/main/resources/mapper/CrossPlanMapper.xml
View file @
512673fb
...
...
@@ -16,6 +16,14 @@
values (#{planNo},#{name},#{crossId})
</insert>
<insert
id=
"insertBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_cross_plan(plan_no,name,cross_id)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.planNo},#{entity.name},#{entity.crossId})
</foreach>
</insert>
<delete
id=
"deleteOne"
>
delete from t_cross_plan
where cross_id = #{crossId} and plan_no = #{planNo}
...
...
signal-utc-service/src/main/resources/mapper/CrossSectionMapper.xml
View file @
512673fb
...
...
@@ -19,6 +19,14 @@
values (#{sectionNo},#{startTime},#{endTime},#{crossId},#{planId},#{controlMode},#{scemeId})
</insert>
<insert
id=
"insertBatch"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into t_cross_section(section_no,start_time,end_time,cross_id,plan_id,control_mode,sceme_id)
values
<foreach
collection=
"entities"
item=
"entity"
separator=
","
>
(#{entity.sectionNo},#{entity.startTime},#{entity.endTime},#{entity.crossId},#{entity.planId},#{entity.controlMode},#{entity.scemeId})
</foreach>
</insert>
<delete
id=
"deleteOne"
>
delete from t_cross_section
where cross_id = #{crossId} and section_no = #{timeSecNo}
...
...
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