Commit 16eab8bb authored by pchxue's avatar pchxue

迁移问题处理

parent 7988a858
......@@ -161,11 +161,21 @@ public class Constants {
* 关闭
*/
public static final String CLOSE = "Close";
/**
* 全部关闭
*/
public static final String CLOSE_ALL = "qbgb";
/**
* 已完成
*/
public static final String COMPLETED = "completed";
/**
* 已终止
*/
public static final String STATUS_END = "end";
/**
* 未完成
*/
......
package com.yonde.dcs.core.constants;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
/**
......@@ -81,4 +82,42 @@ public final class SignConstants {
* 定义流程路由常量
*/
public final static List WfRoutingList = Arrays.asList("通过", "提交");
/**
* 流程 节点名称
*/
public static final HashMap<String, String> SignNodeMap = new HashMap(){{
put("编制", "BKBZ");
put("校对", "BKJD");
put("审定", "BKSD");
put("标检", "BKBJ");
put("数据审核", "BKSJ");
put("管理审核", "BKGL");
put("资料员审核", "BKZL");
put("标审", "BKBS");
put("会签", "BKHQ");
put("工艺室分发辅制会签", "BKFZ");
put("工艺主制会签", "BKZZ");
put("审核", "BKSH");
put("批准", "BKPZ");
put("待审阅", "BKDS");
put("设总签审", "BKSZ");
put("总体室签审", "BKZT");
put("总体室接口工程师签审设总综合检查人", "BKJK");
put("综合检查", "BKZH");
}};
/**
* 流程 节点名称
*/
public static final HashMap<String, String> InterfaceSignNodeMap = new HashMap(){
{
put("审核", "TKSK");
put("提资方设总签审", "TKSZ");
put("提资中", "TKTJ");
put("总体室接口工程师签审", "TKZT");
}};
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import com.yonde.dcs.common.vo.ExtInterfaceVO;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.feign.ExtAutoTaskServiceFeign;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dex.version.plugin.common.entity.DxIterationVOHolder;
import lombok.SneakyThrows;
import java.util.Map;
......@@ -135,8 +136,8 @@ public interface ExtAutoTaskService extends ExtAutoTaskServiceFeign {
* @param iterationObject
*/
// TODO: 2024/7/31 DxIterationVO在4.1不存在
// void endProcess(DxIterationVO iterationObject);
// TODO: xpc DxIterationVO不存在改为DxIterationVOHolder
void endProcess(DxIterationVOHolder iterationObject);
/**
* 生成过时文件通知单word
......
......@@ -122,7 +122,7 @@ public interface ExtDocService {
* @param activityName
* @return
*/
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
// TODO: xpc 将WfTaskDefinitionVO改为DxWfActivityVO
String getSignImage(List<DxWfActivityVO> activities, String activityName);
/**
......
......@@ -5,20 +5,22 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.io.FileUtil;
import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.ContentType;
import com.alibaba.fastjson.JSONObject;
import com.yonde.dcs.common.vo.*;
import com.yonde.dcs.core.constants.Constants;
import com.yonde.dcs.core.constants.SignConstants;
import com.yonde.dcs.core.events.DocBeforeCreateEvent;
import com.yonde.dcs.core.events.ProcessDataUtils;
import com.yonde.dcs.core.factory.NCRSCUtils;
import com.yonde.dcs.core.factory.OutdatedDocNotifyUtils;
import com.yonde.dcs.core.factory.TechnicalFileUtils;
import com.yonde.dcs.core.service.*;
import com.yonde.dcs.core.util.ExtDocUtil;
import com.yonde.dcs.core.util.ExtWfcUtil;
import com.yonde.dcs.core.util.SearchUtil;
import com.yonde.dcs.core.util.WorkFlowUtil;
import com.yonde.dcs.core.util.*;
import com.yonde.dcs.core.word.ImportWordService;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dcs.document.core.service.DocumentService;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.utils.FileUtils;
import com.yonde.dcs.plan.common.vo.ExtPlanDocLinkVO;
import com.yonde.dcs.plan.common.vo.ExtPlanVO;
import com.yonde.dcs.plan.feign.ExtDistributeRecordServiceFeign;
......@@ -27,8 +29,10 @@ import com.yonde.dcs.plan.feign.ExtPlanServiceFeign;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.api.CustomMultipartFile;
import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.entity.jackson.JsonUtils;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.basedata.utils.obj.DxEntityUtils;
import com.yonde.dex.dao.service.util.DxPageUtils;
......@@ -41,16 +45,20 @@ import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.DxOrganizationFeign;
import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.user.feign.SwitchUserService;
import com.yonde.dex.wfc.common.vo.DxWfParticipantInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import com.yonde.dex.wfc.common.vo.DxWfTaskContext;
import com.yonde.dex.utils.common.utils.DxFileUtils;
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.feign.api.WfcActivityFeign;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import com.yonde.dex.wfc.feign.api.WfcTaskFeign;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.utils.CloneUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
......@@ -61,9 +69,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.*;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
......@@ -94,6 +100,9 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
private ExtDistributeRecordServiceFeign distributeRecordService;
@Autowired
private WfcProcessFeign wfInstanceService;
@Autowired
private WfcActivityFeign wfcActivityFeign;
@Autowired
private ExtInterfaceReplaceLinkService interfaceReplaceLinkService;
@Autowired
......@@ -112,15 +121,13 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
private SwitchUserService switchUserService;
@Autowired
private ExtInterfaceInfoLinkService interfaceInfoLinkService;
// @Autowired
// private DocBeforeCreateEvent docBeforeCreateEvent;
@Autowired
private DocBeforeCreateEvent docBeforeCreateEvent;
@Autowired
private FileManagerFeignService fileManagerFeignService;
@Autowired
private ObjFileLinkService objFileLinkService;
@Autowired
private WfcProcessFeign dexWorkFlowService;
@Autowired
private ExtDocUtil extDocUtil;
@Autowired
......@@ -132,16 +139,15 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
private TechnicalFileUtils technicalFileUtils;
@Autowired
private WorkFlowUtil workFlowUtil;
// @Autowired
// private ProcessDataUtils processDataUtils;
@Autowired
private ProcessDataUtils processDataUtils;
@Autowired
ExtApplicantService extApplicantService;
@Autowired
ExtInterfaceService extInterfaceService;
// @Autowired
// IOrganizationService organizationService;
// @Autowired
// private ChangeUserHelper changeUserHelper;
@Autowired
ExtAuditInterfLinkService extAuditInterfLinkService;
/**
* 客制化文档修改状态
......@@ -544,18 +550,17 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
*/
@Override
public void getProcessSelectionInfo(String taskId, DxDocumentVO documentVO) {
// TODO: 2024/7/31 4.1 taskService.getTaskSelectionInfo(taskId)此方法不存在
List<DxWfParticipantInfoVO> processTeamParticipantList = dexWorkFlowService.getProcessTeamParticipantList(taskId);
// TODO: xpc taskService.getTaskSelectionInfo(taskId)此方法不存在
// WfTaskSelectionVo taskSelectionInfo = this.taskService.getTaskSelectionInfo(taskId);
// Map<String, Object> participantList = taskSelectionInfo.getParticipantList();
// Long[] review = (Long[]) participantList.get("wf_act_TeamRole_review_userList");
// Long[] approver = (Long[]) participantList.get("wf_act_TeamRole_Approver_userList");
// Long[] verifier = (Long[]) participantList.get("wf_act_TeamRole_approve_userList");
// Long[] verifier = (Long[]) participantList.get("wf_act_teamrole_approve_userlist");
// //更新pbo属性
// Map<String, Object> dynamicAttrs = documentVO.getDynamicAttrs();
// dynamicAttrs.put("review", review.toString());
// dynamicAttrs.put("approver", approver.toString());
// dynamicAttrs.put("verifier", verifier.toString()·);
// dynamicAttrs.put("verifier", verifier.toString());
// documentVO.setOperator(OperatorType.MODIFY);
// documentService.saveRecursion(documentVO);
}
......@@ -590,8 +595,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
DxDocumentVO doc = new DxDocumentVO();
doc.setNumber(extPlanVO.getFileNumber());
doc.setName(extPlanVO.getFileName());
// TODO: 2024/7/31 4.1 setProjectCode此字段不存在
// doc.setProjectCode(extPlanVO.getProjectCode());
doc.getDxDocumentExpand().setProjectCode(extPlanVO.getProjectCode());
Map<String, Object> map = new HashMap<>();
map.put("fileNumber", extPlanVO.getFileCode());
map.put("review", org.springframework.util.StringUtils.isEmpty(this.searchUserId(extPlanVO.getReview())) ? "" : this.searchUserId(extPlanVO.getReview()));
......@@ -602,8 +606,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
doc.setDynamicAttrs(map);
doc.setState(extPlanVO.getPhaseState());
//查询文档分类
// TODO: 2024/8/1 extPlanService.searchFileT这个方法不存在
// this.extPlanService.searchFileType(extPlanVO.getFileType(), doc);
this.extPlanService.searchFileType(extPlanVO.getFileType(), doc);
doc.markCreatorIdHold();
doc.markModifyIdHold();
//设置文档创建者
......@@ -613,14 +616,12 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//绑定计划和文档的link
ExtPlanDocLinkVO planDocLinkVO = new ExtPlanDocLinkVO();
planDocLinkVO.setSource(extPlanVO);
// TODO: 2024/8/1 DxDocumentVO参数类型不匹对
// planDocLinkVO.setTarget(dxDocumentVO);
planDocLinkVO.setTarget(dxDocumentVO);
planDocLinkService.save(planDocLinkVO);
}
if ("计划反馈类".equals(extPlanVO.getFeedbackType())) {
//向计划执行人分发通知
// TODO: 2024/8/1 extPlanService.generatePlanDistributeRecord方法不存在
// this.extPlanService.generatePlanDistributeRecord(extPlanVO);
this.extPlanService.generatePlanDistributeRecord(extPlanVO);
}
}
......@@ -647,15 +648,12 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
String filePath = Constants.JD_BEFORE_MERGER_PATH + documentVO.getSubTypeName() + "/" + documentVO.getNumber() + "/" + Constants.MERGER_SOURCE;
String fileInputName = Constants.BEFORE_MERGER_PATH + documentVO.getSubTypeName() + "/" + documentVO.getNumber() + "/" + Constants.MERGER_TARGET + "/" + Constants.MERGER_FILE_NAME;
List<ExtInterfaceInfoLinkVO> interfaceInfoLinkVOS = this.recursionInterfaceInfoLinks(documentVO.getVersionId());
// TODO: 2024/8/1 getWfProcessInst返回属性不匹对
// WfProcessInstVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// DxWfProcessVO wfProcessInfoVO = dexWorkFlowService.getProcessDetail(wfProcessInstVO.getId());
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// TODO: xpc dexWorkFlowService.getProcessInstDetailById方法不存在
// WfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId());
if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) {
//1、先根据提资记录生成多个文档
interfaceInfoLinkVOS.stream().forEach(item -> {
// TODO: 2024/8/1 generateAutoInterFaceWord入参不匹对
// docBeforeCreateEvent.generateAutoInterFaceWord(docObjFile, item, wfProcessInfoVO);
});
try {
......@@ -827,24 +825,23 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
*/
private List<DxWfProcessTaskVO> getTaskList(Map<String, Object> wfTaskContext) {
DxWfTaskContext context = (DxWfTaskContext) wfTaskContext.get("context");
String processId = context.getProcessId();
// TODO: 2024/7/31 4.1此方法不存在 getProcessInstDetailById(processId)
// TODO: xpc getProcessInstDetailById(processId)方法不存在,改为wfcActivityFeign.getActivities()
// DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(processId);
// List<WfTaskDefinitionVO> activities = wfProcessInfoVO.getActivityInfo();
// List<DxWfProcessTaskVO> taskVOList = new ArrayList<>();
// for (WfTaskDefinitionVO wf : activities) {
// //判断节点上是否存在
// if (SignConstants.NCRSignTaskList.contains(wf.getTaskName())) {
// List<WfProcessTaskVO> taskList = wf.getTaskList();
// for (WfProcessTaskVO wfPro : taskList) {
// if ("通过".equals(wfPro.getResult())) {
// taskVOList.add(wfPro);
// }
// }
// }
// }
// return taskVOList;
return null;
// List<DxWfActivityVO> activities = wfProcessInfoVO.getActivityInfo();
List<DxWfActivityVO> activities = wfcActivityFeign.getActivities(context.getProcessId(), context.getProcessDefId());
List<DxWfProcessTaskVO> taskVOList = new ArrayList<>();
for (DxWfActivityVO wf : activities) {
//判断节点上是否存在
if (SignConstants.NCRSignTaskList.contains(wf.getTaskName())) {
List<DxWfProcessTaskVO> taskList = wf.getTaskList();
for (DxWfProcessTaskVO wfPro : taskList) {
if ("通过".equals(wfPro.getResult())) {
taskVOList.add(wfPro);
}
}
}
}
return taskVOList;
}
/**
......@@ -884,9 +881,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
//深度查询展开ObjLink
DxDocumentVO documentVO = extDocUtil.findDocObjFileLinks(documentId);
log.info("自动任务======生成word签名开始");
// TODO: 2024/7/31 4.1返回对象不匹对 WfProcessInstVO
// WfProcessInstVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// TODO: 2024/7/31 4.1此方法不存在 getProcessInstDetailById(processId)
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// TODO: xpc 此方法不存在 getProcessInstDetailById(processId)
// WfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId());
String subTypeName = documentVO.getSubTypeName();
log.info("自动任务======生成word签名进行中,文档SubTypeName:{}", subTypeName);
......@@ -931,90 +927,90 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
public void savedInterfaceWf(Long documentId, Map<String, Object> wfTaskContext) {
DxDocumentVO documentVO = extDocUtil.findDocObjFileLinks(documentId);
DxWfTaskContext context = (DxWfTaskContext) wfTaskContext.get("context");
String processId = context.getProcessId();
// TODO: 2024/7/31 4.1此方法不存在 getProcessInstDetailById(processId)
// TODO: xpc 此方法不存在 getProcessInstDetailById(processId),改为wfcActivityFeign.getActivities()
// DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(processId);
Map<String, Object> dynamicAttrs = documentVO.getDynamicAttrs();
// List<WfTaskDefinitionVO> activities = wfProcessInfoVO.getActivityInfo();
// if (!org.springframework.util.CollectionUtils.isEmpty(activities)) {
// //申请审核
// dynamicAttrs.replace("appReviewer", this.getUserName(activities, SignConstants.SIGN_KEY_SQSH));
// dynamicAttrs.replace("appReviewerDate", extDocService.getEndDate(activities, SignConstants.SIGN_KEY_SQSH));
// //总体室签审
// dynamicAttrs.replace("ztsSign", this.getUserName(activities, SignConstants.SIGN_KEY_ZTSQS));
// dynamicAttrs.replace("ztsSignDate", extDocService.getEndDate(activities, SignConstants.SIGN_KEY_ZTSQS));
// }
List<DxWfActivityVO> activities = wfcActivityFeign.getActivities(context.getProcessId(), context.getProcessDefId());
Map<String, Object> dynamicAttrs = documentVO.getDynamicAttrs();
if (!org.springframework.util.CollectionUtils.isEmpty(activities)) {
//申请审核
dynamicAttrs.replace("appReviewer", this.getUserName(activities, SignConstants.SIGN_KEY_SQSH));
dynamicAttrs.replace("appReviewerDate", extDocService.getEndDate(activities, SignConstants.SIGN_KEY_SQSH));
//总体室签审
dynamicAttrs.replace("ztsSign", this.getUserName(activities, SignConstants.SIGN_KEY_ZTSQS));
dynamicAttrs.replace("ztsSignDate", extDocService.getEndDate(activities, SignConstants.SIGN_KEY_ZTSQS));
}
documentVO.setOperator(OperatorType.MODIFY);
DxDocumentVO dxDocumentVO = (DxDocumentVO) documentService.saveRecursion(documentVO);
}
// public String getUserName(List<WfTaskDefinitionVO> activities, String activityName) {
// for (WfTaskDefinitionVO wf : activities) {
// if (wf.getTaskName().equals(activityName)) {
// return getActivityUserName(wf);
// }
// }
// return "";
// }
// TODO: xpc WfTaskDefinitionVO改为DxWfActivityVO
public String getUserName(List<DxWfActivityVO> activities, String activityName) {
for (DxWfActivityVO wf : activities) {
if (wf.getTaskName().equals(activityName)) {
return getActivityUserName(wf);
}
}
return "";
}
/**
* 获取用户名称及用户id
*/
// TODO: 2024/7/31 4.1 这个类不存在WfTaskDefinitionVO
// public String getActivityUserName(WfTaskDefinitionVO 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 = userService.get(Long.parseLong(userId));
// str = userVO.getUserAccount();
// }
// }
// return str;
// }
// 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();
}
}
return str;
}
/**
* 生成内部接口签名word
*
* @param documentVO
*/
// TODO: 2024/7/31 4.1 这个类不存在WfProcessInfoVO
// public void generateInterfaceSignWord(DxDocumentVO documentVO, WfProcessInfoVO wfProcessInfoVO) {
// //合并后word存放路径
// String dirPath = Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\" + Constants.MERGER_SIGN + "\\";
// String filePath = Constants.JD_BEFORE_MERGER_PATH + documentVO.getSubTypeName() + "/" + documentVO.getNumber() + "/" + Constants.MERGER_SOURCE;
// String fileInputName = dirPath + Constants.MERGER_PDF_FILE_NAME;
// List<ExtInterfaceInfoLinkVO> interfaceInfoLinkVOS = this.recursionInterfaceInfoLinks(documentVO.getVersionId());
// if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) {
// //1、先根据提资记录生成多个文档(不需要上传到附件和主内容中)
// interfaceInfoLinkVOS.stream().forEach(item -> {
// docBeforeCreateEvent.generateAutoInterFaceWord(documentVO, item, wfProcessInfoVO);
// });
// try {
// //2、合并生成好的文档
// //生成word的路径为:D:\InetService\resource\template\words\新文档的subTypeName\新文档的number\target\mergeDoc.doc
// FileUtil.mkdir(dirPath);
// FileUtils.mergeFile(filePath, dirPath + Constants.MERGER_FILE_NAME);
// Word2PdfJacobUtil.word2PDF(dirPath + Constants.MERGER_FILE_NAME, fileInputName);
// FileInputStream inputStreamDoc = new FileInputStream(fileInputName);
// //上传到附件中
// extDocService.extractedAttachFile(documentVO, inputStreamDoc, "", Constants.ATTACH_FILE);
// } catch (Exception e) {
// log.error("生成内部接口签名====生成文档错误:" + e.getMessage());
// } finally {
// //删除生成后的临时文件
// FileUtils.deleteDirectory(Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\");
// }
// } else {
// //为空就生成单个的签名文件
// processDataUtils.generateInterFaceWord(documentVO, new ExtInterfaceInfoLinkVO(), wfProcessInfoVO);
// }
// //生成过时文件通知单
// this.generateOutNotify(documentVO, wfProcessInfoVO);
// }
public void generateInterfaceSignWord(DxDocumentVO documentVO, DxWfProcessInfoVO wfProcessInfoVO) {
//合并后word存放路径
String dirPath = Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\" + Constants.MERGER_SIGN + "\\";
String filePath = Constants.JD_BEFORE_MERGER_PATH + documentVO.getSubTypeName() + "/" + documentVO.getNumber() + "/" + Constants.MERGER_SOURCE;
String fileInputName = dirPath + Constants.MERGER_PDF_FILE_NAME;
List<ExtInterfaceInfoLinkVO> interfaceInfoLinkVOS = this.recursionInterfaceInfoLinks(documentVO.getVersionId());
if (!CollectionUtils.isEmpty(interfaceInfoLinkVOS)) {
//1、先根据提资记录生成多个文档(不需要上传到附件和主内容中)
interfaceInfoLinkVOS.stream().forEach(item -> {
docBeforeCreateEvent.generateAutoInterFaceWord(documentVO, item, wfProcessInfoVO);
});
try {
//2、合并生成好的文档
//生成word的路径为:D:\InetService\resource\template\words\新文档的subTypeName\新文档的number\target\mergeDoc.doc
FileUtil.mkdir(dirPath);
FileUtils.mergeFile(filePath, dirPath + Constants.MERGER_FILE_NAME);
Word2PdfJacobUtil.word2PDF(dirPath + Constants.MERGER_FILE_NAME, fileInputName);
FileInputStream inputStreamDoc = new FileInputStream(fileInputName);
//上传到附件中
extDocService.extractedAttachFile(documentVO, inputStreamDoc, "", Constants.ATTACH_FILE);
} catch (Exception e) {
log.error("生成内部接口签名====生成文档错误:" + e.getMessage());
} finally {
//删除生成后的临时文件
FileUtils.deleteDirectory(Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\");
}
} else {
//为空就生成单个的签名文件
processDataUtils.generateInterFaceWord(documentVO, new ExtInterfaceInfoLinkVO(), wfProcessInfoVO);
}
//生成过时文件通知单
this.generateOutNotify(documentVO, wfProcessInfoVO);
}
/**
* 自动任务-编制节点后生成word方法
......@@ -1058,9 +1054,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
public void generateQHTechDoc(Long documentId, Map<String, Object> wfTaskContext) {
DxDocumentVO documentVO = extDocUtil.findDocObjFileLinks(documentId);
if ((Constants.TECHNICAL_FILE.equals(documentVO.getDxDocumentExpand().getOneLevCategory()))) {
//TODO: 2024/7/31 4.1 不存在这个方法getWfProcessInst
// DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// TODO: 2024/7/31 4.1 不存在这个方法getProcessInstDetailById
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(documentVO);
// TODO: xpc 不存在这个方法getProcessInstDetailById
// DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId());
// //深度查询展开objFileLink
// DxDocumentVO dxDocumentVO = extDocUtil.findDocObjFileLinks(documentVO.getId());
......@@ -1084,67 +1079,67 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
* @param documentVO
* @param wfProcessInfoVO
*/
// TODO: 2024/7/31 4.1 这个类不存在WfProcessInfoVO
// private void generateOutNotify(DxDocumentVO documentVO, WfProcessInfoVO wfProcessInfoVO) {
// List<ExtObsoleteDocLinkVO> obsoleteDocLinkVOS = extDocUtil.recursionObsoleteDocLinkBySourceId(documentVO.getVersionId());
// if (!CollectionUtils.isEmpty(obsoleteDocLinkVOS)) {
// ExtObsoleteDocLinkVO obsoleteDocLinkVO = obsoleteDocLinkVOS.get(0);
// DxDocumentVO target = obsoleteDocLinkVO.getTarget();
// if (!ObjectUtils.isEmpty(target)) {
// extDocService.generateDocWordSign(target, OutdatedDocNotifyUtils.class, wfProcessInfoVO, "");
// //保存
// documentService.saveRecursion(target);
// } else {
// log.error("生成过时文件通知单失败!");
// }
// }
// }
private void generateOutNotify(DxDocumentVO documentVO, DxWfProcessInfoVO wfProcessInfoVO) {
List<ExtObsoleteDocLinkVO> obsoleteDocLinkVOS = extDocUtil.recursionObsoleteDocLinkBySourceId(documentVO.getVersionId());
if (!CollectionUtils.isEmpty(obsoleteDocLinkVOS)) {
ExtObsoleteDocLinkVO obsoleteDocLinkVO = obsoleteDocLinkVOS.get(0);
DxDocumentVO target = obsoleteDocLinkVO.getTarget();
if (!ObjectUtils.isEmpty(target)) {
extDocService.generateDocWordSign(target, OutdatedDocNotifyUtils.class, wfProcessInfoVO, "");
//保存
documentService.saveRecursion(target);
} else {
log.error("生成过时文件通知单失败!");
}
}
}
/**
* 自动任务-生成QH技术文件签审页
*/
// TODO: 2024/7/31 4.1 这个类不存在WfProcessInfoVO
// private void generateQHTechDocWord(DxDocumentVO documentVO, WfProcessInfoVO wfProcessInfoVO) {
// String dirPath = Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\" + Constants.MERGER_TARGET + "\\";
// String outWordFilePath = Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\" + Constants.MERGER_SOURCE + "\\";
// //生成特定的文档目录,保存生成的word文件
// FileUtil.mkdir(outWordFilePath);
// try {
// //先生成封皮数据
// docBeforeCreateEvent.generalTechnicalWord(documentVO);
// JSONObject jsonObject = technicalFileUtils.settingData(documentVO, wfProcessInfoVO);
// //生成校核、审核、审定的记录卡
// importWordService.getWordAllTable(jsonObject, Constants.TEMPLATE_PATH + "TechnicalFile/QHTemplate.docx", outWordFilePath + "/QHAuditDoc.docx");
// //生成接口会签
// technicalFileUtils.interfaceHQSetting(documentVO, wfProcessInfoVO);
// //专项审查表
// technicalFileUtils.specialSCSetting(documentVO, wfProcessInfoVO);
// //合并生成好的文档
// FileUtils.mergePdfFile(outWordFilePath, dirPath + Constants.MERGER_PDF_FILE_NAME);
// log.info("生成QH技术文件签审页-合并pdf文件完成!");
// //将pdf上传到附件中(客制化)
// extDocService.extractedAttachFile(documentVO, new FileInputStream(dirPath + Constants.MERGER_PDF_FILE_NAME), "附件二", Constants.ATTACH_FILE);
// } catch (Exception exception) {
// log.error("自动任务-生成QH技术文件签审页错误!" + exception.getMessage());
// } finally {
// //删除生成后的临时文件
// FileUtils.deleteDirectory(Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\");
// }
// }
private void generateQHTechDocWord(DxDocumentVO documentVO, DxWfProcessInfoVO wfProcessInfoVO) {
String dirPath = Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\" + Constants.MERGER_TARGET + "\\";
String outWordFilePath = Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\" + Constants.MERGER_SOURCE + "\\";
//生成特定的文档目录,保存生成的word文件
FileUtil.mkdir(outWordFilePath);
try {
//先生成封皮数据
docBeforeCreateEvent.generalTechnicalWord(documentVO);
JSONObject jsonObject = technicalFileUtils.settingData(documentVO, wfProcessInfoVO);
//生成校核、审核、审定的记录卡
importWordService.getWordAllTable(jsonObject, Constants.TEMPLATE_PATH + "TechnicalFile/QHTemplate.docx", outWordFilePath + "/QHAuditDoc.docx");
//生成接口会签
technicalFileUtils.interfaceHQSetting(documentVO, wfProcessInfoVO);
//专项审查表
technicalFileUtils.specialSCSetting(documentVO, wfProcessInfoVO);
//合并生成好的文档
FileUtils.mergePdfFile(outWordFilePath, dirPath + Constants.MERGER_PDF_FILE_NAME);
log.info("生成QH技术文件签审页-合并pdf文件完成!");
//将pdf上传到附件中(客制化)
extDocService.extractedAttachFile(documentVO, new FileInputStream(dirPath + Constants.MERGER_PDF_FILE_NAME), "附件二", Constants.ATTACH_FILE);
} catch (Exception exception) {
log.error("自动任务-生成QH技术文件签审页错误!" + exception.getMessage());
} finally {
//删除生成后的临时文件
FileUtils.deleteDirectory(Constants.MERGER_FILE_ABSOLUTE_PATH + documentVO.getSubTypeName() + "\\" + documentVO.getNumber() + "\\");
}
}
/**
* 结束流程实例
*
* @param iterationObject
*/
// TODO: 2024/7/31 4.1 这个类不存在DxIterationVO
// @Override
// public void endProcess(DxIterationVO iterationObject) {
// WfProcessInstVO wfProcessInstVO = workFlowUtil.getWfProcessInst(iterationObject);
// if (Objects.nonNull(wfProcessInstVO)) {
// dexWorkFlowService.endProcessInst(wfProcessInstVO.getId());
// }
// }
// TODO: xpc DxIterationVO不存在改为DxIterationVOHolder
@Override
public void endProcess(DxIterationVOHolder iterationObject) {
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(iterationObject);
if (Objects.nonNull(wfProcessInstVO)) {
// TODO: xpc endProcessInst()不存在,改为stopProcess()
wfInstanceService.stopProcess(wfProcessInstVO.getId());
}
}
/**
* 生成过时文件通知单word
......@@ -1158,8 +1153,8 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
obsoleteDocLinkVOS.stream().forEach(item -> {
DxDocumentVO source = item.getSource();
if (!ObjectUtils.isEmpty(source)) {
// TODO: 2024/7/31 4.1 这个类不存在WfProcessInstVO
// WfProcessInstVO wfProcessInstVO = workFlowUtil.getWfProcessInst(source);
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(source);
// TODO: xpc 这个方法不存在getProcessInstDetailById
// DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstDetailById(wfProcessInstVO.getId());
// extDocService.generateDocWordSign(documentVO, OutdatedDocNotifyUtils.class, wfProcessInfoVO, "");
// } else {
......@@ -1180,7 +1175,6 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
public void changeOldDataState(DxDocumentVO documentVO) {
//获取上一大版本的最新小版本
//List<DxDocumentVO> docVersions = documentService.getLastedIterationByVersions(documentVO.getId());
List<DxDocumentVO> allDocVersions = documentService.getAllIterationsByObjId(documentVO.getId());
if (!CollectionUtils.isEmpty(allDocVersions)) {
allDocVersions.stream().forEach((doc) -> {
......@@ -1217,24 +1211,25 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
DxPageImpl<ExtApplicantVO> recursion = extApplicantService.findRecursion(queryCondition);
ExtApplicantVO applicantVO = recursion.getContent().get(0);
//TODO 获取任务参与者信息,key:占位符,value:人名 节点名称还需要补充
// Map<String, String> taskMap = getTaskParticipants(context);
// //将签字后的pdf挂到接口单上面
// PapersVO papersVO = ObjFileLinkUtil.getAppointTypeFile(applicantVO, Constants.MASTER_FILE).get(0);
// String temDir = DxFileUtils.createRandomTemp("interface");
// String interFacePath = downPaperToLocal(papersVO, temDir);
// String interSignPath = temDir + "签字_" + papersVO.getOriginalFileName();
// //pdf签字
// PDFUtil.signWord(interFacePath, interSignPath, taskMap);
// FileUtil.rename(new File(interSignPath), papersVO.getOriginalFileName(), true);
// //删除旧文件,增加新文件
// ObjFileLinkUtil.removeFile(applicantVO, Constants.MASTER_FILE);
// papersVO = savePDFToMinio(interFacePath);//上传到minio
// //TODO 附件上传待指定
// ObjFileLinkUtil.addFile(applicantVO, papersVO, Constants.MASTER_FILE);
// extInterfaceService.saveRecursion(applicantVO);
// FileUtils.deleteDirectory(temDir);
Map<String, String> taskMap = getTaskParticipants(context);
//将签字后的pdf挂到接口单上面
RepoFileVO papersVO = ObjFileLinkUtil.getAppointTypeFile(applicantVO, Constants.MASTER_FILE).get(0);
String temDir = DxFileUtils.createRandomTemp("interface");
String interFacePath = downPaperToLocal(papersVO, temDir);
String interSignPath = temDir + "签字_" + papersVO.getOriginalFileName();
//pdf签字
PDFUtil.signWord(interFacePath, interSignPath, taskMap);
FileUtil.rename(new File(interSignPath), papersVO.getOriginalFileName(), true);
//删除旧文件,增加新文件
ObjFileLinkUtil.removeFile(applicantVO, Constants.MASTER_FILE);
papersVO = savePDFToMinio(interFacePath);//上传到minio
//TODO 附件上传待指定
ObjFileLinkUtil.addFile(applicantVO, papersVO, Constants.MASTER_FILE);
extInterfaceService.saveRecursion(applicantVO);
FileUtils.deleteDirectory(temDir);
}
/**
* 获取流程参与者
*
......@@ -1251,21 +1246,23 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@SneakyThrows
public Map<String, String> getTaskParticipants(String processId) {
Map<String, String> data = new HashMap<>();
//TODO
//TODO xpc getProcessInstSimpleDetailById方法不存在,改为getHisTaskList()
// DxWfProcessInfoVO wfProcessInfoVO = dexWorkFlowService.getProcessInstSimpleDetailById(processId);
// List<DxWfProcessTaskVO> activities = wfProcessInfoVO.getHistoryInfo();
// String dateStr = "";
// HashMap<String, String> signMap = CloneUtils.cloneObject(SignConstants.SignNodeMap);
// for (Map.Entry<String, String> entry : signMap.entrySet()) {
// dateStr = new StringBuffer(entry.getValue()).reverse().toString();
// //节点参与人
// data.put(entry.getValue(), getResolverName(activities, entry.getKey()));
// //节点时间
// data.put(dateStr, getResolverData(activities, entry.getKey()));
// }
// data.entrySet().removeIf(o -> org.springframework.util.StringUtils.isEmpty(o.getValue()));
List<DxWfProcessTaskVO> activities = taskService.getHisTaskList(processId, null, 1, Integer.MAX_VALUE).getContent();
String dateStr = "";
HashMap<String, String> signMap = CloneUtils.cloneObject(SignConstants.SignNodeMap);
for (Map.Entry<String, String> entry : signMap.entrySet()) {
dateStr = new StringBuffer(entry.getValue()).reverse().toString();
//节点参与人
data.put(entry.getValue(), getResolverName(activities, entry.getKey()));
//节点时间
data.put(dateStr, getResolverData(activities, entry.getKey()));
}
data.entrySet().removeIf(o -> org.springframework.util.StringUtils.isEmpty(o.getValue()));
return data;
}
/**
* 下载文件到本地
*
......@@ -1273,27 +1270,27 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
* @param dir
* @return
*/
// public String downPaperToLocal(PapersVO file, String dir) {
// InputStream inputStream = null;
// CustomMultipartFile multipartFile = null;
// try {
// multipartFile = feignDownloadService.downloadio(file.getId());
// } catch (IOException e) {
// log.info("[接口单] >>> 文件服务下载为文件:{}--失败!", file.getId());
// throw new DxBusinessException("500", "文件服务下载文件失败:" + file);
// }
// try {
// inputStream = new ByteArrayInputStream(multipartFile.getBytes());
// } catch (IOException e) {
// log.info("[接口单] >>> 文件服务下载的文件:{}--转换为输入流失败!", file.getId());
// throw new DxBusinessException("500", "文件服务下载的文件转换为输入流失败:" + file);
// }
// String filePath = dir + file.getOriginalFileName();
// //保存到本地目录
// FileUtils.inputToFile(inputStream, filePath);
// return filePath;
//
// }
public String downPaperToLocal(RepoFileVO file, String dir) {
InputStream inputStream = null;
CustomMultipartFile multipartFile = null;
try {
multipartFile = fileManagerFeignService.feignDownloadIO(file.getId());
} catch (IOException e) {
log.info("[接口单] >>> 文件服务下载为文件:{}--失败!", file.getId());
throw new DxBusinessException("500", "文件服务下载文件失败:" + file);
}
try {
inputStream = new ByteArrayInputStream(multipartFile.getBytes());
} catch (IOException e) {
log.info("[接口单] >>> 文件服务下载的文件:{}--转换为输入流失败!", file.getId());
throw new DxBusinessException("500", "文件服务下载的文件转换为输入流失败:" + file);
}
String filePath = dir + file.getOriginalFileName();
//保存到本地目录
FileUtils.inputToFile(inputStream, filePath);
return filePath;
}
/**
* 获取某个环节执行者
......@@ -1314,25 +1311,26 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
/**
* 保存pdf到文件服务
*
* @param pdfPath
* @return
*/
// @Transactional(rollbackFor = Exception.class)
// public PapersVO savePDFToMinio(String pdfPath) throws IOException {
// String pdfName = pdfPath.substring(pdfPath.lastIndexOf("/") + 1);
// MultipartFile multipartFile = new MockMultipartFile("file", pdfName,
// ContentType.MULTIPART.toString(), new FileInputStream(pdfPath));
// Long field = fileManagerFeignService.upload(multipartFile, Constants.BUCKET_NAME);
// if (field == null) {
// log.error(">>> 接口单pdf >>> 文件上传失败!");
// throw new DxBusinessException("500", "文件服务上传文件失败:" + pdfPath);
// } else {
// log.info(">>> 接口单pdf >>>文件上传成功:{}", field);
// }
// //根据docId查询文件对象
// PapersVO fileVO = fileManagerFeignService.findFileInfoById(field);
// return fileVO;
// }
@Transactional(rollbackFor = Exception.class)
public RepoFileVO savePDFToMinio(String pdfPath) throws IOException {
String pdfName = pdfPath.substring(pdfPath.lastIndexOf("/") + 1);
MultipartFile multipartFile = new MockMultipartFile("file", pdfName,
ContentType.MULTIPART.toString(), new FileInputStream(pdfPath));
RepoFileVO field = fileManagerFeignService.uploadFile(multipartFile, Long.valueOf(Constants.BUCKET_NAME));
if (field == null) {
log.error(">>> 接口单pdf >>> 文件上传失败!");
throw new DxBusinessException("500", "文件服务上传文件失败:" + pdfPath);
} else {
log.info(">>> 接口单pdf >>>文件上传成功:{}", field);
}
//根据docId查询文件对象
RepoFileVO fileVO = fileManagerFeignService.findFileInfoById(field.getId());
return fileVO;
}
/**
* 获取某个环节的结束时间
......@@ -1376,34 +1374,33 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@SneakyThrows
@Override
public void autoInterFaceSign(Long extInterfaceId, Map<String, Object> wfTaskContext) {
//TODO
// DxWfTaskContext context = (DxWfTaskContext) wfTaskContext.get("context");
// SearchQueryCondition queryCondition = SearchUtil.buildQueryWithOpenAttr("id", SearchItem.Operator.EQ, extInterfaceId, "objFileLinks.target");
// DxPageImpl<ExtInterfaceVO> recursion = extInterfaceService.findRecursion(queryCondition);
// ExtInterfaceVO extInterfaceVO = recursion.getContent().get(0);
// //TODO 申请内容节点信息
// ExtApplicantVO applicantVO = (ExtApplicantVO) extApplicantService.get(extInterfaceVO.getExtApplicantId());
// Map<String, String> taskMap = ExtWfcUtil.getProcessTeam(ExtApplicantVO.class, applicantVO.getVersionId(), SignConstants.SignNodeMap);
// //TODO 接口单接点信息
// Map<String, String> interFaceMap = ExtWfcUtil.getProcessTeam(ExtInterfaceVO.class, extInterfaceVO.getVersionId(), SignConstants.InterfaceSignNodeMap);
// if (MapUtils.isNotEmpty(interFaceMap)){
// taskMap.putAll(interFaceMap);
// }
// TODO 将签字后的pdf挂到接口单上面
// PapersVO papersVO = ObjFileLinkUtil.getAppointTypeFile(extInterfaceVO, Constants.MASTER_FILE).get(0);
// String temDir = DxFileUtils.createRandomTemp("interface");
// String interFacePath = downPaperToLocal(papersVO, temDir);
// String interSignPath = temDir + "签字_" + papersVO.getOriginalFileName();
// //pdf签字
// PDFUtil.signWord(interFacePath, interSignPath, taskMap);
// FileUtil.rename(new File(interSignPath), papersVO.getOriginalFileName(), true);
// //删除旧文件,增加新文件
// ObjFileLinkUtil.removeFile(extInterfaceVO, Constants.MASTER_FILE);
// papersVO = savePDFToMinio(interFacePath);//上传到minio
// //TODO 附件上传待指定
// ObjFileLinkUtil.addFile(extInterfaceVO, papersVO, Constants.MASTER_FILE);
// extInterfaceService.saveRecursion(extInterfaceVO);
// FileUtils.deleteDirectory(temDir);
DxWfTaskContext context = (DxWfTaskContext) wfTaskContext.get("context");
SearchQueryCondition queryCondition = SearchUtil.buildQueryWithOpenAttr("id", SearchItem.Operator.EQ, extInterfaceId, "objFileLinks.target");
DxPageImpl<ExtInterfaceVO> recursion = extInterfaceService.findRecursion(queryCondition);
ExtInterfaceVO extInterfaceVO = recursion.getContent().get(0);
//TODO 申请内容节点信息
ExtApplicantVO applicantVO = (ExtApplicantVO) extApplicantService.get(extInterfaceVO.getExtApplicantId());
Map<String, String> taskMap = ExtWfcUtil.getProcessTeam(ExtApplicantVO.class, applicantVO.getVersionId(), SignConstants.SignNodeMap);
//TODO 接口单接点信息
Map<String, String> interFaceMap = ExtWfcUtil.getProcessTeam(ExtInterfaceVO.class, extInterfaceVO.getVersionId(), SignConstants.InterfaceSignNodeMap);
if (MapUtils.isNotEmpty(interFaceMap)) {
taskMap.putAll(interFaceMap);
}
//TODO 将签字后的pdf挂到接口单上面
RepoFileVO papersVO = ObjFileLinkUtil.getAppointTypeFile(extInterfaceVO, Constants.MASTER_FILE).get(0);
String temDir = DxFileUtils.createRandomTemp("interface");
String interFacePath = downPaperToLocal(papersVO, temDir);
String interSignPath = temDir + "签字_" + papersVO.getOriginalFileName();
//pdf签字
PDFUtil.signWord(interFacePath, interSignPath, taskMap);
FileUtil.rename(new File(interSignPath), papersVO.getOriginalFileName(), true);
//删除旧文件,增加新文件
ObjFileLinkUtil.removeFile(extInterfaceVO, Constants.MASTER_FILE);
papersVO = savePDFToMinio(interFacePath);//上传到minio
//TODO 附件上传待指定
ObjFileLinkUtil.addFile(extInterfaceVO, papersVO, Constants.MASTER_FILE);
extInterfaceService.saveRecursion(extInterfaceVO);
FileUtils.deleteDirectory(temDir);
}
/**
......@@ -1414,19 +1411,16 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Override
@Transactional(rollbackFor = Exception.class)
public void autoInterfaceEnd(ExtAuditObjectVO auditObjectVO) {
//TODO
// SearchQueryCondition queryCondition = SearchUtil.buildQueryWithOpenAttr("sourceId", SearchItem.Operator.EQ, auditObjectVO.getId(), "target");
// DxPageImpl<ExtAuditInterfLinkVO> recursion = extAuditInterfLinkService.findRecursion(queryCondition);
// if (CollectionUtil.isNotEmpty(recursion.getContent())) {
// //TODO 设置接口单状态为终止
// List<ExtAuditInterfLinkVO> content = recursion.getContent();
// for (ExtAuditInterfLinkVO linkVO : content) {
// ExtInterfaceVO interfaceVO = linkVO.getTarget();
// extInterfaceService.changeStatus(interfaceVO, Constants.STATUS_END, true);
// }
//
// }
SearchQueryCondition queryCondition = SearchUtil.buildQueryWithOpenAttr("sourceId", SearchItem.Operator.EQ, auditObjectVO.getId(), "target");
DxPageImpl<ExtAuditInterfLinkVO> recursion = extAuditInterfLinkService.findRecursion(queryCondition);
if (CollectionUtil.isNotEmpty(recursion.getContent())) {
//TODO 设置接口单状态为终止
List<ExtAuditInterfLinkVO> content = recursion.getContent();
for (ExtAuditInterfLinkVO linkVO : content) {
ExtInterfaceVO interfaceVO = linkVO.getTarget();
extInterfaceService.changeStatus(interfaceVO.getId(), Constants.STATUS_END, true);
}
}
}
/**
......@@ -1437,68 +1431,68 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Override
@Transactional(rollbackFor = Exception.class)
public void startInterFaceFlow(ExtApplicantVO applicantVO) {
//TODO
// applicantVO.setOperator(OperatorType.NO_CHANGE);
// //获取申请内容所关联的提资人
// String providers = applicantVO.getProviders();
// //TODO 组织id 逗号隔开
// String[] split = providers.split(",");
// List<DxOrganizationVO> organizationVOList = new ArrayList<>();
// for (String orgId : split) {
// DxOrganizationVO organizationVO = organizationService.get(Long.valueOf(orgId));
// organizationVOList.add(organizationVO);
//
// }
// String userAccount = applicantVO.getCreator().getAccount();
// try {
// changeUserHelper.switchServiceUser(userAccount);
// for (DxOrganizationVO organizationVO : organizationVOList) {
// ExtInterfaceVO extInterfaceVO = new ExtInterfaceVO();
// //TODO 设置提资人ID 取组织下面 岗位为 主设人 的用户
// Long userId = getUserByOrg(organizationVO);
// extInterfaceVO.setDxClassname(extInterfaceVO.getDxClassname());
applicantVO.setOperator(OperatorType.NO_CHANGE);
//获取申请内容所关联的提资人
String providers = applicantVO.getProviders();
//TODO 组织id 逗号隔开
String[] split = providers.split(",");
List<DxOrganizationVO> organizationVOList = new ArrayList<>();
for (String orgId : split) {
DxOrganizationVO organizationVO = (DxOrganizationVO) dxOrganizationFeign.get(Long.valueOf(orgId));
organizationVOList.add(organizationVO);
}
Long creatorUserId = applicantVO.getCreator().getUserId();
try {
switchUserService.switchUser(creatorUserId);
for (DxOrganizationVO organizationVO : organizationVOList) {
ExtInterfaceVO extInterfaceVO = new ExtInterfaceVO();
//TODO 设置提资人ID 取组织下面 岗位为 主设人 的用户
Long userId = getUserByOrg(organizationVO);
extInterfaceVO.setDxClassname(extInterfaceVO.getDxClassname());
//TODO xpc setDxContextId这个属性不存在,可能是因为没勾选上下文插件
// extInterfaceVO.setDxContextId(applicantVO.getDxContextId());
// extInterfaceVO.setExtApplicant(applicantVO);
// extInterfaceVO.setProviderId(userId);
// extInterfaceVO.setExtApplicantId(applicantVO.getId());
// extInterfaceVO.setExtApplicantIdType(applicantVO.getSubTypeName());
// extInterfaceVO.setApplicatDate(applicantVO.getSubmitDate());
// extInterfaceVO.setOperator(OperatorType.ADD);
// organizationVO.setOperator(OperatorType.NO_CHANGE);
// extInterfaceVO.setProviderOrg(organizationVO);
// extInterfaceVO.setApplicantOrg(organizationVO);
// extInterfaceVO.setApplicantOrgId(applicantVO.getApplicantOrgId());
// extInterfaceVO.setApplicantOrgIdType(applicantVO.getApplicantOrgIdType());
// extInterfaceVO = (ExtInterfaceVO) extInterfaceService.saveRecursion(extInterfaceVO);
//
// //TODO 手动启动流程
// DxWfProcessStartVO startVO = new DxWfProcessStartVO();
// startVO.setBusinessObject(extInterfaceVO);
// startVO.setProcessDefKey("ExtInterface");
// startVO.setBusinessService(extInterfaceVO.getDxClassname());
// startVO.setBusinessObjectId(String.valueOf(extInterfaceVO.getId()));
// startVO.setUserId(applicantVO.getCreator().getUserId().toString());
//
// Map<String, Object> var = new HashMap<>();
// DxWfTaskPerformerVO taskPerformerVO = new DxWfTaskPerformerVO();
// List<String> userIdList = new ArrayList<>();
// // 此处放入任务接收人id
// userIdList.add(String.valueOf(userId));
// taskPerformerVO.setPerformers(userIdList);
//
// var.put("taskPerformer", JsonUtils.toJsonStr(taskPerformerVO));
// startVO.setProcessVar(var);
// //TODO 手动启动流程
// dexWorkFlowService.startProcessWithVar(startVO);
// //废弃版
// //dexWorkFlowService.startProcessByKey("ExtInterface", extInterfaceVO);
// }
//
// } catch (Exception e) {
// throw new DxBusinessException("-1 切换用户失败", e.getMessage());
// } finally {
extInterfaceVO.setExtApplicant(applicantVO);
extInterfaceVO.setProviderId(userId);
extInterfaceVO.setExtApplicantId(applicantVO.getId());
extInterfaceVO.setExtApplicantIdType(applicantVO.getSubTypeName());
extInterfaceVO.setApplicatDate(applicantVO.getSubmitDate());
extInterfaceVO.setOperator(OperatorType.ADD);
organizationVO.setOperator(OperatorType.NO_CHANGE);
extInterfaceVO.setProviderOrg(organizationVO);
extInterfaceVO.setApplicantOrg(organizationVO);
extInterfaceVO.setApplicantOrgId(applicantVO.getApplicantOrgId());
extInterfaceVO.setApplicantOrgIdType(applicantVO.getApplicantOrgIdType());
extInterfaceVO = (ExtInterfaceVO) extInterfaceService.saveRecursion(extInterfaceVO);
//TODO 手动启动流程
DxWfProcessStartVO startVO = new DxWfProcessStartVO();
startVO.setBusinessObject(extInterfaceVO);
startVO.setProcessDefKey("ExtInterface");
startVO.setBusinessService(extInterfaceVO.getDxClassname());
startVO.setBusinessObjectId(String.valueOf(extInterfaceVO.getId()));
startVO.setUserId(applicantVO.getCreator().getUserId().toString());
Map<String, Object> var = new HashMap<>();
DxWfTaskPerformerVO taskPerformerVO = new DxWfTaskPerformerVO();
List<String> userIdList = new ArrayList<>();
// 此处放入任务接收人id
userIdList.add(String.valueOf(userId));
taskPerformerVO.setPerformers(userIdList);
var.put("taskPerformer", JsonUtils.toJsonStr(taskPerformerVO));
startVO.setProcessVar(var);
//TODO 手动启动流程
wfInstanceService.startProcess(startVO);
//废弃版
//dexWorkFlowService.startProcessByKey("ExtInterface", extInterfaceVO);
}
} catch (Exception e) {
throw new DxBusinessException("-1 切换用户失败", e.getMessage());
} finally {
// changeUserHelper.closeSwitchUser();
// }
}
}
/**
......@@ -1509,61 +1503,61 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
@Override
@Transactional(rollbackFor = Exception.class)
public void startAddInterFaceFlow(ExtInterfaceVO extInterfaceVO) {
//TODO
// String userAccount = extInterfaceVO.getCreator().getAccount();
// try {
// changeUserHelper.switchServiceUser(userAccount);
// //若申请方确认 属性值 不为 关闭,则需要重新启动流程
// ExtInterfaceVO newInterFace = new ExtInterfaceVO();
// //TODO 接口单编号规则 需要用到申请内容,需要把申请内容对象塞进去
// ExtApplicantVO applicantVO = (ExtApplicantVO) extApplicantService.get(extInterfaceVO.getExtApplicantId());
// applicantVO.setOperator(OperatorType.NO_CHANGE);
// newInterFace.setPreviousId(extInterfaceVO.getId());
Long userAccount = extInterfaceVO.getCreator().getUserId();
try {
switchUserService.switchUser(userAccount);
//若申请方确认 属性值 不为 关闭,则需要重新启动流程
ExtInterfaceVO newInterFace = new ExtInterfaceVO();
//TODO 接口单编号规则 需要用到申请内容,需要把申请内容对象塞进去
ExtApplicantVO applicantVO = (ExtApplicantVO) extApplicantService.get(extInterfaceVO.getExtApplicantId());
applicantVO.setOperator(OperatorType.NO_CHANGE);
newInterFace.setPreviousId(extInterfaceVO.getId());
//TODO xpc setDxContextId这个属性不存在,可能是因为没勾选上下文插件
// newInterFace.setDxContextId(applicantVO.getDxContextId());
// newInterFace.setProviderId(extInterfaceVO.getProviderId());
// newInterFace.setProviderIdType(extInterfaceVO.getProviderIdType());
// newInterFace.setApplicatDate(extInterfaceVO.getApplicatDate());
// newInterFace.setProvideContent(extInterfaceVO.getProvideContent());
// newInterFace.setDynamicAttrs(extInterfaceVO.getDynamicAttrs());
// //TODO 初始化规则需要知道提资方
// OrganizationVO organizationVO = organizationService.get(extInterfaceVO.getProviderOrgId());
// organizationVO.setOperator(OperatorType.NO_CHANGE);
// newInterFace.setProviderOrg(organizationVO);
// newInterFace.setProviderOrgId(extInterfaceVO.getProviderOrgId());
// newInterFace.setProviderOrgIdType(extInterfaceVO.getProviderOrgIdType());
// newInterFace.setApplicantOrgId(extInterfaceVO.getApplicantOrgId());
// newInterFace.setApplicantOrgIdType(extInterfaceVO.getApplicantOrgIdType());
// //TODO 编号和名称待定 后续需要确认 是否能按初始化规则生成
// newInterFace.setExtApplicant(applicantVO);
// newInterFace.setOperator(OperatorType.ADD);
// newInterFace = (ExtInterfaceVO) extInterfaceService.saveRecursion(newInterFace);
//
// //TODO 手动启动流程
// DxWfProcessStartVO startVO = new DxWfProcessStartVO();
// startVO.setBusinessObject(newInterFace);
// startVO.setProcessDefKey("ExtInterface");
// startVO.setBusinessService(newInterFace.getDxClassname());
// startVO.setBusinessObjectId(String.valueOf(newInterFace.getId()));
// startVO.setUserId(extInterfaceVO.getCreator().getUserId().toString());
//
// Map<String, Object> var = new HashMap<>();
// DxWfTaskPerformerVO taskPerformerVO = new DxWfTaskPerformerVO();
// List<String> userIdList = new ArrayList<>();
// // 此处放入任务接收人id
//// Long userId = getUserByOrgId(extInterfaceVO.getProviderOrgId());
// Long userId = extInterfaceVO.getProviderId();
// userIdList.add(String.valueOf(userId));
// taskPerformerVO.setPerformers(userIdList);
//
// var.put("taskPerformer", JsonUtils.toJsonStr(taskPerformerVO));
// startVO.setProcessVar(var);
// //TODO 手动启动流程
// dexWorkFlowService.startProcessWithVar(startVO);
// } catch (Exception e) {
// throw new DxBusinessException("-1 切换用户失败", e.getMessage());
// } finally {
newInterFace.setProviderId(extInterfaceVO.getProviderId());
newInterFace.setProviderIdType(extInterfaceVO.getProviderIdType());
newInterFace.setApplicatDate(extInterfaceVO.getApplicatDate());
newInterFace.setProvideContent(extInterfaceVO.getProvideContent());
newInterFace.setDynamicAttrs(extInterfaceVO.getDynamicAttrs());
//TODO 初始化规则需要知道提资方
DxOrganizationVO organizationVO = (DxOrganizationVO) dxOrganizationFeign.get(extInterfaceVO.getProviderOrgId());
organizationVO.setOperator(OperatorType.NO_CHANGE);
newInterFace.setProviderOrg(organizationVO);
newInterFace.setProviderOrgId(extInterfaceVO.getProviderOrgId());
newInterFace.setProviderOrgIdType(extInterfaceVO.getProviderOrgIdType());
newInterFace.setApplicantOrgId(extInterfaceVO.getApplicantOrgId());
newInterFace.setApplicantOrgIdType(extInterfaceVO.getApplicantOrgIdType());
//TODO 编号和名称待定 后续需要确认 是否能按初始化规则生成
newInterFace.setExtApplicant(applicantVO);
newInterFace.setOperator(OperatorType.ADD);
newInterFace = (ExtInterfaceVO) extInterfaceService.saveRecursion(newInterFace);
//TODO 手动启动流程
DxWfProcessStartVO startVO = new DxWfProcessStartVO();
startVO.setBusinessObject(newInterFace);
startVO.setProcessDefKey("ExtInterface");
startVO.setBusinessService(newInterFace.getDxClassname());
startVO.setBusinessObjectId(String.valueOf(newInterFace.getId()));
startVO.setUserId(extInterfaceVO.getCreator().getUserId().toString());
Map<String, Object> var = new HashMap<>();
DxWfTaskPerformerVO taskPerformerVO = new DxWfTaskPerformerVO();
List<String> userIdList = new ArrayList<>();
// 此处放入任务接收人id
// Long userId = getUserByOrgId(extInterfaceVO.getProviderOrgId());
Long userId = extInterfaceVO.getProviderId();
userIdList.add(String.valueOf(userId));
taskPerformerVO.setPerformers(userIdList);
var.put("taskPerformer", JsonUtils.toJsonStr(taskPerformerVO));
startVO.setProcessVar(var);
//TODO 手动启动流程
wfInstanceService.startProcess(startVO);
} catch (Exception e) {
throw new DxBusinessException("-1 切换用户失败", e.getMessage());
} finally {
// changeUserHelper.closeSwitchUser();
// }
}
}
/**
......@@ -1585,7 +1579,7 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
if (!CollectionUtil.isEmpty(collect) && !CollectionUtil.isEmpty(extInterfaces)) {
if (extInterfaces.size() == collect.size()) {
//TODO 申请内容关联的多个内部接口单 状态全部为“已发布(关闭)”后,应该自动将申请内容状态置为“全部关闭”
//TODO extApplicantService.changeStatus(first.get(),Constants.CLOSE_ALL,true);
extApplicantService.changeStatus(first.get().getId(), Constants.CLOSE_ALL, true);
// extApplicantService.changeStatus(first.get(),Constants.OBSOLETE,true);
}
}
......@@ -1606,4 +1600,23 @@ public class ExtAutoTaskServiceImpl implements ExtAutoTaskService {
interfaceVO.setProviderId(processTiZiId);
interfaceVO = (ExtInterfaceVO) extInterfaceService.update(interfaceVO);
}
/**
* TODO 获取组织下面 岗位为主设人 的用户
*
* @param organizationVO
* @return
*/
public Long getUserByOrg(DxOrganizationVO organizationVO) {
//TODO xpc userGroupRefService.getUserRefByOrgId()不存在
// List<UserGroupRefVO> userRefByOrgId = this.userGroupRefService.getUserRefByOrgId(organizationVO.getId());
// if (CollectionUtil.isEmpty(userRefByOrgId)) {
// return null;
// }
// Optional<UserGroupRefVO> first = userRefByOrgId.stream().filter(o -> "主设人".equalsIgnoreCase(o.getPostName())).findFirst();
// return first.map(userGroupRefVO -> Long.valueOf(userGroupRefVO.getUserId())).orElse(null);
return null;
}
}
......@@ -9,6 +9,7 @@ import com.yonde.dcs.core.constants.Constants;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dfs.handler.ContentHolder;
import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import lombok.SneakyThrows;
......@@ -33,6 +34,28 @@ import java.util.stream.Collectors;
*/
@Slf4j
public class FileUtils {
/**
* 保存到本地目录
* @param inputStream
* @param fileUrl 文件绝对路径
*/
public static void inputToFile(InputStream inputStream, String fileUrl){
OutputStream outputStream = null;
try {
try {
outputStream = new FileOutputStream(fileUrl);
} catch (FileNotFoundException e) {
log.info("保存到本地临时目录失败:{}!", fileUrl);
throw new DxBusinessException("500", "保存文件到本地临时目录失败:" + fileUrl);
}
IoUtil.copy(inputStream, outputStream);
} finally {
IoUtil.close(inputStream);
IoUtil.close(outputStream);
}
}
/**
* MultipartFile转fie
*
......
......@@ -4,6 +4,7 @@ import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.basedata.entity.vo.IdVO;
import com.yonde.dex.dfs.handler.ContentHolder;
import com.yonde.dex.dfs.vo.ObjFileLinkVO;
import com.yonde.dex.dfs.vo.RepoFileVO;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
......@@ -46,17 +47,17 @@ public class ObjFileLinkUtil {
// addFile(holder, fileVO, fileType);
// }
//
// public static <T extends IdVO & ContentHolder> void addFile(T holder, PapersVO fileVO, String fileType) {
// if (CollectionUtils.isEmpty(((ContentHolder)holder).getObjFileLinks())) {
// ((ContentHolder)holder).setObjFileLinks(new ArrayList());
// }
//
// ObjFileLinkVO linkVo = new ObjFileLinkVO();
// linkVo.setTarget(fileVO);
// linkVo.setOperator(OperatorType.ADD);
// linkVo.setContentType(fileType);
// ((ContentHolder)holder).getObjFileLinks().add(linkVo);
// }
public static <T extends IdVO & ContentHolder> void addFile(T holder, RepoFileVO fileVO, String fileType) {
if (CollectionUtils.isEmpty(((ContentHolder)holder).getObjFileLinks())) {
((ContentHolder)holder).setObjFileLinks(new ArrayList());
}
ObjFileLinkVO linkVo = new ObjFileLinkVO();
linkVo.setTarget(fileVO);
linkVo.setOperator(OperatorType.ADD);
linkVo.setContentType(fileType);
((ContentHolder)holder).getObjFileLinks().add(linkVo);
}
/**
......@@ -148,15 +149,16 @@ public class ObjFileLinkUtil {
* @param <T>
* @return
*/
// public static <T extends IdVO & ContentHolder> List<PapersVO> getAppointTypeFile(T holder, String fileType) {
// if (!Objects.isNull(holder) && !CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) {
// List<ObjFileLinkVO> fileLinkVOList = holder.getObjFileLinks().stream().filter(o -> o.getContentType().equalsIgnoreCase(fileType)).collect(Collectors.toList());
// if (!CollectionUtils.isEmpty(fileLinkVOList)) {
// return fileLinkVOList.stream().map(ObjFileLinkVO::getTarget).collect(Collectors.toList());
// }
// }
// return null;
// }
public static <T extends IdVO & ContentHolder> List<RepoFileVO> getAppointTypeFile(T holder, String fileType) {
if (!Objects.isNull(holder) && !CollectionUtils.isEmpty(((ContentHolder) holder).getObjFileLinks())) {
List<ObjFileLinkVO> fileLinkVOList = holder.getObjFileLinks().stream().filter(o -> o.getContentType().equalsIgnoreCase(fileType)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(fileLinkVOList)) {
return fileLinkVOList.stream().map(ObjFileLinkVO::getTarget).collect(Collectors.toList());
}
}
return null;
}
/**
* 获取对象指定 类型的file
......
......@@ -45,10 +45,7 @@ public class WorkFlowUtil {
* @param iterationVO
* @return
*/
// TODO: 2024/8/1 DxIterationVO不存在
// TODO: xpc WfProcessInstVO不存在改为DxWfProcessVO,IterationVO不存在改为DxIterationVOHolder
// TODO: xpc WfProcessInstVO不存在改为DxWfProcessVO,DxIterationVO不存在改为DxIterationVOHolder
public DxWfProcessVO getWfProcessInst(DxIterationVOHolder iterationVO) {
// TODO: getProcessInstList方法不存在改为getProcessList
// DxWfProcessSearchVO wfProcessInstSearchVO = new DxWfProcessSearchVO();
......
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