From 0261d44802b40a8b8ce23855df1744c0164daf6c Mon Sep 17 00:00:00 2001
From: du <1725534722@qq.com>
Date: Fri, 11 Apr 2025 14:57:47 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8D=95=E7=89=87=E6=9D=90?=
=?UTF-8?q?=E6=96=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ruoyi-admin/pom.xml | 2 +-
.../BasicInformationController.java | 112 ++++++++-
.../gysl/controller/ZwStatsController.java | 92 +++----
.../gysl/service/BasicInformationService.java | 17 +-
.../impl/BasicInformationServiceImpl.java | 226 ++++++------------
.../gysl/service/impl/XmpjqdServiceImpl.java | 8 +-
ruoyi-admin/src/main/resources/xmdtcl.docx | Bin 0 -> 18792 bytes
7 files changed, 229 insertions(+), 228 deletions(-)
create mode 100644 ruoyi-admin/src/main/resources/xmdtcl.docx
diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml
index 3cb5b52..5afd3f6 100644
--- a/ruoyi-admin/pom.xml
+++ b/ruoyi-admin/pom.xml
@@ -24,7 +24,7 @@
cn.hutool
hutool-all
- 5.8.23
+ 5.8.37
org.jsoup
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/BasicInformationController.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/BasicInformationController.java
index 63b37d5..86ec07c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/BasicInformationController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/BasicInformationController.java
@@ -1,9 +1,12 @@
package com.ruoyi.gysl.controller;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -15,8 +18,10 @@ import com.ruoyi.gysl.entity.request.BasicInformationPageReq;
import com.ruoyi.gysl.entity.response.BasicInformationResponse;
import com.ruoyi.gysl.entity.response.ProjectExcelInfo;
import com.ruoyi.gysl.service.*;
+import com.ruoyi.system.mapper.SysDictDataMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -24,9 +29,15 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.*;
/**
* 基本信息(BasicInformation)表控制层
@@ -38,7 +49,8 @@ import java.util.List;
@RestController
@RequestMapping("/gysl/basicInformation")
public class BasicInformationController extends BaseController {
-
+ @Value("${ruoyi.profile}")
+ private String fileAddress;
// 1.审核通过之后再审核不要通知
// 2.项目评价配置和详情那边同步显示
// 3.换掉项目动态导出模板
@@ -51,7 +63,8 @@ public class BasicInformationController extends BaseController {
// 5.月度报告修改
// 8.企业和政务登录
-
+ @Resource
+ private SysDictDataMapper sysDictDataMapper;
/**
* 基本信息
*/
@@ -140,7 +153,7 @@ public class BasicInformationController extends BaseController {
if (byId.getStatus() != 1) {
throw new ServiceException("暂不能提交!");
}
- return success(basicInformationService.audit(req, 2,byId.getStatus()));
+ return success(basicInformationService.audit(req, 2, byId.getStatus()));
}
/**
@@ -154,7 +167,7 @@ public class BasicInformationController extends BaseController {
if (byId.getStatus() == 1) {
throw new ServiceException("请等待企业填报!");
}
- return success(basicInformationService.audit(req, 3,byId.getStatus()));
+ return success(basicInformationService.audit(req, 3, byId.getStatus()));
}
/**
@@ -261,7 +274,7 @@ public class BasicInformationController extends BaseController {
// @PreAuthorize("@ss.hasAnyRoles('admin,common')")
@ApiOperation("导出项目数据")
@PostMapping("/exportInfo")
- public void exportInfo(HttpServletResponse response){
+ public void exportInfo(HttpServletResponse response) {
List pE = basicInformationService.selectList();
ExcelUtil util = new ExcelUtil<>(ProjectExcelInfo.class);
util.exportExcel(response, pE, "项目数据");
@@ -329,5 +342,88 @@ public class BasicInformationController extends BaseController {
// });
// return AjaxResult.success();
// }
+
+ @ApiOperation(value = "导出单片材料")
+ @PostMapping("/wordExport")
+ public void wordExport(HttpServletResponse response, @RequestBody List ids) throws Exception {
+ List sysDictData = sysDictDataMapper.selectDictDataList(new SysDictData());
+ String fatherFile = fileAddress + "/项目压缩文件";
+ FileUtil.mkdir(fatherFile);
+ for (long id : ids) {
+ BasicInformationResponse a1 = basicInformationService.selectOne(id);
+ Map map = new HashMap<>();
+ map.put("issuingTime", a1.getBasicInformation().getIssuingTime() != null ? a1.getBasicInformation().getIssuingTime() : "/");
+ map.put("jsjd", a1.getBasicInformation().getJsjd() != null ? a1.getBasicInformation().getJsjd() : "/");
+ map.put("xzfl", a1.getBasicInformation().getXzfl() != null ?
+ basicInformationService.getDictLabel("xzfl", String.valueOf(a1.getBasicInformation().getXzfl()),sysDictData) : "/");
+ map.put("nature", a1.getBasicInformation().getNature() != null ?
+ basicInformationService.getDictLabel("xmfrdwxz", String.valueOf(a1.getBasicInformation().getNature()),sysDictData) : "/");
+ map.put("name", a1.getBasicInformation().getName() != null ? a1.getBasicInformation().getName() : "/");
+ map.put("ssgnq", a1.getBasicInformation().getSsgnq() != null ?
+ basicInformationService.getDictLabel("ssgnq", String.valueOf(a1.getBasicInformation().getSsgnq()),sysDictData) : "/");
+ map.put("jsdd", a1.getBasicInformation().getJsdd() != null ? a1.getBasicInformation().getJsdd() : "/");
+ map.put("xmfrdwxz", a1.getBasicInformation().getXmfrdwxz() != null ? a1.getBasicInformation().getXmfrdwxz() : "/");
+ map.put("tyshxydm", a1.getBasicInformation().getTyshxydm() != null ? a1.getBasicInformation().getTyshxydm() : "/");
+ map.put("sgdw", a1.getBasicInformation().getSgdw() != null ? a1.getBasicInformation().getSgdw() : "/");
+ map.put("sjdw", a1.getBasicInformation().getSjdw() != null ? a1.getBasicInformation().getSjdw() : "/");
+ map.put("begainTime", a1.getBasicInformation().getBegainTime() != null ? a1.getBasicInformation().getBegainTime() : "/");
+ map.put("endTime", a1.getBasicInformation().getEndTime() != null ? a1.getBasicInformation().getEndTime() : "/");
+ map.put("prioritize", a1.getBasicInformation().getPrioritize() != null ? a1.getBasicInformation().getPrioritize() : "/");
+ map.put("label", a1.getBasicInformation().getLabel() != null ? a1.getBasicInformation().getLabel() : "/");
+ map.put("projectLeader", a1.getBasicInformation().getProjectLeader() != null ? a1.getBasicInformation().getProjectLeader() : "/");
+ map.put("phone", a1.getBasicInformation().getPhone() != null ? a1.getBasicInformation().getPhone() : "/");
+ map.put("zydmj", a1.getPlanInformation().getZydmj() != null ? a1.getPlanInformation().getZydmj() : "/");
+ map.put("rjl", a1.getPlanInformation().getRjl() != null ? a1.getPlanInformation().getRjl() : "/");
+ map.put("zjzmj", a1.getPlanInformation().getZjzmj() != null ? a1.getPlanInformation().getZjzmj() : "/");
+ map.put("jzds", a1.getPlanInformation().getJzds() != null ? a1.getPlanInformation().getJzds() : "/");
+ map.put("bzcjzmj", a1.getPlanInformation().getBzcjzmj() != null ? a1.getPlanInformation().getBzcjzmj() : "/");
+ map.put("jzmd", a1.getPlanInformation().getJzmd() != null ? a1.getPlanInformation().getJzmd() : "/");
+ map.put("zgjzcs", a1.getPlanInformation().getZgjzcs() != null ? a1.getPlanInformation().getZgjzcs() : "/");
+ map.put("zgjzgd", a1.getPlanInformation().getZgjzgd() != null ? a1.getPlanInformation().getZgjzgd() : "/");
+ map.put("fhdj", a1.getPlanInformation().getFhdj() != null ? a1.getPlanInformation().getFhdj() : "/");
+ map.put("jdctcw", a1.getPlanInformation().getJdctcw() != null ? a1.getPlanInformation().getJdctcw() : "/");
+ map.put("fjdctcw", a1.getPlanInformation().getFjdctcw() != null ? a1.getPlanInformation().getFjdctcw() : "/");
+ map.put("jhtze", a1.getBasicInformation().getJhtze() != null ? a1.getBasicInformation().getJhtze() : "/");
+ map.put("ztze", a1.getBasicInformation().getZtze() != null ? a1.getBasicInformation().getZtze() : "/");
+
+ map.put("rzqys", a1.getQyrzInformation().getRzqys() != null ? a1.getQyrzInformation().getRzqys() : "/");
+ map.put("rzqyhylx", a1.getQyrzInformation().getRzqyhylx() != null ? a1.getQyrzInformation().getRzqyhylx() : "/");
+ map.put("rysl", a1.getQyrzInformation().getRysl() != null ? a1.getQyrzInformation().getRysl() : "/");
+ map.put("rzl", a1.getQyrzInformation().getRzl() != null ? a1.getQyrzInformation().getRzl() : "/");
+ map.put("yczmj", a1.getQyrzInformation().getYczmj() != null ? a1.getQyrzInformation().getYczmj() : "/");
+ map.put("kzczmj", a1.getQyrzInformation().getKzczmj() != null ? a1.getQyrzInformation().getKzczmj() : "/");
+ map.put("gycfpjzj", a1.getQyrzInformation().getGycfpjzj() != null ? a1.getQyrzInformation().getGycfpjzj() : "/");
+ try {
+ String itemsFileName = fatherFile + "/" + a1.getBasicInformation().getName()+".docx";
+ Path targetPath = Paths.get(itemsFileName);
+ Files.createDirectories(targetPath.getParent());
+ // 2. 打开输出流(自动覆盖已有文件)
+ try (OutputStream out = new BufferedOutputStream(
+ Files.newOutputStream(targetPath,
+ StandardOpenOption.CREATE,
+ StandardOpenOption.TRUNCATE_EXISTING))) {
+ basicInformationService.generateDocument(map,"xmdtcl.docx",out);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("文件下载失败");
+ }
+ }
+ // 压缩后的文件路径
+ String zipFilePath = fatherFile + ".zip";
+ ZipUtil.zip(fatherFile, zipFilePath);
+ File file = new File(zipFilePath);// 创建File对象
+ response.setContentType("application/zip");// 设置内容类型为ZIP文件
+ response.setHeader("Content-Disposition", "attachment; filename=\"file.zip\"");//设置文件名
+ try (FileInputStream fileInputStream = new FileInputStream(file);
+ OutputStream outputStream = response.getOutputStream()) {
+ byte[] buffer = new byte[4096];
+ int by;
+ while ((by = fileInputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, by);
+ }
+ }
+ FileUtil.del(zipFilePath);
+ FileUtil.del(fatherFile);
+ }
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/ZwStatsController.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/ZwStatsController.java
index f88684c..629941a 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/ZwStatsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/controller/ZwStatsController.java
@@ -1,8 +1,6 @@
package com.ruoyi.gysl.controller;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.io.resource.ClassPathResource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -14,11 +12,6 @@ import com.ruoyi.gysl.service.BasicInformationService;
import com.ruoyi.gysl.service.ZwStatsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
-import org.apache.poi.xwpf.usermodel.XWPFDocument;
-import org.apache.poi.xwpf.usermodel.XWPFParagraph;
-import org.apache.poi.xwpf.usermodel.XWPFRun;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -27,8 +20,9 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
-import java.io.*;
-import java.net.URLEncoder;
+import javax.validation.constraints.NotBlank;
+import java.io.IOException;
+import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,8 +42,6 @@ public class ZwStatsController extends BaseController {
@Resource
private ZwStatsService zwStatsService;
- @Value("${ruoyi.profile}")
- private String fileAddress;
@Resource
private BasicInformationService basicInformationService;
@@ -143,7 +135,8 @@ public class ZwStatsController extends BaseController {
*/
@ApiOperation(value = "导出项目总体报告")
@PostMapping(value = "/exportBg")
- public void exportBg(HttpServletResponse response,@Valid String years) throws Exception {
+ public void exportBg(HttpServletResponse response, @Valid @NotBlank String years)
+ throws Exception {
// 设置响应内容类型和头部
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
@@ -154,82 +147,57 @@ public class ZwStatsController extends BaseController {
List ribbon = zwStatsService.ribbon(years);
//获取投资主体
List investors = zwStatsService.investors(years);
- Map dt = new HashMap<>();
- dt.put("{{years}}",years);
- dt.put("{{allProject}}",allProjectResponse.getAllProject());
- dt.put("{{allGrossArea}}",allProjectResponse.getAllGrossArea());
- dt.put("{{allBuilding1}}",allProjectResponse.getAllBuilding1());
- dt.put("{{allBuilding2}}",allProjectResponse.getAllBuilding2());
- dt.put("{{allBuilding3}}",allProjectResponse.getAllBuilding3());
- dt.put("{{currentYearProject}}",allProjectResponse.getCurrentYearProject());
- dt.put("{{currentYearGrossArea}}",allProjectResponse.getCurrentYearGrossArea());
- dt.put("{{currentBuilding1}}",allProjectResponse.getCurrentBuilding1());
- dt.put("{{currentBuilding2}}",allProjectResponse.getCurrentBuilding2());
- dt.put("{{currentBuilding3}}",allProjectResponse.getCurrentBuilding3());
- ribbon.forEach(x->{
+ Map dt = new HashMap<>();
+ dt.put("{{years}}", years);
+ dt.put("{{allProject}}", allProjectResponse.getAllProject());
+ dt.put("{{allGrossArea}}", allProjectResponse.getAllGrossArea());
+ dt.put("{{allBuilding1}}", allProjectResponse.getAllBuilding1());
+ dt.put("{{allBuilding2}}", allProjectResponse.getAllBuilding2());
+ dt.put("{{allBuilding3}}", allProjectResponse.getAllBuilding3());
+ dt.put("{{currentYearProject}}", allProjectResponse.getCurrentYearProject());
+ dt.put("{{currentYearGrossArea}}", allProjectResponse.getCurrentYearGrossArea());
+ dt.put("{{currentBuilding1}}", allProjectResponse.getCurrentBuilding1());
+ dt.put("{{currentBuilding2}}", allProjectResponse.getCurrentBuilding2());
+ dt.put("{{currentBuilding3}}", allProjectResponse.getCurrentBuilding3());
+ ribbon.forEach(x -> {
switch (x.getSsgnq()) {
case "高端制造与国际贸易区":
- dt.put("{{gn1}}",x.getCount());
+ dt.put("{{gn1}}", x.getCount());
break;
case "阳澄湖半岛旅游度假区":
- dt.put("{{gn2}}",x.getCount());
+ dt.put("{{gn2}}", x.getCount());
break;
case "金鸡湖商务区":
- dt.put("{{gn3}}",x.getCount());
+ dt.put("{{gn3}}", x.getCount());
break;
case "苏相合作区":
- dt.put("{{gn4}}",x.getCount());
+ dt.put("{{gn4}}", x.getCount());
break;
case "独墅湖科教创新区":
- dt.put("{{gn5}}",x.getCount());
+ dt.put("{{gn5}}", x.getCount());
break;
default:
break;
}
});
- investors.forEach(x->{
+ investors.forEach(x -> {
switch (x.getSsgnq()) {
case "国企":
- dt.put("{{tz1}}",x.getCount());
+ dt.put("{{tz1}}", x.getCount());
break;
case "民营企业":
- dt.put("{{tz2}}",x.getCount());
+ dt.put("{{tz2}}", x.getCount());
break;
case "外资企业":
- dt.put("{{tz3}}",x.getCount());
+ dt.put("{{tz3}}", x.getCount());
break;
default:
break;
}
});
- ClassPathResource classPathResource = new ClassPathResource("ztbgmb.docx");
- try (
- InputStream inputStream = classPathResource.getStream();
- // 使用 Apache POI 处理 Word 文件(需提前引入依赖)
- XWPFDocument doc = new XWPFDocument(inputStream);
- ) {
- // 增强的占位符替换逻辑(改进部分)
- for (XWPFParagraph paragraph : doc.getParagraphs()) {
- List runs = paragraph.getRuns();
- if (runs == null) continue;
- for (XWPFRun run : runs) {
- String text = run.getText(0);
- if (text == null) continue;
- // 动态替换所有模板变量
- for (Map.Entry entry : dt.entrySet()) {
- if (text.contains(entry.getKey())) {
- text = text.replace(entry.getKey(), entry.getValue() != null ? entry.getValue().toString() : "");
- run.setText(text, 0);
- }
- }
- }
- }
- // 将文档写入到响应输出流
- try (OutputStream out = response.getOutputStream()) {
- doc.write(out);
- }
- } catch (IOException e) {
- e.printStackTrace();
+ // 4. 生成并写入文档
+ try (OutputStream out = response.getOutputStream()) {
+ basicInformationService.generateDocument(dt, "ztbgmb.docx", out);
}
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/BasicInformationService.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/BasicInformationService.java
index f33b0ca..99b8ec2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/BasicInformationService.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/BasicInformationService.java
@@ -2,15 +2,15 @@ package com.ruoyi.gysl.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.entity.SysDictData;
+import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.gysl.entity.BasicInformation;
import com.ruoyi.gysl.entity.request.AuditRequest;
import com.ruoyi.gysl.entity.request.BasicInformationPageReq;
import com.ruoyi.gysl.entity.response.BasicInformationResponse;
-import com.ruoyi.gysl.entity.response.ProjectBuildingExcel;
import com.ruoyi.gysl.entity.response.ProjectExcelInfo;
-import org.apache.poi.xssf.usermodel.XSSFCellStyle;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
+import java.io.OutputStream;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@@ -93,5 +93,16 @@ public interface BasicInformationService extends IService {
* @return 单条数据
*/
BasicInformationResponse stagingInfo(Long id);
+
+
+ /**
+ * 根据材料返回输chu流
+ */
+ void generateDocument(Map map, String docx, OutputStream sr) throws Exception;
+
+ /**
+ * 根据dict_type和dict_value返回
+ */
+ String getDictLabel(String dictType, String dictValue, List sysDictData);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/BasicInformationServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/BasicInformationServiceImpl.java
index c6b67c3..33d8815 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/BasicInformationServiceImpl.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/BasicInformationServiceImpl.java
@@ -1,8 +1,9 @@
package com.ruoyi.gysl.service.impl;
+import cn.hutool.core.io.resource.ClassPathResource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.docking.entity.SmartDeclaration;
@@ -14,21 +15,22 @@ import com.ruoyi.gysl.entity.request.BasicInformationPageReq;
import com.ruoyi.gysl.entity.request.RemarkPageReq;
import com.ruoyi.gysl.entity.request.ZwIdPageReq;
import com.ruoyi.gysl.entity.response.BasicInformationResponse;
-import com.ruoyi.gysl.entity.response.ProjectBuildingExcel;
import com.ruoyi.gysl.entity.response.ProjectExcelInfo;
import com.ruoyi.gysl.mapper.BasicInformationMapper;
import com.ruoyi.gysl.service.*;
-import org.apache.poi.xssf.usermodel.XSSFCell;
-import org.apache.poi.xssf.usermodel.XSSFCellStyle;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFParagraph;
+import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.io.Serializable;
-import java.lang.reflect.Field;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -122,7 +124,6 @@ public class BasicInformationServiceImpl extends ServiceImpl info, List sc, List ec, int num) {
-// Class> classBuilding = ProjectBuildingExcel.class;
-// for (ProjectExcelInfo projectExcelInfo : info) {
-// XSSFRow tempRow = sheet.createRow(rowNum++);
-// tempRow.setHeight((short) 1400);
-// int i1;
-// for (i1 = 0; i1 < sc.size(); i1++) {
-// XSSFCell tempCell = tempRow.createCell(i1);
-// tempCell.setCellStyle(contentStyle);
-// if (!ec.get(i1).endsWith("厂房")) {
-// if (Objects.equals(sc.get(i1), "")) {
-// tempCell.setCellValue(projectExcelInfo.getId());
-// } else {
-// tempCell.setCellValue(getExcelData(projectExcelInfo, sc.get(i1)));
-// }
-// }
-// }
-//// XSSFCell tempCell = tempRow.createCell(8);
-//// tempCell.setCellStyle(contentStyle);
-//// tempCell.setCellValue("12312321");
-//
-// for (int i2 = 0; i2 < projectExcelInfo.getXmjzxx().size(); i2++) {
-// switch (projectExcelInfo.getXmjzxx().get(i2).getFloor()) {
-// case 1:
-// i1 = ec.indexOf("一层厂房");
-// break;
-// case 2:
-// i1 = ec.indexOf("双层厂房");
-// break;
-// case 3:
-// i1 = ec.indexOf("三层厂房");
-// break;
-// case 4:
-// i1 = ec.indexOf("四层厂房");
-// break;
-// case 5:
-// i1 = ec.indexOf("五层厂房");
-// break;
-// default:
-// i1 = ec.indexOf("六层及以上厂房");
-// }
-// for (Field field : classBuilding.getDeclaredFields()) {
-// XSSFCell tempCell = tempRow.createCell(i1);
-// tempCell.setCellStyle(contentStyle);
-// Excel excelColumn = field.getAnnotation(Excel.class);
-// if (excelColumn != null) {
-// tempCell.setCellValue(getBuildingData(projectExcelInfo.getXmjzxx().get(i2), sc.get(i1)));
-// i1++;
-// }
-// }
-// }
-// }
-// }
-//
-// /**
-// * 填充数据-项目基础信息获取
-// */
-// @Override
-// public String getExcelData(ProjectExcelInfo item, String str) {
-// String a = null;
-// switch (str) {
-// case "":
-// a = item.getId() == null ? "-" : item.getId();
-// break;
-// case "项目名称":
-// a = item.getName() == null ? "-" : item.getName();
-// break;
-// case "项目法人单位":
-// a = item.getXmfrdwxz() == null ? "-" : item.getXmfrdwxz();
-// break;
-// case "项目法人单位性质":
-// a = String.valueOf(item.getNature() == null ? "-" : item.getNature());
-// break;
-// case "总用地面积":
-// a = String.valueOf(item.getZydmj() == null ? "-" : item.getZydmj());
-// break;
-// case "容积率":
-// a = String.valueOf(item.getRjl() == null ? "-" : item.getRjl());
-// break;
-// case "总建筑面积":
-// a = String.valueOf(item.getZjzmj() == null ? "-" : item.getZjzmj());
-// break;
-// case "标准层建筑面积":
-// a = String.valueOf(item.getBzcjzmj() == null ? "-" : item.getBzcjzmj());
-// break;
-// }
-// return a;
-// }
-//
-// /**
-// * 填充数据-项目建筑信息获取
-// */
-// @Override
-// public String getBuildingData(ProjectBuildingExcel item, String str) {
-// String a = null;
-// switch (str) {
-// case "层数":
-// a = item.getFloor() == null ? "-" : String.valueOf(item.getFloor());
-// break;
-// case "总建筑高度":
-// a = item.getTotalBuildingHeight() == null ? "-" : String.valueOf(item.getTotalBuildingHeight());
-// break;
-// case "首层高度":
-// a = String.valueOf(item.getScgd() == null ? "-" : item.getScgd());
-// break;
-// case "2至4层高":
-// a = String.valueOf(item.getTwoAndFourCg() == null ? "-" : item.getTwoAndFourCg());
-// break;
-// case "4层以上层高":
-// a = String.valueOf(item.getFourYscg() == null ? "-" : item.getFourYscg());
-// break;
-// }
-// return a;
-// }
-
/**
* 有经纬度的项目列表
*/
@@ -282,25 +164,14 @@ public class BasicInformationServiceImpl extends ServiceImpl collect1 = req.getWysmxInformations().stream().filter(x ->
- "危化品等级".equals(x.getZdname())
- )
- .collect(Collectors.toList());
- List collect2 = req.getWysmxInformations().stream().filter(x ->
- "生产火灾危险等级".equals(x.getZdname())
- )
- .collect(Collectors.toList());
- List collect3 = req.getWysmxInformations().stream().filter(x ->
- "环境保护".equals(x.getZdname()))
- .collect(Collectors.toList());
+ List collect1 = req.getWysmxInformations().stream().filter(x -> "危化品等级".equals(x.getZdname())).collect(Collectors.toList());
+ List collect2 = req.getWysmxInformations().stream().filter(x -> "生产火灾危险等级".equals(x.getZdname())).collect(Collectors.toList());
+ List collect3 = req.getWysmxInformations().stream().filter(x -> "环境保护".equals(x.getZdname())).collect(Collectors.toList());
if (!collect1.isEmpty() && !collect2.isEmpty() && !collect3.isEmpty()) {
- req.getBasicInformation().setIsFmqd(wysmxInformationService.canGoUpstairs(
- collect1.get(0).getZdinfor(),
- collect2.get(0).getZdinfor(),
- collect3.get(0).getZdinfor()) ? 1 : 0);
+ req.getBasicInformation().setIsFmqd(wysmxInformationService.canGoUpstairs(collect1.get(0).getZdinfor(), collect2.get(0).getZdinfor(), collect3.get(0).getZdinfor()) ? 1 : 0);
}
//修改项目规划信息
@@ -315,12 +186,12 @@ public class BasicInformationServiceImpl extends ServiceImpl map, String docx, OutputStream sr) throws IOException {
+ ClassPathResource resource = new ClassPathResource(docx);
+ try (InputStream is = resource.getStream();
+ XWPFDocument doc = new XWPFDocument(is);
+ ) {
+ // 处理段落
+ for (XWPFParagraph paragraph : doc.getParagraphs()) {
+ List runs = paragraph.getRuns();
+ if (runs == null) continue;
+ for (XWPFRun run : runs) {
+ String text = run.getText(0);
+ if (text == null) continue;
+ // 动态替换所有模板变量
+ for (Map.Entry entry : map.entrySet()) {
+ if (text.contains(entry.getKey())) {
+ text = text.replace(entry.getKey(), entry.getValue() != null ? entry.getValue().toString() : "");
+ run.setText(text, 0);
+ }
+ }
+ }
+ }
+ doc.write(sr);
+ } catch (Exception e) {
+ throw new IOException("文档生成失败", e);
+ }
+ }
+
+
+ /**
+ * 根据dict_type和dict_value返回
+ */
+ @Override
+ public String getDictLabel(String dictType, String dictValue,List sysDictData) {
+ List collect = sysDictData.stream().filter(x ->
+ x.getDictType().equals(dictType) && x.getDictValue().equals(dictValue))
+ .collect(Collectors.toList());
+ if (collect.isEmpty()){
+ return "/";
+ }else {
+ return collect.get(0).getDictLabel();
+ }
+ }
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/XmpjqdServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/XmpjqdServiceImpl.java
index 0283212..45ae25f 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/XmpjqdServiceImpl.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/gysl/service/impl/XmpjqdServiceImpl.java
@@ -67,9 +67,11 @@ public class XmpjqdServiceImpl extends ServiceImpl impleme
List xmpjqdOneResponses = xmpjqdMapper.selectOnePj(id);
//获取项目评价配置
pjpzService.list().forEach(x -> {
- XmpjqdOneResponse xr = new XmpjqdOneResponse();
- xr.setYsmc(x.getPjys());
- xmpjqdOneResponses.add(xr);
+ if(!Objects.equals(x.getPjys(), "总投资额")){
+ XmpjqdOneResponse xr = new XmpjqdOneResponse();
+ xr.setYsmc(x.getPjys());
+ xmpjqdOneResponses.add(xr);
+ }
});
return xmpjqdOneResponses;
}
diff --git a/ruoyi-admin/src/main/resources/xmdtcl.docx b/ruoyi-admin/src/main/resources/xmdtcl.docx
new file mode 100644
index 0000000000000000000000000000000000000000..cf9461864bb1181c07eec71511646ff8874ace24
GIT binary patch
literal 18792
zcmbq)V|XRq)@^K?9ox3;j_vH&W~XD@wr$%^cWfse+q!w*^XZ&>z909w^{002HJ(*#
z%~`c-tTE^OE&~b%1N7GsBEKv6*ZDsW=&v6pcE;Zw?d+WxzJI~czW#vv8wN(0$Ycx*
z1mpw)1cdZIVTShh^zJs+S#gRA1B7TnTXJuRa$7v+G;6GGsham=f8tdi&7r!q!|0F%
z_ddGj)3o$`I*zjKpSFAN&9=x0{&X^XCLOY*lb04*B=T4OK6>HTE)GK!=E!HkQ9nlZ
z@tm5OG1!X~!$f-_6*upZUPC%VC(>(Ph82itj-K9Z)eEHD@JoHylj>x<>5{;g6gtk_
zHWS=1NLXQF#CbR{PA#k1!o+yi0X{h5s^C=YrTX~oNc
z2{&pHSdK0~iX;%m(hS7>>nhiomk-hr$0!{YlEV7bgI_cn#u8Ojz2cjP)ZTl6e-#?O
z8gj~|*b(yRrBSHw?MyR!3+P+SryEz_TG^~^Rcu^n-2s~OZtv=O
z73a~DVxd6l8qO@N;yB}M(p^KAYxl`RdGa;`NaaM3Ll2%lJ#I%_Sy%Sc8X#;;@{IPq
zz_@bVi3+ub|FCDZk?dnlBpPVu5sGUwn#X5mi*^=v&e~T+pfn~KWTqFw9RMQL7L(D8
z2h?L(_7)ISBO-*4CKrqJcH^%ln!)gpm^k$}$H~#J%{f)+ob|p5q
zAz-q&?Q_m?Hb&U~GGJ$ci`?~~xe4ds_@7{)DUln5vQmPO#?qrAfr!=BJ-`>5LGr~k
zbWus;X>8petsV)H*gQ2kc0@ut)(IOUYZveLx6fq#JwyD)n{00cH3fm4Mr<_*++V{pN)kfdp^he||{-_sT4+|<0OAZ|+x_%iSl`RDtdoI-|vNj=F{&nlLRIcQk>&kq=z1RJd
zhd}23J7g7os7UNcl)&Ww@k0
zev4V*$g`{dWs5aSGC_2R8o`jOiMYRM?iA%SE~G|(1m^}gqejicNkD1MUPlV#nPuXC
z%nfs|O%_arToO4en}APq%Gr1sk>yzwsaZ#X^1ug}pu90wDInL+2wU=U8R{yJ&IL>L
z&`0kl8*HW!@Q&FJxoxG7cuXA|d3`3@VBY8JadmJ4G_#jA^?n~bxaKU7b@*=1>1OqT
z%lvu#Gd^g}QrSY&Ug)H}(0_(qQ2C>9Vf^uPG1GxNXh|fi3+OK={`&*)3*xYO8h!^vRFDcP+xfO(SNaBX#;F!AumY)6{+7q11;D+X`-+W0t_<=P|-eL$h<~_Bv$w6%Tz3p^vVU6_iGpM1{JtJiM
z{?YgKT;TJX=eaS*E$Xb>qbuTVVJn!x;ylT-{D75|qVPngiK&);yf9VnAtujH82I@H
z^RiBNihLnTVT>B?sf8xnd)x!aMpJO0yyPdd+YUXha6T6qRNil<6e5J6Xk;s
z@emwIrlLMRpSRWh&VzaldiJAySCj`3frL*r5C!Ora(yH*M-OFH4;j(UXs*|Om{Kr72>ZE5>0l-O@c;W5_u?}AaJiONIiO7ef5NuUqr
zM?V~!+Z*$+59Zm6I^iQmZni7-_&DTneF>H#8Gl1Ze}_4h@NLd+L8sncXny4y@_Ru->iGlSp_Hq~7OA?u^pB%`vYLhF0Tc>Mz>=v8M0=WlO0{9gKscI2(3~#~L0C|C*aJk*
zmfkFgusY2h((Z_FAWV&(#B;a7?lOnU_O_ul?ecbN3~@~V9LgRCEbG_PCOW-u);Fgc
z8xt{X3z@+w7XEvf%31xkPXdA}
z97Og@