正在显示
11 个修改的文件
包含
210 行增加
和
38 行删除
@@ -11,6 +11,8 @@ import io.swagger.annotations.ApiParam; | @@ -11,6 +11,8 @@ import io.swagger.annotations.ApiParam; | ||
11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
13 | 13 | ||
14 | +import javax.annotation.Resource; | ||
15 | + | ||
14 | /** | 16 | /** |
15 | * @author 子诚 | 17 | * @author 子诚 |
16 | * Description:公司信息 Controller | 18 | * Description:公司信息 Controller |
@@ -21,7 +23,7 @@ import org.springframework.web.bind.annotation.*; | @@ -21,7 +23,7 @@ import org.springframework.web.bind.annotation.*; | ||
21 | @RequestMapping("dispatch/companyInfo") | 23 | @RequestMapping("dispatch/companyInfo") |
22 | @RestController | 24 | @RestController |
23 | public class CompanyInfoController { | 25 | public class CompanyInfoController { |
24 | - @Autowired | 26 | + @Resource |
25 | private CompanyInfoService companyInfoService; | 27 | private CompanyInfoService companyInfoService; |
26 | 28 | ||
27 | @ApiOperation("分页查询,公司信息列表") | 29 | @ApiOperation("分页查询,公司信息列表") |
@@ -54,6 +56,12 @@ public class CompanyInfoController { | @@ -54,6 +56,12 @@ public class CompanyInfoController { | ||
54 | return result; | 56 | return result; |
55 | } | 57 | } |
56 | 58 | ||
59 | + /** | ||
60 | + * 增加公司信息. | ||
61 | + * | ||
62 | + * @param companyInfo {@link CompanyInfo} | ||
63 | + * @return | ||
64 | + */ | ||
57 | @ApiOperation("增加,公司信息") | 65 | @ApiOperation("增加,公司信息") |
58 | @PostMapping("/insertCompanyInfo") | 66 | @PostMapping("/insertCompanyInfo") |
59 | public ResultJson insertCompanyInfo(@RequestBody CompanyInfo companyInfo) { | 67 | public ResultJson insertCompanyInfo(@RequestBody CompanyInfo companyInfo) { |
@@ -69,6 +77,12 @@ public class CompanyInfoController { | @@ -69,6 +77,12 @@ public class CompanyInfoController { | ||
69 | return result; | 77 | return result; |
70 | } | 78 | } |
71 | 79 | ||
80 | + /** | ||
81 | + * 编辑公司信息 | ||
82 | + * | ||
83 | + * @param companyInfo {@link CompanyInfo} | ||
84 | + * @return | ||
85 | + */ | ||
72 | @ApiOperation("编辑,公司信息") | 86 | @ApiOperation("编辑,公司信息") |
73 | @PutMapping("/updateCompanyInfo") | 87 | @PutMapping("/updateCompanyInfo") |
74 | public ResultJson updateCompanyInfo(@RequestBody CompanyInfo companyInfo) { | 88 | public ResultJson updateCompanyInfo(@RequestBody CompanyInfo companyInfo) { |
@@ -83,6 +97,12 @@ public class CompanyInfoController { | @@ -83,6 +97,12 @@ public class CompanyInfoController { | ||
83 | return result; | 97 | return result; |
84 | } | 98 | } |
85 | 99 | ||
100 | + /** | ||
101 | + * 删除公司信息 | ||
102 | + * | ||
103 | + * @param companyInfo {@link CompanyInfo} | ||
104 | + * @return | ||
105 | + */ | ||
86 | @ApiOperation("删除,公司信息") | 106 | @ApiOperation("删除,公司信息") |
87 | @DeleteMapping("/deleteCompanyInfo") | 107 | @DeleteMapping("/deleteCompanyInfo") |
88 | public ResultJson deleteCompanyInfo(@RequestBody CompanyInfo companyInfo) { | 108 | public ResultJson deleteCompanyInfo(@RequestBody CompanyInfo companyInfo) { |
@@ -14,6 +14,7 @@ import org.apache.ibatis.annotations.Update; | @@ -14,6 +14,7 @@ import org.apache.ibatis.annotations.Update; | ||
14 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
15 | import org.springframework.web.bind.annotation.*; | 15 | import org.springframework.web.bind.annotation.*; |
16 | 16 | ||
17 | +import javax.annotation.Resource; | ||
17 | import java.util.ArrayList; | 18 | import java.util.ArrayList; |
18 | import java.util.Date; | 19 | import java.util.Date; |
19 | import java.util.List; | 20 | import java.util.List; |
@@ -31,12 +32,18 @@ import static java.util.stream.Collectors.toList; | @@ -31,12 +32,18 @@ import static java.util.stream.Collectors.toList; | ||
31 | @RestController | 32 | @RestController |
32 | public class DispatchController { | 33 | public class DispatchController { |
33 | 34 | ||
34 | - @Autowired | 35 | + @Resource |
35 | private VehicleInfoService vehicleInfoService; | 36 | private VehicleInfoService vehicleInfoService; |
36 | 37 | ||
37 | - @Autowired | 38 | + @Resource |
38 | private DispatchNoteService dispatchNoteService; | 39 | private DispatchNoteService dispatchNoteService; |
39 | 40 | ||
41 | + /** | ||
42 | + * 我要调度车辆. | ||
43 | + * | ||
44 | + * @param req {@link DispatchNote} | ||
45 | + * @return 成功返回已调度的车辆信息 | ||
46 | + */ | ||
40 | @ApiOperation(value = "我要调度车辆", notes = "我要调度车辆") | 47 | @ApiOperation(value = "我要调度车辆", notes = "我要调度车辆") |
41 | @PostMapping("/dispatch") | 48 | @PostMapping("/dispatch") |
42 | public ResultJson dispatch(@RequestBody DispatchNote req) { | 49 | public ResultJson dispatch(@RequestBody DispatchNote req) { |
@@ -126,6 +133,12 @@ public class DispatchController { | @@ -126,6 +133,12 @@ public class DispatchController { | ||
126 | return result; | 133 | return result; |
127 | } | 134 | } |
128 | 135 | ||
136 | + /** | ||
137 | + * 手动开启任务调度. | ||
138 | + * | ||
139 | + * @param req {@link DispatchNote} | ||
140 | + * @return | ||
141 | + */ | ||
129 | @ApiOperation(value = "开始工作", notes = "车辆被调度后,开始工作的时刻") | 142 | @ApiOperation(value = "开始工作", notes = "车辆被调度后,开始工作的时刻") |
130 | @PutMapping("/startTask") | 143 | @PutMapping("/startTask") |
131 | public ResultJson startTask(@RequestBody DispatchNote req) { | 144 | public ResultJson startTask(@RequestBody DispatchNote req) { |
@@ -149,6 +162,12 @@ public class DispatchController { | @@ -149,6 +162,12 @@ public class DispatchController { | ||
149 | return result; | 162 | return result; |
150 | } | 163 | } |
151 | 164 | ||
165 | + /** | ||
166 | + * 手动完成任务调度. | ||
167 | + * | ||
168 | + * @param req {@link DispatchNote} | ||
169 | + * @return 成功完成任务 | ||
170 | + */ | ||
152 | @ApiOperation(value = "完成工作", notes = "车辆被调度后,完成工作的时刻") | 171 | @ApiOperation(value = "完成工作", notes = "车辆被调度后,完成工作的时刻") |
153 | @PutMapping("/completeTask") | 172 | @PutMapping("/completeTask") |
154 | public ResultJson completeTask(@RequestBody DispatchNote req) { | 173 | public ResultJson completeTask(@RequestBody DispatchNote req) { |
@@ -186,7 +205,12 @@ public class DispatchController { | @@ -186,7 +205,12 @@ public class DispatchController { | ||
186 | } | 205 | } |
187 | return result; | 206 | return result; |
188 | } | 207 | } |
189 | - | 208 | + /** |
209 | + * 取消调度车辆. | ||
210 | + * | ||
211 | + * @param req {@link DispatchNote} | ||
212 | + * @return | ||
213 | + */ | ||
190 | @ApiOperation(value = "取消调度车辆", notes = "判断了多种情况下,取消调度车辆") | 214 | @ApiOperation(value = "取消调度车辆", notes = "判断了多种情况下,取消调度车辆") |
191 | @PutMapping("/cancel") | 215 | @PutMapping("/cancel") |
192 | public ResultJson cancel(@RequestBody DispatchNote req) { | 216 | public ResultJson cancel(@RequestBody DispatchNote req) { |
@@ -208,7 +232,7 @@ public class DispatchController { | @@ -208,7 +232,7 @@ public class DispatchController { | ||
208 | * 开始时间为null==>还没有开启调度任务 | 232 | * 开始时间为null==>还没有开启调度任务 |
209 | * 结束时间为null==>代表并没有完成任务 | 233 | * 结束时间为null==>代表并没有完成任务 |
210 | */ | 234 | */ |
211 | - if (req.getBeginTime() == null && req.getEndTime()==null) { | 235 | + if (req.getBeginTime() == null && req.getEndTime() == null) { |
212 | /** | 236 | /** |
213 | * 设置车辆状态,为空闲状态("1") | 237 | * 设置车辆状态,为空闲状态("1") |
214 | * 设置车辆,开始空闲时间 | 238 | * 设置车辆,开始空闲时间 |
@@ -16,6 +16,7 @@ import org.springframework.beans.propertyeditors.CustomDateEditor; | @@ -16,6 +16,7 @@ import org.springframework.beans.propertyeditors.CustomDateEditor; | ||
16 | import org.springframework.web.bind.WebDataBinder; | 16 | import org.springframework.web.bind.WebDataBinder; |
17 | import org.springframework.web.bind.annotation.*; | 17 | import org.springframework.web.bind.annotation.*; |
18 | 18 | ||
19 | +import javax.annotation.Resource; | ||
19 | import java.text.SimpleDateFormat; | 20 | import java.text.SimpleDateFormat; |
20 | import java.util.Date; | 21 | import java.util.Date; |
21 | 22 | ||
@@ -29,11 +30,24 @@ import java.util.Date; | @@ -29,11 +30,24 @@ import java.util.Date; | ||
29 | @RequestMapping("dispatch/dispatchNote") | 30 | @RequestMapping("dispatch/dispatchNote") |
30 | @RestController | 31 | @RestController |
31 | public class DispatchNoteController { | 32 | public class DispatchNoteController { |
32 | - @Autowired | 33 | + @Resource |
33 | private DispatchNoteService dispatchNoteService; | 34 | private DispatchNoteService dispatchNoteService; |
34 | - @Autowired | 35 | + @Resource |
35 | private VehicleInfoService vehicleInfoService; | 36 | private VehicleInfoService vehicleInfoService; |
36 | 37 | ||
38 | + /** | ||
39 | + * 分页查询调度记录列表. | ||
40 | + * | ||
41 | + * @param userName 用户名称 | ||
42 | + * @param userMobile 用户联系方式 | ||
43 | + * @param dispatchType 调度类型 | ||
44 | + * @param gmtCreate 创建时间 | ||
45 | + * @param endTime 完成时间 | ||
46 | + * @param status 记录状态 | ||
47 | + * @param pageNum 当前页数 | ||
48 | + * @param pageSize 每页数量 | ||
49 | + * @return 成功返回查询记录列表 | ||
50 | + */ | ||
37 | @ApiOperation("分页查询,调度记录信息列表") | 51 | @ApiOperation("分页查询,调度记录信息列表") |
38 | @GetMapping("/selectDispatchNoteList") | 52 | @GetMapping("/selectDispatchNoteList") |
39 | public ResultJson<PageInfo> selectDispatchNoteList( | 53 | public ResultJson<PageInfo> selectDispatchNoteList( |
@@ -87,6 +101,12 @@ public class DispatchNoteController { | @@ -87,6 +101,12 @@ public class DispatchNoteController { | ||
87 | return result; | 101 | return result; |
88 | } | 102 | } |
89 | 103 | ||
104 | + /** | ||
105 | + * 删除调度记录. | ||
106 | + * | ||
107 | + * @param dispatchNote {@link DispatchNote} | ||
108 | + * @return | ||
109 | + */ | ||
90 | @ApiOperation("删除调度记录信息") | 110 | @ApiOperation("删除调度记录信息") |
91 | @DeleteMapping("/deleteDispatchNote") | 111 | @DeleteMapping("/deleteDispatchNote") |
92 | public ResultJson<DispatchNote> deleteDispatchNote(@RequestBody DispatchNote dispatchNote) { | 112 | public ResultJson<DispatchNote> deleteDispatchNote(@RequestBody DispatchNote dispatchNote) { |
@@ -121,6 +141,12 @@ public class DispatchNoteController { | @@ -121,6 +141,12 @@ public class DispatchNoteController { | ||
121 | return result; | 141 | return result; |
122 | } | 142 | } |
123 | 143 | ||
144 | + /** | ||
145 | + * 批量删除调度记录. | ||
146 | + * | ||
147 | + * @param ids 所要删除的id以','相连接的字符串 | ||
148 | + * @return ResultJson {@link ResultJson} | ||
149 | + */ | ||
124 | @ApiOperation("批量删除调度记录") | 150 | @ApiOperation("批量删除调度记录") |
125 | @GetMapping("/batchRemove") | 151 | @GetMapping("/batchRemove") |
126 | public ResultJson batchRemoveDispatchNote(String ids) { | 152 | public ResultJson batchRemoveDispatchNote(String ids) { |
@@ -198,7 +224,12 @@ public class DispatchNoteController { | @@ -198,7 +224,12 @@ public class DispatchNoteController { | ||
198 | return result; | 224 | return result; |
199 | } | 225 | } |
200 | 226 | ||
201 | - | 227 | + /** |
228 | + * 编辑调度记录信息. | ||
229 | + * | ||
230 | + * @param dispatchNote {@link DispatchNote} | ||
231 | + * @return | ||
232 | + */ | ||
202 | @ApiOperation("编辑调度记录信息") | 233 | @ApiOperation("编辑调度记录信息") |
203 | @PutMapping("/updateDispatchNote") | 234 | @PutMapping("/updateDispatchNote") |
204 | public ResultJson<DispatchNote> updateDispatchNote(@RequestBody DispatchNote dispatchNote) { | 235 | public ResultJson<DispatchNote> updateDispatchNote(@RequestBody DispatchNote dispatchNote) { |
@@ -216,6 +247,12 @@ public class DispatchNoteController { | @@ -216,6 +247,12 @@ public class DispatchNoteController { | ||
216 | return result; | 247 | return result; |
217 | } | 248 | } |
218 | 249 | ||
250 | + /** | ||
251 | + * 增加调度记录信息. | ||
252 | + * | ||
253 | + * @param dispatchNote {@link DispatchNote} | ||
254 | + * @return | ||
255 | + */ | ||
219 | @ApiOperation("增加调度记录信息") | 256 | @ApiOperation("增加调度记录信息") |
220 | @PostMapping("/insertDispatchNote") | 257 | @PostMapping("/insertDispatchNote") |
221 | public ResultJson<DispatchNote> insertDispatchNote(@RequestBody DispatchNote dispatchNote) { | 258 | public ResultJson<DispatchNote> insertDispatchNote(@RequestBody DispatchNote dispatchNote) { |
@@ -11,9 +11,11 @@ import io.swagger.annotations.ApiParam; | @@ -11,9 +11,11 @@ import io.swagger.annotations.ApiParam; | ||
11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
13 | 13 | ||
14 | +import javax.annotation.Resource; | ||
15 | + | ||
14 | /** | 16 | /** |
15 | * @author 子诚 | 17 | * @author 子诚 |
16 | - * Description: | 18 | + * Description:驾驶员信息管理. |
17 | * 时间:2020/4/26 14:04 | 19 | * 时间:2020/4/26 14:04 |
18 | */ | 20 | */ |
19 | @CrossOrigin | 21 | @CrossOrigin |
@@ -21,10 +23,20 @@ import org.springframework.web.bind.annotation.*; | @@ -21,10 +23,20 @@ import org.springframework.web.bind.annotation.*; | ||
21 | @RequestMapping("dispatch/driverInfo") | 23 | @RequestMapping("dispatch/driverInfo") |
22 | @RestController | 24 | @RestController |
23 | public class DriverInfoController { | 25 | public class DriverInfoController { |
24 | - @Autowired | 26 | + @Resource |
25 | private DriverInfoService driverInfoService; | 27 | private DriverInfoService driverInfoService; |
26 | 28 | ||
27 | - | 29 | + /** |
30 | + * 分页查询,驾驶员信息. | ||
31 | + * | ||
32 | + * @param driverName 驾驶员姓名 | ||
33 | + * @param driverMobile 驾驶员联系方式 | ||
34 | + * @param driverCompany 驾驶员所属公司 | ||
35 | + * @param driverStatus 驾驶员状态 | ||
36 | + * @param pageNum 当前页数 | ||
37 | + * @param pageSize 每页数量 | ||
38 | + * @return 成功返回查询列表 | ||
39 | + */ | ||
28 | @ApiOperation("获取驾驶员列表") | 40 | @ApiOperation("获取驾驶员列表") |
29 | @GetMapping("/selectDriverInfoList") | 41 | @GetMapping("/selectDriverInfoList") |
30 | public ResultJson<PageInfo> selectDriverInfoList( | 42 | public ResultJson<PageInfo> selectDriverInfoList( |
@@ -62,6 +74,12 @@ public class DriverInfoController { | @@ -62,6 +74,12 @@ public class DriverInfoController { | ||
62 | return result; | 74 | return result; |
63 | } | 75 | } |
64 | 76 | ||
77 | + /** | ||
78 | + * 删除驾驶员信息. | ||
79 | + * | ||
80 | + * @param driverInfo {@link DriverInfo} | ||
81 | + * @return | ||
82 | + */ | ||
65 | @ApiOperation("删除驾驶员信息") | 83 | @ApiOperation("删除驾驶员信息") |
66 | @DeleteMapping("/deleteDriverInfo") | 84 | @DeleteMapping("/deleteDriverInfo") |
67 | public ResultJson deleteDriverInfo(@RequestBody DriverInfo driverInfo) { | 85 | public ResultJson deleteDriverInfo(@RequestBody DriverInfo driverInfo) { |
@@ -80,6 +98,12 @@ public class DriverInfoController { | @@ -80,6 +98,12 @@ public class DriverInfoController { | ||
80 | return result; | 98 | return result; |
81 | } | 99 | } |
82 | 100 | ||
101 | + /** | ||
102 | + * 批量删除驾驶员信息. | ||
103 | + * | ||
104 | + * @param ids 所要删除的id以','相连接的字符串 | ||
105 | + * @return | ||
106 | + */ | ||
83 | @ApiOperation("批量删除驾驶员信息") | 107 | @ApiOperation("批量删除驾驶员信息") |
84 | @GetMapping("/batchRemove") | 108 | @GetMapping("/batchRemove") |
85 | public ResultJson batchRemoveDriverInfo(String ids) { | 109 | public ResultJson batchRemoveDriverInfo(String ids) { |
@@ -95,7 +119,12 @@ public class DriverInfoController { | @@ -95,7 +119,12 @@ public class DriverInfoController { | ||
95 | return result; | 119 | return result; |
96 | } | 120 | } |
97 | 121 | ||
98 | - | 122 | + /** |
123 | + * 编辑驾驶员信息. | ||
124 | + * | ||
125 | + * @param driverInfo {@link DriverInfo} | ||
126 | + * @return | ||
127 | + */ | ||
99 | @ApiOperation("编辑驾驶员信息") | 128 | @ApiOperation("编辑驾驶员信息") |
100 | @PutMapping("/updateDriverInfo") | 129 | @PutMapping("/updateDriverInfo") |
101 | public ResultJson updateDriverInfo(@RequestBody DriverInfo driverInfo) { | 130 | public ResultJson updateDriverInfo(@RequestBody DriverInfo driverInfo) { |
@@ -114,6 +143,12 @@ public class DriverInfoController { | @@ -114,6 +143,12 @@ public class DriverInfoController { | ||
114 | return result; | 143 | return result; |
115 | } | 144 | } |
116 | 145 | ||
146 | + /** | ||
147 | + * 增加驾驶员信息. | ||
148 | + * | ||
149 | + * @param driverInfo {@link DriverInfo} | ||
150 | + * @return | ||
151 | + */ | ||
117 | @ApiOperation("增加驾驶员信息") | 152 | @ApiOperation("增加驾驶员信息") |
118 | @PostMapping("/insertDriverInfo") | 153 | @PostMapping("/insertDriverInfo") |
119 | public ResultJson insertDriverInfo(@RequestBody DriverInfo driverInfo) { | 154 | public ResultJson insertDriverInfo(@RequestBody DriverInfo driverInfo) { |
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
9 | import org.springframework.web.bind.annotation.RequestParam; | 9 | import org.springframework.web.bind.annotation.RequestParam; |
10 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
11 | 11 | ||
12 | +import javax.annotation.Resource; | ||
12 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
13 | 14 | ||
14 | /** | 15 | /** |
@@ -20,7 +21,7 @@ import javax.servlet.http.HttpServletRequest; | @@ -20,7 +21,7 @@ import javax.servlet.http.HttpServletRequest; | ||
20 | @RestController | 21 | @RestController |
21 | public class GetUserController { | 22 | public class GetUserController { |
22 | 23 | ||
23 | - @Autowired | 24 | + @Resource |
24 | private GetUserFegin getUserFegin; | 25 | private GetUserFegin getUserFegin; |
25 | 26 | ||
26 | @GetMapping("/user/getUser") | 27 | @GetMapping("/user/getUser") |
@@ -9,13 +9,15 @@ import io.swagger.annotations.Api; | @@ -9,13 +9,15 @@ import io.swagger.annotations.Api; | ||
9 | import io.swagger.annotations.ApiOperation; | 9 | import io.swagger.annotations.ApiOperation; |
10 | import io.swagger.annotations.ApiParam; | 10 | import io.swagger.annotations.ApiParam; |
11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | +import org.springframework.http.HttpStatus; | ||
12 | import org.springframework.web.bind.annotation.*; | 13 | import org.springframework.web.bind.annotation.*; |
13 | 14 | ||
15 | +import javax.annotation.Resource; | ||
14 | import java.util.Date; | 16 | import java.util.Date; |
15 | 17 | ||
16 | /** | 18 | /** |
17 | * @author 子诚 | 19 | * @author 子诚 |
18 | - * Description: | 20 | + * Description:车辆信息管理. |
19 | * 时间:2020/4/24 17:03 | 21 | * 时间:2020/4/24 17:03 |
20 | */ | 22 | */ |
21 | @CrossOrigin | 23 | @CrossOrigin |
@@ -23,9 +25,20 @@ import java.util.Date; | @@ -23,9 +25,20 @@ import java.util.Date; | ||
23 | @RequestMapping("dispatch/vehicleInfo") | 25 | @RequestMapping("dispatch/vehicleInfo") |
24 | @RestController | 26 | @RestController |
25 | public class VehicleInfoController { | 27 | public class VehicleInfoController { |
26 | - @Autowired | 28 | + @Resource |
27 | private VehicleInfoService vehicleInfoService; | 29 | private VehicleInfoService vehicleInfoService; |
28 | 30 | ||
31 | + /** | ||
32 | + * 分页获取车辆列表. | ||
33 | + * | ||
34 | + * @param vehicleStatus 车辆状态 | ||
35 | + * @param vehicleType 车辆类型 | ||
36 | + * @param licensePlateNumber 车牌号码 | ||
37 | + * @param vehicleCompany 车辆所属公司 | ||
38 | + * @param pageNum 当前页数 | ||
39 | + * @param pageSize 每页数量 | ||
40 | + * @return 成功返回查询列表 | ||
41 | + */ | ||
29 | @ApiOperation("获取车辆列表") | 42 | @ApiOperation("获取车辆列表") |
30 | @GetMapping("/selectVehicleInfoList") | 43 | @GetMapping("/selectVehicleInfoList") |
31 | public ResultJson<PageInfo> selectVehicleInfoList( | 44 | public ResultJson<PageInfo> selectVehicleInfoList( |
@@ -65,31 +78,42 @@ public class VehicleInfoController { | @@ -65,31 +78,42 @@ public class VehicleInfoController { | ||
65 | } | 78 | } |
66 | 79 | ||
67 | /** | 80 | /** |
68 | - * 增加 | 81 | + * 添加车辆信息. |
82 | + * | ||
83 | + * @param vehicleInfo {@link VehicleInfo} | ||
84 | + * @return | ||
69 | */ | 85 | */ |
70 | @ApiOperation("添加车辆信息") | 86 | @ApiOperation("添加车辆信息") |
71 | @PostMapping("/insertVehicleInfo") | 87 | @PostMapping("/insertVehicleInfo") |
72 | public ResultJson insertVehicleInfo(@RequestBody VehicleInfo vehicleInfo) { | 88 | public ResultJson insertVehicleInfo(@RequestBody VehicleInfo vehicleInfo) { |
73 | - ResultJson result = new ResultJson<>(); | ||
74 | - //设置车辆id,(uuid) | ||
75 | - vehicleInfo.setId(GetUUID.getuuid()); | ||
76 | - //设置车辆状态,为空闲状态 | ||
77 | - vehicleInfo.setVehicleStatus("1"); | ||
78 | - //设置车辆开始空闲时间 | ||
79 | - vehicleInfo.setFreetime(new Date()); | ||
80 | - int num = vehicleInfoService.insertSelective(vehicleInfo); | ||
81 | - if (num > 0) { | ||
82 | - result.setCode("200"); | ||
83 | - result.setMsg("添加车辆信息,成功"); | ||
84 | - } else { | ||
85 | - result.setCode("400"); | ||
86 | - result.setMsg("添加车辆信息,失败"); | 89 | + String message = validateVehicle(vehicleInfo); |
90 | + //验证通过 | ||
91 | + if (message == null) { | ||
92 | + ResultJson result = new ResultJson<>(); | ||
93 | + //设置车辆id,(uuid) | ||
94 | + vehicleInfo.setId(GetUUID.getuuid()); | ||
95 | + //设置车辆状态,为空闲状态 | ||
96 | + vehicleInfo.setVehicleStatus("1"); | ||
97 | + //设置车辆开始空闲时间 | ||
98 | + vehicleInfo.setFreetime(new Date()); | ||
99 | + int num = vehicleInfoService.insertSelective(vehicleInfo); | ||
100 | + if (num > 0) { | ||
101 | + result.setCode("200"); | ||
102 | + result.setMsg("添加车辆信息,成功"); | ||
103 | + } else { | ||
104 | + result.setCode("400"); | ||
105 | + result.setMsg("添加车辆信息,失败"); | ||
106 | + } | ||
107 | + return result; | ||
87 | } | 108 | } |
88 | - return result; | 109 | + return new ResultJson("406", message != null ? message : "添加车辆信息,失败!"); |
89 | } | 110 | } |
90 | 111 | ||
91 | /** | 112 | /** |
92 | - * 修改 | 113 | + * 修改车辆信息. |
114 | + * | ||
115 | + * @param vehicleInfo {@link VehicleInfo} | ||
116 | + * @return | ||
93 | */ | 117 | */ |
94 | @ApiOperation("修改车辆信息") | 118 | @ApiOperation("修改车辆信息") |
95 | @PutMapping("/updateVehicleInfo") | 119 | @PutMapping("/updateVehicleInfo") |
@@ -106,7 +130,12 @@ public class VehicleInfoController { | @@ -106,7 +130,12 @@ public class VehicleInfoController { | ||
106 | return result; | 130 | return result; |
107 | } | 131 | } |
108 | 132 | ||
109 | - | 133 | + /** |
134 | + * 删除车辆信息. | ||
135 | + * | ||
136 | + * @param vehicleInfo {@link VehicleInfo} | ||
137 | + * @return | ||
138 | + */ | ||
110 | @ApiOperation("删除车辆信息") | 139 | @ApiOperation("删除车辆信息") |
111 | @DeleteMapping("/deleteVehicleInfo") | 140 | @DeleteMapping("/deleteVehicleInfo") |
112 | public ResultJson deleteVehicleInfo(@RequestBody VehicleInfo vehicleInfo) { | 141 | public ResultJson deleteVehicleInfo(@RequestBody VehicleInfo vehicleInfo) { |
@@ -122,6 +151,12 @@ public class VehicleInfoController { | @@ -122,6 +151,12 @@ public class VehicleInfoController { | ||
122 | return result; | 151 | return result; |
123 | } | 152 | } |
124 | 153 | ||
154 | + /** | ||
155 | + * 批量删除车辆信息. | ||
156 | + * | ||
157 | + * @param ids 所要删除的id以','相连接的字符串 | ||
158 | + * @return | ||
159 | + */ | ||
125 | @ApiOperation("批量删除车辆信息") | 160 | @ApiOperation("批量删除车辆信息") |
126 | @GetMapping("/batchRemove") | 161 | @GetMapping("/batchRemove") |
127 | public ResultJson batchRemoveVehicleInfo(String ids) { | 162 | public ResultJson batchRemoveVehicleInfo(String ids) { |
@@ -136,4 +171,18 @@ public class VehicleInfoController { | @@ -136,4 +171,18 @@ public class VehicleInfoController { | ||
136 | } | 171 | } |
137 | return result; | 172 | return result; |
138 | } | 173 | } |
174 | + | ||
175 | + /** | ||
176 | + * 验证新增车辆信息 | ||
177 | + * | ||
178 | + * @param vehicleInfo {@link VehicleInfo} | ||
179 | + * @return 错误信息 | ||
180 | + */ | ||
181 | + private String validateVehicle(VehicleInfo vehicleInfo) { | ||
182 | + VehicleInfo info = vehicleInfoService.selectByLPN(vehicleInfo.getLicensePlateNumber()); | ||
183 | + if (info != null) { | ||
184 | + return "车牌号已存在,请谨慎输入"; | ||
185 | + } | ||
186 | + return null; | ||
187 | + } | ||
139 | } | 188 | } |
@@ -12,7 +12,7 @@ import org.springframework.format.annotation.DateTimeFormat; | @@ -12,7 +12,7 @@ import org.springframework.format.annotation.DateTimeFormat; | ||
12 | 12 | ||
13 | /** | 13 | /** |
14 | * @author 子诚 | 14 | * @author 子诚 |
15 | - * Description: | 15 | + * Description:调度记录实体类 |
16 | * 时间:2020/4/22 15:32 | 16 | * 时间:2020/4/22 15:32 |
17 | */ | 17 | */ |
18 | 18 |
@@ -19,7 +19,7 @@ public interface GetUserFegin { | @@ -19,7 +19,7 @@ public interface GetUserFegin { | ||
19 | /** | 19 | /** |
20 | * 根据用户名获取到 CLOUD-USER-CENTER 服务中的用户的信息 | 20 | * 根据用户名获取到 CLOUD-USER-CENTER 服务中的用户的信息 |
21 | * | 21 | * |
22 | - * @param userName | 22 | + * @param userName 用户名称 |
23 | * @return | 23 | * @return |
24 | */ | 24 | */ |
25 | @GetMapping("/user/list") | 25 | @GetMapping("/user/list") |
@@ -9,12 +9,18 @@ import org.springframework.web.client.RestTemplate; | @@ -9,12 +9,18 @@ import org.springframework.web.client.RestTemplate; | ||
9 | 9 | ||
10 | /** | 10 | /** |
11 | * @author 子诚 | 11 | * @author 子诚 |
12 | - * Description: | 12 | + * Description:获取用户信息,熔断器 |
13 | * 时间:2020/5/8 19:06 | 13 | * 时间:2020/5/8 19:06 |
14 | */ | 14 | */ |
15 | @Service | 15 | @Service |
16 | public class GetUserFeginHystrix implements GetUserFegin { | 16 | public class GetUserFeginHystrix implements GetUserFegin { |
17 | - | 17 | + /** |
18 | + * | ||
19 | + * | ||
20 | + * @param userName 用户名称 | ||
21 | + * @param token 令牌 | ||
22 | + * @return | ||
23 | + */ | ||
18 | @Override | 24 | @Override |
19 | public ResultJson<PageInfo> list(String userName, String token) { | 25 | public ResultJson<PageInfo> list(String userName, String token) { |
20 | System.out.println("与 CLOUD-USER-CENTER 服务断开连接"); | 26 | System.out.println("与 CLOUD-USER-CENTER 服务断开连接"); |
-
请 注册 或 登录 后发表评论