From 41a8d1d5ff0192baaba3130f3113a6ccfbcf6a33 Mon Sep 17 00:00:00 2001
From: jpy <812110275@qq.com>
Date: Sat, 27 May 2023 16:48:34 +0800
Subject: [PATCH] test

---
 screen-api/src/main/java/com/moral/api/service/impl/ExcelServiceImpl.java |   62 +++++++++++++++++++------------
 1 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/screen-api/src/main/java/com/moral/api/service/impl/ExcelServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/ExcelServiceImpl.java
index dbd6abe..0ffda38 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/ExcelServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/ExcelServiceImpl.java
@@ -36,8 +36,7 @@
 import com.moral.api.pojo.vo.excel.ExcelVo;
 import com.moral.api.service.ExcelService;
 import com.moral.api.utils.ExcelUtils;
-import com.moral.pojo.AQI;
-import com.moral.util.AQIUtils;
+
 import com.moral.util.DateUtils;
 
 
@@ -48,7 +47,7 @@
     private ExcelMapper excelMapper;
 
     /**
-     * ������
+     * ���������������
      * @param files
      * @param params
      * @return
@@ -56,11 +55,12 @@
      */
     @Override
     public ExcelBO importTemplate(List<MultipartFile> files, Map<String, Object> params) throws IOException {
+        Date date2 = new Date();
         String time = (String) params.get("time");
         String code = (String) params.get("code");
-        String time1 = (String) params.get("date");
+//        String time1 = (String) params.get("date");
         Date date = DateUtils.getDate(time, "yyyy-MM-dd");
-        Date date1 = DateUtils.getDate(time1, "yyyy-MM-dd");
+//        Date date1 = DateUtils.getDate(time1, "yyyy-MM-dd");
         ExcelBO excelBO = new ExcelBO();
         QueryWrapper<TbExcel> wrapper = new QueryWrapper<>();
         wrapper.eq("time",date).eq("code",code);
@@ -83,18 +83,20 @@
             MultipartFile file5 = files.get(4);
             Map<String, Object> map5 = getMap5(file5);
             map.put("c5",map5);
-            MultipartFile file6 = files.get(5);
-            Map<String, Object> map6 = getMap6(file6);
-            map.put("c6",map6);
+            if (files.size()>5){
+                MultipartFile file6 = files.get(5);
+                Map<String, Object> map6 = getMap6(file6);
+                map.put("c6",map6);
+            }
             String s = JSON.toJSONString(map);
             excel1.setValue(s);
             excel1.setTime(date);
             excel1.setCode(code);
-            excel1.setDate(date1);
+            excel1.setDate(date2);
             excelMapper.insert(excel1);
             excelBO.setId(excel1.getId());
             excelBO.setTime(excel1.getTime());
-            excelBO.setDate(excel1.getDate());
+            excelBO.setDate(date2);
 
         }else {
             HashMap<String, Object> map = new HashMap<>();
@@ -113,28 +115,28 @@
             MultipartFile file5 = files.get(4);
             Map<String, Object> map5 = getMap5(file5);
             map.put("c5",map5);
-            MultipartFile file6 = files.get(5);
-            Map<String, Object> map6 = getMap6(file6);
-            map.put("c6",map6);
+            if (files.size()>5){
+                MultipartFile file6 = files.get(5);
+                Map<String, Object> map6 = getMap6(file6);
+                map.put("c6",map6);
+            }
             String s = JSON.toJSONString(map);
             excel.setValue(s);
             excelMapper.updateById(excel);
             excelBO.setId(excel.getId());
             excelBO.setTime(excel.getTime());
-            excelBO.setDate(excel.getDate());
+            excelBO.setDate(date2);
         }
         return excelBO;
     }
 
     /**
-     * ������
+     * ���������������
      * @param id
      * @return
      */
     @Override
     public ExcelVo export(Integer id) {
-
-
         HashMap<String, Object> map1 = new HashMap<>();
         ArrayList<Map<String,Object>> list1 = new ArrayList<>();
         ArrayList<Map<String,Object>> list2 = new ArrayList<>();
@@ -180,11 +182,19 @@
                 Map map5 = JSON.parseObject(s, Map.class);
                 Set set1s = map5.keySet();
                 for (Object set1 : set1s) {
-                    Object o1 = map5.get(set1);
-                    String s1 = JSON.toJSONString(o1);
-                    Map map6 = JSON.parseObject(s1, Map.class);
-                    map6.put("place",set1);
-                    list3.add(map6);
+                    if (set1.equals("���������")){
+                        Object o1 = map5.get(set1);
+                        String s1 = JSON.toJSONString(o1);
+                        Map map6 = JSON.parseObject(s1, Map.class);
+                        map6.put("place","���������");
+                        list3.add(map6);
+                    }else {
+                        Object o1 = map5.get(set1);
+                        String s1 = JSON.toJSONString(o1);
+                        Map map6 = JSON.parseObject(s1, Map.class);
+                        map6.put("place",set1.toString().substring(3));
+                        list3.add(map6);
+                    }
                 }
             }
             if (set.equals("c4")){
@@ -384,7 +394,7 @@
 //                "������8���������������������90���������������������"+O3y+"������/������������������"+code5+"%���" +
 //                "���������������������������������"+AQIy+"%���������"+code6+"%���";
 
-        excelVo.setQuality(s3+s4);
+        excelVo.setQuality(s4+s3);
         excelVo.setSu(s1);
         excelVo.setCount(count);
         excelVo.setPM10(PM10);
@@ -590,7 +600,11 @@
                 objects[j] = value;
             }
             HashMap<String, Object> map = new HashMap<>();
-            map.put("place", objects[0]);
+            if (objects[0].toString().equals("���������")){
+                map.put("place", "���������");
+            }else {
+                map.put("place",objects[0].toString().substring(3));
+            }
             map.put("������", objects[1]);
             map.put("SO2", objects[2]);
             map.put("SO2���������", objects[3]);

--
Gitblit v1.8.0