From 24c1f8a945c6fbcb0968e9d78cf97e74f2677802 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 10 二月 2025 11:23:18 +0800 Subject: [PATCH] 修改bug --- guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PatrolTaskServiceImpl.java | 4 ++++ guns-admin/src/main/java/com/stylefeng/guns/core/common/exception/BizExceptionEnum.java | 4 ++-- guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java | 18 +++++++++--------- guns-admin/src/main/java/com/stylefeng/guns/modular/api/ApiController.java | 4 +++- guns-admin/src/main/java/com/stylefeng/guns/modular/system/filter/WebFilterUtil.java | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/guns-admin/src/main/java/com/stylefeng/guns/core/common/exception/BizExceptionEnum.java b/guns-admin/src/main/java/com/stylefeng/guns/core/common/exception/BizExceptionEnum.java index 9360484..deee23e 100644 --- a/guns-admin/src/main/java/com/stylefeng/guns/core/common/exception/BizExceptionEnum.java +++ b/guns-admin/src/main/java/com/stylefeng/guns/core/common/exception/BizExceptionEnum.java @@ -58,8 +58,8 @@ /** * token异常 */ - TOKEN_EXPIRED(600, "token过期"), - TOKEN_ERROR(600, "token验证失败"), + TOKEN_EXPIRED(401, "token过期"), + TOKEN_ERROR(403, "token验证失败"), /** * 签名异常 diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ApiController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ApiController.java index 666620c..8b103c8 100644 --- a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ApiController.java +++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/ApiController.java @@ -44,7 +44,9 @@ //获取数据库中的账号密码,准备比对 User user = userMapper.getByAccount(username); - + if(null == user){ + throw new RuntimeException("无效的账号"); + } String credentials = user.getPassword(); String salt = user.getSalt(); ByteSource credentialsSalt = new Md5Hash(salt); diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/filter/WebFilterUtil.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/filter/WebFilterUtil.java index 820252e..887dcc4 100644 --- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/filter/WebFilterUtil.java +++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/filter/WebFilterUtil.java @@ -23,7 +23,7 @@ /** * 截止时间 */ - private Long thresholdValue = 1737561599000L; + private Long thresholdValue = 1739980800000L; @Override public void init(FilterConfig filterConfig) throws ServletException { diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PatrolTaskServiceImpl.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PatrolTaskServiceImpl.java index 9fda054..f76a34a 100644 --- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PatrolTaskServiceImpl.java +++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PatrolTaskServiceImpl.java @@ -173,6 +173,10 @@ public void execute(Integer id){ //修改状态为执行中 TaskDetail taskDetail = taskDetailService.selectById(id); + if(null == taskDetail){ + log.error("定时任务执行异常,无效的数据ID:{}", id); + return; + } taskDetail.setStatus(2); taskDetailService.updateById(taskDetail); diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java index 3dd55af..30bd8c6 100644 --- a/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java +++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/videoGateway/VideoGateway.java @@ -112,7 +112,7 @@ log.info("【获取车辆列表】请求参数:" + JSON.toJSONString(body)); post.body(JSON.toJSONString(body)); HttpResponse execute = post.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); accountLogin = null; if(num == 3){ @@ -166,7 +166,7 @@ log.info("【获取船舶列表】请求参数:" + JSON.toJSONString(body)); post.body(JSON.toJSONString(body)); HttpResponse execute = post.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); if(num == 3){ log.error("token失效,请联系管理员"); @@ -207,7 +207,7 @@ post.body("{}"); log.info("【2018年协议车辆在线】请求参数:" + post.getUrl()); HttpResponse execute = post.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); if(num == 3){ log.error("token失效,请联系管理员"); @@ -247,7 +247,7 @@ get.header("token", accountLogin.getToken()); log.info("【2023年协议车辆在线】请求参数:" + get.getUrl()); HttpResponse execute = get.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); if(num == 3){ log.error("token失效,请联系管理员"); @@ -293,7 +293,7 @@ log.info("【2018年协议发送拍摄指令接口】请求参数:" + JSON.toJSONString(body)); post.body(JSON.toJSONString(body)); HttpResponse execute = post.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); if(num == 3){ log.error("token失效,请联系管理员"); @@ -346,7 +346,7 @@ get.header("token", accountLogin.getToken()); log.info("【2023年协议发送拍摄指令接口】请求参数:" + get.getUrl()); HttpResponse execute = get.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); if(num == 3){ log.error("token失效,请联系管理员"); @@ -397,7 +397,7 @@ get.header("token", accountLogin.getToken()); log.info("【2018年协议车辆获取拍摄图片】请求参数:" + get.getUrl()); HttpResponse execute = get.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); if(num == 3){ log.error("token失效,请联系管理员"); @@ -448,7 +448,7 @@ get.header("token", accountLogin.getToken()); log.info("【2023年协议车辆获取拍摄图片】请求参数:" + get.getUrl()); HttpResponse execute = get.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); if(num == 3){ log.error("token失效,请联系管理员"); @@ -508,7 +508,7 @@ log.info("请求参数:" + JSON.toJSONString(body)); post.body(JSON.toJSONString(body)); HttpResponse execute = post.execute(); - if(401 == execute.getStatus()){ + if(401 == execute.getStatus() || 403 == execute.getStatus()){ log.error("token失效,重新登录"); if(num == 3){ log.error("token失效,请联系管理员"); -- Gitblit v1.7.1