|
@@ -59,9 +59,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
-public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
- extends BaseServiceImpl<TrialSelfInspectionRecordMapper, TrialSelfInspectionRecord>
|
|
|
|
- implements ITrialSelfInspectionRecordService {
|
|
|
|
|
|
+public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialSelfInspectionRecordMapper, TrialSelfInspectionRecord> implements ITrialSelfInspectionRecordService {
|
|
|
|
|
|
private final TrialSampleInfoMapper trialSampleInfoMapper;
|
|
private final TrialSampleInfoMapper trialSampleInfoMapper;
|
|
private final TrialMaterialMobilizationMapper trialMaterialMobilizationMapper;
|
|
private final TrialMaterialMobilizationMapper trialMaterialMobilizationMapper;
|
|
@@ -81,70 +79,109 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) throws FileNotFoundException {
|
|
public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) throws FileNotFoundException {
|
|
- QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
|
|
|
|
- if (StringUtils.isNotEmpty(dto.getQueryValue())) {
|
|
|
|
- queryWrapper.lambda().like(TrialSelfInspectionRecord::getTrialProjectName, dto.getQueryValue());
|
|
|
|
- }
|
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getStartTime()) && org.apache.commons.lang.StringUtils.isNotEmpty(dto.getEndTime())) {
|
|
|
|
- String endTime = dto.getEndTime();
|
|
|
|
- endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
|
|
|
|
- queryWrapper.lambda().between(TrialSelfInspectionRecord::getReportDate, dto.getStartTime(), endTime);
|
|
|
|
- }
|
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getQueryName())) {
|
|
|
|
- queryWrapper.lambda().like(TrialSelfInspectionRecord::getTrialUserName, dto.getQueryName());
|
|
|
|
- }
|
|
|
|
- if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getQueryStatus())) {
|
|
|
|
- queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, dto.getQueryStatus());
|
|
|
|
- }
|
|
|
|
- IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(true, TrialSelfInspectionRecord::getCreateTime));
|
|
|
|
- IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
|
|
- List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
|
|
|
|
- Map<String, Dict> map = iDictClient.getList("trial_detection_category").getData().stream().collect(Collectors.toMap(Dict::getDictKey, Function.identity()));
|
|
|
|
|
|
+ //获取当前选择节点所有的子级节点pKeyIds
|
|
|
|
+ WbsTreePrivate selectedNode = jdbcTemplate.query("select id,project_id from m_wbs_tree_private where p_key_id = " + dto.getNodeId(), new BeanPropertyRowMapper<>(WbsTreePrivate.class)).stream().findAny().orElse(null);
|
|
|
|
+ if (selectedNode != null) {
|
|
|
|
+ List<WbsTreePrivate> ziNodePKeyIds = jdbcTemplate.query("select p_key_id from m_wbs_tree_private where type = 1 and is_deleted = 0 and project_id = " + selectedNode.getProjectId() + " and find_in_set('" + selectedNode.getId() + "',ancestors)", new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
|
+ QueryWrapper<TrialSelfInspectionRecord> queryWrapper = Condition.getQueryWrapper(dto);
|
|
|
|
+ if (ziNodePKeyIds.size() > 0) {
|
|
|
|
+ dto.setNodeId(null);
|
|
|
|
+ List<Long> pIds = ziNodePKeyIds.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
|
+ queryWrapper.lambda().in(TrialSelfInspectionRecord::getNodeId, pIds);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(dto.getQueryValue())) {
|
|
|
|
+ queryWrapper.lambda().like(TrialSelfInspectionRecord::getTrialProjectName, dto.getQueryValue());
|
|
|
|
+ }
|
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getStartTime()) && org.apache.commons.lang.StringUtils.isNotEmpty(dto.getEndTime())) {
|
|
|
|
+ String endTime = dto.getEndTime();
|
|
|
|
+ endTime = DateUtil.format(DateUtils.addDays(DateUtil.parse(endTime, "yyyy-MM-dd"), 1), "yyyy-MM-dd");
|
|
|
|
+ queryWrapper.lambda().between(TrialSelfInspectionRecord::getReportDate, dto.getStartTime(), endTime);
|
|
|
|
+ }
|
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getQueryName())) {
|
|
|
|
+ queryWrapper.lambda().like(TrialSelfInspectionRecord::getTrialUserName, dto.getQueryName());
|
|
|
|
+ }
|
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotEmpty(dto.getQueryStatus())) {
|
|
|
|
+ queryWrapper.lambda().eq(TrialSelfInspectionRecord::getDetectionResult, dto.getQueryStatus());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ IPage<TrialSelfInspectionRecord> pages = this.page(page, queryWrapper.lambda().orderByDesc(true, TrialSelfInspectionRecord::getCreateTime));
|
|
|
|
+ IPage<TrialSelfInspectionRecordVO> trialSelfInspectionRecordVOIPage = TrialSelfInspectionRecordWarpper.build().pageVO(pages);
|
|
|
|
+ List<TrialSelfInspectionRecordVO> records = trialSelfInspectionRecordVOIPage.getRecords();
|
|
|
|
+ Map<String, Dict> map = iDictClient.getList("trial_detection_category").getData().stream().collect(Collectors.toMap(Dict::getDictKey, Function.identity()));
|
|
|
|
+
|
|
|
|
+ for (TrialSelfInspectionRecordVO record : records) {
|
|
|
|
+ record.setDetectionResultName((new Integer(1)).equals(record.getDetectionResult()) ? "合格" : "");
|
|
|
|
+ if (StringUtils.isNotEmpty(record.getDetectionResultName())) {
|
|
|
|
+ record.setDetectionResult(1);
|
|
|
|
+ } else {
|
|
|
|
+ record.setDetectionResult(0);
|
|
|
|
+ }
|
|
|
|
|
|
- for (TrialSelfInspectionRecordVO record : records) {
|
|
|
|
- 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());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(record.getDetectionCategory())) {
|
|
|
|
- Dict dict = map.get(String.valueOf(record.getDetectionCategory()));
|
|
|
|
- if (dict != null) {
|
|
|
|
- record.setDetectionCategoryName(dict.getDictValue());
|
|
|
|
|
|
+ //工程部位及用途名称
|
|
|
|
+ if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
|
|
|
|
+ List<String> ids = Func.toStrList(record.getProjectPosition()); //关联的工程部位ids
|
|
|
|
+ List<WbsTreeContract> result = baseMapper.selectWbsTreeContractListByPKeyIds(ids); //查询工程部位节点名称信息
|
|
|
|
+ List<String> projectPositionNames = result.stream().map(WbsTreeContract::getNodeName).collect(Collectors.toList());
|
|
|
|
+ String name = projectPositionNames.stream().findAny().orElse(null);
|
|
|
|
+ if (projectPositionNames.size() > 1) {
|
|
|
|
+ record.setProjectPositionName(name + "等" + projectPositionNames.size() + "个工程部位信息");
|
|
|
|
+ } else {
|
|
|
|
+ record.setProjectPositionName(name);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //工程部位及用途名称
|
|
|
|
- if (ObjectUtil.isNotEmpty(record.getProjectPosition())) {
|
|
|
|
- List<String> ids = Func.toStrList(record.getProjectPosition()); //关联的工程部位ids
|
|
|
|
- List<WbsTreeContract> result = baseMapper.selectWbsTreeContractListByPKeyIds(ids); //查询工程部位节点名称信息
|
|
|
|
- List<String> projectPositionNames = result.stream().map(WbsTreeContract::getNodeName).collect(Collectors.toList());
|
|
|
|
- String name = projectPositionNames.stream().findAny().orElse(null);
|
|
|
|
- if (projectPositionNames.size() > 1) {
|
|
|
|
- record.setProjectPositionName(name + "等" + projectPositionNames.size() + "个工程部位信息");
|
|
|
|
|
|
+ //关联取样ids
|
|
|
|
+ String sql = "select sampling_id from u_trial_self_sample where self_id = " + record.getId();
|
|
|
|
+ List<Long> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialSelfSample.class)).stream().map(TrialSelfSample::getSamplingId).collect(Collectors.toList());
|
|
|
|
+ if (query.size() > 0) {
|
|
|
|
+ record.setSampleIds(org.apache.commons.lang.StringUtils.join(query, ","));
|
|
|
|
+ this.getIsUploadCertificateStatus(record.getSampleIds(), record);
|
|
} else {
|
|
} else {
|
|
- record.setProjectPositionName(name);
|
|
|
|
|
|
+ record.setIsUploadCertificate(-1);
|
|
|
|
+ record.setIsUploadCertificateName(""); //没关联材料显示null
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- //关联取样ids
|
|
|
|
- String sql = "select sampling_id from u_trial_self_sample where self_id = " + record.getId();
|
|
|
|
- List<Long> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialSelfSample.class)).stream().map(TrialSelfSample::getSamplingId).collect(Collectors.toList());
|
|
|
|
- if (query.size() > 0) {
|
|
|
|
- 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, ","));
|
|
|
|
+ }
|
|
|
|
|
|
- //原材料检测报告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);
|
|
}
|
|
}
|
|
|
|
|
|
- //合并的pdfUrl
|
|
|
|
- String pdf = this.getMergePdfToTrial(record.getContractId(), record.getId());
|
|
|
|
- record.setPdfUrl(pdf);
|
|
|
|
|
|
+ return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
}
|
|
}
|
|
- return trialSelfInspectionRecordVOIPage.setRecords(records);
|
|
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void getIsUploadCertificateStatus(String sampleIds, TrialSelfInspectionRecordVO record) {
|
|
|
|
+ List<TrialSamplingRecord> mobilizationIds = jdbcTemplate.query("select mobilization_id from u_trial_sampling_record where sample_info_id in(" + sampleIds + ")", new BeanPropertyRowMapper<>(TrialSamplingRecord.class));
|
|
|
|
+ if (mobilizationIds.size() > 0) {
|
|
|
|
+ List<Long> collect = mobilizationIds.stream().map(TrialSamplingRecord::getMobilizationId).collect(Collectors.toList());
|
|
|
|
+ String join = org.apache.commons.lang.StringUtils.join(collect, ",");
|
|
|
|
+ List<TrialMaterialMobilization> mobilizations = jdbcTemplate.query("select production_certificate from u_trial_material_mobilization where id in(" + join + ")", new BeanPropertyRowMapper<>(TrialMaterialMobilization.class));
|
|
|
|
+ List<TrialMaterialMobilization> notUpdate = mobilizations.stream().filter(f -> ObjectUtils.isEmpty(f.getProductionCertificate())).collect(Collectors.toList());
|
|
|
|
+ if (notUpdate.size() != 0) {
|
|
|
|
+ record.setIsUploadCertificate(1);
|
|
|
|
+ record.setIsUploadCertificateName("是");
|
|
|
|
+ } else {
|
|
|
|
+ record.setIsUploadCertificate(0);
|
|
|
|
+ record.setIsUploadCertificateName("否");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private String getMergePdfToTrial(Long contractId, Long nodeId) throws FileNotFoundException {
|
|
private String getMergePdfToTrial(Long contractId, Long nodeId) throws FileNotFoundException {
|
|
@@ -224,12 +261,20 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
for (Attach attach : query) {
|
|
for (Attach attach : query) {
|
|
if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getOtherAccessories()) && sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
|
|
if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getOtherAccessories()) && sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
|
|
sampleAncillaryDocumentsVO.setOtherAccessoriesName(attach.getOriginalName());
|
|
sampleAncillaryDocumentsVO.setOtherAccessoriesName(attach.getOriginalName());
|
|
|
|
+ } else if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getOtherAccessories()) && !sampleAncillaryDocumentsVO.getOtherAccessories().equals(attach.getLink())) {
|
|
|
|
+ sampleAncillaryDocumentsVO.setOtherAccessoriesName(sampleAncillaryDocumentsVO.getOtherAccessories());
|
|
}
|
|
}
|
|
|
|
+
|
|
if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getProductionCertificate()) && sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
|
|
if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getProductionCertificate()) && sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
|
|
sampleAncillaryDocumentsVO.setProductionCertificateName(attach.getOriginalName());
|
|
sampleAncillaryDocumentsVO.setProductionCertificateName(attach.getOriginalName());
|
|
|
|
+ } else if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getProductionCertificate()) && !sampleAncillaryDocumentsVO.getProductionCertificate().equals(attach.getLink())) {
|
|
|
|
+ sampleAncillaryDocumentsVO.setProductionCertificateName(sampleAncillaryDocumentsVO.getProductionCertificate());
|
|
}
|
|
}
|
|
|
|
+
|
|
if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getQualityInspectionReport()) && sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
|
|
if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getQualityInspectionReport()) && sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
|
|
sampleAncillaryDocumentsVO.setQualityInspectionReportName(attach.getOriginalName());
|
|
sampleAncillaryDocumentsVO.setQualityInspectionReportName(attach.getOriginalName());
|
|
|
|
+ } else if (StringUtils.isNotEmpty(sampleAncillaryDocumentsVO.getQualityInspectionReport()) && !sampleAncillaryDocumentsVO.getQualityInspectionReport().equals(attach.getLink())) {
|
|
|
|
+ sampleAncillaryDocumentsVO.setQualityInspectionReportName(sampleAncillaryDocumentsVO.getQualityInspectionReport());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -407,64 +452,62 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Async
|
|
@Async
|
|
- public void updateTrialSelfInspectionRecordStatus(String pdfUrlEVisa, List<TaskApprovalVO> obj) throws FileNotFoundException {
|
|
|
|
- for (TaskApprovalVO taskApprovalVO : obj) {
|
|
|
|
- if (ObjectUtil.isNotEmpty(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);
|
|
|
|
- if (taskParallel != null && ObjectUtil.isNotEmpty(taskParallel.getProcessInstanceId())) {
|
|
|
|
- String trialSelfInspectionRecordId = baseMapper.selectTaskByTaskId(taskParallel.getProcessInstanceId());
|
|
|
|
- if (StringUtils.isNotEmpty(trialSelfInspectionRecordId)) {
|
|
|
|
- this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
|
|
- .set(TrialSelfInspectionRecord::getTaskStatus, "OK".equals(taskApprovalVO.getFlag()) ? "已审批" : "已废除")
|
|
|
|
- .set(TrialSelfInspectionRecord::getPdfUrl, pdfUrlEVisa) //pdfUrlEVisa=电签后的pdf
|
|
|
|
- .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());
|
|
|
|
- }
|
|
|
|
|
|
+ public void updateTrialSelfInspectionRecordStatus(String pdfUrlEVisa, TaskApprovalVO obj) throws FileNotFoundException {
|
|
|
|
+ if (ObjectUtil.isNotEmpty(obj.getParallelProcessInstanceId())) {
|
|
|
|
+ String sql = "select process_instance_id from u_task_parallel where parallel_process_instance_id = '" + obj.getParallelProcessInstanceId() + "'";
|
|
|
|
+ TaskParallel taskParallel = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TaskParallel.class)).stream().findAny().orElse(null);
|
|
|
|
+ if (taskParallel != null && ObjectUtil.isNotEmpty(taskParallel.getProcessInstanceId())) {
|
|
|
|
+ String trialSelfInspectionRecordId = baseMapper.selectTaskByTaskId(taskParallel.getProcessInstanceId());
|
|
|
|
+ if (StringUtils.isNotEmpty(trialSelfInspectionRecordId)) {
|
|
|
|
+ this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
|
|
+ .set(TrialSelfInspectionRecord::getTaskStatus, "已审批")
|
|
|
|
+ .set(TrialSelfInspectionRecord::getPdfUrl, pdfUrlEVisa) //pdfUrlEVisa=电签后的pdf
|
|
|
|
+ .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());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -475,6 +518,25 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void updateTrialSelfInspectionRecordStatusFC(TaskApprovalVO obj) {
|
|
|
|
+ if (ObjectUtil.isNotEmpty(obj.getParallelProcessInstanceId())) {
|
|
|
|
+ String sql = "select process_instance_id from u_task_parallel where parallel_process_instance_id = '" + obj.getParallelProcessInstanceId() + "'";
|
|
|
|
+ TaskParallel taskParallel = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TaskParallel.class)).stream().findAny().orElse(null);
|
|
|
|
+ if (taskParallel != null && ObjectUtil.isNotEmpty(taskParallel.getProcessInstanceId())) {
|
|
|
|
+ String trialSelfInspectionRecordId = baseMapper.selectTaskByTaskId(taskParallel.getProcessInstanceId());
|
|
|
|
+ if (StringUtils.isNotEmpty(trialSelfInspectionRecordId)) {
|
|
|
|
+ this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
|
|
|
|
+ .set(TrialSelfInspectionRecord::getTaskStatus, "已废除")
|
|
|
|
+ .eq(TrialSelfInspectionRecord::getId, trialSelfInspectionRecordId)
|
|
|
|
+ );
|
|
|
|
+ //废除后修改电签为null
|
|
|
|
+ jdbcTemplate.execute("update u_information_query set e_visa_pdf_url = null where wbs_id = " + trialSelfInspectionRecordId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String
|
|
public String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String
|
|
projectId, String classify, String id, String tableType) throws Exception {
|
|
projectId, String classify, String id, String tableType) throws Exception {
|
|
@@ -610,12 +672,12 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
|
|
public String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
|
|
|
|
+ //------初始当前填报的表pKeyIds------
|
|
|
|
+ this.initTrialTabIds(dto);
|
|
|
|
+
|
|
//------初始编号信息------
|
|
//------初始编号信息------
|
|
this.initBuildNumber(dto);
|
|
this.initBuildNumber(dto);
|
|
|
|
|
|
- //------初始当前填报的表------
|
|
|
|
- this.initTrialTabIds(dto);
|
|
|
|
-
|
|
|
|
//------新增或编辑------
|
|
//------新增或编辑------
|
|
this.saveOrUpdate(dto);
|
|
this.saveOrUpdate(dto);
|
|
|
|
|
|
@@ -659,41 +721,6 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
List<String> ids = tableIds.stream().distinct().collect(Collectors.toList());
|
|
List<String> ids = tableIds.stream().distinct().collect(Collectors.toList());
|
|
String join = org.apache.commons.lang.StringUtils.join(ids, ",");
|
|
String join = org.apache.commons.lang.StringUtils.join(ids, ",");
|
|
dto.setTableIds(join);
|
|
dto.setTableIds(join);
|
|
-
|
|
|
|
- // TODO 如果前端处理了隐藏表入参的情况(即:隐藏表单pKeyId不传),那么接口就不处理
|
|
|
|
- /*//获取按钮状态,是否为隐藏表单,移除隐藏表单(编辑时)
|
|
|
|
- if (ObjectUtils.isNotEmpty(dto.getId())) {
|
|
|
|
- List<TrialSelfDataRecord> tabStatus = jdbcTemplate.query("select is_buss_show,tab_id from u_trial_self_data_record where record_id = " + dto.getId(), new BeanPropertyRowMapper<>(TrialSelfDataRecord.class));
|
|
|
|
- if (tabStatus.size() > 0) {
|
|
|
|
- Map<Long, TrialSelfDataRecord> collect = tabStatus.stream().collect(Collectors.toMap(TrialSelfDataRecord::getTabId, Function.identity()));
|
|
|
|
- List<Long> pKeyIds = Func.toLongList(dto.getTableIds());
|
|
|
|
- List<Long> addPkeyIds = new ArrayList<>();
|
|
|
|
- for (Long pId : pKeyIds) {
|
|
|
|
- TrialSelfDataRecord record = collect.get(pId);
|
|
|
|
- if (record != null) {
|
|
|
|
- //隐藏的不添加
|
|
|
|
- if (!new Integer(2).equals(record.getIsBussShow())) {
|
|
|
|
- addPkeyIds.add(pId);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- //未生成记录的添加进去
|
|
|
|
- addPkeyIds.add(pId);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //重新赋值
|
|
|
|
- String joinNew = org.apache.commons.lang.StringUtils.join(addPkeyIds, ",");
|
|
|
|
- dto.setTableIds(joinNew);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- //获取按钮状态,是否为隐藏表单,移除隐藏表单(新增时)
|
|
|
|
- String tablePkeyIds = dto.getTableIds();
|
|
|
|
- List<WbsTreePrivate> tableList = jdbcTemplate.query("select is_buss_show,p_key_id from m_wbs_tree_private where status = 1 and p_key_id in(" + tablePkeyIds + ")", new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
|
- List<Long> addPkeyIds = tableList.stream().filter(f -> ObjectUtils.isNotEmpty(f.getIsBussShow()) && !(new Integer(2).equals(f.getIsBussShow()))).map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- //重新赋值
|
|
|
|
- String joinNew = org.apache.commons.lang.StringUtils.join(addPkeyIds, ",");
|
|
|
|
- dto.setTableIds(joinNew);
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void reBuildNumber(TrialSelfInspectionRecord obj, TrialSelfInspectionRecordDTO dto) {
|
|
private void reBuildNumber(TrialSelfInspectionRecord obj, TrialSelfInspectionRecordDTO dto) {
|
|
@@ -709,7 +736,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
@Async
|
|
@Async
|
|
public void submitTrialData(TrialSelfInspectionRecord obj, TrialSelfInspectionRecordDTO dto) {
|
|
public void submitTrialData(TrialSelfInspectionRecord obj, TrialSelfInspectionRecordDTO dto) {
|
|
try {
|
|
try {
|
|
- String pdfURL = excelTabClient.saveTabData(dto.getIsBatchSave(), dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId(), obj.getTableIds());
|
|
|
|
|
|
+ String pdfURL = excelTabClient.saveTabData(dto, dto.getIsBatchSave(), dto.getType(), dto.getTableType(), dto.getId(), obj.getTableIds());
|
|
if (StringUtils.isNotEmpty(pdfURL)) {
|
|
if (StringUtils.isNotEmpty(pdfURL)) {
|
|
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()));
|
|
}
|
|
}
|
|
@@ -854,6 +881,13 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
List<TrialSelfInspectionRecord> result = 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());
|
|
List<TrialSelfInspectionRecord> trialSelfInspectionRecords = result.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
|
|
|
|
|
+ //解决如果当前类型没有表,那么不生成编号
|
|
|
|
+ /*String tableIds = dto.getTableIds();
|
|
|
|
+ List<WbsTreePrivate> recordTab = jdbcTemplate.query("select table_type from m_wbs_tree_private where table_type is not null and p_key_id in (" + tableIds + ")", new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
|
+ List<Integer> collect = recordTab.stream().map(WbsTreePrivate::getTableType).distinct().collect(Collectors.toList());
|
|
|
|
+ String tabType = org.apache.commons.lang.StringUtils.join(collect, ",");
|
|
|
|
+ dto.setTableType(tabType);*/
|
|
|
|
+
|
|
//两种类型同时生成
|
|
//两种类型同时生成
|
|
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 = "";
|