Sfoglia il codice sorgente

Merge branch 'refs/heads/feature-lihb-20251119-entrust' into dev

LHB 2 giorni fa
parent
commit
80eeb689a6

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

@@ -1158,7 +1158,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
 
         //获取之前关联的委托单id
         TrialSelfInspectionRecord oldData = baseMapper.selectById(dto.getId());
-        
+
         this.saveOrUpdate(dto);
         dto.setTableIds(tableIds);
         if (ObjectUtil.isNotEmpty(dto.getId())) {
@@ -1191,6 +1191,23 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             jdbcTemplate.update("update u_entrust_info set sample_status=4 where id ='" + dto.getEntrustId() + "'");
         }
         if(oldData != null && oldData.getEntrustId() != null && dto.getEntrustId() == null){
+            //修改对应 BaseInfo 中的数据
+            String baseInfo = oldData.getBaseInfo();
+            if (StringUtils.isNotBlank(baseInfo)) {
+                //删除关联
+                baseMapper.delSelfSample(dto.getId());
+                //设置空值
+                TrialSeleInspectionRecordBaseInfoDTO trialSeleInspectionRecordBaseInfoDTO = JSONObject.parseObject(baseInfo, TrialSeleInspectionRecordBaseInfoDTO.class);
+                if (trialSeleInspectionRecordBaseInfoDTO != null) {
+                    trialSeleInspectionRecordBaseInfoDTO.setEntrustId(null);
+                    trialSeleInspectionRecordBaseInfoDTO.setEntrustNo(null);
+                    trialSeleInspectionRecordBaseInfoDTO.setTrialSampleInfo(null);
+                    oldData.setBaseInfo(JSON.toJSONString(trialSeleInspectionRecordBaseInfoDTO));
+                    int update = baseMapper.update(null, Wrappers.<TrialSelfInspectionRecord>update().lambda()
+                            .set(TrialSelfInspectionRecord::getBaseInfo, JSON.toJSONString(trialSeleInspectionRecordBaseInfoDTO))
+                            .eq(TrialSelfInspectionRecord::getId, dto.getId()));
+                }
+            }
             entrustInfoService.update(Wrappers.<EntrustInfo>lambdaUpdate().eq(EntrustInfo::getId, oldData.getEntrustId()).set(EntrustInfo::getExpCount, 0));
         }
         String[] strings = dto.getTableType().split(",");