|
@@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.spire.xls.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang.time.DateUtils;
|
|
|
-import org.apache.poi.hssf.record.DVALRecord;
|
|
|
import org.springblade.business.dto.RawMaterialSubmitRelationDTO;
|
|
|
import org.springblade.business.dto.TrialFileSubmitDTO;
|
|
|
import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
|
|
@@ -217,28 +216,46 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
List<TrialSelfInspectionRecordVO2> recordVO2s = BeanUtil.copyProperties(result, TrialSelfInspectionRecordVO2.class);
|
|
|
List<Long> collect = result.stream().map(TrialSelfInspectionRecord::getId).collect(Collectors.toList());
|
|
|
String ids = org.apache.commons.lang.StringUtils.join(collect, ",");
|
|
|
- String sql = "select raw_material_record_id from u_trial_raw_material_self_record where self_record_id in(" + ids + ")";
|
|
|
- List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
- List<Object> idsRecord = new ArrayList<>();
|
|
|
- for (Map<String, Object> map : maps) {
|
|
|
- for (Map.Entry<String, Object> obj : map.entrySet()) {
|
|
|
- idsRecord.add(obj.getValue());
|
|
|
+ if (StringUtils.isNotEmpty(ids)) {
|
|
|
+ String sql = "select raw_material_record_id from u_trial_raw_material_self_record where self_record_id in (" + ids + ")";
|
|
|
+ List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
|
|
|
+ List<Object> idsRecord = new ArrayList<>();
|
|
|
+
|
|
|
+ for (Map<String, Object> map : maps) {
|
|
|
+ for (Map.Entry<String, Object> obj : map.entrySet()) {
|
|
|
+ idsRecord.add(obj.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Object id : idsRecord) {
|
|
|
+ for (TrialSelfInspectionRecordVO2 recordVO2 : recordVO2s) {
|
|
|
+ if (id.equals(recordVO2.getId())) {
|
|
|
+ recordVO2.setIsRawMaterialRelation(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- for (Object id : idsRecord) {
|
|
|
- for (TrialSelfInspectionRecordVO2 recordVO2 : recordVO2s) {
|
|
|
- if (id.equals(recordVO2.getId())) {
|
|
|
- recordVO2.setIsRawMaterialRelation(1);
|
|
|
+
|
|
|
+ for (TrialSelfInspectionRecordVO2 recordVO2 : recordVO2s) {
|
|
|
+ if (StringUtils.isNotEmpty(recordVO2.getProjectPosition())) {
|
|
|
+ List<String> idsP = Func.toStrList(recordVO2.getProjectPosition()); //关联的工程部位ids
|
|
|
+ List<WbsTreeContract> resultNode = baseMapper.selectWbsTreeContractListByPKeyIds(idsP); //查询工程部位节点名称信息
|
|
|
+ List<String> projectPositionNames = resultNode.stream().map(WbsTreeContract::getNodeName).collect(Collectors.toList());
|
|
|
+ String name = projectPositionNames.stream().findAny().orElse(null);
|
|
|
+ if (projectPositionNames.size() > 1) {
|
|
|
+ recordVO2.setProjectPositionName(name + "等" + projectPositionNames.size() + "个工程部位信息");
|
|
|
+ } else {
|
|
|
+ recordVO2.setProjectPositionName(name);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return recordVO2s;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto) throws FileNotFoundException {
|
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
|
- throw new ServiceException("请先保存填报数据后再关联原材检测报告!");
|
|
|
+ throw new ServiceException("请先保存填报数据后再关联原材检测报告");
|
|
|
}
|
|
|
//删除关系
|
|
|
String sql1 = "delete from u_trial_raw_material_self_record where self_record_id ='" + dto.getId() + "'";
|
|
@@ -257,58 +274,63 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, ids).eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
List<String> listPDFURL = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
- //合并PDF
|
|
|
- String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String listPdf = filePath + "/pdf/" + dto.getNodeId() + ".pdf";
|
|
|
- File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
- if (tabPDF.exists()) {
|
|
|
- tabPDF.delete();
|
|
|
- }
|
|
|
- FileUtils.mergePdfPublicMethods(listPDFURL, listPdf);
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(dto.getNodeId() + ".pdf", listPdf);
|
|
|
-
|
|
|
- //获取试验记录id的试验项目名称
|
|
|
- List<String> collect = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getTrialProjectName).collect(Collectors.toList());
|
|
|
- String oneName = collect.stream().findAny().orElse(null);
|
|
|
- String trialProjectName = "";
|
|
|
- if (StringUtils.isNotEmpty(oneName)) {
|
|
|
- trialProjectName = oneName + "等" + collect.size() + "个文件";
|
|
|
- }
|
|
|
-
|
|
|
- if (ObjectUtil.isNotEmpty(bladeFile)) {
|
|
|
- //修改pdfURL
|
|
|
- String querySql = "select * from u_information_query where classify='" + dto.getType() + "' and wbs_id='" + dto.getNodeId() + "' 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.getNodeId() + "' and contract_id ='" + dto.getContractId() + "'";
|
|
|
- jdbcTemplate.execute(sql3);
|
|
|
+ if (listPDFURL.size() > 0) {
|
|
|
+ //合并PDF
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + dto.getNodeId() + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(listPDFURL, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(dto.getNodeId() + ".pdf", listPdf);
|
|
|
+
|
|
|
+ //获取试验记录id的试验项目名称
|
|
|
+ List<String> collect = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getTrialProjectName).collect(Collectors.toList());
|
|
|
+ String oneName = collect.stream().findAny().orElse(null);
|
|
|
+ String trialProjectName = "";
|
|
|
+ if (StringUtils.isNotEmpty(oneName)) {
|
|
|
+ trialProjectName = oneName + "等" + collect.size() + "个文件";
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
} else {
|
|
|
- informationQueryClient.saveData(dto.getNodeId(), dto.getProjectId(), dto.getContractId(), String.valueOf(dto.getType()), bladeFile.getLink(), trialProjectName);
|
|
|
+ //删除关系
|
|
|
+ jdbcTemplate.execute(sql1);
|
|
|
+ return false;
|
|
|
}
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- //删除关系
|
|
|
- jdbcTemplate.execute(sql1);
|
|
|
- return false;
|
|
|
}
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String selfPrintPdf(String ids) throws FileNotFoundException {
|
|
|
List<TrialSelfInspectionRecord> recordList = baseMapper.selectList(Wrappers.<TrialSelfInspectionRecord>lambdaQuery().in(TrialSelfInspectionRecord::getId, Func.toLongList(ids)).eq(TrialSelfInspectionRecord::getStatus, 1));
|
|
|
List<String> listPdfUrl = recordList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getPdfUrl())).map(TrialSelfInspectionRecord::getPdfUrl).collect(Collectors.toList());
|
|
|
- //合并PDF
|
|
|
- Long id = SnowFlakeUtil.getId();
|
|
|
- String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String listPdf = filePath + "/pdf/" + id + ".pdf";
|
|
|
- File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
- if (tabPDF.exists()) {
|
|
|
- tabPDF.delete();
|
|
|
- }
|
|
|
- FileUtils.mergePdfPublicMethods(listPdfUrl, listPdf);
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", listPdf);
|
|
|
- if (bladeFile != null) {
|
|
|
- return bladeFile.getLink();
|
|
|
+ if (listPdfUrl.size() > 0) {
|
|
|
+ //合并PDF
|
|
|
+ Long id = SnowFlakeUtil.getId();
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + id + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(listPdfUrl, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ return bladeFile.getLink();
|
|
|
+ }
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -354,50 +376,59 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
public void updateTrialSelfInspectionRecordStatus(List<TaskApprovalVO> obj) throws FileNotFoundException {
|
|
|
for (TaskApprovalVO taskApprovalVO : obj) {
|
|
|
if (ObjectUtil.isNotEmpty(taskApprovalVO.getParallelProcessInstanceId())) {
|
|
|
- String trialSelfInspectionRecordId = baseMapper.selectTaskByTaskId(taskApprovalVO.getParallelProcessInstanceId());
|
|
|
- if (StringUtils.isNotEmpty(trialSelfInspectionRecordId)) {
|
|
|
- LambdaUpdateWrapper<TrialSelfInspectionRecord> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.set(TrialSelfInspectionRecord::getTaskStatus, "OK".equals(taskApprovalVO.getFlag()) ? "已审批" : "已废除");
|
|
|
- updateWrapper.eq(TrialSelfInspectionRecord::getId, trialSelfInspectionRecordId);
|
|
|
- baseMapper.update(null, updateWrapper);
|
|
|
-
|
|
|
- TrialSelfInspectionRecord entity = updateWrapper.getEntity();
|
|
|
-
|
|
|
- //把当前试验的PDF合并关联到质检树节点下
|
|
|
- if (ObjectUtil.isNotEmpty(entity) && ("已审批").equals(entity.getTaskStatus())) {
|
|
|
- List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(trialSelfInspectionRecordId);
|
|
|
-
|
|
|
- for (String id : contractNodePKeyIds) {
|
|
|
- WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(id);
|
|
|
- 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 pdfUrlAll = baseMapper.selectInformationQuery(id, wbsTreeContract.getContractId(), classify);
|
|
|
- //质检节点合并pdfUrl
|
|
|
- pdfUrlList.add(pdfUrlAll);
|
|
|
- //试验pdfUrl
|
|
|
- pdfUrlList.add(ObjectUtil.isNotEmpty(entity.getPdfUrl()) ? entity.getPdfUrl() : "");
|
|
|
-
|
|
|
- //合并PDF
|
|
|
- String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String listPdf = filePath + "/pdf/" + id + ".pdf";
|
|
|
- File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
- if (tabPDF.exists()) {
|
|
|
- tabPDF.delete();
|
|
|
+ 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);
|
|
|
+ assert taskParallel != null;
|
|
|
+ if (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()) ? "已审批" : "已废除")
|
|
|
+ .eq(TrialSelfInspectionRecord::getId, trialSelfInspectionRecordId)
|
|
|
+ );
|
|
|
+
|
|
|
+ /*TrialSelfInspectionRecord entity = this.baseMapper.selectById(trialSelfInspectionRecordId);
|
|
|
+ //把当前试验的PDF合并关联到质检树节点下
|
|
|
+ if (ObjectUtil.isNotEmpty(entity) && ("已审批").equals(entity.getTaskStatus())) {
|
|
|
+ List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(trialSelfInspectionRecordId);
|
|
|
+
|
|
|
+ for (String id : contractNodePKeyIds) {
|
|
|
+ if (StringUtils.isEmpty(entity.getPdfUrl())) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- FileUtils.mergePdfPublicMethods(pdfUrlList, listPdf);
|
|
|
- BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", listPdf);
|
|
|
- if (bladeFile != null) {
|
|
|
- //修改质检合并pdfURL
|
|
|
- baseMapper.updateInformationQuery(id, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
|
|
|
+
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(id);
|
|
|
+ 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 pdfUrlAll = baseMapper.selectInformationQuery(id, wbsTreeContract.getContractId(), classify);
|
|
|
+ //质检节点合并pdfUrl
|
|
|
+ pdfUrlList.add(pdfUrlAll);
|
|
|
+ //试验pdfUrl
|
|
|
+ pdfUrlList.add(entity.getPdfUrl());
|
|
|
+
|
|
|
+ //合并PDF
|
|
|
+ String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
+ String listPdf = filePath + "/pdf/" + id + ".pdf";
|
|
|
+ File tabPDF = ResourceUtil.getFile(listPdf);
|
|
|
+ if (tabPDF.exists()) {
|
|
|
+ tabPDF.delete();
|
|
|
+ }
|
|
|
+ FileUtils.mergePdfPublicMethods(pdfUrlList, listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(id + ".pdf", listPdf);
|
|
|
+ if (bladeFile != null) {
|
|
|
+ //修改质检合并pdfURL
|
|
|
+ baseMapper.updateInformationQuery(trialSelfInspectionRecordId, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -538,35 +569,35 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- /*@Transactional(rollbackFor = Exception.class)*/
|
|
|
public boolean selfSubmit(TrialSelfInspectionRecordDTO dto) throws Exception {
|
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
|
//构建记录表编号、报告单编号
|
|
|
this.buildNumber(dto);
|
|
|
|
|
|
- //任务流程状态初始化
|
|
|
- dto.setTaskStatus("待审批");
|
|
|
- }
|
|
|
+ //任务流程状态初始化未上报
|
|
|
+ dto.setTaskStatus("未上报");
|
|
|
|
|
|
- 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);
|
|
|
+ //初始化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);
|
|
|
}
|
|
|
- String join = org.apache.commons.lang.StringUtils.join(tableIds, ",");
|
|
|
- dto.setTableIds(join);
|
|
|
-
|
|
|
- /*//只修改基础信息,未修改表信息
|
|
|
- if (dataArray.size() == 0) {
|
|
|
- return this.saveOrUpdate(dto);
|
|
|
- }*/
|
|
|
|
|
|
//关联新增或修改了表信息
|
|
|
- if (this.saveOrUpdate(dto)) {
|
|
|
+ this.saveOrUpdate(dto);
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getId())) {
|
|
|
+ //获取obj
|
|
|
+ TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
|
|
|
+
|
|
|
try {
|
|
|
//保存实体表数据、记录信息、生成pdf
|
|
|
- String pdfURL = excelTabClient.saveTabData(dto.getIsBatchSave(), dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId(), dto.getTableIds());
|
|
|
+ String pdfURL = excelTabClient.saveTabData(dto.getIsBatchSave(), dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId(), obj.getTableIds());
|
|
|
//返回合并pdfURL
|
|
|
if (StringUtils.isNotEmpty(pdfURL)) {
|
|
|
LambdaUpdateWrapper<TrialSelfInspectionRecord> updateWrapper = new LambdaUpdateWrapper<>();
|
|
@@ -575,19 +606,15 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
this.update(null, updateWrapper);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ throw new ServiceException("保存实体表数据生成pdf时发生异常 " + e.getMessage());
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (ObjectUtil.isNotEmpty(dto.getId())) {
|
|
|
//关联样品信息
|
|
|
this.recordSample(dto);
|
|
|
|
|
|
- //关联工程部位及用途信息
|
|
|
- this.recordProjectPosition(dto);
|
|
|
- }
|
|
|
+ //已审批任务,关联到工程部位及用途信息
|
|
|
+ this.recordProjectPosition(dto, obj);
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(dto.getDeviceUseIds())) {
|
|
|
//新增设备使用记录信息
|
|
|
trialDeviceUseService.addDeviceUseInfo(dto);
|
|
|
}
|
|
@@ -605,21 +632,22 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void recordProjectPosition(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
|
|
|
+ private void recordProjectPosition(TrialSelfInspectionRecordDTO dto, TrialSelfInspectionRecord obj) throws FileNotFoundException {
|
|
|
if (StringUtils.isNotEmpty(dto.getProjectPosition())) {
|
|
|
- baseMapper.delSelfQuality(dto.getId()); //删除关联信息
|
|
|
- List<String> ids = Func.toStrList(dto.getProjectPosition());
|
|
|
- for (String id : ids) { //新增关联信息
|
|
|
- baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), dto.getId(), id);
|
|
|
- }
|
|
|
-
|
|
|
+ dto.setTaskStatus(obj.getTaskStatus());
|
|
|
//已审批填报记录
|
|
|
if (("已审批").equals(dto.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()));
|
|
|
|
|
|
- for (String id : contractNodePKeyIds) {
|
|
|
- WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(id);
|
|
|
+ for (String pKeyId : contractNodePKeyIds) {
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractClient.getContractNodeByPrimaryKeyId(pKeyId);
|
|
|
if (wbsTreeContract != null) {
|
|
|
List<String> pdfUrlList = new ArrayList<>();
|
|
|
String classify;
|
|
@@ -628,27 +656,34 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
} else {
|
|
|
classify = "2";
|
|
|
}
|
|
|
- String pdfUrlAll = baseMapper.selectInformationQuery(id, wbsTreeContract.getContractId(), classify);
|
|
|
+ String pdfUrlNodeAll = baseMapper.selectInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify);
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(pdfUrlNodeAll) || StringUtils.isEmpty(obj.getPdfUrl())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
//质检节点合并pdfUrl
|
|
|
- pdfUrlList.add(pdfUrlAll);
|
|
|
+ pdfUrlList.add(pdfUrlNodeAll);
|
|
|
//试验pdfUrl
|
|
|
- pdfUrlList.add(ObjectUtil.isNotEmpty(dto.getPdfUrl()) ? dto.getPdfUrl() : "");
|
|
|
+ pdfUrlList.add(obj.getPdfUrl());
|
|
|
|
|
|
//合并PDF
|
|
|
String filePath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
|
- String listPdf = filePath + "/pdf/" + id + ".pdf";
|
|
|
+ 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(id + ".pdf", listPdf);
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(pKeyId + ".pdf", listPdf);
|
|
|
if (bladeFile != null) {
|
|
|
- //修改质检合并pdfURL
|
|
|
- baseMapper.updateInformationQuery(id, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
|
|
|
+ //修改质检树合并后的pdfURL
|
|
|
+ baseMapper.updateInformationQuery(pKeyId, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("当前试验记录任务未审批,关联工程部位及用途信息失败");
|
|
|
}
|
|
|
}
|
|
|
}
|