Selaa lähdekoodia

审定内签章无文件审核处理

user5 3 vuotta sitten
vanhempi
commit
ace534df07

+ 53 - 171
src/main/java/com/jeeplus/modules/ruralprojectrecords/service/RuralProjectMessageNewService.java

@@ -84,6 +84,7 @@ import com.jeeplus.modules.workreview.service.WorkReviewStandardService;
 import com.jeeplus.modules.workstaff.entity.WorkStaffBasicInfo;
 import com.jeeplus.modules.workstaff.entity.WorkStaffCertificate;
 import com.jeeplus.modules.workstaff.service.WorkStaffBasicInfoService;
+import com.sun.org.apache.xpath.internal.operations.Bool;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import org.activiti.engine.ActivitiObjectNotFoundException;
@@ -1606,7 +1607,7 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
             }
             workActivityMenu.setActivities(activitieList);
         }
-
+        Boolean fileFlag= false;
         WorkActivityProcess workActivityProcess = new WorkActivityProcess();
         WorkActivityProcess selectProcess = new WorkActivityProcess();
         selectProcess.setProcessInstanceId(projectReportData.getProcessInstanceId());
@@ -1676,142 +1677,18 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
                             /*String reportNo = createReportNo(reportData.getConditionType());
                             projectReportData.setNumber(reportNo);*/
                             projectReportData.setAct(reportData.getAct());
-                            new JudgementThread(ruralProjectRecords,projectReportData).start();
-                            //下载审定单文件
-                            /*String deleteFile = null;
-                            try {
-                                //进行签章处理
-                                //根据项目id查询是否已经提交过了审定单签章
-                                if(null == ruralProjectRecords){
-                                    return "查询不到该项目信息";
-                                }
-                                if(null!= ruralProjectRecords.getQualitySignatureFlag() && 1 == ruralProjectRecords.getQualitySignatureFlag()){
-                                    return "该项目已经审定单盖章完成";
-                                }
-                                if(StringUtils.isBlank(ruralProjectRecords.getProjectMasterId())){
-                                    return "项目负责人为空,无法进行签章";
-                                }
-
-                                //根据项目id和附件类型的
-                                Workattachment workClientAttachment = new Workattachment();
-                                workClientAttachment.setAttachmentFlag("105");
-                                workClientAttachment.setAttachmentId(ruralProjectRecords.getId());
-                                workClientAttachment.setProjectId(ruralProjectRecords.getId());
-                                workClientAttachment.setDivIdType("_judgement");
-                                List<Workattachment> fileList = workattachmentService.findList(workClientAttachment);
-                                if(fileList.size()>0){
-                                    Workattachment workattachment = fileList.get(0);
-                                    if(StringUtils.isBlank(workattachment.getUrl())){
-                                        return "报告签章文件存储路径为空,无法进行签章操作,请驳回后重新上传审定单";
-                                    }
-                                    //下载审定单文件
-                                    String path = null;
-                                    if(System.getProperty("os.name").toLowerCase().contains("win")){
-                                        path = "D:/attachment-file/";
-                                    }else{
-                                        path = "/attachment-file/";
-                                    }
-                                    String file = workattachment.getUrl();
-                                    file = file.replace("amp;","");
-                                    String fileName = file.substring(file.lastIndexOf("/") + 1, file.length());
-                                    String aliyunUrl = Global.getAliyunUrl();
-                                    String aliDownloadUrl = Global.getAliDownloadUrl();
-                                    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];
-                                    new OSSClientUtil().downByStreamSaveLocal(ossKey,fileName,path+fileName);
-                                    //将下载下来的文件转换为file文件
-                                    File srcFile = new File(path+fileName);
-                                    deleteFile = path+fileName;
-
-                                    //截取文件名称
-                                    String srcFileName = srcFile.getName().substring(0,srcFile.getName().lastIndexOf("."));
-                                    //截取文件后缀名
-                                    String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
-                                    if(!"doc".equals(substring.toLowerCase()) && !"docx".equals(substring.toLowerCase()) && !"pdf".equals(substring.toLowerCase()) && !"xls".equals(substring.toLowerCase()) && !"xlsx".equals(substring.toLowerCase())){
-                                        return "请上传doc、docx、xls、xlsx或者pdf文件进行签章操作";
-                                    }
-                                    //获取真签单的documentId
-                                    HashMap hashMap = SignaturePostUtil.getDocument(srcFile);
-                                    String code = hashMap.get("code").toString();
-                                    String documentId = "";
-                                    if("0".equals(code)){
-                                        String result = hashMap.get("result").toString();
-                                        HashMap documentIdMap = JSON.parseObject(result, HashMap.class);
-                                        documentId =  documentIdMap.get("documentId").toString();
-                                        if("".equals(documentId)){
-                                            return "签章文件创建失败";
-                                        }
-                                    }else{
-                                        String message = hashMap.get("message").toString();
-                                        return message;
-                                    }
-                                    List<String> documentList = Lists.newArrayList();
-                                    documentList.add(documentId);
-                                    //根据项目id 和 documentId生成合同id
-                                    long s1 = System.currentTimeMillis();
-                                    HashMap contractIdHashMap = new HashMap();
-                                    if("doc".equals(substring.toLowerCase()) || "docx".equals(substring.toLowerCase()) || "pdf".equals(substring.toLowerCase()) ){
-                                        contractIdHashMap = ruralProjectMessageService.getSignatureContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"");
-                                    }else if("xls".equals(substring.toLowerCase()) || "xlsx".equals(substring.toLowerCase())){
-                                        contractIdHashMap = ruralProjectMessageService.getSignatureExcelContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"");
-                                    }
-                                    String contractIdCode = contractIdHashMap.get("code").toString();
-                                    String contractId = "";
-                                    if("0".equals(contractIdCode)){
-                                        contractId = contractIdHashMap.get("contractId").toString();
-                                        if("".equals(contractId)){
-                                            return "签章文件创建失败";
-                                        }
-                                    }else{
-                                        return contractIdHashMap.get("message").toString();
-                                    }
-                                    long s2 = System.currentTimeMillis();
-                                    System.out.println("创建签章合同用时:" + (s2-s1));
-
-                                    //进行静默签署
-                                    *//*long s3 = System.currentTimeMillis();
-                                    HashMap signbyCompanyHashMap = ruralProjectMessageService.signbyCompanyByKeyWord(contractId,documentList);
-                                    if(null != signbyCompanyHashMap){
-                                        String signbyCompanyCode = signbyCompanyHashMap.get("code").toString();
-                                        String signbyCompanyMessage = signbyCompanyHashMap.get("message").toString();
-                                        if(!"0".equals(signbyCompanyCode) && (!"3001009".equals(signbyCompanyCode) || !"文件状态不是“签署中”".equals(signbyCompanyMessage))){
-                                            return signbyCompanyMessage;
-                                        }
-                                    }
-                                    long s4 = System.currentTimeMillis();
-                                    System.out.println("进行静默签署用时:" + (s4-s3));*//*
-                                    //将documentId 和contractId存储到质量复核对应的数据种
-                                    //签章完成则进行数据的保存
-                                    ruralProjectRecords.setQualitySignatureFlag(1);
-                                    ruralProjectRecords.setQualitySignatureDocumentId(documentId);
-                                    ruralProjectRecords.setQualitySignatureContractId(contractId);
-                                    ruralProjectRecords.setQualitySignatureFileName(srcFileName);
-                                    ruralProjectRecords.setQualitySignatureUploadFileUser(UserUtils.getUser());
-                                    ruralProjectRecords.setQualitySignatureUploadDate(new Date());
-                                    //修改签章对应信息文件
-                                    projectReportDataService.updateJudgementSignatureInfo(ruralProjectRecords);
-                                }*//*else{
-                                    return "质量复核审定单文件未找到,无法进行签章操作";
-                                }*//*
-                            }catch (Exception e){
-
-                            }finally {
-                                if(StringUtils.isNotBlank(deleteFile)){
-                                    //根据路径创建文件对象
-                                    File file = new File(deleteFile);
-                                    //路径是个文件且不为空时删除文件
-                                    if(file.isFile()&&file.exists()){
-                                        file.delete();
-                                    }
-                                }
-                            }*/
+                            //根据项目id和附件类型的
+                            Workattachment workClientAttachment = new Workattachment();
+                            workClientAttachment.setAttachmentFlag("105");
+                            workClientAttachment.setAttachmentId(ruralProjectRecords.getId());
+                            workClientAttachment.setProjectId(ruralProjectRecords.getId());
+                            workClientAttachment.setDivIdType("_judgement");
+                            List<Workattachment> fileList = workattachmentService.findList(workClientAttachment);
+                            if(fileList.size()>0){
+                                new JudgementThread(ruralProjectRecords,projectReportData).start();
+                            }else{
+                                fileFlag = true;
+                            }
                             //添加审核通过日期
                             projectReportData.setAuditPassDate(new Date());
                         }
@@ -1848,55 +1725,60 @@ public class RuralProjectMessageNewService extends CrudService<RuralProjectMessa
         List<User> users = new ArrayList<>();
         List<User> userList = new ArrayList<>();
         if (!state) {
-            users.add(projectReportData.getCreateBy());
-            WorkProjectNotify notify = new WorkProjectNotify();
-            notify.setNotifyId(projectReportData.getId());
-            userList = workProjectNotifyService.readByNotifyId(notify);
-            projectReportData.setStatus("1");
-            /*if ("yes".equals(flag)) {
-                String titleStr = "项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
-                String content = "项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
-                if(StringUtils.isNotBlank(projectReportData.getNumber())){
-                    titleStr = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
-                    content = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
-                }
-                str =  "报告名称:"+projectReportData.getName()+",工作内容类型:"+ WorkContentTypeController.getContentTypeName(projectReportData.getType(),"")+",项目所属部门:"+recordsOffice.getName();
-                projectReportData.setStatus("5");
+            if(!fileFlag){
+                users.add(projectReportData.getCreateBy());
                 WorkProjectNotify notify = new WorkProjectNotify();
                 notify.setNotifyId(projectReportData.getId());
                 userList = workProjectNotifyService.readByNotifyId(notify);
-                workProjectNotifyService
-                        .save(UtilNotify
-                                .saveNotify(projectReportData.getId(),
-                                        projectReportData.getCreateBy(),
-                                        projectReportData.getCompanyId(),
-                                        titleStr,
-                                        content,
-                                        "105",
-                                        "0",
-                                        "待通知",
-                                        notifyRole));
+                projectReportData.setStatus("1");
+            }else{
+                if ("yes".equals(flag)) {
 
-            } else {
-                WorkProjectNotify notify = new WorkProjectNotify();
-                notify.setNotifyId(projectReportData.getId());
-                userList = workProjectNotifyService.readByNotifyId(notify);
-                if (com.jeeplus.common.utils.StringUtils.isNotBlank(projectReportData.getStatus()) && !projectReportData.getStatus().equals("3")){
-                    projectReportData.setStatus("4");
+                    String titleStr = "项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
+                    String content = "项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
+                    if(StringUtils.isNotBlank(projectReportData.getNumber())){
+                        titleStr = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
+                        content = "报告号:"+projectReportData.getNumber()+"。项目【"+projectRecords.getProjectName()+"】报告质量复核审批通过";
+                    }
+                    str =  "报告名称:"+projectReportData.getName()+",工作内容类型:"+ WorkContentTypeController.getContentTypeName(projectReportData.getType(),"")+",项目所属部门:"+recordsOffice.getName();
+                    projectReportData.setStatus("5");
+                    WorkProjectNotify notify = new WorkProjectNotify();
+                    notify.setNotifyId(projectReportData.getId());
+                    userList = workProjectNotifyService.readByNotifyId(notify);
                     workProjectNotifyService
                             .save(UtilNotify
                                     .saveNotify(projectReportData.getId(),
                                             projectReportData.getCreateBy(),
                                             projectReportData.getCompanyId(),
-                                            title,
-                                            str,
+                                            titleStr,
+                                            content,
                                             "105",
                                             "0",
                                             "待通知",
                                             notifyRole));
+
+                } else {
+                    WorkProjectNotify notify = new WorkProjectNotify();
+                    notify.setNotifyId(projectReportData.getId());
+                    userList = workProjectNotifyService.readByNotifyId(notify);
+                    if (com.jeeplus.common.utils.StringUtils.isNotBlank(projectReportData.getStatus()) && !projectReportData.getStatus().equals("3")){
+                        projectReportData.setStatus("4");
+                        workProjectNotifyService
+                                .save(UtilNotify
+                                        .saveNotify(projectReportData.getId(),
+                                                projectReportData.getCreateBy(),
+                                                projectReportData.getCompanyId(),
+                                                title,
+                                                str,
+                                                "105",
+                                                "0",
+                                                "待通知",
+                                                notifyRole));
+                    }
                 }
+                workActivityProcessService.deleteProcessIdAuditUsers(projectReportData.getProcessInstanceId());
             }
-            workActivityProcessService.deleteProcessIdAuditUsers(projectReportData.getProcessInstanceId());*/
+
         } else {
             if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("judgementReport")) {
                 WorkProjectNotify notify = new WorkProjectNotify();

+ 1 - 1
src/main/java/com/jeeplus/modules/ruralprojectrecords/thread/JudgementThread.java

@@ -203,7 +203,7 @@ public class JudgementThread extends Thread {
             }else{
                 disposeResult = "审定单文件未找到,无文件签章";
                 bool = false;
-                notFileNotification();
+                //notFileNotification();
             }
         }catch (Exception e){
             if(StringUtils.isBlank(documentId)){