正在显示
14 个修改的文件
包含
148 行增加
和
67 行删除
@@ -138,6 +138,11 @@ | @@ -138,6 +138,11 @@ | ||
138 | <artifactId>fastjson</artifactId> | 138 | <artifactId>fastjson</artifactId> |
139 | <version>1.2.49</version> | 139 | <version>1.2.49</version> |
140 | </dependency> | 140 | </dependency> |
141 | + <dependency> | ||
142 | + <groupId>joda-time</groupId> | ||
143 | + <artifactId>joda-time</artifactId> | ||
144 | + <version>2.10.5</version> | ||
145 | + </dependency> | ||
141 | <!-- tools end --> | 146 | <!-- tools end --> |
142 | 147 | ||
143 | <!-- test start --> | 148 | <!-- test start --> |
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*; | @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*; | ||
16 | * Description:公司信息 Controller | 16 | * Description:公司信息 Controller |
17 | * 时间:2020/4/28 15:41 | 17 | * 时间:2020/4/28 15:41 |
18 | */ | 18 | */ |
19 | +@CrossOrigin | ||
19 | @Api(value = "公司信息,业务", tags = "业务管理——公司信息") | 20 | @Api(value = "公司信息,业务", tags = "业务管理——公司信息") |
20 | @RequestMapping("dispatch/companyInfo") | 21 | @RequestMapping("dispatch/companyInfo") |
21 | @RestController | 22 | @RestController |
1 | package com.sunyo.wlpt.dispatch.controller; | 1 | package com.sunyo.wlpt.dispatch.controller; |
2 | 2 | ||
3 | 3 | ||
4 | +import com.github.pagehelper.PageInfo; | ||
4 | import com.sunyo.wlpt.dispatch.domain.DispatchNote; | 5 | import com.sunyo.wlpt.dispatch.domain.DispatchNote; |
5 | import com.sunyo.wlpt.dispatch.domain.VehicleInfo; | 6 | import com.sunyo.wlpt.dispatch.domain.VehicleInfo; |
6 | import com.sunyo.wlpt.dispatch.response.ResultJson; | 7 | import com.sunyo.wlpt.dispatch.response.ResultJson; |
@@ -24,6 +25,7 @@ import static java.util.stream.Collectors.toList; | @@ -24,6 +25,7 @@ import static java.util.stream.Collectors.toList; | ||
24 | * Description:调度车辆 | 25 | * Description:调度车辆 |
25 | * 时间:2020/4/21 16:44 | 26 | * 时间:2020/4/21 16:44 |
26 | */ | 27 | */ |
28 | +@CrossOrigin | ||
27 | @Api(value = "调度车辆业务", tags = "业务——我要调度车辆") | 29 | @Api(value = "调度车辆业务", tags = "业务——我要调度车辆") |
28 | @RequestMapping("dispatch") | 30 | @RequestMapping("dispatch") |
29 | @RestController | 31 | @RestController |
@@ -126,22 +128,34 @@ public class DispatchController { | @@ -126,22 +128,34 @@ public class DispatchController { | ||
126 | 128 | ||
127 | @ApiOperation(value = "开始工作", notes = "车辆被调度后,开始工作的时刻") | 129 | @ApiOperation(value = "开始工作", notes = "车辆被调度后,开始工作的时刻") |
128 | @PutMapping("/startTask") | 130 | @PutMapping("/startTask") |
129 | - public void startTask(@RequestBody DispatchNote req) { | 131 | + public ResultJson startTask(@RequestBody DispatchNote req) { |
132 | + ResultJson result = new ResultJson(); | ||
130 | /** | 133 | /** |
131 | * 设置调度记录表,开始任务时间(由客户端传递过来,比较精确) | 134 | * 设置调度记录表,开始任务时间(由客户端传递过来,比较精确) |
132 | */ | 135 | */ |
136 | + if (req.getBeginTime() == null) { | ||
133 | req.setBeginTime(new Date()); | 137 | req.setBeginTime(new Date()); |
134 | - dispatchNoteService.updateByPrimaryKeySelective(req); | 138 | + int num = dispatchNoteService.updateByPrimaryKeySelective(req); |
139 | + if (num > 0) { | ||
140 | + result.setMsg("手动开启调度任务,成功"); | ||
141 | + } else { | ||
142 | + result.setCode("400"); | ||
143 | + result.setMsg("手动开启调度任务,失败"); | ||
144 | + } | ||
145 | + } | ||
146 | + return result; | ||
135 | } | 147 | } |
136 | 148 | ||
137 | @ApiOperation(value = "完成工作", notes = "车辆被调度后,完成工作的时刻") | 149 | @ApiOperation(value = "完成工作", notes = "车辆被调度后,完成工作的时刻") |
138 | @PutMapping("/completeTask") | 150 | @PutMapping("/completeTask") |
139 | - public void completeTask(@RequestBody DispatchNote req) { | 151 | + public ResultJson completeTask(@RequestBody DispatchNote req) { |
152 | + ResultJson result = new ResultJson(); | ||
140 | /** | 153 | /** |
141 | * 车辆信息表,修改 | 154 | * 车辆信息表,修改 |
142 | * 1.设置车辆信息表,为空闲状态(1) | 155 | * 1.设置车辆信息表,为空闲状态(1) |
143 | * 2.设置车辆信息表开始空闲时间(任务的完成时间) | 156 | * 2.设置车辆信息表开始空闲时间(任务的完成时间) |
144 | */ | 157 | */ |
158 | + if (req.getEndTime() == null) { | ||
145 | // 根据记录表中的车牌号,获取到车辆信息 | 159 | // 根据记录表中的车牌号,获取到车辆信息 |
146 | String licensePlateNumber = req.getLicensePlateNumber(); | 160 | String licensePlateNumber = req.getLicensePlateNumber(); |
147 | VehicleInfo vehicleInfo = vehicleInfoService.selectByLPN(licensePlateNumber); | 161 | VehicleInfo vehicleInfo = vehicleInfoService.selectByLPN(licensePlateNumber); |
@@ -158,7 +172,15 @@ public class DispatchController { | @@ -158,7 +172,15 @@ public class DispatchController { | ||
158 | */ | 172 | */ |
159 | req.setStatus("1"); | 173 | req.setStatus("1"); |
160 | req.setEndTime(nowTime); | 174 | req.setEndTime(nowTime); |
161 | - dispatchNoteService.updateByPrimaryKeySelective(req); | 175 | + int num = dispatchNoteService.updateByPrimaryKeySelective(req); |
176 | + if (num > 0) { | ||
177 | + result.setMsg("手动完成调度任务,成功"); | ||
178 | + } else { | ||
179 | + result.setCode("400"); | ||
180 | + result.setMsg("手动完成调度任务,失败"); | ||
181 | + } | ||
182 | + } | ||
183 | + return result; | ||
162 | } | 184 | } |
163 | 185 | ||
164 | @ApiOperation(value = "取消调度车辆", notes = "判断了多种情况下,取消调度车辆") | 186 | @ApiOperation(value = "取消调度车辆", notes = "判断了多种情况下,取消调度车辆") |
@@ -6,13 +6,17 @@ import com.sunyo.wlpt.dispatch.domain.VehicleInfo; | @@ -6,13 +6,17 @@ 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.DateTimeUtils; | ||
9 | import com.sunyo.wlpt.dispatch.utils.GetUUID; | 10 | import com.sunyo.wlpt.dispatch.utils.GetUUID; |
10 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
11 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
12 | import io.swagger.annotations.ApiParam; | 13 | import io.swagger.annotations.ApiParam; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
15 | +import org.springframework.beans.propertyeditors.CustomDateEditor; | ||
16 | +import org.springframework.web.bind.WebDataBinder; | ||
14 | import org.springframework.web.bind.annotation.*; | 17 | import org.springframework.web.bind.annotation.*; |
15 | 18 | ||
19 | +import java.text.SimpleDateFormat; | ||
16 | import java.util.Date; | 20 | import java.util.Date; |
17 | 21 | ||
18 | /** | 22 | /** |
@@ -20,6 +24,7 @@ import java.util.Date; | @@ -20,6 +24,7 @@ import java.util.Date; | ||
20 | * Description: | 24 | * Description: |
21 | * 时间:2020/4/24 20:30 | 25 | * 时间:2020/4/24 20:30 |
22 | */ | 26 | */ |
27 | +@CrossOrigin | ||
23 | @Api(value = "调度记录信息,业务", tags = "业务管理——车辆调度记录信息") | 28 | @Api(value = "调度记录信息,业务", tags = "业务管理——车辆调度记录信息") |
24 | @RequestMapping("dispatch/dispatchNote") | 29 | @RequestMapping("dispatch/dispatchNote") |
25 | @RestController | 30 | @RestController |
@@ -38,7 +43,7 @@ public class DispatchNoteController { | @@ -38,7 +43,7 @@ public class DispatchNoteController { | ||
38 | @RequestParam(value = "userMobile", required = false) String userMobile, | 43 | @RequestParam(value = "userMobile", required = false) String userMobile, |
39 | @ApiParam(name = "dispatchType", value = "业务类型", required = false) | 44 | @ApiParam(name = "dispatchType", value = "业务类型", required = false) |
40 | @RequestParam(value = "dispatchType", required = false) String dispatchType, | 45 | @RequestParam(value = "dispatchType", required = false) String dispatchType, |
41 | - @ApiParam(name = "gmtCreate", value = "创建时间", required = false) | 46 | + @ApiParam(name = "gmtCreate", value = "任务创建时间", required = false) |
42 | @RequestParam(value = "gmtCreate", required = false) Date gmtCreate, | 47 | @RequestParam(value = "gmtCreate", required = false) Date gmtCreate, |
43 | @ApiParam(name = "endTime", value = "任务结束时间", required = false) | 48 | @ApiParam(name = "endTime", value = "任务结束时间", required = false) |
44 | @RequestParam(value = "endTime", required = false) Date endTime, | 49 | @RequestParam(value = "endTime", required = false) Date endTime, |
@@ -58,31 +63,20 @@ public class DispatchNoteController { | @@ -58,31 +63,20 @@ public class DispatchNoteController { | ||
58 | * 1.用户姓名;2.用户电话;3.创建时间;4.完成时间 | 63 | * 1.用户姓名;2.用户电话;3.创建时间;4.完成时间 |
59 | * 5.业务类型;6.记录状态 | 64 | * 5.业务类型;6.记录状态 |
60 | */ | 65 | */ |
61 | - | ||
62 | - if ("".equals(userName)) { | ||
63 | //获取参数,用户姓名 | 66 | //获取参数,用户姓名 |
64 | dispatchNote.setUserName(userName); | 67 | dispatchNote.setUserName(userName); |
65 | - } | ||
66 | - if ("".equals(userMobile)) { | ||
67 | //获取参数,用户联系方式 | 68 | //获取参数,用户联系方式 |
68 | dispatchNote.setUserMobile(userMobile); | 69 | dispatchNote.setUserMobile(userMobile); |
69 | - } | ||
70 | - if ("".equals(dispatchType)) { | ||
71 | //获取参数,业务类型 | 70 | //获取参数,业务类型 |
72 | dispatchNote.setDispatchType(dispatchType); | 71 | dispatchNote.setDispatchType(dispatchType); |
73 | - } | ||
74 | - if (null != gmtCreate) { | 72 | + System.out.println(gmtCreate); |
75 | //获取参数,创建时间 | 73 | //获取参数,创建时间 |
76 | dispatchNote.setGmtCreate(gmtCreate); | 74 | dispatchNote.setGmtCreate(gmtCreate); |
77 | - } | ||
78 | - if ("".equals(status)) { | ||
79 | //获取参数,记录表状态 | 75 | //获取参数,记录表状态 |
80 | dispatchNote.setStatus(status); | 76 | dispatchNote.setStatus(status); |
81 | - } | ||
82 | - if (null != endTime) { | ||
83 | //获取参数,任务结束(完成)时间 | 77 | //获取参数,任务结束(完成)时间 |
84 | dispatchNote.setEndTime(endTime); | 78 | dispatchNote.setEndTime(endTime); |
85 | - } | 79 | + System.out.println(dispatchNote); |
86 | PageInfo pageInfo = dispatchNoteService.selectDispatchNoteList(dispatchNote, pageNum, pageSize); | 80 | PageInfo pageInfo = dispatchNoteService.selectDispatchNoteList(dispatchNote, pageNum, pageSize); |
87 | if (pageInfo.getTotal() > 0) { | 81 | if (pageInfo.getTotal() > 0) { |
88 | result.setData(pageInfo); | 82 | result.setData(pageInfo); |
@@ -159,4 +153,10 @@ public class DispatchNoteController { | @@ -159,4 +153,10 @@ public class DispatchNoteController { | ||
159 | } | 153 | } |
160 | return result; | 154 | return result; |
161 | } | 155 | } |
156 | + @InitBinder | ||
157 | + public void initBinder(WebDataBinder binder) { | ||
158 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | ||
159 | + dateFormat.setLenient(false); | ||
160 | + binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); | ||
161 | + } | ||
162 | } | 162 | } |
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*; | @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*; | ||
16 | * Description: | 16 | * Description: |
17 | * 时间:2020/4/26 14:04 | 17 | * 时间:2020/4/26 14:04 |
18 | */ | 18 | */ |
19 | +@CrossOrigin | ||
19 | @Api(value = "驾驶员信息管理", tags = "业务管理——驾驶员信息管理") | 20 | @Api(value = "驾驶员信息管理", tags = "业务管理——驾驶员信息管理") |
20 | @RequestMapping("dispatch/driverInfo") | 21 | @RequestMapping("dispatch/driverInfo") |
21 | @RestController | 22 | @RestController |
@@ -33,7 +34,7 @@ public class DriverInfoController { | @@ -33,7 +34,7 @@ public class DriverInfoController { | ||
33 | @RequestParam(value = "driverMobile", required = false) String driverMobile, | 34 | @RequestParam(value = "driverMobile", required = false) String driverMobile, |
34 | @ApiParam(name = "driverCompany", value = "驾驶员所属公司", required = false) | 35 | @ApiParam(name = "driverCompany", value = "驾驶员所属公司", required = false) |
35 | @RequestParam(value = "driverCompany", required = false) String driverCompany, | 36 | @RequestParam(value = "driverCompany", required = false) String driverCompany, |
36 | - @ApiParam(name = "driverStatus", value = "驾驶员状态:驾驶员状态:1.空闲状态;2.执行状态;3.轮休状态;.请假状态", required = false) | 37 | + @ApiParam(name = "driverStatus", value = "驾驶员状态:驾驶员状态:1.空闲状态;2.执行状态;3.轮休状态;4.请假状态", required = false) |
37 | @RequestParam(value = "driverStatus", required = false) String driverStatus, | 38 | @RequestParam(value = "driverStatus", required = false) String driverStatus, |
38 | @ApiParam(name = "pageNum", value = "第几页,默认为第一页", required = false) | 39 | @ApiParam(name = "pageNum", value = "第几页,默认为第一页", required = false) |
39 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | 40 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, |
@@ -41,22 +42,14 @@ public class DriverInfoController { | @@ -41,22 +42,14 @@ public class DriverInfoController { | ||
41 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | 42 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
42 | ResultJson<PageInfo> result = new ResultJson<>(); | 43 | ResultJson<PageInfo> result = new ResultJson<>(); |
43 | DriverInfo driverInfo = new DriverInfo(); | 44 | DriverInfo driverInfo = new DriverInfo(); |
44 | - if ("".equals(driverName)) { | ||
45 | //获取参数,驾驶员姓名 | 45 | //获取参数,驾驶员姓名 |
46 | driverInfo.setDriverName(driverName); | 46 | driverInfo.setDriverName(driverName); |
47 | - } | ||
48 | - if ("".equals(driverMobile)) { | ||
49 | //获取参数,驾驶员联系方式 | 47 | //获取参数,驾驶员联系方式 |
50 | driverInfo.setDriverMobile(driverMobile); | 48 | driverInfo.setDriverMobile(driverMobile); |
51 | - } | ||
52 | - if ("".equals(driverCompany)) { | ||
53 | //获取参数,驾驶员所属公司 | 49 | //获取参数,驾驶员所属公司 |
54 | driverInfo.setDriverCompany(driverCompany); | 50 | driverInfo.setDriverCompany(driverCompany); |
55 | - } | ||
56 | - if ("".equals(driverStatus)) { | ||
57 | //获取参数,驾驶员状态 | 51 | //获取参数,驾驶员状态 |
58 | driverInfo.setDriverStatus(driverStatus); | 52 | driverInfo.setDriverStatus(driverStatus); |
59 | - } | ||
60 | PageInfo pageInfo = driverInfoService.selectDriverInfoList(driverInfo, pageNum, pageSize); | 53 | PageInfo pageInfo = driverInfoService.selectDriverInfoList(driverInfo, pageNum, pageSize); |
61 | if (pageInfo.getTotal() > 0) { | 54 | if (pageInfo.getTotal() > 0) { |
62 | result.setData(pageInfo); | 55 | result.setData(pageInfo); |
@@ -18,6 +18,7 @@ import java.util.Date; | @@ -18,6 +18,7 @@ import java.util.Date; | ||
18 | * Description: | 18 | * Description: |
19 | * 时间:2020/4/24 17:03 | 19 | * 时间:2020/4/24 17:03 |
20 | */ | 20 | */ |
21 | +@CrossOrigin | ||
21 | @Api(value = "车辆信息", tags = "业务管理——车辆信息管理") | 22 | @Api(value = "车辆信息", tags = "业务管理——车辆信息管理") |
22 | @RequestMapping("dispatch/vehicleInfo") | 23 | @RequestMapping("dispatch/vehicleInfo") |
23 | @RestController | 24 | @RestController |
@@ -43,22 +44,14 @@ public class VehicleInfoController { | @@ -43,22 +44,14 @@ public class VehicleInfoController { | ||
43 | 44 | ||
44 | ResultJson<PageInfo> result = new ResultJson<>(); | 45 | ResultJson<PageInfo> result = new ResultJson<>(); |
45 | VehicleInfo vehicleInfo = new VehicleInfo(); | 46 | VehicleInfo vehicleInfo = new VehicleInfo(); |
46 | - if ("".equals(vehicleStatus)) { | ||
47 | //获取参数,车辆状态 | 47 | //获取参数,车辆状态 |
48 | vehicleInfo.setVehicleStatus(vehicleStatus); | 48 | vehicleInfo.setVehicleStatus(vehicleStatus); |
49 | - } | ||
50 | - if ("".equals(vehicleType)) { | ||
51 | //获取参数,车辆类型 | 49 | //获取参数,车辆类型 |
52 | vehicleInfo.setVehicleType(vehicleType); | 50 | vehicleInfo.setVehicleType(vehicleType); |
53 | - } | ||
54 | - if ("".equals(licensePlateNumber)) { | ||
55 | //获取参数,车牌号 | 51 | //获取参数,车牌号 |
56 | vehicleInfo.setLicensePlateNumber(licensePlateNumber); | 52 | vehicleInfo.setLicensePlateNumber(licensePlateNumber); |
57 | - } | ||
58 | - if ("".equals(vehicleCompany)) { | ||
59 | //获取参数,公司名 | 53 | //获取参数,公司名 |
60 | vehicleInfo.setVehicleCompany(vehicleCompany); | 54 | vehicleInfo.setVehicleCompany(vehicleCompany); |
61 | - } | ||
62 | PageInfo pageInfo = vehicleInfoService.selectVehicleInfoList(vehicleInfo, pageNum, pageSize); | 55 | PageInfo pageInfo = vehicleInfoService.selectVehicleInfoList(vehicleInfo, pageNum, pageSize); |
63 | if (pageInfo.getTotal() > 0) { | 56 | if (pageInfo.getTotal() > 0) { |
64 | result.setData(pageInfo); | 57 | result.setData(pageInfo); |
@@ -78,7 +78,6 @@ public class DispatchNote implements Serializable { | @@ -78,7 +78,6 @@ public class DispatchNote implements Serializable { | ||
78 | /** | 78 | /** |
79 | * 调度记录(任务)创建时间 | 79 | * 调度记录(任务)创建时间 |
80 | */ | 80 | */ |
81 | - @DateTimeFormat(pattern = "yyyy-MM-dd") | ||
82 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | 81 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
83 | private Date gmtCreate; | 82 | private Date gmtCreate; |
84 | 83 | ||
@@ -98,7 +97,6 @@ public class DispatchNote implements Serializable { | @@ -98,7 +97,6 @@ public class DispatchNote implements Serializable { | ||
98 | /** | 97 | /** |
99 | * 任务完成时间 | 98 | * 任务完成时间 |
100 | */ | 99 | */ |
101 | - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | ||
102 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | 100 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
103 | private Date endTime; | 101 | private Date endTime; |
104 | 102 |
@@ -49,7 +49,7 @@ public class DriverInfo implements Serializable { | @@ -49,7 +49,7 @@ public class DriverInfo implements Serializable { | ||
49 | private String jobNumber; | 49 | private String jobNumber; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | - * 驾驶员职位:大队长,班长,副班长,员工 | 52 | + * 驾驶员职位:队长,班长,副班长,员工 |
53 | */ | 53 | */ |
54 | private String driverPosition; | 54 | private String driverPosition; |
55 | 55 |
@@ -16,10 +16,10 @@ public interface DispatchNoteMapper { | @@ -16,10 +16,10 @@ public interface DispatchNoteMapper { | ||
16 | /** | 16 | /** |
17 | * 分页查询,调度记录列表 | 17 | * 分页查询,调度记录列表 |
18 | * | 18 | * |
19 | - * @param record | 19 | + * @param dispatchNote |
20 | * @return | 20 | * @return |
21 | */ | 21 | */ |
22 | - List<DispatchNote> selectVehicleInfoList(DispatchNote record); | 22 | + List<DispatchNote> selectVehicleInfoList(@Param("dispatchNote") DispatchNote dispatchNote); |
23 | 23 | ||
24 | int deleteByPrimaryKey(String id); | 24 | int deleteByPrimaryKey(String id); |
25 | 25 |
1 | +package com.sunyo.wlpt.dispatch.utils; | ||
2 | + | ||
3 | +import java.text.SimpleDateFormat; | ||
4 | +import java.util.ArrayList; | ||
5 | +import java.util.Date; | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 子诚 | ||
10 | + * Description: | ||
11 | + * 时间:2020/5/6 21:16 | ||
12 | + */ | ||
13 | +public class DateTimeUtils { | ||
14 | + | ||
15 | + private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | ||
16 | + private static SimpleDateFormat simpleDateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
17 | + | ||
18 | + | ||
19 | + /** | ||
20 | + * 获取年月日,date类型 | ||
21 | + * @param s | ||
22 | + * @return | ||
23 | + */ | ||
24 | + public static Date getDate(String s){ | ||
25 | + Date time = null; | ||
26 | + if(s == null){ | ||
27 | + return time; | ||
28 | + } | ||
29 | + try { | ||
30 | + if (s.length()>0){ | ||
31 | + time = simpleDateFormat.parse(s); | ||
32 | + } | ||
33 | + }catch (Exception e){ | ||
34 | + e.printStackTrace(); | ||
35 | + } | ||
36 | + return time; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * 获取年月日,String类型 | ||
41 | + * @param date | ||
42 | + * @return | ||
43 | + */ | ||
44 | + public static String getDateString(Date date){ | ||
45 | + return simpleDateFormat.format(date); | ||
46 | + } | ||
47 | + | ||
48 | + /** | ||
49 | + * 获取当前年月日时分秒,String类型 | ||
50 | + * @param date | ||
51 | + * @return | ||
52 | + */ | ||
53 | + public static String getDateTimeString(Date date){ | ||
54 | + return simpleDateTimeFormat.format(date); | ||
55 | + } | ||
56 | + | ||
57 | + public static List getSeverDay(){ | ||
58 | + List<Date> dates = new ArrayList<>(); | ||
59 | + Date date = new Date(); | ||
60 | + dates.add(date); | ||
61 | + for (int i=1;i<7;i++) { | ||
62 | + long time = date.getTime() - i*24 * 3600 * 1000L; | ||
63 | + Date preTime = new Date(time); | ||
64 | + dates.add(preTime); | ||
65 | + } | ||
66 | + return dates; | ||
67 | + } | ||
68 | +} | ||
69 | + |
@@ -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 | + jackson: | ||
11 | + default-property-inclusion: ALWAYS | ||
12 | + time-zone: GMT+8 | ||
13 | + date-format: yyyy-MM-dd | ||
10 | security: | 14 | security: |
11 | user: | 15 | user: |
12 | name: admin | 16 | name: admin |
@@ -68,6 +72,8 @@ mybatis: | @@ -68,6 +72,8 @@ mybatis: | ||
68 | # 日志打印 | 72 | # 日志打印 |
69 | logging: | 73 | logging: |
70 | config: config/logback-dev.xml | 74 | config: config/logback-dev.xml |
75 | + level: | ||
76 | + com.sunyo.wlpt.dispatch.mapper: debug | ||
71 | logback: | 77 | logback: |
72 | appname: dispatch-system | 78 | appname: dispatch-system |
73 | logdir: ./log | 79 | logdir: ./log |
@@ -33,34 +33,32 @@ | @@ -33,34 +33,32 @@ | ||
33 | select | 33 | select |
34 | <include refid="Base_Column_List"/> | 34 | <include refid="Base_Column_List"/> |
35 | from dispatch_note | 35 | from dispatch_note |
36 | - <where> | ||
37 | - <trim suffixOverrides=","> | 36 | + where 1=1 |
38 | <!-- 用户姓名 --> | 37 | <!-- 用户姓名 --> |
39 | - <if test="userName != null and userName != ''"> | ||
40 | - user_name = #{userName,jdbcType=VARCHAR}, | 38 | + <if test="dispatchNote.userName != null and dispatchNote.userName != ''"> |
39 | + AND user_name = #{dispatchNote.userName,jdbcType=VARCHAR} | ||
41 | </if> | 40 | </if> |
42 | <!-- 用户联系方式 --> | 41 | <!-- 用户联系方式 --> |
43 | - <if test="userMobile != null and userMobile != ''"> | ||
44 | - AND user_mobile = #{userMobile,jdbcType=VARCHAR}, | 42 | + <if test="dispatchNote.userMobile != null and dispatchNote.userMobile != ''"> |
43 | + AND user_mobile = #{dispatchNote.userMobile,jdbcType=VARCHAR} | ||
45 | </if> | 44 | </if> |
46 | <!-- 业务类型 --> | 45 | <!-- 业务类型 --> |
47 | - <if test="dispatchType != null and dispatchType != ''"> | ||
48 | - AND dispatch_type = #{dispatchType,jdbcType=VARCHAR}, | 46 | + <if test="dispatchNote.dispatchType != null and dispatchNote.dispatchType != ''"> |
47 | + AND dispatch_type = #{dispatchNote.dispatchType,jdbcType=VARCHAR} | ||
49 | </if> | 48 | </if> |
50 | <!-- 记录表状态 --> | 49 | <!-- 记录表状态 --> |
51 | - <if test="status != null and status != ''"> | ||
52 | - AND status = #{status,jdbcType=VARCHAR}, | 50 | + <if test="dispatchNote.status != null and dispatchNote.status != ''"> |
51 | + AND status = #{dispatchNote.status,jdbcType=VARCHAR} | ||
53 | </if> | 52 | </if> |
54 | <!-- 任务创建时间 --> | 53 | <!-- 任务创建时间 --> |
55 | - <if test="gmtCreate != null"> | ||
56 | - AND DATE_FORMAT(gmt_create,'%Y-%m-%d') = #{gmtCreate,jdbcType=TIMESTAMP}, | 54 | + <if test="dispatchNote.gmtCreate != null"> |
55 | + AND DATE_FORMAT(gmt_create,'%Y-%m-%d') = #{dispatchNote.gmtCreate,jdbcType=DATE} | ||
57 | </if> | 56 | </if> |
58 | <!-- 任务(结束)完成时间 --> | 57 | <!-- 任务(结束)完成时间 --> |
59 | - <if test="endTime != null"> | ||
60 | - AND DATE_FORMAT(end_time,'%Y-%m-%d') = #{endTime,jdbcType=TIMESTAMP} | 58 | + <if test="dispatchNote.endTime != null"> |
59 | + AND DATE_FORMAT(end_time,'%Y-%m-%d') = #{dispatchNote.endTime,jdbcType=DATE} | ||
61 | </if> | 60 | </if> |
62 | - </trim> | ||
63 | - </where> | 61 | + order by gmt_create desc |
64 | </select> | 62 | </select> |
65 | 63 | ||
66 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | 64 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> |
@@ -466,25 +466,22 @@ | @@ -466,25 +466,22 @@ | ||
466 | <include refid="Base_Column_List"/> | 466 | <include refid="Base_Column_List"/> |
467 | from driver_info | 467 | from driver_info |
468 | <where> | 468 | <where> |
469 | - <trim suffixOverrides=","> | ||
470 | <!-- 驾驶员,姓名 --> | 469 | <!-- 驾驶员,姓名 --> |
471 | <if test="driverName != null and driverName != ''"> | 470 | <if test="driverName != null and driverName != ''"> |
472 | - driver_name = #{driverName,jdbcType=VARCHAR}, | 471 | + driver_name = #{driverName,jdbcType=VARCHAR} |
473 | </if> | 472 | </if> |
474 | <!-- 驾驶员,联系方式 --> | 473 | <!-- 驾驶员,联系方式 --> |
475 | <if test="driverMobile != null and driverMobile != ''"> | 474 | <if test="driverMobile != null and driverMobile != ''"> |
476 | - AND driver_mobile = #{driverMobile,jdbcType=VARCHAR}, | 475 | + AND driver_mobile = #{driverMobile,jdbcType=VARCHAR} |
477 | </if> | 476 | </if> |
478 | <!-- 驾驶员,所属公司 --> | 477 | <!-- 驾驶员,所属公司 --> |
479 | <if test="driverCompany != null and driverCompany != ''"> | 478 | <if test="driverCompany != null and driverCompany != ''"> |
480 | - AND driver_company = #{driverCompany,jdbcType=VARCHAR}, | 479 | + AND driver_company = #{driverCompany,jdbcType=VARCHAR} |
481 | </if> | 480 | </if> |
482 | <!-- 驾驶员,状态 --> | 481 | <!-- 驾驶员,状态 --> |
483 | <if test="driverStatus != null and driverStatus != ''"> | 482 | <if test="driverStatus != null and driverStatus != ''"> |
484 | AND driver_status = #{driverStatus,jdbcType=VARCHAR} | 483 | AND driver_status = #{driverStatus,jdbcType=VARCHAR} |
485 | </if> | 484 | </if> |
486 | - </trim> | ||
487 | </where> | 485 | </where> |
488 | - | ||
489 | </select> | 486 | </select> |
490 | </mapper> | 487 | </mapper> |
@@ -567,24 +567,23 @@ | @@ -567,24 +567,23 @@ | ||
567 | <include refid="Base_Column_List"/> | 567 | <include refid="Base_Column_List"/> |
568 | from vehicle_info | 568 | from vehicle_info |
569 | <where> | 569 | <where> |
570 | - <trim suffixOverrides=","> | ||
571 | <!-- 车牌号 --> | 570 | <!-- 车牌号 --> |
572 | <if test="licensePlateNumber != null and licensePlateNumber !=''"> | 571 | <if test="licensePlateNumber != null and licensePlateNumber !=''"> |
573 | - license_plate_number = #{licensePlateNumber,jdbcType=VARCHAR}, | 572 | + license_plate_number = #{licensePlateNumber,jdbcType=VARCHAR} |
574 | </if> | 573 | </if> |
575 | <!-- 车辆类型 --> | 574 | <!-- 车辆类型 --> |
576 | <if test="vehicleType != null and vehicleType != ''"> | 575 | <if test="vehicleType != null and vehicleType != ''"> |
577 | - AND vehicle_type = #{vehicleType,jdbcType=VARCHAR}, | 576 | + AND vehicle_type = #{vehicleType,jdbcType=VARCHAR} |
578 | </if> | 577 | </if> |
579 | <!-- 车辆状态 --> | 578 | <!-- 车辆状态 --> |
580 | <if test="vehicleStatus != null and vehicleStatus != ''"> | 579 | <if test="vehicleStatus != null and vehicleStatus != ''"> |
581 | - AND vehicle_status = #{vehicleStatus,jdbcType=VARCHAR}, | 580 | + AND vehicle_status = #{vehicleStatus,jdbcType=VARCHAR} |
582 | </if> | 581 | </if> |
583 | <!-- 所属公司 --> | 582 | <!-- 所属公司 --> |
584 | <if test="vehicleCompany != null and vehicleCompany != ''"> | 583 | <if test="vehicleCompany != null and vehicleCompany != ''"> |
585 | AND vehicle_company = #{vehicleCompany,jdbcType=VARCHAR} | 584 | AND vehicle_company = #{vehicleCompany,jdbcType=VARCHAR} |
586 | </if> | 585 | </if> |
587 | - </trim> | ||
588 | </where> | 586 | </where> |
587 | + order by freetime | ||
589 | </select> | 588 | </select> |
590 | </mapper> | 589 | </mapper> |
-
请 注册 或 登录 后发表评论