Commit 43c6277e3145678df06d8d54399b1036735d734b
1 parent
777fd955
fix: new add api getDriverSchedulingInfo
Showing
5 changed files
with
28 additions
and
8 deletions
ruoyi-admin/src/main/java/com/ruoyi/driver/mapper/DriverMapper.java
| @@ -68,4 +68,12 @@ public interface DriverMapper | @@ -68,4 +68,12 @@ public interface DriverMapper | ||
| 68 | void saveDrivers(@Param("drivers") List<Driver> driverList); | 68 | void saveDrivers(@Param("drivers") List<Driver> driverList); |
| 69 | 69 | ||
| 70 | void saveDriverScheduling(@Param("responseSchedulings") List<ResponseScheduling> responseSchedulings); | 70 | void saveDriverScheduling(@Param("responseSchedulings") List<ResponseScheduling> responseSchedulings); |
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 获取驾驶员排班信息 | ||
| 74 | + * @param date | ||
| 75 | + * @param jobCode | ||
| 76 | + * @return | ||
| 77 | + */ | ||
| 78 | + List<ResponseScheduling> getDriverSchedulingList(@Param("date") String date,@Param("jobCode") String jobCode); | ||
| 71 | } | 79 | } |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| 1 | package com.ruoyi.driver.service.impl; | 1 | package com.ruoyi.driver.service.impl; |
| 2 | 2 | ||
| 3 | -import java.util.ArrayList; | ||
| 4 | -import java.util.Collection; | ||
| 5 | -import java.util.List; | ||
| 6 | -import java.util.Map; | 3 | +import java.util.*; |
| 7 | 4 | ||
| 8 | import com.ruoyi.common.core.domain.AjaxResult; | 5 | import com.ruoyi.common.core.domain.AjaxResult; |
| 9 | import com.ruoyi.common.core.redis.RedisCache; | 6 | import com.ruoyi.common.core.redis.RedisCache; |
| @@ -105,8 +102,14 @@ public class DriverServiceImpl implements IDriverService { | @@ -105,8 +102,14 @@ public class DriverServiceImpl implements IDriverService { | ||
| 105 | @Override | 102 | @Override |
| 106 | public AjaxResult getDriverSchedulingInfo(String date, String jobCode) { | 103 | public AjaxResult getDriverSchedulingInfo(String date, String jobCode) { |
| 107 | List<ResponseScheduling> cacheMapValue = redisCache.getCacheMapValue(DRIVER_SCHEDULING_PRE + date, jobCode); | 104 | List<ResponseScheduling> cacheMapValue = redisCache.getCacheMapValue(DRIVER_SCHEDULING_PRE + date, jobCode); |
| 108 | - Boolean aBoolean = redisCache.redisTemplate.opsForHash().hasKey(DRIVER_SCHEDULING_PRE + date, jobCode); | ||
| 109 | - return AjaxResult.success(redisCache.getCacheMapValue(DRIVER_SCHEDULING_PRE + date, jobCode)); | 105 | + // 优先从缓存中读取 |
| 106 | + if (cacheMapValue != null && cacheMapValue.size() > 0) { | ||
| 107 | + return AjaxResult.success(redisCache.getCacheMapValue(DRIVER_SCHEDULING_PRE + date, jobCode)); | ||
| 108 | + } | ||
| 109 | + // 数据库中读取所有接收到的排班信息 | ||
| 110 | + List<ResponseScheduling> responseSchedulings = driverMapper.getDriverSchedulingList(date, jobCode); | ||
| 111 | + // 缓存中读取当天的排班信息 | ||
| 112 | + return AjaxResult.success(responseSchedulings); | ||
| 110 | } | 113 | } |
| 111 | 114 | ||
| 112 | @Override | 115 | @Override |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| @@ -212,6 +212,5 @@ public class DriverJob implements InitializingBean { | @@ -212,6 +212,5 @@ public class DriverJob implements InitializingBean { | ||
| 212 | DRIVER_SERVICE = driverService; | 212 | DRIVER_SERVICE = driverService; |
| 213 | REDIS_CACHE = redisCache; | 213 | REDIS_CACHE = redisCache; |
| 214 | GET_SCHEDULING_INFO_URL = getSchedulingInfoUrl; | 214 | GET_SCHEDULING_INFO_URL = getSchedulingInfoUrl; |
| 215 | - | ||
| 216 | } | 215 | } |
| 217 | } | 216 | } |
ruoyi-admin/src/main/java/com/ruoyi/pojo/response/ResponseScheduling.java
| @@ -41,5 +41,5 @@ public class ResponseScheduling { | @@ -41,5 +41,5 @@ public class ResponseScheduling { | ||
| 41 | private String adjustExps; | 41 | private String adjustExps; |
| 42 | private Boolean sflj; | 42 | private Boolean sflj; |
| 43 | private String remarks; | 43 | private String remarks; |
| 44 | -// private List<CTasks> cTasks; | 44 | + private List<CTasks> cTasks; |
| 45 | } | 45 | } |
| 46 | \ No newline at end of file | 46 | \ No newline at end of file |
ruoyi-admin/src/main/resources/mapper/driver/DriverMapper.xml
| @@ -78,6 +78,16 @@ | @@ -78,6 +78,16 @@ | ||
| 78 | <include refid="selectDriverVo"/> | 78 | <include refid="selectDriverVo"/> |
| 79 | where id = #{id} | 79 | where id = #{id} |
| 80 | </select> | 80 | </select> |
| 81 | + <select id="getDriverSchedulingList" resultType="com.ruoyi.pojo.response.ResponseScheduling"> | ||
| 82 | + select id, scheduleDate, lineName, lineCode, lpName, | ||
| 83 | + nbbm, job_code as jobCode,jsy, spy, upDown, qdzCode, | ||
| 84 | + qdzName, zdzCode, zdzName, fcsjT, dfsjT, | ||
| 85 | + zdsjT, fcsjActualTime, zdsjActualTime, | ||
| 86 | + jhlc, jhlcOrig, bcsj, bcType, status, adjustExps, | ||
| 87 | + sflj, remarks | ||
| 88 | + from driver_scheduling | ||
| 89 | + where scheduleDate = #{date} and job_code = #{jobCode} | ||
| 90 | + </select> | ||
| 81 | 91 | ||
| 82 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> | 92 | <insert id="insertDriver" parameterType="Driver" useGeneratedKeys="true" keyProperty="id"> |
| 83 | insert into driver | 93 | insert into driver |