Commit bfb032ab by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents a2d5c291 8b22b0dc
......@@ -101,4 +101,14 @@ public interface ResourceApiService {
* @throws
*/
ServiceResponse<OrderResourceDTO> getOrderResourceByUserId(Integer userId);
/**
* @Title: getUserResourceByUserId
* @Description:
* @author zhiwj
* @param userId
* @return com.gic.api.base.commons.ServiceResponse<com.gic.auth.dto.OrderResourceDTO> 返回null表示没有授权 返回 -1 表示全部
* @throws
*/
ServiceResponse<Long> getUserResourceByUserId(Integer userId);
}
......@@ -85,6 +85,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
if (auditedGroupIsNotExist) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR);
}
if (auditorDTO.getUserId() != null) {
TabSysUser user = userService.getUserById(auditorDTO.getUserId());
if (user == null) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
......@@ -92,6 +93,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
if (!StringUtils.equals(auditorDTO.getPhone(), user.getPhoneNumber())) {
return EnterpriseServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "关联管理员手机号不一致");
}
}
auditorDTO.setIsUse(auditorDTO.getUserId() == null ? 0 : 1);
// 这里进来的 不会去修改openid,所以把openid设为null
......@@ -217,6 +219,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
AuditorDTO auditorDTO = new AuditorDTO();
auditorDTO.setAuditorId(auditorId);
auditorDTO.setOpenid(openid);
auditorDTO.setIsUse(1);
this.auditorService.update(auditorDTO);
}
}
......
......@@ -342,4 +342,20 @@ public class ResourceApiServiceImpl implements ResourceApiService {
return EnterpriseServiceResponse.success(defaultResource);
}
@Override
public ServiceResponse<Long> getUserResourceByUserId(Integer userId) {
TabSysUser user = userService.getUserById(userId);
if (user.getSuperAdmin() == 1) {
// 是超管就返回所有
return EnterpriseServiceResponse.success(-1L);
}
List<UserResourceDTO> resourceDTOList = this.userResourceService.listUserResourceByUserId(userId);
if (CollectionUtils.isEmpty(resourceDTOList)) {
return EnterpriseServiceResponse.failure(ErrorCode.NOTEXISTS);
}
UserResourceDTO userResourceDTO = resourceDTOList.get(0);
TabSysResource resource = this.resourceService.getResource(userResourceDTO.getResourceId());
return EnterpriseServiceResponse.success(resource.getUserResource());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment