Commit b588106a authored by wangyangyang's avatar wangyangyang

文档 图册:回写ied计划状态

parent ddc7d431
......@@ -228,6 +228,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
*
* @param documentVO
*/
@SneakyThrows
@Override
@Transactional(rollbackFor = Exception.class)
public void extChangeDocState(DxDocumentVO documentVO, String state) {
......@@ -239,9 +240,10 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
List<ExtAtlasDrawingLinkVO> drawingLinks = this.recursionAtlasDoc(documentVO.getVersionId());
String docState = documentVO.getState();
String finalState = state;
drawingLinks.stream().forEach(item -> {
DxDocumentVO doc = new DxDocumentVO();
BeanUtils.copyProperties(item.getTarget(), doc);
List<ExtCatalogExcelVO> excelVOS = new ArrayList<>();
for (int i = 0; i < drawingLinks.size(); i++) {
ExtAtlasDrawingLinkVO item = drawingLinks.get(i);
DxDocumentVO doc = item.getTarget();
if (Constants.PENDING_REVIEW.equals(doc.getState()) || docState.equals(doc.getState())) {
doc.setState(finalState);
//设置修改人和时间不变
......@@ -249,9 +251,35 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
doc.markModifyTimeHold();
documentService.changeStatus(doc);
}
});
//TODO 收集图纸信息
ExtCatalogExcelVO catalogExcelVO = new ExtCatalogExcelVO();
catalogExcelVO.setIndex(String.valueOf(i + 1));
catalogExcelVO.setName(doc.getName());
catalogExcelVO.setVersionKey(doc.getVersionKey());
catalogExcelVO.setDrawNumber(String.valueOf(doc.getDynamicAttrs().get("drawNumber")));
catalogExcelVO.setPictureFrame(String.valueOf(doc.getDynamicAttrs().get("pictureFrame")));
excelVOS.add(catalogExcelVO);
}
//TODO 图册生成图纸信息
String dir = ResourceHelper.createTemDir().getPath();
String filePath = dir + "\\图册.xlsx";
EasyExcel.write(filePath, ExtCatalogExcelVO.class)
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
.sheet("图册").doWrite(excelVOS);
//转pdf
String pdfName = "图册.pdf";
String filePdfPath = dir + File.separator + pdfName;
ExcelUtils.Ex2PDF(filePath, filePdfPath);
//上传文件到文件服务器
MultipartFile multipartFile = null;
multipartFile = new MockMultipartFile("file", pdfName, com.yonde.dcs.plan.common.constants.Constants.CONTENT_TYPE_PDF, new FileInputStream(filePdfPath));
RepoFileVO fileVO = fileManagerFeignService.uploadFile(multipartFile, CommonUtil.getBucketIdByAppName(com.yonde.dcs.document.core.constants.Constants.APPLICATION_DOC_INNER_NAME));
ObjFileLinkUtil.addFile(documentVO, fileVO, com.yonde.dcs.plan.common.constants.Constants.ATTACH_FILE);
documentVO.setOperator(OperatorType.MODIFY);
documentVO = (DxDocumentVO) documentService.saveRecursion(documentVO);
FileUtil.del(dir);
// generateCatalog(documentVO.getId());
//TODO 判断该文档关联IED计划下所有的文档状态是否为已完成,已完成则回写IED计划状态----一个IED计划对应一个图册,直接修改计划状态即可
generateCatalog(documentVO.getId());
SearchQueryCondition query = SearchUtil.buildQuery("targetId", SearchItem.Operator.EQ, documentVO.getId());
DxPageImpl iedPage = extIEDPlanDocLinkServiceFeign.findRecursion(query);
ExtIEDPlanDocLinkVO extIEDPlanDocLinkVO = (ExtIEDPlanDocLinkVO) iedPage.getContent().get(0);
......
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