|
@@ -167,19 +167,19 @@ public class DevicePermissOpenApiService extends SuperService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public ResultContent deletePermiss(PermissChangeOpenApiParam param) {
|
|
public ResultContent deletePermiss(PermissChangeOpenApiParam param) {
|
|
|
- if (StringUtils.isEmpty(param.getProjectCode())) {
|
|
|
|
|
- return ResultContent.buildFail("projectCode不能为空");
|
|
|
|
|
|
|
+ // 检查项目信息
|
|
|
|
|
+ ResultContent<String> resultContent = commonService.checkProjectCanUserByCode(param.getProjectCode());
|
|
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
}
|
|
}
|
|
|
|
|
+ String projectOid = resultContent.getContent();
|
|
|
|
|
+
|
|
|
if (StringUtils.isEmpty(param.getUserId())) {
|
|
if (StringUtils.isEmpty(param.getUserId())) {
|
|
|
return ResultContent.buildFail("userId不能为空");
|
|
return ResultContent.buildFail("userId不能为空");
|
|
|
}
|
|
}
|
|
|
if (StringUtils.isEmpty(param.getDeviceId())) {
|
|
if (StringUtils.isEmpty(param.getDeviceId())) {
|
|
|
return ResultContent.buildFail("deviceId不能为空");
|
|
return ResultContent.buildFail("deviceId不能为空");
|
|
|
}
|
|
}
|
|
|
- String projectOid = getOidByCode(param.getProjectCode());
|
|
|
|
|
- if (StringUtils.isEmpty(projectOid)) {
|
|
|
|
|
- return ResultContent.buildFail("projectCode不存在");
|
|
|
|
|
- }
|
|
|
|
|
DevicePermiss entity = devicePermissDao.findTopByUserIdAndDeviceIdAndProjectOid(param.getUserId(), param.getDeviceId(), projectOid);
|
|
DevicePermiss entity = devicePermissDao.findTopByUserIdAndDeviceIdAndProjectOid(param.getUserId(), param.getDeviceId(), projectOid);
|
|
|
if (ObjectUtils.isEmpty(entity)) {
|
|
if (ObjectUtils.isEmpty(entity)) {
|
|
|
return ResultContent.buildFail("权限不存在");
|
|
return ResultContent.buildFail("权限不存在");
|
|
@@ -216,6 +216,8 @@ public class DevicePermissOpenApiService extends SuperService {
|
|
|
if (ObjectUtils.isEmpty(orgUsers)) {
|
|
if (ObjectUtils.isEmpty(orgUsers)) {
|
|
|
return ResultContent.buildFail("用户不属于项目");
|
|
return ResultContent.buildFail("用户不属于项目");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 组装数据
|
|
|
DevicePermissParam saveParam = new DevicePermissParam();
|
|
DevicePermissParam saveParam = new DevicePermissParam();
|
|
|
saveParam.setDeviceIds(List.of(param.getDeviceId()));
|
|
saveParam.setDeviceIds(List.of(param.getDeviceId()));
|
|
|
saveParam.setProjectOid(projectOid);
|
|
saveParam.setProjectOid(projectOid);
|
|
@@ -230,11 +232,14 @@ public class DevicePermissOpenApiService extends SuperService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public ResultContent<List<DevicePermissOpenApiModel>> getDevicePermissByUserId(UserOpenApiParam param) {
|
|
public ResultContent<List<DevicePermissOpenApiModel>> getDevicePermissByUserId(UserOpenApiParam param) {
|
|
|
- if (StringUtils.isEmpty(param.getProjectCode())) {
|
|
|
|
|
- return ResultContent.buildFail("projectCode不能为空");
|
|
|
|
|
|
|
+ // 检查项目信息
|
|
|
|
|
+ ResultContent<String> resultContent = commonService.checkProjectCanUserByCode(param.getProjectCode());
|
|
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
}
|
|
}
|
|
|
|
|
+ String projectOid = resultContent.getContent();
|
|
|
|
|
+
|
|
|
List<DevicePermissOpenApiModel> models = new ArrayList<>();
|
|
List<DevicePermissOpenApiModel> models = new ArrayList<>();
|
|
|
- String projectOid = getOidByCode(param.getProjectCode());
|
|
|
|
|
if (StringUtils.isNotEmpty(projectOid)) {
|
|
if (StringUtils.isNotEmpty(projectOid)) {
|
|
|
List<DevicePermiss> list = devicePermissDao.findByUserIdAndProjectOid(param.getUserId(), projectOid);
|
|
List<DevicePermiss> list = devicePermissDao.findByUserIdAndProjectOid(param.getUserId(), projectOid);
|
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
if (ObjectUtils.isNotEmpty(list)) {
|