蔡德晨 5 anos atrás
pai
commit
8e32e41c63

+ 105 - 0
src/main/java/com/jeeplus/modules/sg/report/entity/SgReport.java

@@ -0,0 +1,105 @@
+package com.jeeplus.modules.sg.report.entity;
+
+import com.jeeplus.core.persistence.DataEntity;
+
+public class SgReport extends DataEntity<SgReport> {
+    private String name;
+    private Integer level1;
+    private Integer level2;
+    private Integer level3;
+    private Integer level4;
+    private String status;
+    private String type;
+    private String startDate;
+    private String endDate;
+    private Integer finishCount;
+    private Integer unfinishCount;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getLevel1() {
+        return level1;
+    }
+
+    public void setLevel1(Integer level1) {
+        this.level1 = level1;
+    }
+
+    public Integer getLevel2() {
+        return level2;
+    }
+
+    public void setLevel2(Integer level2) {
+        this.level2 = level2;
+    }
+
+    public Integer getLevel3() {
+        return level3;
+    }
+
+    public void setLevel3(Integer level3) {
+        this.level3 = level3;
+    }
+
+    public Integer getLevel4() {
+        return level4;
+    }
+
+    public void setLevel4(Integer level4) {
+        this.level4 = level4;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(String startDate) {
+        this.startDate = startDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
+
+    public Integer getFinishCount() {
+        return finishCount;
+    }
+
+    public void setFinishCount(Integer finishCount) {
+        this.finishCount = finishCount;
+    }
+
+    public Integer getUnfinishCount() {
+        return unfinishCount;
+    }
+
+    public void setUnfinishCount(Integer unfinishCount) {
+        this.unfinishCount = unfinishCount;
+    }
+}

+ 20 - 0
src/main/java/com/jeeplus/modules/sg/report/mapper/ReportMapper.java

@@ -0,0 +1,20 @@
+/**
+ * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
+ */
+package com.jeeplus.modules.sg.report.mapper;
+
+import com.jeeplus.core.persistence.BaseMapper;
+import com.jeeplus.core.persistence.annotation.MyBatisMapper;
+import com.jeeplus.modules.sg.information.entity.Information;
+import com.jeeplus.modules.sg.material.entity.Material;
+import com.jeeplus.modules.sg.report.entity.SgReport;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@MyBatisMapper
+public interface ReportMapper extends BaseMapper<Material> {
+   List<SgReport> findData();
+   List<SgReport> findList(SgReport sgReport);
+}

+ 56 - 0
src/main/java/com/jeeplus/modules/sg/report/mapper/xml/ReportMapper.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jeeplus.modules.sg.report.mapper.ReportMapper">
+
+	<select id="findData" resultType="SgReport">
+		SELECT a.department as name ,
+		sum(a.st1) as finishCount,
+		SUM(a.st2) as unfinishCount
+		 from
+	    (SELECT department,
+	            if(firstFinish='否' or secondFinish = '否',0,1) as st1,
+	            if(firstFinish='否' or secondFinish = '否',1,0) as st2
+	            from project_information) a
+	    GROUP BY department
+	</select>
+
+	<select id="findList" parameterType="SgReport" resultType="SgReport">
+		SELECT b.department as name,
+		sum(b.level1) as lever1,
+		sum(b.level2) as level2,
+		sum(b.level3) as level3,
+		sum(b.level4) as level4 from
+		(SELECT a.id, a.department,
+		if(DATEDIFF(a.da, a.approvalDate)&lt;=7,1,0) as level1,
+		if(DATEDIFF(a.da, a.approvalDate)&lt;= 14 and DATEDIFF(a.da, a.approvalDate)&gt;7,1,0) as level2,
+		if(DATEDIFF(a.da, a.approvalDate)&lt;= 21 and DATEDIFF(a.da, a.approvalDate)&gt;14,1,0) as level3,
+		if(DATEDIFF(a.da, a.approvalDate)&gt;21 or a.approvalDate is null,1,0) as level4,
+		a.status as status
+		from
+		(SELECT id,
+		         department,
+		         if(firstFinish='否' or secondFinish = '否',NOW(),if(secondFinish = '是',secondFinishDate,firstFinishDate) )as da ,
+		          approvalDate ,if(firstFinish='否' or secondFinish = '否','0','1') as status
+		          from project_information) a ) b   GROUP BY b.department
+		 <where>
+		    <if test="status != null and status != ''">
+			 b.status = #{status} and
+		   </if>
+		   1=1
+		 </where>
+	</select>
+
+
+
+
+
+
+
+
+
+
+	
+
+
+
+</mapper>

+ 27 - 0
src/main/java/com/jeeplus/modules/sg/report/service/ReportService.java

@@ -0,0 +1,27 @@
+package com.jeeplus.modules.sg.report.service;
+
+import com.jeeplus.modules.sg.information.entity.Information;
+import com.jeeplus.modules.sg.report.entity.SgReport;
+import com.jeeplus.modules.sg.report.mapper.ReportMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+@Service
+public class ReportService {
+    @Autowired
+    private ReportMapper reportMapper;
+
+
+    public List<SgReport> findData(){
+        return reportMapper.findData();
+    }
+
+    public List<SgReport> findList(SgReport sgReport){
+        return reportMapper.findList(sgReport);
+    }
+}

+ 48 - 0
src/main/java/com/jeeplus/modules/sg/report/web/ReportController.java

@@ -0,0 +1,48 @@
+package com.jeeplus.modules.sg.report.web;
+
+import com.jeeplus.core.persistence.Page;
+import com.jeeplus.modules.sg.report.entity.SgReport;
+import com.jeeplus.modules.sg.report.service.ReportService;
+import com.jeeplus.modules.test.manytomany.entity.StudentCourse;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping(value = "${adminPath}/sg/report")
+public class ReportController {
+    @Autowired
+    private ReportService reportService;
+
+
+    /**
+     * 项目报表页面
+     */
+    @RequestMapping(value = {"list", ""})
+    public String list(SgReport sgReport, Model model) {
+        model.addAttribute("sgReport", sgReport);
+        return "modules/sg/report/reportList";
+    }
+
+    /**
+     * 项目报表数据
+     */
+    @ResponseBody
+    @RequestMapping(value = "data")
+    public Map<String, Object> data(SgReport sgReport, HttpServletRequest request, HttpServletResponse response, Model model) {
+        Map<String, Object> map = new HashMap<String, Object>();
+        List<SgReport> list = reportService.findData();
+        map.put("rows", list);
+        return map;
+    }
+
+}

+ 205 - 0
src/main/webapp/webpage/modules/sg/report/reportList.js

@@ -0,0 +1,205 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<script>
+$(document).ready(function() {
+	$('#reportTable').bootstrapTable({
+		 
+		  //请求方法
+               method: 'post',
+               //类型json
+               dataType: "json",
+               contentType: "application/x-www-form-urlencoded",
+               //显示检索按钮
+	           showSearch: true,
+               //显示刷新按钮
+               showRefresh: true,
+               //显示切换手机试图按钮
+               showToggle: true,
+               //显示 内容列下拉框
+    	       showColumns: true,
+    	       //显示到处按钮
+    	       showExport: true,
+    	       //显示切换分页按钮
+    	       showPaginationSwitch: true,
+    	       //最低显示2行
+    	       minimumCountColumns: 2,
+               //是否显示行间隔色
+               striped: true,
+               //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)     
+               cache: false,    
+               //是否显示分页(*)  
+               pagination: false,
+                //排序方式 
+               sortOrder: "asc",  
+               //初始化加载第一页,默认第一页
+               // pageNumber:1,
+               //每页的记录行数(*)   
+               // pageSize: 10,
+               //可供选择的每页的行数(*)    
+               // pageList: [10, 25, 50, 100],
+               //这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据  
+               url: "${ctx}/sg/report/data",
+               //默认值为 'limit',传给服务端的参数为:limit, offset, search, sort, order Else
+               //queryParamsType:'',   
+               ////查询参数,每次调用是会带上这个参数,可自定义                         
+               queryParams : function(params) {
+               	var searchParam = $("#searchForm").serializeJSON();
+               	searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
+               	searchParam.pageSize = params.limit === undefined? -1 : params.limit;
+               	searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+  params.order;
+                   return searchParam;
+               },
+               //分页方式:client客户端分页,server服务端分页(*)
+               sidePagination: "server",
+               contextMenuTrigger:"right",//pc端 按右键弹出菜单
+               contextMenuTriggerMobile:"press",//手机端 弹出菜单,click:单击, press:长按。
+               contextMenu: '#context-menu',
+               // onContextMenuItem: function(row, $el){
+               //     if($el.data("item") == "edit"){
+               //     		edit(row.id);
+               //     }else if($el.data("item") == "view"){
+               //         view(row.id);
+               //     } else if($el.data("item") == "delete"){
+               //          jp.confirm('确认要删除该学生课程记录记录吗?', function(){
+               //         	jp.loading();
+               //         	jp.get("${ctx}/test/manytomany/studentCourse/delete?id="+row.id, function(data){
+               //     	  		if(data.success){
+               //     	  			$('#studentCourseTable').bootstrapTable('refresh');
+               //     	  			jp.success(data.msg);
+               //     	  		}else{
+               //     	  			jp.error(data.msg);
+               //     	  		}
+               //     	  	})
+               //
+               //     	});
+               //
+               //     }
+               // },
+              
+               onClickRow: function(row, $el){
+               },
+               	onShowSearch: function () {
+			$("#search-collapse").slideToggle();
+		},
+               columns: [
+
+			{
+		        field: 'name',
+		        title: '施工单位'
+		    }, {
+					   field: 'finishCount',
+					   title: '完成数量'
+				   },{
+					   field: 'unfinishCount',
+					   title: '未完成数量'
+				   }
+		     ]
+		
+		});
+		
+		  
+	  if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端
+
+		 
+		  $('#studentCourseTable').bootstrapTable("toggleView");
+		}
+	  
+	  $('#studentCourseTable').on('check.bs.table uncheck.bs.table load-success.bs.table ' +
+                'check-all.bs.table uncheck-all.bs.table', function () {
+            $('#remove').prop('disabled', ! $('#studentCourseTable').bootstrapTable('getSelections').length);
+            $('#view,#edit').prop('disabled', $('#studentCourseTable').bootstrapTable('getSelections').length!=1);
+        });
+		  
+		// $("#btnImport").click(function(){
+		// 	jp.open({
+		// 	    type: 2,
+        //         area: [500, 200],
+        //         auto: true,
+		// 	    title:"导入数据",
+		// 	    content: "${ctx}/tag/importExcel" ,
+		// 	    btn: ['下载模板','确定', '关闭'],
+		// 		    btn1: function(index, layero){
+		// 			 jp.downloadFile('${ctx}/test/manytomany/studentCourse/import/template');
+		// 		  },
+		// 	    btn2: function(index, layero){
+		// 		        var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
+		// 				iframeWin.contentWindow.importExcel('${ctx}/test/manytomany/studentCourse/import', function (data) {
+		// 					if(data.success){
+		// 						jp.success(data.msg);
+		// 						refresh();
+		// 					}else{
+		// 						jp.error(data.msg);
+		// 					}
+        //                     jp.close(index);
+        //                 });//调用保存事件
+        //             	return false;
+		// 		  },
+		//
+		// 		  btn3: function(index){
+		// 			  jp.close(index);
+	    // 	       }
+		// 	});
+		// });
+		    
+		
+	  // $("#export").click(function(){//导出Excel文件
+		// 	jp.downloadFile('${ctx}/test/manytomany/studentCourse/export');
+	  // });
+	  //
+		//
+	  // $("#search").click("click", function() {// 绑定查询按扭
+		//   $('#studentCourseTable').bootstrapTable('refresh');
+		// });
+	 
+	 // $("#reset").click("click", function() {// 绑定查询按扭
+		//   $("#searchForm  input").val("");
+		//   $("#searchForm  select").val("");
+		//   $("#searchForm  .select-item").html("");
+		//   $('#studentCourseTable').bootstrapTable('refresh');
+		// });
+		
+		
+	});
+		
+  function getIdSelections() {
+        return $.map($("#studentCourseTable").bootstrapTable('getSelections'), function (row) {
+            return row.id
+        });
+    }
+  
+  // function deleteAll(){
+  //
+	// 	jp.confirm('确认要删除该学生课程记录记录吗?', function(){
+	// 		jp.loading();
+	// 		jp.get("${ctx}/test/manytomany/studentCourse/deleteAll?ids=" + getIdSelections(), function(data){
+  //        	  		if(data.success){
+  //        	  			$('#studentCourseTable').bootstrapTable('refresh');
+  //        	  			jp.success(data.msg);
+  //        	  		}else{
+  //        	  			jp.error(data.msg);
+  //        	  		}
+  //        	  	})
+  //
+	// 	})
+  // }
+  // function refresh(){
+  // 	$('#studentCourseTable').bootstrapTable('refresh');
+  // }
+  // function add(){
+	// 	jp.go("${ctx}/test/manytomany/studentCourse/form/add");
+	// }
+  //
+  // function edit(id){
+	//   if(id == undefined){
+	// 	  id = getIdSelections();
+	//   }
+	//   jp.go("${ctx}/test/manytomany/studentCourse/form/edit?id=" + id);
+  // }
+  //
+  // function view(id) {
+  //     if(id == undefined){
+  //         id = getIdSelections();
+  //     }
+  //     jp.go("${ctx}/test/manytomany/studentCourse/form/view?id=" + id);
+  // }
+  
+</script>

+ 84 - 0
src/main/webapp/webpage/modules/sg/report/reportList.jsp

@@ -0,0 +1,84 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/webpage/include/taglib.jsp"%>
+<html>
+<head>
+	<title>项目报表</title>
+	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+	<meta name="decorator" content="ani"/>
+	<%@ include file="/webpage/include/bootstraptable.jsp"%>
+	<%@include file="reportList.js" %>
+</head>
+<body>
+	<div class="wrapper wrapper-content">
+	<div class="panel panel-primary">
+	<div class="panel-heading">
+		<h3 class="panel-title">项目报表</h3>
+	</div>
+	<div class="panel-body">
+	
+	<!-- 搜索 -->
+	<%--<div id="search-collapse" class="collapse">--%>
+		<%--<div class="accordion-inner">--%>
+			<%--<form:form id="searchForm" modelAttribute="studentCourse" class="form form-horizontal well clearfix">--%>
+			 <%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+				<%--<label class="label-item single-overflow pull-left" title="学生:">学生:</label>--%>
+				<%--<sys:gridselect url="${ctx}/test/manytomany/student/data" id="student" name="student.id" value="${studentCourse.student.id}" labelName="student.name" labelValue="${studentCourse.student.name}"--%>
+					<%--title="选择学生" cssClass="form-control required" fieldLabels="姓名" fieldKeys="name" searchLabels="姓名" searchKeys="name" ></sys:gridselect>--%>
+			<%--</div>--%>
+			 <%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+				<%--<label class="label-item single-overflow pull-left" title="课程:">课程:</label>--%>
+				<%--<sys:gridselect url="${ctx}/test/manytomany/course/data" id="course" name="course.id" value="${studentCourse.course.id}" labelName="course.name" labelValue="${studentCourse.course.name}"--%>
+					<%--title="选择课程" cssClass="form-control required" fieldLabels="课程名" fieldKeys="name" searchLabels="课程名" searchKeys="name" ></sys:gridselect>--%>
+			<%--</div>--%>
+		 <%--<div class="col-xs-12 col-sm-6 col-md-4">--%>
+			<%--<div style="margin-top:26px">--%>
+			  <%--<a  id="search" class="btn btn-primary btn-rounded  btn-bordered btn-sm"><i class="fa fa-search"></i> 查询</a>--%>
+			  <%--<a  id="reset" class="btn btn-primary btn-rounded  btn-bordered btn-sm" ><i class="fa fa-refresh"></i> 重置</a>--%>
+			 <%--</div>--%>
+	    <%--</div>	--%>
+	<%--</form:form>--%>
+	<%--</div>--%>
+	<%--</div>--%>
+	
+	<!-- 工具栏 -->
+	<%--<div id="toolbar">--%>
+			<%--<shiro:hasPermission name="test:manytomany:studentCourse:add">--%>
+				<%--<button id="add" class="btn btn-primary" onclick="add()">--%>
+					<%--<i class="glyphicon glyphicon-plus"></i> 新建--%>
+				<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:manytomany:studentCourse:edit">--%>
+			    <%--<button id="edit" class="btn btn-success" disabled onclick="edit()">--%>
+	            	<%--<i class="glyphicon glyphicon-edit"></i> 修改--%>
+	        	<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:manytomany:studentCourse:del">--%>
+				<%--<button id="remove" class="btn btn-danger" disabled onclick="deleteAll()">--%>
+	            	<%--<i class="glyphicon glyphicon-remove"></i> 删除--%>
+	        	<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:manytomany:studentCourse:import">--%>
+				<%--<button id="btnImport" class="btn btn-info"><i class="fa fa-folder-open-o"></i> 导入</button>--%>
+			<%--</shiro:hasPermission>--%>
+			<%--<shiro:hasPermission name="test:manytomany:studentCourse:export">--%>
+	        		<%--<button id="export" class="btn btn-warning">--%>
+					<%--<i class="fa fa-file-excel-o"></i> 导出--%>
+				<%--</button>--%>
+			 <%--</shiro:hasPermission>--%>
+	                 <%--<shiro:hasPermission name="test:manytomany:studentCourse:view">--%>
+				<%--<button id="view" class="btn btn-default" disabled onclick="view()">--%>
+					<%--<i class="fa fa-search-plus"></i> 查看--%>
+				<%--</button>--%>
+			<%--</shiro:hasPermission>--%>
+		    <%--</div>--%>
+		
+	<!-- 表格 -->
+	<table id="reportTable"   data-toolbar="#toolbar"></table>
+
+    <!-- context menu -->
+
+	</div>
+	</div>
+	</div>
+</body>
+</html>