Browse Source

Merge remote-tracking branch 'origin/test-merge' into test-merge

cr 1 day ago
parent
commit
8c0588a9a8

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

@@ -1223,6 +1223,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(",");

+ 15 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -1230,7 +1230,7 @@ public class WbsTreePrivateController extends BladeController {
 
 
     /**
-     * wbs私有树懒加载获取项目私有节点树形结构--(表单类型划分树)
+     * 设置/取消 表单默认隐藏
      */
     @GetMapping("/showTable")
     @ApiOperationSupport(order = 41)
@@ -1238,9 +1238,21 @@ public class WbsTreePrivateController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "pKeyId", value = "表单的pKeyId", required = true)})
     public R<Boolean> showTable(Long pKeyId) {
-        boolean update = wbsTreePrivateService.update(Wrappers.<WbsTreePrivate>lambdaUpdate().eq(WbsTreePrivate::getPKeyId, pKeyId).ne(WbsTreePrivate::getType, 1).setSql(" default_conceal = 1 - default_conceal"));
+        if (pKeyId == null) {
+            return R.fail("参数错误");
+        }
+        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>lambdaQuery().select(WbsTreePrivate::getPKeyId, WbsTreePrivate::getDefaultConceal, WbsTreePrivate::getProjectId)
+                .eq(WbsTreePrivate::getPKeyId, pKeyId).ne(WbsTreePrivate::getType, 1));
+        if (wbsTreePrivate == null) {
+            return R.fail("选择的表单不存在");
+        }
+        int isDefaultConceal = 0;
+        if (wbsTreePrivate.getDefaultConceal() == null || wbsTreePrivate.getDefaultConceal() == 0) {
+            isDefaultConceal = 1;
+        }
+        boolean update = wbsTreePrivateService.update(Wrappers.<WbsTreePrivate>lambdaUpdate().eq(WbsTreePrivate::getPKeyId, pKeyId).set(WbsTreePrivate::getDefaultConceal, isDefaultConceal).set(WbsTreePrivate::getIsBussShow, isDefaultConceal + 1));
         if ( update) {
-            // todo 是否同步到客户端
+            jdbcTemplate.execute("update m_wbs_tree_contract set is_buss_show =  " + (isDefaultConceal + 1) + " where is_deleted = 0 and is_type_private_pid = " + pKeyId + " and project_id = " + wbsTreePrivate.getProjectId());
         }
         return R.data(update);
     }