Browse Source

解决试验样品处理不可用问题、试验自检记录编号问题

lvy 6 days ago
parent
commit
04a585f914

+ 13 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/TrialSampleInfoVO.java

@@ -52,4 +52,17 @@ public class TrialSampleInfoVO extends TrialSampleInfo {
     @ApiModelProperty("试验单id")
     private String testId;
 
+    /**
+     * 样品处理
+     */
+    @ApiModelProperty("样品处理")
+    private String sampleProcessing;
+
+
+    /**
+     * 样品处理时间或者原因
+     */
+    @ApiModelProperty("样品处理时间或者原因")
+    private String sampleProcessingResult;
+
 }

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

@@ -1116,6 +1116,8 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         List<String> sampleIds = baseMapper.selectSelfSampleRecord(id);
         if (sampleIds.size() > 0) {
             List<TrialSampleInfo> trialSampleInfos = trialSampleInfoMapper.selectBatchIds(sampleIds);
+            List<EntrustInfo> entrustInfoList = entrustInfoService.list(Wrappers.<EntrustInfo>lambdaQuery().in(EntrustInfo::getSampleId, sampleIds));
+            Map<Long, EntrustInfo> entrustInfoMap = entrustInfoList.stream().collect(Collectors.toMap(EntrustInfo::getSampleId, item -> item, (v1, v2) -> v1));
             Map<Long, User> map = iUserClient.selectUserAll().stream().collect(Collectors.toMap(User::getId, Function.identity()));
             if (trialSampleInfos.size() > 0) {
                 for (TrialSampleInfo trialSampleInfo : trialSampleInfos) {
@@ -1124,6 +1126,20 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                         TrialSampleInfoVO trialSampleInfoVO = BeanUtil.copyProperties(trialSampleInfo, TrialSampleInfoVO.class);
                         if (trialSampleInfoVO != null) {
                             trialSampleInfoVO.setUserName(ObjectUtil.isNotEmpty(user.getName()) ? user.getName() : user.getRealName());
+                            EntrustInfo entrustInfo = entrustInfoMap.get(trialSampleInfo.getId());
+                            if (entrustInfo != null && entrustInfo.getSampleStatus() != null) {
+                                if (entrustInfo.getSampleStatus().equals("6")) {
+                                    trialSampleInfoVO.setSampleProcessing("处理");
+                                    trialSampleInfoVO.setSampleProcessingResult(entrustInfo.getRepealReason() == null ? "" : entrustInfo.getRepealReason());
+                                } else if (entrustInfo.getSampleStatus().equals("5")) {
+                                    trialSampleInfoVO.setSampleProcessing("留样");
+                                    Date endTime = entrustInfo.getResamEndTime();
+                                    Date startTime = entrustInfo.getResamStartTime();
+                                    if (startTime != null && endTime != null) {
+                                        trialSampleInfoVO.setSampleProcessingResult(DateUtil.format(startTime, "yyyy-MM-dd") + " 至 " + DateUtil.format(endTime, "yyyy-MM-dd"));
+                                    }
+                                }
+                            }
                             result.add(trialSampleInfoVO);
                         }
                     }
@@ -1359,7 +1375,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
         String key = first.attr("id");
         //记录编号或者报告编号的值
         String recordOrReportNo = jsonObject.getString(key);
-        if (!"".equals(recordOrReportNo) && !(recordOrReportNo == null)) {
+        if (!"".equals(recordOrReportNo) && recordOrReportNo != null && !"/".equals(recordOrReportNo)) {
             String updateSql = "update u_trial_self_inspection_record set " + fileVlue + "='" + recordOrReportNo + "' where id='" + dto.getId() + "'";
             if (fileVlue.equals("record_no")) {
                 dto.setRecordNo(recordOrReportNo);
@@ -1812,7 +1828,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 if (StringUtils.isNotEmpty(maxRecordNo)) {
                     HashMap<String, String> stringStringHashMap = new HashMap<>();
                     stringStringHashMap.put("type", "记录表");
-                    if (trialSelfInspectionRecord != null) {
+                    if (trialSelfInspectionRecord != null && StringUtils.isNotEmpty(trialSelfInspectionRecord.getRecordNo())) {
                         stringStringHashMap.put("valueStr", trialSelfInspectionRecord.getRecordNo());
                         return stringStringHashMap;
                     }
@@ -1829,7 +1845,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 if (StringUtils.isNotEmpty(maxReportNo)) {
                     HashMap<String, String> stringStringHashMap = new HashMap<>();
                     stringStringHashMap.put("type", "报告单");
-                    if (trialSelfInspectionRecord != null) {
+                    if (trialSelfInspectionRecord != null && StringUtils.isNotEmpty(trialSelfInspectionRecord.getReportNo())) {
                         stringStringHashMap.put("valueStr", trialSelfInspectionRecord.getReportNo());
                         return stringStringHashMap;
                     }
@@ -1876,7 +1892,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     //记录表
                     HashMap<String, String> stringStringHashMap = new HashMap<>();
                     stringStringHashMap.put("type", "记录表");
-                    if (trialSelfInspectionRecord != null) {
+                    if (trialSelfInspectionRecord != null && StringUtils.isNotEmpty(trialSelfInspectionRecord.getRecordNo())) {
                         stringStringHashMap.put("valueStr", trialSelfInspectionRecord.getRecordNo());
                         return stringStringHashMap;
                     }
@@ -1923,7 +1939,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                     //报告单
                     HashMap<String, String> stringStringHashMap = new HashMap<>();
                     stringStringHashMap.put("type", "报告单");
-                    if (trialSelfInspectionRecord != null) {
+                    if (trialSelfInspectionRecord != null && StringUtils.isNotEmpty(trialSelfInspectionRecord.getReportNo())) {
                         stringStringHashMap.put("valueStr", trialSelfInspectionRecord.getReportNo());
                         return stringStringHashMap;
                     }
@@ -2185,6 +2201,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     public R getSamplePdfUrl(String id, String contrctId) {
         try {
             String pdf = this.getMergePdfToTrial(Func.toLong(contrctId), Func.toLong(id));
+            if (pdf == null || pdf.isEmpty()) {
+                return R.fail("获取pdf文件失败");
+            }
             return R.data(pdf);
         } catch (FileNotFoundException e) {
             throw new RuntimeException(e);

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

@@ -3025,10 +3025,16 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
             //匹配
             Elements bgBH = doc.select("el-input[placeholderxx~=报告编号.*]");
+            if (bgBH == null || bgBH.isEmpty()) {
+                bgBH = doc.select("el-input[placeholderxx~=报告编 号.*]");
+            }
             Elements cbdwBH = doc.select("el-input[placeholderxx~=承包单位.*]");
             Elements jldwBH = doc.select("el-input[placeholderxx~=监理单位.*]");
             Elements jcdwName = doc.select("el-input[placeholderxx~=检测单位名称.*]");
             Elements jlBH = doc.select("el-input[placeholderxx~=记录编号.*]");
+            if (jlBH == null || jlBH.isEmpty()) {
+                jlBH = doc.select("el-input[placeholderxx~=记录编 号.*]");
+            }
             Elements gcName = doc.select("el-input[placeholderxx~=工程名称.*]");
             Elements sgName = doc.select("el-input[placeholderxx~=施工单位.*]");
             Elements wtName = doc.select("el-input[placeholderxx~=委托单位.*]");
@@ -3127,6 +3133,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     //报告编号
                     if (bgBH.size() >= 1) {
                         for (Element element : bgBH) {
+                            if (ObjectUtils.isEmpty(record.getReportNo()) && ObjectUtils.isNotEmpty(reData.get(element.attr("keyname"))) ) {
+                                break;
+                            }
                             reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(record.getReportNo()) ? record.getReportNo() : "");
                             break;
                         }
@@ -3134,6 +3143,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     //记录编号
                     if (jlBH.size() >= 1) {
                         for (Element element : jlBH) {
+                            if (ObjectUtils.isEmpty(record.getRecordNo()) && ObjectUtils.isNotEmpty(reData.get(element.attr("keyname"))) ) {
+                                break;
+                            }
                             reData.put(element.attr("keyname"), ObjectUtils.isNotEmpty(record.getRecordNo()) ? record.getRecordNo() : "");
                             break;
                         }
@@ -3951,8 +3963,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
             // 获取匹配的laodId
             String load_data_id = "";
-            JSONArray jsonArray = dto.getDataInfo().getJSONArray("orderList");
-            load_data_id = jsonArray.getJSONObject(0).getString("loadDataId");
+            if (dto.getDataInfo() != null) {
+                JSONArray jsonArray = dto.getDataInfo().getJSONArray("orderList");
+                if (jsonArray != null) {
+                    load_data_id = jsonArray.getJSONObject(0).getString("loadDataId");
+                }
+            }
 
             String sql;
             if (query.size() == 0) {
@@ -3982,6 +3998,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     public String getBussPDFSTrial(String nodeId, String tableType, String classify, String contractId, String
             projectId, Long id, String tabIds, TrialSelfInspectionRecordDTO dto) throws Exception {
         String file_path = FileUtils.getSysLocalFileUrl();
+        if (StringUtils.isBlank(tabIds)) {
+            return "";
+        }
         //获取有权限的表的信息
         List<WbsTreePrivate> queryList = jdbcTemplate.query("select p_key_id,html_url,table_type,sort,node_name,create_time from m_wbs_tree_private where is_deleted = 0 and p_key_id in (" + tabIds + ") order by sort,node_name,create_time", new BeanPropertyRowMapper<>(WbsTreePrivate.class));
         List<String> dataPdfUrls = new ArrayList<>();