Commit 7d287e1b7f8714897430151c902a8f0aae7b4f5a
1 parent
f453fa53
fix: change get data step
Showing
4 changed files
with
37 additions
and
12 deletions
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
| ... | ... | @@ -42,13 +42,23 @@ public class DriverController extends BaseController { |
| 42 | 42 | /** |
| 43 | 43 | * 获取驾驶员排班信息 |
| 44 | 44 | */ |
| 45 | - @GetMapping("/{date}/{jobCode}") | |
| 45 | + @GetMapping("/{schedulingDate}/{jobCode}") | |
| 46 | 46 | @ApiOperation("获取驾驶员排班信息") |
| 47 | - public AjaxResult getDriverSchedulingInfo(@ApiParam(name = "date",value = "yyyyMMdd") @PathVariable("date") String date, @PathVariable("jobCode") String jobCode) { | |
| 48 | - return driverService.getDriverSchedulingInfo(date,jobCode); | |
| 47 | + public AjaxResult getDriverSchedulingInfo(@ApiParam(name = "date",value = "yyyyMMdd",type = "String") @PathVariable("schedulingDate") String schedulingDate, @PathVariable("jobCode") String jobCode) { | |
| 48 | + return driverService.getDriverSchedulingInfo(schedulingDate,jobCode); | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | + * 获取当前所有有班次信息的工号集合 | |
| 53 | + */ | |
| 54 | + @GetMapping("/getDriverSchedulingAll") | |
| 55 | + @ApiOperation("获取当前所有有班次信息的工号集合") | |
| 56 | + public AjaxResult getDriverSchedulingAll(){ | |
| 57 | + return driverService.getDriverSchedulingAll(); | |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + /** | |
| 52 | 62 | * 查询驾驶员信息列表 |
| 53 | 63 | */ |
| 54 | 64 | // @PreAuthorize("@ss.hasPermi('driver:driver:list')") | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
| ... | ... | @@ -69,7 +69,10 @@ public interface IDriverService |
| 69 | 69 | */ |
| 70 | 70 | void insertDrivers(List<Driver> driverList); |
| 71 | 71 | |
| 72 | - AjaxResult getDriverSchedulingInfo(String date,String jobCode); | |
| 72 | + AjaxResult getDriverSchedulingInfo(String schedulingDate,String jobCode); | |
| 73 | 73 | |
| 74 | 74 | void saveDriverScheduling(Map<String, List<ResponseScheduling>> driverSchedulingMap); |
| 75 | + | |
| 76 | + AjaxResult getDriverSchedulingAll(); | |
| 77 | + | |
| 75 | 78 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import java.util.*; |
| 4 | 4 | |
| 5 | 5 | import com.ruoyi.common.core.domain.AjaxResult; |
| 6 | 6 | import com.ruoyi.common.core.redis.RedisCache; |
| 7 | +import com.ruoyi.common.utils.DateUtils; | |
| 7 | 8 | import com.ruoyi.common.utils.SecurityUtils; |
| 8 | 9 | import com.ruoyi.pojo.response.ResponseScheduling; |
| 9 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -100,14 +101,15 @@ public class DriverServiceImpl implements IDriverService { |
| 100 | 101 | } |
| 101 | 102 | |
| 102 | 103 | @Override |
| 103 | - public AjaxResult getDriverSchedulingInfo(String date, String jobCode) { | |
| 104 | - List<ResponseScheduling> cacheMapValue = redisCache.getCacheMapValue(DRIVER_SCHEDULING_PRE + date, jobCode); | |
| 105 | - // 优先从缓存中读取 | |
| 106 | - if (cacheMapValue != null && cacheMapValue.size() > 0) { | |
| 107 | - return AjaxResult.success(cacheMapValue); | |
| 108 | - } | |
| 104 | + public AjaxResult getDriverSchedulingInfo(String schedulingDate, String jobCode) { | |
| 105 | +// String key = DRIVER_SCHEDULING_PRE + schedulingDate; | |
| 106 | +// List<ResponseScheduling> cacheMapValue = redisCache.getCacheMapValue(key , jobCode); | |
| 107 | +// // 优先从缓存中读取 | |
| 108 | +// if (cacheMapValue != null && cacheMapValue.size() > 0) { | |
| 109 | +// return AjaxResult.success(cacheMapValue); | |
| 110 | +// } | |
| 109 | 111 | // 数据库中读取所有接收到的排班信息 |
| 110 | - List<ResponseScheduling> responseSchedulings = driverMapper.getDriverSchedulingList(date, jobCode); | |
| 112 | + List<ResponseScheduling> responseSchedulings = driverMapper.getDriverSchedulingList(schedulingDate, jobCode); | |
| 111 | 113 | // 缓存中读取当天的排班信息 |
| 112 | 114 | return AjaxResult.success(responseSchedulings); |
| 113 | 115 | } |
| ... | ... | @@ -120,4 +122,10 @@ public class DriverServiceImpl implements IDriverService { |
| 120 | 122 | } |
| 121 | 123 | |
| 122 | 124 | } |
| 125 | + | |
| 126 | + @Override | |
| 127 | + public AjaxResult getDriverSchedulingAll() { | |
| 128 | + Set yyyyMMdd = redisCache.redisTemplate.opsForHash().keys(DateUtils.getDate("yyyyMMdd")); | |
| 129 | + return AjaxResult.success(yyyyMMdd); | |
| 130 | + } | |
| 123 | 131 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| ... | ... | @@ -19,6 +19,7 @@ import javax.annotation.Resource; |
| 19 | 19 | import java.security.MessageDigest; |
| 20 | 20 | import java.util.*; |
| 21 | 21 | import java.util.concurrent.TimeUnit; |
| 22 | +import java.util.stream.Collectors; | |
| 22 | 23 | |
| 23 | 24 | import static com.ruoyi.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; |
| 24 | 25 | |
| ... | ... | @@ -131,7 +132,10 @@ public class DriverJob implements InitializingBean { |
| 131 | 132 | HttpMethod.GET, |
| 132 | 133 | null, |
| 133 | 134 | new ParameterizedTypeReference<List<Driver>>() { |
| 134 | - }).getBody(); | |
| 135 | + }).getBody().stream().map(item ->{ | |
| 136 | + item.setJobCode(item.getJobCode().split("-")[1]); | |
| 137 | + return item; | |
| 138 | + }).collect(Collectors.toList()); | |
| 135 | 139 | return drivers; |
| 136 | 140 | } |
| 137 | 141 | ... | ... |