Commit 0b2bc2efe547661465fafd6d952ca7243eed9ddb
1 parent
db899468
fix: 修改缓存数据
Showing
3 changed files
with
21 additions
and
4 deletions
Bsth-admin/src/main/java/com/ruoyi/driver/mapper/DriverSchedulingMapper.java
| 1 | package com.ruoyi.driver.mapper; | 1 | package com.ruoyi.driver.mapper; |
| 2 | 2 | ||
| 3 | import com.ruoyi.domain.DriverScheduling; | 3 | import com.ruoyi.domain.DriverScheduling; |
| 4 | +import com.ruoyi.driver.domain.Driver; | ||
| 4 | import org.apache.ibatis.annotations.Param; | 5 | import org.apache.ibatis.annotations.Param; |
| 5 | import org.apache.ibatis.annotations.Select; | 6 | import org.apache.ibatis.annotations.Select; |
| 6 | 7 | ||
| @@ -28,4 +29,5 @@ public interface DriverSchedulingMapper { | @@ -28,4 +29,5 @@ public interface DriverSchedulingMapper { | ||
| 28 | @Select("select count(*) from equipment") | 29 | @Select("select count(*) from equipment") |
| 29 | Integer queryNumberByDevice(); | 30 | Integer queryNumberByDevice(); |
| 30 | 31 | ||
| 32 | + void updateDriverInfo(@Param("driver") Driver driver,@Param("date")String date); | ||
| 31 | } | 33 | } |
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| @@ -75,6 +75,12 @@ public class DriverServiceImpl implements IDriverService { | @@ -75,6 +75,12 @@ public class DriverServiceImpl implements IDriverService { | ||
| 75 | 75 | ||
| 76 | private Logger log = LoggerFactory.getLogger(DriverServiceImpl.class); | 76 | private Logger log = LoggerFactory.getLogger(DriverServiceImpl.class); |
| 77 | 77 | ||
| 78 | + @Resource | ||
| 79 | + private NowSchedulingCache cache; | ||
| 80 | + | ||
| 81 | + @Autowired | ||
| 82 | + private SchedulingService schedulingService; | ||
| 83 | + | ||
| 78 | @Autowired | 84 | @Autowired |
| 79 | private ISysNoticeService noticeService; | 85 | private ISysNoticeService noticeService; |
| 80 | 86 | ||
| @@ -89,10 +95,6 @@ public class DriverServiceImpl implements IDriverService { | @@ -89,10 +95,6 @@ public class DriverServiceImpl implements IDriverService { | ||
| 89 | 95 | ||
| 90 | @Resource | 96 | @Resource |
| 91 | private NowSchedulingCache nowSchedulingCache; | 97 | private NowSchedulingCache nowSchedulingCache; |
| 92 | - | ||
| 93 | - @Resource | ||
| 94 | - private SchedulingService schedulingService; | ||
| 95 | - | ||
| 96 | @Autowired | 98 | @Autowired |
| 97 | private EquipmentMapper equipmentMapper; | 99 | private EquipmentMapper equipmentMapper; |
| 98 | @Autowired | 100 | @Autowired |
| @@ -212,6 +214,16 @@ public class DriverServiceImpl implements IDriverService { | @@ -212,6 +214,16 @@ public class DriverServiceImpl implements IDriverService { | ||
| 212 | @Override | 214 | @Override |
| 213 | public int updateDriver(Driver driver) { | 215 | public int updateDriver(Driver driver) { |
| 214 | driver.setUpdateTime(new Date()); | 216 | driver.setUpdateTime(new Date()); |
| 217 | + // 修改排班表scheduling 以及缓存信息 | ||
| 218 | + List<DriverScheduling> driverSchedulings = cache.getCacheScheduling(ConstDateUtil.getStringNowLocalDate("-")).get(driver.getJobCode()); | ||
| 219 | + for (DriverScheduling scheduling : driverSchedulings) { | ||
| 220 | + if (StringUtil.isNotEmpty(driver.getPosts())){ | ||
| 221 | + scheduling.setPosts(driver.getPosts()); | ||
| 222 | + } | ||
| 223 | + if (StringUtil.isNotEmpty(driver.getFleetName())){ | ||
| 224 | + scheduling.setFleetName(driver.getFleetName()); | ||
| 225 | + } | ||
| 226 | + } | ||
| 215 | return driverMapper.updateDriver(driver); | 227 | return driverMapper.updateDriver(driver); |
| 216 | } | 228 | } |
| 217 | 229 |
Bsth-admin/src/main/java/com/ruoyi/service/SchedulingService.java
| @@ -3,6 +3,7 @@ package com.ruoyi.service; | @@ -3,6 +3,7 @@ package com.ruoyi.service; | ||
| 3 | import cn.hutool.core.collection.CollectionUtil; | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | import com.ruoyi.common.cache.NowSchedulingCache; | 4 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 5 | import com.ruoyi.common.utils.DateUtils; | 5 | import com.ruoyi.common.utils.DateUtils; |
| 6 | +import com.ruoyi.driver.domain.Driver; | ||
| 6 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; | 7 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 7 | import com.ruoyi.in.domain.SignIn; | 8 | import com.ruoyi.in.domain.SignIn; |
| 8 | import com.ruoyi.in.mapper.SignInMapper; | 9 | import com.ruoyi.in.mapper.SignInMapper; |
| @@ -346,4 +347,6 @@ public class SchedulingService { | @@ -346,4 +347,6 @@ public class SchedulingService { | ||
| 346 | public List<DriverScheduling> queryToDay(String date) { | 347 | public List<DriverScheduling> queryToDay(String date) { |
| 347 | return schedulingMapper.queryToDay(date, null, null, null); | 348 | return schedulingMapper.queryToDay(date, null, null, null); |
| 348 | } | 349 | } |
| 350 | + | ||
| 351 | + | ||
| 349 | } | 352 | } |