|
@@ -1,138 +1,44 @@
|
|
package com.onemap.sanya.controller;
|
|
package com.onemap.sanya.controller;
|
|
|
|
|
|
-import com.alibaba.fastjson.util.IOUtils;
|
|
+
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
|
-import com.alibaba.fastjson2.JSONObject;
|
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
import com.deepoove.poi.config.Configure;
|
|
import com.deepoove.poi.config.Configure;
|
|
import com.deepoove.poi.data.PictureRenderData;
|
|
import com.deepoove.poi.data.PictureRenderData;
|
|
import com.deepoove.poi.data.PictureType;
|
|
import com.deepoove.poi.data.PictureType;
|
|
import com.deepoove.poi.data.Pictures;
|
|
import com.deepoove.poi.data.Pictures;
|
|
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
|
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
|
-import com.deepoove.poi.template.MetaTemplate;
|
|
|
|
-import com.deepoove.poi.template.run.RunTemplate;
|
|
|
|
import com.onemap.common.core.utils.StringUtils;
|
|
import com.onemap.common.core.utils.StringUtils;
|
|
import com.onemap.common.core.web.controller.BaseController;
|
|
import com.onemap.common.core.web.controller.BaseController;
|
|
import com.onemap.sanya.domain.*;
|
|
import com.onemap.sanya.domain.*;
|
|
import com.onemap.sanya.domain.CQBC.CompensateEstimateReport;
|
|
import com.onemap.sanya.domain.CQBC.CompensateEstimateReport;
|
|
-import com.onemap.sanya.domain.mergeCell.AnalyseDetailTablePolicy;
|
|
|
|
import com.onemap.sanya.domain.mergeCell.JZDJTableRenderPolicy;
|
|
import com.onemap.sanya.domain.mergeCell.JZDJTableRenderPolicy;
|
|
-import org.apache.poi.xwpf.usermodel.*;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
-import org.springframework.util.ClassUtils;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
-import java.nio.charset.StandardCharsets;
|
|
+import java.text.DecimalFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
* @author Zzz
|
|
* @author Zzz
|
|
*/
|
|
*/
|
|
-
|
|
+
|
|
@RestController
|
|
@RestController
|
|
-@RequestMapping("/sanya")
|
|
+@RequestMapping("/exportWord")
|
|
public class SanYaController extends BaseController {
|
|
public class SanYaController extends BaseController {
|
|
private static final Logger log = LoggerFactory.getLogger(SanYaController.class);
|
|
private static final Logger log = LoggerFactory.getLogger(SanYaController.class);
|
|
|
|
|
|
- private static final String[] LvArray = {"Ⅰ", "Ⅱ", "Ⅲ", "Ⅳ", "Ⅴ", "Ⅵ", "Ⅶ", "Ⅷ", "Ⅸ", "Ⅹ"};
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * 导出选址报告word
|
|
|
|
- * @param request
|
|
|
|
- * @param response
|
|
|
|
- */
|
|
|
|
- @RequestMapping("/exportWord1")
|
|
|
|
- private void exportWord1(HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
- try {
|
|
|
|
- SiteSelectionReport siteSelectionReport = setWordData1();
|
|
|
|
- if (siteSelectionReport == null) {
|
|
|
|
- log.info("选址报告数据为空,导出失败!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ClassPathResource classPathResource = new ClassPathResource("template/word/"+"01-选址报告-02.docx");
|
|
|
|
- InputStream inputStream = classPathResource.getInputStream();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- Configure configure = Configure.builder()
|
|
|
|
- .bind("tableList", new LoopRowTableRenderPolicy())
|
|
|
|
- .bind("analyseList", new AnalyseDetailTablePolicy()).build();
|
|
|
|
-
|
|
|
|
- XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render(siteSelectionReport);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- String wordName = "01-选址报告-02" + "-" + System.currentTimeMillis();
|
|
|
|
- writeWord(response, null, wordName, template);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- log.error("选址报告导出异常,{}" + e);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * 导出选址报告word
|
|
|
|
- * @param request
|
|
|
|
- * @param response
|
|
|
|
- */
|
|
|
|
- @RequestMapping("/exportWord2")
|
|
|
|
- private void exportWord2(HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
- try {
|
|
|
|
- ComplianceAnalysisReport complianceAnalysisReport = setWordData2();
|
|
|
|
- if (complianceAnalysisReport == null) {
|
|
|
|
- log.info("合规性分析报告数据为空,导出失败!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ClassPathResource classPathResource = new ClassPathResource("template/word/"+"02-合规性分析报告-02.docx");
|
|
|
|
- InputStream inputStream = classPathResource.getInputStream();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- Configure configure = Configure.builder()
|
|
|
|
- .bind("tableList01", new LoopRowTableRenderPolicy())
|
|
|
|
- .bind("tableList02", new LoopRowTableRenderPolicy())
|
|
|
|
- .bind("analyseList01", new AnalyseDetailTablePolicy())
|
|
|
|
- .bind("analyseList02", new AnalyseDetailTablePolicy()).build();
|
|
|
|
-
|
|
|
|
- XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render(complianceAnalysisReport);
|
|
|
|
- List<MetaTemplate> elementTemplates = template.getElementTemplates();
|
|
|
|
- for (MetaTemplate elementTemplate : elementTemplates) {
|
|
|
|
- String variable = elementTemplate.variable();
|
|
|
|
- if ("{{tableList01}}".equals(variable) || "{{tableList02}}".equals(variable)) {
|
|
|
|
- RunTemplate runTemplate = (RunTemplate) elementTemplate;
|
|
|
|
- XWPFRun run = runTemplate.getRun();
|
|
|
|
- XWPFTableCell cell = (XWPFTableCell) ((XWPFParagraph) run.getParent()).getBody();
|
|
|
|
- List<XWPFTableRow> rows = cell.getTableRow().getTable().getRows();
|
|
|
|
- int rowIndex = rows.indexOf(cell.getTableRow());
|
|
|
|
- XWPFTable table = cell.getTableRow().getTable();
|
|
|
|
- table.removeRow(rowIndex);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- String wordName = "02-合规性分析报告-02" + "-" + System.currentTimeMillis();
|
|
|
|
- writeWord(response, null, wordName, template);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- log.error("合规性分析报告导出异常,{}" + e);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
* 导出征收补偿预估报告word
|
|
* 导出征收补偿预估报告word
|
|
* @param request
|
|
* @param request
|
|
* @param response
|
|
* @param response
|
|
*/
|
|
*/
|
|
- @RequestMapping("/exportWord3")
|
|
+ @PostMapping("/exportWord3")
|
|
private void exportWord3(@RequestBody CompensateEstimateReport compensateEstimateReport, HttpServletRequest request, HttpServletResponse response) {
|
|
private void exportWord3(@RequestBody CompensateEstimateReport compensateEstimateReport, HttpServletRequest request, HttpServletResponse response) {
|
|
try {
|
|
try {
|
|
|
|
|
|
@@ -166,7 +72,8 @@ public class SanYaController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- String wordName = "03-征收补偿预估报告-02" + "-" + System.currentTimeMillis();
|
|
+
|
|
|
|
+ String wordName =compensateEstimateReport.getName();
|
|
writeWord(response, null, wordName, template);
|
|
writeWord(response, null, wordName, template);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -179,7 +86,7 @@ public class SanYaController extends BaseController {
|
|
* @param request
|
|
* @param request
|
|
* @param response
|
|
* @param response
|
|
*/
|
|
*/
|
|
- @RequestMapping("/exportWord4")
|
|
+ @PostMapping("/exportWord4")
|
|
private void exportWord4(@RequestBody BenchmarkLandPriceReport benchmarkLandPriceReport, HttpServletRequest request, HttpServletResponse response) {
|
|
private void exportWord4(@RequestBody BenchmarkLandPriceReport benchmarkLandPriceReport, HttpServletRequest request, HttpServletResponse response) {
|
|
try {
|
|
try {
|
|
if (benchmarkLandPriceReport == null) {
|
|
if (benchmarkLandPriceReport == null) {
|
|
@@ -225,7 +132,13 @@ public class SanYaController extends BaseController {
|
|
|
|
|
|
List<BenchmarkLandPriceTotal> benchmarkLandPriceTotals = new ArrayList<>();
|
|
List<BenchmarkLandPriceTotal> benchmarkLandPriceTotals = new ArrayList<>();
|
|
for (Map.Entry<String, Double[]> entry : groupSums.entrySet()) {
|
|
for (Map.Entry<String, Double[]> entry : groupSums.entrySet()) {
|
|
- benchmarkLandPriceTotals.add(new BenchmarkLandPriceTotal(entry.getKey(), entry.getValue()[0], entry.getValue()[1]));
|
|
+
|
|
|
|
+ DecimalFormat format = new DecimalFormat("#.00");
|
|
|
|
+ String str0 = format.format(entry.getValue()[0]);
|
|
|
|
+ double Value0 = Double.parseDouble(str0);
|
|
|
|
+ String str1 = format.format(entry.getValue()[1]);
|
|
|
|
+ double Value1 = Double.parseDouble(str1);
|
|
|
|
+ benchmarkLandPriceTotals.add(new BenchmarkLandPriceTotal(entry.getKey(), Value0, Value1));
|
|
}
|
|
}
|
|
benchmarkLandPriceReport.setBenchmarkLandPriceTotalList(benchmarkLandPriceTotals);
|
|
benchmarkLandPriceReport.setBenchmarkLandPriceTotalList(benchmarkLandPriceTotals);
|
|
|
|
|
|
@@ -240,7 +153,8 @@ public class SanYaController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- String wordName = "04-基准地价报告-02" + "-" + System.currentTimeMillis();
|
|
+
|
|
|
|
+ String wordName = benchmarkLandPriceReport.getProjectName();
|
|
writeWord(response, null, wordName, template);
|
|
writeWord(response, null, wordName, template);
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -250,392 +164,6 @@ public class SanYaController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
- * 下载分析文档
|
|
|
|
- * @param fileName
|
|
|
|
- * @param response
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- @RequestMapping("/getWord")
|
|
|
|
- private void getWord( String fileName,HttpServletResponse response) {
|
|
|
|
- String filePath = ClassUtils.getDefaultClassLoader().getResource("").getPath() + "template/storageword/";
|
|
|
|
-
|
|
|
|
- response.setContentType("application/octet-stream");
|
|
|
|
- response.addHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes(), StandardCharsets.UTF_8) + "\"");
|
|
|
|
- response.setHeader("download-filename", fileName);
|
|
|
|
-
|
|
|
|
- response.setHeader("Access-Control-Expose-Headers", "download-filename");
|
|
|
|
- FileInputStream fis = null;
|
|
|
|
- OutputStream os = null;
|
|
|
|
- try {
|
|
|
|
-
|
|
|
|
- os = response.getOutputStream();
|
|
|
|
- File file = new File(filePath+fileName);
|
|
|
|
- if (!file.exists()) {
|
|
|
|
- throw new FileNotFoundException(filePath+fileName);
|
|
|
|
- }
|
|
|
|
- fis = new FileInputStream(file);
|
|
|
|
- byte[] b = new byte[1024];
|
|
|
|
- int length;
|
|
|
|
- while ((length = fis.read(b)) > 0) {
|
|
|
|
- os.write(b, 0, length);
|
|
|
|
- }
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- } finally {
|
|
|
|
- IOUtils.close(os);
|
|
|
|
- IOUtils.close(fis);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * 封装-选址报告导出数据
|
|
|
|
- *
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private SiteSelectionReport setWordData1() {
|
|
|
|
- try {
|
|
|
|
- SiteSelectionReport siteSelectionReport = new SiteSelectionReport();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- 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);
|
|
|
|
-
|
|
|
|
- String wordDataJson = jsonObject.get("wordData1").toString();
|
|
|
|
- siteSelectionReport = JSON.parseObject(wordDataJson, SiteSelectionReport.class);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- List<FactorData> factorDataList = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < 6; i++) {
|
|
|
|
- factorDataList.add(new FactorData().FactorDataForSiteSelectionReport("测试因子名称" + i, "测试计算方法" + i, "测试因子约束" + i));
|
|
|
|
- }
|
|
|
|
- siteSelectionReport.setTableList(factorDataList);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- 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));
|
|
|
|
- siteSelectionReport.setPicList(picList);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- String analyseJson = jsonObject.get("analyseJson").toString();
|
|
|
|
- List<JsonConvert> analyseConList = JSON.parseArray(analyseJson, JsonConvert.class);
|
|
|
|
- List<AnalyseData> analyseList = new ArrayList<>();
|
|
|
|
- Double totalArea = 0.0;
|
|
|
|
- String detail = "";
|
|
|
|
-
|
|
|
|
- for (JsonConvert jsonConvert : analyseConList) {
|
|
|
|
- String key = jsonConvert.getKey();
|
|
|
|
- String value = jsonConvert.getValue();
|
|
|
|
- List<JsonConvert> children = jsonConvert.getChildren();
|
|
|
|
- AnalyseData analyseData = null;
|
|
|
|
- if (children != null && children.size() > 0) {
|
|
|
|
- for (JsonConvert child : children) {
|
|
|
|
- String cKey = child.getKey();
|
|
|
|
- String cValue = child.getValue();
|
|
|
|
-
|
|
|
|
- analyseData = new AnalyseData(key, value, cKey, cValue, new Random().nextDouble()*100, new Random().nextDouble()*100);
|
|
|
|
- analyseList.add(analyseData);
|
|
|
|
-
|
|
|
|
- if (analyseData.getAreaValue() != null) {
|
|
|
|
- totalArea = totalArea + analyseData.getAreaValue();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (analyseData.getAreaValue() != null && analyseData.getPercentValue() != null) {
|
|
|
|
- detail = detail + analyseData.getSecondName() + analyseData.getAreaValue() + "平方米,占比" + analyseData.getPercentValue() + "%;";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- analyseData = new AnalyseData(key, value, "", "", null, null);
|
|
|
|
- analyseList.add(analyseData);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- siteSelectionReport.setTotalArea(totalArea + "");
|
|
|
|
- siteSelectionReport.setDetail(detail);
|
|
|
|
- siteSelectionReport.setAnalyseList(analyseList);
|
|
|
|
- return siteSelectionReport;
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- log.error("选址报告数据封装异常,{}" + e);
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * 封装-合规性分析报告导出数据
|
|
|
|
- *
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private ComplianceAnalysisReport setWordData2() {
|
|
|
|
- try {
|
|
|
|
- ComplianceAnalysisReport complianceAnalysisReport = new ComplianceAnalysisReport();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- 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);
|
|
|
|
-
|
|
|
|
- String wordDataJson = jsonObject.get("wordData2").toString();
|
|
|
|
- complianceAnalysisReport = JSON.parseObject(wordDataJson, ComplianceAnalysisReport.class);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- String analyseJson = jsonObject.get("analyseJson").toString();
|
|
|
|
- List<JsonConvert> analyseConList = JSON.parseArray(analyseJson, JsonConvert.class);
|
|
|
|
- List<AnalyseData> analyseList01 = new ArrayList<>();
|
|
|
|
- List<AnalyseData> analyseList02 = new ArrayList<>();
|
|
|
|
- Double totalArea01 = 0.0;
|
|
|
|
- String detail01 = "";
|
|
|
|
- Double totalArea02 = 0.0;
|
|
|
|
- String detail02 = "";
|
|
|
|
-
|
|
|
|
- for (JsonConvert jsonConvert : analyseConList) {
|
|
|
|
- String key = jsonConvert.getKey();
|
|
|
|
- String value = jsonConvert.getValue();
|
|
|
|
- List<JsonConvert> children = jsonConvert.getChildren();
|
|
|
|
- AnalyseData analyseData01 = null;
|
|
|
|
- AnalyseData analyseData02 = null;
|
|
|
|
- if (children != null && children.size() > 0) {
|
|
|
|
- for (JsonConvert child : children) {
|
|
|
|
- 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);
|
|
|
|
- analyseList01.add(analyseData01);
|
|
|
|
- analyseList02.add(analyseData02);
|
|
|
|
-
|
|
|
|
- if (analyseData01.getAreaValue() != null) {
|
|
|
|
- totalArea01 = totalArea01 + analyseData01.getAreaValue();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (analyseData01.getAreaValue() != null && analyseData01.getPercentValue() != null) {
|
|
|
|
- detail01 = detail01 + analyseData01.getSecondName() + analyseData01.getAreaValue() + "平方米,占比" + analyseData01.getPercentValue() + "%;";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (analyseData02.getAreaValue() != null) {
|
|
|
|
- totalArea02 = totalArea02 + analyseData02.getAreaValue();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (analyseData02.getAreaValue() != null && analyseData02.getPercentValue() != null) {
|
|
|
|
- detail02 = detail02 + analyseData02.getSecondName() + analyseData02.getAreaValue() + "平方米,占比" + analyseData02.getPercentValue() + "%;";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- analyseData01 = new AnalyseData(key, value, "", "", null, null);
|
|
|
|
- analyseData02 = new AnalyseData(key, value, "", "", null, null);
|
|
|
|
- analyseList01.add(analyseData01);
|
|
|
|
- analyseList02.add(analyseData02);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<FactorData> tableList01 = new ArrayList<>();
|
|
|
|
- if (analyseList01 != null && analyseList01.size() > 0) {
|
|
|
|
- Map<String, List<AnalyseData>> analyseCollect01 = analyseList01.stream().collect(Collectors.groupingBy(AnalyseData::getFirstCode));
|
|
|
|
- if (analyseCollect01 != null && analyseCollect01.size() > 0) {
|
|
|
|
- analyseCollect01.entrySet()
|
|
|
|
- .stream()
|
|
|
|
- .sorted(Map.Entry.comparingByKey())
|
|
|
|
- .forEach(entry -> {
|
|
|
|
- List<AnalyseData> analyseDataList = entry.getValue();
|
|
|
|
- Double sum = analyseDataList.stream().mapToDouble(obj -> obj.getAreaValue() != null ? obj.getAreaValue() : 0).sum();
|
|
|
|
- AnalyseData analyseData = analyseDataList.get(0);
|
|
|
|
- String firstCode = analyseData.getFirstCode();
|
|
|
|
- String firstName = analyseData.getFirstName();
|
|
|
|
- tableList01.add(new FactorData().FactorDataForComplianceAnalysisReport01(firstCode + " " + firstName, sum + ""));
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<FactorData> tableList02 = new ArrayList<>();
|
|
|
|
- if (analyseList02 != null && analyseList02.size() > 0) {
|
|
|
|
- Map<String, List<AnalyseData>> analyseCollect02 = analyseList02.stream().collect(Collectors.groupingBy(AnalyseData::getFirstCode));
|
|
|
|
- if (analyseCollect02 != null && analyseCollect02.size() > 0) {
|
|
|
|
- analyseCollect02.entrySet()
|
|
|
|
- .stream()
|
|
|
|
- .sorted(Map.Entry.comparingByKey())
|
|
|
|
- .forEach(entry -> {
|
|
|
|
- List<AnalyseData> analyseDataList = entry.getValue();
|
|
|
|
- Double sum = analyseDataList.stream().mapToDouble(obj -> obj.getAreaValue() != null ? obj.getAreaValue() : 0).sum();
|
|
|
|
- AnalyseData analyseData = analyseDataList.get(0);
|
|
|
|
- String firstCode = analyseData.getFirstCode();
|
|
|
|
- String firstName = analyseData.getFirstName();
|
|
|
|
- tableList02.add(new FactorData().FactorDataForComplianceAnalysisReport02(firstCode + " " + firstName, sum + ""));
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- complianceAnalysisReport.setTableList01(tableList01);
|
|
|
|
- complianceAnalysisReport.setTableList02(tableList02);
|
|
|
|
- complianceAnalysisReport.setAnalyseList01(analyseList01);
|
|
|
|
- complianceAnalysisReport.setTotalArea01(totalArea01);
|
|
|
|
- complianceAnalysisReport.setDetail01(detail01);
|
|
|
|
- complianceAnalysisReport.setAnalyseList02(analyseList02);
|
|
|
|
- complianceAnalysisReport.setTotalArea02(totalArea02);
|
|
|
|
- complianceAnalysisReport.setDetail02(detail02);
|
|
|
|
- return complianceAnalysisReport;
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- log.error("合规性分析报告封装异常,{}" + e);
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * 封装-征收补偿预估报告导出数据
|
|
|
|
- *
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * 封装-基准地价报告导出数据
|
|
|
|
- *
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
|
|
* word写出
|
|
* word写出
|
|
*
|
|
*
|
|
@@ -670,29 +198,4 @@ public class SanYaController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- * word存储
|
|
|
|
- *
|
|
|
|
- * @param response
|
|
|
|
- * @param temDir
|
|
|
|
- * @param wordName
|
|
|
|
- * @param template
|
|
|
|
- * @throws Exception
|
|
|
|
- */
|
|
|
|
- private String storageWord(HttpServletResponse response, String temDir, String wordName, XWPFTemplate template) throws Exception {
|
|
|
|
-
|
|
|
|
- String formatSuffix = ".docx";
|
|
|
|
-
|
|
|
|
- String fileName = wordName + formatSuffix;
|
|
|
|
-
|
|
|
|
- File file = new File(temDir + fileName);
|
|
|
|
- FileOutputStream out = new FileOutputStream(file);
|
|
|
|
- template.write(out);
|
|
|
|
- out.close();
|
|
|
|
- return fileName;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|