From 93aa5b5e4387dbbe09317b53434d6c675cebdbdb Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Fri, 19 May 2023 14:26:54 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E5=B7=A1=E6=A3=80=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BAminio=E5=8D=87=E7=BA=A7=20#=20?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86bug=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/controller/EmInfoController.java | 40 +++++++++++----------- .../equipment/service/impl/EmInfoServiceImpl.java | 22 +++++++----- hzims-service/inspect/pom.xml | 12 +++---- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java index ae36e3d..cabb623 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java @@ -128,26 +128,26 @@ public class EmInfoController extends BladeController { @ApiOperationSupport(order = 6) @ApiOperation(value = "修改", notes = "传入em_info,isModel;其中isModel=0为非母版,=1时保存为母版,modelName,modelType") public R update(@Valid @RequestBody EmInfoAddVo em_info) { - List name = em_infoService.list(new QueryWrapper() {{ - eq("NAME", em_info.getInfo().getName()); - }}); - if (CollectionUtil.isNotEmpty(name)) { - for (EmInfoEntity emInfoEntity : name) { - if (!(em_info.getInfo().getId() + "").equals(emInfoEntity.getId() + "")) { - return R.fail("设备名称已存在"); - } - } - } - List number = em_infoService.list(new QueryWrapper() {{ - eq("NUMBER", em_info.getInfo().getNumber()); - }}); - if (CollectionUtil.isNotEmpty(number)) { - for (EmInfoEntity emInfoEntity : number) { - if (!(em_info.getInfo().getId() + "").equals(emInfoEntity.getId() + "")) { - return R.fail("设备编号已存在"); - } - } - } +// List name = em_infoService.list(new QueryWrapper() {{ +// eq("NAME", em_info.getInfo().getName()); +// }}); +// if (CollectionUtil.isNotEmpty(name)) { +// for (EmInfoEntity emInfoEntity : name) { +// if (!(em_info.getInfo().getId() + "").equals(emInfoEntity.getId() + "")) { +// return R.fail("设备名称已存在"); +// } +// } +// } +// List number = em_infoService.list(new QueryWrapper() {{ +// eq("NUMBER", em_info.getInfo().getNumber()); +// }}); +// if (CollectionUtil.isNotEmpty(number)) { +// for (EmInfoEntity emInfoEntity : number) { +// if (!(em_info.getInfo().getId() + "").equals(emInfoEntity.getId() + "")) { +// return R.fail("设备编号已存在"); +// } +// } +// } return em_infoService.updateInfo(em_info, em_info.getIsModel(), em_info.getModelName(), em_info.getModelType()); } diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java index 18bf630..db5f8c8 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java @@ -145,6 +145,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl existName = this.list( - Wrappers.lambdaQuery().eq(EmInfoEntity::getName, em_info.getInfo().getName()).eq(EmInfoEntity::getDepartment, em_info.getInfo().getDepartment()) + Wrappers.lambdaQuery() + .eq(EmInfoEntity::getName, info.getName()) + .eq(EmInfoEntity::getDepartment, info.getDepartment()) + .ne(Func.isNotEmpty(info.getId()),EmInfoEntity::getId,info.getId()) ); Assert.isTrue(CollectionUtil.isEmpty(existName),()-> { throw new ServiceException("设备名称已存在"); @@ -506,24 +511,25 @@ public class EmInfoServiceImpl extends BaseServiceImpl exist = super.list(Wrappers.lambdaQuery() - .eq(EmInfoEntity::getDepartment, em_info.getInfo().getDepartment()) - .eq(EmInfoEntity::getEmIndex, em_info.getInfo().getEmIndex()) + .eq(EmInfoEntity::getDepartment, info.getDepartment()) + .eq(EmInfoEntity::getEmIndex, info.getEmIndex()) + .ne(Func.isNotEmpty(info.getId()),EmInfoEntity::getId,info.getId()) ); Assert.isTrue(CollectionUtil.isEmpty(exist),() -> { throw new ServiceException("该设备序号已存在,设备新增失败"); }); } // 查询设备编码设备实例是否已存在 - if(Func.isNotEmpty(em_info.getInfo().getNumber())) { + if(Func.isNotEmpty(info.getNumber()) && Func.isEmpty(info.getId())) { R existResult = deviceClient.isDeviceCodeExist(em_info.getInfo().getNumber()); Assert.isTrue(existResult.isSuccess() && !existResult.getData(),() -> { throw new ServiceException("该设备编码在设备实例中找到对应记录,保存失败!"); }); } // 验证设备编号是否已存在 - EmInfoEntity emInfoEntity = this.baseMapper.selectEmInfoByCode(em_info.getInfo().getNumber()); - Assert.isTrue(ObjectUtil.isEmpty(emInfoEntity),() -> { - throw new ServiceException("设备编号已存在"); - }); +// EmInfoEntity emInfoEntity = this.baseMapper.selectEmInfoByCode(em_info.getInfo().getNumber()); +// Assert.isTrue(ObjectUtil.isEmpty(emInfoEntity),() -> { +// throw new ServiceException("设备编号已存在"); +// }); } } diff --git a/hzims-service/inspect/pom.xml b/hzims-service/inspect/pom.xml index 0483db8..6057086 100644 --- a/hzims-service/inspect/pom.xml +++ b/hzims-service/inspect/pom.xml @@ -131,15 +131,15 @@ blade-resource-api ${bladex.project.version} - - io.minio - minio - 6.0.7 - + + + + + org.springblade blade-starter-oss-minio - 2.7.3.RELEASE + 5.0.0.RELEASE com.hnac.hzims