Procházet zdrojové kódy

苏州签章系统签章完成文件解压并处理

user5 před 6 měsíci
rodič
revize
0d4d640067

+ 80 - 0
src/main/java/com/jeeplus/common/oss/OSSClientUtil.java

@@ -9,6 +9,7 @@ import com.jeeplus.common.utils.Encodes;
 import com.jeeplus.common.utils.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
@@ -701,6 +702,85 @@ public class OSSClientUtil {
         }
     }
 
+
+
+    /**
+     * 附件下载到本地指定文件夹(签章系统)
+     * @param key
+     * @param fileName
+     */
+    public void downQzByStreamSaveLocal(String key, String fileName,String downFileStr){
+        try {
+            // 创建OSSClient实例
+            OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+            OSSObject ossObject = ossClient.getObject(qzBucketName, key);
+            BufferedInputStream in = new BufferedInputStream(ossObject.getObjectContent());
+
+
+            //写入到文件(注意文件保存路径的后面一定要加上文件的名称)
+            FileOutputStream fileOut = new FileOutputStream(downFileStr);
+            BufferedOutputStream bos = new BufferedOutputStream(fileOut);
+            byte[] buf = new byte[4096];
+            int length = in.read(buf);
+            //保存文件
+            while(length != -1)
+            {
+                bos.write(buf, 0, length);
+                length = in.read(buf);
+            }
+            if(bos!=null){
+                bos.flush();
+                bos.close();
+            }
+            if(in!=null){
+                in.close();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 上传到OSS服务器  如果同名文件会覆盖服务器上的
+     *
+     * @param fileName 文件名称 包括后缀名
+     * @return 出错返回"" ,唯一MD5数字签名
+     */
+    public String uploadFileSignatureOSS(String filePath, String fileDir, String fileName) {
+        //初始化OSSClient
+        OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
+        File f = new File(filePath);
+
+        try {
+            MultipartFile cMultiFile = new MockMultipartFile("file", f.getName(), null, new FileInputStream(f));
+            if (!cMultiFile.isEmpty()) {
+                //文件原名称
+                String newName = cMultiFile.getOriginalFilename();
+                InputStream inStream = cMultiFile.getInputStream();
+                if(org.apache.commons.lang3.StringUtils.isNotBlank(newName)){
+
+                    long start = System.currentTimeMillis();
+                    //上传文件
+                    PutObjectResult putResult = ossClient.putObject(bucketName, fileDir + fileName, inStream);
+                    String ret = putResult.getETag();
+
+                    try {
+                        if (inStream != null) {
+                            inStream.close();
+                        }
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                    long end = System.currentTimeMillis();
+                    return ret;
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
     /**
      * 文件下载
      * @param key

+ 8 - 0
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectMessageElectronicSealController.java

@@ -499,6 +499,8 @@ public class RuralProjectMessageElectronicSealController extends BaseController
                     addMessage(redirectAttributes, "审定单签章申请已登记完成,无法再次送审");
                     if (StringUtils.isNotBlank(home) && "home".equals(home)){
                         return "redirect:" + Global.getAdminPath() + "/home/?repage";
+                    }else if (StringUtils.isNotBlank(home) && "notifyList".equals(home)){
+                        return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
                     }else {
                         return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
                     }
@@ -513,6 +515,8 @@ public class RuralProjectMessageElectronicSealController extends BaseController
 
         if (StringUtils.isNotBlank(home) && "home".equals(home)){
             return "redirect:" + Global.getAdminPath() + "/home/?repage";
+        }else if (StringUtils.isNotBlank(home) && "notifyList".equals(home)){
+            return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
         }else {
             return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
         }
@@ -840,6 +844,8 @@ public class RuralProjectMessageElectronicSealController extends BaseController
                         addMessage(redirectAttributes, "报告签章申请已送审,请勿重复送审");
                         if (StringUtils.isNotBlank(home) && "home".equals(home)) {
                             return "redirect:" + Global.getAdminPath() + "/home/?repage";
+                        }else if (StringUtils.isNotBlank(home) && "notifyList".equals(home)){
+                            return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
                         } else {
                             return "redirect:" + Global.getAdminPath() + "/ruralProject/electronicSeal/?repage";
                         }
@@ -863,6 +869,8 @@ public class RuralProjectMessageElectronicSealController extends BaseController
 
         if (StringUtils.isNotBlank(home) && "home".equals(home)){
             return "redirect:" + Global.getAdminPath() + "/home/?repage";
+        }else if (StringUtils.isNotBlank(home) && "notifyList".equals(home)){
+            return "redirect:" + Global.getAdminPath() + "/workprojectnotify/workProjectNotify/list/?repage";
         }else {
             return "redirect:"+Global.getAdminPath()+"/ruralProject/electronicSeal/?repage";
         }

+ 282 - 2
src/main/java/com/jeeplus/modules/ruralprojectrecords/web/RuralProjectSignatureCallBackController.java

@@ -2,6 +2,7 @@ package com.jeeplus.modules.ruralprojectrecords.web;
 
 import com.alibaba.fastjson.JSON;
 import com.jeeplus.common.config.Global;
+import com.jeeplus.common.oss.OSSClientUtil;
 import com.jeeplus.common.utils.JedisUtils;
 import com.jeeplus.common.utils.SpringContextHolder;
 import com.jeeplus.common.utils.StringUtils;
@@ -15,6 +16,7 @@ import com.jeeplus.modules.ruralprojectrecords.enums.ProjectStatusEnum;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectMessageElectronicSealService;
 import com.jeeplus.modules.ruralprojectrecords.service.RuralProjectRecordsService;
 import com.jeeplus.modules.sys.entity.User;
+import com.jeeplus.modules.sys.entity.Workattachment;
 import com.jeeplus.modules.sys.service.WorkattachmentService;
 import com.jeeplus.modules.sys.utils.UserUtils;
 import com.jeeplus.modules.tools.utils.SignaturePostUtil;
@@ -25,12 +27,16 @@ import com.jeeplus.modules.workprojectnotify.service.WorkProjectNotifyService;
 import com.jeeplus.modules.workprojectnotify.util.UtilNotify;
 import org.activiti.engine.HistoryService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 import redis.clients.jedis.Jedis;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
 import java.util.*;
 
 /**
@@ -41,6 +47,7 @@ import java.util.*;
 @Controller
 @RequestMapping(value = "${adminPath}/ruralProject/signatureCallBack")
 public class RuralProjectSignatureCallBackController extends BaseController {
+    private final static String directory = Global.getConfig("remoteServer.directory");
     @Autowired
     private RuralProjectRecordsService projectRecordsService;
     @Autowired
@@ -163,7 +170,127 @@ public class RuralProjectSignatureCallBackController extends BaseController {
         String signatureUrl = null;
         if(StringUtils.isNotBlank(presignCallBack.getStoragePath())){
             signatureUrl = presignCallBack.getStoragePath().replace("oss:/","");
-            projectReportData.setSignatureUrl(signatureUrl);
+            if(StringUtils.isBlank(projectReportData.getSignatureUrl())){
+                projectReportData.setSignatureUrl(signatureUrl);
+
+                //将源文件下载下来进行解压并解析,保留有效的文件
+                signatureUrl = signatureUrl.replace("/xg-qz","");
+                OSSClientUtil ossClientUtil = new OSSClientUtil();
+                //将文件下载并对原有文件地址进行替换
+                String deleteFile = null;
+                String unzipFileStr = null;
+                try {
+                    String path = null;
+                    if (System.getProperty("os.name").toLowerCase().contains("win")) {
+                        path = "D:/attachment-file/";
+                    } else {
+                        path = "/attachment-file/";
+                    }
+                    String aliyunUrl = "http://cdn.gangwaninfo.com";
+                    String aliDownloadUrl = "http://oss.gangwaninfo.com";
+
+
+                    String file = aliyunUrl + signatureUrl;
+                    file = file.replace("amp;", "");
+                    String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+                    String cons = "";
+                    if (file.contains(aliyunUrl)) {
+                        cons = aliyunUrl;
+                    } else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")) {
+                        cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+                    } else {
+                        cons = aliDownloadUrl;
+                    }
+                    String ossKey = file.split(cons + "/")[1];
+                    ossClientUtil.downQzByStreamSaveLocal(ossKey,fileName,path+fileName);
+                    //将下载下来的文件转换为file文件
+                    File srcFile = new File(path + fileName);
+                    deleteFile = path + fileName;
+
+                    //截取文件名称
+                    String srcFileName = srcFile.getName().substring(0, srcFile.getName().lastIndexOf("."));
+
+                    //解压后文件地址
+                    unzipFileStr = path + srcFileName;
+
+                    //将下载后的文件进行解压
+                    SignaturePostUtil.unZipFile(srcFile, unzipFileStr);
+
+                    //遍历解压后文件夹中的所有文件信息
+                    File unZipFile = new File(unzipFileStr);
+
+                    File[] unZipFileList = unZipFile.listFiles();
+
+                    if (null != unZipFileList && unZipFileList.length > 0) {
+                        for (File f : unZipFileList) {
+                            String signatureFileName = f.getName();
+                            //判定文件是否是以(1).pdf结尾的,如果是,则表示是正确得文件,保存到oss文件库,并提供下载连接
+                            if (signatureFileName.endsWith("(1).pdf")) {
+                                System.out.println("字符串以 (1).pdf 结尾");
+                                String filepath = "";
+                                //取得上传文件
+                                //将文件上传到oss云盘中
+                                MultipartFile cMultiFile = new MockMultipartFile("file", f.getName(), null, new FileInputStream(f));
+                                if (!cMultiFile.isEmpty()) {
+                                    // 文件保存路径
+                                    String realPath =directory.replaceFirst("/","")+"/projectRecords" + datePath()+"/"+ System.currentTimeMillis();
+                                    //文件原名称
+                                    String newName = cMultiFile.getOriginalFilename();
+                                    if(StringUtils.isNotBlank(newName)){
+                                        newName = newName.substring(13, newName.length());
+                                        //SpringUtil.getBean ( IWorkAttachmentApi.class ).uploadFile2OSS(cMultiFile.getInputStream(),realPath,newName);
+                                        ossClientUtil.uploadFileSignatureOSS(f.getPath(),realPath,newName);
+                                        filepath = "/" + realPath + newName;
+                                    }
+                                }
+
+                                System.out.println(f.getName());
+                                //截取文件后缀名
+                                String substring = f.getName().substring(f.getName().lastIndexOf(".") + 1, f.getName().length());
+
+                                String newFileName = f.getName().substring(13, f.getName().length());
+
+                                //将签章完成的附件进行保存到附件表中
+                                Workattachment workattachment = new Workattachment();
+                                workattachment.setDelFlag("0");
+                                workattachment.setUrl(filepath);
+                                workattachment.setType(substring);
+                                workattachment.setAttachmentName(newFileName);
+                                workattachment.setAttachmentFlag("project_report_approval_file_signature");
+                                workattachment.setFileSize(String.valueOf(f.length()));
+                                workattachment.setAttachmentId(projectReportData.getId());
+                                String id = UUID.randomUUID().toString().replace("-", "");
+                                workattachment.setId(id);
+                                workattachment.setCreateDate(new Date());
+                                workattachment.setUpdateDate(new Date());
+                                //先查询数据库中是否已经对数据进行保存
+                                //若未保存,则进行保存,否则直接跳过
+                                List<Workattachment> byAttachmentIdAndUrl = workattachmentService.getByAttachmentIdAndUrlAndAttachmentFlag(workattachment);
+                                if(byAttachmentIdAndUrl.size() == 0){
+                                    workattachmentService.insert(workattachment);
+
+                                    //将附件信息添加到签章附件信息表中
+                                    projectReportData.setSignatureUrl(filepath);
+                                }
+                            }
+                        }
+                    }
+                } catch (Exception e){
+                    e.printStackTrace();
+                }finally {
+                    if(StringUtils.isNotBlank(deleteFile)){
+                        //根据路径创建文件对象
+                        File file = new File(deleteFile);
+                        //路径是个文件且不为空时删除文件
+                        if(file.isFile()&&file.exists()){
+                            file.delete();
+                        }
+                    }
+                    File file = new File(unzipFileStr);
+                    deleteFile(file);
+                }
+            }
+
         }
         //修改签章对应信息文件
         projectReportDataService.updateSignatureInfo(projectReportData);
@@ -453,7 +580,123 @@ public class RuralProjectSignatureCallBackController extends BaseController {
         String signatureUrl = null;
         if(StringUtils.isNotBlank(presignCallBack.getStoragePath())){
             signatureUrl = presignCallBack.getStoragePath().replace("oss:/","");
-            records.setReportSignatureUrl(signatureUrl);
+
+            if(StringUtils.isBlank(records.getReportSignatureUrl())){
+                records.setReportSignatureUrl(signatureUrl);
+
+                //将源文件下载下来进行解压并解析,保留有效的文件
+                signatureUrl = signatureUrl.replace("/xg-qz","");
+                OSSClientUtil ossClientUtil = new OSSClientUtil();
+                //将文件下载并对原有文件地址进行替换
+                String deleteFile = null;
+                String unzipFileStr = null;
+                try {
+                    String path = null;
+                    if (System.getProperty("os.name").toLowerCase().contains("win")) {
+                        path = "D:/attachment-file/";
+                    } else {
+                        path = "/attachment-file/";
+                    }
+                    String aliyunUrl = "http://cdn.gangwaninfo.com";
+                    String aliDownloadUrl = "http://oss.gangwaninfo.com";
+
+
+                    String file = aliyunUrl + signatureUrl;
+                    file = file.replace("amp;", "");
+                    String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
+                    String cons = "";
+                    if (file.contains(aliyunUrl)) {
+                        cons = aliyunUrl;
+                    } else if (file.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")) {
+                        cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
+                    } else {
+                        cons = aliDownloadUrl;
+                    }
+                    String ossKey = file.split(cons + "/")[1];
+                    ossClientUtil.downQzByStreamSaveLocal(ossKey,fileName,path+fileName);
+                    //将下载下来的文件转换为file文件
+                    File srcFile = new File(path + fileName);
+                    deleteFile = path + fileName;
+
+                    //截取文件名称
+                    String srcFileName = srcFile.getName().substring(0, srcFile.getName().lastIndexOf("."));
+
+                    //解压后文件地址
+                    unzipFileStr = path + srcFileName;
+
+                    //将下载后的文件进行解压
+                    SignaturePostUtil.unZipFile(srcFile, unzipFileStr);
+
+                    //遍历解压后文件夹中的所有文件信息
+                    File unZipFile = new File(unzipFileStr);
+
+                    File[] unZipFileList = unZipFile.listFiles();
+
+                    if (null != unZipFileList && unZipFileList.length > 0) {
+                        for (File f : unZipFileList) {
+                            String filepath = "";
+                            //取得上传文件
+                            //将文件上传到oss云盘中
+                            MultipartFile cMultiFile = new MockMultipartFile("file", f.getName(), null, new FileInputStream(f));
+                            if (!cMultiFile.isEmpty()) {
+                                // 文件保存路径
+                                String realPath =directory.replaceFirst("/","")+"/projectRecords" + datePath()+"/"+ System.currentTimeMillis();
+                                //文件原名称
+                                String newName = cMultiFile.getOriginalFilename();
+                                if(StringUtils.isNotBlank(newName)){
+                                    newName = newName.substring(13, newName.length());
+                                    //SpringUtil.getBean ( IWorkAttachmentApi.class ).uploadFile2OSS(cMultiFile.getInputStream(),realPath,newName);
+                                    ossClientUtil.uploadFileSignatureOSS(f.getPath(),realPath,newName);
+                                    filepath = "/" + realPath + newName;
+                                }
+                            }
+
+                            System.out.println(f.getName());
+                            //截取文件后缀名
+                            String substring = f.getName().substring(f.getName().lastIndexOf(".") + 1, f.getName().length());
+
+                            String newFileName = f.getName().substring(13, f.getName().length());
+
+                            //将签章完成的附件进行保存到附件表中
+                            Workattachment workattachment = new Workattachment();
+                            workattachment.setDelFlag("0");
+                            workattachment.setUrl(filepath);
+                            workattachment.setType(substring);
+                            workattachment.setAttachmentName(newFileName);
+                            workattachment.setAttachmentFlag("project_report_file_signature");
+                            workattachment.setFileSize(String.valueOf(f.length()));
+                            workattachment.setAttachmentId(projectReportData.getId());
+                            String id = UUID.randomUUID().toString().replace("-", "");
+                            workattachment.setId(id);
+                            workattachment.setCreateDate(new Date());
+                            workattachment.setUpdateDate(new Date());
+                            //先查询数据库中是否已经对数据进行保存
+                            //若未保存,则进行保存,否则直接跳过
+                            List<Workattachment> byAttachmentIdAndUrl = workattachmentService.getByAttachmentIdAndUrlAndAttachmentFlag(workattachment);
+                            if(byAttachmentIdAndUrl.size() == 0){
+                                workattachmentService.insert(workattachment);
+
+                                //将附件信息添加到签章附件信息表中
+                                records.setReportSignatureUrl(filepath);
+                            }
+                        }
+                    }
+                } catch (Exception e){
+                    e.printStackTrace();
+                }finally {
+                    if(StringUtils.isNotBlank(deleteFile)){
+                        //根据路径创建文件对象
+                        File file = new File(deleteFile);
+                        //路径是个文件且不为空时删除文件
+                        if(file.isFile()&&file.exists()){
+                            file.delete();
+                        }
+                    }
+                    File file = new File(unzipFileStr);
+                    deleteFile(file);
+                }
+            }
+
         }
         //修改签章对应信息文件
         projectReportDataService.updateReportSignatureInfo(records);
@@ -1390,4 +1633,41 @@ public class RuralProjectSignatureCallBackController extends BaseController {
     }
 
 
+    public static Boolean deleteFile(File file) {
+        //判断文件不为null或文件目录存在
+        if (file == null || !file.exists()) {
+            System.out.println("文件删除失败,请检查文件是否存在以及文件路径是否正确");
+            return false;
+        }
+        //获取目录下子文件
+        File[] files = file.listFiles();
+        //遍历该目录下的文件对象
+        for (File f : files) {
+            //判断子目录是否存在子目录,如果是文件则删除
+            if (f.isDirectory()) {
+                //递归删除目录下的文件
+                deleteFile(f);
+            } else {
+                //文件删除
+                f.delete();
+                //打印文件名
+                System.out.println("文件名:" + f.getName());
+            }
+        }
+        //文件夹删除
+        file.delete();
+        System.out.println("目录名:" + file.getName());
+        return true;
+    }
+
+    private static String datePath(){
+
+        Calendar date = Calendar.getInstance();
+        String year = String.valueOf(date.get(Calendar.YEAR));
+        String month = String.valueOf(date.get(Calendar.MONTH)+1);
+        String day = String.valueOf(date.get(Calendar.DAY_OF_MONTH));
+        String path = "/"+year+"/"+month+"/"+day;
+        return path;
+    }
+
 }

+ 2 - 0
src/main/java/com/jeeplus/modules/sys/dao/WorkattachmentDao.java

@@ -102,6 +102,8 @@ public interface WorkattachmentDao extends CrudDao<Workattachment> {
 
     void deleteExter(ExternalUnitWorkClientAttachment workattachment);
 
+    List<Workattachment> getByAttachmentIdAndUrlAndAttachmentFlag(Workattachment workAttachment);
+
     /**
      * 根据id获取对象
      */

+ 5 - 0
src/main/java/com/jeeplus/modules/sys/service/WorkattachmentService.java

@@ -1166,6 +1166,11 @@ public class WorkattachmentService extends CrudService<WorkattachmentDao, Workat
 	}
 
 
+
+	public List<Workattachment> getByAttachmentIdAndUrlAndAttachmentFlag( Workattachment workattachment){
+		return workattachmentDao.getByAttachmentIdAndUrlAndAttachmentFlag(workattachment);
+	}
+
 	/**
 	 * 根据id获取对象
 	 */

+ 59 - 0
src/main/java/com/jeeplus/modules/tools/utils/SignaturePostUtil.java

@@ -26,8 +26,11 @@ import org.apache.http.util.EntityUtils;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.*;
+import java.nio.charset.Charset;
 import java.util.*;
 import java.util.Map.Entry;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 /**
  * @author: 徐滕
@@ -726,5 +729,61 @@ public class SignaturePostUtil {
         }
         return "";
     }
+
+    /**
+     * zip文件解压
+     * @param file 需解压的文件
+     * @param destDirPath 解压文件地址
+     */
+    public static void unZipFile(File file,String destDirPath){
+        // 开始解压
+        ZipFile zipFile = null;
+        try {
+            //zipFile = new ZipFile(file);
+            //添加解压编码,解决解压报错问题
+            zipFile = new ZipFile(file, Charset.forName("GBK"));
+            Enumeration<?> entries = zipFile.entries();
+            while (entries.hasMoreElements()) {
+                ZipEntry entry = (ZipEntry) entries.nextElement();
+                System.out.println("解压" + entry.getName());
+                // 如果是文件夹,就创建个文件夹
+                if (entry.isDirectory()) {
+                    String dirPath = destDirPath + "/" + entry.getName();
+                    File dir = new File(dirPath);
+                    dir.mkdirs();
+                } else {
+                    // 如果是文件,就先创建一个文件,然后用io流把内容copy过去
+                    File targetFile = new File(destDirPath + "/" + entry.getName());
+                    // 保证这个文件的父文件夹必须要存在
+                    if(!targetFile.getParentFile().exists()){
+                        targetFile.getParentFile().mkdirs();
+                    }
+                    targetFile.createNewFile();
+                    // 将压缩文件内容写入到这个文件中
+                    InputStream is = zipFile.getInputStream(entry);
+                    FileOutputStream fos = new FileOutputStream(targetFile);
+                    int len;
+                    byte[] buf = new byte[1024];
+                    while ((len = is.read(buf)) != -1) {
+                        fos.write(buf, 0, len);
+                    }
+                    // 关流顺序,先打开的后关闭
+                    fos.close();
+                    is.close();
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if(zipFile != null){
+                try {
+                    zipFile.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 }
 

+ 11 - 0
src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceService.java

@@ -843,6 +843,9 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		//项目名称获取
 		List<String> projectNameList = getProjectNameList(workInvoice);
 		String projectNameStr = String.join(",", projectNameList);
+		projectNameStr = projectNameStr.length() > 900
+				? projectNameStr.substring(0, 900)
+				: projectNameStr;
 		//ProjectRecords projectRecords = projectRecordsService.getRuralMasters(workInvoice.getProject().getId());
 		String title = "项目【"+ projectNameStr +"】发票申请待审批";
 		str = "发票金额:" + workInvoice.getMoney() + "(元)。项目【"+ projectNameStr +"】发票申请待审批,发票申请编号:"+workInvoice.getNumber();
@@ -1013,6 +1016,10 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		//项目名称获取
 		List<String> projectNameList = getProjectNameList(workInvoice);
 		String projectNameStr = String.join(",", projectNameList);
+
+		projectNameStr = projectNameStr.length() > 900
+				? projectNameStr.substring(0, 900)
+				: projectNameStr;
 		//ProjectRecords projectRecords = projectRecordsService.getRuralMasters(workInvoice.getProject().getId());
 		String title = "项目【"+ projectNameStr +"】发票申请待审批";
 		str = "发票金额:" + workInvoice.getMoney() + "(元)。项目【"+ projectNameStr +"】发票申请待审批,发票申请编号:"+workInvoice.getNumber();
@@ -1187,6 +1194,10 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		//项目名称获取
 		List<String> projectNameList = getProjectNameList(workInvoice);
 		String projectNameStr = String.join(",", projectNameList);
+
+		projectNameStr = projectNameStr.length() > 900
+				? projectNameStr.substring(0, 900)
+				: projectNameStr;
 		//ProjectRecords projectRecords = projectRecordsService.getRuralMasters(workInvoice.getProject().getId());
 		String title = "项目【"+ projectNameStr +"】发票申请待审批";
 		str = "项目【"+ projectNameStr +"】发票申请待审批,发票申请编号:"+workInvoice.getNumber();

+ 2 - 2
src/main/resources/jeeplus.properties

@@ -7,7 +7,7 @@ jdbc.type=mysql
 jdbc.driver=com.mysql.jdbc.Driver
 db.name=ruihuaoa-activity-data
 #jdbc.url=jdbc:mysql://8.136.152.135:3306/new_ccpm?useUnicode=true&characterEncoding=utf-8
-jdbc.url=jdbc:mysql://192.168.2.4:3306/new_ccpm?useUnicode=true&characterEncoding=utf-8
+jdbc.url=jdbc:mysql://127.0.0.1:3306/new_ccpm?useUnicode=true&characterEncoding=utf-8
 jdbc.username=root
 jdbc.password=root
 #jdbc.password=Xgcomdata10376@
@@ -402,5 +402,5 @@ SZCLOUD_STATUS: sz
 # 公共密码
 publicPassword: Xg@sys9hB2!xWm
 
-//苏州公共密码
+#苏州公共密码
 szPublicPassword: Xg@sys9hB2!xWm

+ 20 - 0
src/main/resources/mappings/modules/sys/WorkattachmentDao.xml

@@ -440,6 +440,26 @@
 	</select>
 
 
+	<select id="getByAttachmentIdAndUrlAndAttachmentFlag" resultType="Workattachment">
+		SELECT
+		<include refid="workattachmentColumns"/>
+		FROM work_attachment a
+		<include refid="workattachmentJoins"/>
+		<where>
+			a.del_flag = 0
+			<if test="attachmentId != null and attachmentId != ''">
+				and a.attachment_id = #{attachmentId}
+			</if>
+			<if test="attachmentName != null and attachmentName != ''">
+				and a.attachment_name = #{attachmentName}
+			</if>
+			<if test="attachmentFlag != null and attachmentFlag != ''">
+				and a.attachment_flag = #{attachmentFlag}
+			</if>
+		</where>
+	</select>
+
+
 <!--		<select id="getWorkattachmentById" resultMap="Workattachment">-->
 <!--			SELECT-->
 <!--			<include refid="workattachmentColumns"/>-->

+ 24 - 3
src/main/webapp/webpage/modules/ruralprojectrecords/ruralporjectmessage/electronicSeal/ruralProjectMessageElectronicSealList.jsp

@@ -236,6 +236,20 @@
 			});
 		}
 
+		function downloadPDF(url,projectReportNumber,type) {
+			console.log(url)
+			fetch(url)
+					.then(response => response.blob())
+					.then(blob => {
+						const link = document.createElement('a');
+						link.href = window.URL.createObjectURL(blob);
+						link.download = projectReportNumber + type + '.pdf'; // 指定下载文件名
+						link.click();
+						window.URL.revokeObjectURL(link.href); // 释放内存
+					})
+					.catch(error => console.error('下载失败:', error));
+		}
+
 		function show(d) {
 			////对操作进行初始化
 			var xml = '<div class=\"layui-btn-group\">';
@@ -304,7 +318,11 @@
 				//上传审定单进行签章
 
 				if(d.approvalSignatureUrlFlag == 1){
-					xml+="<a href=\""+ d.signatureUrl +"\" class=\"layui-btn  layui-btn-xs layui-bg-orange\" style='height:32px;margin-top: 5px;margin-bottom: 5px;'>审定单签章下载</a>"
+					if(!d.signatureUrl.includes('.pdf?Expires')){
+						xml+="<a href=\""+ d.signatureUrl +"\" class=\"layui-btn  layui-btn-xs layui-bg-orange\" style='height:32px;margin-top: 5px;margin-bottom: 5px;'>审定单签章下载</a>"
+					}else{
+						xml += "<a href=\"javascript:void(0);\" onclick=\"downloadPDF('" + d.signatureUrl + "','" + d.projectReportNumber + "','审定单签章')\" class=\"layui-btn layui-btn-xs layui-bg-orange\" style=\"height:32px;margin-top: 5px;margin-bottom: 5px;\">审定单签章下载</a>";
+					}
 				}else{
 					xml+="<a href=\"${ctx}/ruralProject/signatureCallBack/downLoadAttach?contractId="+ d.signatureContractId +"\" class=\"layui-btn  layui-btn-xs layui-bg-orange\" style='height:32px;margin-top: 5px;margin-bottom: 5px;'>审定单签章下载</a>"
 				}
@@ -316,9 +334,12 @@
 			}
 			if(d.reportSignatureStatus == 5){
 				//上传审定单进行签章
-
 				if(d.reportSignatureUrlFlag == 1){
-					xml+="<a href=\""+ d.reportSignatureUrl +"\" class=\"layui-btn  layui-btn-xs layui-bg-orange\" style='height:32px;margin-top: 5px;margin-bottom: 5px;'>报告签章下载</a>"
+					if(!d.reportSignatureUrl.includes('.pdf?Expires')){
+						xml+="<a href=\""+ d.reportSignatureUrl +"\" class=\"layui-btn  layui-btn-xs layui-bg-orange\" style='height:32px;margin-top: 5px;margin-bottom: 5px;'>报告签章下载</a>"
+					}else{
+						xml += "<a href=\"javascript:void(0);\" onclick=\"downloadPDF('" + d.reportSignatureUrl + "','" + d.projectReportNumber + "','报告签章')\" class=\"layui-btn layui-btn-xs layui-bg-orange\" style=\"height:32px;margin-top: 5px;margin-bottom: 5px;\">报告签章下载</a>";
+					}
 				}else{
 					xml+="<a href=\"${ctx}/ruralProject/signatureCallBack/downLoadReportAttach?contractId="+ d.reportSignatureContractId +"\" class=\"layui-btn  layui-btn-xs layui-bg-orange\" style='height:32px;margin-top: 5px;margin-bottom: 5px;'>报告签章下载</a>"
 				}

+ 1 - 0
src/main/webapp/webpage/modules/workclientinfo/all/workClientInfoForm.jsp

@@ -80,6 +80,7 @@
                 });
 
             });
+            $("#exitName").val(true)
             contentDetailTypeShow();
             checkContentKeyUp('unitIntroduction',500);
             $.validator.messages["orUnicode"] = true;

+ 2 - 0
src/main/webapp/webpage/modules/workclientinfo/workClientInfoForm.jsp

@@ -97,6 +97,7 @@
                 });
 
             });
+            $("#exitName").val(true)
             contentDetailTypeShow();
             checkContentKeyUp('unitIntroduction',500);
             $.validator.messages["orUnicode"] = true;
@@ -209,6 +210,7 @@
                         "name":name,
                         "uscCode":uscCode},
                     success:function(data){
+                        console.log("exitName111",data)
                         if(data==="false"){
                             exitName=false
                             $("#exitName").val(false)