浏览代码

数据看板,数据返回格式修改

yangzian 3 年之前
父节点
当前提交
e6ef51eb3c

+ 6 - 3
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/BossDataExhibitionMapper.xml

@@ -138,8 +138,8 @@
         </where>
         GROUP BY
         company_id ) t
-        GROUP BY
-        t.area;
+        GROUP BY t.area
+        ORDER BY t.area DESC;
     </select>
 
     <!--  分公司素材消耗 快手 -->
@@ -178,7 +178,8 @@
         GROUP BY
         company_id
         ) t
-        GROUP BY t.area;
+        GROUP BY t.area
+        ORDER BY t.area DESC;
     </select>
 
     <!--  素材相关===素材使用率===头条 -->
@@ -400,6 +401,7 @@
         </where>
         GROUP BY
         company_id ) t
+        where t.tcost > 0
         GROUP BY
         t.area;
     </select>
@@ -448,6 +450,7 @@
         </where>
         GROUP BY
         company_id ) t
+        where t.tcost > 0
         GROUP BY
         t.area;
     </select>

+ 19 - 33
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/BossDataExhibitionServiceImpl.java

@@ -213,7 +213,6 @@ public class BossDataExhibitionServiceImpl implements IBossDataExhibitionService
         }else if (StringUtils.equals("2",mediaType)){
             resultList = bossDataExhibitionMapper.getMediaTypeAccountTrendKuaishou(stat_tim,end_tim);
         }
-
         if (Check.isNull(resultList)) {
             return Result.error("账户消耗数据查询为空");
         }
@@ -225,47 +224,34 @@ public class BossDataExhibitionServiceImpl implements IBossDataExhibitionService
         Map<String,List<AccountTrendPojo>> map = resultList.stream().collect(Collectors.groupingBy(AccountTrendPojo::getArea));
 
         //1-华北
-        List<AccountTrendPojo> huaBeiList = !map.containsKey("华北") ? null : map.get("华北");
-
-        List<String> huaBeiCostList = new ArrayList();
-        if (!Check.isNull(huaBeiList)){
-            //获取数据 时间 集合
-            List<String> huabeiTime = huaBeiList.stream().map(AccountTrendPojo::getTime).collect(Collectors.toList());
-            // 补充数据
-            huaBeiList = getDateSupplement(betweenDaysList,huabeiTime,huaBeiList);
-            // 获取属性 cost 返回数组
-            huaBeiCostList = huaBeiList.stream().map(AccountTrendPojo::getCost).collect(Collectors.toList());
-        }
+        List<AccountTrendPojo> huaBeiList = !map.containsKey("华北") ? new ArrayList<>() : map.get("华北");
+        //获取数据 时间 集合
+        List<String> huabeiTime = huaBeiList.stream().map(AccountTrendPojo::getTime).collect(Collectors.toList());
+        // 补充数据
+        huaBeiList = getDateSupplement(betweenDaysList,huabeiTime,huaBeiList);
+        // 获取属性 cost 返回数组
+        List<String> huaBeiCostList = huaBeiList.stream().map(AccountTrendPojo::getCost).collect(Collectors.toList());
         resultMap.put("huaBei",huaBeiCostList);
 
         //2-华南
-        List<String> huaNanCostList = new ArrayList();
-        List<AccountTrendPojo> huaNanList = !map.containsKey("华南") ? null : map.get("华南");
-        if (!Check.isNull(huaNanList)){
-            List<String> huaNanTime = huaNanList.stream().map(AccountTrendPojo::getTime).collect(Collectors.toList());
-            huaNanList = getDateSupplement(betweenDaysList,huaNanTime,huaNanList);
-            huaNanCostList = huaNanList.stream().map(AccountTrendPojo::getCost).collect(Collectors.toList());
-        }
+        List<AccountTrendPojo> huaNanList = !map.containsKey("华南") ? new ArrayList<>() : map.get("华南");
+        List<String> huaNanTime = huaNanList.stream().map(AccountTrendPojo::getTime).collect(Collectors.toList());
+        huaNanList = getDateSupplement(betweenDaysList,huaNanTime,huaNanList);
+        List<String> huaNanCostList = huaNanList.stream().map(AccountTrendPojo::getCost).collect(Collectors.toList());
         resultMap.put("huaNan",huaNanCostList);
 
         //3-华东
-        List<String> huaDongCostList = new ArrayList();
-        List<AccountTrendPojo> huaDongList = !map.containsKey("华东") ? null : map.get("华东");
-        if (!Check.isNull(huaDongList)){
-            List<String> huaDongTime = huaDongList.stream().map(AccountTrendPojo::getTime).collect(Collectors.toList());
-            huaDongList = getDateSupplement(betweenDaysList,huaDongTime,huaDongList);
-            huaDongCostList = huaDongList.stream().map(AccountTrendPojo::getCost).collect(Collectors.toList());
-        }
+        List<AccountTrendPojo> huaDongList = !map.containsKey("华东") ? new ArrayList<>() : map.get("华东");
+        List<String> huaDongTime = huaDongList.stream().map(AccountTrendPojo::getTime).collect(Collectors.toList());
+        huaDongList = getDateSupplement(betweenDaysList,huaDongTime,huaDongList);
+        List<String> huaDongCostList = huaDongList.stream().map(AccountTrendPojo::getCost).collect(Collectors.toList());
         resultMap.put("huaDong",huaDongCostList);
 
         //4-骄阳
-        List<String> jiaoYangCostList = new ArrayList();
-        List<AccountTrendPojo> jiaoYangList = !map.containsKey("骄阳") ? null : map.get("骄阳");
-        if (!Check.isNull(jiaoYangList)){
-            List<String> jiaoYangTime = jiaoYangList.stream().map(AccountTrendPojo::getTime).collect(Collectors.toList());
-            jiaoYangList = getDateSupplement(betweenDaysList,jiaoYangTime,jiaoYangList);
-            jiaoYangCostList = jiaoYangList.stream().map(AccountTrendPojo::getCost).collect(Collectors.toList());
-        }
+        List<AccountTrendPojo> jiaoYangList = !map.containsKey("骄阳") ? new ArrayList<>() : map.get("骄阳");
+        List<String> jiaoYangTime = jiaoYangList.stream().map(AccountTrendPojo::getTime).collect(Collectors.toList());
+        jiaoYangList = getDateSupplement(betweenDaysList,jiaoYangTime,jiaoYangList);
+        List<String> jiaoYangCostList = jiaoYangList.stream().map(AccountTrendPojo::getCost).collect(Collectors.toList());
         resultMap.put("jiaoYang",jiaoYangCostList);
 
         return Result.successMsg(("1".equals(mediaType) ? "【头条】" : "【快手】")+"===分公司-分日-账户消耗数据查询成功。",resultMap);