|
@@ -2,6 +2,8 @@ package com.jeeplus.modules.ruralprojectrecords.service;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
+import com.jeeplus.common.config.Global;
|
|
|
+import com.jeeplus.common.oss.OSSClientUtil;
|
|
|
import com.jeeplus.common.service.CrudService;
|
|
|
import com.jeeplus.common.utils.IdGen;
|
|
|
import com.jeeplus.common.utils.ImageUtil;
|
|
@@ -27,6 +29,7 @@ import com.jeeplus.modules.sys.service.UserService;
|
|
|
import com.jeeplus.modules.sys.service.WorkattachmentService;
|
|
|
import com.jeeplus.modules.sys.utils.DictUtils;
|
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
+import com.jeeplus.modules.tools.utils.SignaturePostUtil;
|
|
|
import com.jeeplus.modules.tools.utils.TwoDimensionCode;
|
|
|
import com.jeeplus.modules.utils.SftpClientUtil;
|
|
|
import com.jeeplus.modules.workactivity.dao.WorkActivityProcessDao;
|
|
@@ -77,7 +80,9 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
@Autowired
|
|
|
- private RuralProjectMessageNewService ruralProjectMessageService;
|
|
|
+ private RuralProjectMessageNewService ruralProjectMessageNewService;
|
|
|
+ @Autowired
|
|
|
+ private RuralProjectMessageService ruralProjectMessageService;
|
|
|
@Autowired
|
|
|
private ProjectReportDataService projectReportDataService;
|
|
|
@Autowired
|
|
@@ -453,6 +458,116 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
vars.put("pass", true);
|
|
|
vars.put("passs", true);
|
|
|
notifyRole = "审批通过";
|
|
|
+
|
|
|
+ //下载审定单文件
|
|
|
+ String deleteFile = null;
|
|
|
+ try {
|
|
|
+ //进行签章调用
|
|
|
+ //根据项目id查询是否已经提交过了审定单签章
|
|
|
+ ProjectReportData projectReportData = projectReportDataService.getReportDataByProjectId(ruralProjectRecords.getId());
|
|
|
+ if(null == projectReportData){
|
|
|
+ return "查询不到该项目的质量复核信息";
|
|
|
+ }
|
|
|
+ if(null!= projectReportData.getSignatureFlag() && 1 == projectReportData.getSignatureFlag()){
|
|
|
+ return "该质量复核已经审定单盖章完成";
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(ruralProjectRecords.getProjectMasterId())){
|
|
|
+ return "项目负责人为空,无法进行签章";
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据项目id和附件类型的
|
|
|
+ Workattachment workClientAttachment = new Workattachment();
|
|
|
+ workClientAttachment.setAttachmentFlag("144");
|
|
|
+ workClientAttachment.setAttachmentId(ruralProjectRecords.getId());
|
|
|
+ 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);
|
|
|
+ File verticalInvalidFile = 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())){
|
|
|
+ return "请上传doc、docx或者pdf的文件进行签章操作";
|
|
|
+ }
|
|
|
+ //获取真签单的documentId
|
|
|
+ String documentId = SignaturePostUtil.getDocument(srcFile);
|
|
|
+ //获取竖版假(空白)签单的documentId
|
|
|
+ String verticalInvalidDocumentId = SignaturePostUtil.getVerticalInvalidDocument(verticalInvalidFile.getName(),verticalInvalidFile);
|
|
|
+ if("".equals(verticalInvalidDocumentId)){
|
|
|
+ return "竖版模板文件创建失败";
|
|
|
+ }
|
|
|
+ List<String> documentList = Lists.newArrayList();
|
|
|
+ List<String> invalidDocumentList = Lists.newArrayList();
|
|
|
+ documentList.add(documentId);
|
|
|
+ documentList.add(verticalInvalidDocumentId);
|
|
|
+ //documentList.add(acrossInvalidDocumentId);
|
|
|
+ invalidDocumentList.add(verticalInvalidDocumentId);
|
|
|
+ //invalidDocumentList.add(acrossInvalidDocumentId);
|
|
|
+ //将空白单的documentId存入数据库种
|
|
|
+ projectReportData.setSignatureInvalidDocumentId(String.join(",", invalidDocumentList));
|
|
|
+ //根据项目id 和 documentId生成合同id
|
|
|
+ String contractId = ruralProjectMessageService.getSignatureContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"");
|
|
|
+ if("".equals(contractId)){
|
|
|
+ return "签章文件创建失败";
|
|
|
+ }
|
|
|
+ //进行静默签署
|
|
|
+ ruralProjectMessageService.signbyCompany(contractId,documentList);
|
|
|
+ //将documentId 和contractId存储到质量复核对应的数据种
|
|
|
+ //签章完成则进行数据的保存
|
|
|
+ projectReportData.setSignatureFlag(1);
|
|
|
+ projectReportData.setSignatureDocumentId(documentId);
|
|
|
+ projectReportData.setSignatureContractId(contractId);
|
|
|
+ projectReportData.setSignatureFileName(srcFileName);
|
|
|
+ projectReportData.setSignatureUploadFileUser(UserUtils.getUser());
|
|
|
+ projectReportData.setSignatureUploadDate(new Date());
|
|
|
+ //修改签章对应信息文件
|
|
|
+ projectReportDataService.updateSignatureInfo(projectReportData);
|
|
|
+ }else{
|
|
|
+ return "审定单文件未找到,无法进行签章操作";
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }finally {
|
|
|
+ if(StringUtils.isNotBlank(deleteFile)){
|
|
|
+ //根据路径创建文件对象
|
|
|
+ File file = new File(deleteFile);
|
|
|
+ //路径是个文件且不为空时删除文件
|
|
|
+ if(file.isFile()&&file.exists()){
|
|
|
+ file.delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
workActivityProcess.setIsApproval("2");
|
|
|
vars.put("pass", false);
|
|
@@ -1004,6 +1119,102 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
vars.put("pass", true);
|
|
|
vars.put("passs", true);
|
|
|
notifyRole = "审批通过";
|
|
|
+
|
|
|
+ //下载审定单文件
|
|
|
+ String deleteFile = null;
|
|
|
+ try {
|
|
|
+ //进行签章调用
|
|
|
+ //根据项目id查询是否已经提交过了审定单签章
|
|
|
+ if(null == ruralProjectRecords){
|
|
|
+ return "查询不到该项目信息";
|
|
|
+ }
|
|
|
+ if(null!= ruralProjectRecords.getReportSignatureFlag() && 1 == ruralProjectRecords.getReportSignatureFlag()){
|
|
|
+ return "该项目已经报告盖章完成";
|
|
|
+ }
|
|
|
+ if(StringUtils.isBlank(ruralProjectRecords.getProjectMasterId())){
|
|
|
+ return "项目负责人为空,无法进行签章";
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据项目id和附件类型的
|
|
|
+ Workattachment workClientAttachment = new Workattachment();
|
|
|
+ workClientAttachment.setAttachmentFlag("145");
|
|
|
+ workClientAttachment.setAttachmentId(ruralProjectRecords.getId());
|
|
|
+ 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())){
|
|
|
+ return "请上传doc、docx或者pdf的文件进行签章操作";
|
|
|
+ }
|
|
|
+ //获取真签单的documentId
|
|
|
+ String documentId = SignaturePostUtil.getDocument(srcFile);
|
|
|
+ List<String> documentList = Lists.newArrayList();
|
|
|
+ documentList.add(documentId);
|
|
|
+ //根据项目id 和 documentId生成合同id
|
|
|
+ String contractId = ruralProjectMessageService.getReportSignatureContractId(ruralProjectRecords.getId(), documentList,ruralProjectRecords.getProjectMasterId(),"");
|
|
|
+ if("".equals(contractId)){
|
|
|
+ return "签章文件创建失败";
|
|
|
+ }
|
|
|
+ //进行静默签署
|
|
|
+ ruralProjectMessageService.signbyCompanyByKeyWord(contractId,documentList);
|
|
|
+ //将documentId 和contractId存储到质量复核对应的数据种
|
|
|
+ //签章完成则进行数据的保存
|
|
|
+ ruralProjectRecords.setReportSignatureFlag(1);
|
|
|
+ ruralProjectRecords.setReportSignatureDocumentId(documentId);
|
|
|
+ ruralProjectRecords.setReportSignatureContractId(contractId);
|
|
|
+ ruralProjectRecords.setReportSignatureFileName(srcFileName);
|
|
|
+ ruralProjectRecords.setReportSignatureUploadFileUser(UserUtils.getUser());
|
|
|
+ ruralProjectRecords.setReportSignatureUploadDate(new Date());
|
|
|
+ //修改签章对应信息文件
|
|
|
+ projectReportDataService.updateReportSignatureInfo(ruralProjectRecords);
|
|
|
+ }else{
|
|
|
+ return "审定单文件未找到,无法进行签章操作";
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }finally {
|
|
|
+ if(StringUtils.isNotBlank(deleteFile)){
|
|
|
+ //根据路径创建文件对象
|
|
|
+ File file = new File(deleteFile);
|
|
|
+ //路径是个文件且不为空时删除文件
|
|
|
+ if(file.isFile()&&file.exists()){
|
|
|
+ file.delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
workActivityProcess.setIsApproval("2");
|
|
|
vars.put("pass", false);
|
|
@@ -1316,7 +1527,7 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
RuralReportConsultant bzshbConsultant = new RuralReportConsultant();
|
|
|
List<WorkStaffCertificate> userCertificateList = Lists.newArrayList();
|
|
|
if(StringUtils.isNotBlank(ruralProjectRecords.getProjectMasterId())){
|
|
|
- userCertificateList = ruralProjectMessageService.getCertificateByUser(ruralProjectRecords.getProjectMasterId());
|
|
|
+ userCertificateList = ruralProjectMessageNewService.getCertificateByUser(ruralProjectRecords.getProjectMasterId());
|
|
|
}
|
|
|
//获取专业类型
|
|
|
List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("certificate_major");
|
|
@@ -1335,7 +1546,7 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
consultants.add(currentConsultant);
|
|
|
}
|
|
|
//根据项目id查找报告咨询员信息
|
|
|
- List<RuralReportConsultant> consultantList = ruralProjectMessageService.getConsultantsList(ruralProjectRecords.getId());
|
|
|
+ List<RuralReportConsultant> consultantList = ruralProjectMessageNewService.getConsultantsList(ruralProjectRecords.getId());
|
|
|
Iterator<RuralReportConsultant> it = consultantList.iterator();
|
|
|
while(it.hasNext()){
|
|
|
RuralReportConsultant consultant = it.next();
|
|
@@ -1349,7 +1560,7 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
}
|
|
|
it.remove();
|
|
|
}else if(consultant.getZixunyuan().equals(projectReportData.getBzshbUserId())){
|
|
|
- List<WorkStaffCertificate> bzshbCertificateList = ruralProjectMessageService.getCertificateByUser(projectReportData.getBzshbUserId());
|
|
|
+ List<WorkStaffCertificate> bzshbCertificateList = ruralProjectMessageNewService.getCertificateByUser(projectReportData.getBzshbUserId());
|
|
|
for (WorkStaffCertificate certificateInfo: bzshbCertificateList) {
|
|
|
bzshbConsultant.setZhucezigezhID(certificateInfo.getNum());
|
|
|
bzshbConsultant.setZhucezigezhKey(certificateInfo.getName());
|
|
@@ -1371,7 +1582,7 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
it.remove();
|
|
|
}else{
|
|
|
//根据用户查询技能信息
|
|
|
- List<WorkStaffCertificate> certificateList = ruralProjectMessageService.getCertificateByUser(consultant.getZixunyuan());
|
|
|
+ List<WorkStaffCertificate> certificateList = ruralProjectMessageNewService.getCertificateByUser(consultant.getZixunyuan());
|
|
|
for (WorkStaffCertificate certificateInfo: certificateList) {
|
|
|
if(certificateInfo.getName().equals(consultant.getZhucezigezhKey())){
|
|
|
consultant.setZhucezigezhID(certificateInfo.getNum());
|
|
@@ -1489,7 +1700,7 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
data.put("zixunyuanName",consultantUser.getName());
|
|
|
data.put("consultantProfession1","");
|
|
|
data.put("consultantQualification1","");
|
|
|
- List<WorkStaffCertificate> certificateByUser = ruralProjectMessageService.getCertificateByUser(consultantUser.getId());
|
|
|
+ List<WorkStaffCertificate> certificateByUser = ruralProjectMessageNewService.getCertificateByUser(consultantUser.getId());
|
|
|
for (WorkStaffCertificate certificateInfo: certificateByUser) {
|
|
|
consultantUserConsultant.setZhucezigezhID(certificateInfo.getNum());
|
|
|
consultantUserConsultant.setZhucezigezhKey(certificateInfo.getName());
|
|
@@ -1951,7 +2162,7 @@ public class RuralProjectMessageElectronicSealService extends CrudService<RuralP
|
|
|
workattachment.setProjectId(ruralProjectRecords.getId());
|
|
|
workattachment.setUrl(uploadPath);
|
|
|
workattachment.setType("docx");
|
|
|
- workattachment.setAttachmentFlag("199");
|
|
|
+ workattachment.setAttachmentFlag("145");
|
|
|
workattachment.setAttachmentName(ruralProjectRecords.getProjectName() + "报告签章.docx");
|
|
|
workattachment.setAttachmentUser(UserUtils.getUser().getId());
|
|
|
|