gushoubang преди 10 месеца
родител
ревизия
f2779628b6

+ 16 - 1
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/FzssServiceImpl.java

@@ -157,6 +157,18 @@ public class FzssServiceImpl implements IFzssService {
         fzxzMapper.update(null, wrapper);
     }
 
+    /**
+     * 更新选址分析报告
+     *
+     * @param bsm
+     * @param reportPath
+     */
+    private void updateFzxzReport(String bsm, String reportPath) {
+        UpdateWrapper<FzxzDTO> wrapper = new UpdateWrapper<>();
+        wrapper.eq("bsm", bsm).set("rwzt", Rwzt.getRun());
+        fzxzMapper.update(null, wrapper);
+    }
+
     /**
      * 规划选址逻辑在这里
      *
@@ -239,6 +251,9 @@ public class FzssServiceImpl implements IFzssService {
         // 5.生成报告,生成world文件
         FzxzReport fzxzReport = iReportService.createReport(fzxzDTO.getBsm(), null);
 
+        updateFzxzReport(fzxzDTO.getBsm(), fzxzReport.getReportfile());
+
+
         // 6.开始规划,更新任务状态
         updateFzxzStatus(fzxzDTO.getBsm(), Rwzt.getComplete());
 
@@ -309,7 +324,7 @@ public class FzssServiceImpl implements IFzssService {
 
         // 构建返回结果
         FzxzResultDTO result = DozerUtils.map(fzxzinfo, FzxzResultDTO.class);
-        // 查询分析结果地块信息
+        // 查询分析结果信息
         List<FzxzResDTO> fzxzResDTOS = fzxzResMapper.getListByRwbsm(result.getBsm());
         result.setDks(fzxzResDTOS);
         // 查询选址因子

+ 72 - 70
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/ReportServiceImpl.java

@@ -52,8 +52,8 @@ public class ReportServiceImpl implements IReportService {
 
     @Value("${Hgxfx.temp}")
     private String temp;
-    @Value("${Fzxz.fzxzShp}")
-    private String fzxzShp;
+    // @Value("${Fzxz.fzxzShp}")
+    // private String fzxzShp;
 
     // 根据选址任务生成报告
     public FzxzReport createReport(String bsm, List<String> xzbsmList) {
@@ -78,7 +78,7 @@ public class ReportServiceImpl implements IReportService {
             // 选址简报
             createSimpleReport(res, rootPath + File.separator + simplePath, xzbsmList);
             // zip打包
-            createZipReport(res, rootPath + File.separator + zipPath, rootPath + File.separator + reportPath, rootPath + File.separator + simplePath);
+            // createZipReport(res, rootPath + File.separator + zipPath, rootPath + File.separator + reportPath, rootPath + File.separator + simplePath);
             // 生成返回结果
             fzxzReport.setRootPath(StringUtils.getFileStaticPath(rootPath));
             fzxzReport.setReportfile(StringUtils.getFileStaticPath(rootPath + File.separator + reportPath));
@@ -107,7 +107,7 @@ public class ReportServiceImpl implements IReportService {
      * @param xzbsmList  没有导出全部地块
      */
     private void createReport(FzxzEntityDTO res, String reportPath, List<String> xzbsmList) {
-        List<String> imgList = ReportImg(res, xzbsmList);
+        // List<String> imgList = ReportImg(res, xzbsmList);
         // 创建document文档对象对象实例
         XWPFDocument document = null;
         OutputStream outputStream = null;// 把doc输出到输出流
@@ -299,17 +299,19 @@ public class ReportServiceImpl implements IReportService {
                 NpoiHelper.mergeHorizontal(table, 4, 2, 3);
                 String mapF = "";
                 String mapM = "";
-                if (imgList != null && imgList.size() > 0) {
-                    for (int j = 0; j < imgList.size(); j++) {
-                        String s = imgList.get(j);
-                        if (s.indexOf(item.getBsm() + "_F") >= 0) {
-                            mapF = s;// 全局
-                        }
-                        if (s.indexOf(item.getBsm() + "_M") >= 0) {
-                            mapM = s;// 局部
-                        }
-                    }
-                }
+
+                // TODO 生成位置图片
+                // if (imgList != null && imgList.size() > 0) {
+                //     for (int j = 0; j < imgList.size(); j++) {
+                //         String s = imgList.get(j);
+                //         if (s.indexOf(item.getBsm() + "_F") >= 0) {
+                //             mapF = s;// 全局
+                //         }
+                //         if (s.indexOf(item.getBsm() + "_M") >= 0) {
+                //             mapM = s;// 局部
+                //         }
+                //     }
+                // }
                 if (StringUtils.isNotEmpty(mapF)) {
                     FileInputStream fis = null;
                     try {
@@ -653,37 +655,37 @@ public class ReportServiceImpl implements IReportService {
     /**
      * zip打包
      */
-    private void createZipReport(FzxzEntityDTO res, String reportZip, String reportPath, String simplePath) {
-        File f = new File(fzxzShp);
-        System.out.println("选址分析报告打包zip:" + reportPath);
-        System.out.println("选址分析报告打包shp:" + fzxzShp);
-        if (StringUtils.isNotEmpty(fzxzShp)) {
-            String filePath = fzxzShp.substring(0, fzxzShp.lastIndexOf("."));
-            String docReportPath = reportPath.substring(0, reportPath.lastIndexOf("."));
-            String docSimplePath = reportPath.substring(0, reportPath.lastIndexOf("."));
-            // 生成的压缩文件
-            ZipFile zipFile = null;
-            try {
-                zipFile = new ZipFile(reportZip);
-                ZipParameters parameters = new ZipParameters();
-                // 压缩方式
-                parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
-                // 压缩级别
-                parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
-                zipFile.addFile(new File(simplePath), parameters);
-                zipFile.addFile(new File(reportPath), parameters);
-                zipFile.addFile(new File(filePath + ".shp"), parameters);
-                zipFile.addFile(new File(filePath + ".shx"), parameters);
-                zipFile.addFile(new File(filePath + ".dbf"), parameters);
-                zipFile.addFile(new File(filePath + ".cpg"), parameters);
-                zipFile.addFile(new File(filePath + ".prj"), parameters);
-            } catch (ZipException e) {
-                System.out.println(e.toString());
-                // 插入任务日志
-                iLogService.saveLog(res.getBsm(), "辅助选址", "生成选址报告zip打包错误:" + e.getMessage(), "error");
-            }
-        }
-    }
+    // private void createZipReport(FzxzEntityDTO res, String reportZip, String reportPath, String simplePath) {
+    //     // File f = new File(fzxzShp);
+    //     System.out.println("选址分析报告打包zip:" + reportPath);
+    //     // System.out.println("选址分析报告打包shp:" + fzxzShp);
+    //     if (StringUtils.isNotEmpty(fzxzShp)) {
+    //         String filePath = fzxzShp.substring(0, fzxzShp.lastIndexOf("."));
+    //         String docReportPath = reportPath.substring(0, reportPath.lastIndexOf("."));
+    //         String docSimplePath = reportPath.substring(0, reportPath.lastIndexOf("."));
+    //         // 生成的压缩文件
+    //         ZipFile zipFile = null;
+    //         try {
+    //             zipFile = new ZipFile(reportZip);
+    //             ZipParameters parameters = new ZipParameters();
+    //             // 压缩方式
+    //             parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
+    //             // 压缩级别
+    //             parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
+    //             zipFile.addFile(new File(simplePath), parameters);
+    //             zipFile.addFile(new File(reportPath), parameters);
+    //             zipFile.addFile(new File(filePath + ".shp"), parameters);
+    //             zipFile.addFile(new File(filePath + ".shx"), parameters);
+    //             zipFile.addFile(new File(filePath + ".dbf"), parameters);
+    //             zipFile.addFile(new File(filePath + ".cpg"), parameters);
+    //             zipFile.addFile(new File(filePath + ".prj"), parameters);
+    //         } catch (ZipException e) {
+    //             System.out.println(e.toString());
+    //             // 插入任务日志
+    //             iLogService.saveLog(res.getBsm(), "辅助选址", "生成选址报告zip打包错误:" + e.getMessage(), "error");
+    //         }
+    //     }
+    // }
 
     /**
      * TODO 待定
@@ -693,28 +695,28 @@ public class ReportServiceImpl implements IReportService {
      * @param xzbsmList 没有导出全部的地块
      * @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 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;
+//     }
 }