Browse Source

修复导出bug

Memory_LG 11 months ago
parent
commit
c781d3edb3

+ 14 - 2
data-ui/src/views/data/housingconstruction/enterpriseproductionreport/index.vue

@@ -318,7 +318,12 @@ export default {
     handleAdd() {
       this.reset();
       this.open = true;
-      this.title = "添加企业生产报告";
+      if(this.$route.query.requestType === '1'){
+        this.title = "添加企业生产报告";
+      }else if(this.$route.query.requestType === '2'){
+        this.title = "添加企业资质文件";
+      }
+
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
@@ -372,9 +377,16 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
+      let exportTitle = '';
+      if(this.$route.query.requestType === '1'){
+        exportTitle = "企业生产报告";
+      }else if(this.$route.query.requestType === '2'){
+        exportTitle = "企业资质文件";
+      }
+
       this.download('sooka-sponest-center-data/enterpriseproductionreport/export', {
         ...this.queryParams
-      }, `企业生产报告_${format_date(new Date())}.xlsx`)
+      }, exportTitle+`_${format_date(new Date())}.xlsx`)
     }
   }
 };

+ 1 - 0
data-ui/src/views/data/housingconstruction/gassource/index.vue

@@ -238,6 +238,7 @@ import {treeselect} from "@/api/system/dept";
 import {getCarList} from "@/api/data/housingconstruction/car";
 import DataImageUpload from "@/components/ImageUpload/dataUpload.vue";
 import FileUpload from '@/views/components/FileUpload/index.vue'
+import {format_date} from "@/views/data/common/dateExport";
 
 export default {
   name: "Gassource",

+ 2 - 2
data-ui/src/views/data/housingconstruction/log/index.vue

@@ -383,9 +383,9 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      this.download('sooka-sponest-center-data/log/export', {
+      this.download('sooka-sponest-center-data/housingconstruction/log/export', {
         ...this.queryParams
-      }, `储罐运营数据_${format_date(new Date())}xlsx`)
+      }, `储罐运营数据_${format_date(new Date())}.xlsx`)
     },
     formatLevel(cellValue) {
       return `${cellValue.level} m`;

+ 3 - 3
data-ui/src/views/data/housingconstruction/safetyinspectionitem/index.vue

@@ -53,7 +53,7 @@
         >删除
         </el-button>
       </el-col>
-      <el-col :span="1.5">
+<!--      <el-col :span="1.5">
         <el-button
           type="warning"
           plain
@@ -63,7 +63,7 @@
           v-hasPermi="['housingconstruction:safetyinspectionitem:export']"
         >导出
         </el-button>
-      </el-col>
+      </el-col>-->
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -303,7 +303,7 @@ export default {
     },
     /** 导出按钮操作 */
     handleExport() {
-      this.download('housingconstruction/safetyinspectionitem/export', {
+      this.download('center-data/safetyinspectionitem/export', {
         ...this.queryParams
       }, `安全检查项_${new Date().getTime()}.xlsx`)
     }

+ 1 - 0
data-ui/src/views/data/housingconstruction/storagetank/index.vue

@@ -243,6 +243,7 @@ import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import {treeselect} from "@/api/system/dept";
 import deptselector from "@/views/components/deptselector.vue";
+import {format_date} from "@/views/data/common/dateExport";
 
 export default {
   name: "Storagetank",

+ 41 - 1
src/main/java/com/sooka/sponest/data/housingconstruction/controller/CenterdataTHousingconstructionEnterpriseproductionreportController.java

@@ -1,19 +1,25 @@
 package com.sooka.sponest.data.housingconstruction.controller;
 
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
+import com.ruoyi.common.redis.configure.RedisConfig;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.common.security.utils.DictUtils;
 import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionEnterpriseproductionreport;
+import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionAttachService;
 import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionEnterpriseproductionreportService;
+import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 企业生产报告Controller
@@ -27,6 +33,9 @@ public class CenterdataTHousingconstructionEnterpriseproductionreportController
     @Autowired
     private ICenterdataTHousingconstructionEnterpriseproductionreportService centerdataTHousingconstructionEnterpriseproductionreportService;
 
+    @Autowired
+    private ICenterdataTHousingconstructionAttachService attachService;
+
     /**
      * 查询企业生产报告列表
      */
@@ -46,8 +55,39 @@ public class CenterdataTHousingconstructionEnterpriseproductionreportController
     @PostMapping("/export")
     public void export(HttpServletResponse response, CenterdataTHousingconstructionEnterpriseproductionreport centerdataTHousingconstructionEnterpriseproductionreport) {
         List<CenterdataTHousingconstructionEnterpriseproductionreport> list = centerdataTHousingconstructionEnterpriseproductionreportService.selectCenterdataTHousingconstructionEnterpriseproductionreportList(centerdataTHousingconstructionEnterpriseproductionreport);
+        /*list.forEach(report->{
+            report.setFileUrl(attachService.replasePathToFile(report.getId(),null));
+        });*/
         ExcelUtil<CenterdataTHousingconstructionEnterpriseproductionreport> util = new ExcelUtil<CenterdataTHousingconstructionEnterpriseproductionreport>(CenterdataTHousingconstructionEnterpriseproductionreport.class);
-        util.exportExcel(response, list, "企业生产报告数据");
+        switch (centerdataTHousingconstructionEnterpriseproductionreport.getRequestType()){
+            case "1":
+                Map<String, Object> reportMap = DictUtils.getDictCacheToMap("enterprise_production_report");
+                list.forEach(data->{
+                    data.setReportType(MapUtils.getString(reportMap,data.getReportType()));
+                });
+                util.exportExcel(response, list, "企业生产报告数据");
+                break;
+            case "2":
+                Map<String, Object> fileMap = DictUtils.getDictCacheToMap("enterprise_qualification_file");
+                list.forEach(data->{
+                    data.setReportType(MapUtils.getString(fileMap,data.getReportType()));
+                });
+                util.exportExcel(response, list, "企业资质文件数据");
+                break;
+            default:
+                Map<String, Object> reportMapAll = DictUtils.getDictCacheToMap("enterprise_production_report");
+                Map<String, Object> fileMapAll = DictUtils.getDictCacheToMap("enterprise_qualification_file");
+                list.forEach(data->{
+                    if(reportMapAll.containsKey(data.getReportType())){
+                        data.setReportType(MapUtils.getString(reportMapAll, data.getReportType()));
+                    }
+                    if(fileMapAll.containsKey(data.getReportType())){
+                        data.setReportType(MapUtils.getString(fileMapAll, data.getReportType()));
+                    }
+                });
+                util.exportExcel(response, list, "企业相关附件数据");
+                break;
+        }
     }
 
     /**

+ 7 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/controller/CenterdataTHousingconstructionStoragetankLogController.java

@@ -7,13 +7,16 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.common.security.utils.DictUtils;
 import com.sooka.sponest.data.housingconstruction.domain.CenterdataTHousingconstructionStoragetankLog;
 import com.sooka.sponest.data.housingconstruction.service.ICenterdataTHousingconstructionStoragetankLogService;
+import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 储罐存储数据日志Controller
@@ -46,6 +49,10 @@ public class CenterdataTHousingconstructionStoragetankLogController extends Base
     @PostMapping("/export")
     public void export(HttpServletResponse response, CenterdataTHousingconstructionStoragetankLog centerdataTHousingconstructionStoragetankLog) {
         List<CenterdataTHousingconstructionStoragetankLog> list = centerdataTHousingconstructionStoragetankLogService.selectCenterdataTHousingconstructionStoragetankLogList(centerdataTHousingconstructionStoragetankLog);
+        Map<String, Object> yn = DictUtils.getDictCacheToMap("yes_no");
+        list.forEach(data->{
+            data.setRunState(MapUtils.getString(yn, data.getRunState()));
+        });
         ExcelUtil<CenterdataTHousingconstructionStoragetankLog> util = new ExcelUtil<CenterdataTHousingconstructionStoragetankLog>(CenterdataTHousingconstructionStoragetankLog.class);
         util.exportExcel(response, list, "储罐存储数据日志数据");
     }

+ 18 - 5
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionEnterpriseproductionreport.java

@@ -1,5 +1,7 @@
 package com.sooka.sponest.data.housingconstruction.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.BaseEntity;
 import com.sooka.sponest.data.base.domain.BaseBusinessEntity;
 import lombok.AllArgsConstructor;
@@ -9,6 +11,8 @@ import lombok.Setter;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.util.Date;
+
 /**
  * 企业生产报告对象 centerdata_t_housingconstruction_enterpriseproductionreport
  *
@@ -36,20 +40,18 @@ public class CenterdataTHousingconstructionEnterpriseproductionreport extends
     /**
      * 企业名称
      */
+    @Excel(name = "企业名称")
     private String enterpriseName;
 
     /**
      * 报告类型
      */
+    @Excel(name= "附件类型")
     private String reportType;
 
-    /**
-     * 创建人姓名
-     */
-    private String createName;
-
     private String fileName;
 
+//    @Excel(name="附件路径")
     private String fileUrl;
 
     /**
@@ -59,6 +61,17 @@ public class CenterdataTHousingconstructionEnterpriseproductionreport extends
      */
     private String requestType;
 
+    /**
+     * 更新人姓名
+     */
+    private String updateName;
+
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 3 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionSafetyinspectionitem.java

@@ -27,16 +27,19 @@ public class CenterdataTHousingconstructionSafetyinspectionitem extends BaseBusi
     /**
      * 检查类型
      */
+    @Excel(name="检查项类型")
     private String enterpriseInspectionType;
 
     /**
      * 检查名称
      */
+    @Excel(name="检查项点")
     private String inspectionName;
 
     /**
      * 排序
      */
+    @Excel(name="排序")
     private Integer inspectionSort;
 
     /**

+ 1 - 1
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionSteelcylinder.java

@@ -128,7 +128,7 @@ public class CenterdataTHousingconstructionSteelcylinder extends BaseBusinessEnt
     /**
      * 钢瓶阈值(月)
      */
-    @Excel(name = "钢瓶阈值")
+    @Excel(name = "钢瓶阈值(天)")
     private String threshold;
 
     public void setId(String id) {