|
@@ -3,7 +3,6 @@ package org.springblade.business.service.impl;
|
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
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;
|
|
@@ -55,6 +54,7 @@ import java.io.File;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.util.*;
|
|
|
import java.util.List;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -101,16 +101,18 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(true, TrialSelfInspectionRecord::getCreateTime));
|
|
|
IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
|
List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
|
|
|
- List<Dict> trialDetectionCategory = iDictClient.getList("trial_detection_category").getData();
|
|
|
+ Map<String, Dict> map = iDictClient.getList("trial_detection_category").getData().stream().collect(Collectors.toMap(Dict::getDictKey, Function.identity()));
|
|
|
|
|
|
for (TrialSelfInspectionRecordVO record : records) {
|
|
|
- for (Dict dict : trialDetectionCategory) {
|
|
|
- if (dict.getDictKey().equals(String.valueOf(record.getDetectionCategory()))) {
|
|
|
+ record.setIsUploadCertificateName((new Integer(1)).equals(record.getIsUploadCertificate()) ? "是" : "否");
|
|
|
+ record.setDetectionResultName((new Integer(1)).equals(record.getDetectionResult()) ? "合格" : "不合格");
|
|
|
+
|
|
|
+ if (ObjectUtils.isNotEmpty(record.getDetectionCategory())) {
|
|
|
+ Dict dict = map.get(String.valueOf(record.getDetectionCategory()));
|
|
|
+ if (dict != null) {
|
|
|
record.setDetectionCategoryName(dict.getDictValue());
|
|
|
}
|
|
|
}
|
|
|
- record.setIsUploadCertificateName(record.getIsUploadCertificate().equals(1) ? "是" : "否");
|
|
|
- record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
|
|
|
|
//工程部位及用途名称
|
|
|
if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
|
|
@@ -131,6 +133,18 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
if (query.size() > 0) {
|
|
|
record.setSampleIds(org.apache.commons.lang.StringUtils.join(query, ","));
|
|
|
}
|
|
|
+
|
|
|
+ String sql1 = "select raw_material_record_id,old_pdf_url from u_trial_raw_material_self_record where self_record_id = " + record.getId();
|
|
|
+ List<TrialRawMaterialSelfRecord> query1 = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class));
|
|
|
+ if (query1.size() > 0) {
|
|
|
+ //原材料检测报告ids
|
|
|
+ List<Long> ids = query1.stream().map(TrialRawMaterialSelfRecord::getRawMaterialRecordId).collect(Collectors.toList());
|
|
|
+ record.setRawMaterialIds(org.apache.commons.lang.StringUtils.join(ids, ","));
|
|
|
+
|
|
|
+ //pdfUrl
|
|
|
+ record.setPdfUrl(Objects.requireNonNull(query1.stream().findAny().orElse(null)).getOldPdfUrl());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
|
}
|
|
@@ -166,13 +180,13 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
List<Attach> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Attach.class));
|
|
|
for (SampleAncillaryDocumentsVO sampleAncillaryDocumentsVO : result) {
|
|
|
for (Attach attach : query) {
|
|
|
- if (sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
|
|
|
+ if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getOtherAccessories()) && sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
|
|
|
sampleAncillaryDocumentsVO.setOtherAccessoriesName(attach.getOriginalName());
|
|
|
}
|
|
|
- if (sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
|
|
|
+ if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getProductionCertificate()) && sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
|
|
|
sampleAncillaryDocumentsVO.setProductionCertificateName(attach.getOriginalName());
|
|
|
}
|
|
|
- if (sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
|
|
|
+ if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getQualityInspectionReport()) && sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
|
|
|
sampleAncillaryDocumentsVO.setQualityInspectionReportName(attach.getOriginalName());
|
|
|
}
|
|
|
}
|
|
@@ -229,12 +243,16 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
List<TrialSelfInspectionRecordVO2> recordVO2s;
|
|
|
//编辑
|
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
|
- //获取nodeId节点下的记录信息(排除当前id记录)
|
|
|
+ //获取nodeId节点下的合格的记录信息(排除当前id记录)
|
|
|
List<TrialSelfInspectionRecord> result = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
|
+ .eq(TrialSelfInspectionRecord::getDetectionResult, 1)
|
|
|
+ .eq(TrialSelfInspectionRecord::getStatus, 1)
|
|
|
.eq(TrialSelfInspectionRecord::getNodeId, nodeId)
|
|
|
.eq(TrialSelfInspectionRecord::getContractId, contractId)
|
|
|
.ne(TrialSelfInspectionRecord::getId, id)
|
|
|
- .eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
+ .isNotNull(TrialSelfInspectionRecord::getReportNo)
|
|
|
+ .orderByDesc(TrialSelfInspectionRecord::getCreateTime)
|
|
|
+ );
|
|
|
|
|
|
recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
|
|
|
|
|
@@ -256,9 +274,12 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
} else {
|
|
|
//新增
|
|
|
List<TrialSelfInspectionRecord> result = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
|
+ .eq(TrialSelfInspectionRecord::getDetectionResult, 1)
|
|
|
+ .eq(TrialSelfInspectionRecord::getStatus, 1)
|
|
|
.eq(TrialSelfInspectionRecord::getNodeId, nodeId)
|
|
|
.eq(TrialSelfInspectionRecord::getContractId, contractId)
|
|
|
- .eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
+ .isNotNull(TrialSelfInspectionRecord::getReportNo)
|
|
|
+ .orderByDesc(TrialSelfInspectionRecord::getCreateTime));
|
|
|
|
|
|
recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
|
|
|
}
|
|
@@ -285,110 +306,66 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
@Override
|
|
|
@Async
|
|
|
- public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto) throws FileNotFoundException {
|
|
|
+ public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto, TrialSelfInspectionRecord obj) throws FileNotFoundException {
|
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
|
throw new ServiceException("请先保存填报数据后,再关联原材检测报告信息");
|
|
|
} else {
|
|
|
- TrialSelfInspectionRecord objMain = this.getBaseMapper().selectById(dto.getId());
|
|
|
- if (ObjectUtil.isNotEmpty(objMain) && (("已审批").equals(objMain.getTaskStatus()) || ("待审批").equals(objMain.getTaskStatus()))) {
|
|
|
+ if (ObjectUtil.isNotEmpty(obj) && (("已审批").equals(obj.getTaskStatus()) || ("待审批").equals(obj.getTaskStatus()))) {
|
|
|
throw new ServiceException("当前填报数据已上报,无法进行关联操作");
|
|
|
}
|
|
|
- if (StringUtils.isNotEmpty(dto.getIds())) { //新增关系,合并pdf
|
|
|
- List<String> idsList = Func.toStrList(dto.getIds());
|
|
|
- //获取ids、id下的pdfUrl
|
|
|
- List<String> ids = new ArrayList<>();
|
|
|
- ids.add(dto.getId());
|
|
|
- ids.addAll(idsList);
|
|
|
- List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, ids).eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
- TrialSelfInspectionRecord oldObj = recordList.stream().filter(f -> f.getId().equals(Long.parseLong(dto.getId()))).findAny().orElse(null);
|
|
|
- List<TrialSelfInspectionRecord> oldOther = recordList.stream().filter(f -> !f.getId().equals(Long.parseLong(dto.getId()))).collect(Collectors.toList());
|
|
|
-
|
|
|
- //获取原始pdfUrl
|
|
|
- String sql = "select * from u_trial_raw_material_self_record where self_record_id =" + dto.getId();
|
|
|
- TrialRawMaterialSelfRecord recordOld = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
|
|
|
- if (recordOld != null && oldObj != null) {
|
|
|
- oldObj.setPdfUrl(recordOld.getOldPdfUrl());
|
|
|
- }
|
|
|
|
|
|
- //当前记录pdfUrl置顶
|
|
|
- List<TrialSelfInspectionRecord> recordList2 = new ArrayList<>();
|
|
|
- recordList2.add(oldObj);
|
|
|
- recordList2.addAll(oldOther);
|
|
|
- List<String> listPdfUrl = recordList2.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
|
+ //新增或编辑
|
|
|
+ if (StringUtils.isNotEmpty(dto.getIds())) {
|
|
|
+ //当前关联的原材料记录id
|
|
|
+ List<String> idsNew = new ArrayList<>(Func.toStrList(dto.getIds()));
|
|
|
+ //当前记录id
|
|
|
+ idsNew.add(dto.getId());
|
|
|
+ //获取原材料的pdfUrl
|
|
|
+ List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
|
+ .select(TrialSelfInspectionRecord::getPdfUrl, TrialSelfInspectionRecord::getId)
|
|
|
+ .in(TrialSelfInspectionRecord::getId, idsNew).eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
+
|
|
|
+ //当前记录的pdf
|
|
|
+ TrialSelfInspectionRecord nowObj = recordList.stream().filter(f -> f.getId().equals(Long.parseLong(dto.getId()))).findAny().orElse(null);
|
|
|
+
|
|
|
+ //关联的原材料pdf
|
|
|
+ List<TrialSelfInspectionRecord> recordObjList = recordList.stream().filter(f -> !f.getId().equals(Long.parseLong(dto.getId()))).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //合并pdf,切当前记录pdfUrl置顶,关联原材料pdfUrl文件置尾
|
|
|
+ List<String> pdfUrlAll = new ArrayList<>();
|
|
|
+ if (StringUtils.isNotEmpty(Objects.requireNonNull(nowObj).getPdfUrl()) && recordObjList.size() > 0) {
|
|
|
+ pdfUrlAll.add(nowObj.getPdfUrl());
|
|
|
+ pdfUrlAll.addAll(recordObjList.stream().filter(f -> StringUtils.isNotEmpty(f.getPdfUrl())).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
|
|
|
- if (listPdfUrl.size() > 0) {
|
|
|
- //合并PDF
|
|
|
+ if (pdfUrlAll.size() > 0) {
|
|
|
String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
String listPdf = filePath + "/pdf/" + dto.getNodeId() + ".pdf";
|
|
|
File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
if (tabPDF.exists()) {
|
|
|
tabPDF.delete();
|
|
|
}
|
|
|
- FileUtils.mergePdfPublicMethods(listPdfUrl, listPdf);
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfUrlAll, listPdf);
|
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(dto.getNodeId() + ".pdf", listPdf);
|
|
|
|
|
|
- //获取试验记录id的试验项目名称
|
|
|
- List<String> collect = recordList.stream().map(TrialSelfInspectionRecord::getTrialProjectName).collect(Collectors.toList());
|
|
|
- String name = collect.stream().findAny().orElse(null);
|
|
|
- String trialProjectName;
|
|
|
- if (collect.size() > 1) {
|
|
|
- trialProjectName = name + "等" + collect.size() + "个文件";
|
|
|
- } else {
|
|
|
- trialProjectName = name;
|
|
|
- }
|
|
|
-
|
|
|
- //删除当前记录关系信息
|
|
|
+ //删除记录关系
|
|
|
String sql1 = "delete from u_trial_raw_material_self_record where self_record_id ='" + dto.getId() + "'";
|
|
|
jdbcTemplate.execute(sql1);
|
|
|
- //新增当前记录关系信息
|
|
|
- for (String s : idsList) {
|
|
|
- if (oldObj != null) {
|
|
|
- String sql2 = "insert into u_trial_raw_material_self_record(id,self_record_id,raw_material_record_id,old_pdf_url) values(" + SnowFlakeUtil.getId() + "," + dto.getId() + "," + s + ",'" + oldObj.getPdfUrl() + "')";
|
|
|
+ //新增记录关系
|
|
|
+ for (String recordId : idsNew) {
|
|
|
+ if (!recordId.equals(dto.getId())) {
|
|
|
+ String sql2 = "insert into u_trial_raw_material_self_record(id,self_record_id,raw_material_record_id,old_pdf_url) values(" + SnowFlakeUtil.getId() + "," + dto.getId() + "," + recordId + ",'" + bladeFile.getLink() + "')";
|
|
|
jdbcTemplate.execute(sql2);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (ObjectUtil.isNotEmpty(bladeFile)) {
|
|
|
- //修改pdfURL
|
|
|
- String querySql = "select * from u_information_query where classify='" + dto.getType() + "' and wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "'";
|
|
|
- List<Map<String, Object>> resultSQL = jdbcTemplate.queryForList(querySql);
|
|
|
- if (resultSQL.size() > 0) {
|
|
|
- String sql3 = "update u_information_query set pdf_url ='" + bladeFile.getLink() + "', name = '" + trialProjectName + "' where classify= '" + dto.getType() + "' and wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "'";
|
|
|
- jdbcTemplate.execute(sql3);
|
|
|
- } else {
|
|
|
- informationQueryClient.saveData(dto.getId(), dto.getProjectId(), dto.getContractId(), String.valueOf(dto.getType()), bladeFile.getLink(), trialProjectName);
|
|
|
- }
|
|
|
-
|
|
|
- //修改当前记录pdfUrl
|
|
|
- this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getPdfUrl, bladeFile.getLink()).eq(TrialSelfInspectionRecord::getId, dto.getId()));
|
|
|
-
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- //删除关系
|
|
|
- jdbcTemplate.execute(sql1);
|
|
|
- return false;
|
|
|
- }
|
|
|
+ return true;
|
|
|
}
|
|
|
- } else {
|
|
|
- //删除关系,恢复当前记录的原始pdfUrl
|
|
|
- TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
|
|
|
- String sql = "select * from u_trial_raw_material_self_record where self_record_id =" + dto.getId();
|
|
|
- TrialRawMaterialSelfRecord record = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
|
|
|
- if (record != null) {
|
|
|
- //修改pdfURL
|
|
|
- String querySql = "select * from u_information_query where classify='" + dto.getType() + "' and wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "'";
|
|
|
- List<Map<String, Object>> resultSQL = jdbcTemplate.queryForList(querySql);
|
|
|
- if (resultSQL.size() > 0) {
|
|
|
- String sql3 = "update u_information_query set pdf_url ='" + record.getOldPdfUrl() + "', name = '" + obj.getTrialProjectName() + "' where classify= '" + dto.getType() + "' and wbs_id='" + dto.getId() + "' and contract_id ='" + dto.getContractId() + "'";
|
|
|
- jdbcTemplate.execute(sql3);
|
|
|
- } else {
|
|
|
- informationQueryClient.saveData(dto.getId(), dto.getProjectId(), dto.getContractId(), String.valueOf(dto.getType()), record.getOldPdfUrl(), obj.getTrialProjectName());
|
|
|
- }
|
|
|
-
|
|
|
- //修改当前记录pdfUrl
|
|
|
- this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getPdfUrl, record.getOldPdfUrl()).eq(TrialSelfInspectionRecord::getId, dto.getId()));
|
|
|
|
|
|
- //删除当前记录关系信息
|
|
|
+ } else {
|
|
|
+ //删除全部
|
|
|
+ String sql = "select id from u_trial_raw_material_self_record where self_record_id =" + dto.getId();
|
|
|
+ List<TrialRawMaterialSelfRecord> recordList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class));
|
|
|
+ if (recordList.size() > 0) {
|
|
|
String sql1 = "delete from u_trial_raw_material_self_record where self_record_id ='" + dto.getId() + "'";
|
|
|
jdbcTemplate.execute(sql1);
|
|
|
}
|
|
@@ -645,16 +622,15 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
List<String> sampleIds = baseMapper.selectSelfSampleRecord(id);
|
|
|
if (sampleIds.size() > 0) {
|
|
|
List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectBatchIds(sampleIds);
|
|
|
- List<User> users = iUserClient.selectUserAll();
|
|
|
+ Map<Long, User> map = iUserClient.selectUserAll().stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
|
|
if (trialSampleInfos.size() > 0) {
|
|
|
for (TrialSampleInfo trialSampleInfo : trialSampleInfos) {
|
|
|
- for (User user : users) {
|
|
|
- if (trialSampleInfo.getUserId().equals(user.getId())) {
|
|
|
- TrialSampleInfoVO trialSampleInfoVO = BeanUtil.copyProperties(trialSampleInfo, TrialSampleInfoVO.class);
|
|
|
- if (trialSampleInfoVO != null) {
|
|
|
- trialSampleInfoVO.setUserName(ObjectUtil.isNotEmpty(user.getName()) ? user.getName() : user.getRealName());
|
|
|
- result.add(trialSampleInfoVO);
|
|
|
- }
|
|
|
+ User user = map.get(trialSampleInfo.getUserId());
|
|
|
+ if (user != null) {
|
|
|
+ TrialSampleInfoVO trialSampleInfoVO = BeanUtil.copyProperties(trialSampleInfo, TrialSampleInfoVO.class);
|
|
|
+ if (trialSampleInfoVO != null) {
|
|
|
+ trialSampleInfoVO.setUserName(ObjectUtil.isNotEmpty(user.getName()) ? user.getName() : user.getRealName());
|
|
|
+ result.add(trialSampleInfoVO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -698,7 +674,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
this.saveOrUpdate(dto);
|
|
|
}
|
|
|
|
|
|
- //TODO ------保存实体表数据、试验记录信息、生成pdf------
|
|
|
+ //------保存实体表数据、试验记录信息、生成pdf------
|
|
|
try {
|
|
|
String pdfURL = excelTabClient.saveTabData(dto.getIsBatchSave(), dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId(), obj.getTableIds());
|
|
|
if (StringUtils.isNotEmpty(pdfURL)) {
|
|
@@ -709,7 +685,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
throw new ServiceException("保存实体表数据生成pdf时发生异常" + e.getMessage());
|
|
|
}
|
|
|
|
|
|
- //TODO ------关联工程及用途关系新增或删除------
|
|
|
+ //------关联工程及用途关系新增或删除------
|
|
|
if (StringUtils.isEmpty(obj.getProjectPosition())) {
|
|
|
String delSql = "delete from u_trial_self_quality_project where self_id = " + obj.getId();
|
|
|
jdbcTemplate.execute(delSql);
|
|
@@ -725,7 +701,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //TODO ------关联原材料检测报告------
|
|
|
+ //------关联原材料检测报告------
|
|
|
RawMaterialSubmitRelationDTO relationDTO = new RawMaterialSubmitRelationDTO();
|
|
|
relationDTO.setId(obj.getId().toString());
|
|
|
relationDTO.setIds(dto.getRawMaterialIds());
|
|
@@ -733,19 +709,15 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
relationDTO.setContractId(dto.getContractId().toString());
|
|
|
relationDTO.setProjectId(dto.getProjectId());
|
|
|
relationDTO.setType(dto.getType());
|
|
|
- if (StringUtils.isNotEmpty(relationDTO.getIds())) {
|
|
|
- this.rawMaterialSubmitRelation(relationDTO);
|
|
|
- }
|
|
|
+ this.rawMaterialSubmitRelation(relationDTO, obj);
|
|
|
|
|
|
- //TODO ------关联取样信息------
|
|
|
+ //------关联取样信息------
|
|
|
RecordSampleSubmitDTO recordSampleSubmitDTO = new RecordSampleSubmitDTO();
|
|
|
recordSampleSubmitDTO.setId(obj.getId());
|
|
|
recordSampleSubmitDTO.setSampleIds(dto.getSampleIds());
|
|
|
- if (StringUtils.isNotEmpty(relationDTO.getIds())) {
|
|
|
- this.recordSampleSubmit(recordSampleSubmitDTO);
|
|
|
- }
|
|
|
+ this.recordSampleSubmit(recordSampleSubmitDTO);
|
|
|
|
|
|
- //TODO ------新增设备使用记录信息------
|
|
|
+ //------新增设备使用记录信息------
|
|
|
this.trialDeviceUseService.addDeviceUseInfo(dto);
|
|
|
}
|
|
|
|
|
@@ -759,12 +731,12 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
|
throw new ServiceException("请先保存填报数据后,再关联取样信息");
|
|
|
}
|
|
|
- //删除关联信息
|
|
|
+ //删除关联
|
|
|
baseMapper.delSelfSample(dto.getId());
|
|
|
if (StringUtils.isNotEmpty(dto.getSampleIds())) {
|
|
|
List<String> ids = Func.toStrList(dto.getSampleIds());
|
|
|
for (String id : ids) {
|
|
|
- //新增关联信息
|
|
|
+ //新增关联
|
|
|
baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
|
|
|
}
|
|
|
|
|
@@ -1041,21 +1013,17 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
public IPage<TrialSelfInspectionRecordVO> trialDataPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
|
|
|
QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
|
|
|
-
|
|
|
if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getStartTime()) && org.apache.commons.lang.StringUtils.isNotEmpty(dto.getEndTime())) {
|
|
|
String endTime = dto.getEndTime();
|
|
|
endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
|
|
|
queryWrapper.lambda().between(TrialSelfInspectionRecord::getReportDate, dto.getStartTime(), endTime);
|
|
|
}
|
|
|
-
|
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getTaskStatus, "已审批");
|
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, 1); //合格
|
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionCategory, 1); //自检
|
|
|
-
|
|
|
- IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderBy(true, true, TrialSelfInspectionRecord::getCreateTime));
|
|
|
+ IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(TrialSelfInspectionRecord::getCreateTime));
|
|
|
IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
|
List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
|
|
|
-
|
|
|
//查询是否关联过
|
|
|
if (ObjectUtil.isNotEmpty(dto.getQualityTestPKeyId())) {
|
|
|
List<String> selectedIds = baseMapper.selectSelectedStatusList(Long.parseLong(dto.getQualityTestPKeyId()), "1");
|
|
@@ -1066,7 +1034,6 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
record.setIsSelectedStatus(1);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
|
//工程部位及用途名称
|
|
|
if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
|
|
@@ -1081,7 +1048,6 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
for (TrialSelfInspectionRecordVO record : records) {
|
|
|
record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
@@ -1099,7 +1065,6 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
|
}
|
|
|
|
|
@@ -1124,7 +1089,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
List<String> pdfList = new ArrayList<>();
|
|
|
|
|
|
- //TODO ------自检------
|
|
|
+ //------自检------
|
|
|
if (dto.getType().equals(1)) {
|
|
|
//当前施工pdf
|
|
|
pdfList.add(informationQuery.getPdfUrl());
|
|
@@ -1136,7 +1101,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
List<String> pdfURLs = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
|
pdfList.addAll(pdfURLs);
|
|
|
|
|
|
- //TODO ------第三方、外委------
|
|
|
+ //------第三方、外委------
|
|
|
} else if (dto.getType().equals(2) || dto.getType().equals(3)) {
|
|
|
|
|
|
if (informationQuery.getPdfTrialUrl() != null) {
|