cc 3 долоо хоног өмнө
parent
commit
e01a7eee1b

+ 17 - 0
ai-server/src/main/java/com/zsjz/ai/module/eds/enums/ActionTypeEnum.java

@@ -0,0 +1,17 @@
+package com.zsjz.ai.module.eds.enums;
+
+import lombok.AllArgsConstructor;
+
+/**
+ * 动作类型
+ */
+@AllArgsConstructor
+public enum ActionTypeEnum {
+
+    // 运行
+    RUN("73"),
+    // 访问
+    ACCESS("75");
+
+    public final String code;
+}

+ 125 - 0
ai-server/src/main/java/com/zsjz/ai/module/eds/enums/EdsTreeEnum.java

@@ -0,0 +1,125 @@
+package com.zsjz.ai.module.eds.enums;
+
+
+import cn.hutool.core.util.StrUtil;
+import com.google.common.collect.Lists;
+import com.zsjz.ai.common.exception.ServerException;
+import com.zsjz.ai.module.eds.po.EdsTree;
+import com.zsjz.ai.module.eds.po.EdsTreeCount;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 目录树相关
+ *
+ * @author aa
+ * @since 2019/10/21
+ */
+@Getter
+@AllArgsConstructor
+public enum EdsTreeEnum {
+    ACCOUNT("account", "全部账号"), //
+    BASEINFO_CASEINFO("baseInfo/caseInfo", "案件信息"),
+    CALLSMS_CONTACTS("callSms/contacts", "通讯录"),
+    CHAT_GROUPINFO("chat/getGroupInfoList", "群组信息"),
+
+    // 系统痕迹
+    SYSTEM_TRACE_ACCESS_FILE("systemTrace/accessFileRecord", "访问文件"),
+    SYSTEM_TRACE_USE_SOFTWARE("systemTrace/useSoftwareRecord", "使用软件"),
+
+    // 部标媒体类型
+    MEDIA_PICTURE("media/getMediaTypePicture", "media", EdsMediaTypeEnum.PICTURE.getValue(), EdsMediaTypeEnum.PICTURE.getCode()),
+    MEDIA_AUDIO("media/getMediaTypeAudio", "media", EdsMediaTypeEnum.AUDIO.getValue(), EdsMediaTypeEnum.AUDIO.getCode()),
+    MEDIA_VIDEO("media/getMediaTypeVideo", "media", EdsMediaTypeEnum.VIDEO.getValue(), EdsMediaTypeEnum.VIDEO.getCode()),
+    MEDIA_OTHER("media/getMediaTypeOther", "media", EdsMediaTypeEnum.OTHER.getValue(), EdsMediaTypeEnum.OTHER.getCode());
+
+    private final String id;
+
+    private String parentId;
+
+    private final String fullName;
+
+    private String type;
+
+    EdsTreeEnum(String id, String fullName) {
+        this.id = id;
+        this.fullName = fullName;
+    }
+
+    //全部dirTreeList
+    public static final List<EdsTree> ALL_DIR_TREE_LIST = Lists.newArrayList();
+
+    //oneLevel对应的cls列表
+    private static List<Class<?>> oneLevelTreeList;
+    //twoLevel对应的cls列表
+    private static List<Class<?>> twoLevelTreeList;
+    //threeLevel对应的cls列表
+    private static List<Class<?>> threeLevelTreeList;
+
+    //TB_NAME_MAP,(tbName,dirTree)
+    public static Map<String, EdsTree> TB_NAME_MAP;
+    //ID_MAP,(id,dirTree)
+    public static Map<String, EdsTree> ID_MAP;
+
+    //全部账号统计的表
+    public static final List<String> ACCOUNT_TABLE_LIST = Arrays.asList("wa_mforensics_020100", "wa_mforensics_030100",
+            "wa_mforensics_040100", "wa_mforensics_050100", "wa_mforensics_060100",
+            "wa_mforensics_070100", "wa_mforensics_110100", "wa_mforensics_120100",
+            //jw 账号表
+            "jw_mforensics_215001011", "jw_mforensics_215001019",
+            "jw_mforensics_215001024", "jw_mforensics_215001029", "jw_mforensics_215001033",
+            "jw_mforensics_215001037");
+
+    //聚合总数和删除数量
+    public static EdsTreeCount aggDirTreeNum(List<EdsTreeCount> dirTreeCountList) {
+        int totalNum = 0, delNum = 0;
+        for (EdsTreeCount dirTreeCount : dirTreeCountList) {
+            if (dirTreeCount.getTotalNum() != null) {
+                totalNum += dirTreeCount.getTotalNum();
+                delNum += dirTreeCount.getDelNum();
+            }
+        }
+        EdsTreeCount dirTreeCount = new EdsTreeCount();
+        dirTreeCount.setTotalNum(totalNum);
+        dirTreeCount.setDelNum(delNum);
+        return dirTreeCount;
+    }
+
+    //获取treeLevel对应的classList
+    public static List<Class<?>> getDirClassListByLevel(Integer treeLevel) {
+        if (1 == treeLevel) {
+            if (oneLevelTreeList == null) {
+                oneLevelTreeList = ALL_DIR_TREE_LIST.stream()
+                                                    .filter(dirTree -> StrUtil.isNotEmpty(dirTree.getTbName()) && dirTree.getTreeLevel() == 1)
+                                                    .map(dirTree -> EdsEntityEnum.TABLE_NAME_CLASS_CACHE.get(dirTree.getTbName()).getCls())
+                                                    .collect(Collectors.toList());
+            }
+            return oneLevelTreeList;
+        } else if (2 == treeLevel) {
+            if (twoLevelTreeList == null) {
+                twoLevelTreeList = ALL_DIR_TREE_LIST.stream()
+                                                    .filter(dirTree -> StrUtil.isNotEmpty(dirTree.getTbName()) && dirTree.getTreeLevel() == 2)
+                                                    .map(dirTree -> EdsEntityEnum.TABLE_NAME_CLASS_CACHE.get(dirTree.getTbName()).getCls())
+                                                    .collect(Collectors.toList());
+            }
+            return twoLevelTreeList;
+        } else if (3 == treeLevel) {
+            if (threeLevelTreeList == null) {
+                threeLevelTreeList = ALL_DIR_TREE_LIST.stream()
+                                                      .filter(dirTree -> StrUtil.isNotEmpty(dirTree.getTbName()) && dirTree.getTreeLevel() == 3)
+                                                      .map(dirTree -> EdsEntityEnum.TABLE_NAME_CLASS_CACHE.get(dirTree.getTbName()).getCls())
+                                                      .collect(Collectors.toList());
+            }
+            return threeLevelTreeList;
+        }
+        throw new ServerException("treeLevel error");
+    }
+
+
+
+}

+ 10 - 0
ai-server/src/main/java/com/zsjz/ai/module/eds/mapper/EdsTreeCountMapper.java

@@ -0,0 +1,10 @@
+package com.zsjz.ai.module.eds.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zsjz.ai.module.eds.po.EdsTreeCount;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface EdsTreeCountMapper extends BaseMapper<EdsTreeCount> {
+
+}

+ 2 - 2
ai-server/src/main/java/com/zsjz/ai/module/eds/po/EdsDirTree.java → ai-server/src/main/java/com/zsjz/ai/module/eds/po/EdsTree.java

@@ -12,8 +12,8 @@ import lombok.Data;
  * @author zsjz
  * @author zsjz
  */
  */
 @Data
 @Data
-@TableName(value = "eds_dir_tree")
-public class EdsDirTree {
+@TableName(value = "eds_tree")
+public class EdsTree {
 
 
     /**
     /**
      * 主键 ID。
      * 主键 ID。

+ 8 - 8
ai-server/src/main/java/com/zsjz/ai/module/eds/po/EdsDirTreeCount.java → ai-server/src/main/java/com/zsjz/ai/module/eds/po/EdsTreeCount.java

@@ -15,8 +15,8 @@ import java.util.List;
  * @author zsjz
  * @author zsjz
  */
  */
 @Data
 @Data
-@TableName(value = "eds_dir_tree_count")
-public class EdsDirTreeCount {
+@TableName(value = "eds_tree_count")
+public class EdsTreeCount {
 
 
     /**
     /**
      * 主键 ID。
      * 主键 ID。
@@ -105,10 +105,10 @@ public class EdsDirTreeCount {
     private Integer sort;
     private Integer sort;
 
 
 
 
-    public EdsDirTreeCount() {
+    public EdsTreeCount() {
     }
     }
 
 
-    public EdsDirTreeCount(String collectTargetId, String id, String parentId, String type, Integer totalNum, Integer delNum) {
+    public EdsTreeCount(String collectTargetId, String id, String parentId, String type, Integer totalNum, Integer delNum) {
         this.collectTargetId = collectTargetId;
         this.collectTargetId = collectTargetId;
         this.dtId = id;
         this.dtId = id;
         this.parentId = parentId;
         this.parentId = parentId;
@@ -117,7 +117,7 @@ public class EdsDirTreeCount {
         this.delNum = delNum == null ? 0 : delNum;
         this.delNum = delNum == null ? 0 : delNum;
     }
     }
 
 
-    public EdsDirTreeCount(String collectTargetId, EdsDirTree dirTree, Integer totalNum, Integer delNum) {
+    public EdsTreeCount(String collectTargetId, EdsTree dirTree, Integer totalNum, Integer delNum) {
         this.collectTargetId = collectTargetId;
         this.collectTargetId = collectTargetId;
         this.dtId = dirTree.getId();
         this.dtId = dirTree.getId();
         this.parentId = dirTree.getParentId();
         this.parentId = dirTree.getParentId();
@@ -125,7 +125,7 @@ public class EdsDirTreeCount {
         this.delNum = delNum == null ? 0 : delNum;
         this.delNum = delNum == null ? 0 : delNum;
     }
     }
 
 
-    public EdsDirTreeCount(String collectTargetId, EdsDirTree dirTree, Integer totalNum, Integer delNum, String appType, String account) {
+    public EdsTreeCount(String collectTargetId, EdsTree dirTree, Integer totalNum, Integer delNum, String appType, String account) {
         this.collectTargetId = collectTargetId;
         this.collectTargetId = collectTargetId;
         this.dtId = dirTree.getId();
         this.dtId = dirTree.getId();
         this.parentId = dirTree.getParentId();
         this.parentId = dirTree.getParentId();
@@ -135,7 +135,7 @@ public class EdsDirTreeCount {
         this.account = account;
         this.account = account;
     }
     }
 
 
-    public EdsDirTreeCount(EdsDirTree dirTree, Long totalNum, Long delNum, String appType, String appTypeName, String account) {
+    public EdsTreeCount(EdsTree dirTree, Long totalNum, Long delNum, String appType, String appTypeName, String account) {
         this.dtId = dirTree.getId();
         this.dtId = dirTree.getId();
         this.parentId = dirTree.getParentId();
         this.parentId = dirTree.getParentId();
         this.fullName = dirTree.getFullName();
         this.fullName = dirTree.getFullName();
@@ -167,7 +167,7 @@ public class EdsDirTreeCount {
      */
      */
     @Schema(description = "子树列表")
     @Schema(description = "子树列表")
     @TableField(exist = false)
     @TableField(exist = false)
-    private List<EdsDirTreeCount> childList;
+    private List<EdsTreeCount> childList;
 
 
     public String getAppTypeName() {
     public String getAppTypeName() {
         return appTypeName == null ? appType : appTypeName;
         return appTypeName == null ? appType : appTypeName;

+ 178 - 0
ai-server/src/main/java/com/zsjz/ai/module/eds/utils/DataCountInfo.java

@@ -0,0 +1,178 @@
+package com.zsjz.ai.module.eds.utils;
+
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+
+import com.zsjz.ai.module.eds.enums.ActionTypeEnum;
+import com.zsjz.ai.module.eds.enums.EdsTreeEnum;
+import com.zsjz.ai.module.eds.po.EdsEntityFieldInfo;
+import com.zsjz.ai.module.eds.po.EdsMediaFile;
+import com.zsjz.ai.module.eds.po.EdsTree;
+import com.zsjz.ai.module.eds.po.EdsTreeCount;
+import com.zsjz.ai.module.eds.po.computer.EdsMforensics170200;
+import lombok.Data;
+
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * 数据计数
+ *
+ * @author aa
+ * @since 2019/9/5
+ */
+@Data
+public class DataCountInfo {
+
+    /**
+     * 全部账号
+     */
+    private EdsTreeCount accountDirTreeCount;
+
+    /**
+     * 媒体文件
+     */
+    private Map<String, EdsTreeCount> mediaDirTreeCountMap;
+
+
+    public DataCountInfo(String cid) {
+        this.collectTargetId = cid;
+        //初始化全部账号树
+        accountDirTreeCount = new EdsTreeCount();
+        accountDirTreeCount.setCollectTargetId(cid);
+        accountDirTreeCount.setDtId(EdsTreeEnum.ACCOUNT.getId());
+        accountDirTreeCount.setTotalNum(0);
+        accountDirTreeCount.setDelNum(0);
+
+        //初始化媒体文件树
+        mediaDirTreeCountMap = new ConcurrentHashMap<>(10);
+        EdsTreeEnum mediaPicture = EdsTreeEnum.MEDIA_PICTURE;
+        mediaDirTreeCountMap.put(mediaPicture.getType(),
+                new EdsTreeCount(cid, mediaPicture.getId(), mediaPicture.getParentId(), mediaPicture.getType(), 0, 0));
+        EdsTreeEnum mediaAudio = EdsTreeEnum.MEDIA_AUDIO;
+        mediaDirTreeCountMap.put(mediaAudio.getType(),
+                new EdsTreeCount(cid, mediaAudio.getId(), mediaAudio.getParentId(), mediaAudio.getType(), 0, 0));
+        EdsTreeEnum mediaVideo = EdsTreeEnum.MEDIA_VIDEO;
+        mediaDirTreeCountMap.put(mediaVideo.getType(),
+                new EdsTreeCount(cid, mediaVideo.getId(), mediaVideo.getParentId(), mediaVideo.getType(), 0, 0));
+        EdsTreeEnum mediaOther = EdsTreeEnum.MEDIA_OTHER;
+        mediaDirTreeCountMap.put(mediaOther.getType(),
+                new EdsTreeCount(cid, mediaOther.getId(), mediaOther.getParentId(), mediaOther.getType(), 0, 0));
+
+
+        //初始化当前前bcp包所有的目录树list
+        dirTreeCountList = Collections.synchronizedList(new ArrayList<>());
+        dirTreeCountList.add(accountDirTreeCount);
+    }
+
+    //当前包的采集id
+    private String collectTargetId;
+
+    //存储当前bcp包所有的目录树数量
+    private List<EdsTreeCount> dirTreeCountList;
+
+    //最终dirTreeCountList
+    public List<EdsTreeCount> finalDirTreeCountList() {
+        // 过滤totalNum=0的媒体目录树, 并合并自定义媒体目录树
+        Map<String, EdsTreeCount> mergeMediaDirTree = mediaDirTreeCountMap.values().stream()
+                .filter(dirTreeCount -> dirTreeCount.getTotalNum() > 0)
+                .collect(Collectors.toMap(EdsTreeCount::getDtId, Function.identity(), (o1, o2) -> {
+                    o1.setAppType(String.join(StrUtil.COMMA, o1.getAppType(), o2.getAppType()));
+                    o1.setTotalNum(o1.getTotalNum() + o2.getTotalNum());
+                    o1.setDelNum(o1.getDelNum() + o2.getDelNum());
+                    return o1;
+                }));
+        // 添加媒体目录树
+        dirTreeCountList.addAll(mergeMediaDirTree.values());
+        return dirTreeCountList;
+    }
+
+    /**
+     * 根据cls构建目录树
+     *
+     * @param tableName     表名
+     * @param EdsEntityFieldInfo cls字段信息
+     * @param dataList      数据list
+     */
+    public synchronized void buildDirTreeCountByTbName(String tableName, EdsEntityFieldInfo EdsEntityFieldInfo, List<Object> dataList) {
+        //单独记录账号表数量
+        if (EdsTreeEnum.ACCOUNT_TABLE_LIST.contains(tableName)) {
+            accountDirTreeCount.setTotalNum(accountDirTreeCount.getTotalNum() + dataList.size());
+            accountDirTreeCount.setDelNum(accountDirTreeCount.getDelNum() + Eds.getDeleteNum(EdsEntityFieldInfo, dataList));
+        }
+
+        //根据表名获取目录树
+        EdsTree dirTree = EdsTreeEnum.TB_NAME_MAP.get(tableName);
+        if (dirTree != null) {
+            //根据目录树级别获取dirTreeFunc
+            EdsTreeFunc dirTreeFunc = getDirTreeCountFunc(dirTree);
+            //由dirTreeCountList保存当前bcp包所有的目录树数量
+            List<EdsTreeCount> EdsTreeCounts = Objects.requireNonNull(dirTreeFunc).buildDirTreeList(collectTargetId, EdsEntityFieldInfo, dataList, dirTree);
+            dirTreeCountList.addAll(EdsTreeCounts);
+        } else if (EdsConstant.EDS_MFORENSICS_170200.equals(tableName)) {
+            // 系统痕迹: 使用软件 访问文件由于是同一张表的数据, 单独处理
+            List<EdsMforensics170200> runList = new ArrayList<>(dataList.size() / 3);
+            List<EdsMforensics170200> accessList = new ArrayList<>(dataList.size() / 3);
+            dataList.forEach(data -> {
+                String actionType = ((EdsMforensics170200) data).getActionType();
+                if (actionType != null) {
+                    if (ActionTypeEnum.RUN.code.equals(actionType)) {
+                        runList.add((EdsMforensics170200) data);
+                    } else if (ActionTypeEnum.ACCESS.code.equals(actionType)) {
+                        accessList.add((EdsMforensics170200) data);
+                    }
+                }
+            });
+
+            // 添加使用软件目录
+            if (CollUtil.isNotEmpty(runList)) {
+                // 根据名称去重统计
+                long totalNum = runList.stream().map(EdsMforensics170200::getMimeName).distinct().count();
+                dirTreeCountList.add(new EdsTreeCount(collectTargetId,
+                        EdsTreeEnum.ID_MAP.get(EdsTreeEnum.SYSTEM_TRACE_USE_SOFTWARE.getId()), Math.toIntExact(totalNum), 0));
+            }
+            // 添加访问文件目录
+            if (CollUtil.isNotEmpty(accessList)) {
+                // 根据名称去重统计
+                long totalNum = accessList.stream().map(EdsMforensics170200::getMimeName).distinct().count();
+                dirTreeCountList.add(new EdsTreeCount(collectTargetId,
+                        EdsTreeEnum.ID_MAP.get(EdsTreeEnum.SYSTEM_TRACE_ACCESS_FILE.getId()), Math.toIntExact(totalNum), 0));
+            }
+        }
+    }
+
+
+    private static EdsTreeFunc getDirTreeCountFunc(EdsTree dirTree) {
+        Integer treeLevel = dirTree.getTreeLevel();
+
+        if (treeLevel == 1) {
+            //一级目录树(不统计数量/简单列表)
+            return Eds.oneLevelDirTree();
+        } else if (treeLevel == 2) {
+            //二级目录树(只按appType分组)
+            return Eds.twoLevelDirTree();
+        } else if (treeLevel == 3) {
+            //三级目录树(按appType,account分组)
+            return Eds.threeLevelDirTree();
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * 构建媒体文件目录树
+     */
+    public synchronized void buildDirTreeCountWithMediaFile(List<EdsMediaFile> mediaFileList) {
+        //按类型分组后,统计总数量和删除数量
+        mediaFileList.stream().collect(Collectors.groupingBy(EdsMediaFile::getMediaType)).forEach((type, mediaFiles) -> {
+            EdsTreeCount dirTreeCount = mediaDirTreeCountMap.get(type);
+            dirTreeCount.setTotalNum(dirTreeCount.getTotalNum() + mediaFiles.size());
+            dirTreeCount.setDelNum(dirTreeCount.getDelNum() + Math.toIntExact(mediaFiles.stream()
+                    .filter(edsMediaFile -> edsMediaFile.getDeleteStatus() == 1)
+                    .count()));
+        });
+    }
+}

+ 75 - 14
ai-server/src/main/java/com/zsjz/ai/module/eds/utils/Eds.java

@@ -1,12 +1,12 @@
 package com.zsjz.ai.module.eds.utils;
 package com.zsjz.ai.module.eds.utils;
 
 
-import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.IORuntimeException;
 import cn.hutool.core.io.IORuntimeException;
 import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import com.google.common.collect.Sets;
 import com.zsjz.ai.common.exception.ServerException;
 import com.zsjz.ai.common.exception.ServerException;
 import com.zsjz.ai.common.utils.Z7;
 import com.zsjz.ai.common.utils.Z7;
@@ -17,11 +17,7 @@ import com.zsjz.ai.module.eds.po.base.EdsBaseWmChatCommon;
 import com.zsjz.ai.module.eds.po.base.EdsBaseWmCommerceCommon;
 import com.zsjz.ai.module.eds.po.base.EdsBaseWmCommerceCommon;
 import com.zsjz.ai.module.eds.po.base.EdsBaseWmEmailCommon;
 import com.zsjz.ai.module.eds.po.base.EdsBaseWmEmailCommon;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import net.lingala.zip4j.ZipFile;
-import net.lingala.zip4j.model.ZipParameters;
-import net.lingala.zip4j.model.enums.EncryptionMethod;
 
 
-import java.io.File;
 import java.lang.reflect.Field;
 import java.lang.reflect.Field;
 import java.nio.file.Files;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Path;
@@ -296,6 +292,71 @@ public class Eds {
         }
         }
     }
     }
 
 
+    /**
+     * 一级目录树(不统计数量/简单列表)
+     */
+    public static EdsTreeFunc oneLevelDirTree() {
+        return (cid, pojoField, dataList, dirTree) -> {
+            //判断是否统计数量
+            if (dirTree.getHasNum() == 1) {
+                //删除数量
+                Integer deleteNum = getDeleteNum(pojoField, dataList);
+                return Collections.singletonList(new EdsTreeCount(cid, dirTree, dataList.size(), deleteNum));
+            } else {
+                return Collections.singletonList(new EdsTreeCount(cid, dirTree, 0, 0));
+            }
+        };
+    }
+
+    /**
+     * 二级目录树(只按appType分组)
+     */
+    public static EdsTreeFunc twoLevelDirTree() {
+        return (cid, pojoField, dataList, dirTree) -> {
+            //过滤掉appType=null并根据appType分组
+            Map<String, List<Object>> groupByAppType = null;
+            Object data = dataList.getFirst();
+            if (data instanceof EdsBaseWmChatCommon) {
+                groupByAppType = chatGroupAppType(dataList);
+            } else if (data instanceof EdsBaseWmCommerceCommon) {
+                groupByAppType = commerceGroupAppType(dataList);
+            }
+
+            //创建dirList
+            if (groupByAppType == null) {
+                return Lists.newArrayList();
+            }
+            return getListDirTreeOnlyType(cid, dirTree, pojoField, groupByAppType);
+        };
+    }
+
+    /**
+     * 三级目录树(按appType,account分组)
+     */
+    public static EdsTreeFunc threeLevelDirTree() {
+        return (cid, pojoField, dataList, dirTree) -> {
+            //过滤掉appType=null并根据appType分组
+            Map<String, Map<String, List<Object>>> groupByAppType = null;
+            Object data = dataList.getFirst();
+            if (data instanceof EdsBaseWmChatCommon) {
+                groupByAppType = chatGroupAppTypeAccount(dataList);
+            } else if (data instanceof EdsBaseWmCommerceCommon) {
+                groupByAppType = commerceGroupAppTypeAccount(dataList);
+            } else if (data instanceof EdsBaseWmEmailCommon) {
+                groupByAppType = emailGroupAppTypeAccount(dataList);
+            }
+            //创建dirList
+            if (groupByAppType == null) {
+                return Lists.newArrayList();
+            }
+            //账号信息统计数量
+            Integer hasNum = dirTree.getHasNum();
+            return hasNum == 1 ? getListDirTree(cid, dirTree, pojoField, groupByAppType)
+                    : getAccountDirTree(cid, dirTree, groupByAppType);
+        };
+    }
+
+
 
 
     /**
     /**
      * 按应用类型对即时通讯数据分组
      * 按应用类型对即时通讯数据分组
@@ -350,10 +411,10 @@ public class Eds {
      * @param dirTree        目录树
      * @param dirTree        目录树
      * @param groupByAppType 按应用类型分组后的数据
      * @param groupByAppType 按应用类型分组后的数据
      */
      */
-    public static List<EdsDirTreeCount> getListDirTreeOnlyType(String cid, EdsDirTree dirTree, EdsEntityFieldInfo pojoField,
-                                                               Map<String, List<Object>> groupByAppType) {
+    public static List<EdsTreeCount> getListDirTreeOnlyType(String cid, EdsTree dirTree, EdsEntityFieldInfo pojoField,
+                                                            Map<String, List<Object>> groupByAppType) {
         return groupByAppType.entrySet().stream()
         return groupByAppType.entrySet().stream()
-                .map(appTypeEntry -> new EdsDirTreeCount(cid, dirTree, appTypeEntry.getValue().size(),
+                .map(appTypeEntry -> new EdsTreeCount(cid, dirTree, appTypeEntry.getValue().size(),
                         getDeleteNum(pojoField, appTypeEntry.getValue()), appTypeEntry.getKey(), null))
                         getDeleteNum(pojoField, appTypeEntry.getValue()), appTypeEntry.getKey(), null))
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
     }
     }
@@ -365,11 +426,11 @@ public class Eds {
      * @param dirTree               目录树
      * @param dirTree               目录树
      * @param groupByAppTypeAccount 按应用与账号分组数据
      * @param groupByAppTypeAccount 按应用与账号分组数据
      */
      */
-    public static List<EdsDirTreeCount> getAccountDirTree(String cid, EdsDirTree dirTree,
-                                                          Map<String, Map<String, List<Object>>> groupByAppTypeAccount) {
+    public static List<EdsTreeCount> getAccountDirTree(String cid, EdsTree dirTree,
+                                                       Map<String, Map<String, List<Object>>> groupByAppTypeAccount) {
         return groupByAppTypeAccount.entrySet().stream()
         return groupByAppTypeAccount.entrySet().stream()
                 .flatMap(appTypeEntry ->
                 .flatMap(appTypeEntry ->
-                        appTypeEntry.getValue().keySet().stream().map(s -> new EdsDirTreeCount(cid, dirTree, null, null, appTypeEntry.getKey(), s)))
+                        appTypeEntry.getValue().keySet().stream().map(s -> new EdsTreeCount(cid, dirTree, null, null, appTypeEntry.getKey(), s)))
                 .collect(Collectors.toList());
                 .collect(Collectors.toList());
     }
     }
 
 
@@ -380,11 +441,11 @@ public class Eds {
      * @param dirTree               目录树
      * @param dirTree               目录树
      * @param groupByAppTypeAccount 按应用与账号分组数据
      * @param groupByAppTypeAccount 按应用与账号分组数据
      */
      */
-    public static List<EdsDirTreeCount> getListDirTree(String cid, EdsDirTree dirTree, EdsEntityFieldInfo pojoField,
-                                                       Map<String, Map<String, List<Object>>> groupByAppTypeAccount) {
+    public static List<EdsTreeCount> getListDirTree(String cid, EdsTree dirTree, EdsEntityFieldInfo pojoField,
+                                                    Map<String, Map<String, List<Object>>> groupByAppTypeAccount) {
         return groupByAppTypeAccount.entrySet().stream()
         return groupByAppTypeAccount.entrySet().stream()
                 .flatMap(appTypeEntry -> appTypeEntry.getValue().entrySet().stream()
                 .flatMap(appTypeEntry -> appTypeEntry.getValue().entrySet().stream()
-                        .map(accountEntry -> new EdsDirTreeCount(cid, dirTree, accountEntry
+                        .map(accountEntry -> new EdsTreeCount(cid, dirTree, accountEntry
                                 .getValue().size(),
                                 .getValue().size(),
                                 getDeleteNum(pojoField, accountEntry.getValue()), appTypeEntry.getKey(),
                                 getDeleteNum(pojoField, accountEntry.getValue()), appTypeEntry.getKey(),
                                 accountEntry.getKey())))
                                 accountEntry.getKey())))

+ 23 - 0
ai-server/src/main/java/com/zsjz/ai/module/eds/utils/EdsTreeFunc.java

@@ -0,0 +1,23 @@
+package com.zsjz.ai.module.eds.utils;
+
+import com.zsjz.ai.module.eds.po.EdsTree;
+import com.zsjz.ai.module.eds.po.EdsEntityFieldInfo;
+import com.zsjz.ai.module.eds.po.EdsTreeCount;
+
+import java.util.List;
+
+/**
+ * eds树  数据计数方法
+ */
+@FunctionalInterface
+public interface EdsTreeFunc {
+    /**
+     * 构建目录树数量的方法
+     *
+     * @param cid           采集id
+     * @param edsEntityFieldInfo 实体字段信息
+     * @param dataList      数据list
+     */
+    List<EdsTreeCount> buildDirTreeList(String cid, EdsEntityFieldInfo edsEntityFieldInfo, List<?> dataList, EdsTree dirTree);
+
+}

+ 2 - 2
ai-server/src/main/java/com/zsjz/ai/module/eds/utils/LocalStorage.java

@@ -55,9 +55,9 @@ public class LocalStorage {
         }
         }
     }
     }
 
 
-    public FileDTO copyFile(EdsMediaTypeEnum mediaType, File src, Long caseId, String cid) {
+    public FileDTO copyFile(EdsMediaTypeEnum mediaType, File src,  String cid) {
         try {
         try {
-            String bcpPath = PathConst.EDS_PATH + File.separator + caseId;
+            String bcpPath = PathConst.EDS_PATH + File.separator;
             String md5Cid = DigestUtil.md5Hex(cid);
             String md5Cid = DigestUtil.md5Hex(cid);
             Path dest = PathConst.buildToday(bcpPath).resolve(md5Cid);
             Path dest = PathConst.buildToday(bcpPath).resolve(md5Cid);
             Path destFile = dest.resolve(src.getName());
             Path destFile = dest.resolve(src.getName());

+ 23 - 21
ai-server/src/main/java/com/zsjz/ai/module/eds/xml/DataProcess.java

@@ -18,14 +18,14 @@ import com.baomidou.mybatisplus.core.toolkit.MybatisBatchUtils;
 import com.baomidou.mybatisplus.core.toolkit.MybatisUtils;
 import com.baomidou.mybatisplus.core.toolkit.MybatisUtils;
 import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
 import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
+import com.zsjz.ai.common.enums.FileTypeEnum;
 import com.zsjz.ai.common.utils.GlobalPool;
 import com.zsjz.ai.common.utils.GlobalPool;
 import com.zsjz.ai.module.eds.anno.EdsFields;
 import com.zsjz.ai.module.eds.anno.EdsFields;
-import com.zsjz.ai.common.enums.FileTypeEnum;
 import com.zsjz.ai.module.eds.enums.EdsMediaTypeEnum;
 import com.zsjz.ai.module.eds.enums.EdsMediaTypeEnum;
 import com.zsjz.ai.module.eds.mapper.EdsMediaFileMapper;
 import com.zsjz.ai.module.eds.mapper.EdsMediaFileMapper;
-import com.zsjz.ai.module.eds.po.EdsMediaFile;
-import com.zsjz.ai.module.eds.po.EdsFileFieldInfo;
 import com.zsjz.ai.module.eds.po.EdsEntityFieldInfo;
 import com.zsjz.ai.module.eds.po.EdsEntityFieldInfo;
+import com.zsjz.ai.module.eds.po.EdsFileFieldInfo;
+import com.zsjz.ai.module.eds.po.EdsMediaFile;
 import com.zsjz.ai.module.eds.utils.*;
 import com.zsjz.ai.module.eds.utils.*;
 import lombok.Data;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
@@ -105,7 +105,10 @@ public class DataProcess {
      */
      */
     private LocalDateTime createTime;
     private LocalDateTime createTime;
 
 
-    private Long caseId;
+    /**
+     * 构建目录数据 数据统计
+     */
+    private final DataCountInfo dataCountInfo;
 
 
 
 
     @Data
     @Data
@@ -120,25 +123,26 @@ public class DataProcess {
     }
     }
 
 
 
 
-    public DataProcess(final DataInfo dataInfo, Class<?> cls) {
+    public DataProcess(final DataInfo dataInfo, Class<?> cls, DataCountInfo dataCountInfo) {
         this.dataInfo = dataInfo;
         this.dataInfo = dataInfo;
+        this.dataCountInfo = dataCountInfo;
         this.cls = cls;
         this.cls = cls;
         //取实体字段映射
         //取实体字段映射
         Map<String, Field> fieldMap = Eds.getFieldMap(cls);
         Map<String, Field> fieldMap = Eds.getFieldMap(cls);
         //筛选必须有值的时间字段
         //筛选必须有值的时间字段
         this.mustHasTimeFieldArr = Arrays.stream(Eds.getPojoFieldInfo(cls).getTimeFieldArr())
         this.mustHasTimeFieldArr = Arrays.stream(Eds.getPojoFieldInfo(cls).getTimeFieldArr())
-                                         .filter(field -> Eds.MUST_HAS_VALUE_FIELD_SET.contains(field.getName())).toArray(Field[]::new);
+                .filter(field -> Eds.MUST_HAS_VALUE_FIELD_SET.contains(field.getName())).toArray(Field[]::new);
         //初始化分隔符、起始行、编码与字段数组
         //初始化分隔符、起始行、编码与字段数组
         this.columnSeparator = dataInfo.getColumnSeparator();
         this.columnSeparator = dataInfo.getColumnSeparator();
         this.startIndex = dataInfo.getStartingLine() - 1;
         this.startIndex = dataInfo.getStartingLine() - 1;
         this.charset = dataInfo.getCharset();
         this.charset = dataInfo.getCharset();
         this.bcpFiledArr = Arrays.stream(dataInfo.getBcpFieldNameArr()).filter(bcpFieldName -> ObjUtil.isNotNull(fieldMap.get(bcpFieldName)))
         this.bcpFiledArr = Arrays.stream(dataInfo.getBcpFieldNameArr()).filter(bcpFieldName -> ObjUtil.isNotNull(fieldMap.get(bcpFieldName)))
-                                 .map(fieldMap::get).toArray(Field[]::new);
+                .map(fieldMap::get).toArray(Field[]::new);
         this.createTime = LocalDateTime.now();
         this.createTime = LocalDateTime.now();
     }
     }
 
 
-    public void dataProcess(List<String> l) {
-        Result result = getResult(l);
+    public void dataProcess(List<String> datas) {
+        Result result = getResult(datas);
         if (result == null) {
         if (result == null) {
             return;
             return;
         }
         }
@@ -164,27 +168,26 @@ public class DataProcess {
             log.error("执行插入语句错误", e);
             log.error("执行插入语句错误", e);
         }
         }
         EdsMediaFileMapper edsMediaFileMapper = SpringUtil.getBean(EdsMediaFileMapper.class);
         EdsMediaFileMapper edsMediaFileMapper = SpringUtil.getBean(EdsMediaFileMapper.class);
+        dataCountInfo.buildDirTreeCountByTbName(tableName, edsEntityFieldInfo, result.getDataList());
         if (CollUtil.isNotEmpty(result.getMediaFiles())) {
         if (CollUtil.isNotEmpty(result.getMediaFiles())) {
+            dataCountInfo.buildDirTreeCountWithMediaFile(result.getMediaFiles());
             //异步保存媒体文件
             //异步保存媒体文件
-            GlobalPool.BCP_FILE_DB_POOL.execute(() -> {
-                edsMediaFileMapper.insert(result.getMediaFiles());
-            });
+            GlobalPool.BCP_FILE_DB_POOL.execute(() -> edsMediaFileMapper.insert(result.getMediaFiles()));
         }
         }
 
 
     }
     }
 
 
-    public Result getResult(List<String> l) {
-        if (CollUtil.isEmpty(l)) {
+    public Result getResult(List<String> datas) {
+        if (CollUtil.isEmpty(datas)) {
             return null;
             return null;
         }
         }
         List<Object> dataList = new ArrayList<>();
         List<Object> dataList = new ArrayList<>();
         List<EdsMediaFile> mediaFiles = new ArrayList<>();
         List<EdsMediaFile> mediaFiles = new ArrayList<>();
-        for (String v : l) {
-            String[] oneLineData = this.columnSeparator.split(v, -1);
+        for (String d : datas) {
+            String[] oneLineData = this.columnSeparator.split(d, -1);
             String md5Hex = DigestUtil.md5Hex(ArrayUtil.join(oneLineData, ""));
             String md5Hex = DigestUtil.md5Hex(ArrayUtil.join(oneLineData, ""));
             Object obj = ReflectUtil.newInstance(cls);
             Object obj = ReflectUtil.newInstance(cls);
             ReflectUtil.setFieldValue(obj, "md5", md5Hex);
             ReflectUtil.setFieldValue(obj, "md5", md5Hex);
-            ReflectUtil.setFieldValue(obj, "caseId", caseId);
             //按列数与字段数中较小者遍历
             //按列数与字段数中较小者遍历
             int minLength = Math.min(this.bcpFiledArr.length, oneLineData.length);
             int minLength = Math.min(this.bcpFiledArr.length, oneLineData.length);
             for (int j = 0; j < minLength; j++) {
             for (int j = 0; j < minLength; j++) {
@@ -348,7 +351,7 @@ public class DataProcess {
                     //取扩展名
                     //取扩展名
                     String extName = StrUtil.emptyToDefault(FileNameUtil.getSuffix(file), FileNameUtil.getSuffix(filename));
                     String extName = StrUtil.emptyToDefault(FileNameUtil.getSuffix(file), FileNameUtil.getSuffix(filename));
                     //执行复制上传
                     //执行复制上传
-                    FileDTO fileDTO = LocalStorage.getInstance().copyFile(mediaType, file, caseId,cid);
+                    FileDTO fileDTO = LocalStorage.getInstance().copyFile(mediaType, file, cid);
                     if (ObjUtil.isNull(fileDTO)) {
                     if (ObjUtil.isNull(fileDTO)) {
                         return null;
                         return null;
                     }
                     }
@@ -356,8 +359,8 @@ public class DataProcess {
                     //组装媒体文件记录
                     //组装媒体文件记录
                     LocalDateTime mailSendTime = mailSendTimeField != null ? (LocalDateTime) mailSendTimeField.get(data) : null;
                     LocalDateTime mailSendTime = mailSendTimeField != null ? (LocalDateTime) mailSendTimeField.get(data) : null;
                     return EdsMediaFile.builder().collectTargetId(cid).mediaName(filename).mediaSize(file.length()).mediaPath(fileDTO.getPath())
                     return EdsMediaFile.builder().collectTargetId(cid).mediaName(filename).mediaSize(file.length()).mediaPath(fileDTO.getPath())
-                                       .mediaSmallPath(fileDTO.getUrl()).mediaType(typeCode).deleteStatus(deleteStatus).createTime(createTime)
-                                       .suffixName(extName).hashcode("").tbName(tableName).mailSendTime(mailSendTime).build();
+                            .mediaSmallPath(fileDTO.getUrl()).mediaType(typeCode).deleteStatus(deleteStatus).createTime(createTime)
+                            .suffixName(extName).hashcode("").tbName(tableName).mailSendTime(mailSendTime).build();
                 }
                 }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
@@ -367,5 +370,4 @@ public class DataProcess {
     }
     }
 
 
 
 
-
 }
 }

+ 43 - 9
ai-server/src/main/java/com/zsjz/ai/module/eds/xml/EdsExtra.java

@@ -1,6 +1,7 @@
 package com.zsjz.ai.module.eds.xml;
 package com.zsjz.ai.module.eds.xml;
 
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.io.file.PathUtil;
 import cn.hutool.core.io.file.PathUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.RandomUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.core.util.StrUtil;
@@ -8,12 +9,16 @@ import com.thoughtworks.xstream.XStream;
 import com.zsjz.ai.common.model.dm.entity.FileInfo;
 import com.zsjz.ai.common.model.dm.entity.FileInfo;
 import com.zsjz.ai.module.dm.mapper.FileInfoMapper;
 import com.zsjz.ai.module.dm.mapper.FileInfoMapper;
 import com.zsjz.ai.module.eds.enums.EdsEntityEnum;
 import com.zsjz.ai.module.eds.enums.EdsEntityEnum;
+import com.zsjz.ai.module.eds.enums.EdsTreeEnum;
 import com.zsjz.ai.module.eds.mapper.EdsImportMaterialMapper;
 import com.zsjz.ai.module.eds.mapper.EdsImportMaterialMapper;
+import com.zsjz.ai.module.eds.mapper.EdsTreeCountMapper;
 import com.zsjz.ai.module.eds.po.EdsEntityFieldInfo;
 import com.zsjz.ai.module.eds.po.EdsEntityFieldInfo;
+import com.zsjz.ai.module.eds.po.EdsTreeCount;
 import com.zsjz.ai.module.eds.po.basic.EdsMforensics010100;
 import com.zsjz.ai.module.eds.po.basic.EdsMforensics010100;
+import com.zsjz.ai.module.eds.utils.DataCountInfo;
 import com.zsjz.ai.module.eds.utils.Eds;
 import com.zsjz.ai.module.eds.utils.Eds;
-import com.zsjz.ai.module.eds.utils.EtlRedisKey;
 import com.zsjz.ai.module.eds.utils.EdsConstant;
 import com.zsjz.ai.module.eds.utils.EdsConstant;
+import com.zsjz.ai.module.eds.utils.EtlRedisKey;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.data.redis.core.StringRedisTemplate;
@@ -25,8 +30,11 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
 import java.util.stream.Stream;
 import java.util.stream.Stream;
 
 
+import static java.util.stream.Collectors.groupingBy;
+
 /**
 /**
  * 数据包解压提取服务。
  * 数据包解压提取服务。
  *
  *
@@ -44,6 +52,7 @@ public class EdsExtra {
     private final EdsImportMaterialMapper edsImportMaterialMapper;
     private final EdsImportMaterialMapper edsImportMaterialMapper;
 
 
     private final FileInfoMapper fileInfoMapper;
     private final FileInfoMapper fileInfoMapper;
+    private final EdsTreeCountMapper edsTreeCountMapper;
 
 
 
 
     /**
     /**
@@ -104,7 +113,6 @@ public class EdsExtra {
         dto.setZipPath(zipPath);
         dto.setZipPath(zipPath);
         dto.setUserName(wm0101.getName());
         dto.setUserName(wm0101.getName());
         xmlMessage.setCollectTargetId(ctId);
         xmlMessage.setCollectTargetId(ctId);
-        xmlMessage.setCaseId(dto.getCaseId());
         xmlMessage.setEfd(dto);
         xmlMessage.setEfd(dto);
         long randomLong1 = RandomUtil.randomLong(56, 70);
         long randomLong1 = RandomUtil.randomLong(56, 70);
         //解析数据并批量入库
         //解析数据并批量入库
@@ -117,7 +125,8 @@ public class EdsExtra {
         //逐表解析入库
         //逐表解析入库
         List<DataInfo> dataInfoList = xmlMessage.getDataInfoList();
         List<DataInfo> dataInfoList = xmlMessage.getDataInfoList();
         int dataInfoSize = dataInfoList.size();
         int dataInfoSize = dataInfoList.size();
-
+        //计数
+        final DataCountInfo dataCountInfo = new DataCountInfo(collectTargetId);
         String key = EtlRedisKey.BCP_DATA_SET + collectTargetId;
         String key = EtlRedisKey.BCP_DATA_SET + collectTargetId;
         stringRedisTemplate.opsForValue().set(key, String.valueOf(dataInfoSize));
         stringRedisTemplate.opsForValue().set(key, String.valueOf(dataInfoSize));
         int progress = 70;
         int progress = 70;
@@ -126,18 +135,18 @@ public class EdsExtra {
         for (DataInfo dataInfo : dataInfoList) {
         for (DataInfo dataInfo : dataInfoList) {
             log.info("开始提取bcp数据:{}", dataInfo.getTableName());
             log.info("开始提取bcp数据:{}", dataInfo.getTableName());
             try {
             try {
-                exec(dataInfo, xmlMessage);
+                exec(dataInfo, xmlMessage, dataCountInfo);
             } finally {
             } finally {
                 Long remaining = stringRedisTemplate.opsForValue().decrement(key);
                 Long remaining = stringRedisTemplate.opsForValue().decrement(key);
                 if (remaining != null && remaining <= 0) {
                 if (remaining != null && remaining <= 0) {
-                    finish(efd);
+                    finish(efd, dataCountInfo);
                 }
                 }
             }
             }
         }
         }
         return 0L;
         return 0L;
     }
     }
 
 
-    public void exec(DataInfo dataInfo, Message xmlMessage) {
+    public void exec(DataInfo dataInfo, Message xmlMessage, DataCountInfo dataCountInfo) {
         //确定表名与实体信息
         //确定表名与实体信息
         String tableName = dataInfo.getValByIk(Eds.TABLE_NAME_IK).toLowerCase();
         String tableName = dataInfo.getValByIk(Eds.TABLE_NAME_IK).toLowerCase();
         Class<?> cls = EdsEntityEnum.findClsByTableName(tableName);
         Class<?> cls = EdsEntityEnum.findClsByTableName(tableName);
@@ -147,9 +156,8 @@ public class EdsExtra {
             return;
             return;
         }
         }
         EdsEntityFieldInfo edsEntityFieldInfo = Eds.getPojoFieldInfo(cls);
         EdsEntityFieldInfo edsEntityFieldInfo = Eds.getPojoFieldInfo(cls);
-        DataProcess dataProcess = new DataProcess(dataInfo, cls);
+        DataProcess dataProcess = new DataProcess(dataInfo, cls, dataCountInfo);
         dataProcess.setCid(xmlMessage.getCollectTargetId());
         dataProcess.setCid(xmlMessage.getCollectTargetId());
-        dataProcess.setCaseId(xmlMessage.getCaseId());
         dataProcess.setBcpDir(xmlMessage.getBcpDirPath());
         dataProcess.setBcpDir(xmlMessage.getBcpDirPath());
         dataProcess.setStringRedisTemplate(stringRedisTemplate);
         dataProcess.setStringRedisTemplate(stringRedisTemplate);
         dataProcess.setTableName(tableName);
         dataProcess.setTableName(tableName);
@@ -214,7 +222,7 @@ public class EdsExtra {
      *
      *
      * @param dto 提取任务信息
      * @param dto 提取任务信息
      */
      */
-    public void finish(ExtraFileDTO dto) {
+    public void finish(ExtraFileDTO dto, DataCountInfo dataCountInfo) {
         Eds.delZip(dto.getBcpDir(), dto.getZipPath());
         Eds.delZip(dto.getBcpDir(), dto.getZipPath());
         String errMsg = StrUtil.format("数据包[{}]:已提取完成。", dto.getFileName());
         String errMsg = StrUtil.format("数据包[{}]:已提取完成。", dto.getFileName());
         String dataCnt = EtlRedisKey.BCP_DATA_CNT + dto.getCti();
         String dataCnt = EtlRedisKey.BCP_DATA_CNT + dto.getCti();
@@ -227,7 +235,33 @@ public class EdsExtra {
         fileBean.setFileType("1");
         fileBean.setFileType("1");
         fileBean.setFilePath(dto.getPath().toString());
         fileBean.setFilePath(dto.getPath().toString());
         fileInfoMapper.insert(fileBean);
         fileInfoMapper.insert(fileBean);
+        addDirTreeCount(dataCountInfo);
     }
     }
 
 
+    /**
+     * 将dirTreeCountList入库
+     */
+    private void addDirTreeCount(DataCountInfo dataCountInfo) {
+        //最终dirTreeCountList
+        List<EdsTreeCount> dirTreeCountList = dataCountInfo.finalDirTreeCountList();
+        //分组统计父目录数量
+        List<EdsTreeCount> parentList = dirTreeCountList.stream()
+                .filter(dirTree -> StrUtil.isNotEmpty(dirTree.getParentId()))
+                .collect(groupingBy(EdsTreeCount::getParentId))
+                .entrySet().stream().map(parentEntry -> {
+                    List<EdsTreeCount> childList = parentEntry.getValue();
+                    //聚合总数量和删除数量
+                    EdsTreeCount dirTreeWithNum = EdsTreeEnum.aggDirTreeNum(childList);
+                    //设置id,cid
+                    dirTreeWithNum.setDtId(parentEntry.getKey());
+                    dirTreeWithNum.setCollectTargetId(childList.getFirst().getCollectTargetId());
+                    return dirTreeWithNum;
+                }).toList();
+        //添加父目录
+        dirTreeCountList.addAll(parentList);
+        if (CollectionUtil.isNotEmpty(dirTreeCountList)) {
+            edsTreeCountMapper.insert(dirTreeCountList);
+        }
+    }
 
 
 }
 }

+ 0 - 2
ai-server/src/main/java/com/zsjz/ai/module/eds/xml/Message.java

@@ -52,8 +52,6 @@ public class Message {
      */
      */
     private String collectTargetId;
     private String collectTargetId;
 
 
-    private Long caseId;
-
     /**
     /**
      * MySQL 字段包裹符
      * MySQL 字段包裹符
      */
      */