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;
import com.yonde.dcs.common.vo.ExtReviseVersionVO;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.entity.po.ExtAtlasDrawingLink;
import com.yonde.dex.wfc.common.vo.DxWfActivityVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import javax.servlet.http.HttpServletResponse;
......@@ -111,27 +112,28 @@ public interface ExtDocService {
* @param wfProcessInfoVO
* @param fileName
*/
// TODO: 2024/7/31 2.1有WfProcessInfoVO 4.1没有这个VO
// void generateDocWordSign(DxDocumentVO documentVo, Class classType, WfProcessInfoVO wfProcessInfoVO, String fileName);
// TODO: 2024/7/31 2.1有WfTaskDefinitionVO 4.1没有这个VO
// /**
// * 获取签名图片
// *
// * @param activities
// * @param activityName
// * @return
// */
// String getSignImage(List<WfTaskDefinitionVO> activities, String activityName);
//
// /**
// * 获取签名日期
// *
// * @param activities
// * @param activityName
// * @return
// */
// String getEndDate(List<WfTaskDefinitionVO> activities, String activityName);
void generateDocWordSign(DxDocumentVO documentVo, Class classType, DxWfProcessInfoVO wfProcessInfoVO, String fileName);
/**
* 获取签名图片
*
* @param activities
* @param activityName
* @return
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
String getSignImage(List<DxWfActivityVO> activities, String activityName);
/**
* 获取签名日期
*
* @param activities
* @param activityName
* @return
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
String getEndDate(List<DxWfActivityVO> activities, String activityName);
Boolean validate(DxDocumentVO documentVO);
......@@ -143,8 +145,6 @@ public interface ExtDocService {
*/
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;
import com.yonde.dcs.common.vo.ExtObsoleteDocLinkVO;
import com.yonde.dcs.common.vo.ExtReviseVersionVO;
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.ExtDocService;
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.ExtDocUtil;
import com.yonde.dcs.core.util.FileUtils;
......@@ -41,10 +43,16 @@ import com.yonde.dex.dfs.vo.RepoFileVO;
import com.yonde.dex.dfs.vo.view.FileDownLoadInfoVO;
import com.yonde.dex.dict.feign.DictDataFeignService;
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.version.plugin.common.entity.DxVersionVO;
import com.yonde.dex.version.plugin.core.service.VersionService;
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.DxWfProcessTaskVO;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
......@@ -62,6 +70,8 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
......@@ -109,18 +119,18 @@ public class ExtDocServiceImpl implements ExtDocService {
@Autowired
private ObjFileLinkService objFileLinkService;
// TODO: 2024/8/1 DocConvertService不存在
// TODO: xpc DocConvertService不存在 且未被使用
// @Autowired
// DocConvertService docConvertService;
@Autowired
private ExtDocUtil extDocUtil;
//生成过时文件通知单编码
// @Autowired
// private SerialNumberService serialNumberService;
//
// @Autowired
// private IUserService userService;
@Autowired
private ExtSerialNumberService serialNumberService;
@Autowired
private DxUserInfoFeign userService;
@Override
public Boolean validate(DxDocumentVO documentVO) {
......@@ -148,7 +158,7 @@ public class ExtDocServiceImpl implements ExtDocService {
DxDocumentVO dxDocumentVO;
// 切换用户(升版后创建人保持不变)
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();
changeUserHelper.switchUser(userId);
//切换后升版
......@@ -274,11 +284,7 @@ public class ExtDocServiceImpl implements ExtDocService {
*/
@Override
public List<ExtAtlasDrawingLinkVO> recursionAtlasDoc(Long id) {
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();
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();
DxPageImpl recursion = atlasDrawingLinkService.findRecursion(condition);
if (!ObjectUtils.isEmpty(recursion)) {
return recursion.getContent();
......@@ -297,10 +303,14 @@ public class ExtDocServiceImpl implements ExtDocService {
sourceDoc.setPredecessorId(null);
newViewDoc = ObjectUtil.cloneByStream(sourceDoc);
Long targetViewId = 2L;
DxVersion newVersionVo = new DxVersion();
// TODO: 2024/8/1 clearPersistInfo方法不存在
// newVersionVo.clearPersistInfo();
DxVersionVO newVersionVo = new DxVersionVO();
// TODO: xpc clearPersistInfo方法不存在,根据2.1摘抄过来
// 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);
newVersionVo.setVersionKey(nextVersionKey);
newVersionVo.setVersionSeries(sourceDoc.getVersion().getVersionSeries());
......@@ -308,16 +318,35 @@ public class ExtDocServiceImpl implements ExtDocService {
newVersionVo.setSubTypeName(DxEntityUtils.getModelName(newVersionVo.getClass()));
newVersionVo.setMasterId(sourceDoc.getMasterId());
newVersionVo.setPredecessorId(sourceDoc.getId());
newVersionVo = (DxVersion) versionService.save((IdVO) newVersionVo, true);
// TODO: 2024/8/1 DxIterationVO不存在
// newViewDoc = DcsBuilder.of(newViewDoc).with(IdVO::setSubTypeName, sourceDoc.getSubTypeName()).with(DxIterationVO::setMaster, sourceDoc.getMaster())
// .with(DxIterationVO::setLatest, true).with(DxIterationVO::setCheckOuted, false).work(IdVO::clearPersistInfo).with(DxObjectVo::setDxContextId, sourceDoc.getDxContextId())
newVersionVo = (DxVersionVO) versionService.save((IdVO) newVersionVo, true);
// TODO: xpc DxIterationVO不存在,听同事说此方法已被弃用
// newViewDoc = DcsBuilder.of(newViewDoc).with(IdVO::setSubTypeName, sourceDoc.getSubTypeName())
// .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::setIterationId, "1")
// .with(DxIterationVO::setVersion, newVersionVo)
// .with(DxIterationVO::setVersionId, newVersionVo.getId())
// .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);
return newViewDoc;
}
......@@ -423,8 +452,7 @@ public class ExtDocServiceImpl implements ExtDocService {
private void extFindFileIds(List<Long> fileIds, List<ObjFileLinkVO> objFileLinks, String fileType) {
if (!CollectionUtils.isEmpty(objFileLinks)) {
//遍历取主内容的文件id
List<ObjFileLinkVO> objFileLinkVOs =
objFileLinks.stream().filter(n -> n.getContentType().equals(fileType)).collect(Collectors.toList());
List<ObjFileLinkVO> objFileLinkVOs = objFileLinks.stream().filter(n -> n.getContentType().equals(fileType)).collect(Collectors.toList());
objFileLinkVOs.stream().forEach(o -> {
fileIds.add(o.getTargetId());
});
......@@ -438,15 +466,7 @@ public class ExtDocServiceImpl implements ExtDocService {
* @return
*/
private DxDocumentVO findDocObjFile(Long id) {
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();
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();
//通过id查询文档
DxPageImpl<DxDocumentVO> recursion = documentService.findRecursion(queryDoc);
if (CollectionUtils.isEmpty(recursion.getContent())) {
......@@ -521,11 +541,7 @@ public class ExtDocServiceImpl implements ExtDocService {
* @return
*/
private List<ExtAtlasDrawingLinkVO> recursionAtlasDocByTargetId(Long targetId) {
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();
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();
DxPageImpl recursion = atlasDrawingLinkService.findRecursion(condition);
if (!ObjectUtils.isEmpty(recursion)) {
return recursion.getContent();
......@@ -537,8 +553,7 @@ public class ExtDocServiceImpl implements ExtDocService {
//@Transactional(propagation = Propagation.REQUIRES_NEW)
public void extracted(DxDocumentVO documentVo, InputStream inputStreamDoc) throws Exception {
//上传文件到文件服务器
MultipartFile multipartFile = new MockMultipartFile("file", documentVo.getName() + ".docx",
Constants.CONTENT_TYPE_DOCX, inputStreamDoc);
MultipartFile multipartFile = new MockMultipartFile("file", documentVo.getName() + ".docx", Constants.CONTENT_TYPE_DOCX, inputStreamDoc);
RepoFileVO field = fileManagerService.uploadFile(multipartFile, Long.valueOf(Constants.BUCKET_NAME));
if (field == null) {
log.error("文件上传失败!");
......@@ -588,8 +603,7 @@ public class ExtDocServiceImpl implements ExtDocService {
originalFileName = originalFileName + "(" + secretCode + ")";
//上传文件到文件服务器
MultipartFile multipartFile = null;
multipartFile = new MockMultipartFile("file", originalFileName + ".pdf",
Constants.CONTENT_TYPE_PDF, inputStreamPdf);
multipartFile = new MockMultipartFile("file", originalFileName + ".pdf", Constants.CONTENT_TYPE_PDF, inputStreamPdf);
// if (StringUtils.isEmpty(fileName)) {
// //如果等于空,默认文件名称为getName.pdf
// multipartFile = new MockMultipartFile("file", documentVo.getName() + ".pdf",
......@@ -622,12 +636,10 @@ public class ExtDocServiceImpl implements ExtDocService {
MultipartFile multipartFile = null;
if (StringUtils.isEmpty(fileName)) {
//如果等于空,默认文件名称为name.pdf
multipartFile = new MockMultipartFile("file", documentVo.getName() + ".pdf",
Constants.CONTENT_TYPE_PDF, inputStreamPdf);
multipartFile = new MockMultipartFile("file", documentVo.getName() + ".pdf", Constants.CONTENT_TYPE_PDF, inputStreamPdf);
} else {
//如果等于空,默认文件名称为name.pdf
multipartFile = new MockMultipartFile("file", fileName + ".pdf",
Constants.CONTENT_TYPE_PDF, inputStreamPdf);
multipartFile = new MockMultipartFile("file", fileName + ".pdf", Constants.CONTENT_TYPE_PDF, inputStreamPdf);
}
RepoFileVO field = fileManagerService.uploadFile(multipartFile, Long.valueOf(Constants.BUCKET_NAME));
if (field == null) {
......@@ -793,40 +805,42 @@ public class ExtDocServiceImpl implements ExtDocService {
}
}
// /**
// * 获取图片名称
// *
// * @param activities
// * @param activityName
// * @return
// */
// @Override
// public String getSignImage(List<WfTaskDefinitionVO> activities, String activityName) {
// for (WfTaskDefinitionVO wf : activities) {
// if (wf.getTaskName().equals(activityName)) {
// return getActivityUserName(wf);
// }
// }
// return " ";
// }
//
// /**
// * 获取用户名称及用户id
// */
// public String getActivityUserName(WfTaskDefinitionVO activity) {
// String str = " ";
// List<WfProcessTaskVO> taskList = activity.getTaskList();
// for (WfProcessTaskVO wf : taskList) {
// if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
// //获取用户名称和id
// String userName = wf.getAssigneeName();
// String userId = wf.getAssignee();
// UserVO userVO = userService.get(Long.parseLong(userId));
// str = userVO.getUserAccount() + ".png";
// }
// }
// return str;
// }
/**
* 获取图片名称
*
* @param activities
* @param activityName
* @return
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
@Override
public String getSignImage(List<DxWfActivityVO> activities, String activityName) {
for (DxWfActivityVO wf : activities) {
if (wf.getTaskName().equals(activityName)) {
return getActivityUserName(wf);
}
}
return " ";
}
/**
* 获取用户名称及用户id
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
public String getActivityUserName(DxWfActivityVO activity) {
String str = " ";
List<DxWfProcessTaskVO> taskList = activity.getTaskList();
for (DxWfProcessTaskVO wf : taskList) {
if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
//获取用户名称和id
String userName = wf.getAssigneeName();
String userId = wf.getAssignee();
DxUserInfoVO userVO = (DxUserInfoVO) userService.get(Long.parseLong(userId));
str = userVO.getUserAccount() + ".png";
}
}
return str;
}
/**
* 获取某个环节结束时间
......@@ -836,16 +850,16 @@ public class ExtDocServiceImpl implements ExtDocService {
* @return
*/
// TODO: 2024/8/1 WfTaskDefinitionVO不存在
// @Override
// public String getEndDate(List<WfTaskDefinitionVO> activities, String activityName) {
// for (WfTaskDefinitionVO wf : activities) {
// if (wf.getTaskName().equals(activityName)) {
// return Optional.ofNullable(getActiveEndDate(wf)).orElse("");
// }
// }
// return " ";
// }
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
@Override
public String getEndDate(List<DxWfActivityVO> activities, String activityName) {
for (DxWfActivityVO wf : activities) {
if (wf.getTaskName().equals(activityName)) {
return Optional.ofNullable(getActiveEndDate(wf)).orElse("");
}
}
return " ";
}
/**
* 修改后的处理获取日期
......@@ -854,20 +868,20 @@ public class ExtDocServiceImpl implements ExtDocService {
* @return
*/
// TODO: 2024/8/1 WfTaskDefinitionVO不存在
// private String getActiveEndDate(WfTaskDefinitionVO activity) {
// List<WfProcessTaskVO> taskList = activity.getTaskList();
// String date = "";
// SimpleDateFormat dateFm = new SimpleDateFormat("yyyy-MM-dd");
// if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(taskList)) {
// for (WfProcessTaskVO wf : taskList) {
// if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
// return dateFm.format(wf.getEndTime()).replace(".", "-");
// }
// }
// }
// return date;
// }
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
private String getActiveEndDate(DxWfActivityVO activity) {
List<DxWfProcessTaskVO> taskList = activity.getTaskList();
String date = "";
SimpleDateFormat dateFm = new SimpleDateFormat("yyyy-MM-dd");
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(taskList)) {
for (DxWfProcessTaskVO wf : taskList) {
if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
return dateFm.format(wf.getEndTime()).replace(".", "-");
}
}
}
return date;
}
/**
* 获取升版的图册图纸
......
package com.yonde.dcs.core.util;
import com.yonde.dcs.core.constants.SignConstants;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
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.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.WfcTaskFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Component;
......@@ -31,6 +35,8 @@ public class WorkFlowUtil {
@Autowired
private WfcProcessFeign instanceService;
@Autowired
private WfcTaskFeign wfcTaskFeign;
@Autowired
private DxUserInfoFeign userService;
/**
......@@ -39,17 +45,25 @@ public class WorkFlowUtil {
* @param iterationVO
* @return
*/
//TODO
// public DxWfProcessVO getWfProcessInst(DxIterationVO iterationVO) {
// TODO: 2024/8/1 DxIterationVO不存在
// TODO: xpc WfProcessInstVO不存在改为DxWfProcessVO,IterationVO不存在改为DxIterationVOHolder
public DxWfProcessVO getWfProcessInst(DxIterationVOHolder iterationVO) {
// TODO: getProcessInstList方法不存在改为getProcessList
// DxWfProcessSearchVO wfProcessInstSearchVO = new DxWfProcessSearchVO();
// wfProcessInstSearchVO.setPboClass(iterationVO.getClass().getName());
// wfProcessInstSearchVO.setPboId(iterationVO.getVersionId());
// Page<DxWfProcessVO> wfProcessInstVOPage = this.instanceService.getProcessList(wfProcessInstSearchVO, 1, 10);
// if (!CollectionUtils.isEmpty(wfProcessInstVOPage.getContent())) {
// return wfProcessInstVOPage.getContent().get(0);
// }
// return null;
// }
// Page<WfProcessInstVO> wfProcessInstVOPage = this.instanceService.getProcessList(wfProcessInstSearchVO, 1, 10);
DxWfProcessSearchVO dxWfProcessSearchVO = new DxWfProcessSearchVO();
dxWfProcessSearchVO.setPboClass(iterationVO.getClass().getName());
dxWfProcessSearchVO.setPboId(iterationVO.getVersionId());
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 {
* @param doc
* @return
*/
//TODO
// public DxWfProcessVO getWfProcessInst(DxDocumentVO doc) {
// TODO: xpc WfProcessInstVO不存在改为DxWfProcessVO
public DxWfProcessVO getWfProcessInst(DxDocumentVO doc) {
// TODO: getProcessInstList方法不存在改为getProcessList
// WfProcessInstSearchVO wfProcessInstSearchVO = new WfProcessInstSearchVO();
// wfProcessInstSearchVO.setPboClass(DxDocumentVO.class.getName());
// wfProcessInstSearchVO.setPboId(doc.getVersionId());
// Page<DxWfProcessVO> wfProcessInstVOPage = this.instanceService.getProcessInstList(wfProcessInstSearchVO, 1, 10);
// if (!CollectionUtils.isEmpty(wfProcessInstVOPage.getContent())) {
// return wfProcessInstVOPage.getContent().get(0);
// }
// return null;
// }
// Page<WfProcessInstVO> wfProcessInstVOPage = this.instanceService.getProcessInstList(wfProcessInstSearchVO, 1, 10);
DxWfProcessSearchVO dxWfProcessSearchVO = new DxWfProcessSearchVO();
dxWfProcessSearchVO.setPboClass(DxDocumentVO.class.getName());
dxWfProcessSearchVO.setPboId(doc.getVersionId());
Page<DxWfProcessVO> processList = instanceService.getProcessList(dxWfProcessSearchVO, 1, 10);
if (!CollectionUtils.isEmpty(processList.getContent())) {
return processList.getContent().get(0);
}
return null;
}
/**
* 通过pbo获取流程实例签审详情信息
*
* @param doc
*/
//TODO
public Map<String, List<DxWfProcessTaskVO>> getWfInfo(DxDocumentVO doc) {
// DxWfProcessVO wfProcessInstVO = getWfProcessInst(doc);
// if (!ObjectUtils.isEmpty(wfProcessInstVO)) {
// DxWfProcessInfoVO wfProcessInfo = this.instanceService.getProcessInstSimpleDetailById(wfProcessInstVO.getId());
// List<DxWfProcessTaskVO> historyInfoList = wfProcessInfo.getHistoryInfo();
//
// List<String> checkResult = Arrays.asList("提交", "通过");
// Map<String, List<DxWfProcessTaskVO>> wfHistoryMap = historyInfoList.stream().filter(p -> TaskStateEnum.COMPLETE.name().equals(p.getState()) && checkResult.contains(p.getResult()))
// .sorted(Comparator.comparing(DxWfProcessTaskVO::getEndTime).reversed())
// .collect(Collectors.groupingBy(DxWfProcessTaskVO::getName));
//
// return wfHistoryMap;
// }
// TODO: WfProcessInstVO不存在改为DxWfProcessVO
DxWfProcessVO wfProcessInstVO = getWfProcessInst(doc);
if (!ObjectUtils.isEmpty(wfProcessInstVO)) {
// TODO: xpc getProcessInstList方法不存在,根据逻辑改为getHisTaskList
// WfProcessInfoVO wfProcessInfo = this.instanceService.getProcessInstSimpleDetailById(wfProcessInstVO.getId());
// List<DxWfProcessTaskVO> historyInfoList = wfProcessInfo.getHistoryInfo();
Page<DxWfProcessTaskVO> taskList = wfcTaskFeign.getHisTaskList(wfProcessInstVO.getId(), null, 1, Integer.MAX_VALUE);
List<String> checkResult = Arrays.asList("提交", "通过");
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())
.collect(Collectors.groupingBy(DxWfProcessTaskVO::getName));
return wfHistoryMap;
}
return null;
}
......@@ -130,6 +150,7 @@ public class WorkFlowUtil {
* @param activityName
* @return
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
public String getSignImage(List<DxWfActivityVO> activities, List<String> activityName) {
for (DxWfActivityVO wf : activities) {
if (activityName.contains(wf.getTaskName())) {
......@@ -142,6 +163,7 @@ public class WorkFlowUtil {
/**
* 获取用户名称及用户id
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
public String getActivityUserName(DxWfActivityVO activity) {
String str = " ";
List<DxWfProcessTaskVO> taskList = activity.getTaskList();
......@@ -164,6 +186,7 @@ public class WorkFlowUtil {
* @param activityName
* @return
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
public String getEndDate(List<DxWfActivityVO> activities, List<String> activityName) {
for (DxWfActivityVO wf : activities) {
if (activityName.contains(wf.getTaskName())) {
......@@ -179,6 +202,7 @@ public class WorkFlowUtil {
* @param activity
* @return
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
private String getActiveEndDate(DxWfActivityVO activity) {
List<DxWfProcessTaskVO> taskList = activity.getTaskList();
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