|
@@ -1,9 +1,11 @@
|
|
|
package org.springblade.business.service.impl;
|
|
|
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
@@ -40,6 +42,9 @@ import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
+import org.springblade.core.redis.cache.BladeRedis;
|
|
|
+import org.springblade.core.secure.BladeUser;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.manager.entity.*;
|
|
@@ -139,6 +144,17 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getQueryStatus())) {
|
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, dto.getQueryStatus());
|
|
|
}
|
|
|
+ if (dto.getSortType() != null) {
|
|
|
+ if (dto.getSortType().equals("1")) {
|
|
|
+ queryWrapper.lambda().orderByAsc(TrialSelfInspectionRecord::getReportNo);
|
|
|
+ } else if (dto.getSortType().equals("2")) {
|
|
|
+ queryWrapper.lambda().orderByDesc(TrialSelfInspectionRecord::getReportNo);
|
|
|
+ } else if (dto.getSortType().equals("3")) {
|
|
|
+ queryWrapper.lambda().orderByAsc(Arrays.asList(TrialSelfInspectionRecord::getSpecificationModel, TrialSelfInspectionRecord::getReportNo));
|
|
|
+ } else if (dto.getSortType().equals("4")) {
|
|
|
+ queryWrapper.lambda().orderByDesc(Arrays.asList(TrialSelfInspectionRecord::getSpecificationModel, TrialSelfInspectionRecord::getReportNo));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(true, TrialSelfInspectionRecord::getCreateTime));
|
|
|
IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
@@ -205,6 +221,21 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (record.getBaseInfo() != null && !record.getBaseInfo().isEmpty()) {
|
|
|
+ try {
|
|
|
+ TrialSeleInspectionRecordBaseInfoDTO baseInfoDTO = JSON.parseObject(record.getBaseInfo(), TrialSeleInspectionRecordBaseInfoDTO.class);
|
|
|
+ if (baseInfoDTO != null) {
|
|
|
+ if (StringUtil.hasText(baseInfoDTO.getEntrustNo())) {
|
|
|
+ record.setEntrustNo(baseInfoDTO.getEntrustNo());
|
|
|
+ }
|
|
|
+ if (StringUtil.hasText(baseInfoDTO.getProjectPosition())) {
|
|
|
+ record.setProjectPositionName(baseInfoDTO.getProjectPosition());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("JSON反序列化失败:" + record.getBaseInfo());
|
|
|
+ }
|
|
|
+ }
|
|
|
//合并的pdfUrl
|
|
|
String pdf = this.getMergePdfToTrialNew(record.getContractId(), record.getId(), dto.getType());
|
|
|
record.setPdfUrl(pdf);
|
|
@@ -1131,7 +1162,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
this.recordSampleSubmit(dto, obj);
|
|
|
|
|
|
//------关联新增设备使用记录信息------
|
|
|
- this.trialDeviceUseService.addDeviceUseInfo(dto);
|
|
|
+ this.trialDeviceUseService.addDeviceUseInfo(dto, obj.getId());
|
|
|
}
|
|
|
|
|
|
// ---- 修改样品单号信息 --------
|
|
@@ -1420,16 +1451,16 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
|
|
|
//取样信息
|
|
|
List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectList(Wrappers.<TrialSampleInfo>lambdaQuery().in(TrialSampleInfo::getId, ids));
|
|
|
- List<String> samplingLocations = trialSampleInfos.stream().map(TrialSampleInfo::getSamplingLocation).filter(string -> !string.isEmpty()).collect(Collectors.toList());
|
|
|
+ List<String> samplingLocations = trialSampleInfos.stream().map(TrialSampleInfo::getSamplingLocation).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
|
|
|
String samplingLocation = org.apache.commons.lang.StringUtils.join(samplingLocations, "、");
|
|
|
|
|
|
- List<String> calculationUnits = trialSampleInfos.stream().map(TrialSampleInfo::getCalculationUnit).filter(string -> !string.isEmpty()).collect(Collectors.toList());
|
|
|
+ List<String> calculationUnits = trialSampleInfos.stream().map(TrialSampleInfo::getCalculationUnit).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
|
|
|
String calculationUnit = org.apache.commons.lang.StringUtils.join(calculationUnits, "、");
|
|
|
|
|
|
- List<String> specificationNumbers = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).filter(string -> !string.isEmpty()).collect(Collectors.toList());
|
|
|
+ List<String> specificationNumbers = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationNumber).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
|
|
|
String specificationNumber = org.apache.commons.lang.StringUtils.join(specificationNumbers, "、");
|
|
|
|
|
|
- List<String> specificationModels = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationModel).filter(string -> !string.isEmpty()).collect(Collectors.toList());
|
|
|
+ List<String> specificationModels = trialSampleInfos.stream().map(TrialSampleInfo::getSpecificationModel).filter(string -> string !=null && !string.isEmpty()).collect(Collectors.toList());
|
|
|
String specificationModel = org.apache.commons.lang.StringUtils.join(specificationModels, "、");
|
|
|
|
|
|
//更新
|
|
@@ -1678,7 +1709,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
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());
|
|
|
-
|
|
|
+ TrialSelfInspectionRecord trialSelfInspectionRecord = trialSelfInspectionRecords.stream().filter(item -> Objects.equals(item.getId(), dto.getId())).findFirst().orElse(null);
|
|
|
//两种类型同时生成
|
|
|
if (dto.getTableType().contains("1,2") || dto.getTableType().contains("2,1") || dto.getTableType().contains("9,10") || dto.getTableType().contains("10,9")) {
|
|
|
String maxRecordNo = "";
|
|
@@ -1736,26 +1767,34 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
} else {
|
|
|
//记录表
|
|
|
if (StringUtils.isNotEmpty(maxRecordNo)) {
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put("type","记录表");
|
|
|
+ if (trialSelfInspectionRecord != null) {
|
|
|
+ stringStringHashMap.put("valueStr",trialSelfInspectionRecord.getRecordNo());
|
|
|
+ return stringStringHashMap;
|
|
|
+ }
|
|
|
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)) {
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put("type","报告单");
|
|
|
+ if (trialSelfInspectionRecord != null) {
|
|
|
+ stringStringHashMap.put("valueStr",trialSelfInspectionRecord.getReportNo());
|
|
|
+ return stringStringHashMap;
|
|
|
+ }
|
|
|
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;
|
|
|
}
|
|
@@ -1792,13 +1831,17 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
throw new ServiceException("未找到当前项目合同段的节点信息,操作失败!");
|
|
|
} else {
|
|
|
//记录表
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put("type","记录表");
|
|
|
+ if (trialSelfInspectionRecord != null) {
|
|
|
+ stringStringHashMap.put("valueStr",trialSelfInspectionRecord.getRecordNo());
|
|
|
+ return stringStringHashMap;
|
|
|
+ }
|
|
|
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;
|
|
|
}
|
|
@@ -1835,13 +1878,17 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
throw new ServiceException("未找到当前项目合同段的节点信息,操作失败!");
|
|
|
} else {
|
|
|
//报告单
|
|
|
+ HashMap<String, String> stringStringHashMap = new HashMap<>();
|
|
|
+ stringStringHashMap.put("type","报告单");
|
|
|
+ if (trialSelfInspectionRecord != null) {
|
|
|
+ stringStringHashMap.put("valueStr",trialSelfInspectionRecord.getReportNo());
|
|
|
+ return stringStringHashMap;
|
|
|
+ }
|
|
|
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;
|
|
|
}
|
|
@@ -2073,5 +2120,188 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Long saveBaseInfo(TrialSeleInspectionRecordInfoDTO dto) {
|
|
|
+ TrialSelfInspectionRecord record = new TrialSelfInspectionRecord();
|
|
|
+ BeanUtil.copyProperties(dto, record);
|
|
|
+ if (record.getEntrustId() == null) {
|
|
|
+ record.setEntrustId(0L);
|
|
|
+ }
|
|
|
+ TrialSelfInspectionRecord oldRecord = null;
|
|
|
+ EntrustInfo oldEntrustInfo = null;
|
|
|
+ TrialSampleInfo oldTrialSampleInfo = null;
|
|
|
+ if (dto.getId() != null) {
|
|
|
+ oldRecord = baseMapper.selectById(dto.getId());
|
|
|
+ if (oldRecord != null) {
|
|
|
+ if (oldRecord.getTaskStatus() != null && !oldRecord.getTaskStatus().equals("未上报") && !oldRecord.getTaskStatus().isEmpty()) {
|
|
|
+ throw new ServiceException("当前试验已上报,请勿修改");
|
|
|
+ }
|
|
|
+ if (oldRecord.getEntrustId() != null) {
|
|
|
+ oldEntrustInfo = entrustInfoMapper.selectById(oldRecord.getEntrustId());
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if (oldRecord.getBaseInfo() != null && !oldRecord.getBaseInfo().isEmpty()) {
|
|
|
+ TrialSeleInspectionRecordBaseInfoDTO baseInfo = JSONObject.parseObject(oldRecord.getBaseInfo(), TrialSeleInspectionRecordBaseInfoDTO.class);
|
|
|
+ if (baseInfo != null) {
|
|
|
+ oldTrialSampleInfo = baseInfo.getTrialSampleInfo();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TrialSeleInspectionRecordBaseInfoDTO baseInfo = new TrialSeleInspectionRecordBaseInfoDTO();
|
|
|
+ BeanUtil.copyProperties(dto, baseInfo);
|
|
|
+ EntrustInfo entrustInfo = null;
|
|
|
+ if (record.getEntrustId() != null && record.getEntrustId() > 0) {
|
|
|
+ entrustInfo = entrustInfoMapper.selectById(record.getEntrustId());
|
|
|
+ }
|
|
|
+ List<TrialSampleInfo> trialSampleInfoList = dto.getTrialSampleInfoList();
|
|
|
+ TrialSampleInfo info = dto.getTrialSampleInfo();
|
|
|
+ if (info == null && !trialSampleInfoList.isEmpty()) {
|
|
|
+ info = trialSampleInfoList.get(0);
|
|
|
+ }
|
|
|
+ if (entrustInfo != null && info != null) {
|
|
|
+ // 判断是否冲突
|
|
|
+ if (entrustInfo.getSampleId() != null && !entrustInfo.getSampleId().equals(info.getId())) {
|
|
|
+ // 判断是否是现场试验节点
|
|
|
+ WbsTreePrivate wbs = wbsTreePrivateClient.getNodeByPrimaryKeyId(entrustInfo.getNodeId());
|
|
|
+ if (wbs == null || wbs.getNodeType() != 51) {
|
|
|
+ throw new ServiceException("关联的委托单与取样材料不匹配,请重新选择");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ((entrustInfo == null && oldEntrustInfo != null) && info != null) {
|
|
|
+ // 判断是否关联,如果关联一起取消
|
|
|
+ if (oldEntrustInfo.getSampleId() != null && oldEntrustInfo.getSampleId().equals(info.getId())) {
|
|
|
+ //删除关联
|
|
|
+ baseMapper.delSelfSample(record.getId());
|
|
|
+ info = null;
|
|
|
+ baseInfo.setTrialSampleInfo(null);
|
|
|
+ entrustInfoService.update(Wrappers.<EntrustInfo>lambdaUpdate().eq(EntrustInfo::getId, record.getId()).set(EntrustInfo::getExpCount, 0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (entrustInfo != null && info == null && oldTrialSampleInfo != null) {
|
|
|
+ if (entrustInfo.getSampleId() != null && entrustInfo.getSampleId().equals(oldTrialSampleInfo.getId())) {
|
|
|
+ record.setEntrustId(null);
|
|
|
+ baseInfo.setEntrustId( null);
|
|
|
+ baseInfo.setEntrustNo(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ boolean a=true;
|
|
|
+ boolean b=true;
|
|
|
+ record.setBaseInfo(JSON.toJSONString(baseInfo));
|
|
|
+ if (oldRecord == null) {
|
|
|
+ if(StringUtils.isNotEmpty(record.getRecordNo())){
|
|
|
+ if(StringUtils.isNotEmpty(record.getRecordNo())){
|
|
|
+ a= trialNumberRuleService.checkTrialNumberIsExist(record.getRecordNo(), 4, record.getContractId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(record.getRecordNo())){
|
|
|
+ if(StringUtils.isNotEmpty(record.getReportNo())){
|
|
|
+ b= trialNumberRuleService.checkTrialNumberIsExist(record.getReportNo(), 5, record.getContractId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!a){
|
|
|
+ throw new ServiceException("记录编号已存在");
|
|
|
+ }
|
|
|
+ if(!b){
|
|
|
+ throw new ServiceException("报告编号已存在");
|
|
|
+ }
|
|
|
+ this.save(record);
|
|
|
+ } else {
|
|
|
+ this.updateById(record);
|
|
|
+ }
|
|
|
+ if (info != null) {
|
|
|
+ TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(info.getId());
|
|
|
+ if (sampleInfo != null) {
|
|
|
+ //------关联取样信息------
|
|
|
+ RecordSampleSubmitDTO sampleSubmitDTO = new RecordSampleSubmitDTO();
|
|
|
+ sampleSubmitDTO.setId(record.getId());
|
|
|
+ sampleSubmitDTO.setSampleIds(info.getId() + "");
|
|
|
+ //删除关联
|
|
|
+ baseMapper.delSelfSample(record.getId());
|
|
|
+ baseMapper.saveSelfSample(SnowFlakeUtil.getId(), record.getId(), info.getId() + "");
|
|
|
+ String samplingLocation = sampleInfo.getSamplingLocation();
|
|
|
+ String calculationUnit = sampleInfo.getCalculationUnit();
|
|
|
+ String specificationNumber = info.getSpecificationNumber();
|
|
|
+ String specificationModel = sampleInfo.getSpecificationModel();
|
|
|
+ //更新
|
|
|
+ if (StringUtils.isNotBlank(samplingLocation) || StringUtils.isNotBlank(calculationUnit) || StringUtils.isNotBlank(specificationNumber) || StringUtils.isNotBlank(specificationModel)) {
|
|
|
+ this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
|
+ .set(StringUtils.isNotBlank(samplingLocation), TrialSelfInspectionRecord::getSamplingLocation, samplingLocation)
|
|
|
+ .set(StringUtils.isNotBlank(calculationUnit),TrialSelfInspectionRecord::getCompany, calculationUnit)
|
|
|
+ .set(StringUtils.isNotBlank(specificationNumber),TrialSelfInspectionRecord::getSpecificationNumber, specificationNumber)
|
|
|
+ .set(StringUtils.isNotBlank(specificationModel),TrialSelfInspectionRecord::getSpecificationModel, specificationModel)
|
|
|
+ .eq(TrialSelfInspectionRecord::getId, record.getId()));
|
|
|
+ }
|
|
|
+ if (entrustInfo == null) {
|
|
|
+ // 根据样品关联的委托单关联委托单
|
|
|
+ entrustInfo = entrustInfoMapper.selectList(Wrappers.<EntrustInfo>lambdaQuery().eq(EntrustInfo::getSampleId, info.getId())).stream().findFirst().orElse(null);
|
|
|
+ if (entrustInfo != null) {
|
|
|
+ this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
|
+ .set(TrialSelfInspectionRecord::getEntrustId, entrustInfo.getId())
|
|
|
+ .eq(TrialSelfInspectionRecord::getId, record.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // ---- 修改样品单号信息 --------
|
|
|
+ if(entrustInfo != null){
|
|
|
+ //修改项目节点基础信息
|
|
|
+ jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='"+entrustInfo.getId()+"'");
|
|
|
+ if (entrustInfo.getSampleId() != null) {
|
|
|
+ TrialSampleInfo sampleInfo = trialSampleInfoMapper.selectById(entrustInfo.getSampleId());
|
|
|
+ if (sampleInfo != null) {
|
|
|
+ //------关联取样信息------
|
|
|
+ RecordSampleSubmitDTO sampleSubmitDTO = new RecordSampleSubmitDTO();
|
|
|
+ sampleSubmitDTO.setId(record.getId());
|
|
|
+ sampleSubmitDTO.setSampleIds(sampleInfo.getId() + "");
|
|
|
+ //删除关联
|
|
|
+ baseMapper.delSelfSample(record.getId());
|
|
|
+ baseMapper.saveSelfSample(SnowFlakeUtil.getId(), record.getId(), sampleInfo.getId() + "");
|
|
|
+ String samplingLocation = sampleInfo.getSamplingLocation();
|
|
|
+ String calculationUnit = sampleInfo.getCalculationUnit();
|
|
|
+ String specificationNumber = sampleInfo.getSpecificationNumber();
|
|
|
+ String specificationModel = sampleInfo.getSpecificationModel();
|
|
|
+ //更新
|
|
|
+ if (StringUtils.isNotBlank(samplingLocation) || StringUtils.isNotBlank(calculationUnit) || StringUtils.isNotBlank(specificationNumber) || StringUtils.isNotBlank(specificationModel)) {
|
|
|
+ this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
|
+ .set(StringUtils.isNotBlank(samplingLocation), TrialSelfInspectionRecord::getSamplingLocation, samplingLocation)
|
|
|
+ .set(StringUtils.isNotBlank(calculationUnit),TrialSelfInspectionRecord::getCompany, calculationUnit)
|
|
|
+ .set(StringUtils.isNotBlank(specificationNumber),TrialSelfInspectionRecord::getSpecificationNumber, specificationNumber)
|
|
|
+ .set(StringUtils.isNotBlank(specificationModel),TrialSelfInspectionRecord::getSpecificationModel, specificationModel)
|
|
|
+ .eq(TrialSelfInspectionRecord::getId, record.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //------关联新增设备使用记录信息------
|
|
|
+ List<TrailDeviceUseInfoDTO> deviceUseInfoDTOS = dto.getTrailDeviceUseInfoDTOS();
|
|
|
+ if (deviceUseInfoDTOS != null && !deviceUseInfoDTOS.isEmpty()) {
|
|
|
+ List<Long> ids = deviceUseInfoDTOS.stream().map(TrailDeviceUseInfoDTO::getDeviceInfoId).collect(Collectors.toList());
|
|
|
+ TrialSelfInspectionRecordDTO recordDTO = new TrialSelfInspectionRecordDTO();
|
|
|
+ recordDTO.setDeviceUseIds(org.apache.commons.lang.StringUtils.join(ids, ","));
|
|
|
+ List<Long> collect = trialSampleInfoList.stream().map(TrialSampleInfo::getId).collect(Collectors.toList());
|
|
|
+ recordDTO.setSampleIds(org.apache.commons.lang.StringUtils.join(collect, ","));
|
|
|
+ recordDTO.setNodeId(dto.getNodeId());
|
|
|
+ recordDTO.setTrialUserName(AuthUtil.getUserName());
|
|
|
+ this.trialDeviceUseService.addDeviceUseInfo(recordDTO, record.getId());
|
|
|
+ }
|
|
|
+ if(dto.getOldRecordNumber()!=null&&dto.getOldRecordNumber().equals(dto.getRecordNo())){
|
|
|
+ if(StringUtils.isNotEmpty(dto.getRecordAutoNumber())){
|
|
|
+ trialNumberRuleService.checkSave(dto.getContractId(),4,record.getId(),dto.getRecordAutoNumber());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(dto.getOldReportNumber()!=null&&dto.getOldReportNumber().equals(dto.getReportNo())){
|
|
|
+ if(StringUtils.isNotEmpty(dto.getReportAutoNumber())){
|
|
|
+ trialNumberRuleService.checkSave(dto.getContractId(),5,record.getId(),dto.getReportAutoNumber());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return record.getId();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|