zqy
1 天以前 b10524103480a6834a2e8d5662f009c745143cc4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java
@@ -6,6 +6,8 @@
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.*;
@@ -63,9 +65,40 @@
        System.out.println("[[[[[["+happenStartTime);
        System.out.println("[[[[[["+happenEndTime);
        zfEconomyService.clearAllCache();
    return interfaceBasedSearchRouter.routeSearch(moduleCode,companion,happenStartTime,happenEndTime);
    }
    /**
     * 新增全模块搜索接口(不指定moduleCode)
     */
    @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);
    }
    /**
     * 通用搜索接口
     * 支持单个、多个、全模块搜索
     */
    @PostMapping("/universal")
    public AjaxResult universalSearch(
        @RequestParam(value = "moduleCode",required = false) String modules,  // 模块代码,支持单个、多个、全模块
        @RequestParam(required = false) String companion,
        @RequestParam(required = false) String hasAttachment,
        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
        return interfaceBasedSearchRouter.routeSearch(modules, companion, startTime, endTime,hasAttachment);
    }
}