From 77088e55cec8b6f83f8396d6609ff4f57b4807b5 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期二, 30 十二月 2025 10:05:32 +0800
Subject: [PATCH] 人物搜索 新加了两个模块
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java | 40 ++
.gitignore | 1
zhang-content/src/main/java/com/ruoyi/domain/ModuleSearchResult.java | 5
zhang-content/src/main/java/com/ruoyi/service/ModuleSearchable.java | 3
ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java | 4
zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java | 6
zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java | 6
zhang-content/src/main/java/com/ruoyi/domain/PeopleSea.java | 4
zhang-content/src/main/java/com/ruoyi/service/impl/PeopleSearchServiceImpl.java | 6
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java | 91 ++++--
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/peopleSearchController.java | 6
zhang-content/src/main/java/com/ruoyi/service/impl/InterfaceBasedSearchRouter.java | 512 +++++++++++++++++++++++++--------------
zhang-content/src/main/java/com/ruoyi/service/PeopleSearchService.java | 4
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java | 92 ++++--
14 files changed, 511 insertions(+), 269 deletions(-)
diff --git a/.gitignore b/.gitignore
index ed8368a..af7e5b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,3 +45,4 @@
!*/build/*.java
!*/build/*.html
!*/build/*.xml
+**/EsSearchController.java
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 31efa74..2db0308 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
@@ -2,6 +2,9 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsModel;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.domain.PeopleSea;
import com.ruoyi.service.EsService;
import com.ruoyi.service.ZfEconomyService;
import com.ruoyi.service.impl.InterfaceBasedSearchRouter;
@@ -15,6 +18,9 @@
import javax.websocket.server.PathParam;
import java.util.Date;
import java.util.List;
+
+import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
+import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
/**
* @Author Jinquan_Ou
@@ -54,19 +60,22 @@
}
@GetMapping("/companion/{moduleCode}")
- public AjaxResult getAllbyCAY( @PathVariable("moduleCode") String moduleCode,@RequestParam(value = "companion", required = false) String companion,
- @RequestParam(value = "happenStartTime", required = false)
+ 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){
+ @RequestParam(value = "happenEndTime", required = false)
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date happenEndTime, PeopleSea peopleSea){
System.out.println("[[[[[["+moduleCode);
System.out.println("[[[[[["+companion);
System.out.println("[[[[[["+happenStartTime);
System.out.println("[[[[[["+happenEndTime);
+
+ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
zfEconomyService.clearAllCache();
- return interfaceBasedSearchRouter.routeSearch(moduleCode,companion,happenStartTime,happenEndTime);
+ return interfaceBasedSearchRouter.routeSearch(peopleSea,pageNum,pageSize);
}
/**
* 鏂板鍏ㄦā鍧楁悳绱㈡帴鍙o紙涓嶆寚瀹歮oduleCode锛�
@@ -76,14 +85,31 @@
@RequestParam(value = "happenStartTime", required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd") Date happenStartTime,
@RequestParam(value = "happenEndTime", required = false)
- @DateTimeFormat(pattern = "yyyy-MM-dd") Date happenEndTime) {
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date happenEndTime, PeopleSea peopleSea) {
System.out.println("鍏ㄦā鍧楁悳绱� - 鍚屼即: " + companion);
System.out.println("鍏ㄦā鍧楁悳绱� - 寮�濮嬫椂闂�: " + happenStartTime);
System.out.println("鍏ㄦā鍧楁悳绱� - 缁撴潫鏃堕棿: " + happenEndTime);
zfEconomyService.clearAllCache();
// 浣跨敤null鎴栫┖瀛楃涓茶〃绀哄叏妯″潡鎼滅储
- return interfaceBasedSearchRouter.routeSearch(null, companion, happenStartTime, happenEndTime);
+ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+ return interfaceBasedSearchRouter.routeSearch(peopleSea,pageNum,pageSize);
+ }
+
+ /**
+ * 閫氱敤鎼滅储鎺ュ彛
+ * 鏀寔鍗曚釜銆佸涓�佸叏妯″潡鎼滅储
+ */
+ @PostMapping("/universal")
+ public AjaxResult universalSearch(@RequestBody PeopleSea peopleSea) {
+ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+
+ System.out.println("鍏ㄦā鍧楁悳绱� - 鍚屼即: " + peopleSea.getPeoples());
+ System.out.println("鍏ㄦā鍧楁悳绱� - 寮�濮嬫椂闂�: " + peopleSea.getStartTime());
+ System.out.println("鍏ㄦā鍧楁悳绱� - 缁撴潫鏃堕棿: " + peopleSea.getEndTime());
+ return interfaceBasedSearchRouter.routeSearch(peopleSea,pageNum,pageSize);
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/peopleSearchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/peopleSearchController.java
index b56b97f..826d0dd 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/peopleSearchController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/peopleSearchController.java
@@ -4,10 +4,8 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ServletUtils;
-import com.ruoyi.domain.ZfDoctor;
-import com.ruoyi.domain.peopleSea;
+import com.ruoyi.domain.PeopleSea;
import com.ruoyi.service.PeopleSearchService;
-import com.ruoyi.service.PhyscialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -25,7 +23,7 @@
@GetMapping("/all")
- public AjaxResult listAll(peopleSea peopleSea){
+ public AjaxResult listAll(PeopleSea peopleSea){
Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
System.out.println(peopleSearchService);
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java
index f04dcae..828d2d7 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java
@@ -35,7 +35,9 @@
new HttpHost(
"localhost",
8087,
- "http"
+
+
+ "http"
)
));
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ModuleSearchResult.java b/zhang-content/src/main/java/com/ruoyi/domain/ModuleSearchResult.java
index 8acad81..1e7b418 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ModuleSearchResult.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ModuleSearchResult.java
@@ -4,6 +4,7 @@
public class ModuleSearchResult {
private final String moduleCode;
+ private final String moduleName;
private final List<?> data;
private final int count;
private final long searchTime;
@@ -13,6 +14,7 @@
private ModuleSearchResult(String moduleCode, String moduleName, List<?> data,
int count, long searchTime, boolean success, String errorMessage) {
this.moduleCode = moduleCode;
+ this.moduleName = moduleName;
this.data = data;
this.count = count;
this.searchTime = searchTime;
@@ -29,8 +31,9 @@
return new ModuleSearchResult(moduleCode, null, null, 0, 0, false, errorMessage);
}
- // getters...
+ // Getters
public String getModuleCode() { return moduleCode; }
+ public String getModuleName() { return moduleName; }
public List<?> getData() { return data; }
public int getCount() { return count; }
public long getSearchTime() { return searchTime; }
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/peopleSea.java b/zhang-content/src/main/java/com/ruoyi/domain/PeopleSea.java
similarity index 78%
rename from zhang-content/src/main/java/com/ruoyi/domain/peopleSea.java
rename to zhang-content/src/main/java/com/ruoyi/domain/PeopleSea.java
index 7ab8853..0a8fc7d 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/peopleSea.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/PeopleSea.java
@@ -5,7 +5,7 @@
import java.util.Date;
@Data
-public class peopleSea {
+public class PeopleSea {
private String[] modules;
// private String module;
@@ -13,5 +13,5 @@
private Date endTime;
private String peoples;
- private String hasAttachment;
+ private String hasAttachment;
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java
index 2647465..895c563 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java
@@ -121,4 +121,10 @@
*/
@TableField(exist = false)
private Date happenEndTime;
+
+ /**
+ * 鏄惁鏈夐檮浠�
+ */
+ @TableField(exist = false)
+ private String hasAttachment;
}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
index 236a681..297675c 100644
--- a/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
+++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
@@ -134,5 +134,9 @@
// @TableField(exist = false)
// private Integer year;
-
+ /**
+ * 鏄惁鏈夐檮浠�
+ */
+ @TableField(exist = false)
+ private String hasAttachment;
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ModuleSearchable.java b/zhang-content/src/main/java/com/ruoyi/service/ModuleSearchable.java
index c9f6876..1e713ce 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ModuleSearchable.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ModuleSearchable.java
@@ -3,6 +3,7 @@
import com.ruoyi.domain.ZfEconomy;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
public interface ModuleSearchable {
@@ -14,7 +15,7 @@
/**
* 鎼滅储鏂规硶
*/
- List<?> search(String companion, Date happenStartTime,Date happenEndTime);
+ List<?> search(String companion, Date happenStartTime, Date happenEndTime, String hasAttachment);
/**
* 妯″潡鍚嶇О
diff --git a/zhang-content/src/main/java/com/ruoyi/service/PeopleSearchService.java b/zhang-content/src/main/java/com/ruoyi/service/PeopleSearchService.java
index a7db1e2..cdfb785 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/PeopleSearchService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/PeopleSearchService.java
@@ -1,9 +1,9 @@
package com.ruoyi.service;
import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.domain.peopleSea;
+import com.ruoyi.domain.PeopleSea;
public interface PeopleSearchService {
- AjaxResult selectDataList(peopleSea peopleS, Integer pageNum, Integer pageSize);
+ AjaxResult selectDataList(PeopleSea peopleS, Integer pageNum, Integer pageSize);
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/InterfaceBasedSearchRouter.java b/zhang-content/src/main/java/com/ruoyi/service/impl/InterfaceBasedSearchRouter.java
index 91509a9..9debc0b 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/InterfaceBasedSearchRouter.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/InterfaceBasedSearchRouter.java
@@ -1,20 +1,18 @@
package com.ruoyi.service.impl;
import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.domain.ModuleSearchResult;
+import com.ruoyi.domain.PeopleSea;
import com.ruoyi.service.ModuleSearchable;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.logging.Log;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
-import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -24,6 +22,11 @@
private final Map<String, ModuleSearchable> moduleSearchMap;
+ // 妯″潡鍒嗗壊绗�
+ private static final String MODULE_SEPARATOR = ",";
+
+ // 鍏ㄦā鍧楁爣璇�
+ private static final String ALL_MODULES_FLAG = "all";
/**
* 鑷姩鏀堕泦鎵�鏈夊疄鐜癕oduleSearchable鎺ュ彛鐨凚ean
@@ -43,214 +46,353 @@
log.info("宸叉敞鍐屾悳绱㈡ā鍧�: {}", moduleSearchMap.keySet());
}
- @Async // 澹版槑姝ゆ柟娉曞紓姝ユ墽琛岋紝灏嗕娇鐢ㄦ垜浠笂闈㈤厤缃殑Executor
- public CompletableFuture<ModuleSearchResult> searchModuleAsync(String moduleCode, ModuleSearchable service, String companion, Date startTime, Date endTime) {
- // 灏嗗師鏉ュ湪lambda琛ㄨ揪寮忎腑鐨勬悳绱㈤�昏緫绉诲埌杩欓噷
+ @Async
+ public CompletableFuture<ModuleSearchResult> searchModuleAsync(String moduleCode, ModuleSearchable service,
+ String companion, Date startTime, Date endTime,
+ String hasAttachment, Integer pageNum, Integer pageSize) {
long start = System.currentTimeMillis();
try {
- List<?> data = service.search(companion, startTime, endTime);
+ // 璋冪敤鎼滅储鏂规硶锛岃繑鍥� List<?>
+ List<?> data = service.search(companion, startTime, endTime, hasAttachment);
long searchTime = System.currentTimeMillis() - start;
- ModuleSearchResult result = ModuleSearchResult.success(moduleCode, service.getModuleName(), data, data.size(), searchTime);
+
+ int count = 0;
+ if (data != null) {
+ count = data.size();
+ }
+
+ // 鑾峰彇妯″潡鍚嶇О
+ String moduleName = getModuleName(moduleCode);
+
+ ModuleSearchResult result = ModuleSearchResult.success(
+ moduleCode, moduleName, data, count, searchTime
+ );
return CompletableFuture.completedFuture(result);
} catch (Exception e) {
- log.error("妯″潡[{}]鎼滅储澶辫触: {}", moduleCode, e.getMessage());
- ModuleSearchResult result = ModuleSearchResult.error(moduleCode, e.getMessage());
+ log.error("妯″潡[{}]鎼滅储澶辫触: {}", moduleCode, e.getMessage(), e);
+ String errorMessage = e.getMessage();
+ if (e.getCause() != null) {
+ errorMessage += " (" + e.getCause().getMessage() + ")";
+ }
+ ModuleSearchResult result = ModuleSearchResult.error(moduleCode, errorMessage);
return CompletableFuture.completedFuture(result);
}
}
- /**
- * 閫氱敤鐨勮矾鐢辨悳绱㈣姹傦紙鏀寔涓嶅悓鍙傛暟绫诲瀷锛�
- */
+
/**
* 閫氱敤鐨勮矾鐢辨悳绱㈣姹�
*/
- public AjaxResult routeSearch(String moduleCode, Object... args) {
- log.info("璺敱鎼滅储: moduleCode={}, args={}", moduleCode, Arrays.toString(args));
+ public AjaxResult routeSearch(PeopleSea peopleS, Integer pageNum, Integer pageSize) {
+ String moduleCode = null;
- // 鍏ㄦā鍧楁悳绱細褰搈oduleCode涓虹┖鎴栫壒瀹氭爣璇嗘椂
- if (moduleCode == null || moduleCode.isEmpty() || "all".equalsIgnoreCase(moduleCode)) {
- return searchAllModules(args);
- }
+ // 瀹夊叏澶勭悊 String[] 绫诲瀷鐨� modules
+ if (peopleS != null && peopleS.getModules() != null && peopleS.getModules().length != 0) {
+ String[] modulesArray = peopleS.getModules();
- // 鍗曚釜妯″潡鎼滅储锛堝師鏈夐�昏緫锛�
- ModuleSearchable searchService = moduleSearchMap.get(moduleCode);
- if (searchService == null) {
- String availableModules = String.join(", ", moduleSearchMap.keySet());
- return AjaxResult.error("涓嶆敮鎸佺殑鎼滅储妯″潡: " + moduleCode + "銆傚彲鐢ㄦā鍧�: [" + availableModules + "]");
- }
-
- try {
- if (args.length == 3) {
- return handleFourArgs(searchService, args);
- } else {
- return AjaxResult.error("涓嶆敮鎸佺殑鍙傛暟鏁伴噺锛岄渶瑕�3涓弬鏁帮紝瀹為檯鏀跺埌: " + args.length);
- }
- } catch (Exception e) {
- log.error("鎼滅储鎵ц澶辫触: moduleCode={}", moduleCode, e);
- return AjaxResult.error("鎼滅储鎵ц澶辫触: " + e.getMessage());
- }
- }
-
- private AjaxResult handleFourArgs(ModuleSearchable searchService, Object[] args) {
- String companion = null;
- Date happenStartTime = null;
- Date happenEndTime = null;
-
- // 澶勭悊companion鍙傛暟
- if (args[0] instanceof String) {
- companion = (String) args[0];
- } else if (args[0] != null) {
- companion = args[0].toString();
- }
-
- // 澶勭悊鏃堕棿鍙傛暟
- if (args[1] instanceof Date) {
- happenStartTime = (Date) args[1];
- }
-
- if (args[2] instanceof Date) {
- happenEndTime = (Date) args[2];
- }
-
- // 鍒ゆ柇鎼滅储绫诲瀷
- boolean hasTimeRange = happenStartTime != null && happenEndTime != null;
-
- List<?> result;
- if (hasTimeRange) {
- // 鏈夋椂闂磋寖鍥达細鎵ц鏃堕棿鑼冨洿鎼滅储
- log.info("鎵ц鏃堕棿鑼冨洿鎼滅储: companion={}, startTime={}, endTime={}",
- companion, happenStartTime, happenEndTime);
- result = searchService.search(companion, happenStartTime, happenEndTime);
- } else {
- // 鏃犳椂闂磋寖鍥达細鍙寜companion鎼滅储
- log.info("鎵цcompanion鎼滅储: companion={}, 鏃堕棿鑼冨洿涓虹┖", companion);
- result = searchService.search(companion, null, null);
- }
-
- return AjaxResult.success("鎼滅储鎴愬姛", result);
- }
-
- /**
- * 鍏ㄦā鍧楁悳绱細鑾峰彇鎵�鏈夋ā鍧楃殑鏁版嵁骞跺垎绫�
- */
- private AjaxResult searchAllModules(Object[] args) {
- log.info("鎵ц鍏ㄦā鍧楁悳绱紝鍙傛暟鏁伴噺: {}", args.length);
-
- try {
- Map<String, Object> result = new LinkedHashMap<>();
- int totalCount = 0;
- int successCount = 0;
-
- // 澶勭悊鎼滅储鍙傛暟
- String companion = extractCompanion(args);
- Date happenStartTime = extractStartTime(args);
- Date happenEndTime = extractEndTime(args);
-
- System.out.println("鍏ㄦā鍧楁悳绱� ------ 鍚屼即: " + companion);
- System.out.println("鍏ㄦā鍧楁悳绱� ------ 寮�濮嬫椂闂�: " + happenStartTime);
- System.out.println("鍏ㄦā鍧楁悳绱� ------ 缁撴潫鏃堕棿: " + happenEndTime);
-
- // 骞惰澶勭悊鎵�鏈夋ā鍧楁悳绱紙鎻愰珮鎬ц兘锛�
- List<CompletableFuture<ModuleSearchResult>> futures = moduleSearchMap.entrySet().stream().map(entry ->
- searchModuleAsync(entry.getKey(),
- entry.getValue(), companion,
- happenStartTime, happenEndTime))
+ // 杩囨护鎺夌┖瀛楃涓插拰绌虹櫧瀛楃
+ List<String> validModules = Arrays.stream(modulesArray)
+ .filter(StringUtils::isNotBlank)
+ .map(String::trim)
.collect(Collectors.toList());
+ if (!validModules.isEmpty()) {
+ // 鐢ㄩ�楀彿杩炴帴鏈夋晥鐨勬ā鍧椾唬鐮�
+ moduleCode = String.join(",", validModules);
+ }
+ }
- // 绛夊緟鎵�鏈夋悳绱㈠畬鎴�
- CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
+ log.info("璺敱鎼滅储: moduleCode={}, peopleS={}, pageNum={}, pageSize={}",
+ moduleCode, peopleS, pageNum, pageSize);
- // 鏀堕泦缁撴灉
- for (CompletableFuture<ModuleSearchResult> future : futures) {
- ModuleSearchResult moduleResult = future.get();
- if (moduleResult.isSuccess()) {
- // 鍒涘缓涓�涓彲鍙樼殑HashMap骞跺~鍏ユ暟鎹�
- Map<String, Object> resultMap = new HashMap<>();
- resultMap.put("data", moduleResult.getData());
- resultMap.put("count", moduleResult.getCount());
- resultMap.put("searchTime", moduleResult.getSearchTime());
+ // 瑙f瀽妯″潡浠g爜
+ List<String> targetModules = parseModuleCodes(moduleCode);
- // 灏嗘瀯寤哄ソ鐨凪ap鏀惧叆鏈�缁堢粨鏋滀腑
- result.put(moduleResult.getModuleCode(), resultMap);
+ if (targetModules.isEmpty()) {
+ // 涓嶉�夋ā鍧楃殑鎯呭喌
+ return handleNoModuleSelected();
+ }
- successCount++;
- totalCount += moduleResult.getCount();
- } else {
- Map<String, Object> errorInfo = new HashMap<>();
- errorInfo.put("error", moduleResult.getErrorMessage());
- errorInfo.put("success", false);
- result.put(moduleResult.getModuleCode(), errorInfo);
+ // 缁熶竴澶勭悊锛氬崟涓ā鍧椼�佸涓ā鍧楅兘浣跨敤鍚屾牱鐨勫鐞嗛�昏緫
+ return executeModulesSearch(targetModules, peopleS, pageNum, pageSize);
+ }
+
+ /**
+ * 缁熶竴鎵ц妯″潡鎼滅储
+ */
+ private AjaxResult executeModulesSearch(List<String> moduleCodes, PeopleSea peopleS,
+ Integer pageNum, Integer pageSize) {
+ log.info("鎵ц妯″潡鎼滅储: moduleCodes={}, 妯″潡鏁伴噺={}", moduleCodes, moduleCodes.size());
+
+ // 楠岃瘉鎵�鏈夋ā鍧楁槸鍚﹀瓨鍦�
+ List<String> invalidModules = moduleCodes.stream()
+ .filter(code -> !moduleSearchMap.containsKey(code))
+ .collect(Collectors.toList());
+
+ if (!invalidModules.isEmpty()) {
+ String availableModules = String.join(", ", moduleSearchMap.keySet());
+ String errorMsg = String.format("浠ヤ笅妯″潡涓嶆敮鎸�: %s銆傚彲鐢ㄦā鍧�: [%s]",
+ invalidModules, availableModules);
+ return AjaxResult.error(errorMsg);
+ }
+
+ // 鎻愬彇鍙傛暟
+ String companion = extractCompanion(peopleS);
+ Date startTime = extractStartTime(peopleS);
+ Date endTime = extractEndTime(peopleS);
+ String hasAttachment = extractHasAttachment(peopleS);
+
+ // 璁剧疆鍒嗛〉榛樿鍊�
+ if (pageNum == null || pageNum <= 0) {
+ pageNum = 1;
+ }
+ if (pageSize == null || pageSize <= 0) {
+ pageSize = 10;
+ }
+
+ // 骞跺彂鎼滅储
+ Integer finalPageNum = pageNum;
+ Integer finalPageSize = pageSize;
+ List<CompletableFuture<ModuleSearchResult>> futures = moduleCodes.stream()
+ .map(code -> searchModuleAsync(code, moduleSearchMap.get(code),
+ companion, startTime, endTime, hasAttachment, finalPageNum, finalPageSize))
+ .collect(Collectors.toList());
+
+ // 绛夊緟瀹屾垚
+ CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
+
+ // 鍚堝苟鏁版嵁
+ List<Object> allData = new ArrayList<>();
+ for (CompletableFuture<ModuleSearchResult> future : futures) {
+ try {
+ ModuleSearchResult result = future.get();
+ if (result.isSuccess() && result.getData() != null) {
+ allData.addAll(result.getData());
+ }
+ } catch (Exception e) {
+ // 璁板綍閿欒浣嗙户缁鐞嗗叾浠栨ā鍧�
+ log.error("鑾峰彇妯″潡鎼滅储缁撴灉澶辫触", e);
+ }
+ }
+
+ // 瀵规暟鎹繘琛屾帓搴忥紙濡傛灉闇�瑕侊級
+ sortData(allData);
+
+ // 鍒嗛〉
+ int startIndex = (pageNum - 1) * pageSize;
+ List<Object> paginatedData = allData.stream()
+ .skip(startIndex)
+ .limit(pageSize)
+ .collect(Collectors.toList());
+
+ // 杩斿洖缁撴灉
+ Map<String, Object> data = new HashMap<>();
+ data.put("list", paginatedData);
+ data.put("total", allData.size());
+ data.put("pageNum", pageNum);
+ data.put("pageSize", pageSize);
+
+ return AjaxResult.success(data);
+ }
+
+ /**
+ * 瀵规暟鎹繘琛屾帓搴�
+ * 榛樿鎸夊垱寤烘椂闂撮檷搴忔帓鍒�
+ */
+ private void sortData(List<Object> allData) {
+ if (CollectionUtils.isEmpty(allData)) {
+ return;
+ }
+
+ // 濡傛灉鏁版嵁鏄� Map 绫诲瀷锛屽皾璇曟寜 createTime 鎺掑簭
+ if (allData.get(0) instanceof Map) {
+ allData.sort((a, b) -> {
+ Map<String, Object> mapA = (Map<String, Object>) a;
+ Map<String, Object> mapB = (Map<String, Object>) b;
+
+ Object timeA = mapA.get("createTime");
+ Object timeB = mapB.get("createTime");
+
+ if (timeA instanceof Date && timeB instanceof Date) {
+ // 闄嶅簭鎺掑垪锛氭渶鏂扮殑鍦ㄥ墠
+ return ((Date) timeB).compareTo((Date) timeA);
+ } else if (timeA instanceof String && timeB instanceof String) {
+ // 濡傛灉鏃堕棿鏄瓧绗︿覆锛屽皾璇曡В鏋�
+ try {
+ Date dateA = parseDate((String) timeA);
+ Date dateB = parseDate((String) timeB);
+ if (dateA != null && dateB != null) {
+ return dateB.compareTo(dateA);
+ }
+ } catch (Exception e) {
+ // 瑙f瀽澶辫触锛屼笉鎺掑簭
+ }
+ }
+ return 0;
+ });
+ }
+ }
+
+ /**
+ * 瑙f瀽鏃ユ湡瀛楃涓�
+ */
+ private Date parseDate(String dateStr) {
+ if (dateStr == null || dateStr.isEmpty()) {
+ return null;
+ }
+
+ try {
+ // 灏濊瘯甯歌鐨勬棩鏈熸牸寮�
+ String[] formats = {
+ "yyyy-MM-dd'T'HH:mm:ss.SSSXXX",
+ "yyyy-MM-dd HH:mm:ss",
+ "yyyy-MM-dd"
+ };
+
+ for (String format : formats) {
+ try {
+ return new java.text.SimpleDateFormat(format).parse(dateStr);
+ } catch (Exception e) {
+ // 缁х画灏濊瘯涓嬩竴涓牸寮�
}
}
-
- // 鏋勫缓杩斿洖缁撴灉
- Map<String, Object> finalResult = new LinkedHashMap<>();
- finalResult.put("totalModules", moduleSearchMap.size());
- finalResult.put("successModules", successCount);
- finalResult.put("totalRecords", totalCount);
- finalResult.put("searchTime", new Date());
- finalResult.put("modules", result);
-
- log.info("鍏ㄦā鍧楁悳绱㈠畬鎴�: 鎴愬姛{}/{}涓ā鍧楋紝鎬昏{}鏉¤褰�",
- successCount, moduleSearchMap.size(), totalCount);
-
- return AjaxResult.success("鍏ㄦā鍧楁悳绱㈡垚鍔�", finalResult);
-
} catch (Exception e) {
- log.error("鍏ㄦā鍧楁悳绱㈡墽琛屽け璐�", e);
- return AjaxResult.error("鍏ㄦā鍧楁悳绱㈠け璐�: " + e.getMessage());
+ log.warn("鏃犳硶瑙f瀽鏃ユ湡瀛楃涓�: {}", dateStr, e);
}
- }
- /**
- * 鍗曚釜妯″潡鎼滅储鍖呰鏂规硶
- */
- private ModuleSearchResult searchSingleModule(String moduleCode, ModuleSearchable service,
- String companion, Date startTime, Date endTime) {
- long start = System.currentTimeMillis();
- try {
- List<?> data = service.search(companion, startTime, endTime);
- long searchTime = System.currentTimeMillis() - start;
-
- return ModuleSearchResult.success(moduleCode, service.getModuleName(),
- data, data.size(), searchTime);
-
- } catch (Exception e) {
- log.error("妯″潡[{}]鎼滅储澶辫触: {}", moduleCode, e.getMessage());
- return ModuleSearchResult.error(moduleCode, e.getMessage());
- }
- }
-//
-// /**
-// * 鑾峰彇鎵�鏈夊彲鎼滅储鐨勬ā鍧椾俊鎭�
-// */
-// public List<SysMenu> getAvailableModules() {
-// return moduleSearchMap.values().stream()
-// .map(service -> SysMenu.builder()
-// .moduleCode(service.getModuleCode())
-// .moduleName(service.getModuleName())
-// .build())
-// .collect(Collectors.toList());
-// }
-
- /**
- * 鍙傛暟鎻愬彇杈呭姪鏂规硶
- */
- private String extractCompanion(Object[] args) {
- if (args.length > 0 && args[0] instanceof String) {
- return (String) args[0];
- } else if (args.length > 0 && args[0] != null) {
- return args[0].toString();
- }
return null;
}
- private Date extractStartTime(Object[] args) {
- return (args.length > 1 && args[1] instanceof Date) ? (Date) args[1] : null;
+ /**
+ * 鑾峰彇妯″潡鍚嶇О
+ */
+ private String getModuleName(String moduleCode) {
+ ModuleSearchable service = moduleSearchMap.get(moduleCode);
+ return service != null ? service.getModuleName() : "鏈煡妯″潡";
}
- private Date extractEndTime(Object[] args) {
- return (args.length > 2 && args[2] instanceof Date) ? (Date) args[2] : null;
+ /**
+ * 瀹夊叏鐨勫弬鏁版彁鍙栨柟娉�
+ */
+ private String extractCompanion(PeopleSea peopleS) {
+ if (peopleS == null) {
+ return "";
+ }
+ return peopleS.getPeoples() == null ? "" : peopleS.getPeoples().trim();
+ }
+
+ private Date extractStartTime(PeopleSea peopleS) {
+ if (peopleS == null) {
+ return null;
+ }
+ return peopleS.getStartTime();
+ }
+
+ private Date extractEndTime(PeopleSea peopleS) {
+ if (peopleS == null) {
+ return null;
+ }
+ return peopleS.getEndTime();
+ }
+
+ private String extractHasAttachment(PeopleSea peopleS) {
+ if (peopleS == null) {
+ return "";
+ }
+ return peopleS.getHasAttachment() == null ? "" : peopleS.getHasAttachment().trim();
+ }
+
+ /**
+ * 瑙f瀽妯″潡浠g爜
+ */
+ private List<String> parseModuleCodes(String moduleCode) {
+ if (StringUtils.isBlank(moduleCode)) {
+ // 绌�/绌虹櫧/null -> 鍏ㄦā鍧楁悳绱�
+ return new ArrayList<>(moduleSearchMap.keySet());
+ }
+
+ String trimmedCode = moduleCode.trim();
+
+ // 澶勭悊鍏ㄦā鍧楁爣璇�
+ if (ALL_MODULES_FLAG.equalsIgnoreCase(trimmedCode)) {
+ return new ArrayList<>(moduleSearchMap.keySet());
+ }
+
+ // 澶勭悊涓嶉�夋ā鍧楃殑鎯呭喌
+ if ("none".equalsIgnoreCase(trimmedCode) || "null".equalsIgnoreCase(trimmedCode)) {
+ return Collections.emptyList();
+ }
+
+ // 妫�鏌ユ槸鍚﹀寘鍚�楀彿锛堝涓ā鍧楋級
+ if (trimmedCode.contains(MODULE_SEPARATOR)) {
+ String[] moduleArray = trimmedCode.split(MODULE_SEPARATOR);
+ return Arrays.stream(moduleArray)
+ .map(String::trim)
+ .filter(code -> !code.isEmpty())
+ .collect(Collectors.toList());
+ }
+
+ // 鍗曚釜妯″潡
+ return Collections.singletonList(trimmedCode);
+ }
+
+ /**
+ * 涓嶉�夋ā鍧楃殑澶勭悊閫昏緫
+ */
+ private AjaxResult handleNoModuleSelected() {
+ Map<String, Object> result = new LinkedHashMap<>();
+ result.put("list", Collections.emptyList());
+ result.put("total", 0);
+ result.put("pageNum", 1);
+ result.put("pageSize", 10);
+
+ return AjaxResult.success("鏈�夋嫨鎼滅储妯″潡锛岃閫夋嫨瑕佹悳绱㈢殑妯″潡", result);
+ }
+
+ /**
+ * 鑾峰彇鍙敤妯″潡鍒楄〃
+ */
+ public AjaxResult getAvailableModules() {
+ Map<String, Object> result = new HashMap<>();
+
+ List<Map<String, Object>> modules = moduleSearchMap.values().stream()
+ .map(service -> {
+ Map<String, Object> moduleInfo = new HashMap<>();
+ moduleInfo.put("moduleCode", service.getModuleCode());
+ moduleInfo.put("moduleName", service.getModuleName());
+ return moduleInfo;
+ })
+ .collect(Collectors.toList());
+
+ result.put("modules", modules);
+ result.put("total", modules.size());
+
+ return AjaxResult.success("鑾峰彇鍙敤妯″潡鎴愬姛", result);
+ }
+
+ /**
+ * 楠岃瘉妯″潡浠g爜鏄惁瀛樺湪
+ */
+ public boolean validateModule(String moduleCode) {
+ if (StringUtils.isBlank(moduleCode)) {
+ return false;
+ }
+
+ // 澶勭悊澶氫釜妯″潡鐨勬儏鍐�
+ if (moduleCode.contains(MODULE_SEPARATOR)) {
+ String[] moduleArray = moduleCode.split(MODULE_SEPARATOR);
+ for (String code : moduleArray) {
+ String trimmedCode = code.trim();
+ if (!moduleSearchMap.containsKey(trimmedCode) &&
+ !ALL_MODULES_FLAG.equalsIgnoreCase(trimmedCode)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ // 鍗曚釜妯″潡鐨勬儏鍐�
+ String trimmedCode = moduleCode.trim();
+ return moduleSearchMap.containsKey(trimmedCode) ||
+ ALL_MODULES_FLAG.equalsIgnoreCase(trimmedCode);
}
}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/PeopleSearchServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/PeopleSearchServiceImpl.java
index fc95c11..f59026c 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/PeopleSearchServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/PeopleSearchServiceImpl.java
@@ -7,7 +7,7 @@
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.domain.dto.zfEventdto;
-import com.ruoyi.domain.peopleSea;
+import com.ruoyi.domain.PeopleSea;
import com.ruoyi.service.PeopleSearchService;
import com.ruoyi.service.ZfEventService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,7 +24,7 @@
private ZfEventService zfEventService;
- private LambdaQueryWrapper<peopleSea> buildCondition(peopleSea peops) {
+ private LambdaQueryWrapper<PeopleSea> buildCondition(PeopleSea peops) {
return null;
// if(peops.getModule().equals("浜嬬邯")) {
@@ -44,7 +44,7 @@
@Override
- public AjaxResult selectDataList(peopleSea peopleS, Integer pageNum, Integer pageSize) {
+ public AjaxResult selectDataList(PeopleSea peopleS, Integer pageNum, Integer pageSize) {
System.out.println(peopleS.getModules().toString());
for(String thi: peopleS.getModules()) {
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
index beb70cf..1d27f36 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java
@@ -11,6 +11,7 @@
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.*;
+import com.ruoyi.domain.dto.zfEventdto;
import com.ruoyi.mapper.ZfDoctorMapper;
import com.ruoyi.service.*;
import com.ruoyi.service.ZfDoctorService;
@@ -160,13 +161,13 @@
public List<ZfDoctor> markOwnData(Long familyId,Long fatherFamilyId, Long motherFamilyId, List<ZfDoctor> beanRecords) {
return beanRecords.stream().peek(
- bean -> {
- if (Objects.equals(bean.getFamilyId(), familyId) ||(fatherFamilyId!=0L && fatherFamilyId.equals(familyId))||(motherFamilyId!=0L && motherFamilyId.equals(familyId))) {
- bean.setOwnData(1);
- } else {
- bean.setOwnData(0);
- }
+ bean -> {
+ if (Objects.equals(bean.getFamilyId(), familyId) ||(fatherFamilyId!=0L && fatherFamilyId.equals(familyId))||(motherFamilyId!=0L && motherFamilyId.equals(familyId))) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
}
+ }
).sorted((a, b) -> b.getOwnData() - a.getOwnData()).collect(Collectors.toList());
}
@@ -194,13 +195,13 @@
for (ZfDoctor zfDoctor : dataList) {
// if (zfDoctor.getSuitable().length() != 0 || zfDoctor.getType().length() != 0 || zfDoctor.getEffect().length() != 0 ) {
- if(zfDoctor.getSymptom().length() == 0 || zfDoctor.getSymptom() == null){
- throw new RuntimeException("鐥囩姸涓虹┖锛屽鍏ユ暟鎹け璐�");
- }
- else {
- zfDoctorService.addData(zfDoctor);
- }
+ if(zfDoctor.getSymptom().length() == 0 || zfDoctor.getSymptom() == null){
+ throw new RuntimeException("鐥囩姸涓虹┖锛屽鍏ユ暟鎹け璐�");
}
+ else {
+ zfDoctorService.addData(zfDoctor);
+ }
+ }
// }
return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
@@ -353,13 +354,13 @@
UpdateRequest updateRequest = new UpdateRequest("allsearchdata", esResult.getId());
updateRequest.doc(
- "by1", newModel.getBy1(),
- "by2", newModel.getBy2(),
- "by3", newModel.getBy3(),
- "by4", newModel.getBy4(),
- "by6", newModel.getBy6(),
- "by7", newModel.getBy7(),
- "remark", newModel.getRemark()
+ "by1", newModel.getBy1(),
+ "by2", newModel.getBy2(),
+ "by3", newModel.getBy3(),
+ "by4", newModel.getBy4(),
+ "by6", newModel.getBy6(),
+ "by7", newModel.getBy7(),
+ "remark", newModel.getRemark()
);
try {
@@ -456,17 +457,19 @@
private LambdaQueryWrapper<ZfDoctor> buildCondition(ZfDoctor zfDoctor, List<Long> familyIdList) {
LambdaQueryWrapper<ZfDoctor> lqw = new LambdaQueryWrapper<>();
- lqw.in(ZfDoctor::getFamilyId, familyIdList);
+ lqw.in(familyIdList != null,ZfDoctor::getFamilyId, familyIdList);
lqw.orderByDesc(ZfDoctor::getCreateTime);
lqw.like(StringUtils.isNotEmpty(zfDoctor.getType()), ZfDoctor::getType, zfDoctor.getType())
- .like(StringUtils.isNotEmpty(zfDoctor.getSymptom()), ZfDoctor::getSymptom, zfDoctor.getSymptom())
- .like(StringUtils.isNotEmpty(zfDoctor.getDuration()), ZfDoctor::getDuration, zfDoctor.getDuration())
- .like(StringUtils.isNotEmpty(zfDoctor.getEffect()), ZfDoctor::getEffect, zfDoctor.getEffect())
- .like(StringUtils.isNotEmpty(zfDoctor.getSuitable()), ZfDoctor::getSuitable, zfDoctor.getSuitable())
- .like(StringUtils.isNotEmpty(zfDoctor.getWmedical()), ZfDoctor::getWmedical, zfDoctor.getWmedical())
- .like(StringUtils.isNotEmpty(zfDoctor.getCmedical()), ZfDoctor::getCmedical, zfDoctor.getCmedical())
- .like(StringUtils.isNotEmpty(zfDoctor.getRemark()), ZfDoctor::getRemark, zfDoctor.getRemark());
-// lqw.like(StringUtils.isNotEmpty(zfDoctor.getCompanion()),ZfDoctor::getCompanion,zfDoctor.getCompanion());
+ .like(StringUtils.isNotEmpty(zfDoctor.getSymptom()), ZfDoctor::getSymptom, zfDoctor.getSymptom())
+ .like(StringUtils.isNotEmpty(zfDoctor.getDuration()), ZfDoctor::getDuration, zfDoctor.getDuration())
+ .like(StringUtils.isNotEmpty(zfDoctor.getEffect()), ZfDoctor::getEffect, zfDoctor.getEffect())
+ .like(StringUtils.isNotEmpty(zfDoctor.getSuitable()), ZfDoctor::getSuitable, zfDoctor.getSuitable())
+ .like(StringUtils.isNotEmpty(zfDoctor.getWmedical()), ZfDoctor::getWmedical, zfDoctor.getWmedical())
+ .like(StringUtils.isNotEmpty(zfDoctor.getCmedical()), ZfDoctor::getCmedical, zfDoctor.getCmedical())
+ .like(StringUtils.isNotEmpty(zfDoctor.getRemark()), ZfDoctor::getRemark, zfDoctor.getRemark());
+ if (zfDoctor.getHasAttachment() != null && zfDoctor.getHasAttachment().equals("鏄�")) {
+ lqw.apply("url IS NOT NULL AND url != ''");
+ }// lqw.like(StringUtils.isNotEmpty(zfDoctor.getCompanion()),ZfDoctor::getCompanion,zfDoctor.getCompanion());
if (CollectionUtils.isNotEmpty(zfDoctor.getCompanionList())) {
List<String> companionList = zfDoctor.getCompanionList();
@@ -492,8 +495,8 @@
if (StringUtils.isNotEmpty(zfDoctor.getPrescription())) {
lqw.and(wrapper -> {
wrapper.like(StringUtils.isNotEmpty(zfDoctor.getPrescription()), ZfDoctor::getWmedical, zfDoctor.getPrescription())
- .or()
- .like(StringUtils.isNotEmpty(zfDoctor.getPrescription()), ZfDoctor::getCmedical, zfDoctor.getPrescription());
+ .or()
+ .like(StringUtils.isNotEmpty(zfDoctor.getPrescription()), ZfDoctor::getCmedical, zfDoctor.getPrescription());
});
}
return lqw;
@@ -501,11 +504,11 @@
@Override
public String getModuleCode() {
- return "2043";
+ return "鑽柟";
}
@Override
- public List<?> search(String companion, Date happenStartTime, Date happenEndTime) {
+ public List<?> search(String companion, Date happenStartTime, Date happenEndTime, String hasAttachment) {
ZfDoctor zfDoctor = new ZfDoctor();
String[] split = companion.split(",");
@@ -513,7 +516,30 @@
zfDoctor.setCompanionList(list); zfDoctor.setHappenStartTime(happenStartTime);
zfDoctor.setHappenEndTime(happenEndTime);
- return selectByCondition(zfDoctor);
+ zfDoctor.setHasAttachment(hasAttachment);
+ return doctorList(zfDoctor);
+ }
+
+ public List<zfEventdto> doctorList(ZfDoctor zfDoctor) {
+
+ LambdaQueryWrapper<ZfDoctor> lqw = buildCondition(zfDoctor, null);
+ List<ZfDoctor> beanRecords = list(lqw);
+ return encapData(beanRecords);
+ }
+
+ public List<zfEventdto> encapData(List<ZfDoctor> lis)
+ {
+ List<zfEventdto> daoRes = new ArrayList<>() ;
+ for(ZfDoctor obj : lis)
+ {
+ zfEventdto atd = new zfEventdto();
+ atd.setId(Math.toIntExact(obj.getId()));
+ atd.setModule("鑽柟");
+ atd.setName(obj.getCompanion());
+ atd.setCreateTime(obj.getCreateTime());
+ daoRes.add(atd);
+ }
+ return daoRes;
}
// public LambdaQueryWrapper<ZfDoctor> buildCondition2(List<Long> ids) {
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java
index 6655de3..35bdb22 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java
@@ -12,6 +12,7 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.*;
import com.ruoyi.domain.ZfEconomy;
+import com.ruoyi.domain.dto.zfEventdto;
import com.ruoyi.mapper.ZfEconomyMapper;
import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
@@ -72,7 +73,7 @@
private LambdaQueryWrapper<ZfEconomy> buildCondition(ZfEconomy zfEconomy,List<Long> familyIdList) {
LambdaQueryWrapper<ZfEconomy> lqw = new LambdaQueryWrapper<>();
lqw.orderByDesc(ZfEconomy::getCreateTime);
- lqw.in(ZfEconomy::getFamilyId,familyIdList);
+ lqw.in(familyIdList != null, ZfEconomy::getFamilyId,familyIdList);
lqw.like(StringUtils.isNotEmpty(zfEconomy.getType()),ZfEconomy::getType,zfEconomy.getType());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getKind()),ZfEconomy::getKind,zfEconomy.getKind());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getPrice()),ZfEconomy::getPrice,zfEconomy.getPrice());
@@ -80,30 +81,33 @@
lqw.like(StringUtils.isNotEmpty(zfEconomy.getUsePeople()),ZfEconomy::getUsePeople,zfEconomy.getUsePeople());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getBalance()),ZfEconomy::getBalance,zfEconomy.getBalance());
lqw.like(StringUtils.isNotEmpty(zfEconomy.getRemark()),ZfEconomy::getRemark,zfEconomy.getRemark());
+ if (zfEconomy.getHasAttachment() != null && zfEconomy.getHasAttachment().equals("鏄�")) {
+ lqw.apply("url IS NOT NULL AND url != ''");
+ }
// lqw.in(StringUtils.isNotEmpty(zfEconomy.getCompanionList()),ZfEconomy::getCompanion,zfEconomy.getCompanionList());
// if (zfEconomy.getYear() != 0) {
// System.out.println("pppppppppppppppppppppppppppppppppppppppppppppppppppp"+zfEconomy.getYear());
// lqw.apply("YEAR(happen_time) = {0}", zfEconomy.getYear());
// }
- if (CollectionUtils.isNotEmpty(zfEconomy.getCompanionList())) {
- List<String> companionList = zfEconomy.getCompanionList();
+ if (CollectionUtils.isNotEmpty(zfEconomy.getCompanionList())) {
+ List<String> companionList = zfEconomy.getCompanionList();
- // 娓呯悊鍜屽幓閲�
- companionList = companionList.stream()
- .map(String::trim)
- .filter(s -> !s.isEmpty())
- .distinct()
- .collect(Collectors.toList());
+ // 娓呯悊鍜屽幓閲�
+ companionList = companionList.stream()
+ .map(String::trim)
+ .filter(s -> !s.isEmpty())
+ .distinct()
+ .collect(Collectors.toList());
- if (!companionList.isEmpty()) {
- // 纭繚鎵�鏈夊弬涓庝汉閮藉湪companion瀛楁涓�
- for (String companion : companionList) {
- lqw.apply("FIND_IN_SET({0}, REPLACE(REPLACE(companion, ' ', ''), '锛�', ',')) > 0",
- companion);
- }
+ if (!companionList.isEmpty()) {
+ // 纭繚鎵�鏈夊弬涓庝汉閮藉湪companion瀛楁涓�
+ for (String companion : companionList) {
+ lqw.apply("FIND_IN_SET({0}, REPLACE(REPLACE(companion, ' ', ''), '锛�', ',')) > 0",
+ companion);
}
}
+ }
@@ -132,7 +136,7 @@
@Override
public List<ZfEconomy> change(){
ZfEconomy zfEconomy = new ZfEconomy();
- return list(buildCondition(zfEconomy,null));
+ return list(buildCondition(zfEconomy,null));
}
// private LambdaQueryWrapper<ZfEconomy> buildCondition(ZfEconomy zfEconomy, String familyIds, String secondFamilyAuthority) {
@@ -391,13 +395,13 @@
public List<ZfEconomy> markOwnData(Long familyId,Long fatherFamilyId, Long motherFamilyId,List<ZfEconomy> beanRecords){
return beanRecords.stream().peek(
- bean -> {
- if (Objects.equals(bean.getFamilyId(), familyId) ||(fatherFamilyId!=0L && fatherFamilyId.equals(familyId))||(motherFamilyId!=0L && motherFamilyId.equals(familyId))) {
- bean.setOwnData(1);
- } else {
- bean.setOwnData(0);
- }
+ bean -> {
+ if (Objects.equals(bean.getFamilyId(), familyId) ||(fatherFamilyId!=0L && fatherFamilyId.equals(familyId))||(motherFamilyId!=0L && motherFamilyId.equals(familyId))) {
+ bean.setOwnData(1);
+ } else {
+ bean.setOwnData(0);
}
+ }
).sorted((a,b)-> b.getOwnData()-a.getOwnData()).collect(Collectors.toList());
}
@@ -576,9 +580,9 @@
UpdateRequest updateRequest = new UpdateRequest("allsearchdata", esResult.getId());
updateRequest.doc(
- "by1",newModel.getBy1(),
- "by2",newModel.getBy2(),
- "remark",newModel.getRemark()
+ "by1",newModel.getBy1(),
+ "by2",newModel.getBy2(),
+ "remark",newModel.getRemark()
);
try {
@@ -643,12 +647,12 @@
@Override
public String getModuleCode() {
- return "2045";
+ return "鏀舵敮";
}
@Override
- @Cacheable(value = "economy_search", key = "T(String).format('2045_%s_%s_%s',#companion != null ? #companion : 'null',#happenStartTime != null ? #happenStartTime.getTime() : 0,#happenEndTime != null ? #happenEndTime.getTime() : 0)")
- public List<?> search(String companion, Date happenStartTime,Date happenEndTime) {
+// @Cacheable(value = "economy_search", key = "T(String).format('2045_%s_%s_%s_%s',#companion != null ? #companion : 'null',#happenStartTime != null ? #happenStartTime.getTime() : 0,#happenEndTime != null ? #happenEndTime.getTime() : 0,#hasAttachment != null ? #hasAttachment : 'null')")
+ public List<?> search(String companion, Date happenStartTime,Date happenEndTime,String hasAttachment) {
ZfEconomy zfEconomy = new ZfEconomy();
zfEconomy.setCompanion(companion);
zfEconomy.setHappenStartTime(happenStartTime);
@@ -657,10 +661,39 @@
String[] split = companion.split(",");
List<String> list = Arrays.asList(split);
+ System.out.println("[[[[[[[["+hasAttachment);
zfEconomy.setCompanionList(list);
- return selectByCondition(zfEconomy);
+ zfEconomy.setHasAttachment(hasAttachment);
+ return dataList(zfEconomy);
}
+ public List<zfEventdto> dataList(ZfEconomy zfEconomy) {
+
+ LambdaQueryWrapper<ZfEconomy> lqw = buildCondition(zfEconomy, null);
+
+ List<ZfEconomy> beanRecords = list(lqw);
+
+
+
+ return encapData(beanRecords);
+ }
+
+ public List<zfEventdto> encapData(List<ZfEconomy> lis)
+ {
+ List<zfEventdto> daoRes = new ArrayList<>() ;
+ for(ZfEconomy obj : lis)
+ {
+ zfEventdto atd = new zfEventdto();
+ atd.setId(Math.toIntExact(obj.getId()));
+ atd.setModule("鏀舵敮");
+ atd.setName(obj.getCompanion());
+ atd.setCreateTime(obj.getCreateTime());
+ daoRes.add(atd);
+ }
+ return daoRes;
+ }
+
+
@CacheEvict(value = "economy_search", allEntries = true)
public void clearAllCache() {
System.out.println("娓呴櫎鎵�鏈夌粡娴庢悳绱㈢紦瀛�");
--
Gitblit v1.9.1