Browse Source

Merge remote-tracking branch 'origin/zdsz3.0' into zdsz3.0

wangzhe 1 year ago
parent
commit
411f77131a

+ 10 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zdsz/ZEngineeringDangerousController.java

@@ -6,11 +6,13 @@ import java.util.Arrays;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
+import com.ruoyi.common.core.domain.BaseEntity;
 import com.ruoyi.zdsz.domain.vo.ZEngineeringIndustryVo;
 import lombok.RequiredArgsConstructor;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.*;
 import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.validation.annotation.Validated;
 import com.ruoyi.common.annotation.RepeatSubmit;
@@ -40,7 +42,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
 @RequestMapping("/zdsz/engineeringDangerous")
 public class ZEngineeringDangerousController extends BaseController {
 
-    private final IZEngineeringDangerousService iZEngineeringDangerousService;
+    @Autowired
+    private IZEngineeringDangerousService iZEngineeringDangerousService;
+
+    @PostMapping("review")
+    public R<?> review(@RequestBody ZEngineeringDangerousBo zEngineeringDangerousBo) {
+        boolean review = iZEngineeringDangerousService.review(zEngineeringDangerousBo);
+        return toAjax(review);
+    }
 
     /**
      * 查询危险工程列表

+ 0 - 33
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zdsz/ZEngineeringIndustryController.java

@@ -133,39 +133,6 @@ public class ZEngineeringIndustryController extends BaseController {
         return R.ok(iZEngineeringIndustryService.query(id, type));
     }
 
-    @Value("${filePath}")
-    private String filePath;
-
-    @GetMapping(value = "/downloadZip/{type}/{name}")
-    public void downloadZip(@PathVariable String type,@PathVariable String name,HttpServletResponse response) {
-//        File file = new File(zipPath);//创建指定目录和文件名称的文件对象
-        try {
-            // 创建最外层文件夹
-            byte[] fileNameBytes = filePath.getBytes("UTF-8");
-            // 使用UTF-8编码创建文件
-            File file = new File(new String(fileNameBytes, "UTF-8"));
-            if (!file.exists()) {
-                file.mkdirs();
-            }
-            byte[] typeFileNameBytes = (file.getPath() + "/" + type).getBytes("UTF-8");
-            // 使用UTF-8编码创建文件
-            File typeFile = new File(new String(typeFileNameBytes, "UTF-8"));
-            if (!typeFile.exists()) {
-                typeFile.mkdirs();
-            }
-            byte[] enginNameFileNameBytes = (typeFile.getPath() + "/" + name).getBytes("UTF-8");
-            // 使用UTF-8编码创建文件
-            File enginNameFile = new File(new String(enginNameFileNameBytes, "UTF-8"));
-            if (!enginNameFile.exists()) {
-                enginNameFile.mkdirs();
-            }
-            System.out.println(enginNameFile.getPath());
-            FolderToZipUtil.zip(enginNameFile.getPath(),name,response);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
     /**
      * 工业工程|市政工程根据工程类型查询工程名称
      */

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zdsz/ZEngineeringPipeJackingController.java

@@ -142,7 +142,7 @@ public class ZEngineeringPipeJackingController extends BaseController {
                 enginNameFile.mkdirs();
             }
             System.out.println(enginNameFile.getPath());
-            FolderToZipUtil.zip(enginNameFile.getPath(),name,response);
+            FolderToZipUtil.toZip(filePath+"/"+type+"/"+name,response.getOutputStream(),true);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 166 - 57
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FolderToZipUtil.java

@@ -1,13 +1,17 @@
 package com.ruoyi.common.utils.file;
 
+import org.apache.commons.lang3.StringUtils;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
+import java.io.*;
+import java.net.URLEncoder;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
+import static org.springframework.util.FileCopyUtils.BUFFER_SIZE;
+
 /**
  * @program: microfront-server
  * @description: 文件夹压缩为zip文件
@@ -16,72 +20,177 @@ import java.util.zip.ZipOutputStream;
  */
 public class FolderToZipUtil {
 
-    public static void zip(String sourceFileName, String objName,HttpServletResponse response){
-        ZipOutputStream out = null;
-        BufferedOutputStream bos = null;
+    /**
+     * 压缩文件夹https://www.cnblogs.com/zeng1994/p/7862288.html
+     *
+     * @param srcDir           要压缩的文件夹路径
+     * @param out
+     * @param KeepDirStructure true
+     * @throws RuntimeException
+     */
+    public static void toZip(String srcDir, OutputStream out, boolean KeepDirStructure) throws RuntimeException {
+
+        long start = System.currentTimeMillis();
+
+        ZipOutputStream zos = null;
+        File sourceFile = null;
         try {
-            //将zip以流的形式输出到前台
-            response.setHeader("content-type", "application/octet-stream");
-            response.setCharacterEncoding("utf-8");
-            // 设置浏览器响应头对应的Content-disposition
-            //参数中 testZip 为压缩包文件名,尾部的.zip 为文件后缀
-            response.setHeader("Content-disposition",
-                    "attachment;filename=" + new String(objName.getBytes("gbk"), "iso8859-1")+".zip");
-            //创建zip输出流
-            out = new ZipOutputStream(response.getOutputStream());
-            //创建缓冲输出流
-            bos = new BufferedOutputStream(out);
-            File sourceFile = new File(sourceFileName);
-            //调用压缩函数
-            compress(out, bos, sourceFile, sourceFile.getName());
-            out.flush();
 
+            zos = new ZipOutputStream(out);
+            sourceFile = new File(srcDir);
+            compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure);
+            long end = System.currentTimeMillis();
+            System.out.println("压缩完成,耗时:{}ms" + (end - start));
         } catch (Exception e) {
-            e.printStackTrace();
-        }finally {
-            IOCloseUtil.close(bos, out);
+            throw new RuntimeException("zip error from ZipUtils", e);
+        } finally {
+            if (zos != null) {
+                try {
+                    zos.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            // 删除压缩之前的文件夹
+            if (sourceFile != null) {
+//                log.info("正在删除原文件");
+//                deleteFolder(sourceFile);
+            }
         }
     }
 
+
     /**
-     * 文件压缩
-     * @param out
-     * @param bos
-     * @param sourceFile
-     * @param base
+     * 设置导出zip的响应格式
+     *
+     * @param request
+     * @param response
+     * @param fileZip  zip的名字
+     * @param filePath zip的路径
+     * @throws UnsupportedEncodingException
      */
-    public static void compress(ZipOutputStream out, BufferedOutputStream bos, File sourceFile, String base){
-        FileInputStream fos = null;
-        BufferedInputStream bis = null;
+    public static void downLoadFile(HttpServletRequest request, HttpServletResponse response, String fileZip, String filePath) throws UnsupportedEncodingException {
+
+        //进行浏览器下载
+        final String userAgent = request.getHeader("USER-AGENT");
+        //判断浏览器代理并分别设置响应给浏览器的编码格式
+        String finalFileName = null;
+        if (StringUtils.contains(userAgent, "MSIE") || StringUtils.contains(userAgent, "Trident")) {
+            // IE浏览器
+            finalFileName = URLEncoder.encode(fileZip, "UTF8");
+            System.out.println("IE浏览器");
+        } else if (StringUtils.contains(userAgent, "Mozilla")) {
+            // google,火狐浏览器
+            finalFileName = new String(fileZip.getBytes(), "ISO8859-1");
+        } else {
+            // 其他浏览器
+            finalFileName = URLEncoder.encode(fileZip, "UTF8");
+        }
+        // 告知浏览器下载文件,而不是直接打开,浏览器默认为打开
+        response.setContentType("application/x-download");
+        // 下载文件的名称
+        response.setHeader("Content-Disposition", "attachment;filename=\"" + finalFileName + "\"");
+
+        ServletOutputStream servletOutputStream = null;
         try {
-            //如果路径为目录(文件夹)
-            if (sourceFile.isDirectory()) {
-                //取出文件夹中的文件(或子文件夹)
-                File[] flist = sourceFile.listFiles();
-                if (flist.length == 0) {//如果文件夹为空,则只需在目的地zip文件中写入一个目录进入点
-                    out.putNextEntry(new ZipEntry(base + "/"));
-                } else {//如果文件夹不为空,则递归调用compress,文件夹中的每一个文件(或文件夹)进行压缩
-                    for (int i = 0; i < flist.length; i++) {
-                        compress(out, bos, flist[i], base + "/" + flist[i].getName());
-                    }
+            servletOutputStream = response.getOutputStream();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        DataOutputStream temps = new DataOutputStream(
+            servletOutputStream);
+        // 浏览器下载文件的路径
+        DataInputStream in = null;
+        try {
+            in = new DataInputStream(
+                new FileInputStream(filePath));
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        }
+        byte[] b = new byte[2048];
+        // 之后用来删除临时压缩文件
+        File reportZip = new File(filePath);
+        try {
+            while ((in.read(b)) != -1) {
+                temps.write(b);
+            }
+            temps.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (temps != null) {
+                try {
+                    temps.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
                 }
-            } else {//如果不是目录(文件夹),即为文件,则先写入目录进入点,之后将文件写入zip文件中
-                out.putNextEntry(new ZipEntry(base));
-                fos = new FileInputStream(sourceFile);
-                bis = new BufferedInputStream(fos);
+            }
+            if (reportZip != null) {
+                // 删除服务器本地产生的临时压缩文件!
+                reportZip.delete();
+            }
+            try {
+                servletOutputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 
-                int tag;
-                //将源文件写入到zip文件中
-                while ((tag = bis.read()) != -1) {
-                    out.write(tag);
+    /**
+     * 递归压缩方法
+     *
+     * @param sourceFile       源文件
+     * @param zos              zip输出流
+     * @param name             压缩后的名称
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构;
+     *                         false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws Exception
+     */
+    private static void compress(File sourceFile, ZipOutputStream zos, String name,
+                                 boolean KeepDirStructure) throws Exception {
+        byte[] buf = new byte[BUFFER_SIZE];
+        if (sourceFile.isFile()) {
+            // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字
+            zos.putNextEntry(new ZipEntry(name));
+            // copy文件到zip输出流中
+            int len;
+            FileInputStream in = new FileInputStream(sourceFile);
+            while ((len = in.read(buf)) != -1) {
+                zos.write(buf, 0, len);
+            }
+            // Complete the entry
+            zos.closeEntry();
+            in.close();
+        } else {
+            File[] listFiles = sourceFile.listFiles();
+            if (listFiles == null || listFiles.length == 0) {
+                // 需要保留原来的文件结构时,需要对空文件夹进行处理
+                if (KeepDirStructure) {
+                    // 空文件夹的处理
+                    zos.putNextEntry(new ZipEntry(name + "/"));
+                    // 没有文件,不需要文件的copy
+                    zos.closeEntry();
+                }
+            } else {
+                for (File file : listFiles) {
+                    // 判断是否需要保留原来的文件结构
+                    if (KeepDirStructure) {
+                        // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠,
+                        // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
+                        compress(file, zos, name + "/" + file.getName(), KeepDirStructure);
+                    } else {
+                        compress(file, zos, file.getName(), KeepDirStructure);
+                    }
                 }
-                bis.close();
-                fos.close();
             }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }finally {
-            IOCloseUtil.close(bis,fos);
         }
     }
 }

+ 2 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/ZEngineeringDangerous.java

@@ -29,6 +29,8 @@ public class ZEngineeringDangerous extends BaseEntity {
      */
     @TableId(value = "id")
     private String id;
+    private String reviewStatus;
+    private String reviewRemark;;
     /**
      * 作业基本信息
      */

+ 2 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/bo/ZEngineeringDangerousBo.java

@@ -31,6 +31,8 @@ public class ZEngineeringDangerousBo extends BaseEntity {
     //@NotBlank(message = "不能为空", groups = { EditGroup.class })
     private String id;
 
+    private String reviewStatus;
+    private String reviewRemark;
     /**
      * 作业基本信息
      */

+ 1 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngiineeringPhotoVo.java

@@ -48,6 +48,7 @@ public class ZEngiineeringPhotoVo extends BaseEntity implements Serializable {
     @ExcelProperty(value = "备注")
     private String remark;
     private String type;
+    private String createByName;
 
 
 }

+ 2 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/vo/ZEngineeringDangerousVo.java

@@ -32,6 +32,8 @@ public class ZEngineeringDangerousVo extends BaseEntity implements Serializable
      */
     @ExcelProperty(value = "")
     private String id;
+    private String reviewStatus;
+    private String reviewRemark;
 
     /**
      * 作业基本信息

+ 1 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/mapper/ZEngineeringDangerousMapper.java

@@ -13,4 +13,5 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface ZEngineeringDangerousMapper extends BaseMapperPlus<ZEngineeringDangerousMapper, ZEngineeringDangerous, ZEngineeringDangerousVo> {
     String selectIdByCid(@Param("id") String id);
+    String getName(@Param("name") String name);
 }

+ 1 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/IZEngineeringDangerousService.java

@@ -22,6 +22,7 @@ public interface IZEngineeringDangerousService {
      * 查询危险工程
      */
     ZEngineeringDangerousVo query(String id) ;
+    boolean review(ZEngineeringDangerousBo zEngineeringDangerousBo) ;
 
     /**
      * 查询危险工程列表

+ 1 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngiineeringPhotoServiceImpl.java

@@ -311,6 +311,7 @@ public class ZEngiineeringPhotoServiceImpl implements IZEngiineeringPhotoService
 
     @Override
     @DynamicName(spel = "#bo.createTime")
+    @Async
     public void writeImg(List<ZEngineeringInfoBo> infoIdList,ZEngineeringInfoBo bo) {
         Map<String, String> objInfo = baseMapper.getObjInfo(bo.getEngInfoId());
         System.out.println("-------------节点信息-------------");

+ 3 - 11
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringCivilServiceImpl.java

@@ -1041,7 +1041,7 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
     @Override
     @DynamicName(spel = "#zEngineeringReviewBo.createTime")
     public int insertReview(ZEngineeringReviewBo zEngineeringReviewBo, infoIdList infoIdList) {
-//        ZEngineeringNode zEngineeringNode = zEngineeringNodeMapper.selectById(zEngineeringReviewBo.getEngInfoId());
+        //        ZEngineeringNode zEngineeringNode = zEngineeringNodeMapper.selectById(zEngineeringReviewBo.getEngInfoId());
         //        if (zEngineeringReviewBo.getReviewStatus().equals("1"))
         //        {
         //        infoIdList.getDelInfoIdList().stream().forEach(item -> {
@@ -1060,23 +1060,15 @@ public class ZEngineeringCivilServiceImpl implements IZEngineeringCivilService {
                 MonthTableNameHandler.setData(format.format(item.getCreateTime()));
                 zEngineeringInfoMapper.update(lqw);
                 MonthTableNameHandler.removeData();
-                try {
-                    threadPoolTaskExecutor.execute(()->{
-                        izEngiineeringPhotoService.writeImg(infoIdList.getInfoIdList(), item);
-                    });
-                }catch (Exception e){
-                    e.getStackTrace();
-                }finally {
-                }
+                izEngiineeringPhotoService.writeImg(infoIdList.getInfoIdList(), item);
             });
-            threadPoolTaskExecutor.shutdown();
-
             izEngineeringReviewService.insert(zEngineeringReviewBo);
         } catch (Exception e) {
             e.printStackTrace();
         }
         return 0;
     }
+
     @Autowired
     private ThreadPoolTaskExecutor threadPoolTaskExecutor;
 

+ 75 - 1
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringDangerousServiceImpl.java

@@ -12,6 +12,7 @@ import com.ruoyi.common.core.domain.PageQuery;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.framework.obs.ObsService;
 import com.ruoyi.zdsz.domain.ZEngiineeringPhoto;
 import com.ruoyi.zdsz.domain.ZEngineeringInfo;
 import com.ruoyi.zdsz.domain.ZEngineeringNode;
@@ -23,6 +24,8 @@ import com.ruoyi.zdsz.service.IZEngiineeringPhotoService;
 import com.ruoyi.zdsz.service.IZEngineeringNodeService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import com.ruoyi.zdsz.domain.vo.ZEngineeringDangerousVo;
 import com.ruoyi.zdsz.domain.ZEngineeringDangerous;
@@ -31,6 +34,10 @@ import com.ruoyi.zdsz.service.IZEngineeringDangerousService;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
 
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -51,7 +58,72 @@ public class ZEngineeringDangerousServiceImpl implements IZEngineeringDangerousS
 
     @Autowired
     private IZEngiineeringPhotoService photoService;
+    @Value("${filePath}")
+    private String filePath;
+    @Resource
+    private ObsService obsService;
+    @Override
+    public boolean review(ZEngineeringDangerousBo zEngineeringDangerousBo) {
+        System.out.println(zEngineeringDangerousBo);
+        ZEngineeringDangerous add = BeanUtil.toBean(zEngineeringDangerousBo, ZEngineeringDangerous.class);
+        int i = baseMapper.updateById(add);
+        if ("1".equals(zEngineeringDangerousBo.getReviewStatus())){
+            ZEngiineeringPhotoBo bo = new ZEngiineeringPhotoBo();
+            bo.setParentId(add.getId());
+            bo.setCreateTime(zEngineeringDangerousBo.getCreateTime());
+            write(photoService.queryList(bo), add.getEnginName());
+        }
+        return i>0;
+    }
+
+    @Async
+    public void write(List<ZEngiineeringPhotoVo> zEngiineeringPhotoVos,String enginName) {
+        zEngiineeringPhotoVos.forEach( item ->{
+            String photo = item.getPicUrl();
+            if (StringUtils.isNotBlank(photo)) {
+                try {
+                    // 创建最外层文件夹
+                    byte[] fileNameBytes = filePath.getBytes("UTF-8");
+                    // 使用UTF-8编码创建文件
+                    File file = new File(new String(fileNameBytes, "UTF-8"));
+                    if (!file.exists()) {
+                        file.mkdirs();
+                    }
+                    byte[] typeFileNameByte = (file.getPath() + "/危险工程").getBytes("UTF-8");
+                    // 使用UTF-8编码创建文件
+                    File typeFiles = new File(new String(typeFileNameByte, "UTF-8"));
+                    if (!typeFiles.exists()) {
+                        typeFiles.mkdirs();
+                    }
+                    byte[] typeFileNameBytes = (typeFiles.getPath() + "/" + enginName).getBytes("UTF-8");
+                    // 使用UTF-8编码创建文件
+                    File typeFile = new File(new String(typeFileNameBytes, "UTF-8"));
+                    if (!typeFile.exists()) {
+                        typeFile.mkdirs();
+                    }
+                    byte[] enginNameFileNameBytes = (typeFile.getPath() + "/" + baseMapper.getName(item.getCreateBy())).getBytes("UTF-8");
+                    // 使用UTF-8编码创建文件
+                    File enginNameFile = new File(new String(enginNameFileNameBytes, "UTF-8"));
+                    if (!enginNameFile.exists()) {
+                        enginNameFile.mkdirs();
+                    }
+                    byte[] CreateTimeFileNameBytes = (enginNameFile.getPath() + "/" + new SimpleDateFormat("yyyy-MM-dd").format(item.getUpdateTime())).getBytes("UTF-8");
+                    // 时间
+                    // 使用UTF-8编码创建文件
+                    File CreateTimeFile = new File(new String(CreateTimeFileNameBytes, "UTF-8"));
+                    if (!CreateTimeFile.exists()) {
+                        CreateTimeFile.mkdirs();
+                    }
+                    obsService.download(CreateTimeFile.getPath(), photo.substring(photo.lastIndexOf("/")+1));
+
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+
 
+            }
+        });
+    }
     /**
      * 查询危险工程列表
      */
@@ -348,7 +420,9 @@ public class ZEngineeringDangerousServiceImpl implements IZEngineeringDangerousS
         ZEngiineeringPhotoBo bo = new ZEngiineeringPhotoBo();
         bo.setParentId(vo.getId());
         bo.setCreateTime(vo.getCreateTime());
-        vo.setPics(photoService.queryList(bo));
+        List<ZEngiineeringPhotoVo> zEngiineeringPhotoVos = photoService.queryList(bo);
+        zEngiineeringPhotoVos.forEach(item -> item.setCreateByName(baseMapper.getName(item.getCreateBy())));
+        vo.setPics(zEngiineeringPhotoVos);
         return vo;
     }
     @Override

+ 2 - 1
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringPipeJackingServiceImpl.java

@@ -233,7 +233,8 @@ public class ZEngineeringPipeJackingServiceImpl implements IZEngineeringPipeJack
     @Transactional(rollbackFor=Exception.class)
     public Boolean updateByBo(ZEngineeringPipeJackingBo bo) {
         LambdaQueryWrapper<ZEngineeringPipeJacking> wrapper = Wrappers.lambdaQuery();
-        wrapper.eq(StringUtils.isNotEmpty(bo.getEnginName()),ZEngineeringPipeJacking::getEnginName,bo.getEnginName());
+        wrapper.eq(StringUtils.isNotEmpty(bo.getEnginName()),ZEngineeringPipeJacking::getEnginName,bo.getEnginName())
+                .ne(StringUtils.isNotEmpty(bo.getId()),ZEngineeringPipeJacking::getId,bo.getId());
         List<ZEngineeringPipeJacking> zEngineeringPipeJackings = baseMapper.selectList(wrapper);
         if (zEngineeringPipeJackings.size() > 0){
             return false;

+ 3 - 0
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEngineeringDangerousMapper.xml

@@ -51,4 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectIdByCid" resultType="string">
         select id from z_engineering_node where civli_id = #{id}
     </select>
+    <select id="getName" resultType="string">
+        select nick_name from sys_user where user_name = #{name} and del_flag = '0'
+    </select>
 </mapper>