|
@@ -3,6 +3,7 @@ package cn.com.ty.lift.common.utils;
|
|
|
import cn.com.ty.lift.common.model.StatisticsKVModel;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
|
+import java.io.*;
|
|
|
import java.lang.reflect.Method;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -159,7 +160,7 @@ public class ProjectUtils {
|
|
|
outStatisticsKVModel.setKey(key);
|
|
|
//判断值是否为也为map如果是就行封装 目前只涉及一层封装
|
|
|
if (value != null && value instanceof Map) {
|
|
|
- outStatisticsKVModel.setValue(transReturnMapToStatisticsKVModel((Map)value));
|
|
|
+ outStatisticsKVModel.setValue(transReturnMapToStatisticsKVModel((Map) value));
|
|
|
} else {
|
|
|
outStatisticsKVModel.setValue(value);
|
|
|
}
|
|
@@ -169,4 +170,25 @@ public class ProjectUtils {
|
|
|
return statisticsKVModelList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param list 要拷贝的list
|
|
|
+ * @return 返回拷贝后的对象
|
|
|
+ * @description 对集合进行拷贝
|
|
|
+ * @date 2020/4/16 5:05 下午
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public static <T> List<T> deepCopy(List<T> list) {
|
|
|
+ List<T> dest = new ArrayList<>();
|
|
|
+ try (ByteArrayOutputStream byteOut = new ByteArrayOutputStream()) {
|
|
|
+ ObjectOutputStream out = new ObjectOutputStream(byteOut);
|
|
|
+ out.writeObject(list);
|
|
|
+ ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
|
|
|
+ ObjectInputStream in = new ObjectInputStream(byteIn);
|
|
|
+ dest = (List<T>) in.readObject();
|
|
|
+ } catch (IOException | ClassNotFoundException e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return dest;
|
|
|
+ }
|
|
|
+
|
|
|
}
|