Commit fdcfb444 authored by wei's avatar wei 🎱

监听移交单状态已完成,更新文档状态为已归档

parent d297c1dc
package com.inet.dcs.document.core.event;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.constants.SignConstants;
import com.inet.dcs.document.core.service.ExtTransferDocumentService;
import com.inet.dcs.document.core.service.expand.ExtDxDocumentService;
import com.inet.dcs.document.core.util.WorkFlowUtil;
import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
......@@ -33,21 +35,27 @@ public class ExtTransferDocumentEvent {
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);
// 单据状态已完成,只更新一次
if (Constants.COMPLETE.equals(extTransferDocumentVO.getState()) && ObjectUtils.isEmpty(extTransferDocumentVO.getHandoverTime())) {
// 获取档案组流程审批人信息
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);
// 更新文档状态为已归档
extTransferDocumentService.updateArchivingStatus(extTransferDocumentVO.getId());
}
extTransferDocumentVO.setOperator(OperatorType.MODIFY);
extTransferDocumentService.saveRecursion(extTransferDocumentVO);
}
}
......@@ -30,4 +30,6 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext
DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName);
LocalDateTime getEndDate(List<DxWfProcessTaskVO> activities, String activityName);
void updateArchivingStatus(Long id);
}
......@@ -38,4 +38,6 @@ public interface ExtDxDocumentService<V extends DxDocumentVO> extends ExtDxDocum
* @return
*/
DxDocumentVO startWorkflow(Long id);
void updateArchivingStatus(Long id, String archivingStatus);
}
......@@ -13,6 +13,7 @@ import com.inet.dcs.document.core.service.ExtFilesService;
import com.inet.dcs.document.core.service.ExtTransferDocLinkService;
import com.inet.dcs.document.core.service.ExtTransferDocumentService;
import com.inet.dcs.document.core.service.expand.ExtDxDocumentService;
import com.inet.dcs.document.core.service.impl.expand.ExtDxDocumentServiceImpl;
import com.inet.dcs.document.core.util.SearchUtil;
import com.inet.dcs.document.entity.po.ExtTransferDocument;
import com.yonde.dex.basedata.data.search.SearchItem;
......@@ -33,12 +34,13 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -86,10 +88,7 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Override
public void postUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) {
// 单据状态已完成,只更新一次
if (Constants.COMPLETE.equals(v.getState()) && ObjectUtils.isEmpty(v.getHandoverTime())) {
extTransferDocumentEvent.postUpdate(v);
}
extTransferDocumentEvent.postUpdate(v);
}
}
......@@ -195,6 +194,22 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
return null;
}
@Override
public void updateArchivingStatus(Long id) {
SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("source").build())
.searchItems(SearchItems.builder()
.item(new SearchItem("targetId", SearchItem.Operator.EQ, id, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
List<ExtTransferDocLinkVO> transferDocLinkVOList = extTransferDocLinkService.findRecursion(queryDoc).getContent();
if (CollectionUtils.isNotEmpty(transferDocLinkVOList)) {
ExtTransferDocLinkVO extTransferDocLinkVO = transferDocLinkVOList.get(0);
Long sourceId = extTransferDocLinkVO.getSourceId();
extDxDocumentService.updateArchivingStatus(sourceId, ExtDxDocumentServiceImpl.ARCHIVED);
}
}
@Override
public DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName) {
for (DxWfProcessTaskVO wf : activities) {
......
......@@ -50,6 +50,13 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
public static final String BEAN_NAME = "documentServiceImpl";
public static final String ARCHIVED = "已归档";
public static final String ARCHIVE_INVALIDATED = "归档已作废";
public static final String ARCHIVE_NOT_RECEIVED = "档案未接收";
@Autowired
private ExtDxDocumentFolderService dxDocumentFolderService;
......@@ -105,6 +112,16 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
return this.changeStatus(dxDocumentVO.getId(), Constants.SUBMIT_REVIEWING, true);
}
@Override
public void updateArchivingStatus(Long id, String archivingStatus) {
DxDocumentVO dxDocumentVO = this.get(id);
if (StringUtils.isBlank(dxDocumentVO.getArchivingStatus())) {
dxDocumentVO.setArchivingStatus(archivingStatus);
dxDocumentVO.setOperator(OperatorType.MODIFY);
this.save((V) dxDocumentVO);
}
}
private String getProcessDefKey(String subTypeName) {
log.info("getProcessDefKey.subTypeName:{}", subTypeName);
if (Constants.EXT_DOC_WF_MAP.containsKey(subTypeName)) {
......@@ -163,7 +180,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
}
@Override
public Map<String, DxPageImpl> getDocAndFolder(Long dxContextId, Long parentId,Long dxDocumentFolderId) {
public Map<String, DxPageImpl> getDocAndFolder(Long dxContextId, Long parentId, Long dxDocumentFolderId) {
Map<String, DxPageImpl> result = new HashMap<>();
//查询目录
SearchQueryCondition folderCondition = SearchQueryBuilder.openBuild()
......@@ -177,9 +194,9 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
//查询文档
SearchItems searchItems = new SearchItems();
SearchItem dxDocumentFolderIdSearchItem;
if (Objects.nonNull(dxDocumentFolderId)){
if (Objects.nonNull(dxDocumentFolderId)) {
dxDocumentFolderIdSearchItem = new SearchItem("dxDocumentFolderId", SearchItem.Operator.EQ, dxDocumentFolderId, null);
}else{
} else {
dxDocumentFolderIdSearchItem = new SearchItem("dxDocumentFolderId", SearchItem.Operator.ISNULL, null, null);
}
searchItems.addItem(dxDocumentFolderIdSearchItem);
......@@ -191,7 +208,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
searchItems.addItem(checkOuted);
SearchQueryCondition query = SearchQueryCondition.builder()
.searchItems(searchItems).
openProp(SearchQueryCondition.builder().name("dxContext").build()).build();
openProp(SearchQueryCondition.builder().name("dxContext").build()).build();
DxPageImpl<V> docPage = this.findRecursion(query);
result.put("DxDocument", docPage);
return result;
......
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