瀏覽代碼

直播数据报表 报表数据去除汇总

zhaoxian 3 年之前
父節點
當前提交
5685dc2ad5

+ 14 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/service/impl/LiveDataAgeServiceImpl.java

@@ -8,7 +8,6 @@ import cn.com.ctop.kuaishou.modules.live.enums.liveDataUtil;
 import cn.com.ctop.kuaishou.modules.live.mapper.LiveDataAgeMapper;
 import cn.com.ctop.kuaishou.modules.live.service.ILiveDataAgeService;
 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;
@@ -74,8 +73,9 @@ public class LiveDataAgeServiceImpl extends ServiceImpl<LiveDataAgeMapper, LiveD
             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();
@@ -86,11 +86,15 @@ public class LiveDataAgeServiceImpl extends ServiceImpl<LiveDataAgeMapper, LiveD
                         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));
@@ -139,8 +143,9 @@ public class LiveDataAgeServiceImpl extends ServiceImpl<LiveDataAgeMapper, LiveD
             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++) {
@@ -150,7 +155,8 @@ public class LiveDataAgeServiceImpl extends ServiceImpl<LiveDataAgeMapper, LiveD
                     return Result.error("数据缺失,文档中第" + (i + 1) + "行,【" + ProvinceEnum.getNameByCode(code) + "】为空项,请补充完善后导入");
                 }
                 //不要汇总这条数据
-                if(value.contains("汇总")){
+                if (value.contains("汇总")) {
+                    flag = true;
                     continue;
                 }
                 if (value.contains("%")) {
@@ -165,6 +171,9 @@ public class LiveDataAgeServiceImpl extends ServiceImpl<LiveDataAgeMapper, LiveD
                     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));

+ 14 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/service/impl/LiveDataGenderServiceImpl.java

@@ -9,7 +9,6 @@ import cn.com.ctop.kuaishou.modules.live.enums.liveDataUtil;
 import cn.com.ctop.kuaishou.modules.live.mapper.LiveDataGenderMapper;
 import cn.com.ctop.kuaishou.modules.live.service.ILiveDataGenderService;
 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;
@@ -75,8 +74,9 @@ public class LiveDataGenderServiceImpl extends ServiceImpl<LiveDataGenderMapper,
             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();
@@ -87,11 +87,15 @@ public class LiveDataGenderServiceImpl extends ServiceImpl<LiveDataGenderMapper,
                         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));
@@ -140,8 +144,9 @@ public class LiveDataGenderServiceImpl extends ServiceImpl<LiveDataGenderMapper,
             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++) {
@@ -151,7 +156,8 @@ public class LiveDataGenderServiceImpl extends ServiceImpl<LiveDataGenderMapper,
                     return Result.error("数据缺失,文档中第" + (i + 1) + "行,【" + ProvinceEnum.getNameByCode(code) + "】为空项,请补充完善后导入");
                 }
                 //不要汇总这条数据
-                if(value.contains("汇总")){
+                if (value.contains("汇总")) {
+                    flag = true;
                     continue;
                 }
                 if (value.contains("%")) {
@@ -166,6 +172,9 @@ public class LiveDataGenderServiceImpl extends ServiceImpl<LiveDataGenderMapper,
                     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));

+ 14 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/service/impl/LiveDataPriceServiceImpl.java

@@ -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));

+ 12 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/live/service/impl/LiveDataProvinceServiceImpl.java

@@ -75,6 +75,7 @@ public class LiveDataProvinceServiceImpl extends ServiceImpl<LiveDataProvinceMap
         }
         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();
@@ -86,11 +87,15 @@ public class LiveDataProvinceServiceImpl extends ServiceImpl<LiveDataProvinceMap
                         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));
@@ -140,6 +145,7 @@ public class LiveDataProvinceServiceImpl extends ServiceImpl<LiveDataProvinceMap
         }
         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 +155,8 @@ public class LiveDataProvinceServiceImpl extends ServiceImpl<LiveDataProvinceMap
                     return Result.error("数据缺失,文档中第" + (i + 1) + "行,【" + ProvinceEnum.getNameByCode(code) + "】为空项,请补充完善后导入");
                 }
                 //不要汇总这条数据
-                if(value.contains("汇总")){
+                if (value.contains("汇总")) {
+                    flag = true;
                     continue;
                 }
                 if (value.contains("%")) {
@@ -164,6 +171,9 @@ public class LiveDataProvinceServiceImpl extends ServiceImpl<LiveDataProvinceMap
                     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));