From 320398289d8e5d849d89aff45555db5b4c02afec Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Thu, 30 Nov 2023 21:46:33 +0800 Subject: [PATCH] duibi --- .../impl/CaseApplicationLogServiceImpl.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java index 5b39293..9d452fc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationLogServiceImpl.java @@ -21,10 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -344,28 +341,29 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService } - boolean notEmptyFlag = CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isEmpty(afterCase.getCaseAttachList()); - boolean emptyFlag = CollectionUtil.isEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isNotEmpty(afterCase.getCaseAttachList()); - // 对比附件 - if(notEmptyFlag || emptyFlag){ - changeColumn.append("fileColumn"); - }else if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList()) && CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){ - if(beforeCase.getCaseAttachList().size()!=afterCase.getCaseAttachList().size()){ + List beforeAttachFilter =new ArrayList<>(); + List afterAttachFilter =new ArrayList<>(); + if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList())){ + beforeAttachFilter = beforeCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList()); + } + if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList())){ + afterAttachFilter = afterCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList()); + } + if(CollectionUtil.isNotEmpty(beforeAttachFilter)&& CollectionUtil.isNotEmpty(afterAttachFilter)){ + if(beforeAttachFilter.size()!=afterAttachFilter.size()){ changeColumn.append("fileColumn"); }else { - Map afterAttachMap = afterCase.getCaseAttachList().stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2)); - - - for (CaseAttach beforeCaseAttach : beforeCase.getCaseAttachList()) { + Map afterAttachMap = afterAttachFilter.stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2)); + for (CaseAttach beforeCaseAttach : beforeAttachFilter) { if(!afterAttachMap.containsKey(beforeCaseAttach.getAnnexPath())) { changeColumn.append("fileColumn"); break; } } } - - } + + compareCaseVO.setChangeColumn(changeColumn.toString()); if(CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){ List caseAttachList = afterCase.getCaseAttachList(); -- 2.54.0