Commit d297c1dc authored by wei's avatar wei 🎱

监听移交单状态已完成,更新数据

parent 826e4d18
...@@ -14,6 +14,7 @@ public final class SignConstants { ...@@ -14,6 +14,7 @@ public final class SignConstants {
//签名取值 //签名取值
public static final String SIGN_KEY_PREPARED = "编制"; public static final String SIGN_KEY_PREPARED = "编制";
public static final String SIGN_KEY_DAZSH = "档案组审核";
public static final String SIGN_KEY_TSSH = "同室审核"; public static final String SIGN_KEY_TSSH = "同室审核";
public static final String SIGN_KEY_FXTZSSH = "分系统总师审核"; public static final String SIGN_KEY_FXTZSSH = "分系统总师审核";
public static final String SIGN_KEY_GY = "工艺"; public static final String SIGN_KEY_GY = "工艺";
......
package com.inet.dcs.document.core.event;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.core.constants.SignConstants;
import com.inet.dcs.document.core.service.ExtTransferDocumentService;
import com.inet.dcs.document.core.util.WorkFlowUtil;
import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author whd
* @date 2024-11-05 10:17
* @describe
*/
@Slf4j
@Component
public class ExtTransferDocumentEvent {
@Autowired
private WorkFlowUtil workFlowUtil;
@Autowired
private ExtTransferDocumentService extTransferDocumentService;
public void postUpdate(ExtTransferDocumentVO extTransferDocumentVO) {
// 获取档案组流程审批人信息
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(extTransferDocumentVO);
DxWfProcessInfoVO wfProcessInfoVO = workFlowUtil.getProcessInstDetail(wfProcessInstVO);
List<DxWfProcessTaskVO> activities = wfProcessInfoVO.getHistoryInfo();
DxUserInfoVO dxRecipientUserInfo = extTransferDocumentService.getSignInfo(activities, SignConstants.SIGN_KEY_DAZSH);
if (ObjectUtils.isNotEmpty(dxRecipientUserInfo)) {
extTransferDocumentVO.setDxRecipientUserInfo(dxRecipientUserInfo);
extTransferDocumentVO.setDxRecipientUserInfoId(dxRecipientUserInfo.getId());
extTransferDocumentVO.setDxRecipientUserInfoIdType("DxUser");
}
LocalDateTime handoverTime = extTransferDocumentService.getEndDate(activities, SignConstants.SIGN_KEY_DAZSH);
if (ObjectUtils.isNotEmpty(handoverTime)) {
extTransferDocumentVO.setHandoverTime(handoverTime);
}
extTransferDocumentVO.setOperator(OperatorType.MODIFY);
extTransferDocumentService.saveRecursion(extTransferDocumentVO);
}
}
...@@ -5,6 +5,11 @@ import com.inet.dcs.document.common.vo.archivesOtherVO.ExtTransferDocProjectVO; ...@@ -5,6 +5,11 @@ import com.inet.dcs.document.common.vo.archivesOtherVO.ExtTransferDocProjectVO;
import com.inet.dcs.document.core.service.shadow.ExtTransferDocumentServiceShadow; import com.inet.dcs.document.core.service.shadow.ExtTransferDocumentServiceShadow;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.data.DxPageImpl; import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
import java.time.LocalDateTime;
import java.util.List;
/** /**
* @description: ExtTransferDocument-service * @description: ExtTransferDocument-service
...@@ -21,4 +26,8 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext ...@@ -21,4 +26,8 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext
ExtTransferDocProjectVO getTransferDocProjectById(Long id); ExtTransferDocProjectVO getTransferDocProjectById(Long id);
DxPageImpl getDxDocumentList(SearchQueryCondition searchQueryCondition); DxPageImpl getDxDocumentList(SearchQueryCondition searchQueryCondition);
DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName);
LocalDateTime getEndDate(List<DxWfProcessTaskVO> activities, String activityName);
} }
...@@ -5,6 +5,8 @@ import com.inet.dcs.document.common.vo.ExtTransferDocumentVO; ...@@ -5,6 +5,8 @@ import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.common.vo.archivesOtherVO.ExtFilesUpdateVO; import com.inet.dcs.document.common.vo.archivesOtherVO.ExtFilesUpdateVO;
import com.inet.dcs.document.common.vo.archivesOtherVO.ExtTransferDocProjectVO; import com.inet.dcs.document.common.vo.archivesOtherVO.ExtTransferDocProjectVO;
import com.inet.dcs.document.core.constants.Constants; import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.constants.SignConstants;
import com.inet.dcs.document.core.event.ExtTransferDocumentEvent;
import com.inet.dcs.document.core.repository.ExtTransferDocumentRepository; import com.inet.dcs.document.core.repository.ExtTransferDocumentRepository;
import com.inet.dcs.document.core.service.ExtFilesDocLinkService; import com.inet.dcs.document.core.service.ExtFilesDocLinkService;
import com.inet.dcs.document.core.service.ExtFilesService; import com.inet.dcs.document.core.service.ExtFilesService;
...@@ -21,15 +23,22 @@ import com.yonde.dex.basedata.exception.DxBusinessException; ...@@ -21,15 +23,22 @@ import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.basic.feign.expand.ExtDxContextProjectServiceFeign; import com.yonde.dex.basic.feign.expand.ExtDxContextProjectServiceFeign;
import com.yonde.dex.context.common.vo.DxContextProjectVO; import com.yonde.dex.context.common.vo.DxContextProjectVO;
import com.yonde.dex.dao.service.DxDaoPluginExpander; import com.yonde.dex.dao.service.DxDaoPluginExpander;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.wfc.common.enums.TaskStateEnum;
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.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.List; import java.text.SimpleDateFormat;
import java.util.Map; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -68,13 +77,21 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -68,13 +77,21 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Autowired @Autowired
private ExtDxDocumentService extDxDocumentService; private ExtDxDocumentService extDxDocumentService;
/* @Override @Autowired
public void beforeSave(Collection<V> target) { private ExtTransferDocumentEvent extTransferDocumentEvent;
// 校验是否存在归档中文件
@Autowired
private DxUserInfoFeign userService;
@Override
public void postUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) { for (V v : target) {
target // 单据状态已完成,只更新一次
if (Constants.COMPLETE.equals(v.getState()) && ObjectUtils.isEmpty(v.getHandoverTime())) {
extTransferDocumentEvent.postUpdate(v);
}
}
} }
}*/
@Override @Override
public ExtTransferDocumentVO startWorkflow(Long id) { public ExtTransferDocumentVO startWorkflow(Long id) {
...@@ -131,13 +148,13 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -131,13 +148,13 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
DxContextProjectVO dxContextProjectVO = (DxContextProjectVO) programDxPage.getContent().get(0); DxContextProjectVO dxContextProjectVO = (DxContextProjectVO) programDxPage.getContent().get(0);
//project_class = 项目群:program 项目:project 子项:childProject //project_class = 项目群:program 项目:project 子项:childProject
if ("program".equals(dxContextProjectVO.getProjectClass())) { if ("program".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setProjectCode(dxContextProjectVO.getName()); extTransferDocProjectVO.setProjectCode(dxContextProjectVO.getNumber());
extTransferDocProjectVO.setProjectGroupName(dxContextProjectVO.getName()); extTransferDocProjectVO.setProjectGroupName(dxContextProjectVO.getName());
return extTransferDocProjectVO; return extTransferDocProjectVO;
} else if ("project".equals(dxContextProjectVO.getProjectClass())) { } else if ("project".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setTopicTitle(dxContextProjectVO.getName());
} else if ("childProject".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setProjectName(dxContextProjectVO.getName()); extTransferDocProjectVO.setProjectName(dxContextProjectVO.getName());
} else if ("childProject".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setTopicTitle(dxContextProjectVO.getName());
} }
id = dxContextProjectVO.getParentId(); id = dxContextProjectVO.getParentId();
} }
...@@ -164,6 +181,35 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -164,6 +181,35 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
return extDxDocumentService.findRecursion(searchQueryCondition); return extDxDocumentService.findRecursion(searchQueryCondition);
} }
@Override
public LocalDateTime getEndDate(List<DxWfProcessTaskVO> activities, String activityName) {
for (DxWfProcessTaskVO wf : activities) {
if (wf.getName().equals(activityName)) {
if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
Date endTime = wf.getEndTime();
return endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
}
}
}
return null;
}
@Override
public DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName) {
for (DxWfProcessTaskVO wf : activities) {
if (wf.getName().equals(activityName)) {
if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
//获取用户名称和id
String userName = wf.getAssigneeName();
String userId = wf.getAssignee();
return (DxUserInfoVO) userService.get(Long.parseLong(userId));
}
}
}
return null;
}
private void saveFilesDocLink(List<ExtTransferDocLinkVO> transferDocLinkVOList) { private void saveFilesDocLink(List<ExtTransferDocLinkVO> transferDocLinkVOList) {
List<ExtFilesUpdateVO> extFilesUpdateVOList = Lists.newArrayList(); List<ExtFilesUpdateVO> extFilesUpdateVOList = Lists.newArrayList();
for (ExtTransferDocLinkVO extTransferDocLinkVO : transferDocLinkVOList) { for (ExtTransferDocLinkVO extTransferDocLinkVO : transferDocLinkVOList) {
......
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