|
@@ -992,7 +992,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
//如果传递了编号就修改对应记录的值 以第一张表的数据为准
|
|
|
this.updateRecordNoOrReportNo(obj, dto);
|
|
|
//------编辑时记录表编号或报告单编号为Null的重新生成------
|
|
|
- if(this.judgingParameters(dto)){
|
|
|
+ if(!this.judgingParameters(dto)){
|
|
|
this.reBuildNumber(obj, dto);
|
|
|
}
|
|
|
|
|
@@ -1449,6 +1449,182 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //提前构建记录或者报告编号 供用户保存前提交时使用(新增保存前显示系统引用的记录编号或者报告编号)
|
|
|
+ public HashMap<String,String> buildNumberView(TrialSelfInspectionRecordDTO dto) {
|
|
|
+ StringSPUtils spUtils = new StringSPUtils();
|
|
|
+ List<TrialSelfInspectionRecord> result = baseMapper.selectAll(dto.getNodeId(), dto.getContractId(), dto.getType());
|
|
|
+ List<TrialSelfInspectionRecord> trialSelfInspectionRecords = result.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //两种类型同时生成
|
|
|
+ if (dto.getTableType().contains("1,2") || dto.getTableType().contains("2,1") || dto.getTableType().contains("9,10") || dto.getTableType().contains("10,9")) {
|
|
|
+ String maxRecordNo = "";
|
|
|
+ if (StringUtils.isEmpty(dto.getRecordNo())) {
|
|
|
+ //获取记录表最大编号
|
|
|
+ List<String> recordNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getRecordNo).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+ if (recordNos.size() == 0 || ObjectUtil.isEmpty(recordNos)) {
|
|
|
+ maxRecordNo = "0001";
|
|
|
+ } else {
|
|
|
+ /* List<String> numberRecordNos = new ArrayList<>();
|
|
|
+ for (String recordNo : recordNos) {
|
|
|
+ String number = recordNo.split("-")[recordNo.split("-").length - 1];
|
|
|
+ numberRecordNos.add(number);
|
|
|
+ }
|
|
|
+ int maxRecordNo1 = Integer.parseInt(Collections.max(numberRecordNos)) + 1;
|
|
|
+ if (maxRecordNo1 < 9999 && maxRecordNo1 > 0) {
|
|
|
+ maxRecordNo = spUtils.buildSerial(maxRecordNo1, 4);
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("当前编号已达到最大值9999,操作失败");
|
|
|
+ }*/
|
|
|
+
|
|
|
+ maxRecordNo = recordNos.size()+"";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ String maxReportNo = "";
|
|
|
+ if (StringUtils.isEmpty(dto.getReportNo())) {
|
|
|
+ //获取报告单最大编号
|
|
|
+ List<String> reportNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getReportNo).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+ if (reportNos.size() == 0 || ObjectUtil.isEmpty(reportNos)) {
|
|
|
+ maxReportNo = "0001";
|
|
|
+ } else {
|
|
|
+ /*List<String> numberReportNo = new ArrayList<>();
|
|
|
+ for (String reportNo : reportNos) {
|
|
|
+ String number = reportNo.split("-")[reportNo.split("-").length - 1];
|
|
|
+ numberReportNo.add(number);
|
|
|
+ }
|
|
|
+ int maxReportNo1 = Integer.parseInt(Collections.max(numberReportNo)) + 1;
|
|
|
+ if (maxReportNo1 < 9999 && maxReportNo1 > 0) {
|
|
|
+ maxReportNo = spUtils.buildSerial(maxReportNo1, 4);
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("当前编号已达到最大值9999,操作失败");
|
|
|
+ }*/
|
|
|
+ maxReportNo = reportNos.size()+"";
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
|
|
|
+ ContractInfo contract = contractClient.getContractById(dto.getContractId());
|
|
|
+ int year = LocalDateTimeUtil.now().getYear();
|
|
|
+ if (wbsTreePrivate == null || contract == null) {
|
|
|
+ throw new ServiceException("未找到当前项目合同段的节点信息,操作失败!");
|
|
|
+ } else {
|
|
|
+ //记录表
|
|
|
+ if (StringUtils.isNotEmpty(maxRecordNo)) {
|
|
|
+ String str1 = "JL" +
|
|
|
+ "-" + contract.getContractNumber() +
|
|
|
+ "-" + year +
|
|
|
+ "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
|
|
|
+ "-" + maxRecordNo;
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put("type","记录表");
|
|
|
+ stringStringHashMap.put("valueStr",str1);
|
|
|
+ return stringStringHashMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ //报告单
|
|
|
+ if (StringUtils.isNotEmpty(maxReportNo)) {
|
|
|
+ String str2 = "BG" +
|
|
|
+ "-" + contract.getContractNumber() +
|
|
|
+ "-" + year +
|
|
|
+ "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
|
|
|
+ "-" + maxReportNo;
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put("type","报告单");
|
|
|
+ stringStringHashMap.put("valueStr",str2);
|
|
|
+ return stringStringHashMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //记录表
|
|
|
+ else if (("1").equals(dto.getTableType()) || ("9").equals(dto.getTableType())) {
|
|
|
+ if (StringUtils.isEmpty(dto.getRecordNo())) {
|
|
|
+ //获取记录表最大编号
|
|
|
+ List<String> recordNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getRecordNo).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+ String maxRecordNo;
|
|
|
+ if (recordNos.size() == 0 || ObjectUtil.isEmpty(recordNos)) {
|
|
|
+ maxRecordNo = "0001";
|
|
|
+ } else {
|
|
|
+ /*List<String> numberRecordNos = new ArrayList<>();
|
|
|
+ for (String recordNo : recordNos) {
|
|
|
+ String number = (recordNo.split("-")[recordNo.split("-").length - 1]).replaceAll("]","");
|
|
|
+ numberRecordNos.add(number);
|
|
|
+ }
|
|
|
+ int maxRecordNo1 = Integer.parseInt(Collections.max(numberRecordNos)) + 1;
|
|
|
+ if (maxRecordNo1 < 9999 && maxRecordNo1 > 0) {
|
|
|
+ maxRecordNo = spUtils.buildSerial(maxRecordNo1, 4);
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("当前编号已达到最大值9999,操作失败");
|
|
|
+ }*/
|
|
|
+ maxRecordNo = recordNos.size()+"";
|
|
|
+ }
|
|
|
+
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
|
|
|
+ ContractInfo contract = contractClient.getContractById(dto.getContractId());
|
|
|
+ int year = LocalDateTimeUtil.now().getYear();
|
|
|
+ if (wbsTreePrivate == null || contract == null) {
|
|
|
+ throw new ServiceException("未找到当前项目合同段的节点信息,操作失败!");
|
|
|
+ } else {
|
|
|
+ //记录表
|
|
|
+ String str1 = "JL" +
|
|
|
+ "-" + contract.getContractNumber() +
|
|
|
+ "-" + year +
|
|
|
+ "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
|
|
|
+ "-" + maxRecordNo;
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put("type","记录表");
|
|
|
+ stringStringHashMap.put("valueStr",str1);
|
|
|
+ return stringStringHashMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //报告单
|
|
|
+ else if (("2").equals(dto.getTableType()) || ("10").equals(dto.getTableType())) {
|
|
|
+ if (StringUtils.isEmpty(dto.getReportNo())) {
|
|
|
+ //获取报告单最大编号
|
|
|
+ List<String> reportNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getReportNo).filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
|
|
+ String maxReportNo;
|
|
|
+ if (reportNos.size() == 0 || ObjectUtil.isEmpty(reportNos)) {
|
|
|
+ maxReportNo = "0001";
|
|
|
+ } else {
|
|
|
+ /* List<String> numberReportNo = new ArrayList<>();
|
|
|
+ for (String reportNo : reportNos) {
|
|
|
+ String number = reportNo.split("-")[reportNo.split("-").length - 1];
|
|
|
+ numberReportNo.add(number);
|
|
|
+ }
|
|
|
+ int maxReportNo1 = Integer.parseInt(Collections.max(numberReportNo)) + 1;
|
|
|
+ if (maxReportNo1 < 9999 && maxReportNo1 > 0) {
|
|
|
+ maxReportNo = spUtils.buildSerial(maxReportNo1, 4);
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("当前编号已达到最大值9999,操作失败");
|
|
|
+ }*/
|
|
|
+ maxReportNo = reportNos.size()+"";
|
|
|
+ }
|
|
|
+
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryByPKeyIds(Func.toStrList(String.valueOf(dto.getNodeId()))).stream().findAny().orElse(null);
|
|
|
+ ContractInfo contract = contractClient.getContractById(dto.getContractId());
|
|
|
+ int year = LocalDateTimeUtil.now().getYear();
|
|
|
+ if (wbsTreePrivate == null || contract == null) {
|
|
|
+ throw new ServiceException("未找到当前项目合同段的节点信息,操作失败!");
|
|
|
+ } else {
|
|
|
+ //报告单
|
|
|
+ String str2 = "BG" +
|
|
|
+ "-" + contract.getContractNumber() +
|
|
|
+ "-" + year +
|
|
|
+ "-" + spUtils.getStringSP(wbsTreePrivate.getNodeName().trim()) +
|
|
|
+ "-" + maxReportNo;
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put("type","报告单");
|
|
|
+ stringStringHashMap.put("valueStr",str2);
|
|
|
+ return stringStringHashMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
public IPage<TrialSelfInspectionRecordVO> trialDataPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
|
|
|
QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
|