Browse Source

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

tags/V1.3.3^2
suqin 11 months ago
parent
commit
b80e9a1675
2 changed files with 21 additions and 11 deletions
  1. +20
    -10
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/iotequipment/edit/EditIotEquipmentService.java
  2. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/GaodeUtil.java

+ 20
- 10
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/iotequipment/edit/EditIotEquipmentService.java View File

@@ -86,19 +86,28 @@ public class EditIotEquipmentService {
if (ObjectUtil.isEmpty(iotEquipment)) {
throw new ServiceException("该设备不存在");
}
iotEquipment = iotEquipmentMapper.selectOne(new LambdaQueryWrapper<IotEquipment>()
.eq(IotEquipment::getTenantId, tenantId)
.eq(IotEquipment::getDeptId, request.getDeptId())
.eq(IotEquipment::getCode, request.getCode())
.eq(IotEquipment::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotEmpty(iotEquipment)) {
throw new ServiceException("该部门下已存在该编号设备");

String code = iotEquipment.getCode();
if (!StringUtils.isEmpty(code)) {
if (!request.getCode().equals(code)) { //不相等 说明这次用户要修改设备编码
//在修改前判断 用户传来的设备编号在数据库中是否已经存在
IotEquipment equipment = iotEquipmentMapper.selectOne(new LambdaQueryWrapper<IotEquipment>()
.eq(IotEquipment::getTenantId, tenantId)
.eq(IotEquipment::getDeptId, request.getDeptId())
.eq(IotEquipment::getCode, request.getCode())
.eq(IotEquipment::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNotEmpty(equipment)) {
throw new ServiceException("该部门下已存在该编号设备");
}
}
}

return JsonResult.success();
}

/**
* 启用、禁用
*
* @param id
* @param status
* @return
@@ -124,19 +133,20 @@ public class EditIotEquipmentService {

/**
* 检查启用/禁用参数
*
* @param id
* @param status
* @return
*/
private JsonResult check1(String id,int status) {
private JsonResult check1(String id, int status) {
if (StringUtils.isEmpty(id)) {
throw new ServiceException("设备Id码为空");
}
if(String.valueOf(status).equals("")){
if (String.valueOf(status).equals("")) {
throw new ServiceException("设备状态为空");
}

if(1 != status && 0 != status){
if (1 != status && 0 != status) {
throw new ServiceException("无法修改状态,状态只有启用或者禁用两种!");
}


+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/GaodeUtil.java View File

@@ -16,7 +16,7 @@ import java.text.DecimalFormat;
import java.util.Map;

@Slf4j
public class GaodeUtil {
public class GaodeUtil {

/**
* 逆地理编码

Loading…
Cancel
Save