Commit 2577347518b39ea4a2032b3d3bcef66ffccddc53
1 parent
e93c7f0e
feat: 修改测试工号
Showing
5 changed files
with
80 additions
and
8 deletions
Bsth-admin/src/main/java/com/ruoyi/common/cache/TempCache.java
0 → 100644
| 1 | +package com.ruoyi.common.cache; | |
| 2 | + | |
| 3 | + | |
| 4 | +import java.util.Objects; | |
| 5 | +import java.util.concurrent.ConcurrentHashMap; | |
| 6 | + | |
| 7 | +public class TempCache { | |
| 8 | + private static ConcurrentHashMap<String, Boolean> map = null; | |
| 9 | + | |
| 10 | + static { | |
| 11 | + map = new ConcurrentHashMap<>(); | |
| 12 | + map.put("620001", true); | |
| 13 | + map.put("620002", true); | |
| 14 | + map.put("700001", true); | |
| 15 | + map.put("722717", true); | |
| 16 | + } | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * false 代表签到 | |
| 20 | + * | |
| 21 | + * @param jobCode | |
| 22 | + * @return | |
| 23 | + */ | |
| 24 | + public static Boolean querySignStatus(String jobCode) { | |
| 25 | + return map.get(jobCode); | |
| 26 | + } | |
| 27 | + | |
| 28 | + public static void updateSignStatus(String jobCode) { | |
| 29 | + map.put(jobCode, !map.get(jobCode)); | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 是否测试工号 | |
| 34 | + * | |
| 35 | + * @param jobCode | |
| 36 | + * @return | |
| 37 | + */ | |
| 38 | + public static Boolean checkJobCodeExist(String jobCode) { | |
| 39 | + return !Objects.isNull(map.get(jobCode)); | |
| 40 | + } | |
| 41 | + | |
| 42 | + public static void resetMapStatus() { | |
| 43 | + map.put("620001", true); | |
| 44 | + map.put("620002", true); | |
| 45 | + map.put("700001", true); | |
| 46 | + map.put("722717", true); | |
| 47 | + } | |
| 48 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| ... | ... | @@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| 17 | 17 | import com.github.pagehelper.util.StringUtil; |
| 18 | 18 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 19 | 19 | import com.ruoyi.common.cache.SchedulingCache; |
| 20 | +import com.ruoyi.common.cache.TempCache; | |
| 20 | 21 | import com.ruoyi.common.config.RuoYiConfig; |
| 21 | 22 | import com.ruoyi.common.core.domain.AjaxResult; |
| 22 | 23 | import com.ruoyi.common.core.redis.RedisCache; |
| ... | ... | @@ -380,20 +381,32 @@ public class DriverServiceImpl implements IDriverService { |
| 380 | 381 | for (Driver item : drivers) { |
| 381 | 382 | dto = schedulingService.queryScheduling(item.getJobCode(), now); |
| 382 | 383 | DriverResponseVo vo = handlerRecommendation(item, now, dto, schedulingFlag, alcoholFlag); |
| 383 | - // TODO 针对指定用户操作 | |
| 384 | - if (item.getJobCode().equals("722717") || item.getJobCode().equals("700001")) { | |
| 385 | - if (!CollectionUtil.isEmpty(dto) && vo.getPlanAction().equals(SIGN_IN_STRING)) { | |
| 386 | - vos.add(DriverResponseVo.createDriverResponseVo(null, item, SIGN_IN_STRING, needCheckAlcoholDevice, true, "测试", "测试", "测试")); | |
| 387 | - } else if (!CollectionUtil.isEmpty(dto)) { | |
| 384 | + // TODO 针对指定用户测试操作 | |
| 385 | + if (TempCache.checkJobCodeExist(item.getJobCode())) { | |
| 386 | + if (!CollectionUtil.isEmpty(dto)) { | |
| 387 | + vo.setPlanAction(TempCache.querySignStatus(item.getJobCode()) ? SIGN_IN_STRING : SIGN_IN_OUT_STRING); | |
| 388 | + vo.setCheckAlcohol(TempCache.querySignStatus(item.getJobCode())); | |
| 389 | +// vo.setCheckAlcohol(false); | |
| 388 | 390 | vos.add(vo); |
| 389 | - } else { | |
| 390 | - vos.add(DriverResponseVo.createDriverResponseVo(null, item, SIGN_IN_STRING, needCheckAlcoholDevice, true, "测试", "测试", "测试")); | |
| 391 | + } | |
| 392 | +// if (!CollectionUtil.isEmpty(dto) && vo.getPlanAction().equals(SIGN_IN_STRING)) { | |
| 393 | +// vos.add(DriverResponseVo.createDriverResponseVo(null, item, SIGN_IN_STRING, needCheckAlcoholDevice, true, "测试", "测试", "测试")); | |
| 394 | +// } | |
| 395 | +// else if (!CollectionUtil.isEmpty(dto)) { | |
| 396 | +// vos.add(vo); | |
| 397 | +// } | |
| 398 | + else { | |
| 399 | + vos.add(DriverResponseVo.createDriverResponseVo(null, item, | |
| 400 | + TempCache.querySignStatus(item.getJobCode()) ? SIGN_IN_STRING : SIGN_IN_OUT_STRING, | |
| 401 | + needCheckAlcoholDevice ? TempCache.querySignStatus(item.getJobCode()) : false, | |
| 402 | +// false, | |
| 403 | + true, "测试", "测试", "测试")); | |
| 391 | 404 | } |
| 392 | 405 | // 上面可删除 |
| 393 | 406 | } else { |
| 394 | 407 | // 无排班 工种是驾驶员需要酒测 |
| 395 | 408 | if (Objects.isNull(vo)) { |
| 396 | - vos.add(DriverResponseVo.createDriverResponseVo(null, item, null, "驾驶员".equals(item.getPosts()), false, "", "", "")); | |
| 409 | + vos.add(DriverResponseVo.createDriverResponseVo(null, item, null, DRIVER_STRING.equals(item.getPosts()), false, "", "", "")); | |
| 397 | 410 | } else { |
| 398 | 411 | // 特定设备是无需酒精测试的 |
| 399 | 412 | vo.setCheckAlcohol(needCheckAlcoholDevice ? vo.getCheckAlcohol() : false); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| ... | ... | @@ -14,6 +14,7 @@ import java.util.stream.Collectors; |
| 14 | 14 | import cn.hutool.core.collection.CollectionUtil; |
| 15 | 15 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 16 | 16 | import com.ruoyi.common.cache.SchedulingCache; |
| 17 | +import com.ruoyi.common.cache.TempCache; | |
| 17 | 18 | import com.ruoyi.common.config.RuoYiConfig; |
| 18 | 19 | import com.ruoyi.common.constant.Constants; |
| 19 | 20 | import com.ruoyi.common.core.domain.AjaxResult; |
| ... | ... | @@ -173,6 +174,10 @@ public class SignInServiceImpl implements ISignInService { |
| 173 | 174 | // 更新考勤 |
| 174 | 175 | schedulingService.computedSignInBySignIn(dto, signIn, globalIndex); |
| 175 | 176 | |
| 177 | + if (TempCache.checkJobCodeExist(signIn.getJobCode())) { | |
| 178 | + TempCache.updateSignStatus(signIn.getJobCode()); | |
| 179 | + } | |
| 180 | + | |
| 176 | 181 | // 异常保存到异常异常中 |
| 177 | 182 | threadJobService.asyncInsertExceptionRecord(signIn, driver, dto, globalIndex); |
| 178 | 183 | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/ThreadJobService.java
| ... | ... | @@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil; |
| 5 | 5 | import cn.hutool.http.HttpUtil; |
| 6 | 6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 7 | 7 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 8 | +import com.ruoyi.common.cache.TempCache; | |
| 8 | 9 | import com.ruoyi.common.config.RuoYiConfig; |
| 9 | 10 | import com.ruoyi.common.exception.file.FileUploadException; |
| 10 | 11 | import com.ruoyi.common.utils.DateUtils; |
| ... | ... | @@ -407,6 +408,8 @@ public class ThreadJobService { |
| 407 | 408 | log.info("已有数据,当天排班数据长度:{}", originSchedulingMap.size()); |
| 408 | 409 | return; |
| 409 | 410 | } |
| 411 | + // TODO maybe delete | |
| 412 | + TempCache.resetMapStatus(); | |
| 410 | 413 | List<DriverScheduling> bcList = getBcList(originSchedulingMap); |
| 411 | 414 | |
| 412 | 415 | // 处理非司售人员的排班明细 | ... | ... |