|  | @@ -7,6 +7,7 @@ import com.alibaba.fastjson2.JSONObject;
 | 
	
		
			
				|  |  |  import com.deepoove.poi.XWPFTemplate;
 | 
	
		
			
				|  |  |  import com.deepoove.poi.config.Configure;
 | 
	
		
			
				|  |  |  import com.deepoove.poi.data.PictureRenderData;
 | 
	
		
			
				|  |  | +import com.deepoove.poi.data.PictureType;
 | 
	
		
			
				|  |  |  import com.deepoove.poi.data.Pictures;
 | 
	
		
			
				|  |  |  import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
 | 
	
		
			
				|  |  |  import com.deepoove.poi.template.MetaTemplate;
 | 
	
	
		
			
				|  | @@ -30,10 +31,7 @@ import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  |  import java.io.*;
 | 
	
		
			
				|  |  |  import java.net.URLEncoder;
 | 
	
		
			
				|  |  |  import java.nio.charset.StandardCharsets;
 | 
	
		
			
				|  |  | -import java.util.ArrayList;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -import java.util.Map;
 | 
	
		
			
				|  |  | -import java.util.Random;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
	
		
			
				|  | @@ -49,27 +47,30 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 导出选址报告word
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  |       * @param request
 | 
	
		
			
				|  |  |       * @param response
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @RequestMapping("/exportWord1")
 | 
	
		
			
				|  |  |      private void exportWord1(HttpServletRequest request, HttpServletResponse response) {
 | 
	
		
			
				|  |  | -        log.info("exportWord1!");
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              SiteSelectionReport siteSelectionReport = setWordData1();
 | 
	
		
			
				|  |  |              if (siteSelectionReport == null) {
 | 
	
		
			
				|  |  |                  log.info("选址报告数据为空,导出失败!");
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/word/";
 | 
	
		
			
				|  |  | -            //word模板地址
 | 
	
		
			
				|  |  | -            String resource = basePath + "01-选址报告-02.docx";
 | 
	
		
			
				|  |  | +//            String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/word/";
 | 
	
		
			
				|  |  | +//            //word模板地址
 | 
	
		
			
				|  |  | +//            String resource = basePath + "01-选址报告-02.docx";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            String basePath = this.getClass().getClassLoader().getResource("template/word/").getPath();
 | 
	
		
			
				|  |  | +            String resource = basePath + "02-合规性分析报告-02.docx";
 | 
	
		
			
				|  |  | +            FileInputStream fileInputStream = new FileInputStream(resource);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              Configure configure = Configure.builder()
 | 
	
		
			
				|  |  |                      .bind("tableList", new LoopRowTableRenderPolicy())
 | 
	
		
			
				|  |  |                      .bind("analyseList", new AnalyseDetailTablePolicy()).build();
 | 
	
		
			
				|  |  |              // 通过 XWPFTemplate 编译文件并渲染数据到模板中
 | 
	
		
			
				|  |  | -            XWPFTemplate template = XWPFTemplate.compile(resource, configure).render(siteSelectionReport);
 | 
	
		
			
				|  |  | +            XWPFTemplate template = XWPFTemplate.compile(fileInputStream, configure).render(siteSelectionReport);
 | 
	
		
			
				|  |  |              //生成临时文件存放地址
 | 
	
		
			
				|  |  |              String temDir = basePath;
 | 
	
		
			
				|  |  |              //生成文件名
 | 
	
	
		
			
				|  | @@ -83,29 +84,32 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 导出选址报告word
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  |       * @param request
 | 
	
		
			
				|  |  |       * @param response
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @RequestMapping("/exportWord2")
 | 
	
		
			
				|  |  |      private void exportWord2(HttpServletRequest request, HttpServletResponse response) {
 | 
	
		
			
				|  |  | -        log.info("exportWord2!");
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              ComplianceAnalysisReport complianceAnalysisReport = setWordData2();
 | 
	
		
			
				|  |  |              if (complianceAnalysisReport == null) {
 | 
	
		
			
				|  |  |                  log.info("合规性分析报告数据为空,导出失败!");
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/word/";
 | 
	
		
			
				|  |  | -            //word模板地址
 | 
	
		
			
				|  |  | +//            String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/word/";
 | 
	
		
			
				|  |  | +//            //word模板地址
 | 
	
		
			
				|  |  | +//            String resource = basePath + "02-合规性分析报告-02.docx";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            String basePath = this.getClass().getClassLoader().getResource("template/word/").getPath();
 | 
	
		
			
				|  |  |              String resource = basePath + "02-合规性分析报告-02.docx";
 | 
	
		
			
				|  |  | +            FileInputStream fileInputStream = new FileInputStream(resource);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              Configure configure = Configure.builder()
 | 
	
		
			
				|  |  |                      .bind("tableList01", new LoopRowTableRenderPolicy())
 | 
	
		
			
				|  |  |                      .bind("tableList02", new LoopRowTableRenderPolicy())
 | 
	
		
			
				|  |  |                      .bind("analyseList01", new AnalyseDetailTablePolicy())
 | 
	
		
			
				|  |  |                      .bind("analyseList02", new AnalyseDetailTablePolicy()).build();
 | 
	
		
			
				|  |  |              // 通过 XWPFTemplate 编译文件并渲染数据到模板中
 | 
	
		
			
				|  |  | -            XWPFTemplate template = XWPFTemplate.compile(resource, configure).render(complianceAnalysisReport);
 | 
	
		
			
				|  |  | +            XWPFTemplate template = XWPFTemplate.compile(fileInputStream, configure).render(complianceAnalysisReport);
 | 
	
		
			
				|  |  |              List<MetaTemplate> elementTemplates = template.getElementTemplates();
 | 
	
		
			
				|  |  |              for (MetaTemplate elementTemplate : elementTemplates) {
 | 
	
		
			
				|  |  |                  String variable = elementTemplate.variable();
 | 
	
	
		
			
				|  | @@ -132,7 +136,6 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 导出征收补偿预估报告word
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  |       * @param request
 | 
	
		
			
				|  |  |       * @param response
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -144,13 +147,18 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |                  log.info("征收补偿预估报告数据为空,导出失败!");
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/word/";
 | 
	
		
			
				|  |  | -            //word模板地址
 | 
	
		
			
				|  |  | +//            String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/word/";
 | 
	
		
			
				|  |  | +//            //word模板地址
 | 
	
		
			
				|  |  | +//            String resource = basePath + "03-征收补偿预估报告-02.docx";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            String basePath = this.getClass().getClassLoader().getResource("template/word/").getPath();
 | 
	
		
			
				|  |  |              String resource = basePath + "03-征收补偿预估报告-02.docx";
 | 
	
		
			
				|  |  | +            FileInputStream fileInputStream = new FileInputStream(resource);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              Configure configure = Configure.builder()
 | 
	
		
			
				|  |  |                      .bind("tableList01", new LoopRowTableRenderPolicy()).build();
 | 
	
		
			
				|  |  |              // 通过 XWPFTemplate 编译文件并渲染数据到模板中
 | 
	
		
			
				|  |  | -            XWPFTemplate template = XWPFTemplate.compile(resource, configure).render(compensateEstimateReport);
 | 
	
		
			
				|  |  | +            XWPFTemplate template = XWPFTemplate.compile(fileInputStream, configure).render(compensateEstimateReport);
 | 
	
		
			
				|  |  |              //生成临时文件存放地址
 | 
	
		
			
				|  |  |              String temDir = basePath;
 | 
	
		
			
				|  |  |              //生成文件名
 | 
	
	
		
			
				|  | @@ -164,7 +172,6 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 导出基准地价报告word
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  |       * @param request
 | 
	
		
			
				|  |  |       * @param response
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -176,14 +183,28 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |                  log.info("基准地价报告数据为空,导出失败!");
 | 
	
		
			
				|  |  |                  return error("基准地价报告数据为空,导出失败!");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/word/";
 | 
	
		
			
				|  |  | -            //word模板地址
 | 
	
		
			
				|  |  | +            List<PicData> picList = new ArrayList<>();
 | 
	
		
			
				|  |  | +            //将base64图片转为PictureRenderData
 | 
	
		
			
				|  |  | +            for (String base64ImageData:benchmarkLandPriceReport.getPicBase64List()) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                PictureRenderData pictureRenderData =Pictures.ofBase64(base64ImageData, PictureType.JPEG).size(300, 200).create();
 | 
	
		
			
				|  |  | +                picList.add(new PicData(pictureRenderData));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            benchmarkLandPriceReport.setPicList(picList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//            String basePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/word/";
 | 
	
		
			
				|  |  | +//            //word模板地址
 | 
	
		
			
				|  |  | +//            String resource = basePath + "04-基准地价报告-02.docx";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            String basePath = this.getClass().getClassLoader().getResource("template/word/").getPath();
 | 
	
		
			
				|  |  |              String resource = basePath + "04-基准地价报告-02.docx";
 | 
	
		
			
				|  |  | +            FileInputStream fileInputStream = new FileInputStream(resource);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              Configure configure = Configure.builder()
 | 
	
		
			
				|  |  |                      .bind("tableList01", new LoopRowTableRenderPolicy())
 | 
	
		
			
				|  |  |                      .bind("tableList02", new LoopRowTableRenderPolicy()).build();
 | 
	
		
			
				|  |  |              // 通过 XWPFTemplate 编译文件并渲染数据到模板中
 | 
	
		
			
				|  |  | -            XWPFTemplate template = XWPFTemplate.compile(resource, configure).render(benchmarkLandPriceReport);
 | 
	
		
			
				|  |  | +            XWPFTemplate template = XWPFTemplate.compile(fileInputStream, configure).render(benchmarkLandPriceReport);
 | 
	
		
			
				|  |  |              List<MetaTemplate> elementTemplates = template.getElementTemplates();
 | 
	
		
			
				|  |  |              for (MetaTemplate elementTemplate : elementTemplates) {
 | 
	
		
			
				|  |  |                  String variable = elementTemplate.variable();
 | 
	
	
		
			
				|  | @@ -198,11 +219,10 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //生成文件存放地址
 | 
	
		
			
				|  |  | -            String temDir = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/storageword/";
 | 
	
		
			
				|  |  | -            ;
 | 
	
		
			
				|  |  | +            String temDir = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/storageword/";;
 | 
	
		
			
				|  |  |              //生成文件名
 | 
	
		
			
				|  |  |              String wordName = "04-基准地价报告-02" + "-" + System.currentTimeMillis();
 | 
	
		
			
				|  |  | -            String fileUrl = storageWord(response, temDir, wordName, template);
 | 
	
		
			
				|  |  | +            String fileUrl=storageWord(response, temDir, wordName, template);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              return success(fileUrl);
 | 
	
		
			
				|  |  |          } catch (Exception e) {
 | 
	
	
		
			
				|  | @@ -214,13 +234,12 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 下载分析文档
 | 
	
		
			
				|  |  | -     *
 | 
	
		
			
				|  |  |       * @param fileName
 | 
	
		
			
				|  |  |       * @param response
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @RequestMapping("/getWord")
 | 
	
		
			
				|  |  | -    private void getWord(String fileName, HttpServletResponse response) {
 | 
	
		
			
				|  |  | +    private void getWord( String fileName,HttpServletResponse response) {
 | 
	
		
			
				|  |  |          String filePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/storageword/";
 | 
	
		
			
				|  |  |          // 设置请求头
 | 
	
		
			
				|  |  |          response.setContentType("application/octet-stream");
 | 
	
	
		
			
				|  | @@ -233,9 +252,9 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              // 输出
 | 
	
		
			
				|  |  |              os = response.getOutputStream();
 | 
	
		
			
				|  |  | -            File file = new File(filePath + fileName);
 | 
	
		
			
				|  |  | +            File file = new File(filePath+fileName);
 | 
	
		
			
				|  |  |              if (!file.exists()) {
 | 
	
		
			
				|  |  | -                throw new FileNotFoundException(filePath + fileName);
 | 
	
		
			
				|  |  | +                throw new FileNotFoundException(filePath+fileName);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              fis = new FileInputStream(file);
 | 
	
		
			
				|  |  |              byte[] b = new byte[1024];
 | 
	
	
		
			
				|  | @@ -252,6 +271,7 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 封装-选址报告导出数据
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -260,10 +280,15 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |      private SiteSelectionReport setWordData1() {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              SiteSelectionReport siteSelectionReport = new SiteSelectionReport();
 | 
	
		
			
				|  |  | -            // 模拟数据 读取静态JSON文件填充数据  根据resource文件路径,生成文件
 | 
	
		
			
				|  |  | -            File jsonFile = ResourceUtils.getFile("classpath:template/json/word.json");
 | 
	
		
			
				|  |  | -            // 解析文件为指定编码的字符串
 | 
	
		
			
				|  |  | -            String json = FileUtils.readFileToString(jsonFile, "UTF-8");
 | 
	
		
			
				|  |  | +//            // 模拟数据 读取静态JSON文件填充数据  根据resource文件路径,生成文件
 | 
	
		
			
				|  |  | +//            File jsonFile = ResourceUtils.getFile("classpath:template/json/word.json");
 | 
	
		
			
				|  |  | +//            // 解析文件为指定编码的字符串
 | 
	
		
			
				|  |  | +//            String json = FileUtils.readFileToString(jsonFile, "UTF-8");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            ClassPathResource classPathResource = new ClassPathResource("template/json/word.json");
 | 
	
		
			
				|  |  | +            InputStream inputStream = classPathResource.getInputStream();
 | 
	
		
			
				|  |  | +            String json = org.apache.commons.io.IOUtils.toString(inputStream, StandardCharsets.UTF_8);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              // 转换格式
 | 
	
		
			
				|  |  |              JSONObject jsonObject = JSON.parseObject(json);
 | 
	
		
			
				|  |  |              // 读取模拟数据 并赋值给导出对象
 | 
	
	
		
			
				|  | @@ -303,7 +328,7 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |                          String cKey = child.getKey();
 | 
	
		
			
				|  |  |                          String cValue = child.getValue();
 | 
	
		
			
				|  |  |                          //封装一级,二级,模拟设置分析值
 | 
	
		
			
				|  |  | -                        analyseData = new AnalyseData(key, value, cKey, cValue, new Random().nextDouble() * 100, new Random().nextDouble() * 100);
 | 
	
		
			
				|  |  | +                        analyseData = new AnalyseData(key, value, cKey, cValue, new Random().nextDouble()*100, new Random().nextDouble()*100);
 | 
	
		
			
				|  |  |                          analyseList.add(analyseData);
 | 
	
		
			
				|  |  |                          //计算总面积
 | 
	
		
			
				|  |  |                          if (analyseData.getAreaValue() != null) {
 | 
	
	
		
			
				|  | @@ -339,10 +364,15 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |      private ComplianceAnalysisReport setWordData2() {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              ComplianceAnalysisReport complianceAnalysisReport = new ComplianceAnalysisReport();
 | 
	
		
			
				|  |  | -            // 模拟数据 读取静态JSON文件填充数据  根据resource文件路径,生成文件
 | 
	
		
			
				|  |  | -            File jsonFile = ResourceUtils.getFile("classpath:template/json/word.json");
 | 
	
		
			
				|  |  | -            // 解析文件为指定编码的字符串
 | 
	
		
			
				|  |  | -            String json = FileUtils.readFileToString(jsonFile, "UTF-8");
 | 
	
		
			
				|  |  | +//            // 模拟数据 读取静态JSON文件填充数据  根据resource文件路径,生成文件
 | 
	
		
			
				|  |  | +//            File jsonFile = ResourceUtils.getFile("classpath:template/json/word.json");
 | 
	
		
			
				|  |  | +//            // 解析文件为指定编码的字符串
 | 
	
		
			
				|  |  | +//            String json = FileUtils.readFileToString(jsonFile, "UTF-8");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            ClassPathResource classPathResource = new ClassPathResource("template/json/word.json");
 | 
	
		
			
				|  |  | +            InputStream inputStream = classPathResource.getInputStream();
 | 
	
		
			
				|  |  | +            String json = org.apache.commons.io.IOUtils.toString(inputStream, StandardCharsets.UTF_8);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              // 转换格式
 | 
	
		
			
				|  |  |              JSONObject jsonObject = JSON.parseObject(json);
 | 
	
		
			
				|  |  |              // 读取模拟数据 并赋值给导出对象
 | 
	
	
		
			
				|  | @@ -370,8 +400,8 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |                          String cKey = child.getKey();
 | 
	
		
			
				|  |  |                          String cValue = child.getValue();
 | 
	
		
			
				|  |  |                          //封装一级,二级,模拟设置分析值
 | 
	
		
			
				|  |  | -                        analyseData01 = new AnalyseData(key, value, cKey, cValue, new Random().nextDouble() * 100, new Random().nextDouble() * 100);
 | 
	
		
			
				|  |  | -                        analyseData02 = new AnalyseData(key, value, cKey, cValue, new Random().nextDouble() * 100, new Random().nextDouble() * 100);
 | 
	
		
			
				|  |  | +                        analyseData01 = new AnalyseData(key, value, cKey, cValue, new Random().nextDouble()*100, new Random().nextDouble()*100);
 | 
	
		
			
				|  |  | +                        analyseData02 = new AnalyseData(key, value, cKey, cValue, new Random().nextDouble()*100, new Random().nextDouble()*100);
 | 
	
		
			
				|  |  |                          analyseList01.add(analyseData01);
 | 
	
		
			
				|  |  |                          analyseList02.add(analyseData02);
 | 
	
		
			
				|  |  |                          //计算现状分析总面积
 | 
	
	
		
			
				|  | @@ -459,10 +489,15 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |      private CompensateEstimateReport setWordData3() {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              CompensateEstimateReport compensateEstimateReport = new CompensateEstimateReport();
 | 
	
		
			
				|  |  | -            // 模拟数据 读取静态JSON文件填充数据  根据resource文件路径,生成文件
 | 
	
		
			
				|  |  | -            File jsonFile = ResourceUtils.getFile("classpath:template/json/word.json");
 | 
	
		
			
				|  |  | -            // 解析文件为指定编码的字符串
 | 
	
		
			
				|  |  | -            String json = FileUtils.readFileToString(jsonFile, "UTF-8");
 | 
	
		
			
				|  |  | +//            // 模拟数据 读取静态JSON文件填充数据  根据resource文件路径,生成文件
 | 
	
		
			
				|  |  | +//            File jsonFile = ResourceUtils.getFile("classpath:template/json/word.json");
 | 
	
		
			
				|  |  | +//            // 解析文件为指定编码的字符串
 | 
	
		
			
				|  |  | +//            String json = FileUtils.readFileToString(jsonFile, "UTF-8");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            ClassPathResource classPathResource = new ClassPathResource("template/json/word.json");
 | 
	
		
			
				|  |  | +            InputStream inputStream = classPathResource.getInputStream();
 | 
	
		
			
				|  |  | +            String json = org.apache.commons.io.IOUtils.toString(inputStream, StandardCharsets.UTF_8);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              // 转换格式
 | 
	
		
			
				|  |  |              JSONObject jsonObject = JSON.parseObject(json);
 | 
	
		
			
				|  |  |              // 读取模拟数据 并赋值给导出对象
 | 
	
	
		
			
				|  | @@ -512,75 +547,75 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  | -    private BenchmarkLandPriceReport setWordData4() {
 | 
	
		
			
				|  |  | -        try {
 | 
	
		
			
				|  |  | -            BenchmarkLandPriceReport benchmarkLandPriceReport = new BenchmarkLandPriceReport();
 | 
	
		
			
				|  |  | -            // 模拟数据 读取静态JSON文件填充数据  根据resource文件路径,生成文件
 | 
	
		
			
				|  |  | -            File jsonFile = ResourceUtils.getFile("classpath:template/json/word.json");
 | 
	
		
			
				|  |  | -            // 解析文件为指定编码的字符串
 | 
	
		
			
				|  |  | -            String json = FileUtils.readFileToString(jsonFile, "UTF-8");
 | 
	
		
			
				|  |  | -            // 转换格式
 | 
	
		
			
				|  |  | -            JSONObject jsonObject = JSON.parseObject(json);
 | 
	
		
			
				|  |  | -            // 读取模拟数据 并赋值给导出对象
 | 
	
		
			
				|  |  | -            String wordDataJson = jsonObject.get("wordData4").toString();
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport = JSON.parseObject(wordDataJson, BenchmarkLandPriceReport.class);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            //模拟读取静态图片 赋值给导出对象
 | 
	
		
			
				|  |  | -            String imgPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/img/test.png";
 | 
	
		
			
				|  |  | -            PictureRenderData pictureRenderData = Pictures.ofLocal(imgPath).size(300, 200).create();
 | 
	
		
			
				|  |  | -            List<PicData> picList = new ArrayList<>();
 | 
	
		
			
				|  |  | -            picList.add(new PicData(pictureRenderData));
 | 
	
		
			
				|  |  | -            picList.add(new PicData(pictureRenderData));
 | 
	
		
			
				|  |  | -            picList.add(new PicData(pictureRenderData));
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setPicList(picList);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            //模拟 用地地价预估情况 数据,分为 国有建设用地 集体建设用地
 | 
	
		
			
				|  |  | -            List<LandPriceEstimation> tableList01 = new ArrayList<>();
 | 
	
		
			
				|  |  | -            List<LandPriceEstimation> tableList02 = new ArrayList<>();
 | 
	
		
			
				|  |  | -            for (int i = 0; i < 6; i++) {
 | 
	
		
			
				|  |  | -                tableList01.add(new LandPriceEstimation(LvArray[i], new Random().nextDouble() * 100, new Random().nextDouble() * 100, new Random().nextDouble() * 100));
 | 
	
		
			
				|  |  | -                tableList02.add(new LandPriceEstimation(LvArray[i], new Random().nextDouble() * 100, new Random().nextDouble() * 100, new Random().nextDouble() * 100));
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            //国有建设用地面积 国有土地地价预估 默认0
 | 
	
		
			
				|  |  | -            Double areaSCL = 0.0;
 | 
	
		
			
				|  |  | -            Double landPriceESCL = 0.0;
 | 
	
		
			
				|  |  | -            //集体建设用地面积 集体土地地价预估 默认0
 | 
	
		
			
				|  |  | -            Double areaCCL = 0.0;
 | 
	
		
			
				|  |  | -            Double landPriceECCL = 0.0;
 | 
	
		
			
				|  |  | -            //总面积 总地价预估 默认0
 | 
	
		
			
				|  |  | -            Double totalArea = 0.0;
 | 
	
		
			
				|  |  | -            Double totalLandPrice = 0.0;
 | 
	
		
			
				|  |  | -            if (tableList01 != null && tableList01.size() > 0) {
 | 
	
		
			
				|  |  | -                areaSCL = tableList01.stream().mapToDouble(obj -> obj.getArea() != null ? obj.getArea() : 0).sum();
 | 
	
		
			
				|  |  | -                landPriceESCL = tableList01.stream().mapToDouble(obj -> obj.getLandPriceES() != null ? obj.getLandPriceES() : 0).sum();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            if (tableList02 != null && tableList02.size() > 0) {
 | 
	
		
			
				|  |  | -                areaCCL = tableList02.stream().mapToDouble(obj -> obj.getArea() != null ? obj.getArea() : 0).sum();
 | 
	
		
			
				|  |  | -                landPriceECCL = tableList02.stream().mapToDouble(obj -> obj.getLandPriceES() != null ? obj.getLandPriceES() : 0).sum();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            if (areaSCL > 0 && areaCCL > 0) {
 | 
	
		
			
				|  |  | -                totalArea = areaSCL + areaCCL;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            if (landPriceESCL > 0 && landPriceECCL > 0) {
 | 
	
		
			
				|  |  | -                totalLandPrice = landPriceESCL + landPriceECCL;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            // 赋值导出对象
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setTableList01(tableList01);
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setTableList02(tableList02);
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setTotalArea(totalArea);
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setTotalLandPrice(totalLandPrice);
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setAreaSCL(areaSCL);
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setLandPriceESCL(landPriceESCL);
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setAreaCCL(areaCCL);
 | 
	
		
			
				|  |  | -            benchmarkLandPriceReport.setLandPriceECCL(landPriceECCL);
 | 
	
		
			
				|  |  | -            return benchmarkLandPriceReport;
 | 
	
		
			
				|  |  | -        } catch (Exception e) {
 | 
	
		
			
				|  |  | -            e.printStackTrace();
 | 
	
		
			
				|  |  | -            log.error("基准地价报告数据封装异常,{}" + e);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        return null;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +//    private BenchmarkLandPriceReport setWordData4() {
 | 
	
		
			
				|  |  | +//        try {
 | 
	
		
			
				|  |  | +//            BenchmarkLandPriceReport benchmarkLandPriceReport = new BenchmarkLandPriceReport();
 | 
	
		
			
				|  |  | +//            // 模拟数据 读取静态JSON文件填充数据  根据resource文件路径,生成文件
 | 
	
		
			
				|  |  | +//            File jsonFile = ResourceUtils.getFile("classpath:template/json/word.json");
 | 
	
		
			
				|  |  | +//            // 解析文件为指定编码的字符串
 | 
	
		
			
				|  |  | +//            String json = FileUtils.readFileToString(jsonFile, "UTF-8");
 | 
	
		
			
				|  |  | +//            // 转换格式
 | 
	
		
			
				|  |  | +//            JSONObject jsonObject = JSON.parseObject(json);
 | 
	
		
			
				|  |  | +//            // 读取模拟数据 并赋值给导出对象
 | 
	
		
			
				|  |  | +//            String wordDataJson = jsonObject.get("wordData4").toString();
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport = JSON.parseObject(wordDataJson, BenchmarkLandPriceReport.class);
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            //模拟读取静态图片 赋值给导出对象
 | 
	
		
			
				|  |  | +//            String imgPath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/img/test.png";
 | 
	
		
			
				|  |  | +//            PictureRenderData pictureRenderData = Pictures.ofLocal(imgPath).size(300, 200).create();
 | 
	
		
			
				|  |  | +//            List<PicData> picList = new ArrayList<>();
 | 
	
		
			
				|  |  | +//            picList.add(new PicData(pictureRenderData));
 | 
	
		
			
				|  |  | +//            picList.add(new PicData(pictureRenderData));
 | 
	
		
			
				|  |  | +//            picList.add(new PicData(pictureRenderData));
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setPicList(picList);
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            //模拟 用地地价预估情况 数据,分为 国有建设用地 集体建设用地
 | 
	
		
			
				|  |  | +//            List<LandPriceEstimation> tableList01 = new ArrayList<>();
 | 
	
		
			
				|  |  | +//            List<LandPriceEstimation> tableList02 = new ArrayList<>();
 | 
	
		
			
				|  |  | +//            for (int i = 0; i < 6; i++) {
 | 
	
		
			
				|  |  | +//                tableList01.add(new LandPriceEstimation(LvArray[i], new Random().nextDouble()*100, new Random().nextDouble()*100, new Random().nextDouble()*100));
 | 
	
		
			
				|  |  | +//                tableList02.add(new LandPriceEstimation(LvArray[i], new Random().nextDouble()*100, new Random().nextDouble()*100, new Random().nextDouble()*100));
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//            //国有建设用地面积 国有土地地价预估 默认0
 | 
	
		
			
				|  |  | +//            Double areaSCL = 0.0;
 | 
	
		
			
				|  |  | +//            Double landPriceESCL = 0.0;
 | 
	
		
			
				|  |  | +//            //集体建设用地面积 集体土地地价预估 默认0
 | 
	
		
			
				|  |  | +//            Double areaCCL = 0.0;
 | 
	
		
			
				|  |  | +//            Double landPriceECCL = 0.0;
 | 
	
		
			
				|  |  | +//            //总面积 总地价预估 默认0
 | 
	
		
			
				|  |  | +//            Double totalArea = 0.0;
 | 
	
		
			
				|  |  | +//            Double totalLandPrice = 0.0;
 | 
	
		
			
				|  |  | +//            if (tableList01 != null && tableList01.size() > 0) {
 | 
	
		
			
				|  |  | +//                areaSCL = tableList01.stream().mapToDouble(obj -> obj.getArea() != null ? obj.getArea() : 0).sum();
 | 
	
		
			
				|  |  | +//                landPriceESCL = tableList01.stream().mapToDouble(obj -> obj.getLandPriceES() != null ? obj.getLandPriceES() : 0).sum();
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//            if (tableList02 != null && tableList02.size() > 0) {
 | 
	
		
			
				|  |  | +//                areaCCL = tableList02.stream().mapToDouble(obj -> obj.getArea() != null ? obj.getArea() : 0).sum();
 | 
	
		
			
				|  |  | +//                landPriceECCL = tableList02.stream().mapToDouble(obj -> obj.getLandPriceES() != null ? obj.getLandPriceES() : 0).sum();
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//            if (areaSCL > 0 && areaCCL > 0) {
 | 
	
		
			
				|  |  | +//                totalArea = areaSCL + areaCCL;
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//            if (landPriceESCL > 0 && landPriceECCL > 0) {
 | 
	
		
			
				|  |  | +//                totalLandPrice = landPriceESCL + landPriceECCL;
 | 
	
		
			
				|  |  | +//            }
 | 
	
		
			
				|  |  | +//            // 赋值导出对象
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setTableList01(tableList01);
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setTableList02(tableList02);
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setTotalArea(totalArea);
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setTotalLandPrice(totalLandPrice);
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setAreaSCL(areaSCL);
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setLandPriceESCL(landPriceESCL);
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setAreaCCL(areaCCL);
 | 
	
		
			
				|  |  | +//            benchmarkLandPriceReport.setLandPriceECCL(landPriceECCL);
 | 
	
		
			
				|  |  | +//            return benchmarkLandPriceReport;
 | 
	
		
			
				|  |  | +//        } catch (Exception e) {
 | 
	
		
			
				|  |  | +//            e.printStackTrace();
 | 
	
		
			
				|  |  | +//            log.error("基准地价报告数据封装异常,{}" + e);
 | 
	
		
			
				|  |  | +//        }
 | 
	
		
			
				|  |  | +//        return null;
 | 
	
		
			
				|  |  | +//    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -636,4 +671,7 @@ public class SanYaController extends BaseController {
 | 
	
		
			
				|  |  |          out.close();
 | 
	
		
			
				|  |  |          return fileName;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |