|  | @@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.time.LocalDate;
 | 
	
		
			
				|  |  |  import java.time.LocalDateTime;
 | 
	
		
			
				|  |  |  import java.time.format.DateTimeFormatter;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
	
		
			
				|  | @@ -89,6 +90,7 @@ public class SopUserLogsInfoController extends BaseController
 | 
	
		
			
				|  |  |                                  QwExternalContactVOTime::getId,
 | 
	
		
			
				|  |  |                                  item -> new SopExternalContactInfo(item.getCreateTime(), item.getTagIds(), item.getRemark(),item.getLevel())
 | 
	
		
			
				|  |  |                          ));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  List<String> tagIds = qwExternalContactVOTimes.stream().map(QwExternalContactVOTime::getTagIds).filter(StringUtils::isNotEmpty).flatMap(e -> JSON.parseArray(e, String.class).stream()).collect(Collectors.toList());
 | 
	
		
			
				|  |  |                  if(!tagIds.isEmpty()){
 | 
	
		
			
				|  |  |                      List<QwTag> tagList = qwTagMapper.selectQwTagListByTagIdsNew(tagIds);
 | 
	
	
		
			
				|  | @@ -114,22 +116,14 @@ public class SopUserLogsInfoController extends BaseController
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            Predicate<SopUserLogsInfo> tagFilter = item -> {
 | 
	
		
			
				|  |  | -                String queryTagIds = sopUserLogsInfo.getTagIds();
 | 
	
		
			
				|  |  | -                String itemTagIds = item.getTagIds();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                if (queryTagIds == null || queryTagIds.trim().equals("[]")) {
 | 
	
		
			
				|  |  | -                    return true;
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -                List<String> queryTags = parseTagIds(queryTagIds);
 | 
	
		
			
				|  |  | -                List<String> itemTags = parseTagIds(itemTagIds);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                // 检查 itemTags 是否包含所有 queryTags(AND 关系)
 | 
	
		
			
				|  |  | -                return itemTags.containsAll(queryTags);
 | 
	
		
			
				|  |  | -            };
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |              // 优化过滤条件
 | 
	
		
			
				|  |  |              boolean isRemarkEmpty = StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getRemark());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            Predicate<SopUserLogsInfo> tagFilter = item ->
 | 
	
		
			
				|  |  | +                    sopUserLogsInfo.getTagIds() == null ||
 | 
	
		
			
				|  |  | +                            sopUserLogsInfo.getTagIds().isEmpty() ||
 | 
	
		
			
				|  |  | +                            item.getTagIds().contains(sopUserLogsInfo.getTagIds());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              Predicate<SopUserLogsInfo> remarkFilter = item ->
 | 
	
		
			
				|  |  |                      isRemarkEmpty ||
 | 
	
		
			
				|  |  |                              item.getRemark().contains(sopUserLogsInfo.getRemark());
 | 
	
	
		
			
				|  | @@ -142,34 +136,25 @@ public class SopUserLogsInfoController extends BaseController
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              Predicate<SopUserLogsInfo> timeFilter = item -> {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                if (StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingSTime())
 | 
	
		
			
				|  |  | -                        && StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingETime()) ) {
 | 
	
		
			
				|  |  | +                if (StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getEntryTime())) {
 | 
	
		
			
				|  |  |                      return true;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  try {
 | 
	
		
			
				|  |  | -                    LocalDateTime entryDate = LocalDateTime.parse(item.getInComTime(),
 | 
	
		
			
				|  |  | -                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
 | 
	
		
			
				|  |  | +                    LocalDate entryDate = LocalDate.parse(
 | 
	
		
			
				|  |  | +                            sopUserLogsInfo.getEntryTime(),
 | 
	
		
			
				|  |  | +                            DateTimeFormatter.ofPattern("yyyy-MM-dd")
 | 
	
		
			
				|  |  |                      );
 | 
	
		
			
				|  |  | -                    LocalDateTime inComingSTime = LocalDateTime.parse(sopUserLogsInfo.getInComingSTime(),
 | 
	
		
			
				|  |  | -                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
 | 
	
		
			
				|  |  | +                    LocalDate createDate = LocalDate.parse(
 | 
	
		
			
				|  |  | +                            item.getInComTime().substring(0, 10),
 | 
	
		
			
				|  |  | +                            DateTimeFormatter.ofPattern("yyyy-MM-dd")
 | 
	
		
			
				|  |  |                      );
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                    LocalDateTime inComingETime = LocalDateTime.parse(sopUserLogsInfo.getInComingETime(),
 | 
	
		
			
				|  |  | -                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
 | 
	
		
			
				|  |  | -                    );
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                    return !entryDate.isBefore(inComingSTime) && !entryDate.isAfter(inComingETime);
 | 
	
		
			
				|  |  | +                    return entryDate.equals(createDate);
 | 
	
		
			
				|  |  |                  } catch (Exception e) {
 | 
	
		
			
				|  |  |                      return false;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            boolean hasTimeFilter = !StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingSTime())
 | 
	
		
			
				|  |  | -                    && !StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingETime());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            if (sopUserLogsInfo.getTagIds() != null || !isRemarkEmpty || hasTimeFilter ||!isLevelEmpty) {
 | 
	
		
			
				|  |  | +            if (sopUserLogsInfo.getTagIds() != null || !isRemarkEmpty || !StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getEntryTime()) ||!isLevelEmpty) {
 | 
	
		
			
				|  |  |                  list = list.stream()
 | 
	
		
			
				|  |  |                          .filter(tagFilter.and(remarkFilter).and(timeFilter).and(levelFilter))
 | 
	
		
			
				|  |  |                          .collect(Collectors.toList());
 | 
	
	
		
			
				|  | @@ -188,6 +173,123 @@ public class SopUserLogsInfoController extends BaseController
 | 
	
		
			
				|  |  |                  item.setLevelName(getLevel(item.getLevel()));
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +//            List<SopUserLogsInfo> list = sopUserLogsInfoService.selectSopUserLogsInfoList(sopUserLogsInfo);
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            if (!list.isEmpty()) {
 | 
	
		
			
				|  |  | +//                // 使用并行流提取externalId
 | 
	
		
			
				|  |  | +//                List<Long> externalIdList = list.parallelStream()
 | 
	
		
			
				|  |  | +//                        .map(SopUserLogsInfo::getExternalId)
 | 
	
		
			
				|  |  | +//                        .filter(Objects::nonNull)
 | 
	
		
			
				|  |  | +//                        .collect(Collectors.toList());
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                List<QwExternalContactVOTime> qwExternalContactVOTimes =
 | 
	
		
			
				|  |  | +//                        iQwExternalContactService.selectQwExternalContactListVOByIds(externalIdList);
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                // 构建联系人信息映射
 | 
	
		
			
				|  |  | +//                Map<Long, SopExternalContactInfo> externalContactInfoMap = qwExternalContactVOTimes.stream()
 | 
	
		
			
				|  |  | +//                        .collect(Collectors.toMap(
 | 
	
		
			
				|  |  | +//                                QwExternalContactVOTime::getId,
 | 
	
		
			
				|  |  | +//                                item -> new SopExternalContactInfo(item.getCreateTime(), item.getTagIds(), item.getRemark(),item.getLevel())
 | 
	
		
			
				|  |  | +//                        ));
 | 
	
		
			
				|  |  | +//                List<String> tagIds = qwExternalContactVOTimes.stream().map(QwExternalContactVOTime::getTagIds).filter(StringUtils::isNotEmpty).flatMap(e -> JSON.parseArray(e, String.class).stream()).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +//                if(!tagIds.isEmpty()){
 | 
	
		
			
				|  |  | +//                    List<QwTag> tagList = qwTagMapper.selectQwTagListByTagIdsNew(tagIds);
 | 
	
		
			
				|  |  | +//                    Map<String, QwTag> tagMap = PubFun.listToMapByGroupObject(tagList, QwTag::getTagId);
 | 
	
		
			
				|  |  | +//                    qwExternalContactVOTimes.forEach(e -> {
 | 
	
		
			
				|  |  | +//                        List<String> tagId = JSON.parseArray(e.getTagIds(), String.class);
 | 
	
		
			
				|  |  | +//                        if(StringUtils.isNotEmpty(tagId)){
 | 
	
		
			
				|  |  | +//                            List<String> tagNameList = tagId.stream().filter(tagMap::containsKey).map(t -> tagMap.get(t).getName()).filter(StringUtils::isNotEmpty).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +//                            e.setTagIdsName(tagNameList);
 | 
	
		
			
				|  |  | +//                        }
 | 
	
		
			
				|  |  | +//                    });
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//                // 设置联系信息
 | 
	
		
			
				|  |  | +//                list.forEach(item -> {
 | 
	
		
			
				|  |  | +//                    SopExternalContactInfo info = externalContactInfoMap.getOrDefault(
 | 
	
		
			
				|  |  | +//                            item.getExternalId(),
 | 
	
		
			
				|  |  | +//                            new SopExternalContactInfo("无进线时间", "无标签", "无备注",0));
 | 
	
		
			
				|  |  | +//                    item.setInComTime(info.getCreateTime());
 | 
	
		
			
				|  |  | +//                    item.setTagIds(info.getTagIds());
 | 
	
		
			
				|  |  | +//                    item.setRemark(info.getRemark());
 | 
	
		
			
				|  |  | +//                    item.setLevel(info.getLevel());
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                });
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            Predicate<SopUserLogsInfo> tagFilter = item -> {
 | 
	
		
			
				|  |  | +//                String queryTagIds = sopUserLogsInfo.getTagIds();
 | 
	
		
			
				|  |  | +//                String itemTagIds = item.getTagIds();
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                if (queryTagIds == null || queryTagIds.trim().equals("[]")) {
 | 
	
		
			
				|  |  | +//                    return true;
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//                List<String> queryTags = parseTagIds(queryTagIds);
 | 
	
		
			
				|  |  | +//                List<String> itemTags = parseTagIds(itemTagIds);
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                // 检查 itemTags 是否包含所有 queryTags(AND 关系)
 | 
	
		
			
				|  |  | +//                return itemTags.containsAll(queryTags);
 | 
	
		
			
				|  |  | +//            };
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            // 优化过滤条件
 | 
	
		
			
				|  |  | +//            boolean isRemarkEmpty = StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getRemark());
 | 
	
		
			
				|  |  | +//            Predicate<SopUserLogsInfo> remarkFilter = item ->
 | 
	
		
			
				|  |  | +//                    isRemarkEmpty ||
 | 
	
		
			
				|  |  | +//                            item.getRemark().contains(sopUserLogsInfo.getRemark());
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            boolean isLevelEmpty = sopUserLogsInfo.getLevel() == null;
 | 
	
		
			
				|  |  | +//            Predicate<SopUserLogsInfo> levelFilter = item ->
 | 
	
		
			
				|  |  | +//                    isLevelEmpty ||
 | 
	
		
			
				|  |  | +//                            (item.getLevel() != null && Objects.equals(item.getLevel(), sopUserLogsInfo.getLevel()) );
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            Predicate<SopUserLogsInfo> timeFilter = item -> {
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                if (StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingSTime())
 | 
	
		
			
				|  |  | +//                        && StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingETime()) ) {
 | 
	
		
			
				|  |  | +//                    return true;
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//                try {
 | 
	
		
			
				|  |  | +//                    LocalDateTime entryDate = LocalDateTime.parse(item.getInComTime(),
 | 
	
		
			
				|  |  | +//                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
 | 
	
		
			
				|  |  | +//                    );
 | 
	
		
			
				|  |  | +//                    LocalDateTime inComingSTime = LocalDateTime.parse(sopUserLogsInfo.getInComingSTime(),
 | 
	
		
			
				|  |  | +//                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
 | 
	
		
			
				|  |  | +//                    );
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                    LocalDateTime inComingETime = LocalDateTime.parse(sopUserLogsInfo.getInComingETime(),
 | 
	
		
			
				|  |  | +//                            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
 | 
	
		
			
				|  |  | +//                    );
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                    return !entryDate.isBefore(inComingSTime) && !entryDate.isAfter(inComingETime);
 | 
	
		
			
				|  |  | +//                } catch (Exception e) {
 | 
	
		
			
				|  |  | +//                    return false;
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//            };
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            boolean hasTimeFilter = !StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingSTime())
 | 
	
		
			
				|  |  | +//                    && !StringUtil.strIsNullOrEmpty(sopUserLogsInfo.getInComingETime());
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            if (sopUserLogsInfo.getTagIds() != null || !isRemarkEmpty || hasTimeFilter ||!isLevelEmpty) {
 | 
	
		
			
				|  |  | +//                list = list.stream()
 | 
	
		
			
				|  |  | +//                        .filter(tagFilter.and(remarkFilter).and(timeFilter).and(levelFilter))
 | 
	
		
			
				|  |  | +//                        .collect(Collectors.toList());
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            // 处理标签名称
 | 
	
		
			
				|  |  | +//            list.parallelStream().forEach(item -> {
 | 
	
		
			
				|  |  | +//                if (item.getTagIds() != null && !item.getTagIds().equals("[]") && !item.getTagIds().equals("无标签")) {
 | 
	
		
			
				|  |  | +//                    List<String> tagIds = GSON.fromJson(item.getTagIds(), new TypeToken<List<String>>() {}.getType());
 | 
	
		
			
				|  |  | +//                    QwTagSearchParam param = new QwTagSearchParam();
 | 
	
		
			
				|  |  | +//                    param.setTagIds(tagIds);
 | 
	
		
			
				|  |  | +//                    item.setTagIdsName(iQwTagService.selectQwTagListByTagIds(param));
 | 
	
		
			
				|  |  | +//                }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//                // 处理 level
 | 
	
		
			
				|  |  | +//                item.setLevelName(getLevel(item.getLevel()));
 | 
	
		
			
				|  |  | +//            });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              return getDataTable(list);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          else {
 |