|
|
@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.aliyuncs.exceptions.ClientException;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.xiaoleilu.hutool.util.StrUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
@@ -17,6 +20,7 @@ import platform.common.exception.BaseException;
|
|
|
import platform.common.util.*;
|
|
|
import platform.common.util.word.ExportWord;
|
|
|
import platform.modules.company.dto.LandSupplyApprovalDto;
|
|
|
+import platform.modules.company.entity.ProjectApplication;
|
|
|
import platform.modules.government.dao.IndustrialLandSupplyDetailDao;
|
|
|
import platform.modules.government.dto.DepartmentDto;
|
|
|
import platform.modules.government.dto.IndustrialLandSupplyDto;
|
|
|
@@ -28,7 +32,9 @@ import tk.mybatis.mapper.entity.Example;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.*;
|
|
|
@@ -90,6 +96,11 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
|
|
|
|
|
|
private static String CONSULTATION_MESSAGE = "请反馈明确意见";
|
|
|
|
|
|
+ @Value("${repositoryPath}")
|
|
|
+ public String repositoryPath;
|
|
|
+
|
|
|
+ final private String attachmentType = "annex_template";
|
|
|
+
|
|
|
/**
|
|
|
* @Author: huZhiHao
|
|
|
* @Description: 分页查询
|
|
|
@@ -3702,4 +3713,63 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
|
|
|
|
|
|
ew.exportCheckWord(dataList, document, response);
|
|
|
}
|
|
|
+
|
|
|
+ public void exportCountersignWord2(int id, HttpServletResponse response) throws Exception {
|
|
|
+
|
|
|
+
|
|
|
+ IndustrialLandSupplyDetail entity = this.findById(id);
|
|
|
+
|
|
|
+ generateWord(entity, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void generateWord(IndustrialLandSupplyDetail entity, HttpServletResponse response) throws Exception {
|
|
|
+ String time = DateUtil.getTimeString(new Date()).split(" ")[0];
|
|
|
+ final String name = "苏州国家高新区产业用地预审办文单" + "-" + time + ".docx";
|
|
|
+// String templateUrl = repositoryPath + "/docs/annex_template/annex4.docx";
|
|
|
+ String templateUrl = "template/苏州高新区产业用地预审办文单.docx";
|
|
|
+ //文件数据库存储路径
|
|
|
+// String outputUrl = getFilePath(name, "docs") + ".docx";
|
|
|
+
|
|
|
+ String title = entity.getTitle();
|
|
|
+ String content = entity.getContent_text();
|
|
|
+ String location = entity.getLocation();
|
|
|
+ String consultationSummary = entity.getConsultation_summary_text();
|
|
|
+
|
|
|
+ Map<String, String> dataMap = new HashMap<>();
|
|
|
+ dataMap.put("title", title == null ? "" : title);
|
|
|
+ dataMap.put("content", content == null ? "" : content);
|
|
|
+ dataMap.put("location", location == null ? "" : location);
|
|
|
+ dataMap.put("consultationSummary", consultationSummary == null ? "" : consultationSummary);
|
|
|
+ dataMap.put("time", time);
|
|
|
+
|
|
|
+ response.reset();
|
|
|
+ response.setContentType("application/octet-stream; charset=utf-8");
|
|
|
+ response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("苏州国家高新区产业用地预审办文单" + "-" + time + ".docx", "UTF-8"));
|
|
|
+
|
|
|
+ changWord(templateUrl, response, dataMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getFilePath(String sourceFileName, String typeFolder) {
|
|
|
+ String baseFolder = repositoryPath + File.separator + typeFolder;
|
|
|
+ Date nowDate = new Date();
|
|
|
+ // yyyy/MM/dd
|
|
|
+ String fileFolder = baseFolder + File.separator + com.xiaoleilu.hutool.date.DateUtil.format(nowDate, "yyyy")
|
|
|
+ + File.separator + com.xiaoleilu.hutool.date.DateUtil.format(nowDate, "MM") + File.separator
|
|
|
+ + com.xiaoleilu.hutool.date.DateUtil.format(nowDate, "dd");
|
|
|
+
|
|
|
+ File file = new File(fileFolder);
|
|
|
+
|
|
|
+ if (!file.isDirectory()) {
|
|
|
+ // 如果目录不存在,则创建目录
|
|
|
+ file.mkdirs();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成新的文件名
|
|
|
+ String fileName = com.xiaoleilu.hutool.date.DateUtil.format(nowDate, "yyyyMMddHHmmss") + sourceFileName;
|
|
|
+ return fileFolder + File.separator + fileName;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void changWord(String annexOneTempUrl, HttpServletResponse response, Map<String, String> dataMap) {
|
|
|
+ BokeWordUtils.changWord(annexOneTempUrl, response, dataMap, null);
|
|
|
+ }
|
|
|
}
|