Commit 1cb95188 authored by pchxue's avatar pchxue

迁移问题处理

parent 52ecd47a
package com.yonde.dcs.core.controller;
import com.yonde.dcs.common.vo.ExtReviseVersionVO;
import com.yonde.dcs.core.service.ExtDocService;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.entity.po.ExtAtlasDrawingLink;
import com.yonde.dex.basedata.entity.api.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @program: inet-pdm-service
* @description: 客制化文档接口
* @author: dang wei
* @create: 2021-09-18 13:38
*/
@Api(tags = {"客制化文档信息接口"})
@RestController
@RequestMapping({"/DxDocument/ext"})
//@BasePermission("DCS-DOC:Doc")
public class ExtDocController {
@Autowired
private ExtDocService extDocService;
/**
* 版本升级
*
* @param id
* @param reviseVersionVO
* @return
*/
@ApiOperation("版本升级")
@PostMapping({"/version/{id}/revise"})
// @SubPermission({"versionRevise"})
public ApiResult reviseDocVersion(@PathVariable Long id, @RequestBody ExtReviseVersionVO reviseVersionVO) {
DxDocumentVO dxDocumentVO = extDocService.reviseDocVersion(id, reviseVersionVO);
return ApiResult.ok(dxDocumentVO, "升版成功");
}
/**
* 内部接口提交审阅按钮业务
*
* @param id
* @return
*/
@ApiOperation("内部接口提交审阅按钮")
@PostMapping("/submitProcess/{id}")
public ApiResult submitReview(@PathVariable Long id) {
DxDocumentVO dxDocumentVO = extDocService.submitReview(id);
return ApiResult.ok(dxDocumentVO, "提交审阅成功!");
}
/**
* 批量下载图册
*
* @param response
* @param id
* @throws IOException
*/
@ApiOperation(value = "批量下载", notes = "批量下载", httpMethod = "GET")
@GetMapping(value = "/batchDownloadDoc")
public void batchDownloadDoc(HttpServletResponse response, @RequestParam("id") Long id) throws IOException {
extDocService.batchDownloadDoc(response, id);
}
/**
* 校验图册图纸
*
* @param drawingLinkList
*/
@ApiOperation(value = "校验图册图纸", notes = "校验图册图纸", httpMethod = "POST")
@PostMapping(value = "/checkAtlas")
public ApiResult checkAtlas(@RequestBody List<ExtAtlasDrawingLink> drawingLinkList) {
String message = extDocService.checkAtlas(drawingLinkList);
return ApiResult.ok(message);
}
/**
* 更新文件申请及相关单据
*
* @param documentVO
* @return
*/
@ApiOperation(value = "更新文件申请及相关单据", notes = "更新文件申请及相关单据", httpMethod = "POST")
@PostMapping(value = "/updateDocApplication")
public ApiResult updateDocApplication(@RequestBody DxDocumentVO documentVO) {
DxDocumentVO dxDocumentVO = extDocService.updateDocApplication(documentVO);
return ApiResult.ok(dxDocumentVO);
}
@ApiOperation(value = "获取升版的图册图纸", notes = "获取升版的图册图纸", httpMethod = "POST")
@PostMapping(value = "/upgradeAtlasDrawing")
public ApiResult getUpgradeAtlasDrawingList(@RequestBody DxDocumentVO documentVO) {
List<DxDocumentVO> atlasDrawingList = extDocService.getUpgradeAtlasDrawingList(documentVO);
return ApiResult.ok(atlasDrawingList);
}
}
...@@ -4,6 +4,7 @@ import com.yonde.dcs.common.vo.ExtAtlasDrawingLinkVO; ...@@ -4,6 +4,7 @@ import com.yonde.dcs.common.vo.ExtAtlasDrawingLinkVO;
import com.yonde.dcs.common.vo.ExtReviseVersionVO; import com.yonde.dcs.common.vo.ExtReviseVersionVO;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.entity.po.ExtAtlasDrawingLink; import com.yonde.dcs.entity.po.ExtAtlasDrawingLink;
import com.yonde.dex.wfc.common.vo.DxWfActivityVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO; import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -111,27 +112,28 @@ public interface ExtDocService { ...@@ -111,27 +112,28 @@ public interface ExtDocService {
* @param wfProcessInfoVO * @param wfProcessInfoVO
* @param fileName * @param fileName
*/ */
// TODO: 2024/7/31 2.1有WfProcessInfoVO 4.1没有这个VO void generateDocWordSign(DxDocumentVO documentVo, Class classType, DxWfProcessInfoVO wfProcessInfoVO, String fileName);
// void generateDocWordSign(DxDocumentVO documentVo, Class classType, WfProcessInfoVO wfProcessInfoVO, String fileName);
// TODO: 2024/7/31 2.1有WfTaskDefinitionVO 4.1没有这个VO /**
// /** * 获取签名图片
// * 获取签名图片 *
// * * @param activities
// * @param activities * @param activityName
// * @param activityName * @return
// * @return */
// */ // TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
// String getSignImage(List<WfTaskDefinitionVO> activities, String activityName); String getSignImage(List<DxWfActivityVO> activities, String activityName);
//
// /** /**
// * 获取签名日期 * 获取签名日期
// * *
// * @param activities * @param activities
// * @param activityName * @param activityName
// * @return * @return
// */ */
// String getEndDate(List<WfTaskDefinitionVO> activities, String activityName); // TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
String getEndDate(List<DxWfActivityVO> activities, String activityName);
Boolean validate(DxDocumentVO documentVO); Boolean validate(DxDocumentVO documentVO);
...@@ -143,8 +145,6 @@ public interface ExtDocService { ...@@ -143,8 +145,6 @@ public interface ExtDocService {
*/ */
List<ExtAtlasDrawingLinkVO> recursionAtlasDoc(Long id); List<ExtAtlasDrawingLinkVO> recursionAtlasDoc(Long id);
void generateDocWordSign(DxDocumentVO documentVo, Class classType, DxWfProcessInfoVO wfProcessInfoVO, String fileName);
/** /**
* 获取升版的图册图纸 * 获取升版的图册图纸
* *
......
...@@ -9,9 +9,11 @@ import com.yonde.dcs.common.vo.ExtAtlasDrawingLinkVO; ...@@ -9,9 +9,11 @@ import com.yonde.dcs.common.vo.ExtAtlasDrawingLinkVO;
import com.yonde.dcs.common.vo.ExtObsoleteDocLinkVO; import com.yonde.dcs.common.vo.ExtObsoleteDocLinkVO;
import com.yonde.dcs.common.vo.ExtReviseVersionVO; import com.yonde.dcs.common.vo.ExtReviseVersionVO;
import com.yonde.dcs.core.constants.Constants; import com.yonde.dcs.core.constants.Constants;
import com.yonde.dcs.core.constants.SignConstants;
import com.yonde.dcs.core.service.ExtAtlasDrawingLinkService; import com.yonde.dcs.core.service.ExtAtlasDrawingLinkService;
import com.yonde.dcs.core.service.ExtDocService; import com.yonde.dcs.core.service.ExtDocService;
import com.yonde.dcs.core.service.ExtObsoleteDocLinkService; import com.yonde.dcs.core.service.ExtObsoleteDocLinkService;
import com.yonde.dcs.core.service.ExtSerialNumberService;
import com.yonde.dcs.core.util.CommonUtil; import com.yonde.dcs.core.util.CommonUtil;
import com.yonde.dcs.core.util.ExtDocUtil; import com.yonde.dcs.core.util.ExtDocUtil;
import com.yonde.dcs.core.util.FileUtils; import com.yonde.dcs.core.util.FileUtils;
...@@ -41,10 +43,16 @@ import com.yonde.dex.dfs.vo.RepoFileVO; ...@@ -41,10 +43,16 @@ import com.yonde.dex.dfs.vo.RepoFileVO;
import com.yonde.dex.dfs.vo.view.FileDownLoadInfoVO; import com.yonde.dex.dfs.vo.view.FileDownLoadInfoVO;
import com.yonde.dex.dict.feign.DictDataFeignService; import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO; import com.yonde.dex.dict.service.vo.DictDataVO;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.user.feign.SwitchUserService; import com.yonde.dex.user.feign.SwitchUserService;
import com.yonde.dex.version.plugin.common.entity.DxVersionVO;
import com.yonde.dex.version.plugin.core.service.VersionService; import com.yonde.dex.version.plugin.core.service.VersionService;
import com.yonde.dex.version.plugin.entities.DxVersion; import com.yonde.dex.version.plugin.entities.DxVersion;
import com.yonde.dex.wfc.common.enums.TaskStateEnum;
import com.yonde.dex.wfc.common.vo.DxWfActivityVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO; import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign; import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -62,6 +70,8 @@ import javax.servlet.http.HttpServletResponse; ...@@ -62,6 +70,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -109,18 +119,18 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -109,18 +119,18 @@ public class ExtDocServiceImpl implements ExtDocService {
@Autowired @Autowired
private ObjFileLinkService objFileLinkService; private ObjFileLinkService objFileLinkService;
// TODO: xpc DocConvertService不存在 且未被使用
// TODO: 2024/8/1 DocConvertService不存在
// @Autowired // @Autowired
// DocConvertService docConvertService; // DocConvertService docConvertService;
@Autowired @Autowired
private ExtDocUtil extDocUtil; private ExtDocUtil extDocUtil;
//生成过时文件通知单编码 //生成过时文件通知单编码
// @Autowired
// private SerialNumberService serialNumberService; @Autowired
// private ExtSerialNumberService serialNumberService;
// @Autowired
// private IUserService userService; @Autowired
private DxUserInfoFeign userService;
@Override @Override
public Boolean validate(DxDocumentVO documentVO) { public Boolean validate(DxDocumentVO documentVO) {
...@@ -148,7 +158,7 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -148,7 +158,7 @@ public class ExtDocServiceImpl implements ExtDocService {
DxDocumentVO dxDocumentVO; DxDocumentVO dxDocumentVO;
// 切换用户(升版后创建人保持不变) // 切换用户(升版后创建人保持不变)
try { try {
// TODO: 2024/8/2 将String userAccount = currentDoc.getCreator().getAccount();修改成 Long userId = currentDoc.getCreator().getUserId(); // TODO: xpc 将String userAccount = currentDoc.getCreator().getAccount();修改成 Long userId = currentDoc.getCreator().getUserId();
Long userId = currentDoc.getCreator().getUserId(); Long userId = currentDoc.getCreator().getUserId();
changeUserHelper.switchUser(userId); changeUserHelper.switchUser(userId);
//切换后升版 //切换后升版
...@@ -274,11 +284,7 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -274,11 +284,7 @@ public class ExtDocServiceImpl implements ExtDocService {
*/ */
@Override @Override
public List<ExtAtlasDrawingLinkVO> recursionAtlasDoc(Long id) { public List<ExtAtlasDrawingLinkVO> recursionAtlasDoc(Long id) {
SearchQueryCondition condition = SearchQueryCondition.builder() SearchQueryCondition condition = SearchQueryCondition.builder().openProp(SearchQueryCondition.builder().name("target").openProp(SearchQueryCondition.builder().name("objFileLinks").openProp(SearchQueryCondition.builder().name("target").build()).build()).build()).searchItems(SearchItems.builder().item(new SearchItem("sourceId", SearchItem.Operator.EQ, id, null)).build()).build();
.openProp(SearchQueryCondition.builder().name("target")
.openProp(SearchQueryCondition.builder().name("objFileLinks").openProp(SearchQueryCondition.builder().name("target").build()).build()).build())
.searchItems(SearchItems.builder()
.item(new SearchItem("sourceId", SearchItem.Operator.EQ, id, null)).build()).build();
DxPageImpl recursion = atlasDrawingLinkService.findRecursion(condition); DxPageImpl recursion = atlasDrawingLinkService.findRecursion(condition);
if (!ObjectUtils.isEmpty(recursion)) { if (!ObjectUtils.isEmpty(recursion)) {
return recursion.getContent(); return recursion.getContent();
...@@ -297,10 +303,14 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -297,10 +303,14 @@ public class ExtDocServiceImpl implements ExtDocService {
sourceDoc.setPredecessorId(null); sourceDoc.setPredecessorId(null);
newViewDoc = ObjectUtil.cloneByStream(sourceDoc); newViewDoc = ObjectUtil.cloneByStream(sourceDoc);
Long targetViewId = 2L; Long targetViewId = 2L;
DxVersion newVersionVo = new DxVersion(); DxVersionVO newVersionVo = new DxVersionVO();
// TODO: xpc clearPersistInfo方法不存在,根据2.1摘抄过来
// TODO: 2024/8/1 clearPersistInfo方法不存在 // newVersionVo.clearPersistInfo();
// newVersionVo.clearPersistInfo(); newVersionVo.setId((Long) null);
newVersionVo.setCreateTime((LocalDateTime) null);
newVersionVo.setCreatorId((Long) null);
newVersionVo.setModifyTime((LocalDateTime) null);
newVersionVo.setModifierId((Long) null);
String nextVersionKey = documentService.getNextVersionOfLatestVersion(sourceDoc.getId(), (Long) null, targetViewId); String nextVersionKey = documentService.getNextVersionOfLatestVersion(sourceDoc.getId(), (Long) null, targetViewId);
newVersionVo.setVersionKey(nextVersionKey); newVersionVo.setVersionKey(nextVersionKey);
newVersionVo.setVersionSeries(sourceDoc.getVersion().getVersionSeries()); newVersionVo.setVersionSeries(sourceDoc.getVersion().getVersionSeries());
...@@ -308,16 +318,35 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -308,16 +318,35 @@ public class ExtDocServiceImpl implements ExtDocService {
newVersionVo.setSubTypeName(DxEntityUtils.getModelName(newVersionVo.getClass())); newVersionVo.setSubTypeName(DxEntityUtils.getModelName(newVersionVo.getClass()));
newVersionVo.setMasterId(sourceDoc.getMasterId()); newVersionVo.setMasterId(sourceDoc.getMasterId());
newVersionVo.setPredecessorId(sourceDoc.getId()); newVersionVo.setPredecessorId(sourceDoc.getId());
newVersionVo = (DxVersion) versionService.save((IdVO) newVersionVo, true); newVersionVo = (DxVersionVO) versionService.save((IdVO) newVersionVo, true);
// TODO: 2024/8/1 DxIterationVO不存在 // TODO: xpc DxIterationVO不存在,听同事说此方法已被弃用
// newViewDoc = DcsBuilder.of(newViewDoc).with(IdVO::setSubTypeName, sourceDoc.getSubTypeName()).with(DxIterationVO::setMaster, sourceDoc.getMaster()) // newViewDoc = DcsBuilder.of(newViewDoc).with(IdVO::setSubTypeName, sourceDoc.getSubTypeName())
// .with(DxIterationVO::setLatest, true).with(DxIterationVO::setCheckOuted, false).work(IdVO::clearPersistInfo).with(DxObjectVo::setDxContextId, sourceDoc.getDxContextId()) // .with(DxIterationVO::setMaster, sourceDoc.getMaster())
// .with(DxIterationVO::setLatest, true)
// .with(DxIterationVO::setCheckOuted, false)
// .work(IdVO::clearPersistInfo)
// .with(DxObjectVo::setDxContextId, sourceDoc.getDxContextId())
// .with(DxIterationVO::setVersionKey, nextVersionKey) // .with(DxIterationVO::setVersionKey, nextVersionKey)
// .with(DxIterationVO::setIterationId, "1") // .with(DxIterationVO::setIterationId, "1")
// .with(DxIterationVO::setVersion, newVersionVo) // .with(DxIterationVO::setVersion, newVersionVo)
// .with(DxIterationVO::setVersionId, newVersionVo.getId()) // .with(DxIterationVO::setVersionId, newVersionVo.getId())
// .with(DxIterationVO::setOriginId, sourceDoc.getId()).build(); // .with(DxIterationVO::setOriginId, sourceDoc.getId()).build();
// newViewDoc.setPhaseState(phaseState); newViewDoc.setSubTypeName(sourceDoc.getSubTypeName());
newViewDoc.setMaster(sourceDoc.getMaster());
newViewDoc.setLatest(true);
newViewDoc.setCheckOuted(false);
newViewDoc.setId((Long) null);
newViewDoc.setCreateTime((LocalDateTime) null);
newViewDoc.setCreatorId((Long) null);
newViewDoc.setModifyTime((LocalDateTime) null);
newViewDoc.setModifierId((Long) null);
newViewDoc.setDxContextId(sourceDoc.getDxContextId());
newViewDoc.setVersionKey(nextVersionKey);
newViewDoc.setIterationId("1");
newViewDoc.setVersion(newVersionVo);
newViewDoc.setVersionId(newVersionVo.getId());
newViewDoc.setOriginId(sourceDoc.getId());
newViewDoc.getDxDocumentExpand().setPhaseState(phaseState);
newViewDoc = (DxDocumentVO) documentService.save(newViewDoc); newViewDoc = (DxDocumentVO) documentService.save(newViewDoc);
return newViewDoc; return newViewDoc;
} }
...@@ -423,8 +452,7 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -423,8 +452,7 @@ public class ExtDocServiceImpl implements ExtDocService {
private void extFindFileIds(List<Long> fileIds, List<ObjFileLinkVO> objFileLinks, String fileType) { private void extFindFileIds(List<Long> fileIds, List<ObjFileLinkVO> objFileLinks, String fileType) {
if (!CollectionUtils.isEmpty(objFileLinks)) { if (!CollectionUtils.isEmpty(objFileLinks)) {
//遍历取主内容的文件id //遍历取主内容的文件id
List<ObjFileLinkVO> objFileLinkVOs = List<ObjFileLinkVO> objFileLinkVOs = objFileLinks.stream().filter(n -> n.getContentType().equals(fileType)).collect(Collectors.toList());
objFileLinks.stream().filter(n -> n.getContentType().equals(fileType)).collect(Collectors.toList());
objFileLinkVOs.stream().forEach(o -> { objFileLinkVOs.stream().forEach(o -> {
fileIds.add(o.getTargetId()); fileIds.add(o.getTargetId());
}); });
...@@ -438,15 +466,7 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -438,15 +466,7 @@ public class ExtDocServiceImpl implements ExtDocService {
* @return * @return
*/ */
private DxDocumentVO findDocObjFile(Long id) { private DxDocumentVO findDocObjFile(Long id) {
SearchQueryCondition queryDoc = SearchQueryCondition.builder().openProp(SearchQueryCondition.builder().name( SearchQueryCondition queryDoc = SearchQueryCondition.builder().openProp(SearchQueryCondition.builder().name("dxContext").build()).openProp(SearchQueryCondition.builder().name("dxDocumentFolder").build()).openProp(SearchQueryCondition.builder().name("creator").build()).openProp(SearchQueryCondition.builder().name("modifier").build()).openProp(SearchQueryCondition.builder().name("objFileLinks").openProp(SearchQueryCondition.builder().name("target").build()).build()).searchItems(SearchItems.builder().item(new SearchItem("id", SearchItem.Operator.EQ, id, null)).item(new SearchItem("latest", SearchItem.Operator.EQ, true, null)).operator(SearchItems.BooleanOperator.AND).build()).build();
"dxContext").build())
.openProp(SearchQueryCondition.builder().name("dxDocumentFolder").build())
.openProp(SearchQueryCondition.builder().name("creator").build())
.openProp(SearchQueryCondition.builder().name("modifier").build())
.openProp(SearchQueryCondition.builder().name("objFileLinks").openProp(SearchQueryCondition.builder().name("target").build()).build())
.searchItems(SearchItems.builder().item(new SearchItem("id", SearchItem.Operator.EQ,
id, null)).item(new SearchItem("latest", SearchItem.Operator.EQ,
true, null)).operator(SearchItems.BooleanOperator.AND).build()).build();
//通过id查询文档 //通过id查询文档
DxPageImpl<DxDocumentVO> recursion = documentService.findRecursion(queryDoc); DxPageImpl<DxDocumentVO> recursion = documentService.findRecursion(queryDoc);
if (CollectionUtils.isEmpty(recursion.getContent())) { if (CollectionUtils.isEmpty(recursion.getContent())) {
...@@ -521,11 +541,7 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -521,11 +541,7 @@ public class ExtDocServiceImpl implements ExtDocService {
* @return * @return
*/ */
private List<ExtAtlasDrawingLinkVO> recursionAtlasDocByTargetId(Long targetId) { private List<ExtAtlasDrawingLinkVO> recursionAtlasDocByTargetId(Long targetId) {
SearchQueryCondition condition = SearchQueryCondition.builder() SearchQueryCondition condition = SearchQueryCondition.builder().openProp(SearchQueryCondition.builder().name("source").openProp(SearchQueryCondition.builder().name("objFileLinks").build()).build()).searchItems(SearchItems.builder().item(new SearchItem("targetId", SearchItem.Operator.EQ, targetId, null)).build()).build();
.openProp(SearchQueryCondition.builder().name("source")
.openProp(SearchQueryCondition.builder().name("objFileLinks").build()).build())
.searchItems(SearchItems.builder()
.item(new SearchItem("targetId", SearchItem.Operator.EQ, targetId, null)).build()).build();
DxPageImpl recursion = atlasDrawingLinkService.findRecursion(condition); DxPageImpl recursion = atlasDrawingLinkService.findRecursion(condition);
if (!ObjectUtils.isEmpty(recursion)) { if (!ObjectUtils.isEmpty(recursion)) {
return recursion.getContent(); return recursion.getContent();
...@@ -537,8 +553,7 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -537,8 +553,7 @@ public class ExtDocServiceImpl implements ExtDocService {
//@Transactional(propagation = Propagation.REQUIRES_NEW) //@Transactional(propagation = Propagation.REQUIRES_NEW)
public void extracted(DxDocumentVO documentVo, InputStream inputStreamDoc) throws Exception { public void extracted(DxDocumentVO documentVo, InputStream inputStreamDoc) throws Exception {
//上传文件到文件服务器 //上传文件到文件服务器
MultipartFile multipartFile = new MockMultipartFile("file", documentVo.getName() + ".docx", MultipartFile multipartFile = new MockMultipartFile("file", documentVo.getName() + ".docx", Constants.CONTENT_TYPE_DOCX, inputStreamDoc);
Constants.CONTENT_TYPE_DOCX, inputStreamDoc);
RepoFileVO field = fileManagerService.uploadFile(multipartFile, Long.valueOf(Constants.BUCKET_NAME)); RepoFileVO field = fileManagerService.uploadFile(multipartFile, Long.valueOf(Constants.BUCKET_NAME));
if (field == null) { if (field == null) {
log.error("文件上传失败!"); log.error("文件上传失败!");
...@@ -588,8 +603,7 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -588,8 +603,7 @@ public class ExtDocServiceImpl implements ExtDocService {
originalFileName = originalFileName + "(" + secretCode + ")"; originalFileName = originalFileName + "(" + secretCode + ")";
//上传文件到文件服务器 //上传文件到文件服务器
MultipartFile multipartFile = null; MultipartFile multipartFile = null;
multipartFile = new MockMultipartFile("file", originalFileName + ".pdf", multipartFile = new MockMultipartFile("file", originalFileName + ".pdf", Constants.CONTENT_TYPE_PDF, inputStreamPdf);
Constants.CONTENT_TYPE_PDF, inputStreamPdf);
// if (StringUtils.isEmpty(fileName)) { // if (StringUtils.isEmpty(fileName)) {
// //如果等于空,默认文件名称为getName.pdf // //如果等于空,默认文件名称为getName.pdf
// multipartFile = new MockMultipartFile("file", documentVo.getName() + ".pdf", // multipartFile = new MockMultipartFile("file", documentVo.getName() + ".pdf",
...@@ -622,12 +636,10 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -622,12 +636,10 @@ public class ExtDocServiceImpl implements ExtDocService {
MultipartFile multipartFile = null; MultipartFile multipartFile = null;
if (StringUtils.isEmpty(fileName)) { if (StringUtils.isEmpty(fileName)) {
//如果等于空,默认文件名称为name.pdf //如果等于空,默认文件名称为name.pdf
multipartFile = new MockMultipartFile("file", documentVo.getName() + ".pdf", multipartFile = new MockMultipartFile("file", documentVo.getName() + ".pdf", Constants.CONTENT_TYPE_PDF, inputStreamPdf);
Constants.CONTENT_TYPE_PDF, inputStreamPdf);
} else { } else {
//如果等于空,默认文件名称为name.pdf //如果等于空,默认文件名称为name.pdf
multipartFile = new MockMultipartFile("file", fileName + ".pdf", multipartFile = new MockMultipartFile("file", fileName + ".pdf", Constants.CONTENT_TYPE_PDF, inputStreamPdf);
Constants.CONTENT_TYPE_PDF, inputStreamPdf);
} }
RepoFileVO field = fileManagerService.uploadFile(multipartFile, Long.valueOf(Constants.BUCKET_NAME)); RepoFileVO field = fileManagerService.uploadFile(multipartFile, Long.valueOf(Constants.BUCKET_NAME));
if (field == null) { if (field == null) {
...@@ -793,40 +805,42 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -793,40 +805,42 @@ public class ExtDocServiceImpl implements ExtDocService {
} }
} }
// /** /**
// * 获取图片名称 * 获取图片名称
// * *
// * @param activities * @param activities
// * @param activityName * @param activityName
// * @return * @return
// */ */
// @Override // TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
// public String getSignImage(List<WfTaskDefinitionVO> activities, String activityName) { @Override
// for (WfTaskDefinitionVO wf : activities) { public String getSignImage(List<DxWfActivityVO> activities, String activityName) {
// if (wf.getTaskName().equals(activityName)) { for (DxWfActivityVO wf : activities) {
// return getActivityUserName(wf); if (wf.getTaskName().equals(activityName)) {
// } return getActivityUserName(wf);
// } }
// return " "; }
// } return " ";
// }
// /**
// * 获取用户名称及用户id /**
// */ * 获取用户名称及用户id
// public String getActivityUserName(WfTaskDefinitionVO activity) { */
// String str = " "; // TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
// List<WfProcessTaskVO> taskList = activity.getTaskList(); public String getActivityUserName(DxWfActivityVO activity) {
// for (WfProcessTaskVO wf : taskList) { String str = " ";
// if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) { List<DxWfProcessTaskVO> taskList = activity.getTaskList();
// //获取用户名称和id for (DxWfProcessTaskVO wf : taskList) {
// String userName = wf.getAssigneeName(); if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
// String userId = wf.getAssignee(); //获取用户名称和id
// UserVO userVO = userService.get(Long.parseLong(userId)); String userName = wf.getAssigneeName();
// str = userVO.getUserAccount() + ".png"; String userId = wf.getAssignee();
// } DxUserInfoVO userVO = (DxUserInfoVO) userService.get(Long.parseLong(userId));
// } str = userVO.getUserAccount() + ".png";
// return str; }
// } }
return str;
}
/** /**
* 获取某个环节结束时间 * 获取某个环节结束时间
...@@ -836,16 +850,16 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -836,16 +850,16 @@ public class ExtDocServiceImpl implements ExtDocService {
* @return * @return
*/ */
// TODO: 2024/8/1 WfTaskDefinitionVO不存在 // TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
// @Override @Override
// public String getEndDate(List<WfTaskDefinitionVO> activities, String activityName) { public String getEndDate(List<DxWfActivityVO> activities, String activityName) {
// for (WfTaskDefinitionVO wf : activities) { for (DxWfActivityVO wf : activities) {
// if (wf.getTaskName().equals(activityName)) { if (wf.getTaskName().equals(activityName)) {
// return Optional.ofNullable(getActiveEndDate(wf)).orElse(""); return Optional.ofNullable(getActiveEndDate(wf)).orElse("");
// } }
// } }
// return " "; return " ";
// } }
/** /**
* 修改后的处理获取日期 * 修改后的处理获取日期
...@@ -854,20 +868,20 @@ public class ExtDocServiceImpl implements ExtDocService { ...@@ -854,20 +868,20 @@ public class ExtDocServiceImpl implements ExtDocService {
* @return * @return
*/ */
// TODO: 2024/8/1 WfTaskDefinitionVO不存在 // TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
// private String getActiveEndDate(WfTaskDefinitionVO activity) { private String getActiveEndDate(DxWfActivityVO activity) {
// List<WfProcessTaskVO> taskList = activity.getTaskList(); List<DxWfProcessTaskVO> taskList = activity.getTaskList();
// String date = ""; String date = "";
// SimpleDateFormat dateFm = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat dateFm = new SimpleDateFormat("yyyy-MM-dd");
// if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(taskList)) { if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(taskList)) {
// for (WfProcessTaskVO wf : taskList) { for (DxWfProcessTaskVO wf : taskList) {
// if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) { if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
// return dateFm.format(wf.getEndTime()).replace(".", "-"); return dateFm.format(wf.getEndTime()).replace(".", "-");
// } }
// } }
// } }
// return date; return date;
// } }
/** /**
* 获取升版的图册图纸 * 获取升版的图册图纸
......
package com.yonde.dcs.core.util; package com.yonde.dcs.core.util;
import com.yonde.dcs.core.constants.SignConstants; import com.yonde.dcs.core.constants.SignConstants;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
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.version.plugin.common.entity.DxIterationVOHolder;
import com.yonde.dex.wfc.common.enums.TaskStateEnum; import com.yonde.dex.wfc.common.enums.TaskStateEnum;
import com.yonde.dex.wfc.common.vo.*; import com.yonde.dex.wfc.common.vo.DxWfActivityVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessSearchVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessVO;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign; import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import com.yonde.dex.wfc.feign.api.WfcTaskFeign;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -31,6 +35,8 @@ public class WorkFlowUtil { ...@@ -31,6 +35,8 @@ public class WorkFlowUtil {
@Autowired @Autowired
private WfcProcessFeign instanceService; private WfcProcessFeign instanceService;
@Autowired @Autowired
private WfcTaskFeign wfcTaskFeign;
@Autowired
private DxUserInfoFeign userService; private DxUserInfoFeign userService;
/** /**
...@@ -39,17 +45,25 @@ public class WorkFlowUtil { ...@@ -39,17 +45,25 @@ public class WorkFlowUtil {
* @param iterationVO * @param iterationVO
* @return * @return
*/ */
//TODO // TODO: 2024/8/1 DxIterationVO不存在
// public DxWfProcessVO getWfProcessInst(DxIterationVO iterationVO) {
// TODO: xpc WfProcessInstVO不存在改为DxWfProcessVO,IterationVO不存在改为DxIterationVOHolder
public DxWfProcessVO getWfProcessInst(DxIterationVOHolder iterationVO) {
// TODO: getProcessInstList方法不存在改为getProcessList
// DxWfProcessSearchVO wfProcessInstSearchVO = new DxWfProcessSearchVO(); // DxWfProcessSearchVO wfProcessInstSearchVO = new DxWfProcessSearchVO();
// wfProcessInstSearchVO.setPboClass(iterationVO.getClass().getName()); // wfProcessInstSearchVO.setPboClass(iterationVO.getClass().getName());
// wfProcessInstSearchVO.setPboId(iterationVO.getVersionId()); // wfProcessInstSearchVO.setPboId(iterationVO.getVersionId());
// Page<DxWfProcessVO> wfProcessInstVOPage = this.instanceService.getProcessList(wfProcessInstSearchVO, 1, 10); // Page<WfProcessInstVO> wfProcessInstVOPage = this.instanceService.getProcessList(wfProcessInstSearchVO, 1, 10);
// if (!CollectionUtils.isEmpty(wfProcessInstVOPage.getContent())) { DxWfProcessSearchVO dxWfProcessSearchVO = new DxWfProcessSearchVO();
// return wfProcessInstVOPage.getContent().get(0); dxWfProcessSearchVO.setPboClass(iterationVO.getClass().getName());
// } dxWfProcessSearchVO.setPboId(iterationVO.getVersionId());
// return null; Page<DxWfProcessVO> processList = instanceService.getProcessList(dxWfProcessSearchVO, 1, 10);
// } if (!CollectionUtils.isEmpty(processList.getContent())) {
return processList.getContent().get(0);
}
return null;
}
/** /**
* 获取流程实例 * 获取流程实例
...@@ -57,37 +71,43 @@ public class WorkFlowUtil { ...@@ -57,37 +71,43 @@ public class WorkFlowUtil {
* @param doc * @param doc
* @return * @return
*/ */
//TODO // TODO: xpc WfProcessInstVO不存在改为DxWfProcessVO
// public DxWfProcessVO getWfProcessInst(DxDocumentVO doc) { public DxWfProcessVO getWfProcessInst(DxDocumentVO doc) {
// TODO: getProcessInstList方法不存在改为getProcessList
// WfProcessInstSearchVO wfProcessInstSearchVO = new WfProcessInstSearchVO(); // WfProcessInstSearchVO wfProcessInstSearchVO = new WfProcessInstSearchVO();
// wfProcessInstSearchVO.setPboClass(DxDocumentVO.class.getName()); // wfProcessInstSearchVO.setPboClass(DxDocumentVO.class.getName());
// wfProcessInstSearchVO.setPboId(doc.getVersionId()); // wfProcessInstSearchVO.setPboId(doc.getVersionId());
// Page<DxWfProcessVO> wfProcessInstVOPage = this.instanceService.getProcessInstList(wfProcessInstSearchVO, 1, 10); // Page<WfProcessInstVO> wfProcessInstVOPage = this.instanceService.getProcessInstList(wfProcessInstSearchVO, 1, 10);
// if (!CollectionUtils.isEmpty(wfProcessInstVOPage.getContent())) { DxWfProcessSearchVO dxWfProcessSearchVO = new DxWfProcessSearchVO();
// return wfProcessInstVOPage.getContent().get(0); dxWfProcessSearchVO.setPboClass(DxDocumentVO.class.getName());
// } dxWfProcessSearchVO.setPboId(doc.getVersionId());
// return null; Page<DxWfProcessVO> processList = instanceService.getProcessList(dxWfProcessSearchVO, 1, 10);
// } if (!CollectionUtils.isEmpty(processList.getContent())) {
return processList.getContent().get(0);
}
return null;
}
/** /**
* 通过pbo获取流程实例签审详情信息 * 通过pbo获取流程实例签审详情信息
* *
* @param doc * @param doc
*/ */
//TODO
public Map<String, List<DxWfProcessTaskVO>> getWfInfo(DxDocumentVO doc) { public Map<String, List<DxWfProcessTaskVO>> getWfInfo(DxDocumentVO doc) {
// DxWfProcessVO wfProcessInstVO = getWfProcessInst(doc); // TODO: WfProcessInstVO不存在改为DxWfProcessVO
// if (!ObjectUtils.isEmpty(wfProcessInstVO)) { DxWfProcessVO wfProcessInstVO = getWfProcessInst(doc);
// DxWfProcessInfoVO wfProcessInfo = this.instanceService.getProcessInstSimpleDetailById(wfProcessInstVO.getId()); if (!ObjectUtils.isEmpty(wfProcessInstVO)) {
// List<DxWfProcessTaskVO> historyInfoList = wfProcessInfo.getHistoryInfo(); // TODO: xpc getProcessInstList方法不存在,根据逻辑改为getHisTaskList
// // WfProcessInfoVO wfProcessInfo = this.instanceService.getProcessInstSimpleDetailById(wfProcessInstVO.getId());
// List<String> checkResult = Arrays.asList("提交", "通过"); // List<DxWfProcessTaskVO> historyInfoList = wfProcessInfo.getHistoryInfo();
// Map<String, List<DxWfProcessTaskVO>> wfHistoryMap = historyInfoList.stream().filter(p -> TaskStateEnum.COMPLETE.name().equals(p.getState()) && checkResult.contains(p.getResult())) Page<DxWfProcessTaskVO> taskList = wfcTaskFeign.getHisTaskList(wfProcessInstVO.getId(), null, 1, Integer.MAX_VALUE);
// .sorted(Comparator.comparing(DxWfProcessTaskVO::getEndTime).reversed()) List<String> checkResult = Arrays.asList("提交", "通过");
// .collect(Collectors.groupingBy(DxWfProcessTaskVO::getName)); Map<String, List<DxWfProcessTaskVO>> wfHistoryMap = taskList.stream().filter(p -> TaskStateEnum.COMPLETE.name().equals(p.getState()) && checkResult.contains(p.getResult()))
// .sorted(Comparator.comparing(DxWfProcessTaskVO::getEndTime).reversed())
// return wfHistoryMap; .collect(Collectors.groupingBy(DxWfProcessTaskVO::getName));
// } return wfHistoryMap;
}
return null; return null;
} }
...@@ -130,6 +150,7 @@ public class WorkFlowUtil { ...@@ -130,6 +150,7 @@ public class WorkFlowUtil {
* @param activityName * @param activityName
* @return * @return
*/ */
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
public String getSignImage(List<DxWfActivityVO> activities, List<String> activityName) { public String getSignImage(List<DxWfActivityVO> activities, List<String> activityName) {
for (DxWfActivityVO wf : activities) { for (DxWfActivityVO wf : activities) {
if (activityName.contains(wf.getTaskName())) { if (activityName.contains(wf.getTaskName())) {
...@@ -142,6 +163,7 @@ public class WorkFlowUtil { ...@@ -142,6 +163,7 @@ public class WorkFlowUtil {
/** /**
* 获取用户名称及用户id * 获取用户名称及用户id
*/ */
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
public String getActivityUserName(DxWfActivityVO activity) { public String getActivityUserName(DxWfActivityVO activity) {
String str = " "; String str = " ";
List<DxWfProcessTaskVO> taskList = activity.getTaskList(); List<DxWfProcessTaskVO> taskList = activity.getTaskList();
...@@ -164,6 +186,7 @@ public class WorkFlowUtil { ...@@ -164,6 +186,7 @@ public class WorkFlowUtil {
* @param activityName * @param activityName
* @return * @return
*/ */
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
public String getEndDate(List<DxWfActivityVO> activities, List<String> activityName) { public String getEndDate(List<DxWfActivityVO> activities, List<String> activityName) {
for (DxWfActivityVO wf : activities) { for (DxWfActivityVO wf : activities) {
if (activityName.contains(wf.getTaskName())) { if (activityName.contains(wf.getTaskName())) {
...@@ -179,6 +202,7 @@ public class WorkFlowUtil { ...@@ -179,6 +202,7 @@ public class WorkFlowUtil {
* @param activity * @param activity
* @return * @return
*/ */
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
private String getActiveEndDate(DxWfActivityVO activity) { private String getActiveEndDate(DxWfActivityVO activity) {
List<DxWfProcessTaskVO> taskList = activity.getTaskList(); List<DxWfProcessTaskVO> taskList = activity.getTaskList();
String date = ""; String date = "";
......
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