|
@@ -8,7 +8,6 @@ import cn.com.ctop.kuaishou.modules.live.enums.liveDataUtil;
|
|
|
import cn.com.ctop.kuaishou.modules.live.mapper.LiveDataPriceMapper;
|
|
|
import cn.com.ctop.kuaishou.modules.live.service.ILiveDataPriceService;
|
|
|
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;
|
|
@@ -73,8 +72,9 @@ public class LiveDataPriceServiceImpl extends ServiceImpl<LiveDataPriceMapper, L
|
|
|
if (!titleObj.containsValue(TYPE)) {
|
|
|
return Result.error("导入失败,文档中不包含【设备价格】字段");
|
|
|
}
|
|
|
- List<JSONObject> array = new ArrayList<>();
|
|
|
+ List<JSONObject> array = new ArrayList<>();
|
|
|
for (int i = 1; i <= rows + 1; i++) {
|
|
|
+ boolean flag = false;
|
|
|
Row row = sheet.getRow(i);
|
|
|
if (row != null) {
|
|
|
JSONObject entityObj = new JSONObject();
|
|
@@ -85,11 +85,15 @@ public class LiveDataPriceServiceImpl extends ServiceImpl<LiveDataPriceMapper, L
|
|
|
return Result.error("数据缺失,文档中第" + (i + 1) + "行,【" + ProvinceEnum.getNameByCode(code) + "】为空项,请补充完善后导入");
|
|
|
}
|
|
|
//不要汇总这条数据
|
|
|
- if(value.contains("汇总")){
|
|
|
+ if (value.contains("汇总")) {
|
|
|
+ flag = true;
|
|
|
continue;
|
|
|
}
|
|
|
entityObj.put(code, value);
|
|
|
}
|
|
|
+ if (flag) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
entityObj.put("accountId", accountId);
|
|
|
entityObj.put("statMonth", statMonth);
|
|
|
entityObj.put("id", accountId + "_" + DateUtils.formatDate("yyyyMMdd") + "_" + UUID.randomUUID().toString().replace("-", "").substring(0, 9));
|
|
@@ -138,8 +142,9 @@ public class LiveDataPriceServiceImpl extends ServiceImpl<LiveDataPriceMapper, L
|
|
|
return Result.error("导入失败,文档中不包含【设备价格】字段");
|
|
|
}
|
|
|
|
|
|
- List<JSONObject> array = new ArrayList<>();
|
|
|
+ List<JSONObject> array = new ArrayList<>();
|
|
|
for (int i = 1; i < list.size(); i++) {
|
|
|
+ boolean flag = false;
|
|
|
List<String> values = list.get(i);
|
|
|
JSONObject entityObj = new JSONObject();
|
|
|
for (int j = 0; j < values.size(); j++) {
|
|
@@ -149,7 +154,8 @@ public class LiveDataPriceServiceImpl extends ServiceImpl<LiveDataPriceMapper, L
|
|
|
return Result.error("数据缺失,文档中第" + (i + 1) + "行,【" + ProvinceEnum.getNameByCode(code) + "】为空项,请补充完善后导入");
|
|
|
}
|
|
|
//不要汇总这条数据
|
|
|
- if(value.contains("汇总")){
|
|
|
+ if (value.contains("汇总")) {
|
|
|
+ flag = true;
|
|
|
continue;
|
|
|
}
|
|
|
if (value.contains("%")) {
|
|
@@ -164,6 +170,9 @@ public class LiveDataPriceServiceImpl extends ServiceImpl<LiveDataPriceMapper, L
|
|
|
entityObj.put(code, value);
|
|
|
}
|
|
|
}
|
|
|
+ if (flag) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
entityObj.put("accountId", accountId);
|
|
|
entityObj.put("statMonth", statMonth);
|
|
|
entityObj.put("id", accountId + "_" + DateUtils.formatDate("yyyyMMdd") + "_" + UUID.randomUUID().toString().replace("-", "").substring(0, 9));
|