Browse Source

feat: 去掉中文名查询,添加加全网选择和起止时间查询

weijianghai 2 years ago
parent
commit
73e1d71887

+ 19 - 6
src/main/java/com/nokia/hb/utils/DbUtil.java

@@ -64,11 +64,14 @@ public class DbUtil {
     public static RetData conditionRenderTable(String condition, String searchType, String indicators, String ttype, String sdate)
     {
       Map<String, String> ezMap = initZnEnMap();
-      
-      String sql = "select a.cellname,a.city,a.quxian,a.vendor,b.* from \n(select eci,cellname,city,quxian,vendor from pm_parse.per_cfg_cell where " + searchType + " in (" + condition + ")) a\ninner join \n(select eci," + indicators + " from pm_parse.pm_4g_" + ttype + " where sdate='" + sdate + "') b\non a.eci=b.eci";
-      if (indicators.contains("eci")) {
-        sql = "select a.cellname,a.city,a.quxian,a.vendor,b.* from \n(select eci,cellname,city,quxian,vendor from pm_parse.per_cfg_cell where " + searchType + " in (" + condition + ")) a\ninner join \n(select " + indicators + " from pm_parse.pm_4g_" + ttype + " where sdate='" + sdate + "') b\non a.eci=b.eci";
+      String[] timeArray = sdate.split(" - ");
+      String startTime = timeArray[0];
+      String endTime = timeArray[1];
+      String sql = "select a.cellname,a.city,a.quxian,a.vendor,b.* from \n(select eci,cellname,city,quxian,vendor from pm_parse.per_cfg_cell where " + searchType + " in (" + condition + ")) a\ninner join \n(select " + indicators + " from pm_parse.pm_4g_" + ttype + " where sdate>='" + startTime + "' and sdate <= '" + endTime + "') b\n" + "on a.eci=b.eci";
+      if ("all".equals(searchType)) {
+          sql = "select a.cellname,a.city,a.quxian,a.vendor,b.* from pm_parse.per_cfg_cell a\ninner join \n(select " + indicators + " from pm_parse.pm_4g_" + ttype + " where sdate>='" + startTime + "' and sdate <= '" + endTime + "') b\n" + "on a.eci=b.eci";
       }
+
       List<Map<String, String>> datas = new ArrayList();
       List<Col> cols = new ArrayList();
       try
@@ -109,6 +112,8 @@ public class DbUtil {
         log.debug("indicators: {}", indicators);
         log.debug("citys: {}", citys);
         log.debug("quxians: {}", quxians);
+        log.debug("ttype: {}", ttype);
+        log.debug("sdate: {}", sdate);
         // 获取城市数组
         String[] cityArrays = StringUtils.delete(citys, "'").split(",");
         // 获取拥有的城市权限
@@ -123,17 +128,25 @@ public class DbUtil {
             }
         }
 
+        String[] timeArray = sdate.split(" - ");
+        String startTime = timeArray[0];
+        String endTime = timeArray[1];
+
         String sql = "select b.* from \n" +
                 "(select eci from pm_parse.per_cfg_cell where quxian in (" + quxians + ")) a\n" +
                 "inner join \n" +
-                "(select eci," + indicators + " from pm_parse.pm_4g_" + ttype + " where sdate='" + sdate + "') b\n" +
+                "(select eci," + indicators + " from pm_parse.pm_4g_" + ttype +
+                " where sdate>='" + startTime +
+                "' and sdate <= '" + endTime + "') b\n" +
                 "on a.eci=b.eci";
 
         if(indicators.contains("eci")){
             sql="select b.* from \n" +
                     "(select eci from pm_parse.per_cfg_cell where quxian in (" + quxians + ")) a\n" +
                     "inner join \n" +
-                    "(select " + indicators + " from pm_parse.pm_4g_" + ttype + " where sdate='" + sdate + "') b\n" +
+                    "(select " + indicators + " from pm_parse.pm_4g_" + ttype +
+                    " where sdate>='" + startTime +
+                    "' and sdate <= '" + endTime + "') b\n" +
                     "on a.eci=b.eci";
         }
         List<Map<String, String>> datas = new ArrayList<>();

+ 17 - 11
src/main/resources/templates/template.html

@@ -81,7 +81,7 @@
         <form class="layui-form" action="">
             <div class="column" id="searchType">
                 <input type="radio" name="where" value="eci" title="按eci查询" lay-filter="where" checked>
-                <input type="radio" name="where" value="cellname" title="中文名查询" lay-filter="where">
+                <input type="radio" name="where" value="all" title="全网选择" lay-filter="where">
             </div>
             <textarea id="condition" cols="14" rows="19"
                       style="border-width:1px;border-style: solid;border-color: #eee;"></textarea>
@@ -103,7 +103,7 @@
             </div>
 
             <div class="c1 label" style="margin-left: 120px;">时间:</div>
-            <input type="text" class="layui-input c1" style="width: 180px;" id="time1">
+            <input type="text" class="layui-input c1" style="width: 300px;" id="time1">
             <button class="layui-btn btn c1" style="margin-left: 20px;" onclick="search()">查询</button>
             <button class="layui-btn btn c1" style="margin-left: 20px;" onclick="conditionSearch()">条件查询</button>
         </div>
@@ -162,7 +162,8 @@
             });
             laydate.render({
                 elem: '#time1',
-                type: 'datetime'
+                type: 'datetime',
+                range: true,
             });
 
             initTreeCity(tree)
@@ -434,7 +435,7 @@
             // console.log(indicators)
             let ttype = $('#timeType').val()
             let sdate = $('#time1').val()
-
+            console.log(`sdate: ${sdate}`)
             renderTable(table, citys, quxians,indicators, ttype, sdate)
 
             return false;
@@ -448,14 +449,22 @@
                 alert('填选择时间')
                 return;
             }
-            if ($('#condition').val().length == 0) {
-                alert('填写查询条件')
-                return;
-            }
+
             if (tree.getChecked('Id2').length == 0) {
                 alert('请选择指标')
                 return;
             }
+
+            let condition = $('#condition').val();
+            let ttype = $('#timeType').val()
+            let searchType = $('#searchType').find('input:checked').val()
+            if (searchType === 'eci' && $('#condition').val().length == 0) {
+                alert('填写查询条件')
+                return;
+            }
+
+            console.log(`searchType: ${searchType}`)
+            console.log(`condition: ${condition}`)
             // layer.msg(JSON.stringify(data.field));
             // let checkData1 = tree.getChecked('Id1')[0].children;
 
@@ -472,9 +481,6 @@
             });
             indicators = indicatorsA.join(',')
             // console.log(indicators)
-            let condition = $('#condition').val();
-            let ttype = $('#timeType').val()
-            let searchType = $('#searchType').find('input:checked').val()
             conditionRenderTable(table, condition, searchType, indicators, ttype, sdate)
 
             return false;