|
|
@@ -1,12 +1,12 @@
|
|
|
package com.zsjz.ai.module.eds.utils;
|
|
|
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.IORuntimeException;
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Sets;
|
|
|
import com.zsjz.ai.common.exception.ServerException;
|
|
|
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.EdsBaseWmEmailCommon;
|
|
|
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.nio.file.Files;
|
|
|
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 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()
|
|
|
- .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))
|
|
|
.collect(Collectors.toList());
|
|
|
}
|
|
|
@@ -365,11 +426,11 @@ public class Eds {
|
|
|
* @param dirTree 目录树
|
|
|
* @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()
|
|
|
.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());
|
|
|
}
|
|
|
|
|
|
@@ -380,11 +441,11 @@ public class Eds {
|
|
|
* @param dirTree 目录树
|
|
|
* @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()
|
|
|
.flatMap(appTypeEntry -> appTypeEntry.getValue().entrySet().stream()
|
|
|
- .map(accountEntry -> new EdsDirTreeCount(cid, dirTree, accountEntry
|
|
|
+ .map(accountEntry -> new EdsTreeCount(cid, dirTree, accountEntry
|
|
|
.getValue().size(),
|
|
|
getDeleteNum(pojoField, accountEntry.getValue()), appTypeEntry.getKey(),
|
|
|
accountEntry.getKey())))
|