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
27714f6c
Commit
27714f6c
authored
Jan 16, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除无用常量类,统一返回结果
parent
2ddb2e49
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
121 additions
and
414 deletions
+121
-414
AspectLog.java
.../main/java/net/wanji/web/common/annotation/AspectLog.java
+0
-29
Ignore.java
...src/main/java/net/wanji/web/common/annotation/Ignore.java
+0
-17
Like.java
...e/src/main/java/net/wanji/web/common/annotation/Like.java
+0
-17
Const.java
...ce/src/main/java/net/wanji/web/common/constant/Const.java
+0
-118
Constant.java
...src/main/java/net/wanji/web/common/constant/Constant.java
+19
-0
RedisUtils.java
...e/src/main/java/net/wanji/web/common/util/RedisUtils.java
+3
-4
SignalEvaluateController.java
...va/net/wanji/web/controller/SignalEvaluateController.java
+3
-5
SignalServiceController.java
...ava/net/wanji/web/controller/SignalServiceController.java
+51
-51
TBaseCrossInfoController.java
...va/net/wanji/web/controller/TBaseCrossInfoController.java
+6
-9
GlobalExceptionHandler.java
...in/java/net/wanji/web/handler/GlobalExceptionHandler.java
+9
-9
TBaseCrossInfoService.java
...ain/java/net/wanji/web/service/TBaseCrossInfoService.java
+16
-22
SchemeConfigServiceImpl.java
...anji/web/service/scheme/impl/SchemeConfigServiceImpl.java
+3
-23
Result.java
...ice/src/main/java/net/wanji/feign/pojo/result/Result.java
+0
-98
UtcFeignClients.java
...rc/main/java/net/wanji/feign/service/UtcFeignClients.java
+11
-12
No files found.
signal-control-service/src/main/java/net/wanji/web/common/annotation/AspectLog.java
deleted
100644 → 0
View file @
2ddb2e49
package
net
.
wanji
.
web
.
common
.
annotation
;
import
net.wanji.web.common.enums.BaseEnum
;
import
java.lang.annotation.*
;
/**
* @Description: [自定义注解-系统操作日志,拦截Controller请求]
* @author wanji
* @version 1.0
* Created on 2019/4/17 14:06
*/
@Target
({
ElementType
.
PARAMETER
,
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
AspectLog
{
/**
* 操作描述 业务名称description
* @return
*/
String
description
()
default
""
;
/**
* 操作类型 query create modify delete
* @return
*/
BaseEnum
.
OperationTypeEnum
operationType
();
}
signal-control-service/src/main/java/net/wanji/web/common/annotation/Ignore.java
deleted
100644 → 0
View file @
2ddb2e49
package
net
.
wanji
.
web
.
common
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* @Description: [构造Example时忽略此条件]
* Created on: 2019/5/5
* @author wanji
* @version 1.0
*/
@Target
({
ElementType
.
TYPE
,
ElementType
.
FIELD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Ignore
{
}
signal-control-service/src/main/java/net/wanji/web/common/annotation/Like.java
deleted
100644 → 0
View file @
2ddb2e49
package
net
.
wanji
.
web
.
common
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* @Description: [构造Example时,此字段为like]
* Created on: 2019/5/5
* @author wanji
* @version 1.0
*/
@Target
({
ElementType
.
TYPE
,
ElementType
.
FIELD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
public
@interface
Like
{
}
signal-control-service/src/main/java/net/wanji/web/common/constant/Const.java
deleted
100644 → 0
View file @
2ddb2e49
package
net
.
wanji
.
web
.
common
.
constant
;
/**
* @Description: [常量类]
* @author wanji
* @version 1.0
* Created on 2019/4/16 15:07
*/
public
class
Const
{
/**
* UTC 城市交通信号控制系统简称
*/
public
static
final
String
SYSTEM_TYPE
=
"UTC"
;
/**
* 未删除
*/
public
static
final
Boolean
IS_DELETE_NO
=
false
;
/**
* 已删除
*/
public
static
final
Boolean
IS_DELETE_YES
=
true
;
/**
* 失败-false
*/
public
static
final
int
FALSE
=
0
;
/**
* 成功-true
*/
public
static
final
int
TRUE
=
1
;
/**
* 不下发
*/
public
static
final
String
NOT_SEND
=
"2"
;
/**
* 全部:-1
*/
public
static
final
Integer
ALL
=
-
1
;
/**
* 分隔符:逗号
**/
public
static
final
String
SEPARATOR_COMMA
=
","
;
/**
* 分隔符:冒号
**/
public
static
final
String
SEPARATOR_COLON
=
":"
;
/**
* 分隔符:减号
**/
public
static
final
String
SEPARATOR_MINUS
=
"-"
;
/**
* 分隔符:下划线
**/
public
static
final
String
SEPARATOR_UNDER_LINE
=
"_"
;
/**
* 下划线,作为查询条件时,将"_"转化为"\_"
*/
public
static
final
String
TRANS_UNDERLINE
=
"\\\\_"
;
/**
* 分隔符:空格
**/
public
static
final
String
SEPARATOR_SPACE
=
" "
;
/**
* 分隔符:分号
**/
public
static
final
String
SEPARATOR_SEMICOLON
=
";"
;
/**
* 分隔符:@
*/
public
static
final
String
SEPARATOR_AT
=
"@"
;
/**
* 分隔符:左括号
*/
public
static
final
String
SEPARATOR_LEFTBRACES
=
"("
;
/**
* 分隔符:右括号
*/
public
static
final
String
SEPARATOR_RIGHTBRACES
=
")"
;
/**
* 分隔符:大于号 >
*/
public
static
final
String
SEPARATOR_GREATER_THAN
=
">"
;
/**
* webSocket topic 信号机状态分组
*/
public
static
final
String
WEBSOCKET_TOPIC_SIGNAL_STATE
=
"topic_signal_state"
;
/**
* webSocket topic 下发结果状态分组
*/
public
static
final
String
WEBSOCKET_TOPIC_PLAN_ISSUED
=
"topic_plan_issued"
;
/**
* 海康返回成功码
*/
public
static
final
Integer
HK_TRUE_CODE
=
0
;
/**
* 海康返回成功码的 key
*/
public
static
final
String
HK_KEY_CODE
=
"code"
;
}
signal-control-service/src/main/java/net/wanji/web/common/constant/Constant.java
0 → 100644
View file @
27714f6c
package
net
.
wanji
.
web
.
common
.
constant
;
/**
* @author duanruiming
* @date 2023/01/16 10:45
*/
public
class
Constant
{
/**
* Redis存储Key前缀
*/
public
static
final
String
KEY_PREFIX
=
"utcsystem_"
;
/**
* 分隔符:减号
**/
public
static
final
String
SEPARATOR_MINUS
=
"-"
;
}
signal-control-service/src/main/java/net/wanji/web/common/util/RedisUtils.java
View file @
27714f6c
package
net
.
wanji
.
web
.
common
.
util
;
import
net.wanji.web.common.constant.Const
;
import
net.wanji.web.common.constant.RedisKeyConst
;
import
net.wanji.web.common.constant.Constant
;
import
net.wanji.web.common.util.date.DateStyle
;
import
net.wanji.web.common.util.date.DateUtils
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -265,7 +264,7 @@ public class RedisUtils {
*/
public
String
getVersion
(
String
type
)
{
String
formatDate
=
DateUtils
.
dateToString
(
new
Date
(),
DateStyle
.
YYYYMMDD
);
String
key
=
RedisKeyCons
t
.
KEY_PREFIX
+
type
+
formatDate
;
String
key
=
Constan
t
.
KEY_PREFIX
+
type
+
formatDate
;
//当前时间到第二天还剩多少时间
Date
newDate
=
DateUtils
.
dateForMat
(
DateUtils
.
addDay
(
new
Date
(),
1
),
DateStyle
.
YYYY_MM_DD
);
int
liveTime
=
DateUtils
.
dayDiff
(
newDate
,
new
Date
(),
Calendar
.
MILLISECOND
);
...
...
@@ -275,7 +274,7 @@ public class RedisUtils {
incr
=
getIncr
(
key
,
liveTime
);
//从001开始
}
DecimalFormat
df
=
new
DecimalFormat
(
"000"
);
//三位序列号
return
formatDate
+
Const
.
SEPARATOR_MINUS
+
df
.
format
(
incr
);
return
formatDate
+
Const
ant
.
SEPARATOR_MINUS
+
df
.
format
(
incr
);
}
/**
...
...
signal-control-service/src/main/java/net/wanji/web/controller/SignalEvaluateController.java
View file @
27714f6c
...
...
@@ -3,6 +3,8 @@ package net.wanji.web.controller;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
net.wanji.feign.pojo.entity.JsonViewObject
;
import
net.wanji.web.common.util.date.DateStyle
;
import
net.wanji.web.common.util.date.DateUtils
;
import
net.wanji.web.service.SignalEvaluateService
;
import
net.wanji.web.vo.signalEvaluate.FlowQueueInVO
;
import
net.wanji.web.vo.signalEvaluate.FlowQueueOutVO
;
...
...
@@ -14,7 +16,6 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.ws.rs.core.MediaType
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
...
...
@@ -30,9 +31,6 @@ public class SignalEvaluateController extends BaseController{
@Autowired
SignalEvaluateService
signalEvaluateService
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
@ApiOperation
(
value
=
"流量、排队折线图"
,
notes
=
"流量、排队折线图"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/flowQueue"
,
...
...
@@ -41,7 +39,7 @@ public class SignalEvaluateController extends BaseController{
String
adCode
=
flowQueueInVO
.
getAdCode
();
String
crossId
=
flowQueueInVO
.
getCrossId
();
String
currentTimeStr
=
flowQueueInVO
.
getCurrentTime
();
Date
currentTime
=
sdf
.
parse
(
currentTimeStr
);
Date
currentTime
=
DateUtils
.
getDateFormat
(
DateStyle
.
YYYY_MM_DD_HH_MM_SS
.
getValue
())
.
parse
(
currentTimeStr
);
Integer
timeType
=
flowQueueInVO
.
getTimeType
();
Integer
dataType
=
flowQueueInVO
.
getDataType
();
FlowQueueOutVO
flowQueueOutVO
=
signalEvaluateService
.
flowQueue
(
adCode
,
crossId
,
currentTime
,
timeType
,
dataType
);
...
...
signal-control-service/src/main/java/net/wanji/web/controller/SignalServiceController.java
View file @
27714f6c
...
...
@@ -4,7 +4,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
net.wanji.feign.pojo.
result.Resul
t
;
import
net.wanji.feign.pojo.
entity.JsonViewObjec
t
;
import
net.wanji.feign.pojo.vo.*
;
import
net.wanji.feign.service.UtcFeignClients
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -29,62 +29,62 @@ public class SignalServiceController {
@ApiOperation
(
value
=
"信号机方案下发-基础方案下发"
,
notes
=
"信号机方案下发-基础方案下发"
)
@PostMapping
(
"/schemeSend"
)
public
<
T
>
Result
<
T
>
schemeSend
(
@RequestBody
SchemeSendVO
schemeSendVO
)
{
Result
resul
t
=
utcFeignClients
.
schemeSend
(
schemeSendVO
);
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"信号机方案下发-基础方案下发UTC服务调用异常"
);
public
JsonViewObject
schemeSend
(
@RequestBody
SchemeSendVO
schemeSendVO
)
{
JsonViewObject
jsonViewObjec
t
=
utcFeignClients
.
schemeSend
(
schemeSendVO
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"信号机方案下发-基础方案下发UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
);
return
jsonViewObject
.
success
(
);
}
@ApiOperation
(
value
=
"计划下发-计划信息、时段信息"
,
notes
=
"计划下发-计划信息、时段信息"
)
@PostMapping
(
"/planSend"
)
public
<
T
>
Result
<
T
>
planSend
(
@RequestBody
PlanSendVO
planSendVO
)
throws
Exception
{
Result
resul
t
=
utcFeignClients
.
planSend
(
planSendVO
);
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"计划下发-计划信息、时段信息UTC服务调用异常"
);
public
JsonViewObject
planSend
(
@RequestBody
PlanSendVO
planSendVO
)
throws
Exception
{
JsonViewObject
jsonViewObjec
t
=
utcFeignClients
.
planSend
(
planSendVO
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"计划下发-计划信息、时段信息UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
)
;
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"时间表下发-时间表信息"
,
notes
=
"时间表下发-时间表信息"
)
@PostMapping
(
"/scheduleSend"
)
public
<
T
>
Result
<
T
>
scheduleSend
(
@RequestBody
ScheduleSendVO
scheduleSendVO
)
throws
Exception
{
Result
resul
t
=
utcFeignClients
.
scheduleSend
(
scheduleSendVO
);
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"时间表下发-时间表信息UTC服务调用异常"
);
public
JsonViewObject
scheduleSend
(
@RequestBody
ScheduleSendVO
scheduleSendVO
)
throws
Exception
{
JsonViewObject
jsonViewObjec
t
=
utcFeignClients
.
scheduleSend
(
scheduleSendVO
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"时间表下发-时间表信息UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
)
;
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"相位配时下发-(下发相位参数)"
,
notes
=
"相位配时下发-(下发相位参数)"
)
@PostMapping
(
"/phaseTimingSend"
)
public
<
T
>
Result
<
T
>
phaseTimingSend
(
@RequestBody
PhaseTimingSendVO
phaseTimingSendVO
)
throws
Exception
{
Result
resul
t
=
utcFeignClients
.
phaseTimingSend
(
phaseTimingSendVO
);
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"相位配时下发-(下发相位参数)UTC服务调用异常"
);
public
JsonViewObject
phaseTimingSend
(
@RequestBody
PhaseTimingSendVO
phaseTimingSendVO
)
throws
Exception
{
JsonViewObject
jsonViewObjec
t
=
utcFeignClients
.
phaseTimingSend
(
phaseTimingSendVO
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"相位配时下发-(下发相位参数)UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
)
;
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"灯态控制-路口全红/黄闪/关灯控制/恢复"
,
notes
=
"灯态控制-路口全红/黄闪/关灯控制/恢复"
)
@PostMapping
(
"/lampStateControl"
)
public
<
T
>
Result
<
T
>
allRedControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
public
JsonViewObject
allRedControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
Integer
controlType
=
commandVO
.
getControlType
();
Result
result
=
new
Result
();
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
if
(
1
==
controlType
)
{
resul
t
=
utcFeignClients
.
allRedControl
(
commandVO
);
jsonViewObjec
t
=
utcFeignClients
.
allRedControl
(
commandVO
);
}
if
(
2
==
controlType
)
{
resul
t
=
utcFeignClients
.
yellowLightControl
(
commandVO
);
jsonViewObjec
t
=
utcFeignClients
.
yellowLightControl
(
commandVO
);
}
if
(
3
==
controlType
)
{
resul
t
=
utcFeignClients
.
closeLightControl
(
commandVO
);
jsonViewObjec
t
=
utcFeignClients
.
closeLightControl
(
commandVO
);
}
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"灯态控制UTC服务调用异常"
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"灯态控制UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
)
;
return
jsonViewObject
;
}
...
...
@@ -94,44 +94,44 @@ public class SignalServiceController {
@ApiImplicitParam
(
name
=
"stepNum"
,
value
=
"0 顺序步进 n 跳过n个相位"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
),
})
@PostMapping
(
"/stepControl"
)
public
<
T
>
Result
<
T
>
stepControl
(
@RequestParam
String
code
,
@RequestParam
Integer
command
,
@RequestParam
int
stepNum
)
throws
Exception
{
Result
resul
t
=
utcFeignClients
.
stepControl
(
code
,
command
,
stepNum
);
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"步进控制-步进控制/恢复UTC服务调用异常"
);
public
JsonViewObject
stepControl
(
@RequestParam
String
code
,
@RequestParam
Integer
command
,
@RequestParam
int
stepNum
)
throws
Exception
{
JsonViewObject
jsonViewObjec
t
=
utcFeignClients
.
stepControl
(
code
,
command
,
stepNum
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"步进控制-步进控制/恢复UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
)
;
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"恢复时间表-恢复路口时间表执行"
,
notes
=
"恢复时间表-恢复路口时间表执行"
)
@PostMapping
(
"/recoverSchedule"
)
public
<
T
>
Result
<
T
>
recoverSchedule
(
@RequestParam
String
code
)
throws
Exception
{
Result
resul
t
=
utcFeignClients
.
recoverSchedule
(
code
);
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"恢复时间表-恢复路口时间表执行UTC服务调用异常"
);
public
JsonViewObject
recoverSchedule
(
@RequestParam
String
code
)
throws
Exception
{
JsonViewObject
jsonViewObjec
t
=
utcFeignClients
.
recoverSchedule
(
code
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"恢复时间表-恢复路口时间表执行UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
)
;
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"锁定控制-相位锁定/解锁"
,
notes
=
"锁定控制-相位锁定/解锁"
)
@PostMapping
(
"/lockControl"
)
public
<
T
>
Result
<
T
>
lockControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
Result
resul
t
=
utcFeignClients
.
lockControl
(
commandVO
);
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"锁定控制-相位锁定/解锁UTC服务调用异常"
);
public
JsonViewObject
lockControl
(
@RequestBody
@Validated
ControlCommandVO
commandVO
)
throws
Exception
{
JsonViewObject
jsonViewObjec
t
=
utcFeignClients
.
lockControl
(
commandVO
);
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"锁定控制-相位锁定/解锁UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
)
;
return
jsonViewObject
;
}
@ApiOperation
(
value
=
"相位差下发"
,
notes
=
"相位差下发"
)
@PostMapping
(
"/phaseDiffSend"
)
public
<
T
>
Result
<
T
>
phaseDiffSend
(
HttpServletRequest
httpServletRequest
)
{
Result
resul
t
=
utcFeignClients
.
phaseDiffSend
();
if
(
Objects
.
isNull
(
result
)
||
result
.
getStat
e
()
!=
200
)
{
return
Result
.
error
(
result
.
getState
(),
"相位差下发UTC服务调用异常"
);
public
JsonViewObject
phaseDiffSend
(
HttpServletRequest
httpServletRequest
)
{
JsonViewObject
jsonViewObjec
t
=
utcFeignClients
.
phaseDiffSend
();
if
(
Objects
.
isNull
(
jsonViewObject
)
||
jsonViewObject
.
getCod
e
()
!=
200
)
{
return
jsonViewObject
.
fail
(
"相位差下发UTC服务调用异常"
);
}
return
Result
.
success
(
"success"
)
;
return
jsonViewObject
;
}
}
signal-control-service/src/main/java/net/wanji/web/controller/TBaseCrossInfoController.java
View file @
27714f6c
...
...
@@ -3,10 +3,7 @@ package net.wanji.web.controller;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
net.wanji.feign.pojo.result.Result
;
import
net.wanji.web.po.AreaTreePO
;
import
net.wanji.web.po.CrossInfoPO
;
import
net.wanji.web.po.PageResultPO
;
import
net.wanji.feign.pojo.entity.JsonViewObject
;
import
net.wanji.web.service.TBaseCrossInfoService
;
import
net.wanji.web.vo.BaseCrossInfoVO
;
import
net.wanji.web.vo.CrossInfoVO
;
...
...
@@ -34,31 +31,31 @@ public class TBaseCrossInfoController {
@ApiOperation
(
value
=
"路网管理-路口管理-查询"
,
notes
=
"路网管理-路口管理-查询"
)
@PostMapping
(
"/list"
)
public
Result
<
PageResultPO
<
CrossInfoPO
>>
list
(
@RequestBody
@Validated
CrossInfoVO
crossInfoVO
)
{
public
JsonViewObject
list
(
@RequestBody
@Validated
CrossInfoVO
crossInfoVO
)
{
return
crossInfoService
.
selectAll
(
crossInfoVO
);
}
@ApiOperation
(
value
=
"路网管理-路口管理-修改"
,
notes
=
"路网管理-路口管理-修改"
)
@PostMapping
(
"/updateOne"
)
public
Result
<
String
>
updateOne
(
@RequestBody
@Validated
(
BaseCrossInfoVO
.
Update
.
class
)
BaseCrossInfoVO
crossInfoPO
)
{
public
JsonViewObject
updateOne
(
@RequestBody
@Validated
(
BaseCrossInfoVO
.
Update
.
class
)
BaseCrossInfoVO
crossInfoPO
)
{
return
crossInfoService
.
updateOne
(
crossInfoPO
);
}
@ApiOperation
(
value
=
"路网管理-路口管理-批量删除"
,
notes
=
"路网管理-路口管理-批量删除"
)
@PostMapping
(
"/delete"
)
public
Result
<
String
>
delete
(
@RequestBody
List
<
String
>
ids
)
{
public
JsonViewObject
delete
(
@RequestBody
List
<
String
>
ids
)
{
return
crossInfoService
.
delete
(
ids
);
}
@ApiOperation
(
value
=
"路网管理-路口管理-增加"
,
notes
=
"路网管理-路口管理-增加"
)
@PostMapping
(
"/addOne"
)
public
Result
<
String
>
addOne
(
@RequestBody
@Validated
(
BaseCrossInfoVO
.
Save
.
class
)
BaseCrossInfoVO
crossInfoPO
)
{
public
JsonViewObject
addOne
(
@RequestBody
@Validated
(
BaseCrossInfoVO
.
Save
.
class
)
BaseCrossInfoVO
crossInfoPO
)
{
return
crossInfoService
.
addOne
(
crossInfoPO
);
}
@ApiOperation
(
value
=
"路网管理-路口管理-区域名称下拉框"
,
notes
=
"路网管理-路口管理-区域名称下拉框"
)
@GetMapping
(
"/areaTree"
)
public
Result
<
List
<
AreaTreePO
>>
areaTree
()
{
public
JsonViewObject
areaTree
()
{
return
crossInfoService
.
areaTree
();
}
...
...
signal-control-service/src/main/java/net/wanji/web/handler/GlobalExceptionHandler.java
View file @
27714f6c
...
...
@@ -2,7 +2,7 @@ package net.wanji.web.handler;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.feign.feignEnum.ResultEnum
;
import
net.wanji.feign.pojo.
result.Resul
t
;
import
net.wanji.feign.pojo.
entity.JsonViewObjec
t
;
import
net.wanji.web.exception.CrossException
;
import
org.springframework.validation.FieldError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
...
...
@@ -23,40 +23,40 @@ public class GlobalExceptionHandler {
* 处理自定义的业务异常
*/
@ExceptionHandler
(
value
=
CrossException
.
class
)
public
Result
<
String
>
exceptionHandler
(
HttpServletRequest
req
,
CrossException
e
)
{
public
JsonViewObject
exceptionHandler
(
HttpServletRequest
req
,
CrossException
e
)
{
log
.
error
(
"发生业务异常!原因是:{}"
,
e
.
getErrorMsg
());
return
Result
.
error
(
e
.
getErrorCode
(),
e
.
getErrorMsg
());
return
JsonViewObject
.
newInstance
().
fail
(
"发生业务异常!原因是:{}"
+
e
.
getErrorMsg
());
}
/**
* 处理空指针的异常
*/
@ExceptionHandler
(
value
=
NullPointerException
.
class
)
public
Result
<
String
>
exceptionHandler
(
HttpServletRequest
req
,
NullPointerException
e
)
{
public
JsonViewObject
exceptionHandler
(
HttpServletRequest
req
,
NullPointerException
e
)
{
String
errorMessage
=
e
.
getCause
().
getMessage
();
log
.
error
(
"发生空指针异常!原因是:{}"
,
errorMessage
);
return
Result
.
error
(
ResultEnum
.
INTERNAL_SERVER_ERROR
.
getResultCode
(),
"发生空指针异常!原因是:"
+
errorMessage
);
return
JsonViewObject
.
newInstance
().
fail
(
"发生空指针异常!原因是:"
+
errorMessage
);
}
/**
* 参数异常
*/
@ExceptionHandler
(
value
=
MethodArgumentNotValidException
.
class
)
public
Result
<
String
>
exceptionHandler
(
HttpServletRequest
req
,
MethodArgumentNotValidException
e
)
{
public
JsonViewObject
exceptionHandler
(
HttpServletRequest
req
,
MethodArgumentNotValidException
e
)
{
FieldError
fieldError
=
e
.
getBindingResult
().
getFieldError
();
String
errorMessage
=
ResultEnum
.
INTERNAL_SERVER_ERROR
.
getResultMsg
();
if
(
fieldError
!=
null
)
{
errorMessage
=
fieldError
.
getDefaultMessage
();
}
log
.
error
(
"发生参数异常!原因是:{}"
,
errorMessage
);
return
Result
.
error
(
ResultEnum
.
INTERNAL_SERVER_ERROR
.
getResultCode
(),
"发生参数异常!原因是:"
+
errorMessage
);
return
JsonViewObject
.
newInstance
().
fail
(
"发生参数异常!原因是:"
+
errorMessage
);
}
/**
* 处理其他异常
*/
@ExceptionHandler
(
value
=
Exception
.
class
)
public
Result
<
String
>
exceptionHandler
(
HttpServletRequest
req
,
Exception
e
)
{
public
JsonViewObject
exceptionHandler
(
HttpServletRequest
req
,
Exception
e
)
{
Throwable
cause
=
e
.
getCause
();
String
errorMessage
;
if
(
cause
!=
null
)
{
...
...
@@ -65,6 +65,6 @@ public class GlobalExceptionHandler {
errorMessage
=
e
.
getMessage
();
}
log
.
error
(
"未知异常!原因是:{}"
,
errorMessage
);
return
Result
.
error
(
ResultEnum
.
INTERNAL_SERVER_ERROR
.
getResultCode
(),
"未知异常!原因是:"
+
errorMessage
);
return
JsonViewObject
.
newInstance
().
fail
(
"未知异常!原因是:"
+
errorMessage
);
}
}
signal-control-service/src/main/java/net/wanji/web/service/TBaseCrossInfoService.java
View file @
27714f6c
package
net
.
wanji
.
web
.
service
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
net.wanji.feign.pojo.result.Result
;
import
net.wanji.feign.pojo.entity.JsonViewObject
;
import
net.wanji.web.common.enums.CrossTypeEnum
;
import
net.wanji.web.entity.TBaseAreaInfo
;
import
net.wanji.web.entity.TBaseCrossInfo
;
...
...
@@ -35,7 +33,7 @@ import java.util.stream.Collectors;
* @since 2022-11-28
*/
@Service
public
class
TBaseCrossInfoService
extends
ServiceImpl
<
TBaseCrossInfoMapper
,
TBaseCrossInfo
>
implements
IService
<
TBaseCrossInfo
>
{
public
class
TBaseCrossInfoService
{
@Autowired
private
TBaseCrossInfoMapper
crossInfoMapper
;
...
...
@@ -48,9 +46,8 @@ public class TBaseCrossInfoService extends ServiceImpl<TBaseCrossInfoMapper, TBa
* 查询
*
* @param crossInfoVO 查询路口管理输入参数
* @return {@link Result}<{@link PageResultPO}<{@link CrossInfoPO}>>
*/
public
Result
<
PageResultPO
<
CrossInfoPO
>>
selectAll
(
CrossInfoVO
crossInfoVO
)
{
public
JsonViewObject
selectAll
(
CrossInfoVO
crossInfoVO
)
{
PageResultPO
<
CrossInfoPO
>
page
=
new
PageResultPO
<>();
Integer
count
=
crossInfoMapper
.
countSelectAll
(
crossInfoVO
);
List
<
CrossInfoPO
>
list
=
crossInfoMapper
.
selectAll
(
crossInfoVO
);
...
...
@@ -58,46 +55,45 @@ public class TBaseCrossInfoService extends ServiceImpl<TBaseCrossInfoMapper, TBa
page
.
setPageSize
(
crossInfoVO
.
getPageSize
());
page
.
setTotal
(
count
);
page
.
setData
(
list
);
return
Result
.
success
(
page
);
return
JsonViewObject
.
newInstance
()
.
success
(
page
);
}
/**
* 添加
*
* @param crossInfoPO 增加路口管理输入参数
* @return {@link Result}<{@link String}>
*/
public
Result
<
String
>
addOne
(
BaseCrossInfoVO
crossInfoPO
)
{
public
JsonViewObject
addOne
(
BaseCrossInfoVO
crossInfoPO
)
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
().
success
();
if
(
StringUtils
.
isNoneBlank
(
crossInfoPO
.
getId
()))
{
TBaseCrossInfo
tBaseCrossInfo
=
crossInfoMapper
.
selectByPrimaryKey
(
crossInfoPO
.
getId
());
if
(
Objects
.
nonNull
(
tBaseCrossInfo
))
{
return
Result
.
error
(
"路口编号重复,请重新设置!"
);
return
jsonViewObject
.
fail
(
"路口编号重复,请重新设置!"
);
}
}
TBaseCrossInfo
record
=
getBaseCrossInfo
(
crossInfoPO
);
record
.
setGmtCreate
(
new
Date
());
int
insert
=
crossInfoMapper
.
insertSelective
(
record
);
if
(
insert
>
0
)
{
return
Resul
t
.
success
(
"添加成功"
);
return
jsonViewObjec
t
.
success
(
"添加成功"
);
}
return
Result
.
error
(
"
添加失败"
);
return
JsonViewObject
.
newInstance
().
fail
(
"路口
添加失败"
);
}
/**
* 更新
*
* @param crossInfoPO 修改路口管理输入参数
* @return {@link Result}<{@link String}>
*/
public
Result
<
String
>
updateOne
(
BaseCrossInfoVO
crossInfoPO
)
{
public
JsonViewObject
updateOne
(
BaseCrossInfoVO
crossInfoPO
)
{
TBaseCrossInfo
record
=
new
TBaseCrossInfo
();
BeanUtils
.
copyProperties
(
crossInfoPO
,
record
);
record
.
setGmtModified
(
new
Date
());
int
update
=
crossInfoMapper
.
updateByPrimaryKeySelective
(
record
);
if
(
update
>
0
)
{
return
Result
.
success
(
"修改成功"
);
return
JsonViewObject
.
newInstance
()
.
success
(
"修改成功"
);
}
return
Result
.
error
(
"修改失败"
);
return
JsonViewObject
.
newInstance
().
fail
(
"修改失败"
);
}
private
TBaseCrossInfo
getBaseCrossInfo
(
BaseCrossInfoVO
crossInfoPO
)
{
...
...
@@ -150,20 +146,18 @@ public class TBaseCrossInfoService extends ServiceImpl<TBaseCrossInfoMapper, TBa
* 删除
*
* @param ids id集合
* @return {@link Result}<{@link String}>
*/
public
Result
<
String
>
delete
(
List
<
String
>
ids
)
{
public
JsonViewObject
delete
(
List
<
String
>
ids
)
{
crossInfoMapper
.
deleteBatchIds
(
ids
);
return
Result
.
success
(
"删除成功"
);
return
JsonViewObject
.
newInstance
()
.
success
(
"删除成功"
);
}
/**
* 区域名称下拉框
*
* @return {@link Result}<{@link AreaTreePO}>
*/
public
Result
<
List
<
AreaTreePO
>>
areaTree
()
{
public
JsonViewObject
areaTree
()
{
List
<
AreaTreePO
>
infos
=
areaInfoMapper
.
selectAreaTree
();
// 构建树
Map
<
Integer
,
List
<
AreaTreePO
>>
parentCodeMap
=
infos
.
stream
().
collect
(
Collectors
.
groupingBy
(
AreaTreePO:
:
getParentCode
));
...
...
@@ -176,6 +170,6 @@ public class TBaseCrossInfoService extends ServiceImpl<TBaseCrossInfoMapper, TBa
}
}
infos
=
infos
.
stream
().
filter
(
po
->
po
.
getParentCode
()
!=
null
).
collect
(
Collectors
.
toList
());
return
Result
.
success
(
infos
);
return
JsonViewObject
.
newInstance
()
.
success
(
infos
);
}
}
signal-control-service/src/main/java/net/wanji/web/service/scheme/impl/SchemeConfigServiceImpl.java
View file @
27714f6c
...
...
@@ -6,35 +6,15 @@ import net.wanji.web.dto.CrossIdDTO;
import
net.wanji.web.dto.LaneIdDTO
;
import
net.wanji.web.dto.LightIdDTO
;
import
net.wanji.web.dto.SaveSchemeConfigDTO
;
import
net.wanji.web.mapper.scheme.CrossAccompanyPhaseMapper
;
import
net.wanji.web.mapper.scheme.CrossLaneLightsMapper
;
import
net.wanji.web.mapper.scheme.CrossLightsMapper
;
import
net.wanji.web.mapper.scheme.CrossPhaseLightsMapper
;
import
net.wanji.web.mapper.scheme.CrossPhaseMapper
;
import
net.wanji.web.mapper.scheme.CrossSchemeMapper
;
import
net.wanji.web.mapper.scheme.LaneInfoMapper
;
import
net.wanji.web.po.scheme.CrossAccompanyPhasePO
;
import
net.wanji.web.po.scheme.CrossLaneLightsPO
;
import
net.wanji.web.po.scheme.CrossLightsPO
;
import
net.wanji.web.po.scheme.CrossPhaseLightsPO
;
import
net.wanji.web.po.scheme.CrossPhasePO
;
import
net.wanji.web.po.scheme.CrossSchemePO
;
import
net.wanji.web.po.scheme.LaneInfoPO
;
import
net.wanji.web.mapper.scheme.*
;
import
net.wanji.web.po.scheme.*
;
import
net.wanji.web.service.scheme.SchemeConfigService
;
import
net.wanji.web.vo.scheme.LaneIdsVO
;
import
net.wanji.web.vo.scheme.LightIdVO
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.TreeSet
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
signal-feign-service/src/main/java/net/wanji/feign/pojo/result/Result.java
deleted
100644 → 0
View file @
2ddb2e49
package
net
.
wanji
.
feign
.
pojo
.
result
;
import
net.wanji.feign.feignEnum.ResultEnum
;
import
java.io.Serializable
;
/**
* @author wuxiaokai
* @date 2022/11/15 13:13:36
*/
public
class
Result
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8491397399858539755L
;
private
Integer
state
;
private
String
message
;
private
T
content
;
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
T
getContent
()
{
return
content
;
}
public
void
setContent
(
T
content
)
{
this
.
content
=
content
;
}
public
Result
()
{
}
public
Result
(
Integer
state
,
String
message
,
T
content
)
{
this
.
state
=
state
;
this
.
message
=
message
;
this
.
content
=
content
;
}
public
static
<
T
>
Result
<
T
>
response
(
Integer
state
,
String
message
)
{
return
response
(
state
,
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
response
(
Integer
state
,
String
message
,
T
content
)
{
return
new
Result
<>(
state
,
message
,
content
);
}
public
static
<
T
>
Result
<
T
>
success
()
{
return
Result
.
response
(
ResultEnum
.
SUCCESS
.
getResultCode
(),
ResultEnum
.
SUCCESS
.
getResultMsg
(),
null
);
}
public
static
<
T
>
Result
<
T
>
success
(
String
message
)
{
return
Result
.
response
(
ResultEnum
.
SUCCESS
.
getResultCode
(),
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
success
(
T
content
)
{
return
Result
.
response
(
ResultEnum
.
SUCCESS
.
getResultCode
(),
ResultEnum
.
SUCCESS
.
getResultMsg
(),
content
);
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
state
,
String
message
,
T
content
)
{
return
Result
.
response
(
state
,
message
,
content
);
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
state
,
String
message
)
{
return
Result
.
response
(
state
,
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
error
(
Integer
state
)
{
return
Result
.
response
(
state
,
ResultEnum
.
INTERNAL_SERVER_ERROR
.
getResultMsg
(),
null
);
}
public
static
<
T
>
Result
<
T
>
error
()
{
return
error
(
ResultEnum
.
INTERNAL_SERVER_ERROR
);
}
public
static
<
T
>
Result
<
T
>
error
(
ResultEnum
resultEnum
,
String
message
)
{
return
Result
.
response
(
resultEnum
.
getResultCode
(),
message
,
null
);
}
public
static
<
T
>
Result
<
T
>
error
(
ResultEnum
resultEnum
)
{
return
Result
.
response
(
resultEnum
.
getResultCode
(),
resultEnum
.
getResultMsg
(),
null
);
}
public
static
<
T
>
Result
<
T
>
error
(
String
message
)
{
return
Result
.
response
(
ResultEnum
.
INTERNAL_SERVER_ERROR
.
getResultCode
(),
message
,
null
);
}
}
signal-feign-service/src/main/java/net/wanji/feign/service/UtcFeignClients.java
View file @
27714f6c
package
net
.
wanji
.
feign
.
service
;
import
net.wanji.feign.pojo.entity.JsonViewObject
;
import
net.wanji.feign.pojo.result.Result
;
import
net.wanji.feign.pojo.vo.*
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -19,35 +18,35 @@ public interface UtcFeignClients {
JsonViewObject
runningStatusAlarm
();
@PostMapping
(
"/controlCommand/schemeSend"
)
Resul
t
schemeSend
(
@RequestBody
SchemeSendVO
schemeSendVO
);
JsonViewObjec
t
schemeSend
(
@RequestBody
SchemeSendVO
schemeSendVO
);
@PostMapping
(
"/controlCommand/planSend"
)
Resul
t
planSend
(
@RequestBody
PlanSendVO
planSendVO
);
JsonViewObjec
t
planSend
(
@RequestBody
PlanSendVO
planSendVO
);
@PostMapping
(
"/controlCommand/scheduleSend"
)
Resul
t
scheduleSend
(
@RequestBody
ScheduleSendVO
scheduleSendVO
);
JsonViewObjec
t
scheduleSend
(
@RequestBody
ScheduleSendVO
scheduleSendVO
);
@PostMapping
(
"/controlCommand/phaseTimingSend"
)
Resul
t
phaseTimingSend
(
@RequestBody
PhaseTimingSendVO
phaseTimingSendVO
);
JsonViewObjec
t
phaseTimingSend
(
@RequestBody
PhaseTimingSendVO
phaseTimingSendVO
);
@PostMapping
(
"/controlCommand/allRedControl"
)
Resul
t
allRedControl
(
@RequestBody
ControlCommandVO
commandVO
);
JsonViewObjec
t
allRedControl
(
@RequestBody
ControlCommandVO
commandVO
);
@PostMapping
(
"/controlCommand/yellowLightControl"
)
Resul
t
yellowLightControl
(
@RequestBody
ControlCommandVO
commandVO
);
JsonViewObjec
t
yellowLightControl
(
@RequestBody
ControlCommandVO
commandVO
);
@PostMapping
(
"/controlCommand/closeLightControl"
)
Resul
t
closeLightControl
(
@RequestBody
ControlCommandVO
commandVO
);
JsonViewObjec
t
closeLightControl
(
@RequestBody
ControlCommandVO
commandVO
);
@PostMapping
(
"/controlCommand/stepControl"
)
Resul
t
stepControl
(
@RequestParam
String
code
,
@RequestParam
Integer
command
,
@RequestParam
int
stepNum
);
JsonViewObjec
t
stepControl
(
@RequestParam
String
code
,
@RequestParam
Integer
command
,
@RequestParam
int
stepNum
);
@PostMapping
(
"/controlCommand/recoverSchedule"
)
Resul
t
recoverSchedule
(
@RequestParam
String
code
);
JsonViewObjec
t
recoverSchedule
(
@RequestParam
String
code
);
@PostMapping
(
"/controlCommand/lockControl"
)
Resul
t
lockControl
(
@RequestBody
ControlCommandVO
commandVO
);
JsonViewObjec
t
lockControl
(
@RequestBody
ControlCommandVO
commandVO
);
@PostMapping
(
"/controlCommand/phaseDiffSend"
)
Resul
t
phaseDiffSend
();
JsonViewObjec
t
phaseDiffSend
();
}
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