|
|
@ -1,6 +1,9 @@
|
|
|
|
package com.ruoyi.gysl.controller;
|
|
|
|
package com.ruoyi.gysl.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
@ -22,11 +25,15 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import javax.validation.constraints.Size;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.io.*;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static java.lang.System.out;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 基本信息(BasicInformation)表控制层
|
|
|
|
* 基本信息(BasicInformation)表控制层
|
|
|
@ -140,7 +147,7 @@ public class BasicInformationController extends BaseController {
|
|
|
|
if (byId.getStatus() != 1) {
|
|
|
|
if (byId.getStatus() != 1) {
|
|
|
|
throw new ServiceException("暂不能提交!");
|
|
|
|
throw new ServiceException("暂不能提交!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return success(basicInformationService.audit(req, 2,byId.getStatus()));
|
|
|
|
return success(basicInformationService.audit(req, 2, byId.getStatus()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -154,7 +161,7 @@ public class BasicInformationController extends BaseController {
|
|
|
|
if (byId.getStatus() == 1) {
|
|
|
|
if (byId.getStatus() == 1) {
|
|
|
|
throw new ServiceException("请等待企业填报!");
|
|
|
|
throw new ServiceException("请等待企业填报!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return success(basicInformationService.audit(req, 3,byId.getStatus()));
|
|
|
|
return success(basicInformationService.audit(req, 3, byId.getStatus()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -261,7 +268,7 @@ public class BasicInformationController extends BaseController {
|
|
|
|
// @PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
// @PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
@ApiOperation("导出项目数据")
|
|
|
|
@ApiOperation("导出项目数据")
|
|
|
|
@PostMapping("/exportInfo")
|
|
|
|
@PostMapping("/exportInfo")
|
|
|
|
public void exportInfo(HttpServletResponse response){
|
|
|
|
public void exportInfo(HttpServletResponse response) {
|
|
|
|
List<ProjectExcelInfo> pE = basicInformationService.selectList();
|
|
|
|
List<ProjectExcelInfo> pE = basicInformationService.selectList();
|
|
|
|
ExcelUtil<ProjectExcelInfo> util = new ExcelUtil<>(ProjectExcelInfo.class);
|
|
|
|
ExcelUtil<ProjectExcelInfo> util = new ExcelUtil<>(ProjectExcelInfo.class);
|
|
|
|
util.exportExcel(response, pE, "项目数据");
|
|
|
|
util.exportExcel(response, pE, "项目数据");
|
|
|
@ -292,7 +299,8 @@ public class BasicInformationController extends BaseController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// @ApiOperation(value = "123")
|
|
|
|
// @ApiOperation(value = "123")
|
|
|
|
//// @PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
|
|
|
|
|
|
|
|
/// / @PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
// @PostMapping(value = "/import1", consumes = "multipart/form-data")
|
|
|
|
// @PostMapping(value = "/import1", consumes = "multipart/form-data")
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
|
// public AjaxResult import1(@RequestPart("file") MultipartFile file) throws Exception {
|
|
|
|
// public AjaxResult import1(@RequestPart("file") MultipartFile file) throws Exception {
|
|
|
@ -329,5 +337,161 @@ public class BasicInformationController extends BaseController {
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
// return AjaxResult.success();
|
|
|
|
// return AjaxResult.success();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
@ApiOperation(value = "导出word")
|
|
|
|
|
|
|
|
@PostMapping("/wordExport")
|
|
|
|
|
|
|
|
public void wordExport(HttpServletResponse response, @RequestBody List<Long> ids) throws Exception {
|
|
|
|
|
|
|
|
// 创建临时 ZIP 文件
|
|
|
|
|
|
|
|
java.io.File tempZipFile = java.io.File.createTempFile("archive", ".zip");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置文件
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
List<File> fileList = CollUtil.newArrayList();
|
|
|
|
|
|
|
|
for (long id : ids) {
|
|
|
|
|
|
|
|
BasicInformationResponse a1 = basicInformationService.selectOne(id);
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
map.put("name", a1.getBasicInformation().getName() != null ? a1.getBasicInformation().getName() : "/");
|
|
|
|
|
|
|
|
map.put("ssgnq", a1.getBasicInformation().getSsgnq() != null ? a1.getBasicInformation().getSsgnq() : "/");
|
|
|
|
|
|
|
|
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.getBasicInformation().getZydmj() != null ? a1.getBasicInformation().getZydmj() : "/");
|
|
|
|
|
|
|
|
if(a1.getPlanInformation()!=null) {
|
|
|
|
|
|
|
|
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("bzczmj", 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() : "/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
map.put("rjl","/");
|
|
|
|
|
|
|
|
map.put("zjzmj","/");
|
|
|
|
|
|
|
|
map.put("jzds","/");
|
|
|
|
|
|
|
|
map.put("bzcjzmj","/");
|
|
|
|
|
|
|
|
map.put("bzczmj","/");
|
|
|
|
|
|
|
|
map.put("jzmd","/");
|
|
|
|
|
|
|
|
map.put("zgjzcs","/");
|
|
|
|
|
|
|
|
map.put("zgjzgd","/");
|
|
|
|
|
|
|
|
map.put("fhdj","/");
|
|
|
|
|
|
|
|
map.put("jdctcw","/");
|
|
|
|
|
|
|
|
map.put("fjdctcw","/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a1.getBasicInformation().getNature() != null) {
|
|
|
|
|
|
|
|
switch (a1.getBasicInformation().getNature()) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
map.put("nature", "国企");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
map.put("nature", "外资企业");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
map.put("nature", "民营企业");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
map.put("nature", "其他");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
map.put("nature", "/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
map.put("nature", "/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
map.put("jhtze", a1.getBasicInformation().getJhtze() != null ? a1.getBasicInformation().getJhtze() : "/");
|
|
|
|
|
|
|
|
map.put("ztze", a1.getBasicInformation().getZtze() != null ? a1.getBasicInformation().getZtze() : "/");
|
|
|
|
|
|
|
|
if (a1.getBasicInformation().getXzfl() != null) {
|
|
|
|
|
|
|
|
switch (a1.getBasicInformation().getXzfl()) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
map.put("xzfl", "已建");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
map.put("xzfl", "在建");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
map.put("xzfl", "拟建");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
map.put("xzfl", "/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
map.put("xzfl", "/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("begainTime1", a1.getBasicInformation().getBegainTime() != null ? a1.getBasicInformation().getBegainTime() : "/");
|
|
|
|
|
|
|
|
map.put("jsjd", (a1.getBasicInformation().getJsjd() != null)
|
|
|
|
|
|
|
|
? a1.getBasicInformation().getJsjd()
|
|
|
|
|
|
|
|
: "/");
|
|
|
|
|
|
|
|
if (a1.getQyrzInformation()!=null) {
|
|
|
|
|
|
|
|
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() : "/");
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
map.put("rzqys","/");
|
|
|
|
|
|
|
|
map.put("rzqyhylx","/");
|
|
|
|
|
|
|
|
map.put("rysl","/");
|
|
|
|
|
|
|
|
map.put("rzl","/");
|
|
|
|
|
|
|
|
map.put("yczmj","/");
|
|
|
|
|
|
|
|
map.put("kzczmj","/");
|
|
|
|
|
|
|
|
map.put("gycfpjzj","/");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
File wordFile = new File(a1.getBasicInformation().getName() + ".docx");
|
|
|
|
|
|
|
|
try (InputStream inputStream = basicInformationService.generateDocument(map);
|
|
|
|
|
|
|
|
OutputStream outputStream = new FileOutputStream(a1.getBasicInformation().getName() + ".docx")) {
|
|
|
|
|
|
|
|
if (inputStream != null) {
|
|
|
|
|
|
|
|
byte[] buffer = new byte[4096];
|
|
|
|
|
|
|
|
int bytesRead;
|
|
|
|
|
|
|
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
|
|
|
|
|
|
|
outputStream.write(buffer, 0, bytesRead);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fileList.add(wordFile);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 将生成的 Word 文件添加到 ZIP 文件中
|
|
|
|
|
|
|
|
ZipUtil.zip(tempZipFile, false, fileList.toArray(new File[fileList.size()]));
|
|
|
|
|
|
|
|
// 设置响应头
|
|
|
|
|
|
|
|
response.setContentType("application/x-msdownload");
|
|
|
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=archive.zip");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 将 ZIP 文件内容写入响应输出流
|
|
|
|
|
|
|
|
try (InputStream zipInputStream = FileUtil.getInputStream(tempZipFile);
|
|
|
|
|
|
|
|
OutputStream responseOutputStream = response.getOutputStream()) {
|
|
|
|
|
|
|
|
IoUtil.copy(zipInputStream, responseOutputStream);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
finally {
|
|
|
|
|
|
|
|
// 删除临时 ZIP 文件
|
|
|
|
|
|
|
|
if (tempZipFile.exists()) {
|
|
|
|
|
|
|
|
FileUtil.del(tempZipFile);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 清理生成的 Word 文件
|
|
|
|
|
|
|
|
for (long id : ids) {
|
|
|
|
|
|
|
|
BasicInformationResponse a1 = basicInformationService.selectOne(id);
|
|
|
|
|
|
|
|
File wordFile = new File(a1.getBasicInformation().getName() + ".docx");
|
|
|
|
|
|
|
|
if (wordFile.exists()) {
|
|
|
|
|
|
|
|
FileUtil.del(wordFile);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|