Browse Source

试验
1、委托单关联问题处理

LHB 1 day ago
parent
commit
fd2887ac21

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

@@ -1223,6 +1223,20 @@ 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)) {
+                //设置空值
+                TrialSeleInspectionRecordBaseInfoDTO trialSeleInspectionRecordBaseInfoDTO = JSONObject.parseObject(baseInfo, TrialSeleInspectionRecordBaseInfoDTO.class);
+                if (trialSeleInspectionRecordBaseInfoDTO != null) {
+                    trialSeleInspectionRecordBaseInfoDTO.setEntrustId(null);
+                    trialSeleInspectionRecordBaseInfoDTO.setEntrustNo(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(",");