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