正在显示
15 个修改的文件
包含
128 行增加
和
30 行删除
@@ -34,6 +34,13 @@ | @@ -34,6 +34,13 @@ | ||
34 | </dependency> | 34 | </dependency> |
35 | <!-- SpringBoot end --> | 35 | <!-- SpringBoot end --> |
36 | 36 | ||
37 | + <!-- Security start --> | ||
38 | + <dependency> | ||
39 | + <groupId>org.springframework.boot</groupId> | ||
40 | + <artifactId>spring-boot-starter-security</artifactId> | ||
41 | + </dependency> | ||
42 | + <!-- Security end --> | ||
43 | + | ||
37 | <!-- SpringCloud start --> | 44 | <!-- SpringCloud start --> |
38 | <dependency> | 45 | <dependency> |
39 | <groupId>org.springframework.cloud</groupId> | 46 | <groupId>org.springframework.cloud</groupId> |
@@ -110,12 +117,21 @@ | @@ -110,12 +117,21 @@ | ||
110 | <artifactId>springfox-swagger2</artifactId> | 117 | <artifactId>springfox-swagger2</artifactId> |
111 | <version>2.9.2</version> | 118 | <version>2.9.2</version> |
112 | </dependency> | 119 | </dependency> |
113 | - | ||
114 | <dependency> | 120 | <dependency> |
115 | <groupId>io.springfox</groupId> | 121 | <groupId>io.springfox</groupId> |
116 | <artifactId>springfox-swagger-ui</artifactId> | 122 | <artifactId>springfox-swagger-ui</artifactId> |
117 | <version>2.9.2</version> | 123 | <version>2.9.2</version> |
118 | </dependency> | 124 | </dependency> |
125 | + <dependency> | ||
126 | + <groupId>io.swagger</groupId> | ||
127 | + <artifactId>swagger-annotations</artifactId> | ||
128 | + <version>1.5.22</version> | ||
129 | + </dependency> | ||
130 | + <dependency> | ||
131 | + <groupId>io.swagger</groupId> | ||
132 | + <artifactId>swagger-models</artifactId> | ||
133 | + <version>1.5.22</version> | ||
134 | + </dependency> | ||
119 | 135 | ||
120 | <dependency> | 136 | <dependency> |
121 | <groupId>com.alibaba</groupId> | 137 | <groupId>com.alibaba</groupId> |
1 | +package com.sunyo.wlpt.dispatch.config; | ||
2 | + | ||
3 | +import org.springframework.context.annotation.Configuration; | ||
4 | +import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
5 | +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
6 | +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 子诚 | ||
10 | + * Description:SpringSecurity 权限配置框架 | ||
11 | + * 时间:2020/4/27 9:57 | ||
12 | + */ | ||
13 | +@EnableWebSecurity | ||
14 | +@Configuration | ||
15 | +public class SecurityConfig extends WebSecurityConfigurerAdapter { | ||
16 | + @Override | ||
17 | + protected void configure(HttpSecurity http) throws Exception { | ||
18 | + //首页所有人可以访问,功能页只有对应的权限才能访问 | ||
19 | + http.authorizeRequests() | ||
20 | + .antMatchers("/").permitAll(); | ||
21 | + http.csrf().disable(); | ||
22 | + } | ||
23 | +} |
@@ -6,12 +6,14 @@ import com.sunyo.wlpt.dispatch.domain.VehicleInfo; | @@ -6,12 +6,14 @@ import com.sunyo.wlpt.dispatch.domain.VehicleInfo; | ||
6 | import com.sunyo.wlpt.dispatch.response.ResultJson; | 6 | import com.sunyo.wlpt.dispatch.response.ResultJson; |
7 | import com.sunyo.wlpt.dispatch.service.DispatchNoteService; | 7 | import com.sunyo.wlpt.dispatch.service.DispatchNoteService; |
8 | import com.sunyo.wlpt.dispatch.service.VehicleInfoService; | 8 | import com.sunyo.wlpt.dispatch.service.VehicleInfoService; |
9 | +import com.sunyo.wlpt.dispatch.utils.GetUUID; | ||
9 | import io.swagger.annotations.Api; | 10 | import io.swagger.annotations.Api; |
10 | import io.swagger.annotations.ApiOperation; | 11 | import io.swagger.annotations.ApiOperation; |
11 | import org.apache.ibatis.annotations.Update; | 12 | import org.apache.ibatis.annotations.Update; |
12 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.web.bind.annotation.*; | 14 | import org.springframework.web.bind.annotation.*; |
14 | 15 | ||
16 | +import java.util.ArrayList; | ||
15 | import java.util.Date; | 17 | import java.util.Date; |
16 | import java.util.List; | 18 | import java.util.List; |
17 | 19 | ||
@@ -22,7 +24,7 @@ import static java.util.stream.Collectors.toList; | @@ -22,7 +24,7 @@ import static java.util.stream.Collectors.toList; | ||
22 | * Description:调度车辆 | 24 | * Description:调度车辆 |
23 | * 时间:2020/4/21 16:44 | 25 | * 时间:2020/4/21 16:44 |
24 | */ | 26 | */ |
25 | -@Api(value = "调度车辆业务") | 27 | +@Api(value = "调度车辆业务", tags = "业务——我要调度车辆") |
26 | @RequestMapping("dispatch") | 28 | @RequestMapping("dispatch") |
27 | @RestController | 29 | @RestController |
28 | public class DispatchController { | 30 | public class DispatchController { |
@@ -33,27 +35,36 @@ public class DispatchController { | @@ -33,27 +35,36 @@ public class DispatchController { | ||
33 | @Autowired | 35 | @Autowired |
34 | private DispatchNoteService dispatchNoteService; | 36 | private DispatchNoteService dispatchNoteService; |
35 | 37 | ||
36 | - @ApiOperation(value = "我要调度车辆") | 38 | + @ApiOperation(value = "我要调度车辆", notes = "我要调度车辆") |
37 | @PostMapping("/dispatch") | 39 | @PostMapping("/dispatch") |
38 | - public ResultJson<VehicleInfo> dispatch(@RequestBody DispatchNote req) { | 40 | + public ResultJson dispatch(@RequestBody DispatchNote req) { |
39 | //返回前端的 | 41 | //返回前端的 |
40 | - ResultJson<VehicleInfo> result = new ResultJson<>(); | 42 | + ResultJson result = new ResultJson<>(); |
41 | 43 | ||
42 | /** | 44 | /** |
43 | * 1.获取到用户的需求 | 45 | * 1.获取到用户的需求 |
44 | */ | 46 | */ |
45 | Integer vehicleNumber = req.getVehicleNumber(); | 47 | Integer vehicleNumber = req.getVehicleNumber(); |
46 | - String vehicleType = req.getVehicleType(); | 48 | + |
49 | + VehicleInfo vehicleInfo = new VehicleInfo(); | ||
47 | // 匹配车辆条件,车辆状态为空闲(1) | 50 | // 匹配车辆条件,车辆状态为空闲(1) |
48 | - String vehicleStatus = "1"; | 51 | + vehicleInfo.setVehicleStatus("1"); |
52 | + // 匹配车辆条件,车辆类型 | ||
53 | + vehicleInfo.setVehicleType(req.getVehicleType()); | ||
54 | + | ||
49 | // 2.根据用户的需求(车辆类型、数量进行匹配) | 55 | // 2.根据用户的需求(车辆类型、数量进行匹配) |
50 | - List<VehicleInfo> vehicleInfoList = vehicleInfoService.dispatchVehicle(vehicleType, vehicleStatus); | 56 | + List<VehicleInfo> vehicleInfoList = vehicleInfoService.dispatchVehicle(vehicleInfo); |
57 | + | ||
58 | + for(int i=0;i<vehicleInfoList.size(); i++){ | ||
59 | + System.out.println(vehicleInfoList.get(i)); | ||
60 | + } | ||
51 | // 3.对查询出来的结果进行匹配 | 61 | // 3.对查询出来的结果进行匹配 |
52 | if (vehicleInfoList.size() >= vehicleNumber) { | 62 | if (vehicleInfoList.size() >= vehicleNumber) { |
53 | //取出前(需求)个 | 63 | //取出前(需求)个 |
54 | List<VehicleInfo> needList = vehicleInfoList.stream() | 64 | List<VehicleInfo> needList = vehicleInfoList.stream() |
55 | .limit(vehicleNumber) | 65 | .limit(vehicleNumber) |
56 | .collect(toList()); | 66 | .collect(toList()); |
67 | + | ||
57 | for (int i = 0; i < needList.size(); i++) { | 68 | for (int i = 0; i < needList.size(); i++) { |
58 | /** | 69 | /** |
59 | * 1、通知车牌号为 XX 的车被调用,任务地点:场站位置;业务类型:XXXX | 70 | * 1、通知车牌号为 XX 的车被调用,任务地点:场站位置;业务类型:XXXX |
@@ -72,16 +83,20 @@ public class DispatchController { | @@ -72,16 +83,20 @@ public class DispatchController { | ||
72 | //2.修改车辆状态 | 83 | //2.修改车辆状态 |
73 | needList.get(i).setVehicleStatus("2"); | 84 | needList.get(i).setVehicleStatus("2"); |
74 | // 将车辆状态设置为执行状态 | 85 | // 将车辆状态设置为执行状态 |
75 | - vehicleInfoService.updateByPrimaryKey(needList.get(i)); | 86 | + vehicleInfoService.updateByPrimaryKeySelective(needList.get(i)); |
76 | /** | 87 | /** |
77 | * 3.生成调度表业务 | 88 | * 3.生成调度表业务 |
78 | */ | 89 | */ |
79 | // 生成调度记录表 | 90 | // 生成调度记录表 |
80 | DispatchNote dispatchNote = new DispatchNote(); | 91 | DispatchNote dispatchNote = new DispatchNote(); |
92 | + //记录表,设置id | ||
93 | + dispatchNote.setId(GetUUID.getuuid()); | ||
81 | //记录表,设置用户的姓名 | 94 | //记录表,设置用户的姓名 |
82 | dispatchNote.setUserName(req.getUserName()); | 95 | dispatchNote.setUserName(req.getUserName()); |
83 | //记录表,设置用户的联系方式 | 96 | //记录表,设置用户的联系方式 |
84 | dispatchNote.setUserMobile(req.getUserMobile()); | 97 | dispatchNote.setUserMobile(req.getUserMobile()); |
98 | + //记录表,设置车牌号 | ||
99 | + dispatchNote.setLicensePlateNumber(needList.get(i).getLicensePlateNumber()); | ||
85 | //记录表,设置调度业务类型 | 100 | //记录表,设置调度业务类型 |
86 | dispatchNote.setDispatchType(req.getDispatchType()); | 101 | dispatchNote.setDispatchType(req.getDispatchType()); |
87 | //记录表,设置场站位置 | 102 | //记录表,设置场站位置 |
@@ -92,11 +107,13 @@ public class DispatchController { | @@ -92,11 +107,13 @@ public class DispatchController { | ||
92 | dispatchNote.setVehicleType(req.getVehicleType()); | 107 | dispatchNote.setVehicleType(req.getVehicleType()); |
93 | //记录表,设置记录状态为执行状态(2) | 108 | //记录表,设置记录状态为执行状态(2) |
94 | dispatchNote.setStatus("2"); | 109 | dispatchNote.setStatus("2"); |
110 | + //记录表,设置创建时间 | ||
111 | + dispatchNote.setGmtCreate(new Date()); | ||
95 | // 生成调度记录表 | 112 | // 生成调度记录表 |
96 | dispatchNoteService.insertSelective(dispatchNote); | 113 | dispatchNoteService.insertSelective(dispatchNote); |
97 | } | 114 | } |
98 | //车辆匹配成功,返回车辆信息 | 115 | //车辆匹配成功,返回车辆信息 |
99 | - result.setData((VehicleInfo) needList); | 116 | + result.setData(needList); |
100 | result.setCode("200"); | 117 | result.setCode("200"); |
101 | result.setMsg("车辆调度成功!"); | 118 | result.setMsg("车辆调度成功!"); |
102 | } else { | 119 | } else { |
@@ -141,7 +158,7 @@ public class DispatchController { | @@ -141,7 +158,7 @@ public class DispatchController { | ||
141 | dispatchNoteService.updateByPrimaryKeySelective(req); | 158 | dispatchNoteService.updateByPrimaryKeySelective(req); |
142 | } | 159 | } |
143 | 160 | ||
144 | - @ApiOperation("取消调度车辆") | 161 | + @ApiOperation(value = "取消调度车辆", notes = "判断了多种情况下,取消调度车辆") |
145 | @PutMapping("/cancel") | 162 | @PutMapping("/cancel") |
146 | public ResultJson cancel(@RequestBody DispatchNote req) { | 163 | public ResultJson cancel(@RequestBody DispatchNote req) { |
147 | ResultJson<DispatchNote> result = new ResultJson<>(); | 164 | ResultJson<DispatchNote> result = new ResultJson<>(); |
@@ -9,6 +9,7 @@ import com.sunyo.wlpt.dispatch.service.VehicleInfoService; | @@ -9,6 +9,7 @@ import com.sunyo.wlpt.dispatch.service.VehicleInfoService; | ||
9 | import com.sunyo.wlpt.dispatch.utils.GetUUID; | 9 | import com.sunyo.wlpt.dispatch.utils.GetUUID; |
10 | import io.swagger.annotations.Api; | 10 | import io.swagger.annotations.Api; |
11 | import io.swagger.annotations.ApiOperation; | 11 | import io.swagger.annotations.ApiOperation; |
12 | +import io.swagger.annotations.ApiParam; | ||
12 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.web.bind.annotation.*; | 14 | import org.springframework.web.bind.annotation.*; |
14 | 15 | ||
@@ -19,7 +20,7 @@ import java.util.Date; | @@ -19,7 +20,7 @@ import java.util.Date; | ||
19 | * Description: | 20 | * Description: |
20 | * 时间:2020/4/24 20:30 | 21 | * 时间:2020/4/24 20:30 |
21 | */ | 22 | */ |
22 | -@Api("调度记录信息,业务") | 23 | +@Api(value = "调度记录信息,业务", tags = "业务管理——车辆调度记录信息") |
23 | @RequestMapping("dispatchNote") | 24 | @RequestMapping("dispatchNote") |
24 | @RestController | 25 | @RestController |
25 | public class DispatchNoteController { | 26 | public class DispatchNoteController { |
@@ -28,18 +29,24 @@ public class DispatchNoteController { | @@ -28,18 +29,24 @@ public class DispatchNoteController { | ||
28 | @Autowired | 29 | @Autowired |
29 | private VehicleInfoService vehicleInfoService; | 30 | private VehicleInfoService vehicleInfoService; |
30 | 31 | ||
31 | - /** | ||
32 | - * 获取,调度记录信息列表 | ||
33 | - */ | 32 | + @ApiOperation("分页查询,调度记录信息列表") |
34 | @GetMapping("/selectDispatchNoteList") | 33 | @GetMapping("/selectDispatchNoteList") |
35 | public ResultJson<PageInfo> selectDispatchNoteList( | 34 | public ResultJson<PageInfo> selectDispatchNoteList( |
35 | + @ApiParam(name = "userName", value = "用户姓名", required = false) | ||
36 | @RequestParam(value = "userName", required = false) String userName, | 36 | @RequestParam(value = "userName", required = false) String userName, |
37 | + @ApiParam(name = "userMobile", value = "用户联系方式", required = false) | ||
37 | @RequestParam(value = "userMobile", required = false) String userMobile, | 38 | @RequestParam(value = "userMobile", required = false) String userMobile, |
39 | + @ApiParam(name = "dispatchType", value = "业务类型", required = false) | ||
38 | @RequestParam(value = "dispatchType", required = false) String dispatchType, | 40 | @RequestParam(value = "dispatchType", required = false) String dispatchType, |
41 | + @ApiParam(name = "gmtCreate", value = "创建时间", required = false) | ||
39 | @RequestParam(value = "gmtCreate", required = false) Date gmtCreate, | 42 | @RequestParam(value = "gmtCreate", required = false) Date gmtCreate, |
43 | + @ApiParam(name = "endTime", value = "任务结束时间", required = false) | ||
40 | @RequestParam(value = "endTime", required = false) Date endTime, | 44 | @RequestParam(value = "endTime", required = false) Date endTime, |
45 | + @ApiParam(name = "status", value = "调度记录表状态:1.完成状态;2.执行状态;3、取消(撤销)状态", required = false) | ||
41 | @RequestParam(value = "status", required = false) String status, | 46 | @RequestParam(value = "status", required = false) String status, |
47 | + @ApiParam(name = "pageNum", value = "第几页,默认为第一页", required = false) | ||
42 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | 48 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, |
49 | + @ApiParam(name = "pageSize", value = "每页数量,默认10条", required = false) | ||
43 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | 50 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
44 | ResultJson<PageInfo> result = new ResultJson<>(); | 51 | ResultJson<PageInfo> result = new ResultJson<>(); |
45 | DispatchNote dispatchNote = new DispatchNote(); | 52 | DispatchNote dispatchNote = new DispatchNote(); |
@@ -7,6 +7,7 @@ import com.sunyo.wlpt.dispatch.service.DriverInfoService; | @@ -7,6 +7,7 @@ import com.sunyo.wlpt.dispatch.service.DriverInfoService; | ||
7 | import com.sunyo.wlpt.dispatch.utils.GetUUID; | 7 | import com.sunyo.wlpt.dispatch.utils.GetUUID; |
8 | import io.swagger.annotations.Api; | 8 | 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 org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
12 | 13 | ||
@@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.*; | @@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.*; | ||
15 | * Description: | 16 | * Description: |
16 | * 时间:2020/4/26 14:04 | 17 | * 时间:2020/4/26 14:04 |
17 | */ | 18 | */ |
18 | -@Api("驾驶员信息管理") | 19 | +@Api(value = "驾驶员信息管理", tags = "业务管理——驾驶员信息管理") |
19 | @RequestMapping("/driverInfo") | 20 | @RequestMapping("/driverInfo") |
20 | @RestController | 21 | @RestController |
21 | public class DriverInfoController { | 22 | public class DriverInfoController { |
@@ -26,11 +27,17 @@ public class DriverInfoController { | @@ -26,11 +27,17 @@ public class DriverInfoController { | ||
26 | @ApiOperation("获取驾驶员列表") | 27 | @ApiOperation("获取驾驶员列表") |
27 | @GetMapping("/selectDriverInfoList") | 28 | @GetMapping("/selectDriverInfoList") |
28 | public ResultJson<PageInfo> selectDriverInfoList( | 29 | public ResultJson<PageInfo> selectDriverInfoList( |
30 | + @ApiParam(name = "driverName", value = "驾驶员姓名", required = false) | ||
29 | @RequestParam(value = "driverName", required = false) String driverName, | 31 | @RequestParam(value = "driverName", required = false) String driverName, |
32 | + @ApiParam(name = "driverMobile", value = "驾驶员联系方式", required = false) | ||
30 | @RequestParam(value = "driverMobile", required = false) String driverMobile, | 33 | @RequestParam(value = "driverMobile", required = false) String driverMobile, |
34 | + @ApiParam(name = "driverCompany", value = "驾驶员所属公司", required = false) | ||
31 | @RequestParam(value = "driverCompany", required = false) String driverCompany, | 35 | @RequestParam(value = "driverCompany", required = false) String driverCompany, |
36 | + @ApiParam(name = "driverStatus", value = "驾驶员状态:驾驶员状态:1.空闲状态;2.执行状态;3.轮休状态;.请假状态", required = false) | ||
32 | @RequestParam(value = "driverStatus", required = false) String driverStatus, | 37 | @RequestParam(value = "driverStatus", required = false) String driverStatus, |
38 | + @ApiParam(name = "pageNum", value = "第几页,默认为第一页", required = false) | ||
33 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | 39 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, |
40 | + @ApiParam(name = "pageSize", value = "每页数量,默认10条", required = false) | ||
34 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | 41 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
35 | ResultJson<PageInfo> result = new ResultJson<>(); | 42 | ResultJson<PageInfo> result = new ResultJson<>(); |
36 | DriverInfo driverInfo = new DriverInfo(); | 43 | DriverInfo driverInfo = new DriverInfo(); |
@@ -7,6 +7,7 @@ import com.sunyo.wlpt.dispatch.service.VehicleInfoService; | @@ -7,6 +7,7 @@ import com.sunyo.wlpt.dispatch.service.VehicleInfoService; | ||
7 | import com.sunyo.wlpt.dispatch.utils.GetUUID; | 7 | import com.sunyo.wlpt.dispatch.utils.GetUUID; |
8 | import io.swagger.annotations.Api; | 8 | 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 org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
12 | 13 | ||
@@ -17,7 +18,7 @@ import java.util.Date; | @@ -17,7 +18,7 @@ import java.util.Date; | ||
17 | * Description: | 18 | * Description: |
18 | * 时间:2020/4/24 17:03 | 19 | * 时间:2020/4/24 17:03 |
19 | */ | 20 | */ |
20 | -@Api("车辆信息") | 21 | +@Api(value = "车辆信息", tags = "业务管理——车辆信息管理") |
21 | @RequestMapping("vehicleInfo") | 22 | @RequestMapping("vehicleInfo") |
22 | @RestController | 23 | @RestController |
23 | public class VehicleInfoController { | 24 | public class VehicleInfoController { |
@@ -27,11 +28,17 @@ public class VehicleInfoController { | @@ -27,11 +28,17 @@ public class VehicleInfoController { | ||
27 | @ApiOperation("获取车辆列表") | 28 | @ApiOperation("获取车辆列表") |
28 | @GetMapping("/selectVehicleInfoList") | 29 | @GetMapping("/selectVehicleInfoList") |
29 | public ResultJson<PageInfo> selectVehicleInfoList( | 30 | public ResultJson<PageInfo> selectVehicleInfoList( |
31 | + @ApiParam(name = "vehicleStatus", value = "车辆状态:1.空闲状态;2.执行状态;3、在修状态;4.损坏未修状态;5.保养状态", required = false) | ||
30 | @RequestParam(value = "vehicleStatus", required = false) String vehicleStatus, | 32 | @RequestParam(value = "vehicleStatus", required = false) String vehicleStatus, |
33 | + @ApiParam(name = "vehicleType", value = "车辆类型", required = false) | ||
31 | @RequestParam(value = "vehicleType", required = false) String vehicleType, | 34 | @RequestParam(value = "vehicleType", required = false) String vehicleType, |
35 | + @ApiParam(name = "licensePlateNumber", value = "车牌号", required = false) | ||
32 | @RequestParam(value = "licensePlateNumber", required = false) String licensePlateNumber, | 36 | @RequestParam(value = "licensePlateNumber", required = false) String licensePlateNumber, |
37 | + @ApiParam(name = "vehicleCompany", value = "车辆所属公司", required = false) | ||
33 | @RequestParam(value = "vehicleCompany", required = false) String vehicleCompany, | 38 | @RequestParam(value = "vehicleCompany", required = false) String vehicleCompany, |
39 | + @ApiParam(name = "pageNum", value = "第几页,默认为第一页", required = false) | ||
34 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | 40 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, |
41 | + @ApiParam(name = "pageSize", value = "每页数量,默认10条", required = false) | ||
35 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | 42 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
36 | 43 | ||
37 | ResultJson<PageInfo> result = new ResultJson<>(); | 44 | ResultJson<PageInfo> result = new ResultJson<>(); |
@@ -23,7 +23,7 @@ public class DispatchNote implements Serializable { | @@ -23,7 +23,7 @@ public class DispatchNote implements Serializable { | ||
23 | /** | 23 | /** |
24 | * 调度记录编号uuid | 24 | * 调度记录编号uuid |
25 | */ | 25 | */ |
26 | - private String id = UUID.randomUUID().toString().replaceAll("-", ""); | 26 | + private String id; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * 用户姓名 | 29 | * 用户姓名 |
@@ -21,7 +21,7 @@ public class DriverInfo implements Serializable { | @@ -21,7 +21,7 @@ public class DriverInfo implements Serializable { | ||
21 | /** | 21 | /** |
22 | * 驾驶员信息编号uuid | 22 | * 驾驶员信息编号uuid |
23 | */ | 23 | */ |
24 | - private String id = UUID.randomUUID().toString().replaceAll("-", ""); | 24 | + private String id; |
25 | 25 | ||
26 | /** | 26 | /** |
27 | * 驾驶员姓名 | 27 | * 驾驶员姓名 |
@@ -25,7 +25,7 @@ public class VehicleInfo implements Serializable { | @@ -25,7 +25,7 @@ public class VehicleInfo implements Serializable { | ||
25 | /** | 25 | /** |
26 | * 车辆信息编号uuid | 26 | * 车辆信息编号uuid |
27 | */ | 27 | */ |
28 | - private String id = UUID.randomUUID().toString().replaceAll("-", ""); | 28 | + private String id; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * 车牌号码 | 31 | * 车牌号码 |
@@ -84,7 +84,7 @@ public class VehicleInfo implements Serializable { | @@ -84,7 +84,7 @@ public class VehicleInfo implements Serializable { | ||
84 | /** | 84 | /** |
85 | * 车辆优先级(1,最好,2次之) | 85 | * 车辆优先级(1,最好,2次之) |
86 | */ | 86 | */ |
87 | - private Integer priority; | 87 | + private Integer priority = 2; |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * 车辆所属公司名称 | 90 | * 车辆所属公司名称 |
@@ -15,10 +15,13 @@ import org.apache.ibatis.annotations.Param; | @@ -15,10 +15,13 @@ import org.apache.ibatis.annotations.Param; | ||
15 | @Mapper | 15 | @Mapper |
16 | public interface VehicleInfoMapper { | 16 | public interface VehicleInfoMapper { |
17 | 17 | ||
18 | + | ||
18 | /** | 19 | /** |
19 | * 调度车辆方法 | 20 | * 调度车辆方法 |
21 | + * @param record | ||
22 | + * @return | ||
20 | */ | 23 | */ |
21 | - List<VehicleInfo> dispatchVehicle(@Param("vehicleType") String vehicleType, @Param("vehicleStatus") String vehicleStatus); | 24 | + List<VehicleInfo> dispatchVehicle(VehicleInfo record); |
22 | 25 | ||
23 | /** | 26 | /** |
24 | * 分页查询,车辆列表 | 27 | * 分页查询,车辆列表 |
@@ -3,6 +3,7 @@ package com.sunyo.wlpt.dispatch.response; | @@ -3,6 +3,7 @@ package com.sunyo.wlpt.dispatch.response; | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | 4 | ||
5 | import java.io.Serializable; | 5 | import java.io.Serializable; |
6 | +import java.util.List; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * @author 子诚 | 9 | * @author 子诚 |
@@ -26,6 +27,7 @@ public class ResultJson<T> implements Serializable { | @@ -26,6 +27,7 @@ public class ResultJson<T> implements Serializable { | ||
26 | * 响应数据 | 27 | * 响应数据 |
27 | */ | 28 | */ |
28 | private T data; | 29 | private T data; |
30 | + | ||
29 | /** | 31 | /** |
30 | * JWT令牌 | 32 | * JWT令牌 |
31 | */ | 33 | */ |
@@ -16,11 +16,10 @@ public interface VehicleInfoService { | @@ -16,11 +16,10 @@ public interface VehicleInfoService { | ||
16 | /** | 16 | /** |
17 | * 调度车辆方法 | 17 | * 调度车辆方法 |
18 | * | 18 | * |
19 | - * @param vehicleType | ||
20 | - * @param vehicleStatus | 19 | + * @param vehicleInfo |
21 | * @return | 20 | * @return |
22 | */ | 21 | */ |
23 | - List<VehicleInfo> dispatchVehicle(String vehicleType, String vehicleStatus); | 22 | + List<VehicleInfo> dispatchVehicle(VehicleInfo vehicleInfo); |
24 | 23 | ||
25 | 24 | ||
26 | /** | 25 | /** |
@@ -30,8 +30,9 @@ public class VehicleInfoServiceImpl implements VehicleInfoService { | @@ -30,8 +30,9 @@ public class VehicleInfoServiceImpl implements VehicleInfoService { | ||
30 | * @return List<VehicleInfo> | 30 | * @return List<VehicleInfo> |
31 | */ | 31 | */ |
32 | @Override | 32 | @Override |
33 | - public List<VehicleInfo> dispatchVehicle(String vehicleType, String vehicleStatus) { | ||
34 | - return vehicleInfoMapper.dispatchVehicle(vehicleType, vehicleStatus); | 33 | + public List<VehicleInfo> dispatchVehicle(VehicleInfo vehicleInfo) { |
34 | + List<VehicleInfo> vehicleInfoList = vehicleInfoMapper.dispatchVehicle(vehicleInfo); | ||
35 | + return vehicleInfoMapper.dispatchVehicle(vehicleInfo); | ||
35 | } | 36 | } |
36 | 37 | ||
37 | /** | 38 | /** |
@@ -7,6 +7,10 @@ spring: | @@ -7,6 +7,10 @@ spring: | ||
7 | name: dispatch-system | 7 | name: dispatch-system |
8 | profiles: | 8 | profiles: |
9 | active: dev | 9 | active: dev |
10 | + security: | ||
11 | + user: | ||
12 | + name: admin | ||
13 | + password: 123456 | ||
10 | # 链路追踪配置 | 14 | # 链路追踪配置 |
11 | zipkin: | 15 | zipkin: |
12 | base-url: http://192.168.1.63:9411 | 16 | base-url: http://192.168.1.63:9411 |
@@ -76,6 +80,10 @@ eureka: | @@ -76,6 +80,10 @@ eureka: | ||
76 | prefer-ip-address: true | 80 | prefer-ip-address: true |
77 | instance-id: ${spring.cloud.client.ip-address}:${server.port} | 81 | instance-id: ${spring.cloud.client.ip-address}:${server.port} |
78 | hostname: ${spring.cloud.client.ip-address} | 82 | hostname: ${spring.cloud.client.ip-address} |
83 | + metadata-map: | ||
84 | + user: | ||
85 | + name: "admin" | ||
86 | + passwoed: "123456" | ||
79 | client: | 87 | client: |
80 | healthcheck: | 88 | healthcheck: |
81 | enabled: true | 89 | enabled: true |
@@ -39,12 +39,20 @@ | @@ -39,12 +39,20 @@ | ||
39 | where license_plate_number = #{licensePlateNumber,jdbcType=VARCHAR} | 39 | where license_plate_number = #{licensePlateNumber,jdbcType=VARCHAR} |
40 | </select> | 40 | </select> |
41 | 41 | ||
42 | - <select id="dispatchVehicle" resultType="com.sunyo.wlpt.dispatch.domain.VehicleInfo"> | 42 | + <!-- 调度车辆SQL语句 --> |
43 | + <select id="dispatchVehicle" parameterType="com.sunyo.wlpt.dispatch.domain.VehicleInfo" | ||
44 | + resultMap="BaseResultMap"> | ||
43 | select | 45 | select |
44 | <include refid="Base_Column_List"/> | 46 | <include refid="Base_Column_List"/> |
45 | from vehicle_info | 47 | from vehicle_info |
46 | - where vehicle_status = #{vehicleStatus} | ||
47 | - and vehicle_type =#{vehicleType} | 48 | + <where> |
49 | + <if test="vehicleStatus != null and vehicleStatus != ''"> | ||
50 | + vehicle_status = #{vehicleStatus,jdbcType=VARCHAR} | ||
51 | + </if> | ||
52 | + <if test="vehicleType != null and vehicleType != ''"> | ||
53 | + and vehicle_type = #{vehicleType,jdbcType=VARCHAR} | ||
54 | + </if> | ||
55 | + </where> | ||
48 | order by freetime,priority | 56 | order by freetime,priority |
49 | </select> | 57 | </select> |
50 | 58 |
-
请 注册 或 登录 后发表评论