|
@@ -3,7 +3,6 @@ package cn.com.ctop.kuaishou.modules.live.service.impl;
|
|
|
import cn.com.ctop.common.module.utils.Check;
|
|
|
import cn.com.ctop.common.module.utils.ExportExcelUtils;
|
|
|
import cn.com.ctop.kuaishou.modules.live.entity.LiveDataTouch;
|
|
|
-import cn.com.ctop.kuaishou.modules.live.enums.ProvinceEnum;
|
|
|
import cn.com.ctop.kuaishou.modules.live.enums.TouchEnum;
|
|
|
import cn.com.ctop.kuaishou.modules.live.enums.liveDataUtil;
|
|
|
import cn.com.ctop.kuaishou.modules.live.mapper.LiveDataTouchMapper;
|
|
@@ -12,6 +11,7 @@ import cn.hutool.core.util.CharsetUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
@@ -69,7 +69,7 @@ public class LiveDataTouchServiceImpl extends ServiceImpl<LiveDataTouchMapper, L
|
|
|
//获取映射关系
|
|
|
JSONObject titleObj = liveDataUtil.getTouchTitle(eeu, titleRow, lastCellNum);
|
|
|
|
|
|
- JSONArray array = new JSONArray();
|
|
|
+ List<JSONObject> array = new ArrayList<>();
|
|
|
for (int i = 1; i <= rows + 1; i++) {
|
|
|
Row row = sheet.getRow(i);
|
|
|
if (row != null) {
|
|
@@ -89,7 +89,14 @@ public class LiveDataTouchServiceImpl extends ServiceImpl<LiveDataTouchMapper, L
|
|
|
}
|
|
|
}
|
|
|
if (!Check.isNull(array)) {
|
|
|
- baseMapper.replaceBatch(array);
|
|
|
+ if (array.size() > 5000) {
|
|
|
+ List<List<JSONObject>> splitVideos = Lists.partition(array, 5000);
|
|
|
+ for (List<JSONObject> splitVideo : splitVideos) {
|
|
|
+ baseMapper.replaceBatch(splitVideo);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ baseMapper.replaceBatch(array);
|
|
|
+ }
|
|
|
}
|
|
|
//记录枚举中不存在、不匹配的字段
|
|
|
String sign = titleObj.getString("sign");
|
|
@@ -118,7 +125,7 @@ public class LiveDataTouchServiceImpl extends ServiceImpl<LiveDataTouchMapper, L
|
|
|
List<List<String>> list = liveDataUtil.getCsvList(records);
|
|
|
//获取映射关系
|
|
|
JSONObject titleObj = liveDataUtil.getCsvTouchTitle(list.get(0));
|
|
|
- JSONArray array = new JSONArray();
|
|
|
+ List<JSONObject> array = new ArrayList<>();
|
|
|
for (int i = 1; i < list.size(); i++) {
|
|
|
List<String> values = list.get(i);
|
|
|
JSONObject entityObj = new JSONObject();
|
|
@@ -149,7 +156,14 @@ public class LiveDataTouchServiceImpl extends ServiceImpl<LiveDataTouchMapper, L
|
|
|
}
|
|
|
|
|
|
if (!Check.isNull(array)) {
|
|
|
- baseMapper.replaceBatch(array);
|
|
|
+ if (array.size() > 5000) {
|
|
|
+ List<List<JSONObject>> splitVideos = Lists.partition(array, 5000);
|
|
|
+ for (List<JSONObject> splitVideo : splitVideos) {
|
|
|
+ baseMapper.replaceBatch(splitVideo);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ baseMapper.replaceBatch(array);
|
|
|
+ }
|
|
|
}
|
|
|
//记录枚举中不存在活不匹配的字段
|
|
|
String sign = titleObj.getString("sign");
|