Commit cb1ebf44 authored by wei's avatar wei 🎱

移交单档案组绑定案卷关系同时反更新案卷信息

parent eaddd302
package com.inet.dcs.document.common.vo;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import lombok.Data;
import java.io.Serializable;
......@@ -11,10 +12,16 @@ import java.io.Serializable;
*/
@Data
public class ExtFilesUpdateVO implements Serializable {
/**
* 文件id
*/
private DxDocumentVO dxDocumentVO;
/**
* 所属案卷
*/
private String belongingCaseFile;
/**
* 密级
*/
......
package com.inet.dcs.document.core.service;
import com.inet.dcs.document.common.vo.ExtFilesDocLinkVO;
import com.inet.dcs.document.common.vo.ExtFilesUpdateVO;
import com.inet.dcs.document.core.service.shadow.ExtFilesDocLinkServiceShadow;
import java.util.List;
......@@ -20,4 +21,11 @@ public interface ExtFilesDocLinkService<V extends ExtFilesDocLinkVO> extends Ext
* @return
*/
List<ExtFilesDocLinkVO> getFilesDocLinkByTargetId(Long targetId);
/**
* 保存案卷和文件关联关系
*
* @param extFilesUpdateVOList
*/
void saveFilesDocLink(List<ExtFilesUpdateVO> extFilesUpdateVOList);
}
......@@ -20,4 +20,12 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh
* @param extFilesUpdateVOList
*/
void updateExtFiles(List<ExtFilesUpdateVO> extFilesUpdateVOList);
/**
* 根据案卷编码查询案卷
*
* @param volumeNumber
* @return
*/
List<ExtFilesVO> findRecursionByVolumeNumber(String volumeNumber);
}
package com.inet.dcs.document.core.service.impl;
import com.inet.dcs.document.common.vo.ExtFilesDocLinkVO;
import com.inet.dcs.document.common.vo.ExtFilesUpdateVO;
import com.inet.dcs.document.common.vo.ExtFilesVO;
import com.inet.dcs.document.core.repository.ExtFilesDocLinkRepository;
import com.inet.dcs.document.core.service.ExtFilesDocLinkService;
import com.inet.dcs.document.core.service.ExtFilesService;
import com.inet.dcs.document.entity.po.ExtFilesDocLink;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchItems;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.data.OperatorType;
import lombok.extern.slf4j.Slf4j;
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;
......@@ -29,15 +36,39 @@ public class ExtFilesDocLinkServiceImpl<V extends ExtFilesDocLinkVO> implements
@Autowired
ExtFilesDocLinkRepository<ExtFilesDocLink> extFilesDocLinkRepository;
@Autowired
private ExtFilesService extFilesService;
@Override
public List<ExtFilesDocLinkVO> getFilesDocLinkByTargetId(Long targetId) {
SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("source").build())
.searchItems(SearchItems.builder().item(new SearchItem("targetId", SearchItem.Operator.EQ,
targetId, null)).operator(SearchItems.BooleanOperator.AND).build()).build();
.searchItems(SearchItems.builder()
.item(new SearchItem("targetId", SearchItem.Operator.EQ, targetId, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
return (List<ExtFilesDocLinkVO>) this.findRecursion(queryDoc).getContent();
}
@Override
public void saveFilesDocLink(List<ExtFilesUpdateVO> extFilesUpdateVOList) {
List<ExtFilesDocLinkVO> extFilesDocLinkVOList = Lists.newArrayList();
for (ExtFilesUpdateVO extFilesUpdateVO : extFilesUpdateVOList) {
List<ExtFilesVO> filesVOList = extFilesService.findRecursionByVolumeNumber(extFilesUpdateVO.getBelongingCaseFile());
if (CollectionUtils.isNotEmpty(filesVOList)) {
ExtFilesDocLinkVO extFilesDocLinkVO = new ExtFilesDocLinkVO();
ExtFilesVO extFilesVO = filesVOList.get(0);
DxDocumentVO dxDocumentVO = extFilesUpdateVO.getDxDocumentVO();
extFilesDocLinkVO.setTarget(extFilesVO);
extFilesDocLinkVO.setTargetId(extFilesVO.getId());
extFilesDocLinkVO.setSource(dxDocumentVO);
extFilesDocLinkVO.setSourceId(dxDocumentVO.getId());
extFilesDocLinkVO.setOperator(OperatorType.ADD);
extFilesDocLinkVOList.add(extFilesDocLinkVO);
}
}
this.saveRecursion((V) extFilesDocLinkVOList);
}
}
......@@ -93,7 +93,8 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
* @param volumeNumber
* @return
*/
private List<ExtFilesVO> findRecursionByVolumeNumber(String volumeNumber) {
@Override
public List<ExtFilesVO> findRecursionByVolumeNumber(String volumeNumber) {
SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.searchItems(SearchItems.builder()
.item(new SearchItem("volumeNumber", SearchItem.Operator.EQ, volumeNumber, null))
......
......@@ -5,6 +5,7 @@ import com.inet.dcs.document.common.vo.ExtTransferDocLinkVO;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.repository.ExtTransferDocumentRepository;
import com.inet.dcs.document.core.service.ExtFilesDocLinkService;
import com.inet.dcs.document.core.service.ExtFilesService;
import com.inet.dcs.document.core.service.ExtTransferDocLinkService;
import com.inet.dcs.document.core.service.ExtTransferDocumentService;
......@@ -51,6 +52,9 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Autowired
private ExtFilesService extFilesService;
@Autowired
private ExtFilesDocLinkService extFilesDocLinkService;
@Override
public ExtTransferDocumentVO startWorkflow(Long id) {
ExtTransferDocumentVO extTransferDocumentVO = this.get(id);
......@@ -66,6 +70,7 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Override
public void updateExtFiles(ExtTransferDocumentVO extTransferDocumentVO) {
// 1.查出移交单文件关联关系
SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("source").build())
.searchItems(SearchItems.builder()
......@@ -76,11 +81,29 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
if (CollectionUtils.isEmpty(transferDocLinkVOList)) {
return;
}
log.info("=================开始=绑定案卷关系同时反更新案卷信息================");
// 2.绑定案卷文件关联关系
this.saveFilesDocLink(transferDocLinkVOList);
// 3.更新案卷下部分信息
this.updateExtFilesByBelongingCaseFile(transferDocLinkVOList);
log.info("=================结束=绑定案卷关系同时反更新案卷信息================");
}
private void saveFilesDocLink(List<ExtTransferDocLinkVO> transferDocLinkVOList) {
List<ExtFilesUpdateVO> extFilesUpdateVOList = Lists.newArrayList();
for (ExtTransferDocLinkVO extTransferDocLinkVO : transferDocLinkVOList) {
ExtFilesUpdateVO extFilesUpdateVO = new ExtFilesUpdateVO();
extFilesUpdateVO.setBelongingCaseFile(extTransferDocLinkVO.getBelongingCaseFile());
extFilesUpdateVO.setDxDocumentVO(extTransferDocLinkVO.getSource());
extFilesUpdateVOList.add(extFilesUpdateVO);
}
extFilesDocLinkService.saveFilesDocLink(extFilesUpdateVOList);
}
private void updateExtFilesByBelongingCaseFile(List<ExtTransferDocLinkVO> transferDocLinkVOList) {
Map<String, List<ExtTransferDocLinkVO>> belongingCaseFileMap = transferDocLinkVOList.stream()
.collect(Collectors.groupingBy(ExtTransferDocLinkVO::getBelongingCaseFile));
// 更新案卷下部分信息
List<ExtFilesUpdateVO> extFilesUpdateVOList = Lists.newArrayList();
belongingCaseFileMap.forEach((key, value) -> {
ExtFilesUpdateVO extFilesUpdateVO = new ExtFilesUpdateVO();
......
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