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

更新移交单

parent 9cb3780a
...@@ -47,8 +47,8 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex ...@@ -47,8 +47,8 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex
@ApiOperation(value = "获取要归档的文档列表", notes = "获取要归档的文档列表") @ApiOperation(value = "获取要归档的文档列表", notes = "获取要归档的文档列表")
@PostMapping(value = "/getDxDocumentList") @PostMapping(value = "/getDxDocumentList")
public ApiResult getDxDocumentList(@RequestBody SearchQueryCondition searchQueryCondition) { public ApiResult getDxDocumentList(@RequestBody SearchQueryCondition searchQueryCondition,@RequestParam("id") Long id) {
return ApiResult.ok(extTransferDocumentService.getDxDocumentList(searchQueryCondition)); return ApiResult.ok(extTransferDocumentService.getDxDocumentList(searchQueryCondition,id));
} }
@ApiOperation(value = "保存文档案卷关联关系", notes = "保存文档案卷关联关系") @ApiOperation(value = "保存文档案卷关联关系", notes = "保存文档案卷关联关系")
......
...@@ -7,6 +7,10 @@ import com.inet.dcs.document.core.service.ExtTransferDocumentService; ...@@ -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.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.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.user.common.vo.DxUserInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO; import com.yonde.dex.wfc.common.vo.DxWfProcessInfoVO;
import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO; import com.yonde.dex.wfc.common.vo.DxWfProcessTaskVO;
...@@ -26,6 +30,7 @@ import java.util.List; ...@@ -26,6 +30,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Component @Component
@DxEvent
public class ExtTransferDocumentEvent { public class ExtTransferDocumentEvent {
@Autowired @Autowired
...@@ -34,7 +39,10 @@ public class ExtTransferDocumentEvent { ...@@ -34,7 +39,10 @@ public class ExtTransferDocumentEvent {
@Autowired @Autowired
private ExtTransferDocumentService extTransferDocumentService; private ExtTransferDocumentService extTransferDocumentService;
public void postUpdate(ExtTransferDocumentVO 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())) { if (Constants.COMPLETE.equals(extTransferDocumentVO.getState()) && ObjectUtils.isEmpty(extTransferDocumentVO.getHandoverTime())) {
// 获取档案组流程审批人信息 // 获取档案组流程审批人信息
...@@ -58,4 +66,5 @@ public class ExtTransferDocumentEvent { ...@@ -58,4 +66,5 @@ public class ExtTransferDocumentEvent {
extTransferDocumentService.updateArchivingStatus(extTransferDocumentVO.getId()); extTransferDocumentService.updateArchivingStatus(extTransferDocumentVO.getId());
} }
} }
}
} }
...@@ -41,4 +41,7 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh ...@@ -41,4 +41,7 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh
void generatFilesDirectory(Long id); void generatFilesDirectory(Long id);
List<Long> getChildList(Long partId, List<Long> list);
} }
...@@ -26,7 +26,7 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext ...@@ -26,7 +26,7 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext
ExtTransferDocProjectVO getTransferDocProjectById(Long id); ExtTransferDocProjectVO getTransferDocProjectById(Long id);
DxPageImpl getDxDocumentList(SearchQueryCondition searchQueryCondition); DxPageImpl getDxDocumentList(SearchQueryCondition searchQueryCondition,Long id);
DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName); DxUserInfoVO getSignInfo(List<DxWfProcessTaskVO> activities, String activityName);
......
...@@ -312,6 +312,7 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic ...@@ -312,6 +312,7 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
//递归根据项目群查询项目子项 //递归根据项目群查询项目子项
@Override
public List<Long> getChildList(Long partId, List<Long> list) { public List<Long> getChildList(Long partId, List<Long> list) {
SearchQueryCondition build = SearchQueryBuilder.openBuild().openFilterBuilder().setEq("parentId", partId).closeFilterBuilder().build(); SearchQueryCondition build = SearchQueryBuilder.openBuild().openFilterBuilder().setEq("parentId", partId).closeFilterBuilder().build();
List<DxContextProjectVO> dxContextProjectVOS= extDxContextProjectServiceFeign.findRecursion(build).getContent(); List<DxContextProjectVO> dxContextProjectVOS= extDxContextProjectServiceFeign.findRecursion(build).getContent();
......
package com.inet.dcs.document.core.service.impl; 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.ExtFilesDocLinkVO;
import com.inet.dcs.document.common.vo.ExtFilesVO; import com.inet.dcs.document.common.vo.ExtFilesVO;
import com.inet.dcs.document.common.vo.ExtTransferDocLinkVO; import com.inet.dcs.document.common.vo.ExtTransferDocLinkVO;
...@@ -56,10 +57,7 @@ import java.io.FileInputStream; ...@@ -56,10 +57,7 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.Arrays; import java.util.*;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -113,12 +111,7 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -113,12 +111,7 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Autowired @Autowired
DxApplicationFeignService feignService; DxApplicationFeignService feignService;
@Override
public void postUpdate(Collection<V> target, Collection<V> origin) {
for (V v : target) {
extTransferDocumentEvent.postUpdate(v);
}
}
@Override @Override
public ExtTransferDocumentVO startWorkflow(Long id) { public ExtTransferDocumentVO startWorkflow(Long id) {
...@@ -144,35 +137,55 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -144,35 +137,55 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
if ("program".equals(dxContextProjectVO.getProjectClass())) { if ("program".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setProjectCode(dxContextProjectVO.getNumber()); extTransferDocProjectVO.setProjectCode(dxContextProjectVO.getNumber());
extTransferDocProjectVO.setProjectGroupName(dxContextProjectVO.getName()); extTransferDocProjectVO.setProjectGroupName(dxContextProjectVO.getName());
extTransferDocProjectVO.setProjectId(dxContextProjectVO.getParentId()); extTransferDocProjectVO.setProjectId(dxContextProjectVO.getId());
return extTransferDocProjectVO; return extTransferDocProjectVO;
} else if ("project".equals(dxContextProjectVO.getProjectClass())) { } else if ("project".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setProjectName(dxContextProjectVO.getName()); extTransferDocProjectVO.setProjectName(dxContextProjectVO.getName());
} else if ("childProject".equals(dxContextProjectVO.getProjectClass())) { } else if ("childProject".equals(dxContextProjectVO.getProjectClass())) {
extTransferDocProjectVO.setTopicTitle(dxContextProjectVO.getName()); extTransferDocProjectVO.setTopicTitle(dxContextProjectVO.getName());
} }
id = dxContextProjectVO.getParentId();
} }
} }
@Override @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() SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("source").build()) .openProp(SearchQueryCondition.builder().name("source").build())
.searchItems(SearchItems.builder() .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(); .operator(SearchItems.BooleanOperator.AND).build()).build();
List<ExtTransferDocLinkVO> transferDocLinkVOList = extTransferDocLinkService.findRecursion(queryDoc).getContent(); List<ExtTransferDocLinkVO> transferDocLinkVOList = extTransferDocLinkService.findRecursion(queryDoc).getContent();
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();
if (CollectionUtils.isNotEmpty(transferDocLinkVOList)) { Integer pageFrom = searchQueryCondition.getPageFrom();
log.info("transferDocLinkVOList.size={}", transferDocLinkVOList.size()); if (CollectionUtil.isNotEmpty(resultDocList)) {
List<Long> sourceIds = transferDocLinkVOList.stream().map(ExtTransferDocLinkVO::getSourceId).collect(Collectors.toList()); List<DxDocumentVO> content1 = resultDocList.stream().skip((long) (pageFrom - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
SearchItem searchItem = new SearchItem("id", SearchItem.Operator.NOTIN, sourceIds, null); return new DxPageImpl<>(content1, pageFrom - 1, pageSize, resultDocList.size(),
searchQueryCondition.getSearchItems().addItem(searchItem); (resultDocList.size() % pageSize == 0) ? resultDocList.size() / pageSize : resultDocList.size() / pageSize + 1);
} }
return null;
return extDxDocumentService.findRecursion(searchQueryCondition);
} }
@Override @Override
......
...@@ -82,6 +82,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -82,6 +82,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
@Autowired @Autowired
private DxUserInfoFeign userService; private DxUserInfoFeign userService;
@Override @Override
public void beforeSave(Collection<V> target) { public void beforeSave(Collection<V> target) {
for (V v : target) { for (V v : target) {
...@@ -144,6 +145,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -144,6 +145,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
dxDocumentVO.setDxRefundPersonUserId(null); dxDocumentVO.setDxRefundPersonUserId(null);
dxDocumentVO.setDxRefundPersonUserIdType(null); dxDocumentVO.setDxRefundPersonUserIdType(null);
dxDocumentVO.setWithdrawalTime(null); dxDocumentVO.setWithdrawalTime(null);
} }
// 列表上退档-归档已作废 // 列表上退档-归档已作废
if (ARCHIVE_INVALIDATED.equals(archivingStatus)) { if (ARCHIVE_INVALIDATED.equals(archivingStatus)) {
...@@ -159,7 +161,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe ...@@ -159,7 +161,7 @@ public class ExtDxDocumentServiceImpl<V extends DxDocumentVO> extends DocumentSe
// 更新文档归档状态 // 更新文档归档状态
dxDocumentVO.setArchivingStatus(archivingStatus); dxDocumentVO.setArchivingStatus(archivingStatus);
dxDocumentVO.setOperator(OperatorType.MODIFY); dxDocumentVO.setOperator(OperatorType.MODIFY);
this.save((V) dxDocumentVO); this.saveRecursion((V) dxDocumentVO);
} }
@Override @Override
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.yonde.dex</groupId> <groupId>com.yonde.dex</groupId>
<artifactId>dex-basic-service-feign</artifactId> <artifactId>dex-basic-service-expand-feign</artifactId>
<version>4.1-20241024-RELEASE</version> <version>4.1-20241024-RELEASE</version>
</dependency> </dependency>
<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