Commit 7330037d7392cad00dea6bd3a237d0c274c3072f
1 parent
f23b8ae6
fix: 新增清除异常接口
Showing
6 changed files
with
47 additions
and
12 deletions
ruoyi-admin/src/main/java/com/ruoyi/common/redispre/GlobalRedisPreName.java
ruoyi-admin/src/main/java/com/ruoyi/driver/controller/DriverController.java
| ... | ... | @@ -211,4 +211,14 @@ public class DriverController extends BaseController { |
| 211 | 211 | return driverService.faceRegistrationFeedback(vo.getDeviceId(), vo.getJobCodes()); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | + /** | |
| 215 | + * 清除指定工号异常记录 | |
| 216 | + */ | |
| 217 | + @ApiOperation("清除指定工号异常记录") | |
| 218 | + @DeleteMapping("/clear/{jobCode}") | |
| 219 | + public AjaxResult clearExceptionRecordByJobCode(@PathVariable("jobCode") String jobCode) { | |
| 220 | + driverService.clearExceptionRecordByJobCode(jobCode); | |
| 221 | + return AjaxResult.success("清除成功"); | |
| 222 | + } | |
| 223 | + | |
| 214 | 224 | } | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/driver/service/IDriverService.java
ruoyi-admin/src/main/java/com/ruoyi/driver/service/impl/DriverServiceImpl.java
| ... | ... | @@ -47,6 +47,7 @@ import static com.ruoyi.common.ApiProperties.PERSONNEL_API_KEY; |
| 47 | 47 | import static com.ruoyi.common.ConstSignInConstSignInProperties.SIGN_FACE_ACTIVE; |
| 48 | 48 | import static com.ruoyi.common.global.ResultCode.CODE_207; |
| 49 | 49 | import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; |
| 50 | +import static com.ruoyi.common.redispre.GlobalRedisPreName.REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW; | |
| 50 | 51 | |
| 51 | 52 | /** |
| 52 | 53 | * 驾驶员信息Service业务层处理 |
| ... | ... | @@ -374,6 +375,13 @@ public class DriverServiceImpl implements IDriverService { |
| 374 | 375 | driverMapper.updateDriverInfoByJobCodes(drivers); |
| 375 | 376 | } |
| 376 | 377 | |
| 378 | + @Override | |
| 379 | + public void clearExceptionRecordByJobCode(String jobCode) { | |
| 380 | + String dateKey = REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW + ConstDateUtil.formatDate(new Date()); | |
| 381 | + log.info("在:{}时间工号:{}的异常记录被清除了",dateKey,jobCode); | |
| 382 | + redisCache.deleteCacheMapValue(dateKey,jobCode); | |
| 383 | + } | |
| 384 | + | |
| 377 | 385 | /** |
| 378 | 386 | * 获取新的imageUrl |
| 379 | 387 | * | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/in/service/impl/SignInServiceImpl.java
| ... | ... | @@ -180,10 +180,6 @@ public class SignInServiceImpl implements ISignInService { |
| 180 | 180 | SignInResponseVo vo = getSignInResponseVo(signIn, equipment); |
| 181 | 181 | signIn.setCreateTime(new Date()); |
| 182 | 182 | signIn.setRemark(""); |
| 183 | - // 测试用户特殊处理 | |
| 184 | - if (signIn.getJobCode().equals("700002") || signIn.getJobCode().equals("700001")) { | |
| 185 | - return AjaxResult.success(SIGN_IN_SUCCESS_STRING, vo); | |
| 186 | - } | |
| 187 | 183 | // 签到检查 |
| 188 | 184 | if (checkSignIn(signIn, driver)) { |
| 189 | 185 | signIn.setStatus(SIGN_IN_SUCCESS); |
| ... | ... | @@ -195,6 +191,11 @@ public class SignInServiceImpl implements ISignInService { |
| 195 | 191 | |
| 196 | 192 | uploadImage(signIn); |
| 197 | 193 | signInMapper.insertSignIn(signIn); |
| 194 | + | |
| 195 | + // 测试用户特殊处理 | |
| 196 | + if (signIn.getJobCode().equals("700002") || signIn.getJobCode().equals("700001")) { | |
| 197 | + return AjaxResult.success(SIGN_IN_SUCCESS_STRING, vo); | |
| 198 | + } | |
| 198 | 199 | // TODO redis 存储每个人的签到 用于后续考勤 |
| 199 | 200 | |
| 200 | 201 | // 驾驶人员二次签到酒精测试异常 |
| ... | ... | @@ -278,6 +279,8 @@ public class SignInServiceImpl implements ISignInService { |
| 278 | 279 | // 查询数据库 |
| 279 | 280 | result = true; |
| 280 | 281 | break; |
| 282 | + default: | |
| 283 | + break; | |
| 281 | 284 | } |
| 282 | 285 | |
| 283 | 286 | // 超时校验司售人员 | ... | ... |
ruoyi-admin/src/main/java/com/ruoyi/job/DriverJob.java
| ... | ... | @@ -30,8 +30,7 @@ import java.util.*; |
| 30 | 30 | import java.util.concurrent.TimeUnit; |
| 31 | 31 | import java.util.stream.Collectors; |
| 32 | 32 | |
| 33 | -import static com.ruoyi.common.redispre.GlobalRedisPreName.DRIVER_SCHEDULING_PRE; | |
| 34 | -import static com.ruoyi.common.redispre.GlobalRedisPreName.REDIS_PERSONNEL_TOKEN; | |
| 33 | +import static com.ruoyi.common.redispre.GlobalRedisPreName.*; | |
| 35 | 34 | |
| 36 | 35 | /** |
| 37 | 36 | * 该定时任务用户获取驾驶员信息 |
| ... | ... | @@ -159,6 +158,21 @@ public class DriverJob implements InitializingBean { |
| 159 | 158 | return result; |
| 160 | 159 | } |
| 161 | 160 | |
| 161 | + public void clearExceptionYesterdayRecord() { | |
| 162 | + // 获取当前日期时间 | |
| 163 | + Calendar calendar = Calendar.getInstance(); | |
| 164 | + | |
| 165 | + // 将日期减去一天 | |
| 166 | + calendar.add(Calendar.DAY_OF_MONTH, -1); | |
| 167 | + | |
| 168 | + // 获取昨天的日期时间 | |
| 169 | + Date yesterday = calendar.getTime(); | |
| 170 | + String dateKey = REDIS_SIGN_IN_DRIVER_ALCOHOL_OVERFLOW + ConstDateUtil.formatDate(yesterday); | |
| 171 | + log.info("开始清除昨天的异常数据:{}", dateKey); | |
| 172 | + REDIS_CACHE.deleteObject(dateKey); | |
| 173 | + log.info("清除昨天的异常数据完成:{}", dateKey); | |
| 174 | + } | |
| 175 | + | |
| 162 | 176 | /** |
| 163 | 177 | * 获取排班任务请求 |
| 164 | 178 | * 24小时执行一次 |
| ... | ... | @@ -166,11 +180,11 @@ public class DriverJob implements InitializingBean { |
| 166 | 180 | public void getSchedulingInfo() { |
| 167 | 181 | long timestamp = System.currentTimeMillis(); |
| 168 | 182 | String formatDate = ConstDateUtil.formatDate(timestamp); |
| 169 | - log.info("获取排班任务触发时间:{}",formatDate); | |
| 183 | + log.info("获取排班任务触发时间:{}", formatDate); | |
| 170 | 184 | // 获取排班请求 |
| 171 | 185 | String getSchedulingInfoUrl = null; |
| 172 | 186 | |
| 173 | - log.info("开始获取{}的排班数据",formatDate); | |
| 187 | + log.info("开始获取{}的排班数据", formatDate); | |
| 174 | 188 | try { |
| 175 | 189 | getSchedulingInfoUrl = String.format(GET_SCHEDULING_INFO_URL, "99", formatDate, timestamp, NONCE, PASSWORD, getSHA1(getStringStringMap(String.valueOf(timestamp)))); |
| 176 | 190 | } catch (Exception e) { |
| ... | ... | @@ -179,7 +193,7 @@ public class DriverJob implements InitializingBean { |
| 179 | 193 | // 获取排班信息并存入redis |
| 180 | 194 | saveSchedulingToRedis(getSchedulingInfoUrl, formatDate); |
| 181 | 195 | |
| 182 | - log.info("获取{}的排班数据完毕",formatDate); | |
| 196 | + log.info("获取{}的排班数据完毕", formatDate); | |
| 183 | 197 | } |
| 184 | 198 | |
| 185 | 199 | /** |
| ... | ... | @@ -226,6 +240,7 @@ public class DriverJob implements InitializingBean { |
| 226 | 240 | return driverSchedulingMap; |
| 227 | 241 | } |
| 228 | 242 | |
| 243 | + | |
| 229 | 244 | public static void getDrivers(String accessToken) throws Exception { |
| 230 | 245 | // Map<String, String> configMap = getStringStringMap(timestamp); |
| 231 | 246 | // String sign = getSHA1(configMap); | ... | ... |