liuyc 2 yıl önce
ebeveyn
işleme
8c8fc4a8b3

+ 11 - 9
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -593,15 +593,17 @@ public class InformationWriteQueryController extends BladeController {
                     break;
             }
         } else {
-            //查询表格
-            String sql = "select is_tab_pdf from u_trial_self_data_record where record_id = " + id;
-            List<TrialSelfDataRecord> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialSelfDataRecord.class));
-            if (query.size() > 0) {
-                for (TrialSelfDataRecord info : query) {
-                    if (new Integer("2").equals(info.getIsTabPdf())) {
-                        //这些表格中,但凡有一个能够预览,就开放预览
-                        status = "2";
-                        break;
+            if (StringUtils.isNotEmpty(id)) {
+                //查询表格
+                String sql = "select is_tab_pdf from u_trial_self_data_record where record_id = " + id;
+                List<TrialSelfDataRecord> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TrialSelfDataRecord.class));
+                if (query.size() > 0) {
+                    for (TrialSelfDataRecord info : query) {
+                        if (new Integer("2").equals(info.getIsTabPdf())) {
+                            //这些表格中,但凡有一个能够预览,就开放预览
+                            status = "2";
+                            break;
+                        }
                     }
                 }
             }

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/ITaskService.java

@@ -63,7 +63,7 @@ public interface ITaskService extends BaseService<Task> {
     Boolean abolishTask(Task task);
 
     /**
-     * 获取待办任务数量
+     * 获取任务数量
      */
     Map<String,String> getTaskCount(String projectId, String contractId, String userId);
 

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/ITrialSelfInspectionRecordService.java

@@ -8,6 +8,7 @@ import org.springblade.business.dto.TrialSelfInspectionRecordPageDTO;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
 import org.springblade.business.vo.*;
 import org.springblade.core.mp.base.BaseService;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.FileNotFoundException;
@@ -35,6 +36,7 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
     String selfPrintNullPdf(String ids) throws Exception;
 
+    @Async
     void updateTrialSelfInspectionRecordStatus(List<TaskApprovalVO> obj) throws FileNotFoundException;
 
     String addBussFile(MultipartFile file, Long pkeyId, String nodeId, String contractId, String projectId, String classify, String id, String tableType) throws Exception;

+ 12 - 12
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -241,7 +241,7 @@ public class TrialSelfInspectionRecordServiceImpl
                 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) {
+                if (projectPositionNames.size() >= 2) {
                     recordVO2.setProjectPositionName(name + "等" + projectPositionNames.size() + "个工程部位信息");
                 } else {
                     recordVO2.setProjectPositionName(name);
@@ -569,6 +569,7 @@ public class TrialSelfInspectionRecordServiceImpl
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public boolean selfSubmit(TrialSelfInspectionRecordDTO dto) throws Exception {
         if (ObjectUtil.isEmpty(dto.getId())) {
             //构建记录表编号、报告单编号
@@ -592,18 +593,20 @@ public class TrialSelfInspectionRecordServiceImpl
         this.saveOrUpdate(dto);
 
         if (ObjectUtil.isNotEmpty(dto.getId())) {
-            //获取obj
+            //获取当前试验记录信息
             TrialSelfInspectionRecord obj = baseMapper.selectById(dto.getId());
 
+            //已审批任务,关联到工程部位及用途信息
+            this.recordProjectPosition(dto, obj);
+
             try {
                 //保存实体表数据、记录信息、生成pdf
                 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<>();
-                    updateWrapper.set(TrialSelfInspectionRecord::getPdfUrl, pdfURL);
-                    updateWrapper.eq(TrialSelfInspectionRecord::getId, dto.getId());
-                    this.update(null, updateWrapper);
+                    //修改合并pdf
+                    this.update(Wrappers.<TrialSelfInspectionRecord>lambdaUpdate()
+                            .set(TrialSelfInspectionRecord::getPdfUrl, pdfURL)
+                            .eq(TrialSelfInspectionRecord::getId, dto.getId()));
                 }
             } catch (Exception e) {
                 throw new ServiceException("保存实体表数据生成pdf时发生异常 " + e.getMessage());
@@ -612,11 +615,8 @@ public class TrialSelfInspectionRecordServiceImpl
             //关联样品信息
             this.recordSample(dto);
 
-            //已审批任务,关联到工程部位及用途信息
-            this.recordProjectPosition(dto, obj);
-
             //新增设备使用记录信息
-            trialDeviceUseService.addDeviceUseInfo(dto);
+            this.trialDeviceUseService.addDeviceUseInfo(dto);
         }
 
         return true;
@@ -683,7 +683,7 @@ public class TrialSelfInspectionRecordServiceImpl
                     }
                 }
             } else {
-                throw new ServiceException("当前试验记录任务未审批,关联工程部位及用途信息失败");
+                throw new ServiceException("当前试验记录任务未上报审批,关联工程部位及用途信息失败");
             }
         }
     }