Commit c7c4a42d authored by 侯彦文's avatar 侯彦文

更新移交单

parent 9cb3780a
......@@ -47,8 +47,8 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex
@ApiOperation(value = "获取要归档的文档列表", notes = "获取要归档的文档列表")
@PostMapping(value = "/getDxDocumentList")
public ApiResult getDxDocumentList(@RequestBody SearchQueryCondition searchQueryCondition) {
return ApiResult.ok(extTransferDocumentService.getDxDocumentList(searchQueryCondition));
public ApiResult getDxDocumentList(@RequestBody SearchQueryCondition searchQueryCondition,@RequestParam("id") Long id) {
return ApiResult.ok(extTransferDocumentService.getDxDocumentList(searchQueryCondition,id));
}
@ApiOperation(value = "保存文档案卷关联关系", notes = "保存文档案卷关联关系")
......
......@@ -7,6 +7,10 @@ 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.dao.events.BusinessEventType;
import com.yonde.dex.dao.events.DxEvent;
import com.yonde.dex.dao.events.DxEventListener;
import com.yonde.dex.dao.events.DxEventWrap;
import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
......@@ -26,6 +30,7 @@ import java.util.List;
*/
@Slf4j
@Component
@DxEvent
public class ExtTransferDocumentEvent {
@Autowired
......@@ -34,28 +39,32 @@ public class ExtTransferDocumentEvent {
@Autowired
private ExtTransferDocumentService extTransferDocumentService;
public void postUpdate(ExtTransferDocumentVO extTransferDocumentVO) {
// 单据状态已完成,只更新一次
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.getUserId());
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);
@DxEventListener(value = ExtTransferDocumentVO.class, eventType = BusinessEventType.POST_LIFECYCLE_CHANGE_STATUS, order = 1)
public void postUpdate(List<DxEventWrap<ExtTransferDocumentVO>> eventWrapList) {
for (DxEventWrap<ExtTransferDocumentVO> e : eventWrapList) {
ExtTransferDocumentVO extTransferDocumentVO = e.getTarget();
// 单据状态已完成,只更新一次
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.getUserId());
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());
// 更新文档状态为已归档
extTransferDocumentService.updateArchivingStatus(extTransferDocumentVO.getId());
}
}
}
}
......@@ -41,4 +41,7 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh
void generatFilesDirectory(Long id);
List<Long> getChildList(Long partId, List<Long> list);
}
......@@ -26,7 +26,7 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext
ExtTransferDocProjectVO getTransferDocProjectById(Long id);
DxPageImpl getDxDocumentList(SearchQueryCondition searchQueryCondition);
DxPageImpl getDxDocumentList(SearchQueryCondition searchQueryCondition,Long id);
DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName);
......
......@@ -312,6 +312,7 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
//递归根据项目群查询项目子项
@Override
public List<Long> getChildList(Long partId, List<Long> list) {
SearchQueryCondition build = SearchQueryBuilder.openBuild().openFilterBuilder().setEq("parentId", partId).closeFilterBuilder().build();
List<DxContextProjectVO> dxContextProjectVOS= extDxContextProjectServiceFeign.findRecursion(build).getContent();
......
package com.inet.dcs.document.core.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.inet.dcs.document.common.vo.ExtFilesDocLinkVO;
import com.inet.dcs.document.common.vo.ExtFilesVO;
import com.inet.dcs.document.common.vo.ExtTransferDocLinkVO;
......@@ -56,10 +57,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -113,12 +111,7 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Autowired
DxApplicationFeignService feignService;
@Override
public void postUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) {
extTransferDocumentEvent.postUpdate(v);
}
}
@Override
public ExtTransferDocumentVO startWorkflow(Long id) {
......@@ -144,35 +137,55 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
if ("program".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setProjectCode(dxContextProjectVO.getNumber());
extTransferDocProjectVO.setProjectGroupName(dxContextProjectVO.getName());
extTransferDocProjectVO.setProjectId(dxContextProjectVO.getParentId());
extTransferDocProjectVO.setProjectId(dxContextProjectVO.getId());
return extTransferDocProjectVO;
} else if ("project".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setProjectName(dxContextProjectVO.getName());
} else if ("childProject".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setTopicTitle(dxContextProjectVO.getName());
}
id = dxContextProjectVO.getParentId();
}
}
@Override
public DxPageImpl getDxDocumentList(SearchQueryCondition searchQueryCondition) {
// 查询不是已完成状态的移交单文档
public DxPageImpl getDxDocumentList(SearchQueryCondition searchQueryCondition,Long id) {
//查询当前项目群下文档
List<Long> childList = extFilesService.getChildList(id, new ArrayList<>());
childList.add(id);
//查询当前项目群下所有文档
SearchItem dxContextIdSearchItem = new SearchItem("dxContextId", SearchItem.Operator.IN,childList, null);
SearchItem stateSearchItem = new SearchItem("state", SearchItem.Operator.EQ,Constants.DOC_RELEASE, null);
searchQueryCondition.getSearchItems().addItem(dxContextIdSearchItem);
searchQueryCondition.getSearchItems().addItem(stateSearchItem);
List<DxDocumentVO> extDxDocList = extDxDocumentService.findRecursion(searchQueryCondition).getContent();
//查询当前项目群下所有移交单
SearchQueryCondition searchTransfer = SearchQueryCondition.builder()
.searchItems(SearchItems.builder()
.item(new SearchItem("dxContextId", SearchItem.Operator.IN, childList, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
List<ExtTransferDocumentVO> transferDocumentList = (List<ExtTransferDocumentVO>) this.findRecursion(searchTransfer).getContent();
//查询移交单下所有文档
List<Long> extTransferDocId = transferDocumentList.stream().map(ExtTransferDocumentVO::getId).collect(Collectors.toList());
SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("source").build())
.searchItems(SearchItems.builder()
.item(new SearchItem("target.state", SearchItem.Operator.NEQ, Constants.COMPLETE, null))
.item(new SearchItem("targetId", SearchItem.Operator.IN,extTransferDocId, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
List<ExtTransferDocLinkVO> transferDocLinkVOList = extTransferDocLinkService.findRecursion(queryDoc).getContent();
// 从文档里面排除
if (CollectionUtils.isNotEmpty(transferDocLinkVOList)) {
log.info("transferDocLinkVOList.size={}", transferDocLinkVOList.size());
List<Long> sourceIds = transferDocLinkVOList.stream().map(ExtTransferDocLinkVO::getSourceId).collect(Collectors.toList());
SearchItem searchItem = new SearchItem("id", SearchItem.Operator.NOTIN, sourceIds, null);
searchQueryCondition.getSearchItems().addItem(searchItem);
List<DxDocumentVO> dxDocumentVOSList = transferDocLinkVOList.stream().map(ExtTransferDocLinkVO::getSource).collect(Collectors.toList());
List<DxDocumentVO> resultDocList = extDxDocList.stream().filter(dxDocumentVO -> !dxDocumentVOSList.contains(dxDocumentVO)).collect(Collectors.toList());
Integer pageSize = searchQueryCondition.getPageSize();
Integer pageFrom = searchQueryCondition.getPageFrom();
if (CollectionUtil.isNotEmpty(resultDocList)) {
List<DxDocumentVO> content1 = resultDocList.stream().skip((long) (pageFrom - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
return new DxPageImpl<>(content1, pageFrom - 1, pageSize, resultDocList.size(),
(resultDocList.size() % pageSize == 0) ? resultDocList.size() / pageSize : resultDocList.size() / pageSize + 1);
}
return extDxDocumentService.findRecursion(searchQueryCondition);
return null;
}
@Override
......
......@@ -82,6 +82,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
@Autowired
private DxUserInfoFeign userService;
@Override
public void beforeSave(Collection<V> target) {
for (V v : target) {
......@@ -144,6 +145,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
dxDocumentVO.setDxRefundPersonUserId(null);
dxDocumentVO.setDxRefundPersonUserIdType(null);
dxDocumentVO.setWithdrawalTime(null);
}
// 列表上退档-归档已作废
if (ARCHIVE_INVALIDATED.equals(archivingStatus)) {
......@@ -159,7 +161,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
// 更新文档归档状态
dxDocumentVO.setArchivingStatus(archivingStatus);
dxDocumentVO.setOperator(OperatorType.MODIFY);
this.save((V) dxDocumentVO);
this.saveRecursion((V) dxDocumentVO);
}
@Override
......
......@@ -73,7 +73,7 @@
</dependency>
<dependency>
<groupId>com.yonde.dex</groupId>
<artifactId>dex-basic-service-feign</artifactId>
<artifactId>dex-basic-service-expand-feign</artifactId>
<version>4.1-20241024-RELEASE</version>
</dependency>
<dependency>
......
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