|
@@ -3,8 +3,8 @@ 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.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.spire.xls.*;
|
|
import com.spire.xls.*;
|
|
@@ -12,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;
|
|
@@ -45,6 +44,7 @@ import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -53,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
|
|
@@ -66,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;
|
|
@@ -80,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());
|
|
@@ -99,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())) {
|
|
@@ -129,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) {
|
|
//获取材料附件信息
|
|
//获取材料附件信息
|
|
@@ -164,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());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -205,18 +262,19 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectBatchIds(ids);
|
|
List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectBatchIds(ids);
|
|
for (TrialSelfInspectionRecord trialSelfInspectionRecord : trialSelfInspectionRecords) {
|
|
for (TrialSelfInspectionRecord trialSelfInspectionRecord : trialSelfInspectionRecords) {
|
|
TrialSelfInspectionRecordDTO dto = BeanUtil.copyProperties(trialSelfInspectionRecord, TrialSelfInspectionRecordDTO.class);
|
|
TrialSelfInspectionRecordDTO dto = BeanUtil.copyProperties(trialSelfInspectionRecord, TrialSelfInspectionRecordDTO.class);
|
|
- assert dto != null;
|
|
|
|
- dto.setId(SnowFlakeUtil.getId());
|
|
|
|
- if (StringUtils.isNotEmpty(dto.getRecordNo())) {
|
|
|
|
- dto.setTableType("1");
|
|
|
|
- } else if (StringUtils.isNotEmpty(dto.getReportNo())) {
|
|
|
|
- dto.setTableType("2");
|
|
|
|
- } else if (StringUtils.isNotEmpty(dto.getReportNo()) && StringUtils.isNotEmpty(dto.getRecordNo())) {
|
|
|
|
- dto.setTableType("1,2");
|
|
|
|
|
|
+ if (dto != null) {
|
|
|
|
+ dto.setId(SnowFlakeUtil.getId());
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getRecordNo())) {
|
|
|
|
+ dto.setTableType("1");
|
|
|
|
+ } else if (StringUtils.isNotEmpty(dto.getReportNo())) {
|
|
|
|
+ dto.setTableType("2");
|
|
|
|
+ } else if (StringUtils.isNotEmpty(dto.getReportNo()) && StringUtils.isNotEmpty(dto.getRecordNo())) {
|
|
|
|
+ dto.setTableType("1,2");
|
|
|
|
+ }
|
|
|
|
+ //重构编号
|
|
|
|
+ this.buildNumber(dto);
|
|
|
|
+ this.save(dto);
|
|
}
|
|
}
|
|
- //重构编号
|
|
|
|
- this.buildNumber(dto);
|
|
|
|
- this.save(dto);
|
|
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -226,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);
|
|
|
|
|
|
@@ -253,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);
|
|
}
|
|
}
|
|
@@ -281,110 +346,59 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto) throws FileNotFoundException {
|
|
|
|
|
|
+ @Async
|
|
|
|
+ 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) {
|
|
|
|
- assert 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) {
|
|
|
|
- assert 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() + "')";
|
|
|
|
- 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);
|
|
|
|
|
|
+ //新增记录关系
|
|
|
|
+ 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);
|
|
}
|
|
}
|
|
-
|
|
|
|
- //修改当前记录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);
|
|
}
|
|
}
|
|
@@ -454,19 +468,69 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void updateTrialSelfInspectionRecordStatus(List<TaskApprovalVO> obj){
|
|
|
|
|
|
+ @Async
|
|
|
|
+ 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() + "'";
|
|
TaskParallel taskParallel = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TaskParallel.class)).stream().findAny().orElse(null);
|
|
TaskParallel taskParallel = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TaskParallel.class)).stream().findAny().orElse(null);
|
|
- assert taskParallel != null;
|
|
|
|
- if (ObjectUtil.isNotEmpty(taskParallel.getProcessInstanceId())) {
|
|
|
|
|
|
+ if (taskParallel != null && ObjectUtil.isNotEmpty(taskParallel.getProcessInstanceId())) {
|
|
String trialSelfInspectionRecordId = baseMapper.selectTaskByTaskId(taskParallel.getProcessInstanceId());
|
|
String trialSelfInspectionRecordId = baseMapper.selectTaskByTaskId(taskParallel.getProcessInstanceId());
|
|
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)
|
|
);
|
|
);
|
|
|
|
+
|
|
|
|
+ TrialSelfInspectionRecord record = baseMapper.selectById(trialSelfInspectionRecordId);
|
|
|
|
+ //此时的record.getPdfUrl()为电签后的pdf信息
|
|
|
|
+ if (("已审批").equals(record.getTaskStatus()) && (new Integer(1)).equals(record.getDetectionResult()) && (new Integer(1)).equals(record.getDetectionCategory())) {
|
|
|
|
+ /**
|
|
|
|
+ * 在资料填报工序-预览全部pdf时再拼接合并显示,当前只做储存(如果当前资料填报工序节点有其他多个试验记录pdf关联信息,那么合并存储,否则直接存储)
|
|
|
|
+ */
|
|
|
|
+ if (StringUtils.isNotEmpty(record.getProjectPosition())) {
|
|
|
|
+ //有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;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //如果当前工程部位节点的关联试验记录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 listPdf = filePath + "/pdf/" + pKeyId + ".pdf";
|
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
|
+ if (tabPDF.exists()) {
|
|
|
|
+ tabPDF.delete();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfS, listPdf);
|
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
|
|
|
|
+ if (bladeFile != null) {
|
|
|
|
+ //修改合并的试验pdf到质检树节点的pdf_trial_url_position上存储
|
|
|
|
+ baseMapper.updateInformationQuery(pKeyId, record.getContractId(), bladeFile.getLink());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -474,7 +538,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();
|
|
@@ -588,16 +653,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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -607,24 +671,24 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public String selfSubmit(TrialSelfInspectionRecordDTO dto) {
|
|
|
|
|
|
+ public String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
|
|
if (ObjectUtil.isEmpty(dto.getId()) && StringUtils.isNotEmpty(dto.getTableType())) {
|
|
if (ObjectUtil.isEmpty(dto.getId()) && StringUtils.isNotEmpty(dto.getTableType())) {
|
|
//构建记录表编号、报告单编号
|
|
//构建记录表编号、报告单编号
|
|
this.buildNumber(dto);
|
|
this.buildNumber(dto);
|
|
|
|
|
|
//任务流程状态初始化未上报
|
|
//任务流程状态初始化未上报
|
|
dto.setTaskStatus("未上报");
|
|
dto.setTaskStatus("未上报");
|
|
|
|
+ }
|
|
|
|
|
|
- //初始化tabIds
|
|
|
|
- JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
|
|
|
|
- List<String> tableIds = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < dataArray.size(); i++) {
|
|
|
|
- String pkeyId = dataArray.getJSONObject(i).getString("pkeyId");
|
|
|
|
- tableIds.add(pkeyId);
|
|
|
|
- }
|
|
|
|
- String join = org.apache.commons.lang.StringUtils.join(tableIds, ",");
|
|
|
|
- dto.setTableIds(join);
|
|
|
|
|
|
+ //初始化tabIds
|
|
|
|
+ JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
|
|
|
|
+ List<String> tableIds = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
|
+ String pkeyId = dataArray.getJSONObject(i).getString("pkeyId");
|
|
|
|
+ tableIds.add(pkeyId);
|
|
}
|
|
}
|
|
|
|
+ String join = org.apache.commons.lang.StringUtils.join(tableIds, ",");
|
|
|
|
+ dto.setTableIds(join);
|
|
|
|
|
|
this.saveOrUpdate(dto);
|
|
this.saveOrUpdate(dto);
|
|
|
|
|
|
@@ -632,7 +696,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
//获取当前最新的试验记录信息
|
|
//获取当前最新的试验记录信息
|
|
TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
|
|
TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
|
|
|
|
|
|
- //如果新增时不是两种类型表都填报过,那么有一项编号为Null,所以编辑时生成记录表编号或报告单编号
|
|
|
|
|
|
+ //编辑时生成记录表编号或报告单编号,如果新增时不是两种类型表都填报过,那么有一项编号为Null
|
|
if (StringUtils.isEmpty(obj.getRecordNo()) && dto.getTableType().contains("1")) {
|
|
if (StringUtils.isEmpty(obj.getRecordNo()) && dto.getTableType().contains("1")) {
|
|
this.buildNumber(dto);
|
|
this.buildNumber(dto);
|
|
this.saveOrUpdate(dto);
|
|
this.saveOrUpdate(dto);
|
|
@@ -641,37 +705,53 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
this.saveOrUpdate(dto);
|
|
this.saveOrUpdate(dto);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //------保存实体表数据、试验记录信息、生成pdf------
|
|
try {
|
|
try {
|
|
- //保存实体表数据、试验记录信息、生成pdf
|
|
|
|
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)) {
|
|
//修改合并pdf
|
|
//修改合并pdf
|
|
- this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
|
|
- .set(TrialSelfInspectionRecord::getPdfUrl, pdfURL)
|
|
|
|
- .eq(TrialSelfInspectionRecord::getId, dto.getId()));
|
|
|
|
|
|
+ this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate().set(TrialSelfInspectionRecord::getPdfUrl, pdfURL).eq(TrialSelfInspectionRecord::getId, dto.getId()));
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- throw new ServiceException("保存实体表数据生成pdf时发生异常 " + e.getMessage());
|
|
|
|
|
|
+ throw new ServiceException("保存实体表数据生成pdf时发生异常" + e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
- //新增设备使用记录信息
|
|
|
|
|
|
+ //------关联原材料检测报告------
|
|
|
|
+ RawMaterialSubmitRelationDTO relationDTO = new RawMaterialSubmitRelationDTO();
|
|
|
|
+ relationDTO.setId(obj.getId().toString());
|
|
|
|
+ relationDTO.setIds(dto.getRawMaterialIds());
|
|
|
|
+ relationDTO.setNodeId(dto.getNodeId().toString());
|
|
|
|
+ relationDTO.setContractId(dto.getContractId().toString());
|
|
|
|
+ relationDTO.setProjectId(dto.getProjectId());
|
|
|
|
+ relationDTO.setType(dto.getType());
|
|
|
|
+ this.rawMaterialSubmitRelation(relationDTO, obj);
|
|
|
|
+
|
|
|
|
+ //------关联取样信息------
|
|
|
|
+ RecordSampleSubmitDTO recordSampleSubmitDTO = new RecordSampleSubmitDTO();
|
|
|
|
+ recordSampleSubmitDTO.setId(obj.getId());
|
|
|
|
+ recordSampleSubmitDTO.setSampleIds(dto.getSampleIds());
|
|
|
|
+ this.recordSampleSubmit(recordSampleSubmitDTO);
|
|
|
|
+
|
|
|
|
+ //------新增设备使用记录信息------
|
|
this.trialDeviceUseService.addDeviceUseInfo(dto);
|
|
this.trialDeviceUseService.addDeviceUseInfo(dto);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //返回当前记录id
|
|
return dto.getId().toString();
|
|
return dto.getId().toString();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Async
|
|
public boolean recordSampleSubmit(RecordSampleSubmitDTO dto) {
|
|
public boolean recordSampleSubmit(RecordSampleSubmitDTO dto) {
|
|
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);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -721,82 +801,17 @@ 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> trialSelfInspectionRecords = baseMapper.selectAll(dto.getNodeId(), dto.getContractId());
|
|
|
|
|
|
+ List<TrialSelfInspectionRecord> result = baseMapper.selectAll(dto.getNodeId(), dto.getContractId());
|
|
|
|
+ List<TrialSelfInspectionRecord> trialSelfInspectionRecords = result.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
|
//两种类型同时生成
|
|
//两种类型同时生成
|
|
if (dto.getTableType().contains("1,2") || dto.getTableType().contains("2,1")) {
|
|
if (dto.getTableType().contains("1,2") || dto.getTableType().contains("2,1")) {
|
|
String maxRecordNo = "";
|
|
String maxRecordNo = "";
|
|
if (StringUtils.isEmpty(dto.getRecordNo())) {
|
|
if (StringUtils.isEmpty(dto.getRecordNo())) {
|
|
//获取记录表最大编号
|
|
//获取记录表最大编号
|
|
- List<String> recordNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getRecordNo).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> recordNos = trialSelfInspectionRecords.stream().filter(f -> ObjectUtils.isNotEmpty(f.getRecordNo())).map(TrialSelfInspectionRecord::getRecordNo).collect(Collectors.toList());
|
|
if (recordNos.size() == 0 || ObjectUtil.isEmpty(recordNos)) {
|
|
if (recordNos.size() == 0 || ObjectUtil.isEmpty(recordNos)) {
|
|
maxRecordNo = "0001";
|
|
maxRecordNo = "0001";
|
|
} else {
|
|
} else {
|
|
@@ -817,7 +832,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
String maxReportNo = "";
|
|
String maxReportNo = "";
|
|
if (StringUtils.isEmpty(dto.getReportNo())) {
|
|
if (StringUtils.isEmpty(dto.getReportNo())) {
|
|
//获取报告单最大编号
|
|
//获取报告单最大编号
|
|
- List<String> reportNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getReportNo).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> reportNos = trialSelfInspectionRecords.stream().filter(f -> ObjectUtils.isNotEmpty(f.getReportNo())).map(TrialSelfInspectionRecord::getReportNo).collect(Collectors.toList());
|
|
if (reportNos.size() == 0 || ObjectUtil.isEmpty(reportNos)) {
|
|
if (reportNos.size() == 0 || ObjectUtil.isEmpty(reportNos)) {
|
|
maxReportNo = "0001";
|
|
maxReportNo = "0001";
|
|
} else {
|
|
} else {
|
|
@@ -868,7 +883,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
if (("1").equals(dto.getTableType())) {
|
|
if (("1").equals(dto.getTableType())) {
|
|
if (StringUtils.isEmpty(dto.getRecordNo())) {
|
|
if (StringUtils.isEmpty(dto.getRecordNo())) {
|
|
//获取记录表最大编号
|
|
//获取记录表最大编号
|
|
- List<String> recordNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getRecordNo).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> recordNos = trialSelfInspectionRecords.stream().filter(f -> ObjectUtils.isNotEmpty(f.getRecordNo())).map(TrialSelfInspectionRecord::getRecordNo).collect(Collectors.toList());
|
|
String maxRecordNo;
|
|
String maxRecordNo;
|
|
if (recordNos.size() == 0 || ObjectUtil.isEmpty(recordNos)) {
|
|
if (recordNos.size() == 0 || ObjectUtil.isEmpty(recordNos)) {
|
|
maxRecordNo = "0001";
|
|
maxRecordNo = "0001";
|
|
@@ -908,7 +923,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
if (("2").equals(dto.getTableType())) {
|
|
if (("2").equals(dto.getTableType())) {
|
|
if (StringUtils.isEmpty(dto.getReportNo())) {
|
|
if (StringUtils.isEmpty(dto.getReportNo())) {
|
|
//获取报告单最大编号
|
|
//获取报告单最大编号
|
|
- List<String> reportNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getReportNo).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> reportNos = trialSelfInspectionRecords.stream().filter(f -> ObjectUtils.isNotEmpty(f.getReportNo())).map(TrialSelfInspectionRecord::getReportNo).collect(Collectors.toList());
|
|
String maxReportNo;
|
|
String maxReportNo;
|
|
if (reportNos.size() == 0 || ObjectUtil.isEmpty(reportNos)) {
|
|
if (reportNos.size() == 0 || ObjectUtil.isEmpty(reportNos)) {
|
|
maxReportNo = "0001";
|
|
maxReportNo = "0001";
|
|
@@ -945,23 +960,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");
|
|
@@ -972,7 +984,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())) {
|
|
@@ -987,7 +998,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) ? "合格" : "不合格");
|
|
@@ -1005,49 +1015,53 @@ 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())) {
|
|
|
|
- throw new ServiceException("未获取到当前节点的pKeyId");
|
|
|
|
|
|
+ } else if (ObjectUtil.isEmpty(dto.getNodeId())) {
|
|
|
|
+ throw new ServiceException("未获取到当前节点信息");
|
|
}
|
|
}
|
|
|
|
|
|
//获取当前节点的合并的pdfURL
|
|
//获取当前节点的合并的pdfURL
|
|
- InformationQuery informationQuery = informationQueryService.getBaseMapper().selectOne(Wrappers.<InformationQuery>lambdaQuery()
|
|
|
|
|
|
+ InformationQuery informationQuery = informationQueryService.getBaseMapper().selectList(Wrappers.<InformationQuery>lambdaQuery()
|
|
.eq(InformationQuery::getWbsId, dto.getNodeId())
|
|
.eq(InformationQuery::getWbsId, dto.getNodeId())
|
|
.eq(InformationQuery::getProjectId, dto.getProjectId())
|
|
.eq(InformationQuery::getProjectId, dto.getProjectId())
|
|
.eq(InformationQuery::getContractId, dto.getContractId())
|
|
.eq(InformationQuery::getContractId, dto.getContractId())
|
|
- .eq(InformationQuery::getType, 1) //质检
|
|
|
|
- );
|
|
|
|
|
|
+ .eq(InformationQuery::getType, 1)).stream().findAny().orElse(null);
|
|
|
|
|
|
if (StringUtils.isNotEmpty(dto.getIds())) {
|
|
if (StringUtils.isNotEmpty(dto.getIds())) {
|
|
- if (ObjectUtil.isNotEmpty(informationQuery) && StringUtils.isNotEmpty(informationQuery.getPdfUrl())) {
|
|
|
|
-
|
|
|
|
|
|
+ if (informationQuery != null) {
|
|
List<String> pdfList = new ArrayList<>();
|
|
List<String> pdfList = new ArrayList<>();
|
|
|
|
+ //------自检------
|
|
|
|
+ if (dto.getType().equals(1)) {
|
|
|
|
+ if (informationQuery.getPdfTrialUrl() != null) {
|
|
|
|
+ //如果当前存在第三方、外委的pdf,那么拼接
|
|
|
|
+ pdfList.add(informationQuery.getPdfTrialUrl());
|
|
|
|
+ }
|
|
|
|
|
|
- if (StringUtils.isEmpty(informationQuery.getPdfTrialUrl())) {
|
|
|
|
- //如果PdfTrialUrl == null 说明是第一次关联
|
|
|
|
- pdfList.add(informationQuery.getPdfUrl());
|
|
|
|
- } else {
|
|
|
|
- //如果PdfTrialUrl != null 说明是第二次以上操作关联,那么就在之前的上面做增量,主要解决不同类型提交时的问题
|
|
|
|
- pdfList.add(informationQuery.getPdfTrialUrl());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (dto.getType().equals(1)) { //自检
|
|
|
|
- //获取自检的对应的数据pdf
|
|
|
|
- List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, dto.getIds()));
|
|
|
|
|
|
+ //自检pdf
|
|
|
|
+ List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery()
|
|
|
|
+ .select(TrialSelfInspectionRecord::getPdfUrl)
|
|
|
|
+ .in(TrialSelfInspectionRecord::getId, Func.toLongList(dto.getIds())));
|
|
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);
|
|
|
|
|
|
- } else if (dto.getType().equals(2) || dto.getType().equals(3)) { //第三方、外委
|
|
|
|
- //获取第三方、外委的对应的数据pdf
|
|
|
|
- List<TrialDetectionData> trialDetectionData = trialDetectionDataService.getBaseMapper().selectList(Wrappers.<TrialDetectionData>lambdaQuery().in(TrialDetectionData::getId, dto.getIds()));
|
|
|
|
|
|
+ //------第三方、外委------
|
|
|
|
+ } else if (dto.getType().equals(2) || dto.getType().equals(3)) {
|
|
|
|
+ if (informationQuery.getPdfTrialUrl() != null) {
|
|
|
|
+ //如果当前存在试验自检的pdf,那么拼接
|
|
|
|
+ pdfList.add(informationQuery.getPdfTrialUrl());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //第三方、外委pdf
|
|
|
|
+ List<TrialDetectionData> trialDetectionData = trialDetectionDataService.getBaseMapper().selectList(Wrappers.<TrialDetectionData>lambdaQuery().in(TrialDetectionData::getId, Func.toLongList(dto.getIds())));
|
|
List<String> pdfURLs = new ArrayList<>();
|
|
List<String> pdfURLs = new ArrayList<>();
|
|
for (TrialDetectionData trialDetectionDatum : trialDetectionData) {
|
|
for (TrialDetectionData trialDetectionDatum : trialDetectionData) {
|
|
if (StringUtils.isNotEmpty(trialDetectionDatum.getRecordTableUrl())) {
|
|
if (StringUtils.isNotEmpty(trialDetectionDatum.getRecordTableUrl())) {
|
|
@@ -1058,11 +1072,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";
|
|
@@ -1076,9 +1089,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
//修改当前节点的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 : Func.toStrList(dto.getIds())) {
|
|
for (String recordId : Func.toStrList(dto.getIds())) {
|
|
- //修改选中状态记录信息(选中为勾选绿色)
|
|
|
|
baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
|
|
baseMapper.deleteSeletedStatusByNodeId(dto.getNodeId(), dto.getType(), recordId); //先删除对应记录
|
|
-
|
|
|
|
baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
|
|
baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
@@ -1086,7 +1097,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- throw new ServiceException("当前节点还未上报,获取pdf信息失败,请先上报后再进行关联");
|
|
|
|
|
|
+ throw new ServiceException("当前质检节点还未保存生成pdf,请先保存后再进行试验文件关联");
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -1117,11 +1128,10 @@ 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);
|
|
String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
String listPdf = filePath + "/pdf/" + informationQuery.getId() + ".pdf";
|
|
@@ -1132,12 +1142,10 @@ 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); //先删除对应记录
|
|
-
|
|
|
|
baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
|
|
baseMapper.insertSeletedStatus(SnowFlakeUtil.getId(), dto.getNodeId(), dto.getType(), recordId); //新增该类型选中的记录信息
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
@@ -1147,15 +1155,16 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
} else {
|
|
} else {
|
|
//修改pdfTrialUrl=null
|
|
//修改pdfTrialUrl=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;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|