Преглед на файлове

成果包异地存储支持、适配

wanger преди 4 месеца
родител
ревизия
567645ec97

+ 12 - 0
onemap-common/onemap-common-core/src/main/java/com/onemap/common/core/utils/StringUtils.java

@@ -614,6 +614,18 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
         return filename.replace("D:/onemapfile/", "/file/statics/");
     }
 
+    /**
+     * 获取文件转发地址
+     *
+     * @param filename
+     * @return
+     */
+    public static String getGhFileStaticPath(String filename, String temp) {
+//        filename = filename.replaceAll("\\\\", "/");
+        filename = filename.replace(temp, "/ghfile/statics/");
+        return filename.replaceAll("\\\\", "/");
+    }
+
     /**
      * 获取文件转发地址
      *

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/cggl/EscalationMapper.java

@@ -48,7 +48,7 @@ public interface EscalationMapper extends BaseMapper<EscalationDTO> {
 
     String selectWaitCheck(String s);
 
-    void updateWaitCheck(String id);
+    void updateWaitCheck(@Param("id") String id, @Param("status") String status);
 
     List<EscalationTaskDTO> getSelectCgSclistbyzt(@Param("type") String type, @Param("xzqdm") String xzqdm, @Param("cgmc") String cgmc, @Param("cglx") String cglx);
 

+ 7 - 5
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/cggl/CgglServiceImpl.java

@@ -110,6 +110,7 @@ public class CgglServiceImpl implements CgglService {
             // 复制文件流
             FileUtils.copyInputStreamToFile(file.getInputStream(), copyFile);
         } catch (Exception e) {
+            System.out.println("成果包拷贝失败!");
             e.printStackTrace();
         }
         QueryWrapper<EscalationFileDTO> wrapper = new QueryWrapper<>();
@@ -128,6 +129,7 @@ public class CgglServiceImpl implements CgglService {
             curdto.setUnzippath(unzippath);
             escalationFileMapper.update(curdto, wrapper);
         } catch (Exception r) {
+            System.out.println("上传压缩包或者解压失败!");
             r.printStackTrace();
             curdto.setStatus("2");
             curdto.setRemark("上传压缩包或者解压失败");
@@ -533,7 +535,7 @@ public class CgglServiceImpl implements CgglService {
         //TODO 整理成果包树状结构
         Map<String, String> map = new HashMap<>();
         List<EscalationFolderDTO> datas = new ArrayList<>();
-        findFolder(new File(fileDir), map, datas);
+        findFolder(new File(fileDir), map, datas, temp);
         //递归生成树结构
         datas = buildFolderTree(datas);
         return RequestResult.success("获取成功", datas);
@@ -735,14 +737,14 @@ public class CgglServiceImpl implements CgglService {
     /**
      * 递归文件
      */
-    private static void findFolder(File file, Map<String, String> map, List<EscalationFolderDTO> allFile) {
+    private static void findFolder(File file, Map<String, String> map, List<EscalationFolderDTO> allFile, String temp) {
         map.put(file.getAbsolutePath(), StringUtils.getUUID());
         if (file.isDirectory()) {
             EscalationFolderDTO data = new EscalationFolderDTO();
             data.setId(map.get(file.getAbsolutePath()));
             data.setPid(map.get(file.getParent()));
             data.setName(file.getName());
-            data.setFilepath(StringUtils.getFileStaticPath(file.getAbsolutePath()));
+            data.setFilepath(StringUtils.getGhFileStaticPath(file.getAbsolutePath(), temp));
             data.setIsparent(true);
             if (file.getName().toLowerCase().indexOf(".gdb") > 0) {
                 data.setFilepath(file.getAbsolutePath());
@@ -756,7 +758,7 @@ public class CgglServiceImpl implements CgglService {
                 allFile.add(data);
                 File[] files = file.listFiles();
                 for (File f : files) {
-                    findFolder(f, map, allFile);
+                    findFolder(f, map, allFile, temp);
                 }
             }
         } else {
@@ -775,7 +777,7 @@ public class CgglServiceImpl implements CgglService {
                 data.setId(map.get(file.getAbsolutePath()));
                 data.setPid(map.get(file.getParent()));
                 data.setName(file.getName());
-                data.setFilepath(StringUtils.getFileStaticPath(file.getAbsolutePath()));
+                data.setFilepath(StringUtils.getGhFileStaticPath(file.getAbsolutePath(), temp));
                 data.setIsparent(false);
                 allFile.add(data);
             }

+ 14 - 6
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/task/CgjcSchedule.java

@@ -3,6 +3,7 @@ package com.onemap.apply.task;
 import com.onemap.apply.mapper.cggl.EscalationMapper;
 import com.onemap.apply.utils.HttpClientUtil;
 import com.onemap.common.core.utils.StringUtils;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -25,6 +26,8 @@ public class CgjcSchedule {
     private EscalationMapper escalationMapper;
     @Value("${Cggl.cgjc}")
     private String cgjcUrl;
+    @Value("${Cggl.machine}")
+    private Boolean machine;
 
     /**
      * Scheduled 定时器参数
@@ -42,12 +45,17 @@ public class CgjcSchedule {
         try {
             String id = escalationMapper.selectWaitCheck("");
             if (!StringUtils.isEmpty(id)) {
-                escalationMapper.updateWaitCheck(id);
-                String getUrl = cgjcUrl + "" + id;
-                System.out.println("开始进行成果完整性检查,调用地址" + getUrl);
-                String msg = HttpClientUtil.doGet(getUrl);
-                System.out.println("成果完整性检查结果" + msg);
-                System.out.println("成果完整性检查模块:" + id + "审查任务调用成果!!!!!!!! " + new Date().toString());
+                if (machine) {
+                    escalationMapper.updateWaitCheck(id, "0");
+                    String getUrl = cgjcUrl + "" + id;
+                    System.out.println("开始进行成果完整性检查,调用地址" + getUrl);
+                    String msg = HttpClientUtil.doGet(getUrl);
+                    System.out.println("成果完整性检查结果" + msg);
+                    System.out.println("成果完整性检查模块:" + id + "审查任务调用成果!!!!!!!! " + new Date().toString());
+                } else {
+                    escalationMapper.updateWaitCheck(id, "1");
+                    System.out.println("成果完整性检查结果:不执行机器审查");
+                }
             }
         } catch (Exception e) {
             e.printStackTrace();

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/task/CgscSchedule.java

@@ -48,7 +48,7 @@ public class CgscSchedule {
         try {
             String id = escalationMapper.selectWaitCheck("");
             if (!StringUtils.isEmpty(id)) {
-                escalationMapper.updateWaitCheck(id);
+                escalationMapper.updateWaitCheck(id, "0");
                 String getUrl = cgscUrl + "" + id;
                 System.out.println("开始进行成果审查,调用地址" + getUrl);
                 String msg = HttpClientUtil.doGet(getUrl);

+ 4 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/utils/UnPackageUtils.java

@@ -37,6 +37,8 @@ public class UnPackageUtils {
 //                zip.setPassword(password);
 //            }
         } catch (Exception e) {
+            System.out.println("成果包解压失败!");
+            e.printStackTrace();
         }
     }
 
@@ -76,6 +78,8 @@ public class UnPackageUtils {
                 }
             }
         } catch (Exception e) {
+            System.out.println("成果包解压失败!");
+            e.printStackTrace();
         }
     }
 }

+ 2 - 2
onemap-modules/onemap-apply/src/main/resources/mapper/oracle/cggl/EscalationMapper.xml

@@ -389,8 +389,8 @@
     </select>
 
     <update id="updateWaitCheck" parameterType="java.lang.String">
-        update t_cggl_escalation_file t set t.status = '0'
-        where t.id = (select fileid from t_cggl_escalation where id = #{param})
+        update t_cggl_escalation_file t set t.status = #{status}
+        where t.id = (select fileid from t_cggl_escalation where id = #{id})
     </update>
 
     <!-- <if test="(uploadstatus == null or uploadstatus == '') and userlevel != '1' and cglevel != '1'">