From 66309ec82964316c3ae032fdcf2742d59179922c Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Thu, 05 Jan 2023 14:55:05 +0800 Subject: [PATCH] 列表数据导出 --- screen-api/src/main/java/com/moral/api/service/impl/ExcelServiceImpl.java | 44 +++++++++++++++++++++++++++----------------- 1 files changed, 27 insertions(+), 17 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 a551074..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); @@ -92,11 +92,11 @@ 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<>(); @@ -125,20 +125,18 @@ 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<>(); @@ -184,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")){ @@ -594,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