xiaoshushu 2 tahun lalu
induk
melakukan
b4ec653ad5

+ 2 - 3
pom.xml

@@ -12,14 +12,13 @@
         <dependency>
             <groupId>com.jfinal</groupId>
             <artifactId>jfinal</artifactId>
-            <version>3.2</version>
+            <version>4.9.15</version>
         </dependency>
         <!-- jetty -->
         <dependency>
             <groupId>com.jfinal</groupId>
             <artifactId>jetty-server</artifactId>
-            <version>8.1.8</version>
-            <!-- <scope>test</scope>-->
+            <version>2019.3</version>
             <scope>compile</scope>
         </dependency>
         <dependency>

+ 4 - 6
src/main/java/com/lsw/Application.java

@@ -9,6 +9,7 @@ import com.jfinal.plugin.activerecord.dialect.OracleDialect;
 import com.jfinal.plugin.druid.DruidPlugin;
 import com.jfinal.template.Engine;
 import com.lsw.controller.IndexController;
+import com.lsw.controller.ReportController;
 
 /**
  * @author 李书文
@@ -26,6 +27,7 @@ public class Application extends JFinalConfig {
     @Override
     public void configRoute(Routes me) {
         me.add("/", IndexController.class, "/WEB-INF/view/");
+        me.add("/report", ReportController.class, "/WEB-INF/view/report");
     }
 
     @Override
@@ -38,6 +40,7 @@ public class Application extends JFinalConfig {
         DruidPlugin dp = new DruidPlugin(url, username, password, driver);
         me.add(dp);
         arp = new ActiveRecordPlugin(dp);//设置数据库方言
+        arp.addSqlTemplate("report.sql");
         arp.setDialect(new OracleDialect());
         arp.setContainerFactory(new CaseInsensitiveContainerFactory());//忽略大小写
         arp.setShowSql(true);
@@ -53,17 +56,12 @@ public class Application extends JFinalConfig {
         me.add(new ContextPathHandler("path"));
     }
 
-    @Override
-    public void afterJFinalStart() {
-        welcome();
-    }
-
     private void welcome() {
         System.out.println("系统启动完成 ");
     }
 
     public static void main(String[] args) {
-        JFinal.start("src/main/webapp", 9999, "/");
+        JFinal.start("src/main/webapp", 9999, "/", 5);
     }
 
     @Override

+ 23 - 0
src/main/java/com/lsw/controller/ReportController.java

@@ -0,0 +1,23 @@
+package com.lsw.controller;
+
+import com.jfinal.core.Controller;
+import com.jfinal.plugin.activerecord.Db;
+import com.jfinal.plugin.activerecord.Record;
+import com.lsw.utils.StringUtil;
+
+import java.util.List;
+
+public class ReportController extends Controller {
+
+    public void index() {
+        long start = System.currentTimeMillis();
+        long end = System.currentTimeMillis();
+
+        List<Record>list= Db.template("asd").find();
+        System.out.println("asd:"+list.toString());
+        setAttr("time", StringUtil.mul((end - start), (float) 0.001) + "s");
+        render("index.html");
+    }
+
+
+}

+ 12 - 0
src/main/java/com/lsw/utils/StringUtil.java

@@ -0,0 +1,12 @@
+package com.lsw.utils;
+
+import java.math.BigDecimal;
+
+public class StringUtil {
+
+    public static double mul(long v1, float v2) {
+        BigDecimal b1 = new BigDecimal(Float.toString(v1));
+        BigDecimal b2 = new BigDecimal(Float.toString(v2));
+        return b1.multiply(b2).doubleValue();
+    }
+}

+ 9 - 0
src/main/resources/sql/report.sql

@@ -0,0 +1,9 @@
+###完成率
+#sql("asd")
+ select count(0), case  when e.STATELABEL = '结束' then '结束' else '未结束' end  from tlk_examine e
+ left outer join t_user on t_user.ID=author
+ left outer join t_department on t_user.defaultdepartment=t_department.ID
+ where e.DOMAINID='uumsxrgm1KEEqSZIoHs' and t_department.ID in (select  ID from t_department start with ID='ZMMMGm5mnGCE4WvWFeI' connect by prior ID=superior)
+ and e.created between to_date('2021-05-01 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('2023-05-31 00:00:00','yyyy-mm-dd hh24:mi:ss')
+ and e.STATELABEL is not null group by  case  when e.STATELABEL = '结束'  then '结束' else '未结束' end
+#end

+ 134 - 0
src/main/webapp/WEB-INF/view/report/index.html

@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>实验完成率</title>
+    <link href="#(path)/static/js/element-ui.css" rel="stylesheet"/>
+    <style>
+         body {background-color: #f1f1f4;}
+		.bar{height:600px;margin-top: 50px;}
+        [v-cloak] {display: none;}
+    </style>
+</head>
+<body>
+<div id="app" v-cloak>
+    <el-form :inline="true" label-width="auto">
+        <el-form-item label="状态" prop="state">
+            <el-select placeholder="请选择实验部门" clearable>
+                <el-option label="矿山机械" :value="0"></el-option>
+                <el-option label="矿山机械" :value="0"></el-option>
+                <el-option label="矿山机械" :value="0"></el-option>
+                <el-option label="矿山机械" :value="0"></el-option>
+                <el-option label="矿山机械" :value="0"></el-option>
+            </el-select>
+        </el-form-item>
+        <el-form-item label="时间范围">
+            <el-date-picker
+                    v-model="created"
+                    style="width: 240px"
+                    value-format="yyyy-MM-dd"
+                    type="daterange"
+                    range-separator="-"
+                    start-placeholder="开始日期"
+                    end-placeholder="结束日期"
+            ></el-date-picker>
+        </el-form-item>
+        <el-form-item>
+            <el-button type="primary" icon="el-icon-search">搜索</el-button>
+            <el-button icon="el-icon-refresh">重置</el-button>
+        </el-form-item>
+    </el-form>
+    <div id="bar" class="bar"></div>
+</div>
+</body>
+<script src="#(path)/static/js/jquery.min.js"></script>
+<script src="#(path)/static/js/layer/layer.js"></script>
+<script src="#(path)/static/js/vue.min.js"></script>
+<script src="#(path)/static/js/common.js"></script>
+<script src="#(path)/static/js/echarts.min.js"></script>
+<script src="#(path)/static/js/element-ui.js"></script>
+<script>
+    let vm = new Vue({
+        el: "#app",
+        data: {
+            created:[]
+        },
+        mounted() {
+            this.initEcharts();
+        },
+        methods: {
+            initEcharts() {
+                let myChart = echarts.init(document.getElementById('bar'));
+                let option = {
+                    title: [{
+                        text: '实验完成率',
+                        left: 'center',
+                        top: 0,
+                        textStyle: {
+                            fontSize: '15',
+                        }
+
+                    }],
+                    tooltip: {
+                        trigger: 'item',
+                        formatter: "{a} <br/>{b}: {c} ({d}%)",
+                        position: function (p) { //其中p为当前鼠标的位置
+                            return [p[0] + 10, p[1] - 10];
+                        }
+                    },
+                    legend: {
+                        top: '76%',
+                        itemWidth: 10,
+                        itemHeight: 10,
+                        data: ['层级1', '层级2', '层级3', '层级4', '层级5', '层级6'],
+                        textStyle: {
+                            fontSize: '12',
+                        }
+                    },
+                    series: [{
+                        name: '兴趣分布',
+                        type: 'pie',
+                        center: ['50%', '42%'],
+                        radius: ['40%', '60%'],
+                        label: {
+                            show: true
+                        },
+                        labelLine: {
+                            show: true
+                        },
+                        data: [{
+                            value: 5,
+                            name: '层级1'
+                        },
+                            {
+                                value: 1,
+                                name: '层级2'
+                            },
+                            {
+                                value: 6,
+                                name: '层级3'
+                            },
+                            {
+                                value: 2,
+                                name: '层级4'
+                            },
+                            {
+                                value: 1,
+                                name: '层级5'
+                            },
+                            {
+                                value: 1,
+                                name: '层级6'
+                            },
+                        ]
+                    }]
+                };
+                myChart.setOption(option);
+                window.addEventListener("resize", function () {
+                    myChart.resize();
+                });
+            }
+        }
+    })
+</script>
+</html>

File diff ditekan karena terlalu besar
+ 21 - 0
src/main/webapp/static/js/echarts.min.js


Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini