liuyc 2 жил өмнө
parent
commit
4e61b5ac4b

+ 2 - 3
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -113,8 +113,8 @@ public class TrialDetectionController extends BladeController {
 
     @PostMapping("/self/update-ancillary-documents")
     @ApiOperationSupport(order = 10)
-    @ApiOperation(value = "自检记录批量修改附件", notes = "传入List<SampleAncillaryDocumentsVO>集合")
-    public R<Object> selfUpdateAncillaryDocuments(@Valid @RequestBody List<SampleAncillaryDocumentsVO> vo) {
+    @ApiOperation(value = "自检记录修改附件", notes = "传入SampleAncillaryDocumentsVO")
+    public R<Object> selfUpdateAncillaryDocuments(@Valid @RequestBody SampleAncillaryDocumentsVO vo) {
         return R.status(iTrialSelfInspectionRecordService.selfUpdateAncillaryDocuments(vo));
     }
 
@@ -187,7 +187,6 @@ public class TrialDetectionController extends BladeController {
         } else {
             return R.fail("无历史数据预览,请保存数据");
         }
-
     }
 
     @GetMapping("/self/raw-material/tree")

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

@@ -23,7 +23,7 @@ public interface ITrialSelfInspectionRecordService extends BaseService<TrialSelf
 
     List<SampleAncillaryDocumentsVO> selfAncillaryDocumentsList(String id);
 
-    boolean selfUpdateAncillaryDocuments(List<SampleAncillaryDocumentsVO> vo);
+    boolean selfUpdateAncillaryDocuments( SampleAncillaryDocumentsVO vo);
 
     boolean selfCopy(List<Long> toLongList);
 

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

@@ -161,17 +161,16 @@ public class TrialSelfInspectionRecordServiceImpl
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public boolean selfUpdateAncillaryDocuments(List<SampleAncillaryDocumentsVO> vo) {
-        for (SampleAncillaryDocumentsVO sampleAncillaryDocumentsVO : vo) {
-            TrialMaterialMobilization trialMaterialMobilization = trialMaterialMobilizationMapper.selectById(sampleAncillaryDocumentsVO.getId());
-            if (ObjectUtil.isEmpty(trialMaterialMobilization)) {
-                throw new ServiceException("未获取到对应材料信息,修改失败");
-            }
-            trialMaterialMobilization.setQualityInspectionReport(sampleAncillaryDocumentsVO.getQualityInspectionReport());
-            trialMaterialMobilization.setOtherAccessories(sampleAncillaryDocumentsVO.getOtherAccessories());
-            trialMaterialMobilization.setProductionCertificate(sampleAncillaryDocumentsVO.getProductionCertificate());
-            trialMaterialMobilizationMapper.updateById(trialMaterialMobilization);
+    public boolean selfUpdateAncillaryDocuments(SampleAncillaryDocumentsVO vo) {
+        TrialMaterialMobilization trialMaterialMobilization = trialMaterialMobilizationMapper.selectById(vo.getId());
+        if (ObjectUtil.isEmpty(trialMaterialMobilization)) {
+            throw new ServiceException("未获取到对应材料信息,修改失败");
         }
+        trialMaterialMobilization.setQualityInspectionReport(vo.getQualityInspectionReport());
+        trialMaterialMobilization.setOtherAccessories(vo.getOtherAccessories());
+        trialMaterialMobilization.setProductionCertificate(vo.getProductionCertificate());
+        trialMaterialMobilizationMapper.updateById(trialMaterialMobilization);
+
         return true;
     }
 
@@ -536,70 +535,78 @@ public class TrialSelfInspectionRecordServiceImpl
 
         if (ObjectUtil.isNotEmpty(dto.getId())) {
             //关联样品信息
-            if (StringUtils.isNotEmpty(dto.getSampleIds())) {
-                baseMapper.delSelfSample(dto.getId()); //删除关联信息
-                List<String> ids = Func.toStrList(dto.getSampleIds());
-                for (String id : ids) {  //新增关联信息
-                    baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
-                }
-            }
+            this.recordSample(dto);
 
             //关联工程部位及用途信息
-            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);
-                }
-
-                //已审批填报记录
-                if (("已审批").equals(dto.getTaskStatus())) {
-                    //把当前试验的PDF合并关联到质检树节点下
-                    List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(String.valueOf(dto.getId()));
-
-                    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(dto.getPdfUrl()) ? dto.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(id, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
-                            }
-                        }
-                    }
-                }
-            }
+            this.recordProjectPosition(dto);
         }
 
-        //新增设备使用记录信息
         if (StringUtils.isNotEmpty(dto.getDeviceUseIds())) {
+            //新增设备使用记录信息
             trialDeviceUseService.addDeviceUseInfo(dto);
         }
 
         return true;
     }
 
+    private void recordSample(TrialSelfInspectionRecordDTO dto) {
+        if (StringUtils.isNotEmpty(dto.getSampleIds())) {
+            baseMapper.delSelfSample(dto.getId()); //删除关联信息
+            List<String> ids = Func.toStrList(dto.getSampleIds());
+            for (String id : ids) {  //新增关联信息
+                baseMapper.saveSelfSample(SnowFlakeUtil.getId(), dto.getId(), id);
+            }
+        }
+    }
+
+    private void recordProjectPosition(TrialSelfInspectionRecordDTO dto) 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);
+            }
+
+            //已审批填报记录
+            if (("已审批").equals(dto.getTaskStatus())) {
+                //把当前试验的PDF合并关联到质检树节点下
+                List<String> contractNodePKeyIds = baseMapper.selectQualityNodeId(String.valueOf(dto.getId()));
+
+                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(dto.getPdfUrl()) ? dto.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(id, wbsTreeContract.getContractId(), classify, bladeFile.getLink());
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     private void buildNumber(TrialSelfInspectionRecordDTO dto) {
         StringSPUtils spUtils = new StringSPUtils();
         List<TrialSelfInspectionRecord> trialSelfInspectionRecords = baseMapper.selectAll(dto.getNodeId());

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -2611,7 +2611,7 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "id", value = "记录id-当做groupId", required = true)
     })
     public R<List<Map<String, Object>>> getBussDataInfoTrial(Long id, Long pkeyId) {
-        List<Map<String, Object>> bussDataInfoTrial = excelTabService.getBussDataInfoTrial(id, pkeyId);
+        List<Map<String, Object>> bussDataInfoTrial = excelTabService.getBussDataInfoTrial(id, pkeyId );
         return R.data(bussDataInfoTrial);
     }
 

+ 5 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ExcelTabClientImpl.java

@@ -32,8 +32,8 @@ public class ExcelTabClientImpl implements ExcelTabClient {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String saveTabData(JSONObject dataInfo, Integer type, Integer tableType, Long id, String tabIds) throws Exception {
-        JSONArray dataArray = dataInfo.getJSONArray("orderList");
         //通用参数
+        JSONArray dataArray = dataInfo.getJSONArray("orderList");
         JSONObject table = dataArray.getJSONObject(0);
         String nodeId = table.getString("nodeId");
         String projectId = table.getString("projectId");
@@ -76,7 +76,11 @@ public class ExcelTabClientImpl implements ExcelTabClient {
                     projectId,
                     id //记录id
             );
+        } else {
+            //没有表关联,只修改记录信息
+            return pdfUrl;
         }
+
         return pdfUrl;
     }
 

+ 0 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExcelTabService.java

@@ -110,7 +110,6 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
 
 
     // 试验
-
     /**
      * 结果信息持久化 - 试验
      */

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -1203,7 +1203,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             throw new ServiceException("无实体表对应");
         }
 
-        String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " group_id = " + groupId;
+        String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + groupId;
         List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
 
         // 匹配关联
@@ -1612,7 +1612,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     String sqlInfo = "";
                     LinkedHashMap<String, String> dataMap2 = tableInfo.getDataMap();
                     sqlInfo = "INSERT INTO " + tabName + " ( ";
-                    String keyStr = "id,group_id";
+                    String keyStr = "id,group_id,";
                     String valStr = SnowFlakeUtil.getId() + "," + groupId + ",";
                     for (String keys : dataMap2.keySet()) {
                         keyStr += keys + ",";