zqy
5 天以前 28cf0afe5cb951bf34a60a1ee0f36d38c592a8c0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java
@@ -3,10 +3,17 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsModel;
import com.ruoyi.service.EsService;
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;
/**
@@ -21,6 +28,12 @@
    @Resource
    EsService esService;
    @Resource
    InterfaceBasedSearchRouter interfaceBasedSearchRouter;
    @Resource
    ZfEconomyServiceImpl zfEconomyService;
    @GetMapping()
    public AjaxResult search(@PathParam("keyword") String keyword){
@@ -39,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);
    }
    /**
     * 新增全模块搜索接口(不指定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);
    }
}