Commit 89e2421b authored by wei's avatar wei 🎱

文件归所属案卷

parent 541742fb
package com.inet.dcs.document.common.vo.archivesOtherVO; package com.inet.dcs.document.common.vo.archivesOtherVO;
import com.inet.dcs.document.common.vo.ExtFilesVO;
import com.yonde.dcs.document.common.entity.vo.DxDocumentVO; import com.yonde.dcs.document.common.entity.vo.DxDocumentVO;
import lombok.Data; import lombok.Data;
...@@ -13,10 +14,30 @@ import java.io.Serializable; ...@@ -13,10 +14,30 @@ import java.io.Serializable;
@Data @Data
public class ExtFilesUpdateVO implements Serializable { public class ExtFilesUpdateVO implements Serializable {
/** /**
* 文件id * 移交单ID
*/
private Long transferDocumentId;
/**
* 文档id
*/
private Long docId;
/**
* 文档
*/ */
private DxDocumentVO dxDocumentVO; private DxDocumentVO dxDocumentVO;
/**
* 所属案卷ID
*/
private Long filesId;
/**
* 案卷
*/
private ExtFilesVO extFilesVO;
/** /**
* 所属案卷 * 所属案卷
*/ */
......
...@@ -366,6 +366,10 @@ public class Constants { ...@@ -366,6 +366,10 @@ public class Constants {
* 项目代号字典type * 项目代号字典type
*/ */
public static final String PROJECT_CODE = "ProjectCode"; public static final String PROJECT_CODE = "ProjectCode";
/**
* 项目类型
*/
public static final String PROJECT_CATEGORY = "projectCategory";
/** /**
* 设计阶段字典type * 设计阶段字典type
*/ */
......
package com.inet.dcs.document.core.controller; package com.inet.dcs.document.core.controller;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO; import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.common.vo.archivesOtherVO.ExtFilesUpdateVO;
import com.inet.dcs.document.core.controller.shadow.ExtTransferDocumentControllerShadow; import com.inet.dcs.document.core.controller.shadow.ExtTransferDocumentControllerShadow;
import com.inet.dcs.document.core.service.ExtTransferDocumentService; import com.inet.dcs.document.core.service.ExtTransferDocumentService;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
...@@ -11,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -11,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @description: ExtTransferDocument-Controller * @description: ExtTransferDocument-Controller
* @author: dexadmin * @author: dexadmin
...@@ -39,6 +42,13 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex ...@@ -39,6 +42,13 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex
return ApiResult.ok(ApiResult.SUCCESS, "更新案卷部分信息成功"); return ApiResult.ok(ApiResult.SUCCESS, "更新案卷部分信息成功");
} }
@ApiOperation(value = "保存文档案卷关联关系", notes = "保存文档案卷关联关系")
@PostMapping(value = "/saveFilesDocLink")
public ApiResult saveFilesDocLink(@RequestBody List<ExtFilesUpdateVO> extFilesUpdateVOList) {
extTransferDocumentService.saveFilesDocLink(extFilesUpdateVOList);
return ApiResult.ok(ApiResult.SUCCESS, "保存文档案卷关联关系成功");
}
@ApiOperation(value = "获取项目信息", notes = "获取项目信息") @ApiOperation(value = "获取项目信息", notes = "获取项目信息")
@GetMapping(value = "/getTransferDocProject") @GetMapping(value = "/getTransferDocProject")
public ApiResult getTransferDocProjectById(@RequestParam("id") Long id) { public ApiResult getTransferDocProjectById(@RequestParam("id") Long id) {
...@@ -52,7 +62,7 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex ...@@ -52,7 +62,7 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex
} }
@ApiOperation(value = "移交单下文件清单退档", notes = "移交单下文件清单退档") @ApiOperation(value = "移交单下文件清单退档", notes = "移交单下文件清单退档")
@GetMapping(value = "/returnDocument") @PostMapping(value = "/returnDocument")
public ApiResult returnDocument(@RequestParam("id") Long id, public ApiResult returnDocument(@RequestParam("id") Long id,
@RequestParam("docId") Long docId) { @RequestParam("docId") Long docId) {
extTransferDocumentService.returnDocument(id, docId); extTransferDocumentService.returnDocument(id, docId);
......
...@@ -22,6 +22,14 @@ public interface ExtFilesDocLinkService<V extends ExtFilesDocLinkVO> extends Ext ...@@ -22,6 +22,14 @@ public interface ExtFilesDocLinkService<V extends ExtFilesDocLinkVO> extends Ext
*/ */
List<ExtFilesDocLinkVO> getFilesDocLinkByTargetId(Long targetId); List<ExtFilesDocLinkVO> getFilesDocLinkByTargetId(Long targetId);
/**
* 根据文档ID查询关联文件的target
*
* @param targetId
* @return
*/
List<ExtFilesDocLinkVO> getFilesDocLinkBySourceId(Long targetId);
/** /**
* 保存案卷和文件关联关系 * 保存案卷和文件关联关系
* *
......
...@@ -17,9 +17,10 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh ...@@ -17,9 +17,10 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh
/** /**
* 批量更新案卷部分信息 * 批量更新案卷部分信息
* *
* @param extFilesUpdateVOList * @param extFilesVO
* @param filesUpdateVO
*/ */
void updateExtFiles(List<ExtFilesUpdateVO> extFilesUpdateVOList); void updateExtFiles(ExtFilesVO extFilesVO, ExtFilesUpdateVO filesUpdateVO);
/** /**
* 根据案卷编码查询案卷 * 根据案卷编码查询案卷
...@@ -36,4 +37,5 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh ...@@ -36,4 +37,5 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh
* @return * @return
*/ */
List<ExtFilesVO> getExtFilesByProjectCode(Long projectCode); List<ExtFilesVO> getExtFilesByProjectCode(Long projectCode);
} }
package com.inet.dcs.document.core.service; package com.inet.dcs.document.core.service;
import com.inet.dcs.document.common.vo.ExtTransferDocumentVO; import com.inet.dcs.document.common.vo.ExtTransferDocumentVO;
import com.inet.dcs.document.common.vo.archivesOtherVO.ExtFilesUpdateVO;
import com.inet.dcs.document.common.vo.archivesOtherVO.ExtTransferDocProjectVO; import com.inet.dcs.document.common.vo.archivesOtherVO.ExtTransferDocProjectVO;
import com.inet.dcs.document.core.service.shadow.ExtTransferDocumentServiceShadow; import com.inet.dcs.document.core.service.shadow.ExtTransferDocumentServiceShadow;
import com.yonde.dex.basedata.data.search.SearchQueryCondition; import com.yonde.dex.basedata.data.search.SearchQueryCondition;
...@@ -12,11 +13,11 @@ import java.time.LocalDateTime; ...@@ -12,11 +13,11 @@ import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
* @description: ExtTransferDocument-service * @description: ExtTransferDocument-service
* @author: dexadmin * @author: dexadmin
* @version: V * @version: V
* @date: 2024-10-29 10:30:50 * @date: 2024-10-29 10:30:50
**/ **/
public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> extends ExtTransferDocumentServiceShadow<V> { public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> extends ExtTransferDocumentServiceShadow<V> {
ExtTransferDocumentVO startWorkflow(Long id); ExtTransferDocumentVO startWorkflow(Long id);
...@@ -34,4 +35,6 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext ...@@ -34,4 +35,6 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext
void updateArchivingStatus(Long id); void updateArchivingStatus(Long id);
void returnDocument(Long id, Long docId); void returnDocument(Long id, Long docId);
void saveFilesDocLink(List<ExtFilesUpdateVO> extFilesUpdateVOList);
} }
...@@ -50,23 +50,31 @@ public class ExtFilesDocLinkServiceImpl<V extends ExtFilesDocLinkVO> implements ...@@ -50,23 +50,31 @@ public class ExtFilesDocLinkServiceImpl<V extends ExtFilesDocLinkVO> implements
return (List<ExtFilesDocLinkVO>) this.findRecursion(queryDoc).getContent(); return (List<ExtFilesDocLinkVO>) this.findRecursion(queryDoc).getContent();
} }
@Override
public List<ExtFilesDocLinkVO> getFilesDocLinkBySourceId(Long sourceId) {
SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("target").build())
.searchItems(SearchItems.builder()
.item(new SearchItem("sourceId", SearchItem.Operator.EQ, sourceId, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
return (List<ExtFilesDocLinkVO>) this.findRecursion(queryDoc).getContent();
}
@Override @Override
public void saveFilesDocLink(List<ExtFilesUpdateVO> extFilesUpdateVOList) { public void saveFilesDocLink(List<ExtFilesUpdateVO> extFilesUpdateVOList) {
List<ExtFilesDocLinkVO> extFilesDocLinkVOList = Lists.newArrayList(); List<ExtFilesDocLinkVO> extFilesDocLinkVOList = Lists.newArrayList();
for (ExtFilesUpdateVO extFilesUpdateVO : extFilesUpdateVOList) { for (ExtFilesUpdateVO extFilesUpdateVO : extFilesUpdateVOList) {
List<ExtFilesVO> filesVOList = extFilesService.findRecursionByVolumeNumber(extFilesUpdateVO.getBelongingCaseFile());
if (CollectionUtils.isNotEmpty(filesVOList)) {
ExtFilesDocLinkVO extFilesDocLinkVO = new ExtFilesDocLinkVO(); ExtFilesDocLinkVO extFilesDocLinkVO = new ExtFilesDocLinkVO();
ExtFilesVO extFilesVO = filesVOList.get(0); ExtFilesVO extFilesVO = extFilesUpdateVO.getExtFilesVO();
DxDocumentVO dxDocumentVO = extFilesUpdateVO.getDxDocumentVO();
extFilesDocLinkVO.setTarget(extFilesVO); extFilesDocLinkVO.setTarget(extFilesVO);
extFilesDocLinkVO.setTargetId(extFilesVO.getId()); extFilesDocLinkVO.setTargetId(extFilesVO.getId());
DxDocumentVO dxDocumentVO = extFilesUpdateVO.getDxDocumentVO();
extFilesDocLinkVO.setSource(dxDocumentVO); extFilesDocLinkVO.setSource(dxDocumentVO);
extFilesDocLinkVO.setSourceId(dxDocumentVO.getId()); extFilesDocLinkVO.setSourceId(dxDocumentVO.getId());
extFilesDocLinkVO.setOperator(OperatorType.ADD); extFilesDocLinkVO.setOperator(OperatorType.ADD);
extFilesDocLinkVOList.add(extFilesDocLinkVO); extFilesDocLinkVOList.add(extFilesDocLinkVO);
} }
}
if (CollectionUtils.isNotEmpty(extFilesDocLinkVOList)) { if (CollectionUtils.isNotEmpty(extFilesDocLinkVOList)) {
this.saveRecursion((V) extFilesDocLinkVOList); this.saveRecursion((V) extFilesDocLinkVOList);
} }
......
...@@ -5,6 +5,7 @@ import com.inet.dcs.document.common.vo.ExtFilesVO; ...@@ -5,6 +5,7 @@ import com.inet.dcs.document.common.vo.ExtFilesVO;
import com.inet.dcs.document.common.vo.archivesOtherVO.ExtFilesUpdateVO; import com.inet.dcs.document.common.vo.archivesOtherVO.ExtFilesUpdateVO;
import com.inet.dcs.document.core.constants.Constants; import com.inet.dcs.document.core.constants.Constants;
import com.inet.dcs.document.core.repository.ExtFilesRepository; import com.inet.dcs.document.core.repository.ExtFilesRepository;
import com.inet.dcs.document.core.service.ExtDocService;
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.core.service.ExtFilesService;
import com.inet.dcs.document.core.util.SearchUtil; import com.inet.dcs.document.core.util.SearchUtil;
...@@ -20,12 +21,8 @@ import com.yonde.dex.context.common.vo.DxContextProjectVO; ...@@ -20,12 +21,8 @@ import com.yonde.dex.context.common.vo.DxContextProjectVO;
import com.yonde.dex.context.common.vo.DxContextVO; import com.yonde.dex.context.common.vo.DxContextVO;
import com.yonde.dex.dao.service.DxDaoPluginExpander; import com.yonde.dex.dao.service.DxDaoPluginExpander;
import com.yonde.dex.dict.feign.DictDataFeignService; import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -42,7 +39,6 @@ import java.util.List; ...@@ -42,7 +39,6 @@ import java.util.List;
@Service(ExtFilesServiceImpl.BEAN_NAME) @Service(ExtFilesServiceImpl.BEAN_NAME)
public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesService<V>, DxDaoPluginExpander<V> { public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesService<V>, DxDaoPluginExpander<V> {
public static final String BEAN_NAME = "extFilesServiceImpl"; public static final String BEAN_NAME = "extFilesServiceImpl";
@Autowired @Autowired
...@@ -60,6 +56,9 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic ...@@ -60,6 +56,9 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
@Autowired @Autowired
private DictDataFeignService dictDataService; private DictDataFeignService dictDataService;
@Autowired
private ExtDocService extDocService;
@Override @Override
public void beforeSave(Collection<V> target) { public void beforeSave(Collection<V> target) {
// 全宗号+项目号+项目代号+类别代号+盒号(三位流水号)+后缀“-(两位数字流水号)例如:2-20114272031-QH03-JS01-001-(01) // 全宗号+项目号+项目代号+类别代号+盒号(三位流水号)+后缀“-(两位数字流水号)例如:2-20114272031-QH03-JS01-001-(01)
...@@ -95,6 +94,16 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic ...@@ -95,6 +94,16 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
} }
} }
@Override
public void updateExtFiles(ExtFilesVO extFilesVO, ExtFilesUpdateVO filesUpdateVO) {
extFilesVO.setSecretCode(filesUpdateVO.getSecretCode());
extFilesVO.setStoragePeriod(filesUpdateVO.getStoragePeriod());
extFilesVO.setFileNumber(filesUpdateVO.getFileNumber());
extFilesVO.setPageNumber(filesUpdateVO.getPageNumber());
extFilesVO.setOperator(OperatorType.MODIFY);
this.saveRecursion((V) extFilesVO);
}
/** /**
* 根据案卷序号查询案卷 * 根据案卷序号查询案卷
* *
...@@ -126,8 +135,13 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic ...@@ -126,8 +135,13 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
.item(new SearchItem("checkOuted", SearchItem.Operator.EQ, true, null)) .item(new SearchItem("checkOuted", SearchItem.Operator.EQ, true, null))
.operator(SearchItems.BooleanOperator.AND).build()).build(); .operator(SearchItems.BooleanOperator.AND).build()).build();
List<ExtFilesVO> content = (List<ExtFilesVO>) this.findRecursion(queryDoc).getContent(); List<ExtFilesVO> extFilesVOList = (List<ExtFilesVO>) this.findRecursion(queryDoc).getContent();
return content; for (ExtFilesVO extFilesVO : extFilesVOList) {
DxContextVO dxContext = extFilesVO.getDxContext();
String projectClass = dxContext.getProjectClass();
dxContext.setProjectClass(extDocService.searchDictDataByDictCode(Constants.PROJECT_CATEGORY, projectClass));
}
return extFilesVOList;
} }
private String getProjectCodeAndNumber(DxContextProjectVO dxContextProjectVO) { private String getProjectCodeAndNumber(DxContextProjectVO dxContextProjectVO) {
...@@ -183,59 +197,6 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic ...@@ -183,59 +197,6 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
return caseNumberBuilder.append(caseNumber).toString(); return caseNumberBuilder.append(caseNumber).toString();
} }
@Override
public void updateExtFiles(List<ExtFilesUpdateVO> extFilesUpdateVOList) {
List<ExtFilesVO> extFilesVOList = Lists.newArrayList();
List<DictDataVO> secretCodeDictList = dictDataService.getDictDatas(Constants.SECRET_CODE);
for (ExtFilesUpdateVO extFilesUpdateVO : extFilesUpdateVOList) {
List<ExtFilesVO> filesVOS = this.findRecursionByVolumeNumber(extFilesUpdateVO.getBelongingCaseFile());
if (CollectionUtils.isNotEmpty(filesVOS)) {
ExtFilesVO extFilesVO = filesVOS.get(0);
// 密级
String secretCode = extFilesVO.getSecretCode();
if (StringUtils.isBlank(secretCode)) {
secretCode = extFilesUpdateVO.getSecretCode();
} else {
}
extFilesVO.setSecretCode(secretCode);
// 年限
String storagePeriod = extFilesVO.getStoragePeriod();
if (StringUtils.isBlank(storagePeriod)) {
storagePeriod = extFilesUpdateVO.getStoragePeriod();
} else {
}
extFilesVO.setStoragePeriod(storagePeriod);
// 文件数
Integer fileNumber = extFilesVO.getFileNumber();
if (ObjectUtils.isEmpty(fileNumber)) {
fileNumber = extFilesUpdateVO.getFileNumber();
} else {
}
extFilesVO.setFileNumber(fileNumber);
// 总文件页数
Integer pageNumber = extFilesVO.getPageNumber();
if (ObjectUtils.isEmpty(pageNumber)) {
pageNumber = extFilesUpdateVO.getPageNumber();
} else {
}
extFilesVO.setPageNumber(pageNumber);
extFilesVO.setOperator(OperatorType.MODIFY);
extFilesVOList.add(extFilesVO);
}
}
if (CollectionUtils.isNotEmpty(extFilesVOList)) {
this.saveRecursion((V) extFilesVOList);
}
}
} }
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.ExtFilesVO;
import com.inet.dcs.document.common.vo.ExtTransferDocLinkVO; 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.common.vo.archivesOtherVO.ExtFilesUpdateVO; import com.inet.dcs.document.common.vo.archivesOtherVO.ExtFilesUpdateVO;
...@@ -16,6 +18,7 @@ import com.inet.dcs.document.core.service.expand.ExtDxDocumentService; ...@@ -16,6 +18,7 @@ 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.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.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;
...@@ -24,6 +27,8 @@ import com.yonde.dex.basedata.exception.DxBusinessException; ...@@ -24,6 +27,8 @@ import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.basic.feign.expand.ExtDxContextProjectServiceFeign; import com.yonde.dex.basic.feign.expand.ExtDxContextProjectServiceFeign;
import com.yonde.dex.context.common.vo.DxContextProjectVO; import com.yonde.dex.context.common.vo.DxContextProjectVO;
import com.yonde.dex.dao.service.DxDaoPluginExpander; import com.yonde.dex.dao.service.DxDaoPluginExpander;
import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO;
import com.yonde.dex.user.common.vo.DxUserInfoVO; import com.yonde.dex.user.common.vo.DxUserInfoVO;
import com.yonde.dex.user.feign.DxUserInfoFeign; import com.yonde.dex.user.feign.DxUserInfoFeign;
import com.yonde.dex.wfc.common.enums.TaskStateEnum; import com.yonde.dex.wfc.common.enums.TaskStateEnum;
...@@ -32,6 +37,7 @@ import com.yonde.dex.wfc.feign.api.WfcProcessFeign; ...@@ -32,6 +37,7 @@ import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -40,7 +46,6 @@ import java.time.ZoneId; ...@@ -40,7 +46,6 @@ import java.time.ZoneId;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -85,6 +90,9 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -85,6 +90,9 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
@Autowired @Autowired
private DxUserInfoFeign userService; private DxUserInfoFeign userService;
@Autowired
private DictDataFeignService dictDataService;
@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) {
...@@ -129,13 +137,6 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -129,13 +137,6 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
String archiveNumber = extTransferDocLinkVO.getArchiveNumber(); String archiveNumber = extTransferDocLinkVO.getArchiveNumber();
// TODO 查询linK判断是否数据库存在 // TODO 查询linK判断是否数据库存在
} }
log.info("=================开始=绑定案卷关系同时反更新案卷信息================");
// 3.绑定案卷文件关联关系
this.saveFilesDocLink(transferDocLinkVOList);
// 4.更新案卷下部分信息
this.updateExtFilesByBelongingCaseFile(transferDocLinkVOList);
log.info("=================结束=绑定案卷关系同时反更新案卷信息================");
} }
@Override @Override
...@@ -187,7 +188,6 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -187,7 +188,6 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) { if (wf.getState().equals(TaskStateEnum.COMPLETE.name()) && (SignConstants.WfResultList.contains(wf.getResult()))) {
Date endTime = wf.getEndTime(); Date endTime = wf.getEndTime();
return endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); return endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
} }
} }
} }
...@@ -215,6 +215,47 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -215,6 +215,47 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
} }
@Override
public void saveFilesDocLink(List<ExtFilesUpdateVO> extFilesUpdateVOList) {
List<ExtFilesVO> extFilesVOList = Lists.newArrayList();
List<Long> extFilesDocLinkIds = Lists.newArrayList();
ExtFilesUpdateVO extFilesUpdateVO = extFilesUpdateVOList.get(0);
SearchQueryCondition queryCondition = SearchUtil.buildQuery("id", SearchItem.Operator.EQ, extFilesUpdateVO.getFilesId());
ExtFilesVO extFilesVO = (ExtFilesVO) extFilesService.findRecursion(queryCondition).getContent().get(0);
extFilesVOList.add(extFilesVO);
for (ExtFilesUpdateVO extFilesUpdate : extFilesUpdateVOList) {
// 是否以前归属过案卷
List<ExtFilesDocLinkVO> filesDocLinkVOList = extFilesDocLinkService.getFilesDocLinkBySourceId(extFilesUpdate.getDocId());
if (ObjectUtils.isNotEmpty(filesDocLinkVOList)) {
ExtFilesDocLinkVO extFilesDocLinkVO = filesDocLinkVOList.get(0);
ExtFilesVO target = extFilesDocLinkVO.getTarget();
extFilesVOList.add(target);
extFilesDocLinkIds.add(extFilesDocLinkVO.getId());
}
SearchQueryCondition query = SearchUtil.buildQuery("id", SearchItem.Operator.EQ, extFilesUpdate.getDocId());
DxDocumentVO dxDocumentVO = (DxDocumentVO) extDxDocumentService.findRecursion(query).getContent().get(0);
extFilesUpdate.setExtFilesVO(extFilesVO);
extFilesUpdate.setDxDocumentVO(dxDocumentVO);
}
// 1.删除以前关系并重新计算以前案卷下为文档下最大密级、保管年限、文件数,总文件数
if (CollectionUtils.isNotEmpty(extFilesDocLinkIds)) {
extFilesDocLinkService.deleteAllById(extFilesDocLinkIds);
}
// 2.绑定新的案卷文档关联关系
extFilesDocLinkService.saveFilesDocLink(extFilesUpdateVOList);
// 3.重新计算案卷下为文档下最大密级、保管年限、文件数,总文件数
if (CollectionUtils.isNotEmpty(extFilesVOList)) {
this.updateExtFilesByBelongingCaseFile(extFilesVOList);
}
}
@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) {
...@@ -230,44 +271,63 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp ...@@ -230,44 +271,63 @@ public class ExtTransferDocumentServiceImpl<V extends ExtTransferDocumentVO> imp
return null; return null;
} }
private void saveFilesDocLink(List<ExtTransferDocLinkVO> transferDocLinkVOList) { private void updateExtFilesByBelongingCaseFile(List<ExtFilesVO> extFilesVOList) {
List<ExtFilesUpdateVO> extFilesUpdateVOList = Lists.newArrayList(); for (ExtFilesVO extFilesVO : extFilesVOList) {
for (ExtTransferDocLinkVO extTransferDocLinkVO : transferDocLinkVOList) { String volumeNumber = extFilesVO.getVolumeNumber();
ExtFilesUpdateVO extFilesUpdateVO = new ExtFilesUpdateVO(); int pageNumber = 0; //文件页数
extFilesUpdateVO.setBelongingCaseFile(extTransferDocLinkVO.getBelongingCaseFile()); String secretCode = ""; //最大密级
extFilesUpdateVO.setDxDocumentVO(extTransferDocLinkVO.getSource()); Integer secretCodeDictSeq = 0;
extFilesUpdateVOList.add(extFilesUpdateVO); String storagePeriod = ""; //最大年限
Integer storagePeriodDictSeq = 0;
// 案卷下的文档
SearchQueryCondition queryDoc = SearchQueryCondition.builder()
.openProp(SearchQueryCondition.builder().name("source").build())
.searchItems(SearchItems.builder()
.item(new SearchItem("belongingCaseFile", SearchItem.Operator.EQ, volumeNumber, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
List<ExtTransferDocLinkVO> extTransferDocLinkVOList = extTransferDocLinkService.findRecursion(queryDoc).getContent();
for (ExtTransferDocLinkVO extTransferDocLinkVO : extTransferDocLinkVOList) {
String secretCodeDoc = extTransferDocLinkVO.getSource().getSecretCode();
List<DictDataVO> dictDataVOByKey = this.getDictDataVOByKey(Constants.SECRET_CODE, secretCodeDoc);
// todo 获取最大密级和年限
if (CollectionUtils.isNotEmpty(dictDataVOByKey)) {
DictDataVO dictDataVO = dictDataVOByKey.get(0);
String dictKey = dictDataVO.getDictKey();
secretCodeDictSeq = dictDataVO.getDictSeq();
secretCode = this.getCompareMax(Constants.SECRET_CODE, secretCode, secretCodeDictSeq);
} }
extFilesDocLinkService.saveFilesDocLink(extFilesUpdateVOList); //storagePeriod = this.getCompareMax(Constants.SECRET_CODE, extTransferDocLinkVO.getStoragePeriod());
pageNumber += extTransferDocLinkVO.getPageNumber();
} }
private void updateExtFilesByBelongingCaseFile(List<ExtTransferDocLinkVO> transferDocLinkVOList) { ExtFilesUpdateVO filesUpdateVO = new ExtFilesUpdateVO();
Map<String, List<ExtTransferDocLinkVO>> belongingCaseFileMap = transferDocLinkVOList.stream() filesUpdateVO.setSecretCode(secretCode);
.collect(Collectors.groupingBy(ExtTransferDocLinkVO::getBelongingCaseFile)); filesUpdateVO.setStoragePeriod(storagePeriod);
filesUpdateVO.setFileNumber(extTransferDocLinkVOList.size());
filesUpdateVO.setPageNumber(pageNumber);
extFilesService.updateExtFiles(extFilesVO, filesUpdateVO);
}
}
List<ExtFilesUpdateVO> extFilesUpdateVOList = Lists.newArrayList(); private String getCompareMax(String dictCode, String dictKey, Integer max) {
belongingCaseFileMap.forEach((key, value) -> { List<DictDataVO> dictDataVOList = this.getDictDataVOByKey(dictCode, dictKey);
ExtFilesUpdateVO extFilesUpdateVO = new ExtFilesUpdateVO(); if (CollectionUtils.isNotEmpty(dictDataVOList)) {
String secretCode = ""; //最大密级 DictDataVO dictDataVO = dictDataVOList.get(0);
String storagePeriod = ""; //最大年限 Integer dictSeq = dictDataVO.getDictSeq();
int fileNumber = 0; if (dictSeq > max) {
int pageNumber = value.size(); return dictDataVO.getDictKey();
for (ExtTransferDocLinkVO extTransferDocLinkVO : value) { }
// TODO 密级 }
extTransferDocLinkVO.getSource().getSecretCode(); return dictKey;
// TODO 保存年限 }
extTransferDocLinkVO.getStoragePeriod();
// 文件页数 private List<DictDataVO> getDictDataVOByKey(String dictCode, String dictKey) {
fileNumber += extTransferDocLinkVO.getPageNumber(); List<DictDataVO> dictDataVOs = dictDataService.getDictDatas(dictCode);
} if (CollectionUtils.isNotEmpty(dictDataVOs)) {
extFilesUpdateVO.setBelongingCaseFile(key); return dictDataVOs.stream().filter(dic -> dic.getDictKey().equals(dictKey)).collect(Collectors.toList());
extFilesUpdateVO.setSecretCode(secretCode); }
extFilesUpdateVO.setStoragePeriod(storagePeriod); return null;
extFilesUpdateVO.setFileNumber(fileNumber);
extFilesUpdateVO.setPageNumber(pageNumber);
extFilesUpdateVOList.add(extFilesUpdateVO);
});
extFilesService.updateExtFiles(extFilesUpdateVOList);
} }
} }
......
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