wenhongquan 3 سال پیش
والد
کامیت
32821295b4

+ 21 - 1
pom.xml

@@ -29,7 +29,8 @@
         <commons.io.version>2.11.0</commons.io.version>
         <commons.fileupload.version>1.4</commons.fileupload.version>
         <commons.collections.version>3.2.2</commons.collections.version>
-        <poi.version>4.1.2</poi.version>
+        <poi.version>5.2.2</poi.version>
+        <poitl.version>1.12.0</poitl.version>
         <velocity.version>2.3</velocity.version>
         <jwt.version>0.9.1</jwt.version>
     </properties>
@@ -116,6 +117,25 @@
                 <version>${poi.version}</version>
             </dependency>
 
+
+            <dependency>
+                <groupId>org.apache.poi</groupId>
+                <artifactId>poi-ooxml-schemas</artifactId>
+                <version>${poi.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.poi</groupId>
+                <artifactId>poi</artifactId>
+                <version>${poi.version}</version>
+            </dependency>
+
+
+
+
+
+
+
             <!-- velocity代码生成使用模板 -->
             <dependency>
                 <groupId>org.apache.velocity</groupId>

+ 24 - 0
ruoyi-admin/pom.xml

@@ -66,6 +66,30 @@
         </dependency>
 
 
+        <dependency>
+            <groupId>com.deepoove</groupId>
+            <artifactId>poi-tl</artifactId>
+            <version>${poitl.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>${poi.version}</version>
+        </dependency>
+
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml-schemas</artifactId>
+            <version>${poi.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>${poi.version}</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 77 - 4
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysReportController.java

@@ -1,19 +1,35 @@
 package com.ruoyi.system.controller;
 
+import com.deepoove.poi.XWPFTemplate;
+import com.deepoove.poi.util.PoitlIOUtils;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.domain.SysPlan;
 import com.ruoyi.system.domain.SysReport;
+import com.ruoyi.system.service.ISysDictDataService;
+import com.ruoyi.system.service.ISysPlanService;
 import com.ruoyi.system.service.ISysReportService;
+import com.ruoyi.system.service.impl.SysDictDataServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ClassUtils;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.text.DateFormat;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 【请填写功能名称】Controller
@@ -27,6 +43,11 @@ public class SysReportController extends BaseController
 {
     @Autowired
     private ISysReportService sysReportService;
+    @Autowired
+    private ISysPlanService sysPlanService;
+
+    @Autowired
+    private ISysDictDataService sysDictDataService;
 
     /**
      * 查询【请填写功能名称】列表
@@ -59,13 +80,65 @@ public class SysReportController extends BaseController
      * 导出【请填写功能名称】列表
      */
 
-    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
+    @Log(title = "施工报备导出", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysReport sysReport)
+    public void export(HttpServletResponse response, HttpServletRequest request, SysReport sysReport)
     {
+
+         String path = ClassUtils.getDefaultClassLoader().getResource("").getPath()+"static/template/";
+        String templatePath =path+"report.docx";
+
         List<SysReport> list = sysReportService.selectSysReportList(sysReport);
-        ExcelUtil<SysReport> util = new ExcelUtil<SysReport>(SysReport.class);
-        util.exportExcel(response, list, "数据");
+        if(list.size()<1)  AjaxResult.error("不存在!");;
+        list.get(0);
+        SysPlan plan = sysPlanService.selectSysPlanById(list.get(0).getPlanId());
+        SysDictData dictData =new SysDictData();dictData.setDictType("content_one");
+        List<SysDictData> onedatalist = sysDictDataService.selectDictDataList(dictData);
+        Map<String,String> onemap = new HashMap<>();
+        for (SysDictData d:onedatalist
+             ) {
+            onemap.put(d.getDictValue(),d.getDictLabel());
+        }
+        dictData.setDictType("content_two");
+        List<SysDictData> twodatalist = sysDictDataService.selectDictDataList(dictData);
+        Map<String,String> twomap = new HashMap<>();
+        for (SysDictData d:twodatalist
+        ) {
+            twomap.put(d.getDictValue(),d.getDictLabel());
+        }
+
+//        ExcelUtil<SysReport> util = new ExcelUtil<SysReport>(SysReport.class);
+//        util.exportExcel(response, list, "数据");
+        try{
+            XWPFTemplate template = XWPFTemplate.compile(templatePath).render(
+                    new HashMap<String, Object>(){{
+                        put("date", DateUtils.parseDateToStr("yyyy年MM月dd日",list.get(0).getCreateTime()));
+                        put("name", plan.getName());
+                        put("length", plan.getBridgeHeightWidth());
+                        put("dengji", plan.getLevel());
+                        put("luduan", list.get(0).getSection()+("K"+ (list.get(0).getStartKm()==null?list.get(0).getStartKm():"0" )+"+"+(list.get(0).getStartHectometer()==null?list.get(0).getStartHectometer():"000" )+" ~ K"+ (list.get(0).getEndKm()==null?list.get(0).getEndKm():"0")+"+"+(list.get(0).getEndHectometer()==null?list.get(0).getEndHectometer():"000" )));
+                        put("content",(list.get(0).getContentOne()==null?"":onemap.get( list.get(0).getContentOne())) +(list.get(0).getContentTwo()==null?"":twomap.get( list.get(0).getContentTwo())) );
+                        put("daterange", DateUtils.parseDateToStr("yyyy年MM月dd日hh:mm:ss",list.get(0).getStartTime())+" 至 "+DateUtils.parseDateToStr("yyyy年MM月dd日hh:mm:ss",list.get(0).getEndTime()));
+                        put("danwei", list.get(0).getDept());
+                        put("shuoming", list.get(0).getContentDes());
+                    }});
+
+
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-disposition","attachment;filename=\""+"out_template.docx"+"\"");
+
+            OutputStream out = response.getOutputStream();
+
+            template.write(out);
+            out.flush();
+            out.close();
+            template.close();
+        }catch (Exception e){
+
+        }
+
+
+
     }
 
     /**

+ 1 - 1
ruoyi-admin/src/main/resources/application-druid.yml

@@ -6,7 +6,7 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://${DATABASE_HOST:localhost}:${DATABASE_PORT:3306}/ruoyisql?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                url: jdbc:mysql://${DATABASE_HOST:127.0.0.1}:${DATABASE_PORT:3306}/ruoyisql?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                 username: ${DATABASE_USER:root}
                 password: ${DATABASE_PWD:root}
             # 从库数据源

+ 2 - 2
ruoyi-admin/src/main/resources/mapper/system/SysReportMapper.xml

@@ -221,9 +221,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <![CDATA[
          AND a.id<> b.id and a.section = b.section AND a.direction=b.direction AND (ABS(UNIX_TIMESTAMP(a.end_time)-UNIX_TIMESTAMP(b.end_time))<=3600) AND NOT ((locate('1',b.lane)=0 AND locate('2',b.lane)=0 AND locate('3',a.lane)=0 AND locate('4',a.lane)=0) OR (locate('1',a.lane)=0 AND locate('2',a.lane)=0 AND locate('3',b.lane)=0 AND locate('4',b.lane)=0)) AND ( (
              ABS(CONVERT ( b.end_km, UNSIGNED )+ CONVERT ( b.end_hectometer, UNSIGNED )/ 1000-CONVERT ( a.start_km, UNSIGNED )+ CONVERT ( a.start_hectometer, UNSIGNED )/ 1000 )
-				)< 2.5  and (
+				)<= 2.5  and (
 				ABS(CONVERT ( a.end_km, UNSIGNED )+ CONVERT ( a.end_hectometer, UNSIGNED )/ 1000-CONVERT ( b.start_km, UNSIGNED )+ CONVERT ( b.start_hectometer, UNSIGNED )/ 1000 )
-				)< 2.5 AND (((CONVERT (b.end_km,UNSIGNED)+CONVERT (b.end_hectometer,UNSIGNED)/1000)>=(CONVERT (a.end_km,UNSIGNED)+CONVERT (a.end_hectometer,UNSIGNED)/1000) AND (CONVERT (a.start_km,UNSIGNED)+CONVERT (a.start_hectometer,UNSIGNED)/1000)>=(CONVERT (b.start_km,UNSIGNED)+CONVERT (b.start_hectometer,UNSIGNED)/1000)) OR ((CONVERT (b.end_km,UNSIGNED)+CONVERT (b.end_hectometer,UNSIGNED)/1000)<=(CONVERT (a.end_km,UNSIGNED)+CONVERT (a.end_hectometer,UNSIGNED)/1000) AND (CONVERT (a.start_km,UNSIGNED)+CONVERT (a.start_hectometer,UNSIGNED)/1000)<=(CONVERT (b.start_km,UNSIGNED)+CONVERT (b.start_hectometer,UNSIGNED)/1000))))) AS cids FROM sys_report a WHERE a.id IN   ]]>
+				)<= 2.5 AND (((CONVERT (b.end_km,UNSIGNED)+CONVERT (b.end_hectometer,UNSIGNED)/1000)>=(CONVERT (a.end_km,UNSIGNED)+CONVERT (a.end_hectometer,UNSIGNED)/1000) AND (CONVERT (a.start_km,UNSIGNED)+CONVERT (a.start_hectometer,UNSIGNED)/1000)>=(CONVERT (b.start_km,UNSIGNED)+CONVERT (b.start_hectometer,UNSIGNED)/1000)) OR ((CONVERT (b.end_km,UNSIGNED)+CONVERT (b.end_hectometer,UNSIGNED)/1000)<=(CONVERT (a.end_km,UNSIGNED)+CONVERT (a.end_hectometer,UNSIGNED)/1000) AND (CONVERT (a.start_km,UNSIGNED)+CONVERT (a.start_hectometer,UNSIGNED)/1000)<=(CONVERT (b.start_km,UNSIGNED)+CONVERT (b.start_hectometer,UNSIGNED)/1000))))) AS cids FROM sys_report a WHERE a.id IN   ]]>
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

BIN
ruoyi-admin/src/main/resources/static/template/report.docx


+ 1 - 1
ruoyi-ui/.env.development

@@ -1,5 +1,5 @@
 # 页面标题
-VUE_APP_TITLE = 天王养排工区智慧管理系统
+VUE_APP_TITLE = 宁常管理处施工报备智能管理系统
 
 # 开发环境配置
 ENV = 'development'

+ 1 - 1
ruoyi-ui/.env.production

@@ -1,5 +1,5 @@
 # 页面标题
-VUE_APP_TITLE = 天王养排工区智慧管理系统
+VUE_APP_TITLE = 宁常管理处施工报备智能管理系统
 
 # 生产环境配置
 ENV = 'production'

+ 1 - 1
ruoyi-ui/package.json

@@ -1,7 +1,7 @@
 {
   "name": "ruoyi",
   "version": "3.8.2",
-  "description": "若依管理系统",
+  "description": "宁常管理处施工报备智能管理系统",
   "author": "若依",
   "license": "MIT",
   "scripts": {

BIN
ruoyi-ui/src/assets/images/images/img_dingbu@2x.png


BIN
ruoyi-ui/src/assets/images/images/logo.png


+ 30 - 5
ruoyi-ui/src/views/home/index.vue

@@ -1,6 +1,11 @@
 <template>
   <div class="app-container home" >
               <div class="title_top" style="position:fixed">
+                  <div class="logo">
+
+
+                    <img src="@/assets/images/images/logo.png">
+                  </div>
                   <el-menu
                             :default-active="activeIndex"
                             class="el-menu-demo"
@@ -23,7 +28,7 @@
                                                   font-weight: 400;
                                                   text-align: left;
                                                   color: #ffffff;
-                                                  margin-top: 10rem;
+                                                  line-height: 42px;
                                                   /*line-height: 100%;*/
                                                   margin-left:15rem">{{user.nickName}}</div>
                                       <div style="margin-left:5rem" > <img src="@/assets/images/images/exit.png" @click="logout"/>  </div>
@@ -124,16 +129,36 @@ export default {
    .home{
        padding: 0 0 0 0;
        height:100vh;
-       overflow: hidden
+       overflow: hidden;
+       background: #164394;
    }
 
    .title_top{
-          background: url("~@/assets/images/images/img_top_full.png") no-repeat;
-          background-size: 100% 100%;
+          background: url("~@/assets/images/images/img_dingbu@2x.png") no-repeat;
+          background-size: 1350px 100%;
+          //background: #164394;
           width:100%;
           height:7vh;
           padding-left:551rem;
-          display: inline-flex
+          display: inline-flex;
+     .logo{
+       display: none;
+       background: url("~@/assets/images/images/img_top@2x.png") no-repeat;
+       background-size: 100% 100%;
+       width: 600rem;
+       height: 100%;
+       background-position: 0;
+       //top:-5%;
+       position: absolute;
+       left: 0;
+       //left: 0;
+       img{
+         //position: absolute;
+         left: 0;
+         top:0;
+       }
+     }
+
    }
 
   .user-avatar {

+ 2 - 1
ruoyi-ui/src/views/login.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="login">
     <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
-      <h3 class="title">天王养排工区智慧管理系统</h3>
+      <h2 class="title">宁常管理处施工报备智能管理系统</h2>
       <el-form-item prop="username">
         <el-input
           v-model="loginForm.username"
@@ -166,6 +166,7 @@ export default {
 }
 .title {
   margin: 0px auto 30px auto;
+  font-size: 18px;
   text-align: center;
   color: #707070;
 }

+ 1 - 1
ruoyi-ui/src/views/plan/add.vue

@@ -7,7 +7,7 @@
                         {{name}}
               <el-button size="small" type="primary" plain style="position: absolute;top:0;right: 10px"  @click="cancle">返回</el-button>
             </div>
-            <el-form ref="form" :model="form" :rules="rules" label-width="200rem"  style="padding-left:100rem;padding-right:300rem;margin-top:50rem">
+            <el-form ref="form" :model="form" :rules="rules" label-width="280rem"  style="padding-left:100rem;padding-right:300rem;margin-top:50rem">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="公路(桥梁或汽渡)名称" prop="name" required>

+ 45 - 35
ruoyi-ui/src/views/report/add.vue

@@ -17,12 +17,12 @@
         ref="form"
         :model="form"
         :rules="rules"
-        label-width="200rem"
+        label-width="230rem"
         style="padding-left: 10%; padding-right: 100rem; margin-top: 50rem"
       >
         <el-row>
           <el-col :span="12">
-            <el-form-item label="选择计划" prop="planId">
+            <el-form-item label="选择计划" prop="planId" required >
               <el-select
                 v-model="form.planId"
                 placeholder="请选择施工计划"
@@ -208,42 +208,48 @@
             </el-form-item>
 
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="施工内容二" prop="contentTwo">
+          <el-col :span="24">
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="施工内容二" prop="contentTwo">
+
+                <el-select
+                  v-model="form.contentTwo"
+                  placeholder="请选择方向"
+                  clearable
+                  :disabled="readonly"
+                  size="small"
+                  style="width: 300rem"
+                >
+                  <el-option
+                    v-for="dict in dict.type.content_two"
+                    :key="dict.value"
+                    :label="dict.label"
+                    :value="dict.value"
+                  />
+                </el-select>
+              </el-form-item>
 
-              <el-select
-                v-model="form.contentTwo"
-                placeholder="请选择方向"
-                clearable
-                :disabled="readonly"
-                size="small"
-                style="width: 300rem"
-              >
-                <el-option
-                  v-for="dict in dict.type.content_two"
-                  :key="dict.value"
-                  :label="dict.label"
-                  :value="dict.value"
-                />
-              </el-select>
-            </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="预计结束时间" prop="endTime">
+                <el-date-picker
+                  clearable
+                  style="width: 300rem"
+                  v-model="form.endTime"
+                  :readonly="readonly"
+                  value-format="yyyy-MM-dd HH:mm:dd"
+                  type="datetime"
+                  placeholder="请选择预计结束时间"
+                >
+                </el-date-picker>
+              </el-form-item>
 
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="预计结束时间" prop="endTime">
-              <el-date-picker
-                clearable
-                style="width: 300rem"
-                v-model="form.endTime"
-                :readonly="readonly"
-                value-format="yyyy-MM-dd HH:mm:dd"
-                type="datetime"
-                placeholder="请选择预计结束时间"
-              >
-              </el-date-picker>
-            </el-form-item>
+            </el-col>
 
+          </el-row>
           </el-col>
+
           <el-col :span="12">
             <el-form-item label="现场负责人" prop="manageUser">
               <el-input
@@ -408,7 +414,11 @@ export default {
       form: {},
       activities:[{content: '报备创建',
         timestamp: '2018-04-15'}],
-      rules: {},
+      rules: {
+        planId:[
+          { required: true, message: '请选择计划', trigger: 'change' }
+        ],
+      },
       planList: [],
       status: "",
       name: "",

+ 17 - 6
ruoyi-ui/src/views/report/index.vue

@@ -135,6 +135,15 @@
                 v-hasPermi="['system:report:sp']"
 
               >审批</el-button>
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              v-if="scope.row.status==='3' "
+              @click.stop="handleExport(scope.row)"
+              v-hasPermi="['system:report:sp']"
+
+            >导出</el-button>
           </div>
 
 
@@ -164,7 +173,7 @@
           <el-radio v-model="spform.status" label="1">同意</el-radio>
           <el-radio v-model="spform.status" label="2">不同意</el-radio>
         </el-form-item>
-        <el-form-item label="下级审批部门" v-if="spform.status=='1' && nexdept" >
+        <el-form-item label="发送部门" v-if="spform.status=='1' && nexdept" >
           <el-radio  :value="nexdept"   :label="nexdept+''">{{ alldept.filter(i=>{ return i.deptId == nexdept}).length>0?alldept.filter(i=>{ return i.deptId == nexdept})[0].deptName:"" }}</el-radio>
         </el-form-item>
 
@@ -268,12 +277,14 @@ export default {
     });
     getConfigKey("spflow").then(res=>{
      res = JSON.parse(res.msg);
+
       this.spl = res;
       for (var index in this.spl) {
         var tempc = this.spl[index];
-        var indexc =  tempc.findIndex((i)=>i.deptId == this.currentuserdeptid);
+        var indexc =  tempc.findIndex((i)=>i+"" == this.currentuserdeptid+"");
+        // console.log(tempc)
         if(indexc!=-1){
-          console.log(this.currentuserdeptid)
+
           this.nexdept =  indexc+1 == tempc.length?null:tempc[indexc+1];
           break;
         }
@@ -429,10 +440,10 @@ export default {
 
 
     /** 导出按钮操作 */
-    handleExport() {
+    handleExport(row) {
       this.download('system/report/export', {
-        ...this.queryParams
-      }, `report_${new Date().getTime()}.xlsx`)
+        id:row.id
+      }, `report_${new Date().getTime()}.docx`)
     },
     selectable(row, index){
       return (row.isMerge+"") === "-1";

+ 1 - 1
ruoyi-ui/vue.config.js

@@ -7,7 +7,7 @@ function resolve(dir) {
 
 const CompressionPlugin = require('compression-webpack-plugin')
 
-const name = process.env.VUE_APP_TITLE || '天王养排工区智慧管理系统' // 网页标题
+const name = process.env.VUE_APP_TITLE || '宁常管理处施工报备智能管理系统' // 网页标题
 
 const port = process.env.port || process.env.npm_config_port || 80 // 端口