Commit 89e2421b authored by wei's avatar wei 🎱

文件归所属案卷

parent 541742fb
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 lombok.Data;
......@@ -13,10 +14,30 @@ import java.io.Serializable;
@Data
public class ExtFilesUpdateVO implements Serializable {
/**
* 文件id
* 移交单ID
*/
private Long transferDocumentId;
/**
* 文档id
*/
private Long docId;
/**
* 文档
*/
private DxDocumentVO dxDocumentVO;
/**
* 所属案卷ID
*/
private Long filesId;
/**
* 案卷
*/
private ExtFilesVO extFilesVO;
/**
* 所属案卷
*/
......
......@@ -366,6 +366,10 @@ public class Constants {
* 项目代号字典type
*/
public static final String PROJECT_CODE = "ProjectCode";
/**
* 项目类型
*/
public static final String PROJECT_CATEGORY = "projectCategory";
/**
* 设计阶段字典type
*/
......
package com.inet.dcs.document.core.controller;
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.service.ExtTransferDocumentService;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
......@@ -11,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @description: ExtTransferDocument-Controller
* @author: dexadmin
......@@ -39,6 +42,13 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex
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 = "获取项目信息")
@GetMapping(value = "/getTransferDocProject")
public ApiResult getTransferDocProjectById(@RequestParam("id") Long id) {
......@@ -52,7 +62,7 @@ public class ExtTransferDocumentController<V extends ExtTransferDocumentVO, S ex
}
@ApiOperation(value = "移交单下文件清单退档", notes = "移交单下文件清单退档")
@GetMapping(value = "/returnDocument")
@PostMapping(value = "/returnDocument")
public ApiResult returnDocument(@RequestParam("id") Long id,
@RequestParam("docId") Long docId) {
extTransferDocumentService.returnDocument(id, docId);
......
......@@ -22,6 +22,14 @@ public interface ExtFilesDocLinkService<V extends ExtFilesDocLinkVO> extends Ext
*/
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
/**
* 批量更新案卷部分信息
*
* @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
* @return
*/
List<ExtFilesVO> getExtFilesByProjectCode(Long projectCode);
}
package com.inet.dcs.document.core.service;
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.core.service.shadow.ExtTransferDocumentServiceShadow;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
......@@ -12,11 +13,11 @@ import java.time.LocalDateTime;
import java.util.List;
/**
* @description: ExtTransferDocument-service
* @author: dexadmin
* @version: V
* @date: 2024-10-29 10:30:50
**/
* @description: ExtTransferDocument-service
* @author: dexadmin
* @version: V
* @date: 2024-10-29 10:30:50
**/
public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> extends ExtTransferDocumentServiceShadow<V> {
ExtTransferDocumentVO startWorkflow(Long id);
......@@ -34,4 +35,6 @@ public interface ExtTransferDocumentService<V extends ExtTransferDocumentVO> ext
void updateArchivingStatus(Long id);
void returnDocument(Long id, Long docId);
void saveFilesDocLink(List<ExtFilesUpdateVO> extFilesUpdateVOList);
}
......@@ -50,23 +50,31 @@ public class ExtFilesDocLinkServiceImpl<V extends ExtFilesDocLinkVO> implements
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
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();
ExtFilesVO extFilesVO = extFilesUpdateVO.getExtFilesVO();
extFilesDocLinkVO.setTarget(extFilesVO);
extFilesDocLinkVO.setTargetId(extFilesVO.getId());
DxDocumentVO dxDocumentVO = extFilesUpdateVO.getDxDocumentVO();
extFilesDocLinkVO.setSource(dxDocumentVO);
extFilesDocLinkVO.setSourceId(dxDocumentVO.getId());
extFilesDocLinkVO.setOperator(OperatorType.ADD);
extFilesDocLinkVOList.add(extFilesDocLinkVO);
}
}
if (CollectionUtils.isNotEmpty(extFilesDocLinkVOList)) {
this.saveRecursion((V) extFilesDocLinkVOList);
}
......
......@@ -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.core.constants.Constants;
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.ExtFilesService;
import com.inet.dcs.document.core.util.SearchUtil;
......@@ -20,12 +21,8 @@ import com.yonde.dex.context.common.vo.DxContextProjectVO;
import com.yonde.dex.context.common.vo.DxContextVO;
import com.yonde.dex.dao.service.DxDaoPluginExpander;
import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO;
import lombok.extern.slf4j.Slf4j;
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.stereotype.Service;
......@@ -42,7 +39,6 @@ import java.util.List;
@Service(ExtFilesServiceImpl.BEAN_NAME)
public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesService<V>, DxDaoPluginExpander<V> {
public static final String BEAN_NAME = "extFilesServiceImpl";
@Autowired
......@@ -60,6 +56,9 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
@Autowired
private DictDataFeignService dictDataService;
@Autowired
private ExtDocService extDocService;
@Override
public void beforeSave(Collection<V> target) {
// 全宗号+项目号+项目代号+类别代号+盒号(三位流水号)+后缀“-(两位数字流水号)例如:2-20114272031-QH03-JS01-001-(01)
......@@ -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
.item(new SearchItem("checkOuted", SearchItem.Operator.EQ, true, null))
.operator(SearchItems.BooleanOperator.AND).build()).build();
List<ExtFilesVO> content = (List<ExtFilesVO>) this.findRecursion(queryDoc).getContent();
return content;
List<ExtFilesVO> extFilesVOList = (List<ExtFilesVO>) this.findRecursion(queryDoc).getContent();
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) {
......@@ -183,59 +197,6 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
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);
}
}
}
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