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
c2e56970
Commit
c2e56970
authored
Jan 28, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方案管理-运行计划,全局异常处理
parent
85fecf73
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
211 additions
and
1 deletion
+211
-1
SignalGlobalExceptionHandler.java
...ji/web/common/exception/SignalGlobalExceptionHandler.java
+6
-0
WeekException.java
...in/java/net/wanji/web/common/exception/WeekException.java
+19
-0
RunningPlanController.java
...et/wanji/web/controller/scheme/RunningPlanController.java
+62
-0
RunningPlanDTO.java
...rvice/src/main/java/net/wanji/web/dto/RunningPlanDTO.java
+73
-0
CrossSchedulesPlanPO.java
...in/java/net/wanji/web/po/scheme/CrossSchedulesPlanPO.java
+1
-1
RunningPlanService.java
...java/net/wanji/web/service/scheme/RunningPlanService.java
+11
-0
RunningPlanServiceImpl.java
...wanji/web/service/scheme/impl/RunningPlanServiceImpl.java
+39
-0
No files found.
signal-control-service/src/main/java/net/wanji/web/common/exception/SignalGlobalExceptionHandler.java
View file @
c2e56970
...
@@ -29,4 +29,10 @@ public class SignalGlobalExceptionHandler {
...
@@ -29,4 +29,10 @@ public class SignalGlobalExceptionHandler {
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
fail
(
e
);
return
jsonViewObject
.
fail
(
e
);
}
}
@ExceptionHandler
(
value
=
WeekException
.
class
)
public
JsonViewObject
weekExceptionHandler
(
WeekException
e
)
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
fail
(
e
);
}
}
}
\ No newline at end of file
signal-control-service/src/main/java/net/wanji/web/common/exception/WeekException.java
0 → 100644
View file @
c2e56970
package
net
.
wanji
.
web
.
common
.
exception
;
/**
* 路段关系异常
*
* @author Kent HAN
* @date 2022/11/10 9:09
*/
public
class
WeekException
extends
RuntimeException
{
public
WeekException
(
String
message
)
{
super
(
message
);
}
public
WeekException
(
String
message
,
Exception
e
)
{
super
(
message
,
e
);
}
}
signal-control-service/src/main/java/net/wanji/web/controller/scheme/RunningPlanController.java
0 → 100644
View file @
c2e56970
package
net
.
wanji
.
web
.
controller
.
scheme
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
net.wanji.feign.pojo.result.JsonViewObject
;
import
net.wanji.web.dto.RunningPlanDTO
;
import
net.wanji.web.service.scheme.impl.RunningPlanServiceImpl
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.ws.rs.core.MediaType
;
/**
* 方案管理-运行计划
*
* @author Kent HAN
* @date 2022/12/20 10:14
*/
@Api
(
value
=
"RunningPlanController"
,
description
=
"方案管理-运行计划"
)
@RequestMapping
(
"/runningPlan"
)
@RestController
public
class
RunningPlanController
{
private
final
RunningPlanServiceImpl
runningPlanService
;
public
RunningPlanController
(
RunningPlanServiceImpl
runningPlanService
)
{
this
.
runningPlanService
=
runningPlanService
;
}
@ApiOperation
(
value
=
"保存运行计划"
,
notes
=
"保存运行计划"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/saveRunningPlan"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
JsonViewObject
.
class
),
})
public
JsonViewObject
saveRunningPlan
(
@RequestBody
RunningPlanDTO
runningPlanDTO
)
{
runningPlanService
.
saveRunningPlan
(
runningPlanDTO
);
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
return
jsonViewObject
.
success
();
}
//
// @ApiOperation(value = "渠化配置/灯组设置、车道配置列表", notes = "渠化配置/灯组设置、车道配置列表", response = JsonViewObject.class,
// produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
// @PostMapping(value = "/listLaneInfo",
// produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
// @ApiResponses({
// @ApiResponse(code = 200, message = "OK", response = SaveLaneInfoDTO.class),
// })
// public JsonViewObject listLaneInfo(@RequestBody CrossIdDTO crossIdDTO) {
// SaveLaneInfoDTO saveLaneInfoDTO = crossConfigService.listLaneInfo(crossIdDTO);
// JsonViewObject jsonViewObject = JsonViewObject.newInstance();
//
// return jsonViewObject.success(saveLaneInfoDTO);
// }
}
signal-control-service/src/main/java/net/wanji/web/dto/RunningPlanDTO.java
0 → 100644
View file @
c2e56970
package
net
.
wanji
.
web
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
import
java.util.List
;
/**
* 运行计划DTO
*
* @author Kent HAN
* @date 2023/1/28 16:11
*/
@NoArgsConstructor
@Data
public
class
RunningPlanDTO
{
@ApiModelProperty
(
value
=
"路口ID"
,
required
=
true
)
private
String
crossId
;
@ApiModelProperty
(
value
=
"日计划列表"
,
required
=
true
)
private
List
<
DailyPlanListElement
>
dailyPlanList
;
@ApiModelProperty
(
value
=
"运行计划列表"
,
required
=
true
)
private
List
<
SchedulesPlanListElement
>
schedulesPlanList
;
@NoArgsConstructor
@Data
public
static
class
DailyPlanListElement
{
/**
* planNo : P01
* name : 计划名1
* startTime : 07:00
* endTime : 09:00
* schemeName : 方案名1
*/
@ApiModelProperty
(
value
=
"计划编号"
,
required
=
true
)
private
String
planNo
;
@ApiModelProperty
(
value
=
"日计划名"
,
required
=
true
)
private
String
name
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
true
)
private
String
startTime
;
@ApiModelProperty
(
value
=
"结束时间"
,
required
=
true
)
private
String
endTime
;
@ApiModelProperty
(
value
=
"方案名"
,
required
=
true
)
private
String
schemeName
;
}
@NoArgsConstructor
@Data
public
static
class
SchedulesPlanListElement
{
/**
* scheduleNo : S01
* name : 运行计划名1
* week : [1,2,3,4,5]
* specialDate : null
* planName : 计划名1
*/
@ApiModelProperty
(
value
=
"运行计划编号"
,
required
=
true
)
private
String
scheduleNo
;
@ApiModelProperty
(
value
=
"运行计划名"
,
required
=
true
)
private
String
name
;
@ApiModelProperty
(
value
=
"星期:1周一,2周二,3周三,4周四,5周五,6周六,7周日"
,
required
=
true
)
private
List
<
Integer
>
week
;
@ApiModelProperty
(
value
=
"特殊日期,格式 2023-01-28"
,
required
=
true
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
specialDate
;
@ApiModelProperty
(
value
=
"执行日计划名"
,
required
=
true
)
private
String
planName
;
}
}
signal-control-service/src/main/java/net/wanji/web/po/scheme/CrossSchedulesPlanPO.java
View file @
c2e56970
...
@@ -27,7 +27,7 @@ public class CrossSchedulesPlanPO {
...
@@ -27,7 +27,7 @@ public class CrossSchedulesPlanPO {
private
Integer
planId
;
private
Integer
planId
;
/** 星期:1周一,2周二,3周三,4周四,5周五,6周六,7周日,0特殊日期 */
/** 星期:1周一,2周二,3周三,4周四,5周五,6周六,7周日,0特殊日期 */
@ApiModelProperty
(
name
=
"星期:1周一,2周二,3周三,4周四,5周五,6周六,7周日,0特殊日期"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"星期:1周一,2周二,3周三,4周四,5周五,6周六,7周日,0特殊日期"
,
notes
=
""
)
private
Integer
week
;
private
Integer
week
=
0
;
/** 特殊日期 */
/** 特殊日期 */
@ApiModelProperty
(
name
=
"特殊日期"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"特殊日期"
,
notes
=
""
)
private
Date
specialDate
;
private
Date
specialDate
;
...
...
signal-control-service/src/main/java/net/wanji/web/service/scheme/RunningPlanService.java
0 → 100644
View file @
c2e56970
package
net
.
wanji
.
web
.
service
.
scheme
;
import
net.wanji.web.dto.RunningPlanDTO
;
/**
* @author Kent HAN
* @date 2023/1/28 16:41
*/
public
interface
RunningPlanService
{
void
saveRunningPlan
(
RunningPlanDTO
runningPlanDTO
);
}
signal-control-service/src/main/java/net/wanji/web/service/scheme/impl/RunningPlanServiceImpl.java
0 → 100644
View file @
c2e56970
package
net
.
wanji
.
web
.
service
.
scheme
.
impl
;
import
net.wanji.web.common.exception.WeekException
;
import
net.wanji.web.dto.RunningPlanDTO
;
import
net.wanji.web.service.scheme.RunningPlanService
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author Kent HAN
* @date 2023/1/28 16:41
*/
@Service
public
class
RunningPlanServiceImpl
implements
RunningPlanService
{
@Override
public
void
saveRunningPlan
(
RunningPlanDTO
runningPlanDTO
)
{
// 验证特殊日期
List
<
RunningPlanDTO
.
SchedulesPlanListElement
>
schedulesPlanList
=
runningPlanDTO
.
getSchedulesPlanList
();
for
(
RunningPlanDTO
.
SchedulesPlanListElement
schedulesPlan
:
schedulesPlanList
)
{
List
<
Integer
>
week
=
schedulesPlan
.
getWeek
();
Date
specialDate
=
schedulesPlan
.
getSpecialDate
();
if
(
week
!=
null
&&
week
.
size
()
>
0
&&
specialDate
!=
null
)
{
throw
new
WeekException
(
"不能同时有星期选择和日期选择"
);
}
}
// todo
// 保存计划数据
// 更新计划表获取计划ID
// 根据路口ID和方案名获取方案ID
// 更新时段表
// 保存调度数据
// 更新调度表获取调度ID
// 根据路口ID和计划名获取计划ID
// 更新调度计划关系表
}
}
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