| | |
| | | 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; |
| | | |
| | | |
| | |
| | | private ExcelMapper excelMapper; |
| | | |
| | | /** |
| | | * 导入 |
| | | * 高新区导入 |
| | | * @param files |
| | | * @param params |
| | | * @return |
| | |
| | | */ |
| | | @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); |
| | |
| | | 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<>(); |
| | |
| | | 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<>(); |
| | |
| | | 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")){ |
| | |
| | | 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]); |