From cce64e796b8dcfe6e2250c3bab1d6fed00561775 Mon Sep 17 00:00:00 2001 From: hanyuqing <1106611654@qq.com> Date: Sat, 6 Sep 2025 14:52:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gyxtp/src/view/create.vue | 146 +++++++---- .../controller/system/ZhyFileManageController.java | 2 +- .../com/ruoyi/api/controller/DocApiController.java | 282 +++++++++++++-------- 3 files changed, 277 insertions(+), 153 deletions(-) diff --git a/gyxtp/src/view/create.vue b/gyxtp/src/view/create.vue index 96a0ef9..f30c9ea 100644 --- a/gyxtp/src/view/create.vue +++ b/gyxtp/src/view/create.vue @@ -13,21 +13,29 @@
-
-
+
+
- + + + + + + + + +
-
-
+
+
@@ -57,20 +65,20 @@
-
-
+ +
+
-
-
-
+
-
+
-
-
-
+ +
- 构建 +
+ 构建 + 重置 +
+
@@ -379,7 +391,8 @@ export default { children: 'children', // 告诉组件:子节点字段名是 `children`(可省略,默认就是 children) disabled: 'disabled' // 可选:如果有禁用逻辑,可以加 }, - + messages:[], + input:[] }; }, @@ -413,22 +426,26 @@ export default { { id: res.g01.id, docTitle: res.g01.name, - children: res.g01.children + children: res.g01.children, + expanded: true }, { id: res.g02.id, docTitle: res.g02.name, - children: res.g02.children + children: res.g02.children, + }, { id: res.g03.id, docTitle: res.g03.name, - children: res.g03.children + children: res.g03.children, + }, { id: res.g04.id, docTitle: res.g04.name, - children: res.g04.children + children: res.g04.children, + }, ] this.cascadeOptions2 = [ @@ -697,13 +714,15 @@ export default { } .input-new-tag { - padding: 0px 12px; + padding: 0px 6px; border:none; border-radius: 4px; font-size: 14px; outline: none; height: 30px; margin-left: 0.5vw; + width: 160px; + border-radius: 2vw; } .input-new-tag:focus { @@ -736,28 +755,22 @@ export default { top: 5.4vw; background-color: #f3f7ff; position: absolute; + overflow: auto; } .input { width: 350px; margin-left: 3vw; - height: 30px; border-radius: 2vw; background-color: rgba(255, 255, 255, 0.65); border: 2px solid #0776ff; text-indent: 1vw; font-size: 1.2vw; margin-right: 15px; + padding: 5px 0px; } -.searchInfo { - margin-top: 8%; - position: relative; - display: flex; - justify-content: center; - -} .input::placeholder { height: 30px; @@ -858,5 +871,42 @@ export default { .vue-treeselect__multi-value-item { font-size: 16px; } +.module1{ + width: 600px;margin-bottom: 19px;display: flex;align-items: center; +} +.group0{ + + position: relative; + display: flex; + justify-content: center; + margin-bottom: 20px; +} +.group1{ + + position: relative; + display: flex; + justify-content: center; + margin-bottom: 20px; +} +.group2{ + + position: relative; + display: flex; + justify-content: center; + margin-bottom: 20px; +} +.module{ + height: 170px; + overflow: auto; +} +.group0 .module1:last-of-type { + margin-bottom: 0; +} +.group1 .module1:last-of-type { + margin-bottom: 0; +} +.group2 .module1:last-of-type { + margin-bottom: 0; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java index 6a04b2f..d6683b6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ZhyFileManageController.java @@ -703,7 +703,7 @@ public class ZhyFileManageController extends BaseController { } zhyFileManageService.wordSplitterOld(null , url +"\\wordSplitter", 0,list); - zhyFileManageService.createIndex(url + "\\wordSplitter", "D:\\project\\gyx\\tupudata\\fileManager\\index"); +// zhyFileManageService.createIndex(url + "\\wordSplitter", "D:\\project\\gyx\\tupudata\\fileManager\\index"); test1Mapper.updateParentId(list); diff --git a/ruoyi-api/src/main/java/com/ruoyi/api/controller/DocApiController.java b/ruoyi-api/src/main/java/com/ruoyi/api/controller/DocApiController.java index b764619..407f5f7 100644 --- a/ruoyi-api/src/main/java/com/ruoyi/api/controller/DocApiController.java +++ b/ruoyi-api/src/main/java/com/ruoyi/api/controller/DocApiController.java @@ -1084,104 +1084,89 @@ public class DocApiController extends BaseController { } @GetMapping("/getTitleByGroup") public Map getTitleByGroup(HttpServletRequest request) { - String token = request.getHeader("Token"); - if (!token.equals("")) { - token = tokenService.parseToken(token).get("login_user_key", String.class); - reushToken.DeletToken(token); - LoginUser loginUser1 = redisCache.getCacheObject("login_tokens:" + token); - if (loginUser1 != null) { - //查询所有一级标题 - - List g01=test1Mapper.selectDocByLevelByGroup(0l,1l); - List g02=test1Mapper.selectDocByLevelByGroup(0l,2l); - List g03=test1Mapper.selectDocByLevelByGroup(0l,3l); - List g04=test1Mapper.selectDocByLevelByGroup(0l,4l); - + //查询所有一级标题 + List g01=test1Mapper.selectDocByLevelByGroup(0l,1l); + List g02=test1Mapper.selectDocByLevelByGroup(0l,2l); + List g03=test1Mapper.selectDocByLevelByGroup(0l,3l); + List g04=test1Mapper.selectDocByLevelByGroup(0l,4l); - List g11=test1Mapper.selectDocByLevelByGroup(1l,1l); - List g12=test1Mapper.selectDocByLevelByGroup(1l,2l); - List g13=test1Mapper.selectDocByLevelByGroup(1l,3l); - List g14=test1Mapper.selectDocByLevelByGroup(1l,4l); - List g21=test1Mapper.selectDocByLevelByGroup(2l,1l); - List g22=test1Mapper.selectDocByLevelByGroup(2l,2l); + List g11=test1Mapper.selectDocByLevelByGroup(1l,1l); + List g12=test1Mapper.selectDocByLevelByGroup(1l,2l); + List g13=test1Mapper.selectDocByLevelByGroup(1l,3l); + List g14=test1Mapper.selectDocByLevelByGroup(1l,4l); - Map mapAll=new HashMap<>(); - Map map01=new HashMap<>(); - map01.put("id",1); - map01.put("name","方向"); - map01.put("children",g01); + List g21=test1Mapper.selectDocByLevelByGroup(2l,1l); + List g22=test1Mapper.selectDocByLevelByGroup(2l,2l); - Map map02=new HashMap<>(); - map02.put("id",2); - map02.put("name","作战"); - map02.put("children",g02); + Map mapAll=new HashMap<>(); + Map map01=new HashMap<>(); + map01.put("id",1); + map01.put("name","方向"); + map01.put("children",g01); - Map map03=new HashMap<>(); - map03.put("id",3); - map03.put("name","装备"); - map03.put("children",g03); + Map map02=new HashMap<>(); + map02.put("id",2); + map02.put("name","作战"); + map02.put("children",g02); - Map map04=new HashMap<>(); - map04.put("id",4); - map04.put("name","环境"); - map04.put("children",g04); + Map map03=new HashMap<>(); + map03.put("id",3); + map03.put("name","装备"); + map03.put("children",g03); - Map map11=new HashMap<>(); - map11.put("id",1); - map11.put("name","业务系统"); - map11.put("children",g11); + Map map04=new HashMap<>(); + map04.put("id",4); + map04.put("name","环境"); + map04.put("children",g04); - Map map12=new HashMap<>(); - map12.put("id",2); - map12.put("name","模型库"); - map12.put("children",g12); + Map map11=new HashMap<>(); + map11.put("id",1); + map11.put("name","业务系统"); + map11.put("children",g11); - Map map13=new HashMap<>(); - map13.put("id",3); - map13.put("name","规则库"); - map13.put("children",g13); + Map map12=new HashMap<>(); + map12.put("id",2); + map12.put("name","模型库"); + map12.put("children",g12); - Map map14=new HashMap<>(); - map14.put("id",4); - map14.put("name","大类数据"); - map14.put("children",g14); + Map map13=new HashMap<>(); + map13.put("id",3); + map13.put("name","规则库"); + map13.put("children",g13); - Map map21=new HashMap<>(); - map21.put("id",1); - map21.put("name","模型方法"); - map21.put("children",g21); + Map map14=new HashMap<>(); + map14.put("id",4); + map14.put("name","大类数据"); + map14.put("children",g14); - Map map22=new HashMap<>(); - map22.put("id",2); - map22.put("name","指标"); - map22.put("children",g22); + Map map21=new HashMap<>(); + map21.put("id",1); + map21.put("name","模型方法"); + map21.put("children",g21); + Map map22=new HashMap<>(); + map22.put("id",2); + map22.put("name","指标"); + map22.put("children",g22); - mapAll.put("g01",map01); - mapAll.put("g02",map02); - mapAll.put("g03",map03); - mapAll.put("g04",map04); - mapAll.put("g11",map11); - mapAll.put("g12",map12); - mapAll.put("g13",map13); - mapAll.put("g14",map14); + mapAll.put("g01",map01); + mapAll.put("g02",map02); + mapAll.put("g03",map03); + mapAll.put("g04",map04); - mapAll.put("g21",map21); - mapAll.put("g22",map22); + mapAll.put("g11",map11); + mapAll.put("g12",map12); + mapAll.put("g13",map13); + mapAll.put("g14",map14); + mapAll.put("g21",map21); + mapAll.put("g22",map22); - return mapAll; - } else { - return null; - } - } else { - return null; - } - + return mapAll; } @Autowired BuildService buildService; @@ -1244,7 +1229,7 @@ public class DocApiController extends BaseController { } @PostMapping("/buildTwo") - public void buildTwo(HttpServletRequest request,@RequestBody Map data) throws JsonProcessingException { + public void buildTwo(HttpServletRequest request,@RequestBody Map data) throws JsonProcessingException, InterruptedException { System.out.println(data); // 存储结果:group -> type -> List(ID 列表) @@ -1450,37 +1435,126 @@ public class DocApiController extends BaseController { //如果中途嘎了java等待,然后20分钟去访问mysql时间最后一条数据 } - public void goPython(String title1,String title2,List> searchItems) throws JsonProcessingException { - String[] keywords = new String[]{title1, title2}; - Map map =new HashMap(); - map.put("keywords",keywords); - map.put("searchItems",searchItems); - sendPython(map); - while (pythonService.flag){ +// public void goPython(String title1,String title2,List> searchItems) throws JsonProcessingException, InterruptedException { +// String[] keywords = new String[]{title1, title2}; +// Map map =new HashMap(); +// map.put("keywords",keywords); +// map.put("searchItems",searchItems); +// sendPython(map); +// while (pythonService.flag){ +// +// } +// pythonService.flag=true; +// System.out.println("22222222222222222222"); +// System.out.println(pythonService.pythonMessage); +// String payload=pythonService.pythonMessage; +// ObjectMapper mapper=new ObjectMapper(); +// Map objMap =mapper.readValue(payload, new TypeReference>() {}); +// if(objMap.get("code").equals("500")){ +// System.out.println(objMap.get("message")); +// Thread.sleep(10 * 60 * 1000); +// } +// if(objMap.get("code").equals("200")){ +// if (objMap.get("function_name").equals("build")){ +// System.out.println("1111111111111"); +// System.out.println(objMap); +// staticBuildService.create(objMap); +// } +// if (objMap.get("function_name").equals("none")){ +//// staticBuildService.create(objMap); +// System.out.println("没有数据"); +// } +// } +// } +public void goPython(String title1, String title2, List> searchItems) + throws JsonProcessingException, InterruptedException { - } - pythonService.flag=false; - System.out.println("22222222222222222222"); - System.out.println(pythonService.pythonMessage); - String payload=pythonService.pythonMessage; - ObjectMapper mapper=new ObjectMapper(); - Map objMap =mapper.readValue(payload, new TypeReference>() {}); - if(objMap.get("code").equals("500")){ - System.out.println(objMap.get("message")); - } - if(objMap.get("code").equals("200")){ - if (objMap.get("function_name").equals("build")){ - System.out.println("1111111111111"); - System.out.println(objMap); - staticBuildService.create(objMap); + String[] keywords = new String[]{title1, title2}; + int maxRetries = 3; // 最大重试次数,避免无限重试 + int retryCount = 0; + + while (retryCount <= maxRetries) { + try { + // 构建请求数据 + Map map = new HashMap<>(); + map.put("keywords", keywords); + map.put("searchItems", searchItems); + + // 发送请求给 Python + sendPython(map); + + // 等待 Python 执行完成(通过 flag 控制) + while (pythonService.flag) { + Thread.sleep(1000); // 每秒检查一次,避免忙等 + } + + // 标志位重置(假设下次调用前需要手动重置) + pythonService.flag = true; + + System.out.println("从 Python 收到响应: " + pythonService.pythonMessage); + String payload = pythonService.pythonMessage; + + // 解析 JSON 响应 + ObjectMapper mapper = new ObjectMapper(); + Map objMap = mapper.readValue(payload, new TypeReference>() {}); + + // 检查响应状态 + if ("500".equals(objMap.get("code"))) { + System.out.println("Python 执行失败: " + objMap.get("message")); + retryCount++; + if (retryCount > maxRetries) { + System.out.println("已达到最大重试次数,放弃重试。"); + break; + } + System.out.println("将在 10 分钟后重试... (第 " + retryCount + " 次重试)"); + Thread.sleep(10 * 60 * 1000); // 等待 10 分钟后重试 + continue; // 重要:跳回循环开头,重新执行整个流程 + } + + // 成功响应 + if ("200".equals(objMap.get("code"))) { + String functionName = objMap.get("function_name"); + if ("build".equals(functionName)) { + System.out.println("执行 build 逻辑..."); + staticBuildService.create(objMap); + } else if ("none".equals(functionName)) { + System.out.println("Python 返回:没有数据"); + } else { + System.out.println("未知的 function_name: " + functionName); + } + // 成功处理,跳出循环 + break; } - if (objMap.get("function_name").equals("none")){ -// staticBuildService.create(objMap); - System.out.println("没有数据"); + + // 如果 code 既不是 200 也不是 500,也应重试 + System.out.println("收到未知响应 code: " + objMap.get("code") + ", 消息: " + objMap.get("message")); + retryCount++; + if (retryCount > maxRetries) { + System.out.println("未知响应,已达到最大重试次数。"); + break; } + Thread.sleep(10 * 60 * 1000); + continue; + + } catch (IOException e) { + // 处理 JSON 解析异常等 + System.err.println("处理 Python 响应时发生错误: " + e.getMessage()); + retryCount++; + if (retryCount > maxRetries) break; + Thread.sleep(10 * 60 * 1000); + continue; + } catch (Exception e) { + // 其他潜在异常,如 sendPython 抛出的异常 + System.err.println("调用 Python 时发生异常: " + e.getMessage()); + retryCount++; + if (retryCount > maxRetries) break; + Thread.sleep(10 * 60 * 1000); + continue; } } + System.out.println("goPython 流程结束。"); +} public List getIdsByGroupAndType( Map>> result, String groupName,