|
@@ -66,10 +66,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
import javax.validation.ConstraintViolationException;
|
|
|
import java.io.*;
|
|
|
-import java.net.HttpURLConnection;
|
|
|
-import java.net.URL;
|
|
|
-import java.net.URLDecoder;
|
|
|
-import java.net.URLEncoder;
|
|
|
+import java.net.*;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import freemarker.template.Template;
|
|
@@ -872,6 +869,44 @@ public class WorkFullManageController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 预览工程造价咨询质量控制流程单信息
|
|
|
+ * @param response
|
|
|
+ * @param projectReportData
|
|
|
+ */
|
|
|
+ @RequestMapping(value="preViewMassControl")
|
|
|
+ @ResponseBody
|
|
|
+ public String preViewMassControl(HttpServletResponse response, ProjectReportData projectReportData) {
|
|
|
+ Map data = disposeProjectReportdata(projectReportData);
|
|
|
+
|
|
|
+
|
|
|
+ //模板对象
|
|
|
+ Template template=null;
|
|
|
+ //freemaker模板路径
|
|
|
+ File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
|
|
|
+ Configuration cfg = new Configuration();
|
|
|
+ try {
|
|
|
+ cfg.setDirectoryForTemplateLoading(path);
|
|
|
+ //选择对应的ftl文件
|
|
|
+ template = cfg.getTemplate("massControl.ftl","UTF-8");
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ File docFile = new File("工程造价咨询质量控制流程单.doc");
|
|
|
+ FreemarkerUtil.generateFile(data,template,docFile);
|
|
|
+ String pathStr = ResponseUtil.preViewResponse("工程造价咨询质量控制流程单.doc", docFile, response);
|
|
|
+ File newFile = new File(pathStr);
|
|
|
+ String url = "";
|
|
|
+ try {
|
|
|
+ url = newFile.toURI().toURL().getPath();
|
|
|
+ System.out.println();
|
|
|
+ } catch (MalformedURLException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "http://4pwi9k.natappfree.cc" + url;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 下载工程造价咨询质量控制流程单信息
|
|
|
* @param response
|
|
|
* @param projectReportData
|
|
@@ -879,6 +914,34 @@ public class WorkFullManageController extends BaseController {
|
|
|
@RequestMapping(value="downloadMassControl")
|
|
|
@ResponseBody
|
|
|
public void downloadMassControl(HttpServletResponse response, ProjectReportData projectReportData) {
|
|
|
+ Map data = disposeProjectReportdata(projectReportData);
|
|
|
+
|
|
|
+
|
|
|
+ //模板对象
|
|
|
+ Template template=null;
|
|
|
+ //freemaker模板路径
|
|
|
+ File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
|
|
|
+ Configuration cfg = new Configuration();
|
|
|
+ try {
|
|
|
+ cfg.setDirectoryForTemplateLoading(path);
|
|
|
+ //选择对应的ftl文件
|
|
|
+ template = cfg.getTemplate("massControl.ftl","UTF-8");
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ File docFile = new File("工程造价咨询质量控制流程单.doc");
|
|
|
+ FreemarkerUtil.generateFile(data,template,docFile);
|
|
|
+ ResponseUtil.docResponse("工程造价咨询质量控制流程单.doc",docFile,response);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 质量流程控制单文件数据处理
|
|
|
+ * @param projectReportData
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Map<String,Object> disposeProjectReportdata(ProjectReportData projectReportData){
|
|
|
//获取报告信息
|
|
|
projectReportData = projectReportDataService.get(projectReportData.getId());
|
|
|
//获取项目信息
|
|
@@ -1155,25 +1218,7 @@ public class WorkFullManageController extends BaseController {
|
|
|
data.put("technicistMonth","");
|
|
|
data.put("technicistDay","");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- //模板对象
|
|
|
- Template template=null;
|
|
|
- //freemaker模板路径
|
|
|
- File path = new File(this.getClass().getResource("/").getPath()+"/freemarker");
|
|
|
- Configuration cfg = new Configuration();
|
|
|
- try {
|
|
|
- cfg.setDirectoryForTemplateLoading(path);
|
|
|
- //选择对应的ftl文件
|
|
|
- template = cfg.getTemplate("massControl.ftl","UTF-8");
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- File docFile = new File("工程造价咨询质量控制流程单.doc");
|
|
|
- FreemarkerUtil.generateFile(data,template,docFile);
|
|
|
- ResponseUtil.docResponse("工程造价咨询质量控制流程单.doc",docFile,response);
|
|
|
-
|
|
|
+ return data;
|
|
|
}
|
|
|
|
|
|
/**
|