Commit 7c37e00c authored by wei's avatar wei 🎱

非项目群下的案卷,查顶级

parent 5a59f6ef
......@@ -3,8 +3,15 @@ package com.inet.dcs.document.core.service.impl;
import com.inet.dcs.document.common.vo.ExtFilesVO;
import com.inet.dcs.document.core.repository.ExtFilesRepository;
import com.inet.dcs.document.core.service.ExtFilesService;
import com.inet.dcs.document.core.util.SearchUtil;
import com.inet.dcs.document.entity.po.ExtFiles;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.basic.feign.expand.ExtDxContextProjectServiceFeign;
import com.yonde.dex.context.common.vo.DxContextProjectVO;
import com.yonde.dex.context.common.vo.DxContextVO;
import com.yonde.dex.dao.service.DxDaoPluginExpander;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -31,17 +38,52 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
// 需要补位的长度
public static final int LENGTH = 3;
@Autowired
private ExtDxContextProjectServiceFeign extDxContextProjectServiceFeign;
@Override
public void beforeSave(Collection<V> target) {
// 全宗号+项目号+项目代号+类别代号+盒号(三位流水号)+后缀“-(两位数字流水号)例如:2-20114272031-QH03-JS01-001-(01)
String projectCodeAndNumber;
for (V v : target) {
DxContextVO dxContext = v.getDxContext();
if ("program".equals(dxContext.getProjectClass())) {
projectCodeAndNumber = dxContext.getContractCode() + "-" + dxContext.getNumber();
} else {
projectCodeAndNumber = this.getProjectCodeAndNumber(dxContext);
}
String caseNumber = this.getCaseNumber(v.getCaseNumber());
String categoryNumber = v.getCategoryNumber();
String volumeNumber = "2-" + "项目号" + "-" + "项目代号" + "-".concat(categoryNumber + "-").concat(caseNumber);
String volumeNumber = "2-".concat(projectCodeAndNumber + "-").concat(categoryNumber + "-").concat(caseNumber);
v.setVolumeNumber(volumeNumber);
}
}
private String getProjectCodeAndNumber(DxContextVO dxContext) {
boolean projectClass = false;
// 项目群上的合同编号
String contractCode = "";
// 项目群的项目代号
String number = "";
// 非项目群下的案卷,查顶级
while (!projectClass) {
dxContext = this.getProjectInfo(dxContext);
projectClass = "program".equals(dxContext.getProjectClass());
if (projectClass) {
contractCode = dxContext.getContractCode();
number = dxContext.getNumber();
}
}
return contractCode + "-" + number;
}
private DxContextVO getProjectInfo(DxContextVO dxContextVO) {
SearchQueryCondition searchProgram = SearchUtil.buildQuery("id", SearchItem.Operator.EQ, dxContextVO.getParentId());
DxPageImpl programDxPage = extDxContextProjectServiceFeign.findRecursion(searchProgram);
return (DxContextVO) programDxPage.getContent().get(0);
}
private String getCaseNumber(String caseNumber) {
StringBuilder caseNumberBuilder = new StringBuilder();
int length = caseNumber.length();
......
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