LAPTOP-BJJ3IV5R\SIWEI 10 сар өмнө
parent
commit
02eb427fa8

+ 15 - 108
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/GdbhReportServiceImpl.java

@@ -124,6 +124,7 @@ public class GdbhReportServiceImpl implements GdbhReportService {
                 int useHeight = useWidth * originalHeight / originalWidth;
                 XWPFRun run = document.createParagraph().createRun();
                 run.addPicture(is, XWPFDocument.PICTURE_TYPE_PNG, null, Units.toEMU(useWidth), Units.toEMU(useHeight));
+                pos++;
             }
 
             //结果
@@ -202,11 +203,16 @@ public class GdbhReportServiceImpl implements GdbhReportService {
         if (StringUtils.isNull(jgMap)) {
             return pos;
         }
+
+//        XWPFParagraph pageBreakParagraph2 = document.createParagraph();
+//        XWPFRun pageBreakRun2 = pageBreakParagraph2.createRun();
+//        pageBreakRun2.addBreak(BreakType.PAGE);
+
         Map sandiao = (Map) jgMap.get("sandiao");
         String v_mx_bsmmc_0 = (String) sandiao.get("mx_bsmmc");
-        List<Map<String, Object>> v_mx_data_0 = (List<Map<String, Object>>) sandiao.get("mx_data");
-        NpoiHelper.content(document, v_mx_data_0 + "; 分析结果如下:", pos++);
+        NpoiHelper.content(document, v_mx_bsmmc_0 + "; 分析结果如下:", pos++);
 
+        List<Map<String, Object>> v_mx_data_0 = (List<Map<String, Object>>) sandiao.get("mx_data");
         List sanDiaoTitles = new ArrayList<NpoiHelper.TableTitle>();
         NpoiHelper.TableTitle tableTitle1 = new NpoiHelper.TableTitle();
         tableTitle1.setKey("groupvalue");
@@ -256,17 +262,15 @@ public class GdbhReportServiceImpl implements GdbhReportService {
 
         List<Map> yzjg = (List<Map>) jgMap.get("yzjg");
         for (Map yz_data : yzjg) {
-
-            XWPFParagraph pageBreakParagraph1 = document.createParagraph();
-            XWPFRun pageBreakRun1 = pageBreakParagraph1.createRun();
-            pageBreakRun1.addBreak(BreakType.PAGE);
+//            XWPFParagraph pageBreakParagraph1 = document.createParagraph();
+//            XWPFRun pageBreakRun1 = pageBreakParagraph1.createRun();
+//            pageBreakRun1.addBreak(BreakType.PAGE);
             pos++;
 
-            List<Map> mx_data_list = (List<Map>) yz_data.get("mx_data");
             String mx_bsmmc = (String) yz_data.get("mx_bsmmc");
             String mx_bsm = (String) yz_data.get("mx_bsm");
-            NpoiHelper.content(document, mx_bsmmc + "; 分析结果如下:", pos++);
-
+            NpoiHelper.catalog(document, mx_bsmmc + "; 分析结果如下:", pos++);
+            List<Map> mx_data_list = (List<Map>) yz_data.get("mx_data");
             for (Map d0_yz_data : mx_data_list) {
                 Integer d0_sumcount = (Integer) d0_yz_data.get("sumcount");
                 String d0_bsmmc = (String) d0_yz_data.get("bsmmc");
@@ -287,7 +291,7 @@ public class GdbhReportServiceImpl implements GdbhReportService {
                 tabYzTitles.add(tableTitle);
                 List<Map<String, Object>> dataTablelist = new ArrayList<>();
                 dataTablelist.add(d0_yz_data);
-                NpoiHelper.setComTable(document, tabYzTitles, dataTablelist, "", pos);
+                NpoiHelper.setComTable(document, tabYzTitles, dataTablelist, "", pos++);
 
                 RequestResult res_0 = applyService.QueryGdbhJgYz(rwbsm, mx_bsm, d0_bsm);
                 if (res_0.isError()) {
@@ -327,111 +331,14 @@ public class GdbhReportServiceImpl implements GdbhReportService {
                     int useHeight = useWidth * originalHeight / originalWidth;
                     XWPFRun run = document.createParagraph().createRun();
                     run.addPicture(is, XWPFDocument.PICTURE_TYPE_PNG, null, Units.toEMU(useWidth), Units.toEMU(useHeight));
+                    pos++;
                 }
-
-
             }
-
-
         }
 
-
         return pos;
     }
 
-//    private int jiefuo2(XWPFDocument document, int pos, Map jgMap) throws IOException, InvalidFormatException {
-//        if (StringUtils.isNull(jgMap)) {
-//            return pos;
-//        }
-//        List<Map> yzjg = (List<Map>) jgMap.get("yzjg");
-//
-//
-//        int i = 0;
-//        NpoiHelper.Option optionIsBold = new NpoiHelper.Option();
-//        optionIsBold.setBold(true);//
-//        for (Map jgMap : jgList) {
-//            List<Map<String, Object>> dataList = new ArrayList<>();
-//            Object dataListObj = jgMap.get("dataList");
-//            if (dataListObj != null) {
-//                dataList = (List<Map<String, Object>>) dataListObj;
-//            }
-//            Integer scxstyle = (Integer) jgMap.get("scxstyle");
-//            String scxname = (String) jgMap.get("scxname");
-//            String d_tiles = tiles + (i + 1);
-//            document.setParagraph(NpoiHelper.newParagraph(document, d_tiles + "、分析因子  " + scxname, optionIsBold), pos++);
-//            if (scxstyle != null && 0 == scxstyle && dataList.size() > 0) {
-//                List tabYzTitles = new ArrayList<NpoiHelper.TableTitle>();
-//                NpoiHelper.TableTitle tableTitle = new NpoiHelper.TableTitle();
-//                tableTitle.setKey("yslx_name");
-//                tableTitle.setName("名称");
-//                tableTitle.setWidth(3760);
-//                tabYzTitles.add(tableTitle);
-//                tableTitle = new NpoiHelper.TableTitle();
-//                tableTitle.setKey("mj");
-//                tableTitle.setName("面积(亩)");
-//                tableTitle.setWidth(5640);
-//                tabYzTitles.add(tableTitle);
-//                // 查询选址因子,并且转换为List<Map> 因子条件(包含:C、不包含:N、分析:A)
-//                List<Map<String, Object>> dataTablelist = dataList;
-//                NpoiHelper.setComTable(document, tabYzTitles, dataTablelist, scxname + "结果", pos++);
-//            } else if (scxstyle != null && 1 == scxstyle && dataList.size() > 0) {
-//                List tabYzTitles = new ArrayList<NpoiHelper.TableTitle>();
-//                NpoiHelper.TableTitle tableTitle = new NpoiHelper.TableTitle();
-//                tableTitle.setKey("yslx_name");
-//                tableTitle.setName("名称");
-//                tableTitle.setWidth(3760);
-//                tabYzTitles.add(tableTitle);
-//                tableTitle = new NpoiHelper.TableTitle();
-//                tableTitle.setKey("mj");
-//                tableTitle.setName("距离(米)");
-//                tableTitle.setWidth(5640);
-//                tabYzTitles.add(tableTitle);
-//                // 查询选址因子,并且转换为List<Map> 因子条件(包含:C、不包含:N、分析:A)
-//                List<Map<String, Object>> dataTablelist = dataList;
-//                NpoiHelper.setComTable(document, tabYzTitles, dataTablelist, scxname + "结果", pos++);
-//            }
-//
-//            if (dataList.size() > 0) {
-//                pos++;
-//                WktsVo wktsVo = new WktsVo();
-//                List<WktsVo.WktInfo> wktInfos = new ArrayList<>();
-//                WktsVo.WktInfo wktInfoData = new WktsVo.WktInfo();
-//                wktInfoData.setWkt(ewkt);
-//                wktInfos.add(wktInfoData);
-//
-//                for (Map<String, Object> dataMap : dataList) {
-//                    WktsVo.WktInfo wktInfo = new WktsVo.WktInfo();
-//                    String geom = (String) dataMap.get("geom");
-//                    wktInfo.setWkt(geom);
-//                    String colorString = generateRandomColor();
-//                    wktInfo.setFillColor(colorString);
-//                    wktInfo.setBorderColor(colorString);
-//                    wktInfos.add(wktInfo);
-//                }
-//
-//                wktsVo.setWktInfos(wktInfos);
-//                RequestResult requestResult = spatialService.getImage(wktsVo);
-//                if (requestResult.isSuccess()) {
-//                    Map<String, String> map = (Map<String, String>) requestResult.get("data");
-//                    String path = map.get("path");
-//                    InputStream is = new FileInputStream(path);
-//                    BufferedImage bufferedImage = ImageIO.read(new File(path));
-//                    int originalWidth = bufferedImage.getWidth();
-//                    int originalHeight = bufferedImage.getHeight();
-//                    int useWidth = 400; // Set the desired width
-//                    int useHeight = useWidth * originalHeight / originalWidth;
-//                    XWPFRun run = document.createParagraph().createRun();
-//                    run.addPicture(is, XWPFDocument.PICTURE_TYPE_PNG, null, Units.toEMU(useWidth), Units.toEMU(useHeight));
-//                }
-//            }
-//            List<Map> children = (List<Map>) jgMap.get("children");
-//            pos = jiefuo(document, pos, children, d_tiles + ".", ewkt);
-//            i++;
-//
-//        }
-//        return pos;
-//    }
-
     private String generateRandomColor() {
         Random random = new Random();
         int red = random.nextInt(256);