|
@@ -439,16 +439,20 @@ public class HouseController extends BaseController {
|
|
|
|
|
|
List<String> userRoles = userUtils.getRolesByToken(getToken());
|
|
List<String> userRoles = userUtils.getRolesByToken(getToken());
|
|
String roleKey = null;
|
|
String roleKey = null;
|
|
- if (userRoles.size() == 1) {
|
|
|
|
|
|
+ if (userRoles.size() <= 1) {
|
|
// 只有一个权限时
|
|
// 只有一个权限时
|
|
roleKey = (String)userRoles.get(0);
|
|
roleKey = (String)userRoles.get(0);
|
|
if (!"upload".equals(roleKey)) {
|
|
if (!"upload".equals(roleKey)) {
|
|
log.warn("只有一个权限的非上传者角色,不能删除房源");
|
|
log.warn("只有一个权限的非上传者角色,不能删除房源");
|
|
throw new CommonBaseException(ResultCodeEnum.D101 , "权限不足,不能删除房源");
|
|
throw new CommonBaseException(ResultCodeEnum.D101 , "权限不足,不能删除房源");
|
|
}
|
|
}
|
|
- }else if(userRoles.size() != 3){
|
|
|
|
- log.warn("多于一个权限的角色,非管理员,不能删除房源");
|
|
|
|
- throw new CommonBaseException(ResultCodeEnum.D101 , "权限不足,不能删除房源");
|
|
|
|
|
|
+ }else if(userRoles.size() == 2){
|
|
|
|
+ if(userRoles.contains("edit") && userRoles.contains("admin")){
|
|
|
|
+ //理论上不会有这种权限组合
|
|
|
|
+ log.warn("多于一个权限的角色,只有用户管理和编辑房源权限不能删除房源");
|
|
|
|
+ throw new CommonBaseException(ResultCodeEnum.D101 , "权限不足(缺少上传房源权限),不能删除房源");
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
String[] split = ids.split(",");
|
|
String[] split = ids.split(",");
|
|
@@ -459,9 +463,18 @@ public class HouseController extends BaseController {
|
|
return new R(MsgCode.e_COMMON_3002,"没有存在的房源");
|
|
return new R(MsgCode.e_COMMON_3002,"没有存在的房源");
|
|
}
|
|
}
|
|
|
|
|
|
- if(null != houseEntity.getStatus() && (houseEntity.getStatus().compareTo(0) == 0) || houseEntity.getStatus().compareTo(3) == 0){
|
|
|
|
- log.error("只有upload, 房源id!=0,房源计算中不能删除");
|
|
|
|
- throw new CommonBaseException(ResultCodeEnum.D101 , "房源计算中不能删除");
|
|
|
|
|
|
+ if(null != houseEntity.getStatus()){
|
|
|
|
+
|
|
|
|
+ if((houseEntity.getStatus().compareTo(0) == 0) && (null != houseEntity.getStatus() && houseEntity.getStatus().compareTo(1) == 0)){
|
|
|
|
+ //预审通过了的,还未垂直校验的,不能删除
|
|
|
|
+ log.error("房源垂直校验计算中不能删除");
|
|
|
|
+ throw new CommonBaseException(ResultCodeEnum.D101 , "房源垂直校验计算中不能删除");
|
|
|
|
+ }
|
|
|
|
+ if(houseEntity.getStatus().compareTo(3) == 0){
|
|
|
|
+ log.error("房源生成模型计算中不能删除");
|
|
|
|
+ throw new CommonBaseException(ResultCodeEnum.D101 , "房源生成模型计算中不能删除");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|