Commit 02303862 authored by wei's avatar wei 🎱

移交单流程结束,文件移交文件目录附件

parent 86e264f6
...@@ -2,22 +2,27 @@ package com.inet.dcs.document.core.factory; ...@@ -2,22 +2,27 @@ package com.inet.dcs.document.core.factory;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.inet.dcs.document.common.vo.ExtTransferDocLinkVO;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO; import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.core.constants.Constants; import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.service.ExtDocService; import com.inet.dcs.document.core.service.ExtDocService;
import com.inet.dcs.document.core.service.ExtTransferDocLinkService; import com.inet.dcs.document.core.service.ExtTransferDocLinkService;
import com.inet.dcs.document.core.util.SearchUtil; import com.inet.dcs.document.core.util.SearchUtil;
import com.inet.dcs.document.core.word.ImportWordService; import com.inet.dcs.document.core.word.ImportWordService;
import com.inet.dcs.document.entity.excel.DocPojo;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dex.basedata.data.search.SearchItem; import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.dfs.vo.ObjFileLinkVO; import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import com.yonde.dex.user.common.vo.DxUserInfoVO; import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.DxUserInfoFeign; import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO; import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -61,8 +66,9 @@ public class TransferDocumentUtils { ...@@ -61,8 +66,9 @@ public class TransferDocumentUtils {
String yjbm = extTransferDocumentVO.getDxTransferDocOrg().getName(); String yjbm = extTransferDocumentVO.getDxTransferDocOrg().getName();
jsonObject.put("yjbm", yjbm);//移交部门 jsonObject.put("yjbm", yjbm);//移交部门
SearchQueryCondition queryCondition = SearchUtil.buildQuery("targetId", SearchItem.Operator.EQ, extTransferDocumentVO.getId()); SearchQueryCondition queryCondition = SearchUtil.buildQueryWithOpenAttr("targetId", SearchItem.Operator.EQ, extTransferDocumentVO.getId(), "source");
int zfs = extTransferDocLinkService.findRecursion(queryCondition).getContent().size(); List<ExtTransferDocLinkVO> extTransferDocLinkVOList = extTransferDocLinkService.findRecursion(queryCondition).getContent();
int zfs = extTransferDocLinkVOList.size();
jsonObject.put("zfs", zfs);//总份数 jsonObject.put("zfs", zfs);//总份数
Long userId = extTransferDocumentVO.getDxTransferUserInfoId(); Long userId = extTransferDocumentVO.getDxTransferUserInfoId();
...@@ -80,7 +86,35 @@ public class TransferDocumentUtils { ...@@ -80,7 +86,35 @@ public class TransferDocumentUtils {
jsonObject.put("jsr_date", jsrDate);//接收人日期 jsonObject.put("jsr_date", jsrDate);//接收人日期
//模板名称 //模板名称
importWordService.getWordAllTable(jsonObject, path + file + ".docx", outFilePath + "outFile.docx"); importWordService.getWordAllTable(jsonObject, path + file + ".docx", outFilePath + "移交单.docx");
// [@denFileLists,0,1,1]
List<DocPojo> docList = this.getDocPojoList(extTransferDocLinkVOList);
jsonObject.put("number", extTransferDocumentVO.getNumber());
jsonObject.put("docList", docList);
//模板名称
importWordService.getWordAllTable(jsonObject, path + file + ".docx", outFilePath + "移交单文件目录.docx");
}
private List<DocPojo> getDocPojoList(List<ExtTransferDocLinkVO> extTransferDocLinkVOList) {
int i = 0;
List<DocPojo> docPojoList = Lists.newArrayList();
for (ExtTransferDocLinkVO extTransferDocLinkVO : extTransferDocLinkVOList) {
i = i + 1;
DxDocumentVO documentVO = extTransferDocLinkVO.getSource();
DocPojo docPojo = new DocPojo();
docPojo.setIndex(i + "");
docPojo.setFileNumber(documentVO.getNumber());// todo
docPojo.setFileDept(documentVO.getDxOrganization().getName());
docPojo.setFileName(documentVO.getName());
docPojo.setFileDate(documentVO.getCreateTime().toString());// todo
docPojo.setSecret(extDocService.searchDictDataByDictCode(Constants.SECRET_CODE, documentVO.getSecretCode()));
docPojo.setPageNumber(extTransferDocLinkVO.getPageNumber() + "");
docPojo.setRemark(ObjectUtils.isEmpty(documentVO.getNote()) ? "" : documentVO.getNote());
docPojoList.add(docPojo);
}
return docPojoList;
} }
/** /**
......
...@@ -305,8 +305,13 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService { ...@@ -305,8 +305,13 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
if (org.springframework.util.CollectionUtils.isEmpty(fileList)) { if (org.springframework.util.CollectionUtils.isEmpty(fileList)) {
log.error("签名----生成的word文件目录内容为空===="); log.error("签名----生成的word文件目录内容为空====");
} else { } else {
String pdfFilePath = fileList.stream().filter(item -> item.endsWith(".pdf")).findFirst().get(); //String pdfFilePath = fileList.stream().filter(item -> item.endsWith(".pdf")).findFirst().get();
extTransferDocumentService.extractedAttachFile(extTransferDocumentVO, new FileInputStream(pdfFilePath), fileName, Constants.ATTACH_FILE); for (String pdfFilePath : fileList) {
if (pdfFilePath.endsWith(".pdf")) {
fileName = pdfFilePath.split("\\.")[0];
extTransferDocumentService.extractedAttachFile(extTransferDocumentVO, new FileInputStream(pdfFilePath), fileName, Constants.ATTACH_FILE);
}
}
log.info("签名----获取生成的word文件内容结束===="); log.info("签名----获取生成的word文件内容结束====");
} }
//删除生成后的临时文件 //删除生成后的临时文件
......
package com.inet.dcs.document.entity.excel;
import lombok.Data;
/**
* @author whd
* @ClassName DocPojo.java
* @Description 文档用于生成附件的类
* @createTime 2024/11/12 16:50:00
*/
@Data
public class DocPojo {
/**
* 序号
*/
private String index;
/**
* 文文件编号:文件代号有值的文件取文件代号,文件代号没有值的文件取文件编号(或编号number)
*/
private String fileNumber;
/**
* 责任者(文件创建部门)
*/
private String fileDept;
/**
* 文件题目(文件名称)
*/
private String fileName;
/**
* 日期(文件发布日期:有流程的文件,取流程结束时间;无流程的文件,取文件创建时间)
*/
private String fileDate;
/**
* 密级(文件密级)
*/
private String secret;
/**
* 页数(文件页数)
*/
private String pageNumber;
/**
* 备注(文件本身的备注)
*/
private String remark;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment