|
@@ -14,11 +14,13 @@ import com.jeeplus.flowable.model.Flow;
|
|
|
import com.jeeplus.flowable.service.FlowTaskService;
|
|
|
import com.jeeplus.sys.utils.Global;
|
|
|
import com.jeeplus.sys.utils.SpringContextHolder;
|
|
|
+import com.jeeplus.sys.utils.UserUtils;
|
|
|
import com.jeeplus.test.cw.common.flowable.dto.CommitParamDTO;
|
|
|
import com.jeeplus.test.cw.projectRecords.domain.CwProjectRecords;
|
|
|
import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
|
|
|
import com.jeeplus.test.cw.projectReport.domain.CwProjectReport;
|
|
|
import com.jeeplus.test.cw.projectReport.domain.CwProjectReportData;
|
|
|
+import com.jeeplus.test.cw.projectReport.domain.CwProjectReportFile;
|
|
|
import com.jeeplus.test.cw.projectReport.domain.CwProjectReportSignature;
|
|
|
import com.jeeplus.test.cw.projectReport.mapper.CwProjectReportMapper;
|
|
|
import com.jeeplus.test.cw.projectReport.mapper.CwProjectReportSignatureMapper;
|
|
@@ -26,6 +28,7 @@ import com.jeeplus.test.cw.projectReport.mapper.ProjectReportWorkAttachmentMappe
|
|
|
import com.jeeplus.test.cw.projectReport.service.CwProjectReportService;
|
|
|
import com.jeeplus.test.cw.projectReport.service.dto.CwProjectReportSignatureDTO;
|
|
|
import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
|
+import com.jeeplus.test.oss.mapper.OssServiceMapper;
|
|
|
import com.jeeplus.test.oss.service.OSSClientService;
|
|
|
import com.jeeplus.test.signature.domain.PresignCallBack;
|
|
|
import com.jeeplus.test.signature.utils.SignaturePostUtil;
|
|
@@ -64,6 +67,7 @@ public class CwProjectReportSignatureCallBackController {
|
|
|
|
|
|
private CwProjectReportService cwProjectReportService = SpringContextHolder.getBean(CwProjectReportService.class);
|
|
|
private OSSClientService ossClientService = SpringContextHolder.getBean(OSSClientService.class);
|
|
|
+ private OssServiceMapper ossServiceMapper = SpringContextHolder.getBean(OssServiceMapper.class);
|
|
|
private CwProjectReportSignatureMapper cwProjectReportSignatureMapper = SpringContextHolder.getBean(CwProjectReportSignatureMapper.class);
|
|
|
private ProjectReportWorkAttachmentMapper attachmentMapper = SpringContextHolder.getBean(ProjectReportWorkAttachmentMapper.class);
|
|
|
private CwProjectReportMapper reportMapper = SpringContextHolder.getBean(CwProjectReportMapper.class);
|
|
@@ -267,40 +271,74 @@ public class CwProjectReportSignatureCallBackController {
|
|
|
|
|
|
File[] unZipFileList = unZipFile.listFiles();
|
|
|
|
|
|
- for (File f : unZipFileList) {
|
|
|
- String filepath = "";
|
|
|
- //取得上传文件
|
|
|
- //将文件上传到oss云盘中
|
|
|
- MultipartFile cMultiFile = new MockMultipartFile("file", f.getName(), null, new FileInputStream(f));
|
|
|
- if (cMultiFile != null && !cMultiFile.isEmpty()) {
|
|
|
- // 文件保存路径
|
|
|
- String realPath =DIRECTORY.replace("/","")+"/cw_project_report_file"+ossClientService.datePath()+"/"+ System.currentTimeMillis();
|
|
|
- //文件原名称
|
|
|
- String newName = cMultiFile.getOriginalFilename();
|
|
|
- newName = newName.substring(13, newName.length());
|
|
|
- ossClientService.uploadFile2OSS(cMultiFile.getInputStream(),realPath,newName);
|
|
|
- filepath = "/" + realPath + newName;
|
|
|
- }
|
|
|
-
|
|
|
- System.out.println(f.getName());
|
|
|
- //截取文件后缀名
|
|
|
- String substring = f.getName().substring(f.getName().lastIndexOf(".")+1, f.getName().length());
|
|
|
- //遍历该contractId对应的报告信息,将报告信息中的附件地址进行替换
|
|
|
-
|
|
|
- //查询报告文件信息(电子章)
|
|
|
- List<WorkAttachment> fileList = attachmentMapper.selectWorkAttachmentByReportId(projectReportData.getId());
|
|
|
- if(fileList.size()>0){
|
|
|
- for (WorkAttachment workattachment : fileList) {
|
|
|
- //根据url截取文件名成
|
|
|
- String workattachmentName = workattachment.getUrl().substring(workattachment.getUrl().lastIndexOf("/")+1, workattachment.getUrl().length());
|
|
|
-
|
|
|
- if(f.getName().contains(workattachmentName)){
|
|
|
- workattachment.setUrl(filepath);
|
|
|
- workattachment.setType(substring);
|
|
|
- workattachment.setAttachmentName(f.getName());
|
|
|
- attachmentMapper.updateByIdOnSignature(workattachment);
|
|
|
+ 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.replace("/","")+"/cw_project_report_file"+ossClientService.datePath()+"/"+ System.currentTimeMillis();
|
|
|
+ //文件原名称
|
|
|
+ String newName = cMultiFile.getOriginalFilename();
|
|
|
+ if(StringUtils.isNotBlank(newName)){
|
|
|
+ newName = newName.substring(13, newName.length());
|
|
|
+ ossClientService.uploadFile2OSS(cMultiFile.getInputStream(),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("cw_project_report_file");
|
|
|
+ workattachment.setFileSize(String.valueOf(f.length()));
|
|
|
+ workattachment.setAttachmentId(projectReportData.getId());
|
|
|
+ workattachment.setAttachmentType("");
|
|
|
+ String id = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ workattachment.setId(id);
|
|
|
+ workattachment.setCreateDate(new Date());
|
|
|
+ workattachment.setUpdateDate(new Date());
|
|
|
+ ossServiceMapper.insert(workattachment);
|
|
|
+
|
|
|
+ //将附件信息添加到签章附件信息表中
|
|
|
+ CwProjectReportFile cwProjectReportFile = new CwProjectReportFile();
|
|
|
+ cwProjectReportFile.setDelFlag(0);
|
|
|
+ cwProjectReportFile.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ cwProjectReportFile.setCreateBy(UserUtils.getByLoginName("admin").getId());
|
|
|
+ cwProjectReportFile.setUpdateBy(UserUtils.getByLoginName("admin").getId());
|
|
|
+ cwProjectReportFile.setCreateDate(new Date());
|
|
|
+ cwProjectReportFile.setUpdateDate(new Date());
|
|
|
+ cwProjectReportFile.setReportFileId(id);
|
|
|
+ cwProjectReportFile.setFileAffiliation("1");
|
|
|
+ cwProjectReportService.insertProjectReportFile(cwProjectReportFile);
|
|
|
+ //遍历该contractId对应的报告信息,将报告信息中的附件地址进行替换
|
|
|
+
|
|
|
+ //查询报告文件信息(电子章)
|
|
|
+ /*List<WorkAttachment> fileList = attachmentMapper.selectWorkAttachmentByReportId(projectReportData.getId());
|
|
|
+ if(fileList.size()>0){
|
|
|
+ for (WorkAttachment workattachment : fileList) {
|
|
|
+ //根据url截取文件名成
|
|
|
+ String workattachmentName = workattachment.getUrl().substring(workattachment.getUrl().lastIndexOf("/")+1, workattachment.getUrl().length());
|
|
|
+
|
|
|
+ if(f.getName().contains(workattachmentName)){
|
|
|
+ workattachment.setUrl(filepath);
|
|
|
+ workattachment.setType(substring);
|
|
|
+ workattachment.setAttachmentName(f.getName());
|
|
|
+ attachmentMapper.updateByIdOnSignature(workattachment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
}
|
|
|
}
|
|
|
|