|
@@ -20,6 +20,9 @@ import com.onemap.analyse.utils.NpoiHelper;
|
|
import com.onemap.analyse.utils.NumberUtil;
|
|
import com.onemap.analyse.utils.NumberUtil;
|
|
import com.onemap.analyse.utils.UnitsUtil;
|
|
import com.onemap.analyse.utils.UnitsUtil;
|
|
import com.onemap.common.core.utils.StringUtils;
|
|
import com.onemap.common.core.utils.StringUtils;
|
|
|
|
+import com.onemap.common.core.web.domain.RequestResult;
|
|
|
|
+import com.onemap.system.api.SpatialService;
|
|
|
|
+import com.onemap.system.api.domain.WktsVo;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.poi.util.Units;
|
|
import org.apache.poi.util.Units;
|
|
import org.apache.poi.xwpf.usermodel.*;
|
|
import org.apache.poi.xwpf.usermodel.*;
|
|
@@ -57,6 +60,9 @@ public class ReportServiceImpl implements IReportService {
|
|
@Resource
|
|
@Resource
|
|
GhdkaMapper ghdkaMapper;
|
|
GhdkaMapper ghdkaMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ SpatialService spatialService;
|
|
|
|
+
|
|
// 根据选址任务生成报告
|
|
// 根据选址任务生成报告
|
|
public FzxzReport createReport(String bsm, List<String> dkIds) {
|
|
public FzxzReport createReport(String bsm, List<String> dkIds) {
|
|
// 保存生成报告日志
|
|
// 保存生成报告日志
|
|
@@ -233,13 +239,7 @@ public class ReportServiceImpl implements IReportService {
|
|
tabYztbTitles.add(tableTitleTb);
|
|
tabYztbTitles.add(tableTitleTb);
|
|
XWPFTable tableYztb = NpoiHelper.setComTable(document, tabYztbTitles, fztable, "表2:地类分析统计表", pos++);
|
|
XWPFTable tableYztb = NpoiHelper.setComTable(document, tabYztbTitles, fztable, "表2:地类分析统计表", pos++);
|
|
// 查询结果
|
|
// 查询结果
|
|
- QueryWrapper<SelectionResDTO> giswrapper = new QueryWrapper<>();
|
|
|
|
- giswrapper.eq("rwbsm", res.getBsm());
|
|
|
|
- // 筛选方案,根据传参或者预选方案
|
|
|
|
- if (dkIds != null && dkIds.size() > 0) {
|
|
|
|
- giswrapper.in("bsm", dkIds);
|
|
|
|
- }
|
|
|
|
- List<SelectionResDTO> fzxzJgGisDTOList = fzxzResMapper.selectList(giswrapper);
|
|
|
|
|
|
+ List<SelectionResDTO> fzxzJgGisDTOList = fzxzResMapper.getListByRwbsm(res.getBsm(), dkIds);
|
|
NpoiHelper.catalog(document, "三、选址分析", pos++);
|
|
NpoiHelper.catalog(document, "三、选址分析", pos++);
|
|
String ydmc = res.getYdmc();
|
|
String ydmc = res.getYdmc();
|
|
if (!StringUtils.isEmpty(ydmc)) {
|
|
if (!StringUtils.isEmpty(ydmc)) {
|
|
@@ -294,12 +294,16 @@ public class ReportServiceImpl implements IReportService {
|
|
cell.removeParagraph(0);
|
|
cell.removeParagraph(0);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ String geomWkt = item.getGeom();
|
|
|
|
+ String path = reportImg(geomWkt);
|
|
|
|
+
|
|
// 在合并后的单元格中创建一个新的段落
|
|
// 在合并后的单元格中创建一个新的段落
|
|
XWPFParagraph paraImag = row.getCell(0).addParagraph();
|
|
XWPFParagraph paraImag = row.getCell(0).addParagraph();
|
|
paraImag.setAlignment(ParagraphAlignment.CENTER); // 居中对齐
|
|
paraImag.setAlignment(ParagraphAlignment.CENTER); // 居中对齐
|
|
|
|
|
|
XWPFRun run = paraImag.createRun();
|
|
XWPFRun run = paraImag.createRun();
|
|
- File imageFile = new File("states.png");
|
|
|
|
|
|
+ // File imageFile = new File("states.png");
|
|
|
|
+ File imageFile = new File(path);
|
|
BufferedImage bufferedImage = ImageIO.read(imageFile);
|
|
BufferedImage bufferedImage = ImageIO.read(imageFile);
|
|
|
|
|
|
int originalWidth = bufferedImage.getWidth();
|
|
int originalWidth = bufferedImage.getWidth();
|
|
@@ -458,35 +462,25 @@ public class ReportServiceImpl implements IReportService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * TODO 待定
|
|
|
|
* 导出报告图片
|
|
* 导出报告图片
|
|
*
|
|
*
|
|
- * @param res
|
|
|
|
- * @param xzbsmList 没有导出全部的地块
|
|
|
|
|
|
+ * @param wkt
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
-// private List<String> ReportImg(FzxzEntityDTO res, List<String> xzbsmList) {
|
|
|
|
-// // 查询分析结果图斑信息
|
|
|
|
-// QueryWrapper<FzxzResDTO> giswrapper = new QueryWrapper<>();
|
|
|
|
-// giswrapper.eq("rwbsm", res.getBsm());
|
|
|
|
-// // 筛选方案,根据传参或者预选方案
|
|
|
|
-// // giswrapper.ne("yxfa", "0");
|
|
|
|
-// if (xzbsmList != null) {
|
|
|
|
-// giswrapper.in("bsm", xzbsmList);
|
|
|
|
-// }
|
|
|
|
-// List<FzxzResDTO> fzxzJgGisDTOList = fzxzResMapper.selectList(giswrapper);
|
|
|
|
-// // SDE转SHP
|
|
|
|
-// String inShp = fzxzShp;
|
|
|
|
-// List objidlist = new ArrayList<>();
|
|
|
|
-// for (FzxzResDTO cur : fzxzJgGisDTOList) {
|
|
|
|
-// // objidlist.add(cur.getObjectid());
|
|
|
|
-// }
|
|
|
|
-// String objids = Joiner.on(",").join(objidlist);
|
|
|
|
-// // sde2Shp("KJGH.T_FZSS_FZXZ_JG_GIS", inShp, "\"OBJECTID\" IN (" + objids + ")");
|
|
|
|
-// // 执行python
|
|
|
|
-// Map<String, String> params = new HashMap<>();
|
|
|
|
-// // List<String> result = PythonExecute.RunFzxzMap(mapFunctionId, params);
|
|
|
|
-// List<String> result = new ArrayList<>();
|
|
|
|
-// return result;
|
|
|
|
-// }
|
|
|
|
|
|
+ private String reportImg(String wkt) {
|
|
|
|
+ String path = "";
|
|
|
|
+
|
|
|
|
+ WktsVo wktsVo = new WktsVo();
|
|
|
|
+
|
|
|
|
+ WktsVo.WktInfo wktInfo = new WktsVo.WktInfo();
|
|
|
|
+ wktInfo.setWkt(wkt);
|
|
|
|
+ wktsVo.getWktInfos().add(wktInfo);
|
|
|
|
+
|
|
|
|
+ RequestResult requestResult = spatialService.getImage(wktsVo);
|
|
|
|
+ if (requestResult.isSuccess()) {
|
|
|
|
+ Map<String, String> map = (Map<String, String>) requestResult.get("data");
|
|
|
|
+ path=map.get("path");
|
|
|
|
+ }
|
|
|
|
+ return path;
|
|
|
|
+ }
|
|
}
|
|
}
|