Преглед изворни кода

style: 添加注释,调整代码格式

weijianghai пре 2 година
родитељ
комит
8dd1501b56

+ 0 - 211
src/main/java/com/nokia/hb/Controller/DataViewController.java

@@ -1,211 +0,0 @@
-//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();
-//        }
-//    }
-//
-//
-//}

+ 0 - 94
src/main/java/com/nokia/hb/Controller/TemplateController.java

@@ -1,94 +0,0 @@
-package com.nokia.hb.Controller;
-
-import com.nokia.hb.Pojo.RetData;
-import com.nokia.hb.Pojo.TreeNode;
-import com.nokia.hb.utils.DbUtil;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-import javax.servlet.http.HttpSession;
-import java.util.List;
-
-@Controller
-@RequestMapping("/")
-public class TemplateController {
-    /**
-     * 用户登录
-     */
-    @PostMapping("userLogin")
-    @ResponseBody
-    public Object userLogin(String username, String password, HttpSession session) {
-        return DbUtil.userLogin(username, password, session);
-    }
-
-    @GetMapping("initTreeCitys")
-    @ResponseBody
-    public List<TreeNode> initTreeCitys() {
-        return DbUtil.initTreeCitys();
-    }
-
-    @GetMapping("initTreeIndicator")
-    @ResponseBody
-    public List<TreeNode> initTreeIndicator() {
-        return DbUtil.initTreeIndicator();
-    }
-
-
-    @PostMapping("renderTable")
-    @ResponseBody
-    public RetData renderTable(String citys, String quxians, String indicators, String ttype, String sdate,
-                               String condition, String searchType, HttpSession session) {
-
-        return DbUtil.renderTable(citys,quxians,indicators,ttype,sdate,condition,searchType,session);
-    }
-    
-//    @PostMapping({"conditionRenderTable"})
-//    @ResponseBody
-//    public RetData conditionRenderTable(String condition, String searchType, String indicators, String ttype, String sdate)
-//    {
-//      String[] split = condition.split("\n");
-//      String c = "";
-//      for (String s : split) {
-//        c = c + "'" + s + "',";
-//      }
-//      c = c.substring(0, c.length() - 1);
-//      return DbUtil.conditionRenderTable(c, searchType, indicators, ttype, sdate);
-//    }
-
-    /**
-     * 添加指标模板
-     *
-     * @param templateName 指标模板名称
-     * @param indicators 指标
-     */
-    @PostMapping("addTemplate")
-    @ResponseBody
-    public Object addTemplate(String templateName, String indicators, HttpSession session) {
-
-        return DbUtil.addTemplate(templateName, indicators,session);
-    }
-
-    /**
-     * 获取指标模板
-     */
-    @GetMapping("initTreeIndicatorTemplate")
-    @ResponseBody
-    public List<TreeNode> initTreeIndicatorTemplate(HttpSession session) {
-        return DbUtil.initTreeIndicatorTemplate(session);
-    }
-
-    /**
-     * 删除指标模板
-     *
-     * @param ids 模板id
-     */
-    @PostMapping("deleteTemplate")
-    @ResponseBody
-    public Object deleteTemplate(String ids) {
-
-        return DbUtil.deleteTemplate(ids);
-    }
-}

+ 0 - 43
src/main/java/com/nokia/hb/Controller/ViewController.java

@@ -1,43 +0,0 @@
-package com.nokia.hb.Controller;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.servlet.ModelAndView;
-
-@Controller
-@RequestMapping("/")
-public class ViewController {
-//    @GetMapping("view")
-//    public ModelAndView  view()
-//    {
-//        ModelAndView model = new ModelAndView("view");
-//        return model;
-//    }
-
-    /**
-     * 登录页面
-     */
-    @GetMapping("login")
-    public ModelAndView  login()
-    {
-        ModelAndView model = new ModelAndView("login");
-        return model;
-    }
-
-    @GetMapping("template")
-    public ModelAndView  template()
-    {
-        ModelAndView model = new ModelAndView("template");
-        return model;
-    }
-
-    @GetMapping("error")
-    public ModelAndView error()
-    {
-        ModelAndView model = new ModelAndView("error");
-        return model;
-    }
-
-
-}

+ 0 - 50
src/main/java/com/nokia/hb/Dao/DataViewDao.java

@@ -1,50 +0,0 @@
-//package com.nokia.hb.Dao;
-//
-//import com.alibaba.fastjson.JSON;
-//import com.nokia.hb.utils.DbUtil;
-//import javafx.application.Application;
-//import javafx.stage.Stage;
-//
-//import java.awt.image.DataBuffer;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//public class DataViewDao {
-//
-//
-//    public static String typeExport(String from, String provinces, String citys, String ttype, String t1, String t2) {
-//
-//
-//        return DbUtil.typeExport(from, provinces, citys, ttype, t1, t2);
-//    }
-//
-//    public static String exportAll(String ttype, String sts, String ets, String smts, String emts) {
-//        return DbUtil.exportAll(ttype, sts, ets, smts, emts);
-//    }
-//
-//    public static Map<String, List<Object>> search(String from, String t1, String t2, String stype, String ttype, String provinces, String citys) {
-//        Map<String, List<Object>>res = null;
-//        if("5G开关打开率".equals(stype)){
-//            res=DbUtil.searchRate(from, t1, t2, ttype, provinces, citys);
-//        }else {
-//            res=DbUtil.search(from, t1, t2, stype, ttype, provinces, citys);
-//        }
-//
-//        return res;
-//    }
-//
-//    public static String exportClose(String ttype, String sts, String ets, String smts, String emts) {
-//        return DbUtil.exportClose(ttype, sts, ets, smts, emts);
-//    }
-//
-//
-//    public List<String> initProvince(String type) {
-//        return DbUtil.initProvince(type);
-//    }
-//
-//    public List<String> initCitys(String type, String province) {
-//        return DbUtil.initCitys(type, province);
-//    }
-//
-//}

+ 0 - 38
src/main/java/com/nokia/hb/Pojo/Col.java

@@ -1,38 +0,0 @@
-package com.nokia.hb.Pojo;
-
-public class Col {
-    String field;
-    String title;
-
-    public Col() {
-    }
-
-    public Col(String field, String title) {
-        this.field = field;
-        this.title = title;
-    }
-
-    public String getField() {
-        return field;
-    }
-
-    public void setField(String field) {
-        this.field = field;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    @Override
-    public String toString() {
-        return "{" +
-                "field:'" + field + '\'' +
-                ", title:'" + title + '\'' +
-                '}';
-    }
-}

+ 0 - 60
src/main/java/com/nokia/hb/Pojo/RetData.java

@@ -1,60 +0,0 @@
-package com.nokia.hb.Pojo;
-
-import java.util.List;
-import java.util.Map;
-
-public class RetData {
-    /**
-     * 错误信息
-     */
-    String msg;
-    List<Col> cols;
-    List<Map<String,String>> datas;
-
-    public RetData() {
-    }
-
-    public RetData(List<Col> cols, List<Map<String, String>> datas) {
-        this.cols = cols;
-        this.datas = datas;
-    }
-
-    public RetData(List<Col> cols, List<Map<String, String>> datas, String msg) {
-        this.cols = cols;
-        this.datas = datas;
-        this.msg = msg;
-    }
-
-    public List<Col> getCols() {
-        return cols;
-    }
-
-    public void setCols(List<Col> cols) {
-        this.cols = cols;
-    }
-
-    public List<Map<String, String>> getDatas() {
-        return datas;
-    }
-
-    public void setDatas(List<Map<String, String>> datas) {
-        this.datas = datas;
-    }
-
-    public String getMsg() {
-        return msg;
-    }
-
-    public void setMsg(String msg) {
-        this.msg = msg;
-    }
-
-    @Override
-    public String toString() {
-        return "RetData{" +
-                "msg='" + msg + '\'' +
-                ", cols=" + cols +
-                ", datas=" + datas +
-                '}';
-    }
-}

+ 0 - 74
src/main/java/com/nokia/hb/Pojo/TreeNode.java

@@ -1,74 +0,0 @@
-package com.nokia.hb.Pojo;
-
-import java.util.List;
-
-public class TreeNode {
-
-    String title = "";
-    String id = "";
-    boolean spread = false;
-    List<TreeNode> children = null;
-
-    public TreeNode() {
-    }
-
-    public TreeNode(String title, String id, List<TreeNode> children) {
-        this.title = title;
-        this.id = id;
-        this.children = children;
-    }
-
-    public TreeNode(String title, String id, boolean spread, List<TreeNode> children) {
-        this.title = title;
-        this.id = id;
-        this.spread = spread;
-        this.children = children;
-    }
-
-    public TreeNode(String title, String id) {
-        this.title = title;
-        this.id = id;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public boolean isSpread() {
-        return spread;
-    }
-
-    public void setSpread(boolean spread) {
-        this.spread = spread;
-    }
-
-    public List<TreeNode> getChildren() {
-        return children;
-    }
-
-    public void setChildren(List<TreeNode> children) {
-        this.children = children;
-    }
-
-    @Override
-    public String toString() {
-        return "TreeNode{" +
-                "title='" + title + '\'' +
-                ", id='" + id + '\'' +
-                ", spread=" + spread +
-                ", children=" + children +
-                '}';
-    }
-}

+ 0 - 37
src/main/java/com/nokia/hb/Service/DataViewService.java

@@ -1,37 +0,0 @@
-//package com.nokia.hb.Service;
-//
-//import com.nokia.hb.Dao.DataViewDao;
-//import org.springframework.stereotype.Service;
-//
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//@Service
-//public class DataViewService {
-//    public DataViewDao dataViewDao = new DataViewDao();
-//
-//    public List<String> initProvince(String type) {
-//        return dataViewDao.initProvince(type);
-//    }
-//
-//    public List<String> initCitys(String type, String province) {
-//        return dataViewDao.initCitys(type, province);
-//    }
-//
-//    public String typeExport(String from, String provinces, String citys, String ttype, String t1, String t2) {
-//        return DataViewDao.typeExport(from, provinces, citys, ttype, t1, t2);
-//    }
-//
-//    public String exportAll(String ttype, String sts, String ets, String smts, String emts) {
-//        return DataViewDao.exportAll(ttype, sts, ets, smts, emts);
-//    }
-//
-//    public Map<String, List<Object>> search(String from, String t1, String t2, String stype, String ttype, String provinces, String citys) {
-//        return DataViewDao.search(from, t1, t2, stype, ttype, provinces, citys);
-//    }
-//
-//    public String exportClose(String ttype, String sts, String ets, String smts, String emts) {
-//        return DataViewDao.exportClose(ttype, sts, ets, smts, emts);
-//    }
-//}

+ 0 - 1
src/main/java/com/nokia/hb/controller/TemplateController.java

@@ -85,7 +85,6 @@ public class TemplateController {
      */
     @PostMapping("deleteTemplate")
     public Object deleteTemplate(String ids) {
-
         return DbUtil.deleteTemplate(ids);
     }
 }

+ 10 - 17
src/main/java/com/nokia/hb/controller/ViewController.java

@@ -1,19 +1,11 @@
-package com.nokia.hb.Controller;
+package com.nokia.hb.controller;
 
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.servlet.ModelAndView;
 
 @Controller
-@RequestMapping("/")
 public class ViewController {
-//    @GetMapping("view")
-//    public ModelAndView  view()
-//    {
-//        ModelAndView model = new ModelAndView("view");
-//        return model;
-//    }
 
     /**
      * 登录页面
@@ -21,23 +13,24 @@ public class ViewController {
     @GetMapping("login")
     public ModelAndView  login()
     {
-        ModelAndView model = new ModelAndView("login");
-        return model;
+        return new ModelAndView("login");
     }
 
+    /**
+     * 指标页面
+     */
     @GetMapping("template")
     public ModelAndView  template()
     {
-        ModelAndView model = new ModelAndView("template");
-        return model;
+        return new ModelAndView("template");
     }
 
+    /**
+     * 错误页面
+     */
     @GetMapping("error")
     public ModelAndView error()
     {
-        ModelAndView model = new ModelAndView("error");
-        return model;
+        return new ModelAndView("error");
     }
-
-
 }