Commit 43fdaccb by huangjinxin

fix:图层删除判断saas图层

1 parent 370edc8a
...@@ -132,7 +132,9 @@ public enum StatusCodeEnum { ...@@ -132,7 +132,9 @@ public enum StatusCodeEnum {
FENDAN_ENGINEER_UNMATCHED("023", "分单接口没有查到配置工程师", false), FENDAN_ENGINEER_UNMATCHED("023", "分单接口没有查到配置工程师", false),
FENDAN_IS_TRANSCEND("024", "分单超派", false); FENDAN_IS_TRANSCEND("024", "分单超派", false),
RESOURCE_USER_EXISTS_ROLE("025", "用绑定用户的角色不允许删除,需要解绑后才可以删除角色", false);
/** /**
* 状态码 * 状态码
......
...@@ -16,6 +16,7 @@ import com.dituhui.pea.order.utils.TypeUtils; ...@@ -16,6 +16,7 @@ import com.dituhui.pea.order.utils.TypeUtils;
import com.google.gson.internal.LinkedTreeMap; import com.google.gson.internal.LinkedTreeMap;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
...@@ -252,12 +253,14 @@ public class BusinessLayerServiceImpl implements BusinessLayerService { ...@@ -252,12 +253,14 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
return Result.failure("该图层下面还有区块"); return Result.failure("该图层下面还有区块");
} }
// 同步删除saas图层 if (StringUtils.isNotBlank(layer.getSaasLayerId())) {
String result = saasRemoteService.deleteLayer(ak, layer.getSaasLayerId()); // 同步删除saas图层
log.info("deleteLayer params:{} result:{}", layerId, result); String result = saasRemoteService.deleteLayer(ak, layer.getSaasLayerId());
Result<Boolean> saasResult = TypeUtils.convertResult(result); log.info("deleteLayer params:{} result:{}", layerId, result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) { Result<Boolean> saasResult = TypeUtils.convertResult(result);
return Result.failure(saasResult.getMessage()); if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure(saasResult.getMessage());
}
} }
// 更新状态为删除状态 // 更新状态为删除状态
......
...@@ -131,6 +131,10 @@ public class RoleService { ...@@ -131,6 +131,10 @@ public class RoleService {
if (ObjectUtil.isNull(roleEntity)) { if (ObjectUtil.isNull(roleEntity)) {
throw new BusinessException(StatusCodeEnum.ROLE_DOES_NOT_EXIST); throw new BusinessException(StatusCodeEnum.ROLE_DOES_NOT_EXIST);
} }
List<UserRoleEntity> roleEntities = userRoleDao.findByRoleId(roleId);
if (CollectionUtils.isNotEmpty(roleEntities)) {
throw new BusinessException(StatusCodeEnum.RESOURCE_USER_EXISTS_ROLE);
}
// 删除角色 // 删除角色
roleDao.deleteById(roleId); roleDao.deleteById(roleId);
// 删除用户和角色的关系 // 删除用户和角色的关系
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!