From 0cdc8f7ceea4126c19013a6794d4327e6903dd58 Mon Sep 17 00:00:00 2001 From: jiyufei <67400194@qq.com> Date: Mon, 8 Jul 2024 17:54:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(bucket):=E5=A4=84=E7=90=86=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E8=BF=94=E5=9B=9E=E6=B6=88=E6=81=AF;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/RecycleBucketController.java | 22 ++++++++++--------- .../RecycleDeviceConfigController.java | 15 +++++++------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/RecycleBucketController.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/RecycleBucketController.java index df4fd66..bfe9566 100644 --- a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/RecycleBucketController.java +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/RecycleBucketController.java @@ -115,7 +115,11 @@ public class RecycleBucketController { //只会查询出来一个 recycleBucketForm.setCompanyId(companyId.get(0)); } - return ActionResult.success(recycleBucketService.saveOrUpdate(recycleBucketForm, null, true)); + String result = recycleBucketService.saveOrUpdate(recycleBucketForm, null, true); + if (result.contains("失败") || result.contains("两")) { + return ActionResult.fail(result); + } + return ActionResult.success(result); } /** @@ -144,16 +148,13 @@ public class RecycleBucketController { //只会查询出来一个 recycleBucketForm.setCompanyId(companyId.get(0)); } - try { - recycleBucketService.saveOrUpdate(recycleBucketForm, id, false); - } catch (Exception e) { - e.printStackTrace(); - return ActionResult.fail("修改数据失败"); + String result = recycleBucketService.saveOrUpdate(recycleBucketForm, null, true); + if (result.contains("失败") || result.contains("该设备已存在两台回收桶")) { + return ActionResult.fail(result); } - return ActionResult.success("更新成功"); - } else { - return ActionResult.fail("更新失败,数据不存在"); + return ActionResult.success(result); } + return ActionResult.fail("更新失败,数据不存在"); } /** @@ -241,7 +242,8 @@ public class RecycleBucketController { return ActionResult.success(recycleBucketMap); } - private RecycleBucketEntity buildEntity(RecycleBucketEntity entity, Map configCollect) { + private RecycleBucketEntity buildEntity(RecycleBucketEntity + entity, Map configCollect) { if (configCollect.containsKey(entity.getCompanyId())) { RecycleDeviceConfigEntity deviceConfig = configCollect.get(entity.getCompanyId()); //如果为空 则获取公共配置 diff --git a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/RecycleDeviceConfigController.java b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/RecycleDeviceConfigController.java index 6c96da0..834fff8 100644 --- a/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/RecycleDeviceConfigController.java +++ b/jnpf-java-boot/jnpf-scm/jnpf-scm-controller/src/main/java/jnpf/controller/RecycleDeviceConfigController.java @@ -100,6 +100,9 @@ public class RecycleDeviceConfigController { return ActionResult.fail(b); } String result = recycleDeviceConfigService.saveOrUpdate(recycleDeviceConfigForm, null, true); + if (result.contains("失败") || result.contains("已存在该组织架构")) { + return ActionResult.fail(result); + } return ActionResult.success(result); } @@ -123,15 +126,13 @@ public class RecycleDeviceConfigController { } RecycleDeviceConfigEntity entity = recycleDeviceConfigService.getInfo(id); if (entity != null) { - try { - recycleDeviceConfigService.saveOrUpdate(recycleDeviceConfigForm, id, false); - } catch (Exception e) { - return ActionResult.fail("修改数据失败"); + String result = recycleDeviceConfigService.saveOrUpdate(recycleDeviceConfigForm, null, true); + if (result.contains("失败") || result.contains("已存在该组织架构")) { + return ActionResult.fail(result); } - return ActionResult.success("更新成功"); - } else { - return ActionResult.fail("更新失败,数据不存在"); + return ActionResult.success(result); } + return ActionResult.fail("更新失败,数据不存在"); } /**