Commit fdcfb444 authored by wei's avatar wei 🎱

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

parent d297c1dc
package com.inet.dcs.document.core.event; package com.inet.dcs.document.core.event;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO; 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.constants.SignConstants;
import com.inet.dcs.document.core.service.ExtTransferDocumentService; 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.inet.dcs.document.core.util.WorkFlowUtil;
import com.yonde.dex.basedata.entity.data.OperatorType; import com.yonde.dex.basedata.entity.data.OperatorType;
import com.yonde.dex.user.common.vo.DxUserInfoVO; import com.yonde.dex.user.common.vo.DxUserInfoVO;
...@@ -33,21 +35,27 @@ public class ExtTransferDocumentEvent { ...@@ -33,21 +35,27 @@ public class ExtTransferDocumentEvent {
private ExtTransferDocumentService extTransferDocumentService; private ExtTransferDocumentService extTransferDocumentService;
public void postUpdate(ExtTransferDocumentVO extTransferDocumentVO) { public void postUpdate(ExtTransferDocumentVO extTransferDocumentVO) {
// 获取档案组流程审批人信息 // 单据状态已完成,只更新一次
DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(extTransferDocumentVO); if (Constants.COMPLETE.equals(extTransferDocumentVO.getState()) && ObjectUtils.isEmpty(extTransferDocumentVO.getHandoverTime())) {
DxWfProcessInfoVO wfProcessInfoVO = workFlowUtil.getProcessInstDetail(wfProcessInstVO); // 获取档案组流程审批人信息
List<DxWfProcessTaskVO> activities = wfProcessInfoVO.getHistoryInfo(); DxWfProcessVO wfProcessInstVO = workFlowUtil.getWfProcessInst(extTransferDocumentVO);
DxUserInfoVO dxRecipientUserInfo = extTransferDocumentService.getSignInfo(activities, SignConstants.SIGN_KEY_DAZSH); DxWfProcessInfoVO wfProcessInfoVO = workFlowUtil.getProcessInstDetail(wfProcessInstVO);
if (ObjectUtils.isNotEmpty(dxRecipientUserInfo)) { List<DxWfProcessTaskVO> activities = wfProcessInfoVO.getHistoryInfo();
extTransferDocumentVO.setDxRecipientUserInfo(dxRecipientUserInfo); DxUserInfoVO dxRecipientUserInfo = extTransferDocumentService.getSignInfo(activities, SignConstants.SIGN_KEY_DAZSH);
extTransferDocumentVO.setDxRecipientUserInfoId(dxRecipientUserInfo.getId()); if (ObjectUtils.isNotEmpty(dxRecipientUserInfo)) {
extTransferDocumentVO.setDxRecipientUserInfoIdType("DxUser"); extTransferDocumentVO.setDxRecipientUserInfo(dxRecipientUserInfo);
} extTransferDocumentVO.setDxRecipientUserInfoId(dxRecipientUserInfo.getId());
LocalDateTime handoverTime = extTransferDocumentService.getEndDate(activities, SignConstants.SIGN_KEY_DAZSH); extTransferDocumentVO.setDxRecipientUserInfoIdType("DxUser");
if (ObjectUtils.isNotEmpty(handoverTime)) { }
extTransferDocumentVO.setHandoverTime(handoverTime); 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 ...@@ -30,4 +30,6 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext
DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName); DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName);
LocalDateTime getEndDate(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 ...@@ -38,4 +38,6 @@ public interface ExtDxDocumentService<V extends DxDocumentVO> extends ExtDxDocum
* @return * @return
*/ */
DxDocumentVO startWorkflow(Long id); DxDocumentVO startWorkflow(Long id);
void updateArchivingStatus(Long id, String archivingStatus);
} }
...@@ -13,6 +13,7 @@ import com.inet.dcs.document.core.service.ExtFilesService; ...@@ -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.ExtTransferDocLinkService;
import com.inet.dcs.document.core.service.ExtTransferDocumentService; import com.inet.dcs.document.core.service.ExtTransferDocumentService;
import com.inet.dcs.document.core.service.expand.ExtDxDocumentService; 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.core.util.SearchUtil;
import com.inet.dcs.document.entity.po.ExtTransferDocument; import com.inet.dcs.document.entity.po.ExtTransferDocument;
import com.yonde.dex.basedata.data.search.SearchItem; import com.yonde.dex.basedata.data.search.SearchItem;
...@@ -33,12 +34,13 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -33,12 +34,13 @@ 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.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; 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; import java.util.stream.Collectors;
/** /**
...@@ -86,10 +88,7 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -86,10 +88,7 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Override @Override
public void postUpdate(Collection<V> target, Collection<V> origin) { public void postUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) { for (V v : target) {
// 单据状态已完成,只更新一次 extTransferDocumentEvent.postUpdate(v);
if (Constants.COMPLETE.equals(v.getState()) && ObjectUtils.isEmpty(v.getHandoverTime())) {
extTransferDocumentEvent.postUpdate(v);
}
} }
} }
...@@ -195,6 +194,22 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -195,6 +194,22 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
return null; 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 @Override
public DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName) { public DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName) {
for (DxWfProcessTaskVO wf : activities) { for (DxWfProcessTaskVO wf : activities) {
......
...@@ -50,6 +50,13 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -50,6 +50,13 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
public static final String BEAN_NAME = "documentServiceImpl"; 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 @Autowired
private ExtDxDocumentFolderService dxDocumentFolderService; private ExtDxDocumentFolderService dxDocumentFolderService;
...@@ -105,6 +112,16 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -105,6 +112,16 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
return this.changeStatus(dxDocumentVO.getId(), Constants.SUBMIT_REVIEWING, true); 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) { private String getProcessDefKey(String subTypeName) {
log.info("getProcessDefKey.subTypeName:{}", subTypeName); log.info("getProcessDefKey.subTypeName:{}", subTypeName);
if (Constants.EXT_DOC_WF_MAP.containsKey(subTypeName)) { if (Constants.EXT_DOC_WF_MAP.containsKey(subTypeName)) {
...@@ -163,7 +180,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -163,7 +180,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
} }
@Override @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<>(); Map<String, DxPageImpl> result = new HashMap<>();
//查询目录 //查询目录
SearchQueryCondition folderCondition = SearchQueryBuilder.openBuild() SearchQueryCondition folderCondition = SearchQueryBuilder.openBuild()
...@@ -177,9 +194,9 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -177,9 +194,9 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
//查询文档 //查询文档
SearchItems searchItems = new SearchItems(); SearchItems searchItems = new SearchItems();
SearchItem dxDocumentFolderIdSearchItem; SearchItem dxDocumentFolderIdSearchItem;
if (Objects.nonNull(dxDocumentFolderId)){ if (Objects.nonNull(dxDocumentFolderId)) {
dxDocumentFolderIdSearchItem = new SearchItem("dxDocumentFolderId", SearchItem.Operator.EQ, dxDocumentFolderId, null); dxDocumentFolderIdSearchItem = new SearchItem("dxDocumentFolderId", SearchItem.Operator.EQ, dxDocumentFolderId, null);
}else{ } else {
dxDocumentFolderIdSearchItem = new SearchItem("dxDocumentFolderId", SearchItem.Operator.ISNULL, null, null); dxDocumentFolderIdSearchItem = new SearchItem("dxDocumentFolderId", SearchItem.Operator.ISNULL, null, null);
} }
searchItems.addItem(dxDocumentFolderIdSearchItem); searchItems.addItem(dxDocumentFolderIdSearchItem);
...@@ -191,7 +208,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -191,7 +208,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
searchItems.addItem(checkOuted); searchItems.addItem(checkOuted);
SearchQueryCondition query = SearchQueryCondition.builder() SearchQueryCondition query = SearchQueryCondition.builder()
.searchItems(searchItems). .searchItems(searchItems).
openProp(SearchQueryCondition.builder().name("dxContext").build()).build(); openProp(SearchQueryCondition.builder().name("dxContext").build()).build();
DxPageImpl<V> docPage = this.findRecursion(query); DxPageImpl<V> docPage = this.findRecursion(query);
result.put("DxDocument", docPage); result.put("DxDocument", docPage);
return result; 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