459242451@qq.com 3 жил өмнө
parent
commit
e014fc1ea5

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhdd/PlanController.java

@@ -152,7 +152,7 @@ public class PlanController extends BaseController {
      * @return
      */
     @RepeatSubmit()
-    @GetMapping("/saveAndCreate")
+    @PostMapping("/saveAndCreate")
     @Security
     public AjaxResult savePlanAndCreate(@RequestBody JSONObject jsonObject) {
         String id = jsonObject.getStr("id");

+ 5 - 2
ruoyi-zhdd/src/main/java/com/ruoyi/zhdd/service/impl/DhServiceImpl.java

@@ -120,12 +120,12 @@ public class DhServiceImpl implements IDhService {
     public void tokenKeepalive(String token) {
         JSONObject json = new JSONObject();
         json.set("token", token);
-        json.set("duration", 120);
+        json.set("duration", 86400);
         String put = HttpRequest.put(keepaliveUrl).timeout(-1).body(json.toString()).execute().body();
         JSONObject putJson = JSONUtil.parseObj(put);
         if (putJson.getInt("code") == 200) {
             // 存入redis缓存
-            RedisUtils.setCacheObject(Constants.CACHE_DH_TOKEN, token, 120, TimeUnit.SECONDS);
+            RedisUtils.setCacheObject(Constants.CACHE_DH_TOKEN, token, 86400, TimeUnit.SECONDS);
         } else {
             log.info("保活失败:{}。重新获取", putJson);
             authorize();
@@ -205,6 +205,9 @@ public class DhServiceImpl implements IDhService {
         if (getJson.containsKey("code")) {
             // 说明有错误
             log.error("获取设备树出错:{}", getJson);
+            if (401 == getJson.getInt("code")) {
+                RedisUtils.deleteObject(Constants.CACHE_DH_TOKEN);
+            }
             throw new ServiceException("调用大华融合通信平台接口创建会话出错,错误:" + getJson.getStr("message"));
         }
         return getJson.getJSONArray("results");