|
@@ -46,6 +46,7 @@ import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -283,6 +284,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Async
|
|
|
public boolean rawMaterialSubmitRelation(RawMaterialSubmitRelationDTO dto) throws FileNotFoundException {
|
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
|
throw new ServiceException("请先保存填报数据后,再关联原材检测报告信息");
|
|
@@ -456,7 +458,8 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateTrialSelfInspectionRecordStatus(List<TaskApprovalVO> obj) {
|
|
|
+ @Async
|
|
|
+ public void updateTrialSelfInspectionRecordStatus(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() + "'";
|
|
@@ -468,6 +471,58 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
.set(TrialSelfInspectionRecord::getTaskStatus, "OK".equals(taskApprovalVO.getFlag()) ? "已审批" : "已废除")
|
|
|
.eq(TrialSelfInspectionRecord::getId, trialSelfInspectionRecordId)
|
|
|
);
|
|
|
+
|
|
|
+ //TODO ------审批通过且合格的自检记录信息,关联到施工质检节点上------
|
|
|
+ TrialSelfInspectionRecord record = baseMapper.selectById(trialSelfInspectionRecordId);
|
|
|
+ if (("已审批").equals(record.getTaskStatus()) && (new Integer(1)).equals(record.getDetectionResult()) && (new Integer(1)).equals(record.getDetectionCategory())) {
|
|
|
+ //删除关联信息
|
|
|
+ baseMapper.delSelfQuality(record.getId());
|
|
|
+
|
|
|
+ List<String> ids = Func.toStrList(record.getProjectPosition());
|
|
|
+ //新增关联信息
|
|
|
+ for (String id : ids) {
|
|
|
+ baseMapper.saveSelfQuality(SnowFlakeUtil.getId(), record.getId(), id);
|
|
|
+ }
|
|
|
+
|
|
|
+ //把当前试验的PDF合并关联到质检树节点下
|
|
|
+ List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(String.valueOf(record.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(record.getPdfUrl())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //质检节点合并pdfUrl
|
|
|
+ pdfUrlList.add(pdfUrlNodeAll);
|
|
|
+ //试验pdfUrl
|
|
|
+ pdfUrlList.add(record.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());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -608,48 +663,31 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String selfSubmit(TrialSelfInspectionRecordDTO dto) {
|
|
|
+ public String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
|
|
|
if (ObjectUtil.isEmpty(dto.getId()) && StringUtils.isNotEmpty(dto.getTableType())) {
|
|
|
//构建记录表编号、报告单编号
|
|
|
this.buildNumber(dto);
|
|
|
|
|
|
//任务流程状态初始化未上报
|
|
|
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);
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(dto.getId())) {
|
|
|
//获取当前最新的试验记录信息
|
|
|
TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
|
|
|
|
|
|
- //编辑时处理表单pKeyIds问题 TODO 如果前端传全pKeyId就不需要该逻辑
|
|
|
- if (StringUtils.isNotEmpty(obj.getTableIds())) {
|
|
|
- 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);
|
|
|
- }
|
|
|
- List<String> ids = Func.toStrList(obj.getTableIds());
|
|
|
- tableIds.addAll(ids);
|
|
|
-
|
|
|
- List<String> tabIds = tableIds.stream().distinct().collect(Collectors.toList());
|
|
|
- dto.setTableIds(org.apache.commons.lang.StringUtils.join(tabIds, ","));
|
|
|
- //更新当前记录绑定的最新的表单
|
|
|
- this.saveOrUpdate(dto);
|
|
|
- obj.setTableIds(dto.getTableIds());
|
|
|
- }
|
|
|
-
|
|
|
//编辑时生成记录表编号或报告单编号,如果新增时不是两种类型表都填报过,那么有一项编号为Null
|
|
|
if (StringUtils.isEmpty(obj.getRecordNo()) && dto.getTableType().contains("1")) {
|
|
|
this.buildNumber(dto);
|
|
@@ -659,20 +697,53 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
this.saveOrUpdate(dto);
|
|
|
}
|
|
|
|
|
|
- //保存实体表数据、试验记录信息、生成pdf
|
|
|
+ //TODO ------保存实体表数据、试验记录信息、生成pdf------
|
|
|
try {
|
|
|
String pdfURL = excelTabClient.saveTabData(dto.getIsBatchSave(), dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId(), obj.getTableIds());
|
|
|
if (StringUtils.isNotEmpty(pdfURL)) {
|
|
|
//修改合并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) {
|
|
|
- throw new ServiceException("保存实体表数据生成pdf时发生异常 " + e.getMessage());
|
|
|
+ throw new ServiceException("保存实体表数据生成pdf时发生异常" + e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ //TODO ------关联工程及用途关系新增或删除------
|
|
|
+ if (StringUtils.isEmpty(obj.getProjectPosition())) {
|
|
|
+ String delSql = "delete from u_trial_self_quality_project where self_id = " + obj.getId();
|
|
|
+ jdbcTemplate.execute(delSql);
|
|
|
+ } else {
|
|
|
+ List<Long> recordIds = Func.toLongList(obj.getProjectPosition());
|
|
|
+ String delSql = "delete from u_trial_self_quality_project where self_id = " + obj.getId();
|
|
|
+ jdbcTemplate.execute(delSql);
|
|
|
+ //保留新增
|
|
|
+ for (Long recordNodeId : recordIds) {
|
|
|
+ String insertSql = "insert into u_trial_self_quality_project(id,self_id,quality_node_id) values (" + SnowFlakeUtil.getId() + "," + obj.getId() + "," + recordNodeId + ")";
|
|
|
+ jdbcTemplate.execute(insertSql);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //TODO ------关联原材料检测报告------
|
|
|
+ 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());
|
|
|
+ if (StringUtils.isNotEmpty(relationDTO.getIds())) {
|
|
|
+ this.rawMaterialSubmitRelation(relationDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ //TODO ------关联取样信息------
|
|
|
+ RecordSampleSubmitDTO recordSampleSubmitDTO = new RecordSampleSubmitDTO();
|
|
|
+ recordSampleSubmitDTO.setId(obj.getId());
|
|
|
+ recordSampleSubmitDTO.setSampleIds(dto.getSampleIds());
|
|
|
+ if (StringUtils.isNotEmpty(relationDTO.getIds())) {
|
|
|
+ this.recordSampleSubmit(recordSampleSubmitDTO);
|
|
|
}
|
|
|
|
|
|
- //新增设备使用记录信息
|
|
|
+ //TODO ------新增设备使用记录信息------
|
|
|
this.trialDeviceUseService.addDeviceUseInfo(dto);
|
|
|
}
|
|
|
|
|
@@ -681,6 +752,7 @@ public class TrialSelfInspectionRecordServiceImpl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Async
|
|
|
public boolean recordSampleSubmit(RecordSampleSubmitDTO dto) {
|
|
|
if (ObjectUtil.isEmpty(dto.getId())) {
|
|
|
throw new ServiceException("请先保存填报数据后,再关联取样信息");
|