Browse Source

数据中心

hanfucheng 1 year ago
parent
commit
7a684444a9

+ 1 - 1
src/main/java/com/sooka/sponest/data/index/service/IndexViewService.java

@@ -61,5 +61,5 @@ public interface IndexViewService {
     * @author 韩福成
     * @date 2023/11/3 9:53
     */
-    List<Map<String,Object>> dataStatistics(MenuInfo menuInfo);
+    Map<String,Object> dataStatistics(MenuInfo menuInfo);
 }

+ 14 - 25
src/main/java/com/sooka/sponest/data/index/service/impl/IndexViewServiceImpl.java

@@ -312,23 +312,19 @@ public class IndexViewServiceImpl extends BaseServiceImpl implements IndexViewSe
     * @author 韩福成
     * @date 2023/11/3 11:19
     */
-    public List<Map<String,Object>> dataStatistics(MenuInfo menuInfo) {
-        List<Map<String,Object>> list = new ArrayList<>();
+    public Map<String,Object> dataStatistics(MenuInfo menuInfo) {
         setSookaDataBase(menuInfo);
         // 获取菜单信息
         List<MenuInfo> basicDataList = indexViewMapper.getBasicDataList(menuInfo);
-        /*List<MenuInfo> basicDataList = new ArrayList<>();
-        MenuInfo info = new MenuInfo();
-        info.setTableNameAndType("centerdata_t_emergency_team");
-        basicDataList.add(info);*/
-        Map<String,Object> map = new HashMap<>();
+        Map<String,Object> map = new LinkedHashMap<>();
         map.put("铁东区","0,100,365,372");
         map.put("铁西区","0,100,365,373");
         map.put("双辽市","0,100,365,369");
         map.put("伊通县","0,100,365,370");
         map.put("梨树县","0,100,365,371");
+        int a = 1;
+        Map<String,Object> td = new LinkedHashMap<>();
         for (Map.Entry<String, Object> m : map.entrySet()){
-            Map<String,Object> td = new HashMap<>();
             Long updateCount = 0L;
             Long count = 0L;
             for (MenuInfo item : basicDataList) {
@@ -346,41 +342,34 @@ public class IndexViewServiceImpl extends BaseServiceImpl implements IndexViewSe
                 info1.setEndDate(menuInfo.getEndDate());
                 updateCount += indexViewMapper.getBasicDataCount(info1);
             }
-            td.put("name",m.getKey());
-            td.put("count",count);
-            td.put("updateCount",updateCount);
+            td.put("count"+a,count);
+            td.put("updateCount"+a,updateCount);
             BigDecimal updateRate = new BigDecimal(0).setScale(2,RoundingMode.HALF_UP);
             if (updateCount!=0) {
                 BigDecimal counts = new BigDecimal(count);
                 BigDecimal updateCounts = new BigDecimal(updateCount);
                 updateRate = updateCounts.divide(counts,4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2,RoundingMode.HALF_UP);
             }
-            td.put("updateRate",updateRate+"%");
-            list.add(td);
+            td.put("updateRate"+a,updateRate+"%");
+            a+=1;
         }
         List<IndexViewInfo> indexViewInfoList = this.getBasicDataList(menuInfo);
-        String[] names = new String[]{"林业","农业","环保","资源","交通","消防","应急","水利",};
+        int b = 6;
         for (IndexViewInfo indexViewInfo : indexViewInfoList){
-            Map<String,Object> map1 = new HashMap<>();
             if (!indexViewInfo.getCategory().equals("共有基础数据类型")){
-                for (String name : names){
-                    if (indexViewInfo.getCategory().contains(name)){
-                        map1.put("name",name);
-                    }
-                }
-                map1.put("count",indexViewInfo.getCount());
-                map1.put("updateCount",indexViewInfo.getUpdataCount());
+                td.put("count"+b,indexViewInfo.getCount());
+                td.put("updateCount"+b,indexViewInfo.getUpdataCount());
                 BigDecimal updateRate = new BigDecimal(0).setScale(2,RoundingMode.HALF_UP);
                 if (indexViewInfo.getUpdataCount()!=0){
                     BigDecimal counts = new BigDecimal(indexViewInfo.getCount());
                     BigDecimal updateCounts = new BigDecimal(indexViewInfo.getUpdataCount());
                     updateRate = updateCounts.divide(counts,4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2,RoundingMode.HALF_UP);
                 }
-                map1.put("updateRate",updateRate+"%");
-                list.add(map1);
+                td.put("updateRate"+b,updateRate+"%");
             }
+            b+=1;
         }
-        return list;
+        return td;
     }
 }