|
@@ -424,7 +424,8 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
|
|
|
List<TrialSelfInspectionRecord> bg = recordList.stream().filter(f -> ObjectUtils.isNotEmpty(f.getReportNo()) && f.getReportNo().contains("BG-")).collect(Collectors.toList());
|
|
|
List<TrialSelfInspectionRecord> jl = recordList.stream().filter(f -> ObjectUtils.isNotEmpty(f.getRecordNo()) && f.getRecordNo().contains("JL-")).collect(Collectors.toList());
|
|
|
-
|
|
|
+ String maxRecordNo = "";
|
|
|
+ String maxReportNo = "";
|
|
|
if (jl.size() > 0) {
|
|
|
List<String> numberRecordNos = new ArrayList<>();
|
|
|
for (String recordNo : jl.stream().map(TrialSelfInspectionRecord::getRecordNo).collect(Collectors.toList())) {
|
|
@@ -433,11 +434,15 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
}
|
|
|
int maxRecordNo1 = Integer.parseInt(Collections.max(numberRecordNos)) + 1;
|
|
|
if (maxRecordNo1 < 9999 && maxRecordNo1 > 0) {
|
|
|
- String recordNo = dto.getRecordNo();
|
|
|
- String substring = recordNo.substring(recordNo.length() - 4);
|
|
|
- String s = spUtils.buildSerial(maxRecordNo1, 4);
|
|
|
- String replace = recordNo.replace(substring, s);
|
|
|
- dto.setRecordNo(replace);
|
|
|
+ if (ObjectUtil.isEmpty(dto.getRecordNo())) {
|
|
|
+ maxRecordNo = "0001";
|
|
|
+ } else {
|
|
|
+ String recordNo = dto.getRecordNo();
|
|
|
+ String substring = recordNo.substring(recordNo.length() - 4);
|
|
|
+ String s = spUtils.buildSerial(maxRecordNo1, 4);
|
|
|
+ String replace = recordNo.replace(substring, s);
|
|
|
+ dto.setRecordNo(replace);
|
|
|
+ }
|
|
|
} else {
|
|
|
throw new ServiceException("当前编号已达到最大值9999,操作失败");
|
|
|
}
|
|
@@ -450,15 +455,47 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
}
|
|
|
int maxReportNo1 = Integer.parseInt(Collections.max(numberReportNos)) + 1;
|
|
|
if (maxReportNo1 < 9999 && maxReportNo1 > 0) {
|
|
|
- String reportNo = dto.getReportNo();
|
|
|
- String substring = reportNo.substring(reportNo.length() - 4);
|
|
|
- String s = spUtils.buildSerial(maxReportNo1, 4);
|
|
|
- String replace = reportNo.replace(substring, s);
|
|
|
- dto.setReportNo(replace);
|
|
|
+ if (ObjectUtil.isEmpty(dto.getReportNo())) {
|
|
|
+ maxReportNo = "0001";
|
|
|
+ } else {
|
|
|
+ String reportNo = dto.getReportNo();
|
|
|
+ String substring = reportNo.substring(reportNo.length() - 4);
|
|
|
+ String s = spUtils.buildSerial(maxReportNo1, 4);
|
|
|
+ String replace = reportNo.replace(substring, s);
|
|
|
+ dto.setReportNo(replace);
|
|
|
+ }
|
|
|
} else {
|
|
|
throw new ServiceException("当前编号已达到最大值9999,操作失败");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId())));
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivates.stream().findAny().orElse(null);
|
|
|
+ ContractInfo contract = contractClient.getContractById(dto.getContractId());
|
|
|
+ int year = LocalDateTimeUtil.now().getYear();
|
|
|
+ if (wbsTreePrivate == null) {
|
|
|
+ throw new ServiceException("未找到当前节点信息,操作失败!");
|
|
|
+ } else {
|
|
|
+ //记录表
|
|
|
+ if (StringUtils.isNotEmpty(maxRecordNo)) {
|
|
|
+ String str1 = "JL" +
|
|
|
+ "-" + contract.getContractNumber() +
|
|
|
+ "-" + year +
|
|
|
+ "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
|
|
|
+ "-" + maxRecordNo;
|
|
|
+ dto.setRecordNo(str1);
|
|
|
+ }
|
|
|
+
|
|
|
+ //报告单
|
|
|
+ if (StringUtils.isNotEmpty(maxReportNo)) {
|
|
|
+ String str2 = "BG" +
|
|
|
+ "-" + contract.getContractNumber() +
|
|
|
+ "-" + year +
|
|
|
+ "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
|
|
|
+ "-" + maxReportNo;
|
|
|
+ dto.setReportNo(str2);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|