|
@@ -3,7 +3,6 @@ package org.springblade.business.service.impl;
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
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.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
@@ -13,7 +12,6 @@ import lombok.AllArgsConstructor;
|
|
import org.apache.commons.lang.time.DateUtils;
|
|
import org.apache.commons.lang.time.DateUtils;
|
|
import org.springblade.business.dto.*;
|
|
import org.springblade.business.dto.*;
|
|
import org.springblade.business.entity.*;
|
|
import org.springblade.business.entity.*;
|
|
-import org.springblade.business.feign.InformationQueryClient;
|
|
|
|
import org.springblade.business.mapper.TrialMaterialMobilizationMapper;
|
|
import org.springblade.business.mapper.TrialMaterialMobilizationMapper;
|
|
import org.springblade.business.mapper.TrialSampleInfoMapper;
|
|
import org.springblade.business.mapper.TrialSampleInfoMapper;
|
|
import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
|
|
import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
|
|
@@ -55,6 +53,7 @@ import java.io.File;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.FileNotFoundException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -68,12 +67,10 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
private final IUserClient iUserClient;
|
|
private final IUserClient iUserClient;
|
|
private final ContractClient contractClient;
|
|
private final ContractClient contractClient;
|
|
private final WbsTreePrivateClient wbsTreePrivateClient;
|
|
private final WbsTreePrivateClient wbsTreePrivateClient;
|
|
- private final WbsTreeContractClient wbsTreeContractClient;
|
|
|
|
private final ExcelTabClient excelTabClient;
|
|
private final ExcelTabClient excelTabClient;
|
|
private final IDictClient iDictClient;
|
|
private final IDictClient iDictClient;
|
|
private final JdbcTemplate jdbcTemplate;
|
|
private final JdbcTemplate jdbcTemplate;
|
|
private final NewIOSSClient newIOSSClient;
|
|
private final NewIOSSClient newIOSSClient;
|
|
- private final InformationQueryClient informationQueryClient;
|
|
|
|
private final IOSSClient iossClient;
|
|
private final IOSSClient iossClient;
|
|
private final CommonFileClient commonFileClient;
|
|
private final CommonFileClient commonFileClient;
|
|
private final TableFileClient tableFileClient;
|
|
private final TableFileClient tableFileClient;
|
|
@@ -82,7 +79,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
private final TrialDetectionDataServiceImpl trialDetectionDataService;
|
|
private final TrialDetectionDataServiceImpl trialDetectionDataService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
|
|
|
|
|
|
+ public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) throws FileNotFoundException {
|
|
QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
|
|
QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
|
|
if (StringUtils.isNotEmpty(dto.getQueryValue())) {
|
|
if (StringUtils.isNotEmpty(dto.getQueryValue())) {
|
|
queryWrapper.lambda().like(TrialSelfInspectionRecord::getTrialProjectName, dto.getQueryValue());
|
|
queryWrapper.lambda().like(TrialSelfInspectionRecord::getTrialProjectName, dto.getQueryValue());
|
|
@@ -101,16 +98,18 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(true, TrialSelfInspectionRecord::getCreateTime));
|
|
IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(true, TrialSelfInspectionRecord::getCreateTime));
|
|
IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
|
|
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 (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.setDetectionCategoryName(dict.getDictValue());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- record.setIsUploadCertificateName(record.getIsUploadCertificate().equals(1) ? "是" : "否");
|
|
|
|
- record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
|
|
|
|
|
|
//工程部位及用途名称
|
|
//工程部位及用途名称
|
|
if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
|
|
if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
|
|
@@ -131,10 +130,66 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
if (query.size() > 0) {
|
|
if (query.size() > 0) {
|
|
record.setSampleIds(org.apache.commons.lang.StringUtils.join(query, ","));
|
|
record.setSampleIds(org.apache.commons.lang.StringUtils.join(query, ","));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //原材料检测报告ids
|
|
|
|
+ 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) {
|
|
|
|
+ List<Long> ids = query1.stream().map(TrialRawMaterialSelfRecord::getRawMaterialRecordId).collect(Collectors.toList());
|
|
|
|
+ record.setRawMaterialIds(org.apache.commons.lang.StringUtils.join(ids, ","));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //合并的pdfUrl
|
|
|
|
+ String pdf = this.getMergePdfToTrial(record.getContractId(), record.getId());
|
|
|
|
+ record.setPdfUrl(pdf);
|
|
}
|
|
}
|
|
return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private String getMergePdfToTrial(Long contractId, Long nodeId) throws FileNotFoundException {
|
|
|
|
+ String sql = "select pdf_url,e_visa_pdf_url from u_information_query where wbs_id='" + nodeId + "' and contract_id ='" + contractId + "'";
|
|
|
|
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
|
+ if (maps.size() >= 1) {
|
|
|
|
+ Map<String, Object> stringObjectMap = maps.get(0);
|
|
|
|
+ Object pdfUrl = stringObjectMap.get("pdf_url");
|
|
|
|
+
|
|
|
|
+ if (stringObjectMap.get("e_visa_pdf_url") != null) {
|
|
|
|
+ //优先使用电签的pdf
|
|
|
|
+ pdfUrl = stringObjectMap.get("e_visa_pdf_url");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //关联原材料检测报告的pdf(合并后的dpf都一样,取其一)
|
|
|
|
+ String sqlRecord = "select old_pdf_url from u_trial_raw_material_self_record where self_record_id =" + nodeId;
|
|
|
|
+ TrialRawMaterialSelfRecord recordObj = jdbcTemplate.query(sqlRecord, new BeanPropertyRowMapper<>(TrialRawMaterialSelfRecord.class)).stream().findAny().orElse(null);
|
|
|
|
+ if (pdfUrl != null && recordObj != null && recordObj.getOldPdfUrl() != null) {
|
|
|
|
+ String pdfUrlTrialRawMaterial = recordObj.getOldPdfUrl();
|
|
|
|
+ List<String> pdfList = new ArrayList<>();
|
|
|
|
+ //试验原始pdf
|
|
|
|
+ pdfList.add(pdfUrl.toString());
|
|
|
|
+ //材料检测报告pdf
|
|
|
|
+ pdfList.add(pdfUrlTrialRawMaterial);
|
|
|
|
+ //合并
|
|
|
|
+ String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
+ Long id = SnowFlakeUtil.getId();
|
|
|
|
+ String trialPdf = file_path + "/pdf/" + id + ".pdf";
|
|
|
|
+ File trialPdf2 = ResourceUtil.getFile(trialPdf);
|
|
|
|
+ if (trialPdf2.exists()) {
|
|
|
|
+ trialPdf2.delete();
|
|
|
|
+ }
|
|
|
|
+ //合并当前所有选择的试验pdf
|
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfList, trialPdf);
|
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", trialPdf);
|
|
|
|
+ if (bladeFile != null && ObjectUtils.isNotEmpty(bladeFile.getLink())) {
|
|
|
|
+ pdfUrl = bladeFile.getLink();
|
|
|
|
+ return pdfUrl.toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ assert pdfUrl != null;
|
|
|
|
+ return pdfUrl.toString();
|
|
|
|
+ }
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<SampleAncillaryDocumentsVO> selfAncillaryDocumentsList(String id) {
|
|
public List<SampleAncillaryDocumentsVO> selfAncillaryDocumentsList(String id) {
|
|
//获取材料附件信息
|
|
//获取材料附件信息
|
|
@@ -166,13 +221,13 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
List<Attach> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Attach.class));
|
|
List<Attach> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Attach.class));
|
|
for (SampleAncillaryDocumentsVO sampleAncillaryDocumentsVO : result) {
|
|
for (SampleAncillaryDocumentsVO sampleAncillaryDocumentsVO : result) {
|
|
for (Attach attach : query) {
|
|
for (Attach attach : query) {
|
|
- if (sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getOtherAccessories()) && sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
|
|
sampleAncillaryDocumentsVO.setOtherAccessoriesName(attach.getOriginalName());
|
|
sampleAncillaryDocumentsVO.setOtherAccessoriesName(attach.getOriginalName());
|
|
}
|
|
}
|
|
- if (sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getProductionCertificate()) && sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
|
|
sampleAncillaryDocumentsVO.setProductionCertificateName(attach.getOriginalName());
|
|
sampleAncillaryDocumentsVO.setProductionCertificateName(attach.getOriginalName());
|
|
}
|
|
}
|
|
- if (sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getQualityInspectionReport()) && sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
|
|
sampleAncillaryDocumentsVO.setQualityInspectionReportName(attach.getOriginalName());
|
|
sampleAncillaryDocumentsVO.setQualityInspectionReportName(attach.getOriginalName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -229,12 +284,16 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
List<TrialSelfInspectionRecordVO2> recordVO2s;
|
|
List<TrialSelfInspectionRecordVO2> recordVO2s;
|
|
//编辑
|
|
//编辑
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
if (StringUtils.isNotEmpty(id)) {
|
|
- //获取nodeId节点下的记录信息(排除当前id记录)
|
|
|
|
|
|
+ //获取nodeId节点下的合格的记录信息(排除当前id记录)
|
|
List<TrialSelfInspectionRecord> result = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
List<TrialSelfInspectionRecord> result = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
|
|
+ .eq(TrialSelfInspectionRecord::getDetectionResult, 1)
|
|
|
|
+ .eq(TrialSelfInspectionRecord::getStatus, 1)
|
|
.eq(TrialSelfInspectionRecord::getNodeId, nodeId)
|
|
.eq(TrialSelfInspectionRecord::getNodeId, nodeId)
|
|
.eq(TrialSelfInspectionRecord::getContractId, contractId)
|
|
.eq(TrialSelfInspectionRecord::getContractId, contractId)
|
|
.ne(TrialSelfInspectionRecord::getId, id)
|
|
.ne(TrialSelfInspectionRecord::getId, id)
|
|
- .eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
|
|
|
+ .isNotNull(TrialSelfInspectionRecord::getReportNo)
|
|
|
|
+ .orderByDesc(TrialSelfInspectionRecord::getCreateTime)
|
|
|
|
+ );
|
|
|
|
|
|
recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
|
|
recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
|
|
|
|
|
|
@@ -256,9 +315,12 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
} else {
|
|
} else {
|
|
//新增
|
|
//新增
|
|
List<TrialSelfInspectionRecord> result = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
List<TrialSelfInspectionRecord> result = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
|
|
+ .eq(TrialSelfInspectionRecord::getDetectionResult, 1)
|
|
|
|
+ .eq(TrialSelfInspectionRecord::getStatus, 1)
|
|
.eq(TrialSelfInspectionRecord::getNodeId, nodeId)
|
|
.eq(TrialSelfInspectionRecord::getNodeId, nodeId)
|
|
.eq(TrialSelfInspectionRecord::getContractId, contractId)
|
|
.eq(TrialSelfInspectionRecord::getContractId, contractId)
|
|
- .eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
|
|
|
+ .isNotNull(TrialSelfInspectionRecord::getReportNo)
|
|
|
|
+ .orderByDesc(TrialSelfInspectionRecord::getCreateTime));
|
|
|
|
|
|
recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
|
|
recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
|
|
}
|
|
}
|
|
@@ -285,110 +347,58 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Async
|
|
@Async
|
|
- public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto) throws FileNotFoundException {
|
|
|
|
|
|
+ public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto, TrialSelfInspectionRecord obj) throws
|
|
|
|
+ FileNotFoundException {
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
throw new ServiceException("请先保存填报数据后,再关联原材检测报告信息");
|
|
throw new ServiceException("请先保存填报数据后,再关联原材检测报告信息");
|
|
} else {
|
|
} 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("当前填报数据已上报,无法进行关联操作");
|
|
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> ids = Func.toStrList(dto.getIds());
|
|
|
|
+
|
|
|
|
+ //获取原材料的pdf
|
|
|
|
+ List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
|
|
+ .select(TrialSelfInspectionRecord::getPdfUrl, TrialSelfInspectionRecord::getId)
|
|
|
|
+ .in(TrialSelfInspectionRecord::getId, ids).eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
|
+ List<TrialSelfInspectionRecord> recordObjList = recordList.stream().filter(f -> !f.getId().equals(Long.parseLong(dto.getId()))).collect(Collectors.toList());
|
|
|
|
+ List<String> pdfUrlAll = new ArrayList<>();
|
|
|
|
+ if (recordObjList.size() > 0) {
|
|
|
|
+ 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 filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String listPdf = filePath + "/pdf/" + dto.getNodeId() + ".pdf";
|
|
String listPdf = filePath + "/pdf/" + dto.getNodeId() + ".pdf";
|
|
File tabPDF = ResourceUtil.getFile(listPdf);
|
|
File tabPDF = ResourceUtil.getFile(listPdf);
|
|
if (tabPDF.exists()) {
|
|
if (tabPDF.exists()) {
|
|
tabPDF.delete();
|
|
tabPDF.delete();
|
|
}
|
|
}
|
|
- FileUtils.mergePdfPublicMethods(listPdfUrl, listPdf);
|
|
|
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfUrlAll, listPdf);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(dto.getNodeId() + ".pdf", 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() + "'";
|
|
String sql1 = "delete from u_trial_raw_material_self_record where self_record_id ='" + dto.getId() + "'";
|
|
jdbcTemplate.execute(sql1);
|
|
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 : ids) {
|
|
|
|
+ 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);
|
|
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() + "'";
|
|
String sql1 = "delete from u_trial_raw_material_self_record where self_record_id ='" + dto.getId() + "'";
|
|
jdbcTemplate.execute(sql1);
|
|
jdbcTemplate.execute(sql1);
|
|
}
|
|
}
|
|
@@ -459,7 +469,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Async
|
|
@Async
|
|
- public void updateTrialSelfInspectionRecordStatus(List<TaskApprovalVO> obj) throws FileNotFoundException {
|
|
|
|
|
|
+ public void updateTrialSelfInspectionRecordStatus(String pdfUrlEVisa, List<TaskApprovalVO> obj) throws FileNotFoundException {
|
|
for (TaskApprovalVO taskApprovalVO : obj) {
|
|
for (TaskApprovalVO taskApprovalVO : obj) {
|
|
if (ObjectUtil.isNotEmpty(taskApprovalVO.getParallelProcessInstanceId())) {
|
|
if (ObjectUtil.isNotEmpty(taskApprovalVO.getParallelProcessInstanceId())) {
|
|
String sql = "select process_instance_id from u_task_parallel where parallel_process_instance_id = '" + taskApprovalVO.getParallelProcessInstanceId() + "'";
|
|
String sql = "select process_instance_id from u_task_parallel where parallel_process_instance_id = '" + taskApprovalVO.getParallelProcessInstanceId() + "'";
|
|
@@ -469,44 +479,39 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
if (StringUtils.isNotEmpty(trialSelfInspectionRecordId)) {
|
|
if (StringUtils.isNotEmpty(trialSelfInspectionRecordId)) {
|
|
this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
.set(TrialSelfInspectionRecord::getTaskStatus, "OK".equals(taskApprovalVO.getFlag()) ? "已审批" : "已废除")
|
|
.set(TrialSelfInspectionRecord::getTaskStatus, "OK".equals(taskApprovalVO.getFlag()) ? "已审批" : "已废除")
|
|
|
|
+ .set(TrialSelfInspectionRecord::getPdfUrl, pdfUrlEVisa) //pdfUrlEVisa=电签后的pdf
|
|
.eq(TrialSelfInspectionRecord::getId, trialSelfInspectionRecordId)
|
|
.eq(TrialSelfInspectionRecord::getId, trialSelfInspectionRecordId)
|
|
);
|
|
);
|
|
|
|
|
|
- //TODO ------审批通过且合格的自检记录信息,关联到工程部位信息的施工质检节点上去------
|
|
|
|
TrialSelfInspectionRecord record = baseMapper.selectById(trialSelfInspectionRecordId);
|
|
TrialSelfInspectionRecord record = baseMapper.selectById(trialSelfInspectionRecordId);
|
|
if (("已审批").equals(record.getTaskStatus()) && (new Integer(1)).equals(record.getDetectionResult()) && (new Integer(1)).equals(record.getDetectionCategory())) {
|
|
if (("已审批").equals(record.getTaskStatus()) && (new Integer(1)).equals(record.getDetectionResult()) && (new Integer(1)).equals(record.getDetectionCategory())) {
|
|
|
|
+ /**
|
|
|
|
+ * 在资料填报工序-预览全部pdf时再拼接合并显示,当前只做储存(如果当前资料填报工序节点有其他多个试验记录pdf关联信息,那么合并存储,否则直接存储)
|
|
|
|
+ */
|
|
if (StringUtils.isNotEmpty(record.getProjectPosition())) {
|
|
if (StringUtils.isNotEmpty(record.getProjectPosition())) {
|
|
- List<String> ids = Func.toStrList(record.getProjectPosition());
|
|
|
|
-
|
|
|
|
- //删除当前试验记录关联信息
|
|
|
|
- baseMapper.delSelfQuality(record.getId());
|
|
|
|
-
|
|
|
|
- for (String pKeyId : ids) {
|
|
|
|
- //新增关联信息
|
|
|
|
- baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), record.getId(), pKeyId);
|
|
|
|
-
|
|
|
|
- //合并pdf到质检树节点
|
|
|
|
- WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(pKeyId);
|
|
|
|
- if (wbsTreeContract != null) {
|
|
|
|
- List<String> pdfUrlList = new ArrayList<>();
|
|
|
|
- String classify;
|
|
|
|
-
|
|
|
|
- if (wbsTreeContract.getTableOwner().contains("1") || wbsTreeContract.getTableOwner().contains("2") || wbsTreeContract.getTableOwner().contains("3")) {
|
|
|
|
- classify = "1";
|
|
|
|
- } else {
|
|
|
|
- classify = "2";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String pdfUrlNodeAll = baseMapper.selectInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isEmpty(pdfUrlNodeAll) || StringUtils.isEmpty(record.getPdfUrl())) {
|
|
|
|
|
|
+ //有pdf的节点
|
|
|
|
+ String sqlNodeAll = "select wbs_id from u_information_query where wbs_id in(" + record.getProjectPosition() + ") and contract_id = " + record.getContractId();
|
|
|
|
+ List<Long> collect = jdbcTemplate.query(sqlNodeAll, new BeanPropertyRowMapper<>(InformationQuery.class)).stream().map(InformationQuery::getWbsId).collect(Collectors.toList());
|
|
|
|
+ if (collect.size() > 0) {
|
|
|
|
+ //删除当前记录关联记录
|
|
|
|
+ baseMapper.delSelfQuality(record.getId());
|
|
|
|
+ for (Long pKeyId : collect) {
|
|
|
|
+ //新增当前记录关联信息
|
|
|
|
+ baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), record.getId(), pKeyId);
|
|
|
|
+
|
|
|
|
+ //获取当前工程部位节点最新的关联试验记录ids
|
|
|
|
+ List<String> trialRecordIds = baseMapper.selectTrialIdByNodeId(pKeyId);
|
|
|
|
+
|
|
|
|
+ //如果当前工程部位节点的关联试验记录id只有一条,且等于当前关联试验记录id,那么不合并,直接存储该条试验记录的pdf
|
|
|
|
+ if (trialRecordIds.size() == 1 && trialRecordIds.get(0).equals(record.getId().toString())) {
|
|
|
|
+ //修改当前试验pdf到质检树节点的pdf_trial_url_position上存储
|
|
|
|
+ baseMapper.updateInformationQuery(pKeyId, record.getContractId(), record.getPdfUrl());
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
- //质检节点pdfUrl
|
|
|
|
- pdfUrlList.add(pdfUrlNodeAll);
|
|
|
|
- //试验记录pdfUrl
|
|
|
|
- pdfUrlList.add(record.getPdfUrl());
|
|
|
|
|
|
+ //如果当前工程部位节点的关联试验记录id有多条,那么合并
|
|
|
|
+ List<TrialSelfInspectionRecord> pdfUrlList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().select(TrialSelfInspectionRecord::getPdfUrl).in(TrialSelfInspectionRecord::getId, trialRecordIds));
|
|
|
|
+ List<String> pdfS = pdfUrlList.stream().filter(f -> StringUtils.isNotEmpty(f.getPdfUrl())).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
|
|
String listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
|
|
@@ -514,11 +519,12 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
if (tabPDF.exists()) {
|
|
if (tabPDF.exists()) {
|
|
tabPDF.delete();
|
|
tabPDF.delete();
|
|
}
|
|
}
|
|
- FileUtils.mergePdfPublicMethods(pdfUrlList, listPdf);
|
|
|
|
|
|
+
|
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfS, listPdf);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
|
|
if (bladeFile != null) {
|
|
if (bladeFile != null) {
|
|
- //修改质检树合并后的pdfUrl
|
|
|
|
- baseMapper.updateInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
|
|
|
|
|
|
+ //修改合并的试验pdf到质检树节点的pdf_trial_url_position上存储
|
|
|
|
+ baseMapper.updateInformationQuery(pKeyId, record.getContractId(), bladeFile.getLink());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -531,7 +537,8 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception {
|
|
|
|
|
|
+ public String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String
|
|
|
|
+ projectId, String classify, String id, String tableType) throws Exception {
|
|
R<BladeFile> bladeFile = iossClient.addFileInfo(file);
|
|
R<BladeFile> bladeFile = iossClient.addFileInfo(file);
|
|
BladeFile bladeFile1 = bladeFile.getData();
|
|
BladeFile bladeFile1 = bladeFile.getData();
|
|
TableFile tableFile = new TableFile();
|
|
TableFile tableFile = new TableFile();
|
|
@@ -645,16 +652,15 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
List<String> sampleIds = baseMapper.selectSelfSampleRecord(id);
|
|
List<String> sampleIds = baseMapper.selectSelfSampleRecord(id);
|
|
if (sampleIds.size() > 0) {
|
|
if (sampleIds.size() > 0) {
|
|
List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectBatchIds(sampleIds);
|
|
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) {
|
|
if (trialSampleInfos.size() > 0) {
|
|
for (TrialSampleInfo trialSampleInfo : trialSampleInfos) {
|
|
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 +704,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
this.saveOrUpdate(dto);
|
|
this.saveOrUpdate(dto);
|
|
}
|
|
}
|
|
|
|
|
|
- //TODO ------保存实体表数据、试验记录信息、生成pdf------
|
|
|
|
|
|
+ //------保存实体表数据、试验记录信息、生成pdf------
|
|
try {
|
|
try {
|
|
String pdfURL = excelTabClient.saveTabData(dto.getIsBatchSave(), dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId(), obj.getTableIds());
|
|
String pdfURL = excelTabClient.saveTabData(dto.getIsBatchSave(), dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId(), obj.getTableIds());
|
|
if (StringUtils.isNotEmpty(pdfURL)) {
|
|
if (StringUtils.isNotEmpty(pdfURL)) {
|
|
@@ -709,8 +715,8 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
throw new ServiceException("保存实体表数据生成pdf时发生异常" + e.getMessage());
|
|
throw new ServiceException("保存实体表数据生成pdf时发生异常" + e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
- //TODO ------关联工程及用途关系新增或删除------
|
|
|
|
- if (StringUtils.isEmpty(obj.getProjectPosition())) {
|
|
|
|
|
|
+ //------关联工程及用途关系新增或删除------(已做修改,在审批修改状态时,再建立关联关系)
|
|
|
|
+ /*if (StringUtils.isEmpty(obj.getProjectPosition())) {
|
|
String delSql = "delete from u_trial_self_quality_project where self_id = " + obj.getId();
|
|
String delSql = "delete from u_trial_self_quality_project where self_id = " + obj.getId();
|
|
jdbcTemplate.execute(delSql);
|
|
jdbcTemplate.execute(delSql);
|
|
} else {
|
|
} else {
|
|
@@ -723,9 +729,9 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
String insertSql = "insert into u_trial_self_quality_project(id,self_id,quality_node_id) values (" + SnowFlakeUtil.getId() + "," + obj.getId() + "," + recordNodeId + ")";
|
|
String insertSql = "insert into u_trial_self_quality_project(id,self_id,quality_node_id) values (" + SnowFlakeUtil.getId() + "," + obj.getId() + "," + recordNodeId + ")";
|
|
jdbcTemplate.execute(insertSql);
|
|
jdbcTemplate.execute(insertSql);
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
- //TODO ------关联原材料检测报告------
|
|
|
|
|
|
+ //------关联原材料检测报告------
|
|
RawMaterialSubmitRelationDTO relationDTO = new RawMaterialSubmitRelationDTO();
|
|
RawMaterialSubmitRelationDTO relationDTO = new RawMaterialSubmitRelationDTO();
|
|
relationDTO.setId(obj.getId().toString());
|
|
relationDTO.setId(obj.getId().toString());
|
|
relationDTO.setIds(dto.getRawMaterialIds());
|
|
relationDTO.setIds(dto.getRawMaterialIds());
|
|
@@ -733,19 +739,15 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
relationDTO.setContractId(dto.getContractId().toString());
|
|
relationDTO.setContractId(dto.getContractId().toString());
|
|
relationDTO.setProjectId(dto.getProjectId());
|
|
relationDTO.setProjectId(dto.getProjectId());
|
|
relationDTO.setType(dto.getType());
|
|
relationDTO.setType(dto.getType());
|
|
- if (StringUtils.isNotEmpty(relationDTO.getIds())) {
|
|
|
|
- this.rawMaterialSubmitRelation(relationDTO);
|
|
|
|
- }
|
|
|
|
|
|
+ this.rawMaterialSubmitRelation(relationDTO, obj);
|
|
|
|
|
|
- //TODO ------关联取样信息------
|
|
|
|
|
|
+ //------关联取样信息------
|
|
RecordSampleSubmitDTO recordSampleSubmitDTO = new RecordSampleSubmitDTO();
|
|
RecordSampleSubmitDTO recordSampleSubmitDTO = new RecordSampleSubmitDTO();
|
|
recordSampleSubmitDTO.setId(obj.getId());
|
|
recordSampleSubmitDTO.setId(obj.getId());
|
|
recordSampleSubmitDTO.setSampleIds(dto.getSampleIds());
|
|
recordSampleSubmitDTO.setSampleIds(dto.getSampleIds());
|
|
- if (StringUtils.isNotEmpty(relationDTO.getIds())) {
|
|
|
|
- this.recordSampleSubmit(recordSampleSubmitDTO);
|
|
|
|
- }
|
|
|
|
|
|
+ this.recordSampleSubmit(recordSampleSubmitDTO);
|
|
|
|
|
|
- //TODO ------新增设备使用记录信息------
|
|
|
|
|
|
+ //------新增设备使用记录信息------
|
|
this.trialDeviceUseService.addDeviceUseInfo(dto);
|
|
this.trialDeviceUseService.addDeviceUseInfo(dto);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -759,12 +761,12 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
throw new ServiceException("请先保存填报数据后,再关联取样信息");
|
|
throw new ServiceException("请先保存填报数据后,再关联取样信息");
|
|
}
|
|
}
|
|
- //删除关联信息
|
|
|
|
|
|
+ //删除关联
|
|
baseMapper.delSelfSample(dto.getId());
|
|
baseMapper.delSelfSample(dto.getId());
|
|
if (StringUtils.isNotEmpty(dto.getSampleIds())) {
|
|
if (StringUtils.isNotEmpty(dto.getSampleIds())) {
|
|
List<String> ids = Func.toStrList(dto.getSampleIds());
|
|
List<String> ids = Func.toStrList(dto.getSampleIds());
|
|
for (String id : ids) {
|
|
for (String id : ids) {
|
|
- //新增关联信息
|
|
|
|
|
|
+ //新增关联
|
|
baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
|
|
baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -814,72 +816,6 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public boolean recordProjectPosition(SelfProjectPositionSubmitDTO dto) throws FileNotFoundException {
|
|
|
|
- if (ObjectUtil.isEmpty(dto.getId())) {
|
|
|
|
- throw new ServiceException("请先保存填报数据后,再关联工程部位及用途信息");
|
|
|
|
- }
|
|
|
|
- //已审批记录关联
|
|
|
|
- if (StringUtils.isNotEmpty(dto.getProjectPosition())) {
|
|
|
|
- TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
|
|
|
|
- if (("已审批").equals(obj.getTaskStatus())) {
|
|
|
|
- //删除关联信息
|
|
|
|
- baseMapper.delSelfQuality(dto.getId());
|
|
|
|
-
|
|
|
|
- List<String> ids = Func.toStrList(dto.getProjectPosition());
|
|
|
|
- //新增关联信息
|
|
|
|
- for (String id : ids) {
|
|
|
|
- baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), dto.getId(), id);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //把当前试验的PDF合并关联到质检树节点下
|
|
|
|
- List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(String.valueOf(dto.getId())); //获取合同段质检树的节点PkeyId
|
|
|
|
- for (String pKeyId : contractNodePKeyIds) {
|
|
|
|
- WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(pKeyId);
|
|
|
|
- if (wbsTreeContract != null) {
|
|
|
|
- List<String> pdfUrlList = new ArrayList<>();
|
|
|
|
- String classify;
|
|
|
|
- if (wbsTreeContract.getTableOwner().contains("1") || wbsTreeContract.getTableOwner().contains("2") || wbsTreeContract.getTableOwner().contains("3")) {
|
|
|
|
- classify = "1";
|
|
|
|
- } else {
|
|
|
|
- classify = "2";
|
|
|
|
- }
|
|
|
|
- String pdfUrlNodeAll = baseMapper.selectInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify);
|
|
|
|
-
|
|
|
|
- if (StringUtils.isEmpty(pdfUrlNodeAll) || StringUtils.isEmpty(obj.getPdfUrl())) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //质检节点合并pdfUrl
|
|
|
|
- pdfUrlList.add(pdfUrlNodeAll);
|
|
|
|
- //试验pdfUrl
|
|
|
|
- pdfUrlList.add(obj.getPdfUrl());
|
|
|
|
-
|
|
|
|
- //合并PDF
|
|
|
|
- String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
|
- String listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
|
|
|
|
- File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
|
- if (tabPDF.exists()) {
|
|
|
|
- tabPDF.delete();
|
|
|
|
- }
|
|
|
|
- FileUtils.mergePdfPublicMethods(pdfUrlList, listPdf);
|
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
|
|
|
|
- if (bladeFile != null) {
|
|
|
|
- //修改质检树合并后的pdfURL
|
|
|
|
- baseMapper.updateInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- throw new ServiceException("当前试验记录任务未上报审批,关联工程部位及用途信息失败");
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- //删除关联信息
|
|
|
|
- baseMapper.delSelfQuality(dto.getId());
|
|
|
|
- }
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void buildNumber(TrialSelfInspectionRecordDTO dto) {
|
|
private void buildNumber(TrialSelfInspectionRecordDTO dto) {
|
|
StringSPUtils spUtils = new StringSPUtils();
|
|
StringSPUtils spUtils = new StringSPUtils();
|
|
List<TrialSelfInspectionRecord> result = baseMapper.selectAll(dto.getNodeId(), dto.getContractId());
|
|
List<TrialSelfInspectionRecord> result = baseMapper.selectAll(dto.getNodeId(), dto.getContractId());
|
|
@@ -1039,23 +975,20 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public IPage<TrialSelfInspectionRecordVO> trialDataPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
|
|
|
|
|
|
+ public IPage<TrialSelfInspectionRecordVO> trialDataPage
|
|
|
|
+ (IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {
|
|
QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
|
|
QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
|
|
-
|
|
|
|
if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getStartTime()) && org.apache.commons.lang.StringUtils.isNotEmpty(dto.getEndTime())) {
|
|
if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getStartTime()) && org.apache.commons.lang.StringUtils.isNotEmpty(dto.getEndTime())) {
|
|
String endTime = dto.getEndTime();
|
|
String endTime = dto.getEndTime();
|
|
endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
|
|
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().between(TrialSelfInspectionRecord::getReportDate, dto.getStartTime(), endTime);
|
|
}
|
|
}
|
|
-
|
|
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getTaskStatus, "已审批");
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getTaskStatus, "已审批");
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, 1); //合格
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, 1); //合格
|
|
queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionCategory, 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);
|
|
IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
|
|
List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
|
|
-
|
|
|
|
//查询是否关联过
|
|
//查询是否关联过
|
|
if (ObjectUtil.isNotEmpty(dto.getQualityTestPKeyId())) {
|
|
if (ObjectUtil.isNotEmpty(dto.getQualityTestPKeyId())) {
|
|
List<String> selectedIds = baseMapper.selectSelectedStatusList(Long.parseLong(dto.getQualityTestPKeyId()), "1");
|
|
List<String> selectedIds = baseMapper.selectSelectedStatusList(Long.parseLong(dto.getQualityTestPKeyId()), "1");
|
|
@@ -1066,7 +999,6 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
record.setIsSelectedStatus(1);
|
|
record.setIsSelectedStatus(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
//工程部位及用途名称
|
|
//工程部位及用途名称
|
|
if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
|
|
if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
|
|
@@ -1081,7 +1013,6 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
} else {
|
|
} else {
|
|
for (TrialSelfInspectionRecordVO record : records) {
|
|
for (TrialSelfInspectionRecordVO record : records) {
|
|
record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
record.setDetectionResultName(record.getDetectionResult().equals(1) ? "合格" : "不合格");
|
|
@@ -1099,16 +1030,17 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean fileSubmit(TrialFileSubmitDTO dto) throws FileNotFoundException {
|
|
public boolean fileSubmit(TrialFileSubmitDTO dto) throws FileNotFoundException {
|
|
|
|
+ /**
|
|
|
|
+ * 在资料填报工序-预览全部pdf时再拼接合并显示,当前只做储存
|
|
|
|
+ */
|
|
if (ObjectUtil.isEmpty(dto.getType())) {
|
|
if (ObjectUtil.isEmpty(dto.getType())) {
|
|
throw new ServiceException("请选择一个类型");
|
|
throw new ServiceException("请选择一个类型");
|
|
- }
|
|
|
|
- if (ObjectUtil.isEmpty(dto.getNodeId())) {
|
|
|
|
|
|
+ } else if (ObjectUtil.isEmpty(dto.getNodeId())) {
|
|
throw new ServiceException("未获取到当前节点信息");
|
|
throw new ServiceException("未获取到当前节点信息");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1120,14 +1052,14 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
.eq(InformationQuery::getType, 1)).stream().findAny().orElse(null);
|
|
.eq(InformationQuery::getType, 1)).stream().findAny().orElse(null);
|
|
|
|
|
|
if (StringUtils.isNotEmpty(dto.getIds())) {
|
|
if (StringUtils.isNotEmpty(dto.getIds())) {
|
|
- if (informationQuery != null && StringUtils.isNotEmpty(informationQuery.getPdfUrl())) {
|
|
|
|
-
|
|
|
|
|
|
+ if (informationQuery != null) {
|
|
List<String> pdfList = new ArrayList<>();
|
|
List<String> pdfList = new ArrayList<>();
|
|
-
|
|
|
|
- //TODO ------自检------
|
|
|
|
|
|
+ //------自检------
|
|
if (dto.getType().equals(1)) {
|
|
if (dto.getType().equals(1)) {
|
|
- //当前施工pdf
|
|
|
|
- pdfList.add(informationQuery.getPdfUrl());
|
|
|
|
|
|
+ if (informationQuery.getPdfTrialUrl() != null) {
|
|
|
|
+ //如果当前存在第三方、外委的pdf,那么拼接
|
|
|
|
+ pdfList.add(informationQuery.getPdfTrialUrl());
|
|
|
|
+ }
|
|
|
|
|
|
//自检pdf
|
|
//自检pdf
|
|
List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
@@ -1136,15 +1068,11 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
List<String> pdfURLs = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
List<String> pdfURLs = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
pdfList.addAll(pdfURLs);
|
|
pdfList.addAll(pdfURLs);
|
|
|
|
|
|
- //TODO ------第三方、外委------
|
|
|
|
|
|
+ //------第三方、外委------
|
|
} else if (dto.getType().equals(2) || dto.getType().equals(3)) {
|
|
} else if (dto.getType().equals(2) || dto.getType().equals(3)) {
|
|
-
|
|
|
|
if (informationQuery.getPdfTrialUrl() != null) {
|
|
if (informationQuery.getPdfTrialUrl() != null) {
|
|
- //如果当前存在自检pdf,那么拼接
|
|
|
|
|
|
+ //如果当前存在试验自检的pdf,那么拼接
|
|
pdfList.add(informationQuery.getPdfTrialUrl());
|
|
pdfList.add(informationQuery.getPdfTrialUrl());
|
|
- } else {
|
|
|
|
- //当前施工pdf
|
|
|
|
- pdfList.add(informationQuery.getPdfUrl());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//第三方、外委pdf
|
|
//第三方、外委pdf
|
|
@@ -1159,11 +1087,10 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
pdfList.addAll(pdfURLs);
|
|
pdfList.addAll(pdfURLs);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (pdfList.size() > 0) {
|
|
if (pdfList.size() > 0) {
|
|
- //合并pdf把试验自检记录、第三方、外委的pdf追加到当前质检合同段树节点下的pdf后显示
|
|
|
|
|
|
+ //合并试验自检、第三方、外委的pdf
|
|
List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
@@ -1216,14 +1143,12 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, ids));
|
|
List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, ids));
|
|
List<String> pdfURLs = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
List<String> pdfURLs = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
pdfList.addAll(pdfURLs);
|
|
pdfList.addAll(pdfURLs);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- if (pdfList.size() > 0) {
|
|
|
|
- //合并pdf把试验自检记录、第三方、外委的pdf追加到当前质检合同段树节点下的pdf后显示
|
|
|
|
|
|
+ if (pdfList.size() > 0 && informationQuery != null) {
|
|
|
|
+ //重新合并
|
|
List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
List<String> collect = pdfList.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
- assert informationQuery != null;
|
|
|
|
String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
File tabPDF = ResourceUtil.getFile(listPdf);
|
|
File tabPDF = ResourceUtil.getFile(listPdf);
|
|
if (tabPDF.exists()) {
|
|
if (tabPDF.exists()) {
|
|
@@ -1232,7 +1157,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
FileUtils.mergePdfPublicMethods(collect, listPdf);
|
|
FileUtils.mergePdfPublicMethods(collect, listPdf);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getId() + ".pdf", listPdf);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(informationQuery.getId() + ".pdf", listPdf);
|
|
if (bladeFile != null) {
|
|
if (bladeFile != null) {
|
|
- //修改当前节点的pdfTrialURL地址
|
|
|
|
|
|
+ //修改当前节点最新的pdfTrialURL地址
|
|
if (informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, bladeFile.getLink()).eq(InformationQuery::getId, informationQuery.getId()))) {
|
|
if (informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, bladeFile.getLink()).eq(InformationQuery::getId, informationQuery.getId()))) {
|
|
for (String recordId : recordIds) {
|
|
for (String recordId : recordIds) {
|
|
baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
|
|
baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
|
|
@@ -1245,16 +1170,16 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
} else {
|
|
} else {
|
|
//修改pdfTrialUrl=null
|
|
//修改pdfTrialUrl=null
|
|
- assert informationQuery != null;
|
|
|
|
- informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, null).eq(InformationQuery::getId, informationQuery.getId()));
|
|
|
|
|
|
+ if (informationQuery != null) {
|
|
|
|
+ informationQueryService.update(Wrappers.<InformationQuery>lambdaUpdate().set(InformationQuery::getPdfTrialUrl, null).eq(InformationQuery::getId, informationQuery.getId()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//删除该类型的所有记录信息
|
|
//删除该类型的所有记录信息
|
|
baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), null);
|
|
baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), null);
|
|
-
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
-
|
|
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|