From 28cf0afe5cb951bf34a60a1ee0f36d38c592a8c0 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 09 十二月 2025 11:10:29 +0800
Subject: [PATCH] 新增搜索 不选模块进行全局搜索 获取每个模块

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 50 insertions(+), 6 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java
index 1a57cd7..31efa74 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java
@@ -3,13 +3,17 @@
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.EsModel;
 import com.ruoyi.service.EsService;
-import org.springframework.data.elasticsearch.core.SearchHits;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.service.ZfEconomyService;
+import com.ruoyi.service.impl.InterfaceBasedSearchRouter;
+import com.ruoyi.service.impl.ZfEconomyServiceImpl;
+import com.ruoyi.system.service.ISysMenuService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import javax.websocket.server.PathParam;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -25,8 +29,14 @@
     @Resource
     EsService esService;
 
+    @Resource
+    InterfaceBasedSearchRouter interfaceBasedSearchRouter;
+
+    @Resource
+    ZfEconomyServiceImpl zfEconomyService;
+
     @GetMapping()
-    public AjaxResult search(String keyword){
+    public AjaxResult search(@PathParam("keyword") String keyword){
         List<EsModel> byCondition = esService.findByCondition(keyword);
         return AjaxResult.success(byCondition);
     }
@@ -42,4 +52,38 @@
         List<EsModel> modelList = esService.getAll();
         return AjaxResult.success(modelList);
     }
+
+    @GetMapping("/companion/{moduleCode}")
+    public AjaxResult getAllbyCAY( @PathVariable("moduleCode") String moduleCode,@RequestParam(value = "companion", required = false) String companion,
+                                   @RequestParam(value = "happenStartTime", required = false)
+                                   @DateTimeFormat(pattern = "yyyy-MM-dd") Date happenStartTime,
+                                   @RequestParam(value = "happenEndTime", required = false)
+                                       @DateTimeFormat(pattern = "yyyy-MM-dd") Date happenEndTime){
+        System.out.println("[[[[[["+moduleCode);
+        System.out.println("[[[[[["+companion);
+
+
+        System.out.println("[[[[[["+happenStartTime);
+        System.out.println("[[[[[["+happenEndTime);
+        zfEconomyService.clearAllCache();
+    return interfaceBasedSearchRouter.routeSearch(moduleCode,companion,happenStartTime,happenEndTime);
+    }
+    /**
+     * 鏂板鍏ㄦā鍧楁悳绱㈡帴鍙o紙涓嶆寚瀹歮oduleCode锛�
+     */
+    @GetMapping("/companion")
+    public AjaxResult getAllModulesByCompanion(@RequestParam(value = "companion", required = false) String companion,
+                                               @RequestParam(value = "happenStartTime", required = false)
+                                               @DateTimeFormat(pattern = "yyyy-MM-dd") Date happenStartTime,
+                                               @RequestParam(value = "happenEndTime", required = false)
+                                               @DateTimeFormat(pattern = "yyyy-MM-dd") Date happenEndTime) {
+
+        System.out.println("鍏ㄦā鍧楁悳绱� - 鍚屼即: " + companion);
+        System.out.println("鍏ㄦā鍧楁悳绱� - 寮�濮嬫椂闂�: " + happenStartTime);
+        System.out.println("鍏ㄦā鍧楁悳绱� - 缁撴潫鏃堕棿: " + happenEndTime);
+        zfEconomyService.clearAllCache();
+        // 浣跨敤null鎴栫┖瀛楃涓茶〃绀哄叏妯″潡鎼滅储
+        return interfaceBasedSearchRouter.routeSearch(null, companion, happenStartTime, happenEndTime);
+    }
+
 }

--
Gitblit v1.9.1