1
0
Quellcode durchsuchen

调整图斑展示

chenendian vor 2 Monaten
Ursprung
Commit
7a85a71fa4

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/ProjectAttachmentInfoMapper.java

@@ -91,7 +91,7 @@ public interface ProjectAttachmentInfoMapper {
     void deleteByProjectId(String projectId);
 
 
-    void deleteByNodeIds(List<String> ids);
+    void deleteByIds(List<String> ids);
 
 
 

+ 31 - 25
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/NodeAttachmentImpl.java

@@ -1,10 +1,7 @@
 package com.siwei.apply.service.impl;
 
 import com.siwei.apply.common.UnifyAttachmentEnum;
-import com.siwei.apply.domain.NodeAttachment;
-import com.siwei.apply.domain.Project;
-import com.siwei.apply.domain.ProjectAttachmentInfo;
-import com.siwei.apply.domain.ProjectWorkflow;
+import com.siwei.apply.domain.*;
 import com.siwei.apply.domain.res.TdgyRes;
 import com.siwei.apply.enums.*;
 import com.siwei.apply.mapper.NodeAttachmentMapper;
@@ -16,6 +13,7 @@ import com.siwei.apply.service.TdgyService;
 import com.siwei.apply.utils.FileExtractUtil;
 import com.siwei.apply.utils.ServiceFileUtil;
 import com.siwei.apply.utils.ServiceUtil;
+import com.siwei.common.core.domain.R;
 import com.siwei.common.core.exception.ServiceException;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.io.FilenameUtils;
@@ -29,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.io.IOException;
 import java.nio.file.*;
 import java.util.*;
+import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 
@@ -605,32 +604,39 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
      */
 
     public  Boolean  modifyAttachmentInfo(String projectId,String nodeId,String rootPath){
-        try {
-            List<Path> fileList = ServiceFileUtil.getDirectoryFileList(rootPath);
-
-
-            if(CollectionUtils.isEmpty(fileList)){
-                for(Path path : fileList){
-                    ProjectAttachmentInfo projectAttachmentInfo = new ProjectAttachmentInfo();
-                    projectAttachmentInfo.generateId();
-                    projectAttachmentInfo.setProjectId(projectId);
-                    projectAttachmentInfo.setNodeId(nodeId);
-                    projectAttachmentInfo.setFilePath(path.toString());
-                    String  baseName = FilenameUtils.getBaseName(path.getFileName().toString());
-                    projectAttachmentInfo.setFileName(baseName);
-                    projectAttachmentInfoMapper.insert(projectAttachmentInfo);
+        //这里使用异步方法
+        CompletableFuture.supplyAsync(()->{
+            try {
+                    //先进行删除
+                    List<ProjectAttachmentInfo> projectAttachmentInfoList =  projectAttachmentInfoMapper.selectByProjectIdNodeId(projectId,nodeId);
+                    if(CollectionUtils.isEmpty(projectAttachmentInfoList)){
+                        List<String> ids =  projectAttachmentInfoList.stream().map(BaseId::getId).collect(Collectors.toList());
+                        projectAttachmentInfoMapper.deleteByIds(ids);
+                    }
+
+                    //再进行更新
+                    List<Path> fileList = ServiceFileUtil.getDirectoryFileList(rootPath);
+                    if(CollectionUtils.isEmpty(fileList)){
+                        for(Path path : fileList){
+                            ProjectAttachmentInfo projectAttachmentInfo = new ProjectAttachmentInfo();
+                            projectAttachmentInfo.generateId();
+                            projectAttachmentInfo.setProjectId(projectId);
+                            projectAttachmentInfo.setNodeId(nodeId);
+                            projectAttachmentInfo.setFilePath(path.toString());
+                            String  baseName = FilenameUtils.getBaseName(path.getFileName().toString());
+                            projectAttachmentInfo.setFileName(baseName);
+                            projectAttachmentInfoMapper.insert(projectAttachmentInfo);
+                        }
+                    }
+                } catch (IOException e) {
+                    throw new ServiceException("全文检索附件材料--保存失败");
                 }
-            }
-        } catch (IOException e) {
-            throw new ServiceException("全文检索附件材料--保存失败");
-        }
+            return null;
+        });
         return true;
     }
 
 
 
 
-
-
-
 }

+ 1 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/ProjectAttachmentInfoMapper.xml

@@ -137,7 +137,7 @@
         DELETE FROM t_project_attachment_info WHERE project_id = #{projectId}
     </delete>
 
-    <delete id="deleteByNodeIds" parameterType="List">
+    <delete id="deleteByIds" parameterType="List">
         DELETE FROM t_project_attachment_info
         <where>
             <if test="ids != null and ids.size() > 0">

+ 2 - 2
siwei-modules/siwei-apply/src/main/resources/one_code_index_v1.json

@@ -17,7 +17,7 @@
                     "label": "用地预审与选址意见书-新",
                     "title": "用地预审与选址意见书-新",
                     "type": "wms",
-                    "url": "http://192.168.60.220:8090/geoserver/c_one_code/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=c_one_code%3Ac_one_code_ydysyxz&maxFeatures=50",
+                    "url": "http://192.168.60.220:8090/geoserver/c_one_code/wms?service=WMS&version=1.1.0&request=GetMap&layers=c_one_code%3Ac_one_code_ydysyxz&bbox=115.84467869332723%2C28.798911387985576%2C117.46128305288478%2C40.0626953125&width=330&height=768&srs=EPSG%3A4326&styles=&format=application/openlayers",
                     "source": "",
                     "legend": "",
                     "favorite": null,
@@ -87,7 +87,7 @@
                   "label": "建设工程规划许可证-新",
                   "title": "建设工程规划许可证-新",
                   "type": "wms",
-                  "url": "http://192.168.60.220:8090/geoserver/c_one_code/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=c_one_code%3Ac_one_code_jsgcghxk&maxFeatures=50",
+                  "url": "http://192.168.60.220:8090/geoserver/c_one_code/wms?service=WMS&version=1.1.0&request=GetMap&layers=c_one_code%3Ac_one_code_jsgcghxk&bbox=116.16224459134624%2C38.97904146634608%2C117.46128305288478%2C40.0626953125&width=768&height=640&srs=EPSG%3A4326&styles=&format=application/openlayers",
                   "source": null,
                   "legend": null,
                   "favorite": null,