|
|
|
|
|
|
|
|
public JsonResult getList() { |
|
|
public JsonResult getList() { |
|
|
//获取登录用户信息 |
|
|
//获取登录用户信息 |
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
if (ObjectUtil.isNull(user)) { |
|
|
|
|
|
JsonResult.error(ListByDeptUserTypeEnum.USER_IS_NULL.getCode(), ListByDeptUserTypeEnum.USER_IS_NULL.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
String tenantId = user.getTenantId(); |
|
|
String tenantId = user.getTenantId(); |
|
|
if (StringUtils.isEmpty(tenantId)) { |
|
|
|
|
|
JsonResult.error(ListByDeptUserTypeEnum.TENANT_ID_IS_NULL.getCode(), ListByDeptUserTypeEnum.TENANT_ID_IS_NULL.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//判断用户角色 1超级管理员 2部门管理员 3普通用户 |
|
|
//判断用户角色 1超级管理员 2部门管理员 3普通用户 |
|
|
if (null == user.getDataPermission()) { |
|
|
if (null == user.getDataPermission()) { |
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
|
|
|
|
|
.orderByDesc(Inspection::getCreateTime) |
|
|
.orderByDesc(Inspection::getCreateTime) |
|
|
.last("limit 5")); |
|
|
.last("limit 5")); |
|
|
if (CollectionUtil.isEmpty(inspectionList)) { |
|
|
if (CollectionUtil.isEmpty(inspectionList)) { |
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
|
|
|
|
|
return JsonResult.success(); |
|
|
} |
|
|
} |
|
|
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) { |
|
|
Stream<InspectionListVo> inspections = this.getInspectionListVoStream(inspectionList); |
|
|
Stream<InspectionListVo> inspections = this.getInspectionListVoStream(inspectionList); |
|
|
|
|
|
|
|
|
.orderByDesc(Inspection::getCreateTime) |
|
|
.orderByDesc(Inspection::getCreateTime) |
|
|
.last("limit 5")); |
|
|
.last("limit 5")); |
|
|
if (CollectionUtil.isEmpty(inspectionList)) { |
|
|
if (CollectionUtil.isEmpty(inspectionList)) { |
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
|
|
|
|
|
return JsonResult.success(); |
|
|
} |
|
|
} |
|
|
Stream<InspectionListVo> inspectionListVoStream = this.getInspectionListVoStream(inspectionList); |
|
|
Stream<InspectionListVo> inspectionListVoStream = this.getInspectionListVoStream(inspectionList); |
|
|
return JsonResult.success(inspectionListVoStream); |
|
|
return JsonResult.success(inspectionListVoStream); |