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 | 1 | package com.ruoyi.driver.mapper; |
| 2 | 2 | |
| 3 | 3 | import com.ruoyi.domain.DriverScheduling; |
| 4 | +import com.ruoyi.driver.domain.Driver; | |
| 4 | 5 | import org.apache.ibatis.annotations.Param; |
| 5 | 6 | import org.apache.ibatis.annotations.Select; |
| 6 | 7 | |
| ... | ... | @@ -28,4 +29,5 @@ public interface DriverSchedulingMapper { |
| 28 | 29 | @Select("select count(*) from equipment") |
| 29 | 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 | 75 | |
| 76 | 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 | 84 | @Autowired |
| 79 | 85 | private ISysNoticeService noticeService; |
| 80 | 86 | |
| ... | ... | @@ -89,10 +95,6 @@ public class DriverServiceImpl implements IDriverService { |
| 89 | 95 | |
| 90 | 96 | @Resource |
| 91 | 97 | private NowSchedulingCache nowSchedulingCache; |
| 92 | - | |
| 93 | - @Resource | |
| 94 | - private SchedulingService schedulingService; | |
| 95 | - | |
| 96 | 98 | @Autowired |
| 97 | 99 | private EquipmentMapper equipmentMapper; |
| 98 | 100 | @Autowired |
| ... | ... | @@ -212,6 +214,16 @@ public class DriverServiceImpl implements IDriverService { |
| 212 | 214 | @Override |
| 213 | 215 | public int updateDriver(Driver driver) { |
| 214 | 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 | 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 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | 4 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 5 | 5 | import com.ruoyi.common.utils.DateUtils; |
| 6 | +import com.ruoyi.driver.domain.Driver; | |
| 6 | 7 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 7 | 8 | import com.ruoyi.in.domain.SignIn; |
| 8 | 9 | import com.ruoyi.in.mapper.SignInMapper; |
| ... | ... | @@ -346,4 +347,6 @@ public class SchedulingService { |
| 346 | 347 | public List<DriverScheduling> queryToDay(String date) { |
| 347 | 348 | return schedulingMapper.queryToDay(date, null, null, null); |
| 348 | 349 | } |
| 350 | + | |
| 351 | + | |
| 349 | 352 | } | ... | ... |