|  | @@ -3,14 +3,19 @@ package com.onemap.analyse.service.impl;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
	
		
			
				|  |  |  import com.fasterxml.jackson.annotation.JsonProperty;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.domain.*;
 | 
	
		
			
				|  |  | +import com.onemap.analyse.domain.res.GeomRes;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.domain.vo.FactorSpatialVo;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.mapper.FzxzMapper;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.mapper.FactorUseMapper;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.mapper.base.FzxzResMapper;
 | 
	
		
			
				|  |  | +import com.onemap.analyse.mapper.base.ShpFileMapper;
 | 
	
		
			
				|  |  | +import com.onemap.analyse.mapper.vector.GhdkaMapper;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.service.ILogService;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.service.IReportService;
 | 
	
		
			
				|  |  | +import com.onemap.analyse.utils.JsonUtils;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.utils.NpoiHelper;
 | 
	
		
			
				|  |  |  import com.onemap.analyse.utils.NumberUtil;
 | 
	
		
			
				|  |  | +import com.onemap.analyse.utils.UnitsUtil;
 | 
	
		
			
				|  |  |  import com.onemap.common.core.utils.StringUtils;
 | 
	
		
			
				|  |  |  import org.apache.commons.io.FileUtils;
 | 
	
		
			
				|  |  |  import org.apache.poi.xwpf.usermodel.*;
 | 
	
	
		
			
				|  | @@ -41,11 +46,17 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  |      private FactorUseMapper fzxzXzyzMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    ShpFileMapper shpFileMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Value("${Hgxfx.tempWin}")
 | 
	
		
			
				|  |  |      private String tempWin;
 | 
	
		
			
				|  |  |      @Value("${Hgxfx.tempLinux}")
 | 
	
		
			
				|  |  |      private String tempLinux;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    GhdkaMapper ghdkaMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      // 根据选址任务生成报告
 | 
	
		
			
				|  |  |      public FzxzReport createReport(String bsm, List<String> xzbsmList) {
 | 
	
		
			
				|  |  |          String temp = tempLinux;
 | 
	
	
		
			
				|  | @@ -92,6 +103,8 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |       * @param xzbsmList  没有导出全部地块
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private void createReport(FzxzEntityDTO res, String reportPath, List<String> xzbsmList) {
 | 
	
		
			
				|  |  | +        GeomRes geomRes = shpFileMapper.getOne(res.getGeomId());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          // List<String> imgList = ReportImg(res, xzbsmList);
 | 
	
		
			
				|  |  |          // 创建document文档对象对象实例
 | 
	
		
			
				|  |  |          XWPFDocument document = null;
 | 
	
	
		
			
				|  | @@ -108,15 +121,12 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              // 1、项目选址信息
 | 
	
		
			
				|  |  |              NpoiHelper.catalog(document, "一、项目选址信息", pos++);
 | 
	
		
			
				|  |  | -            String ydmj = res.getYdmjbegin() + " - " + res.getYdmjend();
 | 
	
		
			
				|  |  | -            if (StringUtils.isEmpty(res.getYdmjbegin()) || Double.parseDouble(res.getYdmjbegin()) == 0)
 | 
	
		
			
				|  |  | -                ydmj = "≤" + res.getYdmjend();
 | 
	
		
			
				|  |  | -            else if (StringUtils.isEmpty(res.getYdmjend()) || Double.parseDouble(res.getYdmjend()) == 0)
 | 
	
		
			
				|  |  | -                ydmj = "≥" + res.getYdmjbegin();
 | 
	
		
			
				|  |  | +            String ydmj = NumberUtil.double2TwoDecimal(UnitsUtil.m2ToMu(res.getYdmjbegin())) +
 | 
	
		
			
				|  |  | +                    " - " + NumberUtil.double2TwoDecimal(UnitsUtil.m2ToMu(res.getYdmjend()));
 | 
	
		
			
				|  |  |              List<String> listTemp = new ArrayList<>();
 | 
	
		
			
				|  |  |              listTemp.add("\t项目名称:" + res.getXmmc());
 | 
	
		
			
				|  |  |              listTemp.add("\t建设单位:" + res.getJsdw());
 | 
	
		
			
				|  |  | -            listTemp.add("\t用地面积:" + ydmj + "平方米");
 | 
	
		
			
				|  |  | +            listTemp.add("\t用地面积:" + ydmj + "亩");
 | 
	
		
			
				|  |  |              listTemp.add("\t用地性质:" + res.getYdmc());
 | 
	
		
			
				|  |  |              listTemp.add("\t影响因子:");
 | 
	
		
			
				|  |  |              NpoiHelper.content(document, listTemp, pos++);
 | 
	
	
		
			
				|  | @@ -144,14 +154,17 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |              List<FactorUseDTO> fzxzXzyzDTOList = fzxzXzyzMapper.selectList(wrapper);
 | 
	
		
			
				|  |  |              List<Map<String, Object>> dataTablelist = new ArrayList<>();
 | 
	
		
			
				|  |  |              for (int i = 0; i < fzxzXzyzDTOList.size(); i++) {
 | 
	
		
			
				|  |  | +                FactorUseDTO fzxzXzyzDTO = fzxzXzyzDTOList.get(i);
 | 
	
		
			
				|  |  | +                FactorSpatialVo factorSpatialVo = JsonUtils.toObject(fzxzXzyzDTO.getConditionInfoStr(), FactorSpatialVo.class);
 | 
	
		
			
				|  |  | +                fzxzXzyzDTO.setConditionInfoObj(factorSpatialVo);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  // 添加选址因子
 | 
	
		
			
				|  |  |                  Map<String, Object> map = new HashMap<>();
 | 
	
		
			
				|  |  | -                FactorUseDTO fzxzXzyzDTO = fzxzXzyzDTOList.get(i);
 | 
	
		
			
				|  |  | +                Map<String, String> factorMap = getFactorContent(factorSpatialVo);
 | 
	
		
			
				|  |  |                  map.put("YXYZMC", fzxzXzyzDTO.getFactorName());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                Map<String, String> factorMap=   getFactorContent(fzxzXzyzDTO.getConditionInfoObj());
 | 
	
		
			
				|  |  |                  map.put("YZTJ_TEXT", factorMap.get("YZTJ_TEXT"));
 | 
	
		
			
				|  |  |                  map.put("YXZ", factorMap.get("YXZ"));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  dataTablelist.add(map);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              XWPFTable tableYz = NpoiHelper.setComTable(document, tabYzTitles, dataTablelist, "表1:选址影响因子", pos++);
 | 
	
	
		
			
				|  | @@ -172,7 +185,7 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |              // }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              // List<FzxzGeomInfoDTO> list = fzxzTbEntityDTOList.stream().sorted(Comparator.comparing(FzxzGeomInfoDTO::getSumMj).reversed()).collect(Collectors.toList());
 | 
	
		
			
				|  |  | -            String fwfx = "\t根据指定选址分析得出,所选范围共" + Math.round(sumcount) + "平方米,其中";
 | 
	
		
			
				|  |  | +            String fwfx = "\t根据指定选址分析得出,所选范围共" + NumberUtil.double2TwoDecimal(UnitsUtil.m2ToMu(geomRes.getArea())) + "亩,其中";
 | 
	
		
			
				|  |  |              List<Map<String, Object>> fztable = new ArrayList<>();
 | 
	
		
			
				|  |  |              // 生成地类分析统计表
 | 
	
		
			
				|  |  |              // TODO
 | 
	
	
		
			
				|  | @@ -244,6 +257,26 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |              optionIsBold.setBold(true);
 | 
	
		
			
				|  |  |              for (int i = 0; i < fzxzJgGisDTOList.size(); i++) {
 | 
	
		
			
				|  |  |                  SelectionResDTO item = fzxzJgGisDTOList.get(i);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                // 查询地块信息
 | 
	
		
			
				|  |  | +                String rawTableName = item.getSjyb();
 | 
	
		
			
				|  |  | +                Integer rawItemId = item.getDkid();
 | 
	
		
			
				|  |  | +                List<String> columns = new ArrayList<>();
 | 
	
		
			
				|  |  | +                columns.add("kzxxgyddm");
 | 
	
		
			
				|  |  | +                columns.add("kzxxgydmc");
 | 
	
		
			
				|  |  | +                Map<String, Object> rawTable = ghdkaMapper.getInfoByColumn(rawTableName, rawItemId.toString(), columns);
 | 
	
		
			
				|  |  | +                String dkName = "";
 | 
	
		
			
				|  |  | +                String dkCode = "";
 | 
	
		
			
				|  |  | +                if (rawTable != null) {
 | 
	
		
			
				|  |  | +                    if (rawTable.containsKey("kzxxgydmc")) {
 | 
	
		
			
				|  |  | +                        dkName = rawTable.get("kzxxgydmc").toString();// 地块类型
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if (rawTable.containsKey("kzxxgyddm")) {
 | 
	
		
			
				|  |  | +                        dkCode = rawTable.get("kzxxgyddm").toString();// 地块编码
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  document.setParagraph(NpoiHelper.newParagraph(document, index + "、方案" + NumberUtil.int2chineseNum(index), optionIsBold), pos++);
 | 
	
		
			
				|  |  |                  XWPFTable table = document.createTable(7, 4);
 | 
	
		
			
				|  |  |                  table.setWidth(9000);// 总宽度
 | 
	
	
		
			
				|  | @@ -260,12 +293,13 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |                  table.getRow(0).getCell(0).setParagraph(NpoiHelper.setCellText(table, "符合用地情况", optionIsBold));
 | 
	
		
			
				|  |  |                  // Table 表格第二行
 | 
	
		
			
				|  |  |                  table.getRow(1).getCell(0).setParagraph(NpoiHelper.setCellText(table, "地类编码", optionIsBold));
 | 
	
		
			
				|  |  | -                // table.getRow(1).getCell(1).setParagraph(NpoiHelper.setCellText(table, item.getDlbm(), null));
 | 
	
		
			
				|  |  | +                table.getRow(1).getCell(1).setParagraph(NpoiHelper.setCellText(table, dkCode, null));
 | 
	
		
			
				|  |  |                  table.getRow(1).getCell(2).setParagraph(NpoiHelper.setCellText(table, "地类名称", optionIsBold));
 | 
	
		
			
				|  |  | -                // table.getRow(1).getCell(3).setParagraph(NpoiHelper.setCellText(table, item.getDlmc(), null));
 | 
	
		
			
				|  |  | +                table.getRow(1).getCell(3).setParagraph(NpoiHelper.setCellText(table, dkName, null));
 | 
	
		
			
				|  |  |                  // Table 表格第三行
 | 
	
		
			
				|  |  |                  table.getRow(2).getCell(0).setParagraph(NpoiHelper.setCellText(table, "地块面积", optionIsBold));
 | 
	
		
			
				|  |  | -                // table.getRow(2).getCell(1).setParagraph(NpoiHelper.setCellText(table, Math.round(item.getTbmj()) + "平方米", null));
 | 
	
		
			
				|  |  | +                table.getRow(2).getCell(1).setParagraph(NpoiHelper.setCellText(table,
 | 
	
		
			
				|  |  | +                        NumberUtil.double2TwoDecimal(UnitsUtil.m2ToMu(item.getArea())) + "亩", null));
 | 
	
		
			
				|  |  |                  table.getRow(2).getCell(2).setParagraph(NpoiHelper.setCellText(table, "土地位置", optionIsBold));
 | 
	
		
			
				|  |  |                  // table.getRow(2).getCell(3).setParagraph(NpoiHelper.setCellText(table, item.getXzqmc(), null));
 | 
	
		
			
				|  |  |                  // Table 表格第四行
 | 
	
	
		
			
				|  | @@ -420,6 +454,7 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 获取因子内容
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  |       * @param factorSpatialVo
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
	
		
			
				|  | @@ -435,13 +470,13 @@ public class ReportServiceImpl implements IReportService {
 | 
	
		
			
				|  |  |          } else if (factorSpatialVo.getDefaultType().equals("not_contain")) {
 | 
	
		
			
				|  |  |              spName = "不位于";
 | 
	
		
			
				|  |  |          } else if (factorSpatialVo.getDefaultType().equals("gt")) {
 | 
	
		
			
				|  |  | -            spName = "大于";
 | 
	
		
			
				|  |  | +            spName = "距离大于";
 | 
	
		
			
				|  |  |          } else if (factorSpatialVo.getDefaultType().equals("lt")) {
 | 
	
		
			
				|  |  | -            spName = "小于";
 | 
	
		
			
				|  |  | +            spName = "距离小于";
 | 
	
		
			
				|  |  |          } else if (factorSpatialVo.getDefaultType().equals("get")) {
 | 
	
		
			
				|  |  | -            spName = "大于等于";
 | 
	
		
			
				|  |  | +            spName = "距离大于等于";
 | 
	
		
			
				|  |  |          } else if (factorSpatialVo.getDefaultType().equals("let")) {
 | 
	
		
			
				|  |  | -            spName = "小于等于";
 | 
	
		
			
				|  |  | +            spName = "距离小于等于";
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          map.put("YZTJ_TEXT", spName);
 | 
	
		
			
				|  |  |          map.put("YXZ", factorSpatialVo.getDefaultValue().toString());
 |