|
@@ -0,0 +1,211 @@
|
|
|
+//package com.nokia.hb.Controller;
|
|
|
+//
|
|
|
+//import com.alibaba.fastjson.JSON;
|
|
|
+//import com.nokia.hb.Service.DataViewService;
|
|
|
+//import org.springframework.stereotype.Controller;
|
|
|
+//import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+//import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+//import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+//import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+//
|
|
|
+//import javax.servlet.http.HttpServletResponse;
|
|
|
+//import java.io.ByteArrayInputStream;
|
|
|
+//import java.io.IOException;
|
|
|
+//import java.io.UnsupportedEncodingException;
|
|
|
+//import java.time.LocalDate;
|
|
|
+//import java.time.format.DateTimeFormatter;
|
|
|
+//import java.util.*;
|
|
|
+//
|
|
|
+//@Controller
|
|
|
+//@RequestMapping("/")
|
|
|
+//public class DataViewController {
|
|
|
+// public DataViewService dataViewService = new DataViewService();
|
|
|
+//
|
|
|
+// @GetMapping("initProvince")
|
|
|
+// @ResponseBody
|
|
|
+// public List<String> initProvince(String type) {
|
|
|
+// System.out.println("initProvince");
|
|
|
+// System.out.println(type);
|
|
|
+// return dataViewService.initProvince(type);
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("initCitys")
|
|
|
+// @ResponseBody
|
|
|
+// public List<String> initCitys(String type, String province) {
|
|
|
+// System.out.println("initCitys");
|
|
|
+// System.out.println(type);
|
|
|
+// System.out.println(province);
|
|
|
+//
|
|
|
+//
|
|
|
+// return dataViewService.initCitys(type, province);
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("search")
|
|
|
+// @ResponseBody
|
|
|
+// public String search(String from, String range, String stype, String ttype, String provinces, String citys) {
|
|
|
+// String[] split = range.split("-");
|
|
|
+// String t1 = split[0].trim();
|
|
|
+// String t2 = split[1].trim();
|
|
|
+// if (!"".equals(citys)) {
|
|
|
+// String[] split1 = citys.split(",");
|
|
|
+// citys = "";
|
|
|
+// for (String s : split1) {
|
|
|
+// citys += "'" + s + "'" + ",";
|
|
|
+// }
|
|
|
+// citys = citys.substring(0, citys.length() - 1);
|
|
|
+// }
|
|
|
+// String[] split2 = provinces.split(",");
|
|
|
+// provinces = "";
|
|
|
+// for (String s : split2) {
|
|
|
+// provinces += "'" + s + "'" + ",";
|
|
|
+// }
|
|
|
+// provinces = provinces.substring(0, provinces.length() - 1);
|
|
|
+// Map<String, List<Object>> search = dataViewService.search(from, t1, t2, stype, ttype, provinces, citys);
|
|
|
+// String s = JSON.toJSONString(search);
|
|
|
+//
|
|
|
+// System.out.println(s);
|
|
|
+// return s;
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @GetMapping("typeExport")
|
|
|
+// public void typeExport(HttpServletResponse response, String from, String provinces, String citys, String ttype, String range) {
|
|
|
+// //from :local roaming
|
|
|
+// //etype :导出全量
|
|
|
+// //ttype:天 7天
|
|
|
+// //range: 20210721 - 20210728
|
|
|
+//
|
|
|
+// String[] split = range.split("-");
|
|
|
+// String t1 = split[0].trim();
|
|
|
+// String t2 = split[1].trim();
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// String s = dataViewService.typeExport(from, provinces, citys, ttype, t1, t2);
|
|
|
+//
|
|
|
+//
|
|
|
+//// list.toString().getBytes();
|
|
|
+// ByteArrayInputStream bis = null;
|
|
|
+// try {
|
|
|
+// bis = new ByteArrayInputStream(s.getBytes("gbk"));
|
|
|
+// } catch (UnsupportedEncodingException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// // 下载本地文件
|
|
|
+// String fileName = "5GTypeDownload_" + range + ".csv"; // 文件的默认保存名
|
|
|
+// // 读到流中
|
|
|
+// //InputStream inStream = new FileInputStream("/home/ubantu/Desktop/seq.java");// 文件的存放路径
|
|
|
+// // 设置输出的格式
|
|
|
+// response.reset();
|
|
|
+// response.setContentType("text/plain");
|
|
|
+// response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
|
|
+// response.setCharacterEncoding("UTF-8");
|
|
|
+// // 循环取出流中的数据
|
|
|
+// byte[] b = new byte[100];
|
|
|
+// int len;
|
|
|
+// try {
|
|
|
+// while ((len = bis.read(b)) > 0)
|
|
|
+// response.getOutputStream().write(b, 0, len);
|
|
|
+// bis.close();
|
|
|
+// } catch (IOException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @GetMapping("exportAll")
|
|
|
+// public void typeExport(HttpServletResponse response, @RequestParam String ttype, @RequestParam String range) {
|
|
|
+//
|
|
|
+// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
+// String[] split = range.split("-");
|
|
|
+// String sts = split[0].trim();
|
|
|
+// String ets = split[1].trim();//最后日期
|
|
|
+// LocalDate sld = LocalDate.parse(sts, formatter);
|
|
|
+// LocalDate eld = LocalDate.parse(ets, formatter);
|
|
|
+// LocalDate smld = sld.minusDays(Integer.valueOf(ttype));
|
|
|
+// LocalDate emld = eld.minusDays(Integer.valueOf(ttype));
|
|
|
+// String smts = formatter.format(smld);
|
|
|
+// String emts = formatter.format(emld);
|
|
|
+// String s = dataViewService.exportAll(ttype, sts, ets, smts, emts);
|
|
|
+//
|
|
|
+//
|
|
|
+//// list.toString().getBytes();
|
|
|
+// ByteArrayInputStream bis = null;
|
|
|
+// try {
|
|
|
+//// bis = new ByteArrayInputStream(s.getBytes("UTF-8"));
|
|
|
+// bis = new ByteArrayInputStream(s.getBytes("gbk"));
|
|
|
+// } catch (UnsupportedEncodingException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// // 下载本地文件
|
|
|
+// String fileName = "5GTypeAllDownload_" + range + ".csv"; // 文件的默认保存名
|
|
|
+// // 读到流中
|
|
|
+// //InputStream inStream = new FileInputStream("/home/ubantu/Desktop/seq.java");// 文件的存放路径
|
|
|
+// // 设置输出的格式
|
|
|
+// response.reset();
|
|
|
+// response.setContentType("text/plain");
|
|
|
+// response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
|
|
+// response.setCharacterEncoding("UTF-8");
|
|
|
+// // 循环取出流中的数据
|
|
|
+// byte[] b = new byte[100];
|
|
|
+// int len;
|
|
|
+// try {
|
|
|
+// while ((len = bis.read(b)) > 0)
|
|
|
+// response.getOutputStream().write(b, 0, len);
|
|
|
+// bis.close();
|
|
|
+// } catch (IOException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @GetMapping("exportClose")
|
|
|
+// public void typeExportClose(HttpServletResponse response, @RequestParam String ttype, @RequestParam String range) {
|
|
|
+//
|
|
|
+// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
+// String[] split = range.split("-");
|
|
|
+// String sts = split[0].trim();
|
|
|
+// String ets = split[1].trim();//最后日期
|
|
|
+// LocalDate sld = LocalDate.parse(sts, formatter);
|
|
|
+// LocalDate eld = LocalDate.parse(ets, formatter);
|
|
|
+// LocalDate smld = sld.minusDays(Integer.valueOf(ttype));
|
|
|
+// LocalDate emld = eld.minusDays(Integer.valueOf(ttype));
|
|
|
+// String smts = formatter.format(smld);
|
|
|
+// String emts = formatter.format(emld);
|
|
|
+// String s = dataViewService.exportClose(ttype, sts, ets, smts, emts);
|
|
|
+//
|
|
|
+//
|
|
|
+//// list.toString().getBytes();
|
|
|
+// ByteArrayInputStream bis = null;
|
|
|
+// try {
|
|
|
+//// bis = new ByteArrayInputStream(s.getBytes("UTF-8"));
|
|
|
+// bis = new ByteArrayInputStream(s.getBytes("gbk"));
|
|
|
+// } catch (UnsupportedEncodingException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// // 下载本地文件
|
|
|
+// String fileName = "5GTypeCloseDownload_" + range + ".csv"; // 文件的默认保存名
|
|
|
+// // 读到流中
|
|
|
+// //InputStream inStream = new FileInputStream("/home/ubantu/Desktop/seq.java");// 文件的存放路径
|
|
|
+// // 设置输出的格式
|
|
|
+// response.reset();
|
|
|
+// response.setContentType("text/plain");
|
|
|
+// response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
|
|
+// response.setCharacterEncoding("UTF-8");
|
|
|
+// // 循环取出流中的数据
|
|
|
+// byte[] b = new byte[100];
|
|
|
+// int len;
|
|
|
+// try {
|
|
|
+// while ((len = bis.read(b)) > 0)
|
|
|
+// response.getOutputStream().write(b, 0, len);
|
|
|
+// bis.close();
|
|
|
+// } catch (IOException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//}
|