31个文件已修改
1 文件已重命名
1796 ■■■■ 已修改文件
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/EsSearchController.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/peopleSearchController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ModuleSearchResult.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/PeopleSea.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/TravelCount.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfPet.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ModuleSearchable.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/PeopleSearchService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/InterfaceBasedSearchRouter.java 511 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/PeopleSearchServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountServiceImpl.java 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorServiceImpl.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEconomyServiceImpl.java 103 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -45,3 +45,4 @@
!*/build/*.java
!*/build/*.html
!*/build/*.xml
**/EsSearchController.java
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);
    }
    /**
     * 新增全模块搜索接口(不指定moduleCode)
@@ -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);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
@@ -75,6 +75,35 @@
    /**
     *  根据用户的id查询另外一个家族的全部成员信息
     *
     */
    @GetMapping("/getAnotherFamInfo/{userId}")
    public  AjaxResult getAnotherFamInfo(@PathVariable("userId") Long userId)
    {
        ZInfoUser zInfoUser = new ZInfoUser();
        zInfoUser.setSysId(userId);
        System.out.println(userId);
        List<ZInfoUser> zInfoUsers = zInfoUserService.selectByCondition(zInfoUser);
        if(!zInfoUsers.isEmpty())
        {
            ZInfoUser zi = new ZInfoUser();
            zi.setUaid(zInfoUsers.get(0).getUaid());
            zi.setSysId(userId);
            ZInfoUser zss = zInfoUserService.selectByUaidAndUid(zi);
            return zInfoUserService.listAllFamilyPeople(zss.getClanId());
        //    return AjaxResult.success("查询成功",zss);
        }
        else
        {
            return AjaxResult.success("没有另外的家族信息", null);
        }
    }
    /**
     * 导出个人详细信息记录列表
     */
//    @PreAuthorize("@ss.hasPermi('system:property:export')")
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/peopleSearchController.java
@@ -4,14 +4,15 @@
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
@@ -25,7 +26,7 @@
    @GetMapping("/all")
    public AjaxResult listAll(peopleSea peopleSea){
    public AjaxResult listAll(@RequestBody PeopleSea peopleSea){
        Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
        Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
        System.out.println(peopleSearchService);
ruoyi-common/src/main/java/com/ruoyi/common/config/ElasticSearchConfig.java
@@ -35,7 +35,9 @@
                new HttpHost(
                        "localhost",
                        8087,
                        "http"
                    "http"
                )
        ));
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
@@ -121,6 +121,16 @@
    private Integer clanId;
    private String uaid;
    public String getUaid() {
        return uaid;
    }
    public void setUaid(String uaid) {
        this.uaid = uaid;
    }
    public void setClanId(Integer clanId) {
        this.clanId = clanId;
    }
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; }
zhang-content/src/main/java/com/ruoyi/domain/PeopleSea.java
File was renamed from 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,7 @@
    private Date endTime;
    private String peoples;
    private String hasAttachment;
    private String hasAttachment;
    private String isHIde;
}
zhang-content/src/main/java/com/ruoyi/domain/TravelCount.java
@@ -1,11 +1,13 @@
package com.ruoyi.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@@ -14,7 +16,7 @@
/**
 * <p>
 *
 *
 * </p>
 *
 * @author ojq
@@ -120,4 +122,30 @@
     */
    private Integer shareId;
    /**
     * 参与者
     */
    private String companion;
    /**
     * 参与者列表
     */
    @TableField(exist = false)
    private List<String> companionList;
//    @TableField(exist = false)
//    private Integer year;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 是否隐藏
     */
    private String isHide;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfClean.java
@@ -10,6 +10,7 @@
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * <p>
@@ -117,4 +118,29 @@
     */
    private Integer shareId;
    /**
     * 参与者
     */
    private String companion;
    /**
     * 参与者列表
     */
    @TableField(exist = false)
    private List<String> companionList;
//    @TableField(exist = false)
//    private Integer year;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 是否隐藏
     */
    private String isHide;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfCollection.java
@@ -12,10 +12,11 @@
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
 * <p>
 *
 *
 * </p>
 *
 * @author ojq
@@ -121,4 +122,30 @@
     */
    private Integer shareId;
    /**
     * 参与者
     */
    private String companion;
    /**
     * 参与者列表
     */
    @TableField(exist = false)
    private List<String> companionList;
//    @TableField(exist = false)
//    private Integer year;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 是否隐藏
     */
    private String isHide;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfDoctor.java
@@ -121,4 +121,15 @@
     */
    @TableField(exist = false)
    private Date happenEndTime;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 是否隐藏
     */
    private String isHide;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfEconomy.java
@@ -134,5 +134,15 @@
//    @TableField(exist = false)
//    private Integer year;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 是否隐藏
     */
    private String isHide;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfEquipment.java
@@ -11,10 +11,11 @@
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
 * <p>
 *
 *
 * </p>
 *
 * @author ojq
@@ -115,5 +116,31 @@
     */
    private Integer shareId;
    /**
     * 参与者
     */
    private String companion;
    /**
     * 参与者列表
     */
    @TableField(exist = false)
    private List<String> companionList;
//    @TableField(exist = false)
//    private Integer year;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 是否隐藏
     */
    private String isHide;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfEvent.java
@@ -12,6 +12,7 @@
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
 * <p>
@@ -103,4 +104,17 @@
     */
    private Integer shareId;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 参与者列表
     */
    @TableField(exist = false)
    private List<String> companionList;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfPet.java
@@ -12,6 +12,7 @@
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
/**
 * <p>
@@ -160,5 +161,30 @@
     */
    private Integer shareId;
    /**
     * 参与者
     */
    private String companion;
    /**
     * 参与者列表
     */
    @TableField(exist = false)
    private List<String> companionList;
//    @TableField(exist = false)
//    private Integer year;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 是否隐藏
     */
    private String isHide;
}
zhang-content/src/main/java/com/ruoyi/domain/ZfProperty.java
@@ -12,6 +12,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
@@ -104,4 +105,30 @@
    private Integer shareId;
    /**
     * 参与者
     */
    private String companion;
    /**
     * 参与者列表
     */
    @TableField(exist = false)
    private List<String> companionList;
//    @TableField(exist = false)
//    private Integer year;
    /**
     * 是否有附件
     */
    @TableField(exist = false)
    private String hasAttachment;
    /**
     * 是否隐藏
     */
    private String isHide;
}
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);
    /**
     * 模块名称
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);
}
zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
@@ -46,6 +46,8 @@
   // AjaxResult updateBySysId()
    List<ZInfoUser> selectByCondition(ZInfoUser zInfoUser);
    ZInfoUser selectByUaidAndUid(ZInfoUser zInfoUser);
    AjaxResult removeByUserName(List<String> userName);
    List<ZInfoUser> selectByFamId(long fid);
    AjaxResult searchMyRelation();
zhang-content/src/main/java/com/ruoyi/service/impl/IZfPropertyServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -11,6 +12,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.ZfPropertyMapper;
import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
@@ -38,7 +40,7 @@
 */
@Slf4j
@Service
public class IZfPropertyServiceImpl extends ServiceImpl<ZfPropertyMapper, ZfProperty> implements IZfPropertyService {
public class IZfPropertyServiceImpl extends ServiceImpl<ZfPropertyMapper, ZfProperty> implements IZfPropertyService,ModuleSearchable  {
    @Resource
    IZfPropertyService zfPropertyService;
@@ -51,10 +53,10 @@
    @Resource
    ZfPropertyMapper zfPropertyMapper;
    @Resource
    EsService esService;
    @Resource
    RestHighLevelClient restHighLevelClient;
@@ -92,10 +94,48 @@
                .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress())
                .like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark())
                .eq(zfProperty.getFamilyId()!=null,ZfProperty::getFamilyId,zfProperty.getFamilyId())
                .in(ZfProperty::getFamilyId,familyIdList)
                .in(familyIdList!=null,ZfProperty::getFamilyId,familyIdList)
                .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime())
                .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
        lqw.orderByDesc(ZfProperty::getCreateTime);
        if (StringUtils.isNotEmpty(zfProperty.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(ZfProperty::getIsHide, "是")
                .or()
                .isNull(ZfProperty::getIsHide)
            );
        }
        if (zfProperty.getHasAttachment() != null && zfProperty.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(zfProperty.getCompanionList())) {
            List<String> companionList = zfProperty.getCompanionList();
            // 清理和去重
            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);
                }
            }
        }
        System.out.println("查询条件: " + lqw.getCustomSqlSegment());
        return lqw;
    }
@@ -454,7 +494,7 @@
            esModel.setRemark(zfProperty.getRemark());
            //这里存储查询详情的路径
            esService.insertTable(esModel);
            return AjaxResult.success();
        } else {
            return AjaxResult.error();
@@ -530,7 +570,7 @@
            }else {
                newModel.setBy6(dataById.getAddress());
            }
            if(zfProperty.getRemark()!=null){
                newModel.setRemark(zfProperty.getRemark());
            }else {
@@ -684,6 +724,55 @@
        return AjaxResult.success(result);
    }
    @Override
    public String getModuleCode() {
        return "家产";
    }
    @Override
//    @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) {
        ZfProperty zfProperty = new ZfProperty();
        zfProperty.setCompanion(companion);
        zfProperty.setHappenStartTime(happenStartTime);
        zfProperty.setHappenEndTime(happenEndTime);
        String[] split = companion.trim().replace(" ", "").replace(",", ",").split(",");
        List<String> list = Arrays.asList(split);
        zfProperty.setCompanionList(list);
        zfProperty.setHasAttachment(hasAttachment);
        zfProperty.setIsHide("否");
        return dataList(zfProperty);
    }
    public List<zfEventdto> dataList(ZfProperty zfProperty) {
        LambdaQueryWrapper<ZfProperty> lqw = buildCondition(zfProperty, null);
        List<ZfProperty> beanRecords = list(lqw);
        return encapData(beanRecords);
    }
    public List<zfEventdto> encapData(List<ZfProperty> lis)
    {
        List<zfEventdto> daoRes = new ArrayList<>() ;
        for(ZfProperty 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;
    }
}
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";
    /**
     * 自动收集所有实现ModuleSearchable接口的Bean
@@ -43,214 +46,352 @@
        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) {
        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;
        // 全模块搜索:当moduleCode为空或特定标识时
        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());
        // 解析模块代码
        List<String> targetModules = parseModuleCodes(moduleCode);
                    // 将构建好的Map放入最终结果中
                    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;
        }
        // 并发搜索
        List<CompletableFuture<ModuleSearchResult>> futures = moduleCodes.stream()
            .map(code -> searchModuleAsync(code, moduleSearchMap.get(code),
                companion, startTime, endTime, hasAttachment))
            .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) {
                        // 解析失败,不排序
                    }
                }
                return 0;
            });
        }
    }
    /**
     * 解析日期字符串
     */
    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("无法解析日期字符串: {}", 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();
    }
    /**
     * 解析模块代码
     */
    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);
    }
    /**
     * 验证模块代码是否存在
     */
    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);
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/PeopleSearchServiceImpl.java
@@ -5,9 +5,10 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.common.utils.StringUtils;
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 +25,7 @@
    private ZfEventService zfEventService;
    private LambdaQueryWrapper<peopleSea> buildCondition(peopleSea peops) {
    private LambdaQueryWrapper<PeopleSea> buildCondition(PeopleSea peops) {
        return null;
//        if(peops.getModule().equals("事纪")) {
@@ -44,7 +45,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()) {
@@ -62,14 +63,21 @@
                for (String pe : pes) {
                    lqw.like(ZfEvent::getPeople, pe);
                }
                peopleS.setIsHIde("否");
                lqw.eq(!StringUtils.isEmpty(peopleS.getIsHIde()), ZfEvent::getIsHide, "否");
                lqw.between(peopleS.getStartTime() != null && peopleS.getEndTime() != null, ZfEvent::getHappenTime, peopleS.getStartTime(), peopleS.getEndTime());
                if(peopleS.getHasAttachment().equals("是"))
                if(peopleS.getHasAttachment()!=null&&peopleS.getHasAttachment().equals("是"))
                {
                    lqw.isNotNull(ZfEvent::getUrl);
                    System.out.println("not null!");
                    lqw.isNotNull(ZfEvent::getUrl).and(r->r.apply("url!=''"));
                }else
                {
                    lqw.eq(!StringUtils.isEmpty(peopleS.getHasAttachment()), ZfEvent::getUrl, "");
                }
                Page<ZfEvent> zfEventPage = new Page<>(pageNum, pageSize);
              //  if(peopleS.getIsHIde()!=null)
               Page<ZfEvent> zfEventPage = new Page<>(pageNum, pageSize);
                Page<ZfEvent> pageResult = zfEventService.page(zfEventPage, lqw);
                List<ZfEvent> beanRecords = pageResult.getRecords();//得到查询出来的数据
zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountServiceImpl.java
@@ -2,15 +2,16 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.domain.TravelCount;
import com.ruoyi.domain.TravelDetail;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZProperty;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.*;
import com.ruoyi.domain.dto.zfEventdto;
import com.ruoyi.mapper.TravelCountMapper;
import com.ruoyi.service.ModuleSearchable;
import com.ruoyi.service.TravelCountService;
import com.ruoyi.service.TravelDetailService;
import com.ruoyi.service.ZInfoUserService;
@@ -19,6 +20,9 @@
import org.springframework.transaction.annotation.Transactional;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -31,7 +35,7 @@
 * @since 2023-10-06
 */
@Service
public class TravelCountServiceImpl extends ServiceImpl<TravelCountMapper, TravelCount> implements TravelCountService {
public class TravelCountServiceImpl extends ServiceImpl<TravelCountMapper, TravelCount> implements TravelCountService, ModuleSearchable {
    @Autowired
    private TravelDetailService travelDetailService;
@@ -129,4 +133,101 @@
        DecimalFormat df = new DecimalFormat("0.00");
        travelCount.setTotalPrice(Double.parseDouble(df.format(entranceTotal+eatTotal+travelCount.getGroupTotal()+stayTotal+travelTotal)));
    }
    private LambdaQueryWrapper<TravelCount> buildCondition(TravelCount travelCount, List<Long> familyIdList) {
        LambdaQueryWrapper<TravelCount> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(TravelCount::getCreateTime);
        if (StringUtils.isNotEmpty(travelCount.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(TravelCount::getIsHide, "是")
                .or()
                .isNull(TravelCount::getIsHide)
            );
        }
        if (travelCount.getHasAttachment() != null && travelCount.getHasAttachment().equals("是")) {
            lqw.apply("url IS NOT NULL AND url != ''");
        }
//        lqw.in(StringUtils.isNotEmpty(travelCount.getCompanionList()),travelCount::getCompanion,travelCount.getCompanionList());
//        if (travelCount.getYear() != 0) {
//            System.out.println("pppppppppppppppppppppppppppppppppppppppppppppppppppp"+travelCount.getYear());
//            lqw.apply("YEAR(happen_time) = {0}", travelCount.getYear());
//        }
        if (CollectionUtils.isNotEmpty(travelCount.getCompanionList())) {
            List<String> companionList = travelCount.getCompanionList();
            // 清理和去重
            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);
                }
            }
        }
        System.out.println("查询条件: " + lqw.getCustomSqlSegment());
        return lqw;
    }
    @Override
    public String getModuleCode() {
        return "旅游";
    }
    @Override
//    @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) {
        TravelCount travelCount = new TravelCount();
        travelCount.setCompanion(companion);
        String[] split = companion.split(",");
        List<String> list = Arrays.asList(split);
        travelCount.setCompanionList(list);
        travelCount.setHasAttachment(hasAttachment);
        travelCount.setIsHide("否");
        System.out.println("[[[[[[[["+travelCount);
        return dataList(travelCount);
    }
    public List<zfEventdto> dataList(TravelCount travelCount) {
        LambdaQueryWrapper<TravelCount> lqw = buildCondition(travelCount, null);
        List<TravelCount> beanRecords = list(lqw);
        return encapData(beanRecords);
    }
    public List<zfEventdto> encapData(List<TravelCount> lis)
    {
        List<zfEventdto> daoRes = new ArrayList<>() ;
        for(TravelCount 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;
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
@@ -231,6 +231,7 @@
    private LambdaQueryWrapper<ZInfoUser> buildCondition(ZInfoUser zInfoUser) {
        LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>();
        lqw.eq(zInfoUser.getSysId()!=null, ZInfoUser::getSysId, zInfoUser.getSysId());
        lqw.eq(zInfoUser.getUserId() != null, ZInfoUser::getUserId, zInfoUser.getUserId());
        lqw.like(StringUtils.isNotEmpty(zInfoUser.getAlwaysAddress()), ZInfoUser::getAlwaysAddress, zInfoUser.getAlwaysAddress());
        lqw.like(StringUtils.isNotEmpty(zInfoUser.getAlwaysPolice()), ZInfoUser::getAlwaysPolice, zInfoUser.getAlwaysPolice());
@@ -266,6 +267,21 @@
    }
    @Override
    public ZInfoUser selectByUaidAndUid(ZInfoUser zInfoUser) {
        LambdaQueryWrapper<ZInfoUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        System.out.println(zInfoUser.getUserId());
        System.out.println(zInfoUser.getUaid());
        lambdaQueryWrapper.eq(!StringUtils.isEmpty(zInfoUser.getUaid()), ZInfoUser::getUaid, zInfoUser.getUaid())
                .ne(zInfoUser.getSysId()!=null, ZInfoUser::getSysId, zInfoUser.getSysId());
        List<ZInfoUser> lis = list(lambdaQueryWrapper);
        if(!lis.isEmpty())
            return lis.get(0);
        else
            return null;
    }
    @Override
    public AjaxResult removeByUserName(List<String> userName) {
        LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>();
        lqw.in(ZInfoUser::getNickName,String.valueOf(userName.get(0)));
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCleanServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -12,6 +13,7 @@
import com.ruoyi.domain.*;
import com.ruoyi.domain.ZfClean;
import com.ruoyi.domain.dto.zfEventdto;
import com.ruoyi.mapper.ZfCleanMapper;
import com.ruoyi.service.*;
@@ -42,7 +44,7 @@
 */
@Service
@Slf4j
public class ZfCleanServiceImpl extends ServiceImpl<ZfCleanMapper, ZfClean> implements ZfCleanService {
public class ZfCleanServiceImpl extends ServiceImpl<ZfCleanMapper, ZfClean> implements ZfCleanService,ModuleSearchable {
    @Resource
    ZInfoUserService zInfoUserService;
@@ -55,10 +57,10 @@
    @Resource
    ZfLogService zfLogService;
    @Resource
    EsService esService;
    @Resource
    RestHighLevelClient restHighLevelClient;
@@ -80,8 +82,49 @@
                .like(StringUtils.isNotEmpty(zfClean.getLocation()), ZfClean::getLocation, zfClean.getLocation())
                .like(StringUtils.isNotEmpty(zfClean.getRemark()), ZfClean::getRemark, zfClean.getRemark())
                .eq(zfClean.getHappenTime() != null, ZfClean::getHappenTime, zfClean.getHappenTime())
                .in(ZfClean::getFamilyId,familyIdList)
                .in(familyIdList != null,ZfClean::getFamilyId,familyIdList)
                .between(zfClean.getHappenStartTime() != null && zfClean.getHappenEndTime() != null, ZfClean::getHappenTime, zfClean.getHappenStartTime(), zfClean.getHappenEndTime());
        if (StringUtils.isNotEmpty(zfClean.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(ZfClean::getIsHide, "是")
                .or()
                .isNull(ZfClean::getIsHide)
            );
        }
        if (zfClean.getHasAttachment() != null && zfClean.getHasAttachment().equals("是")) {
            lqw.apply("url IS NOT NULL AND url != ''");
        }
//        lqw.in(StringUtils.isNotEmpty(zfClean.getCompanionList()),zfClean::getCompanion,zfClean.getCompanionList());
//        if (zfClean.getYear() != 0) {
//            System.out.println("pppppppppppppppppppppppppppppppppppppppppppppppppppp"+zfClean.getYear());
//            lqw.apply("YEAR(happen_time) = {0}", zfClean.getYear());
//        }
        if (CollectionUtils.isNotEmpty(zfClean.getCompanionList())) {
            List<String> companionList = zfClean.getCompanionList();
            // 清理和去重
            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);
                }
            }
        }
        lqw.eq(zfClean.getHappenTime() != null, ZfClean::getHappenTime, zfClean.getHappenTime());
        return lqw;
    }
@@ -441,8 +484,8 @@
            esModel.setFid(familyId);
            //这里存储查询详情的路径
            esService.insertTable(esModel);
            return AjaxResult.success();
        } else {
            return AjaxResult.error();
@@ -646,4 +689,55 @@
    }
    @Override
    public String getModuleCode() {
        return "保洁";
    }
    @Override
//    @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) {
        ZfClean zfClean = new ZfClean();
        zfClean.setCompanion(companion);
        zfClean.setHappenStartTime(happenStartTime);
        zfClean.setHappenEndTime(happenEndTime);
        String[] split = companion.split(",");
        List<String> list = Arrays.asList(split);
        zfClean.setCompanionList(list);
        zfClean.setHasAttachment(hasAttachment);
        zfClean.setIsHide("否");
        System.out.println("[[[[[[[["+zfClean);
        return dataList(zfClean);
    }
    public List<zfEventdto> dataList(ZfClean zfClean) {
        LambdaQueryWrapper<ZfClean> lqw = buildCondition(zfClean, null);
        List<ZfClean> beanRecords = list(lqw);
        return encapData(beanRecords);
    }
    public List<zfEventdto> encapData(List<ZfClean> lis)
    {
        List<zfEventdto> daoRes = new ArrayList<>() ;
        for(ZfClean 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;
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZfCollectionServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -11,6 +12,7 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.*;
import com.ruoyi.domain.ZfCollection;
import com.ruoyi.domain.dto.zfEventdto;
import com.ruoyi.mapper.ZfCollectionMapper;
import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
@@ -40,11 +42,11 @@
 */
@Service
@Slf4j
public class ZfCollectionServiceImpl extends ServiceImpl<ZfCollectionMapper, ZfCollection> implements ZfCollectionService {
public class ZfCollectionServiceImpl extends ServiceImpl<ZfCollectionMapper, ZfCollection> implements ZfCollectionService,ModuleSearchable {
    @Resource
    ZfCollectionService zfCollectionService;
    @Resource
    ZInfoUserService zInfoUserService;
@@ -79,9 +81,47 @@
        lqw.like(StringUtils.isNotEmpty(zfCollection.getPrice()),ZfCollection::getPrice,zfCollection.getPrice());
        lqw.like(StringUtils.isNotEmpty(zfCollection.getLocation()),ZfCollection::getLocation,zfCollection.getLocation());
        lqw.like(StringUtils.isNotEmpty(zfCollection.getRemark()),ZfCollection::getRemark,zfCollection.getRemark());
        lqw.in(ZfCollection::getFamilyId,familyIdList);
        lqw.in(familyIdList != null,ZfCollection::getFamilyId,familyIdList);
        lqw.eq(zfCollection.getHappenTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenTime());
        lqw.between(zfCollection.getHappenStartTime() != null && zfCollection.getHappenEndTime() != null, ZfCollection::getHappenTime, zfCollection.getHappenStartTime(), zfCollection.getHappenEndTime());
        if (StringUtils.isNotEmpty(zfCollection.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(ZfCollection::getIsHide, "是")
                .or()
                .isNull(ZfCollection::getIsHide)
            );
        }
        if (zfCollection.getHasAttachment() != null && zfCollection.getHasAttachment().equals("是")) {
            lqw.apply("url IS NOT NULL AND url != ''");
        }
//        lqw.in(StringUtils.isNotEmpty(zfCollection.getCompanionList()),zfCollection::getCompanion,zfCollection.getCompanionList());
//        if (zfCollection.getYear() != 0) {
//            System.out.println("pppppppppppppppppppppppppppppppppppppppppppppppppppp"+zfCollection.getYear());
//            lqw.apply("YEAR(happen_time) = {0}", zfCollection.getYear());
//        }
        if (CollectionUtils.isNotEmpty(zfCollection.getCompanionList())) {
            List<String> companionList = zfCollection.getCompanionList();
            // 清理和去重
            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);
                }
            }
        }
        return lqw;
    }
@@ -364,7 +404,7 @@
        return AjaxResult.success(data);
    }
//    @Override
//    public AjaxResult addData2(ZfCollection zfCollection){
//        ZInfoUser mySelf = getMySelf();
@@ -645,4 +685,54 @@
    }
    @Override
    public String getModuleCode() {
        return "收藏";
    }
    @Override
//    @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) {
        ZfCollection zfCollection = new ZfCollection();
        zfCollection.setCompanion(companion);
        zfCollection.setHappenStartTime(happenStartTime);
        zfCollection.setHappenEndTime(happenEndTime);
        String[] split = companion.split(",");
        List<String> list = Arrays.asList(split);
        zfCollection.setCompanionList(list);
        zfCollection.setHasAttachment(hasAttachment);
        zfCollection.setIsHide("否");
        System.out.println("[[[[[[[["+zfCollection);
        return dataList(zfCollection);
    }
    public List<zfEventdto> dataList(ZfCollection zfCollection) {
        LambdaQueryWrapper<ZfCollection> lqw = buildCondition(zfCollection, null);
        List<ZfCollection> beanRecords = list(lqw);
        return encapData(beanRecords);
    }
    public List<zfEventdto> encapData(List<ZfCollection> lis)
    {
        List<zfEventdto> daoRes = new ArrayList<>() ;
        for(ZfCollection 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;
    }
}
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,27 @@
    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 (StringUtils.isNotEmpty(zfDoctor.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(ZfDoctor::getIsHide, "是")
                .or()
                .isNull(ZfDoctor::getIsHide)
            );
        }
        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 +503,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 +512,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 +524,31 @@
        zfDoctor.setCompanionList(list);        zfDoctor.setHappenStartTime(happenStartTime);
        zfDoctor.setHappenEndTime(happenEndTime);
        return selectByCondition(zfDoctor);
        zfDoctor.setHasAttachment(hasAttachment);
        zfDoctor.setIsHide("否");
        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) {
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,42 @@
        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 (StringUtils.isNotEmpty(zfEconomy.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(ZfEconomy::getIsHide, "是")
                .or()
                .isNull(ZfEconomy::getIsHide)
            );
        }
        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 +145,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 +404,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 +589,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 +656,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);
@@ -658,9 +671,41 @@
        List<String> list = Arrays.asList(split);
        zfEconomy.setCompanionList(list);
        return selectByCondition(zfEconomy);
        zfEconomy.setHasAttachment(hasAttachment);
        zfEconomy.setIsHide("否");
        System.out.println("[[[[[[[["+zfEconomy);
        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("清除所有经济搜索缓存");
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -11,6 +12,7 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.*;
import com.ruoyi.domain.ZfEquipment;
import com.ruoyi.domain.dto.zfEventdto;
import com.ruoyi.mapper.ZfEquipmentMapper;
import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
@@ -40,7 +42,7 @@
 */
@Service
@Slf4j
public class ZfEquipmentServiceImpl extends ServiceImpl<ZfEquipmentMapper, ZfEquipment> implements ZfEquipmentService {
public class ZfEquipmentServiceImpl extends ServiceImpl<ZfEquipmentMapper, ZfEquipment> implements ZfEquipmentService ,ModuleSearchable{
    @Resource
    ZInfoUserService zInfoUserService;
@@ -74,8 +76,51 @@
        lqw.like(StringUtils.isNotEmpty(zfEquipment.getLocation()), ZfEquipment::getLocation, zfEquipment.getLocation());
        lqw.like(StringUtils.isNotEmpty(zfEquipment.getRemark()), ZfEquipment::getRemark, zfEquipment.getRemark());
        lqw.eq(zfEquipment.getHappenTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenTime());
        lqw.in(ZfEquipment::getFamilyId,familyIdList);
        lqw.in(familyIdList != null,ZfEquipment::getFamilyId,familyIdList);
        lqw.between(zfEquipment.getHappenStartTime() != null && zfEquipment.getHappenEndTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenStartTime(), zfEquipment.getHappenEndTime());
        if (StringUtils.isNotEmpty(zfEquipment.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(ZfEquipment::getIsHide, "是")
                .or()
                .isNull(ZfEquipment::getIsHide)
            );
        }
        if (zfEquipment.getHasAttachment() != null && zfEquipment.getHasAttachment().equals("是")) {
            lqw.apply("url IS NOT NULL AND url != ''");
        }
//        lqw.in(StringUtils.isNotEmpty(zfEquipment.getCompanionList()),zfEquipment::getCompanion,zfEquipment.getCompanionList());
//        if (zfEquipment.getYear() != 0) {
//            System.out.println("pppppppppppppppppppppppppppppppppppppppppppppppppppp"+zfEquipment.getYear());
//            lqw.apply("YEAR(happen_time) = {0}", zfEquipment.getYear());
//        }
        if (CollectionUtils.isNotEmpty(zfEquipment.getCompanionList())) {
            List<String> companionList = zfEquipment.getCompanionList();
            // 清理和去重
            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);
                }
            }
        }
        lqw.eq(zfEquipment.getHappenTime() != null, ZfEquipment::getHappenTime, zfEquipment.getHappenTime());
        return lqw;
    }
@@ -91,7 +136,7 @@
    }
//    //------------------------------------------------------------------------------------------
//    private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment, String familyIds, String secondFamilyAuthority) {
//        //模糊查询的条件
@@ -399,7 +444,7 @@
            esModel.setFid(familyId);
            //这里存储查询详情的路径
            esService.insertTable(esModel);
            return AjaxResult.success();
        } else {
            return AjaxResult.error();
@@ -633,8 +678,58 @@
        }else {
            return AjaxResult.error();
        }
    }
    @Override
    public String getModuleCode() {
        return "设备";
    }
    @Override
//    @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) {
        ZfEquipment zfEquipment = new ZfEquipment();
        zfEquipment.setCompanion(companion);
        zfEquipment.setHappenStartTime(happenStartTime);
        zfEquipment.setHappenEndTime(happenEndTime);
        String[] split = companion.split(",");
        List<String> list = Arrays.asList(split);
        zfEquipment.setCompanionList(list);
        zfEquipment.setHasAttachment(hasAttachment);
        zfEquipment.setIsHide("否");
        System.out.println("[[[[[[[["+zfEquipment);
        return dataList(zfEquipment);
    }
    public List<zfEventdto> dataList(ZfEquipment zfEquipment) {
        LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment, null);
        List<ZfEquipment> beanRecords = list(lqw);
        return encapData(beanRecords);
    }
    public List<zfEventdto> encapData(List<ZfEquipment> lis)
    {
        List<zfEventdto> daoRes = new ArrayList<>() ;
        for(ZfEquipment 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;
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -11,6 +12,7 @@
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.*;
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.domain.dto.zfEventdto;
import com.ruoyi.mapper.ZfEventMapper;
import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
@@ -40,7 +42,7 @@
 */
@Slf4j
@Service
public class ZfEventServiceImpl extends ServiceImpl<ZfEventMapper, ZfEvent> implements ZfEventService {
public class ZfEventServiceImpl extends ServiceImpl<ZfEventMapper, ZfEvent> implements ZfEventService,ModuleSearchable {
    @Resource
    ZInfoUserService zInfoUserService;
@@ -66,12 +68,54 @@
        LambdaQueryWrapper<ZfEvent> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(ZfEvent::getCreateTime);
        lqw.like(!StringUtils.isEmpty(zfEvent.getAddress()), ZfEvent::getAddress, zfEvent.getAddress());
        lqw.like(!StringUtils.isEmpty(zfEvent.getPeople()), ZfEvent::getPeople, zfEvent.getPeople());
        lqw.like(!StringUtils.isEmpty(zfEvent.getTitle()), ZfEvent::getTitle, zfEvent.getTitle());
        lqw.like(!StringUtils.isEmpty(zfEvent.getRemark()), ZfEvent::getRemark, zfEvent.getRemark());
        lqw.eq(zfEvent.getHappenTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenTime());
        lqw.in(ZfEvent::getFamilyId,familyIdList);
        lqw.in(familyIdList != null, ZfEvent::getFamilyId,familyIdList);
        lqw.between(zfEvent.getHappenStartTime() != null && zfEvent.getHappenEndTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenStartTime(), zfEvent.getHappenEndTime());
        if (StringUtils.isNotEmpty(zfEvent.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(ZfEvent::getIsHide, "是")
                .or()
                .isNull(ZfEvent::getIsHide)
            );
        }else {
                    lqw.like(!StringUtils.isEmpty(zfEvent.getPeople()), ZfEvent::getPeople, zfEvent.getPeople());
        }
        if (zfEvent.getHasAttachment() != null && zfEvent.getHasAttachment().equals("是")) {
            lqw.apply("url IS NOT NULL AND url != ''");
        }
//        lqw.in(StringUtils.isNotEmpty(ZfEvent.getCompanionList()),ZfEvent::getCompanion,ZfEvent.getCompanionList());
//        if (ZfEvent.getYear() != 0) {
//            System.out.println("pppppppppppppppppppppppppppppppppppppppppppppppppppp"+ZfEvent.getYear());
//            lqw.apply("YEAR(happen_time) = {0}", ZfEvent.getYear());
//        }
        if (CollectionUtils.isNotEmpty(zfEvent.getCompanionList())) {
            List<String> companionList = zfEvent.getCompanionList();
            // 清理和去重
            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(people, ' ', ''), ',', ',')) > 0",
                        companion);
                }
            }
        }
        lqw.eq(zfEvent.getHappenTime() != null, ZfEvent::getHappenTime, zfEvent.getHappenTime());
        System.out.println("查询条件: " + lqw.getCustomSqlSegment());
        return lqw;
    }
@@ -619,4 +663,56 @@
    }
    @Override
    public String getModuleCode() {
        return "家纪";
    }
    @Override
//    @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) {
        ZfEvent zfEvent = new ZfEvent();
        zfEvent.setPeople(companion);
        zfEvent.setHappenStartTime(happenStartTime);
        zfEvent.setHappenEndTime(happenEndTime);
        System.out.println("--------------"+companion+"-----------------");
        String[] split = companion.trim().replace(" ", "").replace(",", ",").split(",");
        List<String> list = Arrays.asList(split);
        zfEvent.setCompanionList(list);
        zfEvent.setHasAttachment(hasAttachment);
        zfEvent.setIsHide("否");
        System.out.println("[[[[[[[["+zfEvent);
        return dataList(zfEvent);
    }
    public List<zfEventdto> dataList(ZfEvent zfEvent) {
        LambdaQueryWrapper<ZfEvent> lqw = buildCondition(zfEvent, null);
        List<ZfEvent> beanRecords = list(lqw);
        return encapData(beanRecords);
    }
    public List<zfEventdto> encapData(List<ZfEvent> lis)
    {
        List<zfEventdto> daoRes = new ArrayList<>() ;
        for(ZfEvent obj : lis)
        {
            zfEventdto atd = new zfEventdto();
            atd.setId(Math.toIntExact(obj.getId()));
            atd.setModule("家纪");
            atd.setName(obj.getPeople());
            atd.setCreateTime(obj.getCreateTime());
            daoRes.add(atd);
        }
        return daoRes;
    }
}
zhang-content/src/main/java/com/ruoyi/service/impl/ZfPetServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -9,6 +10,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.ZfPetMapper;
import com.ruoyi.service.*;
import lombok.extern.slf4j.Slf4j;
@@ -33,7 +35,7 @@
 */
@Service
@Slf4j
public class ZfPetServiceImpl extends ServiceImpl<ZfPetMapper, ZfPet> implements ZfPetService {
public class ZfPetServiceImpl extends ServiceImpl<ZfPetMapper, ZfPet> implements ZfPetService,ModuleSearchable {
    @Autowired
    ZInfoUserService zInfoUserService;
@@ -43,7 +45,7 @@
    @Autowired
    ZfPetService zfPetService;
    @Resource
    ZAuthorityService zAuthorityService;
@@ -125,7 +127,7 @@
    }
    @Override
    public List<ZfPet> selectByCondition(ZfPet zfPet) {
@@ -356,7 +358,7 @@
    private LambdaQueryWrapper<ZfPet> buildCondition(ZfPet zfPet,List<Long> familyIdList) {
        LambdaQueryWrapper<ZfPet> lqw = new LambdaQueryWrapper<>();
        lqw.orderByDesc(ZfPet::getCreateTime);
        lqw.in(ZfPet::getFamilyId,familyIdList);
        lqw.in(familyIdList != null, ZfPet::getFamilyId,familyIdList);
        lqw.eq(zfPet.getId()!=null,ZfPet::getId,zfPet.getId());
        lqw.like(StringUtils.isNotEmpty(zfPet.getIdNum()),ZfPet::getIdNum,zfPet.getIdNum());
        lqw.like(StringUtils.isNotEmpty(zfPet.getSecurityCode()),ZfPet::getSecurityCode,zfPet.getSecurityCode());
@@ -373,6 +375,93 @@
        lqw.like(StringUtils.isNotEmpty(zfPet.getDialect()),ZfPet::getDialect,zfPet.getDialect());
        lqw.like(StringUtils.isNotEmpty(zfPet.getDisEatHabit()),ZfPet::getDisEatHabit,zfPet.getDisEatHabit());
        lqw.like(StringUtils.isNotEmpty(zfPet.getDisLifeHabit()),ZfPet::getDisLifeHabit,zfPet.getDisLifeHabit());
        return lqw;
    }
}
        if (StringUtils.isNotEmpty(zfPet.getIsHide())) {
            lqw.and(wrapper -> wrapper
                .ne(ZfPet::getIsHide, "是")
                .or()
                .isNull(ZfPet::getIsHide)
            );
        }
        if (zfPet.getHasAttachment() != null && zfPet.getHasAttachment().equals("是")) {
            lqw.apply("url IS NOT NULL AND url != ''");
        }
//        lqw.in(StringUtils.isNotEmpty(zfPet.getCompanionList()),zfPet::getCompanion,zfPet.getCompanionList());
//        if (zfPet.getYear() != 0) {
//            System.out.println("pppppppppppppppppppppppppppppppppppppppppppppppppppp"+zfPet.getYear());
//            lqw.apply("YEAR(happen_time) = {0}", zfPet.getYear());
//        }
        if (CollectionUtils.isNotEmpty(zfPet.getCompanionList())) {
            List<String> companionList = zfPet.getCompanionList();
            // 清理和去重
            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);
                }
            }
        }
        return lqw;}
        @Override
        public String getModuleCode() {
            return "宠物";
        }
        @Override
//    @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) {
            ZfPet zfPet = new ZfPet();
            zfPet.setCompanion(companion);
            String[] split = companion.split(",");
            List<String> list = Arrays.asList(split);
            zfPet.setCompanionList(list);
            zfPet.setHasAttachment(hasAttachment);
            zfPet.setIsHide("否");
            System.out.println("[[[[[[[["+zfPet);
            return dataList(zfPet);
        }
        public List<zfEventdto> dataList(ZfPet zfPet) {
            LambdaQueryWrapper<ZfPet> lqw = buildCondition(zfPet, null);
            List<ZfPet> beanRecords = list(lqw);
            return encapData(beanRecords);
        }
        public List<zfEventdto> encapData(List<ZfPet> lis)
        {
            List<zfEventdto> daoRes = new ArrayList<>() ;
            for(ZfPet obj : lis)
            {
                zfEventdto atd = new zfEventdto();
                atd.setId(Math.toIntExact(Long.parseLong(obj.getId())));
                atd.setModule("宠物");
                atd.setName(obj.getCompanion());
                atd.setCreateTime(obj.getCreateTime());
                daoRes.add(atd);
            }
            return daoRes;
        }}