Browse Source

# 巡检管理机器人minio升级

# 设备管理bug解决
zhongwei
haungxing 2 years ago
parent
commit
93aa5b5e43
  1. 40
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmInfoController.java
  2. 22
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  3. 12
      hzims-service/inspect/pom.xml

40
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<EmInfoEntity> name = em_infoService.list(new QueryWrapper<EmInfoEntity>() {{
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<EmInfoEntity> number = em_infoService.list(new QueryWrapper<EmInfoEntity>() {{
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<EmInfoEntity> name = em_infoService.list(new QueryWrapper<EmInfoEntity>() {{
// 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<EmInfoEntity> number = em_infoService.list(new QueryWrapper<EmInfoEntity>() {{
// 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());
}

22
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -145,6 +145,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
@Override
public R updateInfo(@Valid EmInfoAddVo em_info, String isModel, String modelName, Integer modelType) {
this.validEmInfo(em_info);
if (this.updateById(em_info.getInfo())) {
getStationCodeStoreRedis();
if (isModel.equals(EquipmentContants.isModelEnum.yes.getValue())) {
@ -496,9 +497,13 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
}
private void validEmInfo(EmInfoAddVo em_info) {
EmInfoEntity info = em_info.getInfo();
// 验证设备名称
List<EmInfoEntity> existName = this.list(
Wrappers.<EmInfoEntity>lambdaQuery().eq(EmInfoEntity::getName, em_info.getInfo().getName()).eq(EmInfoEntity::getDepartment, em_info.getInfo().getDepartment())
Wrappers.<EmInfoEntity>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<EmInfoMapper, EmInfoEntit
// 验证设备序号
if(Func.isNotEmpty(em_info.getInfo().getEmIndex())) {
List<EmInfoEntity> exist = super.list(Wrappers.<EmInfoEntity>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<Boolean> 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("设备编号已存在");
// });
}
}

12
hzims-service/inspect/pom.xml

@ -131,15 +131,15 @@
<artifactId>blade-resource-api</artifactId>
<version>${bladex.project.version}</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>6.0.7</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.minio</groupId>-->
<!-- <artifactId>minio</artifactId>-->
<!-- <version>6.0.7</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-oss-minio</artifactId>
<version>2.7.3.RELEASE</version>
<version>5.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>com.hnac.hzims</groupId>

Loading…
Cancel
Save