Commit bd25cafe authored by wei's avatar wei 🎱

案卷序号

parent 15030a46
package com.inet.dcs.document.core.service.impl; package com.inet.dcs.document.core.service.impl;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import com.inet.dcs.document.common.vo.ExtFilesVO; import com.inet.dcs.document.common.vo.ExtFilesVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Autowired;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import com.inet.dcs.document.core.service.ExtFilesService;
import com.inet.dcs.document.core.repository.ExtFilesRepository; import com.inet.dcs.document.core.repository.ExtFilesRepository;
import com.inet.dcs.document.core.service.ExtFilesService;
import com.inet.dcs.document.entity.po.ExtFiles; import com.inet.dcs.document.entity.po.ExtFiles;
import javax.annotation.Resource; import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.dao.service.DxDaoPluginExpander;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collection;
/** /**
* @description: ExtFiles-ServiceImpl * @description: ExtFiles-ServiceImpl
* @author: dexadmin * @author: dexadmin
* @version: V * @version: V
* @date: 2024-10-29 10:30:49 * @date: 2024-10-29 10:30:49
**/ **/
@Slf4j @Slf4j
@Service(ExtFilesServiceImpl.BEAN_NAME) @Service(ExtFilesServiceImpl.BEAN_NAME)
public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesService<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";
...@@ -29,6 +28,42 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic ...@@ -29,6 +28,42 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
@Autowired @Autowired
ExtFilesRepository<ExtFiles> extFilesRepository; ExtFilesRepository<ExtFiles> extFilesRepository;
// 需要补位的长度
public static final int LENGTH = 3;
@Override
public void beforeSave(Collection<V> target) {
// 全宗号+项目号+项目代号+类别代号+盒号(三位流水号)+后缀“-(两位数字流水号)例如:2-20114272031-QH03-JS01-001-(01)
for (V v : target) {
String caseNumber = v.getCaseNumber();
caseNumber = getCaseNumber(caseNumber);
String categoryNumber = v.getCategoryNumber();
String volumeNumber = "2-" + "项目号" + "-" + "项目代号" + "-".concat(categoryNumber + "-").concat(caseNumber);
v.setVolumeNumber(volumeNumber);
}
}
private String getCaseNumber(String caseNumber) {
StringBuilder caseNumberBuilder = new StringBuilder();
int length = caseNumber.length();
// 正常输入补位后不能超过3位数字
if (!caseNumber.contains("=") && length > 3) {
throw new DxBusinessException("500", "案卷序号:" + caseNumber + "不能超过3位数");
}
// 无后缀-输入,位数3补齐0
if (!caseNumber.contains("=")) {
// 不满足位数
if (length < LENGTH) {
for (int i = 0; i < LENGTH - length; i++) {
caseNumberBuilder.append("0");
}
}
} else {
// 包含-认为是插入后缀情况 暂时定义为直接拼上
}
return caseNumberBuilder.append(caseNumber).toString();
}
} }
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