Commit cb1ebf44 authored by wei's avatar wei 🎱

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

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