|
@@ -7,6 +7,9 @@ using StackExchange.Redis;
|
|
|
using OASystem.Domain.Dtos.UserDto;
|
|
|
using OASystem.Domain.Entities.System;
|
|
|
using OASystem.Domain;
|
|
|
+using OASystem.Infrastructure.Repositories.System;
|
|
|
+using OASystem.Domain.Dtos.System;
|
|
|
+using OASystem.Domain.ViewModels.System;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -19,13 +22,21 @@ namespace OASystem.API.Controllers
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly IConfiguration _config;
|
|
|
private readonly LoginRepository _loginRep;
|
|
|
+ private readonly SetDataRepository _setDataRepository;
|
|
|
+ private readonly CompanyRepository _CompanyRepository;
|
|
|
+ private readonly SystemMenuPermissionRepository _SystemMenuPermissionRepository;
|
|
|
//private IDatabase _redis;
|
|
|
//private RedisHelper _redisHelper;
|
|
|
- public AuthController(IConfiguration config, LoginRepository loginRep, IMapper mapper)
|
|
|
+ public AuthController(IConfiguration config, LoginRepository loginRep, IMapper mapper,
|
|
|
+ SetDataRepository setDataRepository, CompanyRepository companyRepository,
|
|
|
+ SystemMenuPermissionRepository systemMenuPermissionRepository)
|
|
|
{
|
|
|
_config = config;
|
|
|
_loginRep = loginRep;
|
|
|
_mapper = mapper;
|
|
|
+ _setDataRepository = setDataRepository;
|
|
|
+ _CompanyRepository = companyRepository;
|
|
|
+ _SystemMenuPermissionRepository = systemMenuPermissionRepository;
|
|
|
//_redis = client.GetDatabase(RedisEnum.Common);
|
|
|
//_redisHelper = client("132.232.92.186", "7369", "123456");
|
|
|
}
|
|
@@ -156,5 +167,79 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
return Ok(JsonView(view));
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 权限数据页面初始化
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Authorize]
|
|
|
+ [HttpPost("GetAuth")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> GetAuth(AuthDto dto)
|
|
|
+ {
|
|
|
+ Result result = new Result();
|
|
|
+
|
|
|
+ //模块数据
|
|
|
+ var setDataResult = await _setDataRepository.GetSySDefultModule(_setDataRepository);
|
|
|
+ if (setDataResult.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(setDataResult.Msg)) ;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SetDataView> setDataList = _mapper.Map<List<SetDataView>>(setDataResult.Data);
|
|
|
+ var mod = setDataList.Find(x => x.Name == "权限模块");
|
|
|
+ if (mod == null)
|
|
|
+ {
|
|
|
+ return Ok(JsonView("未找到权限模块!"));
|
|
|
+ }
|
|
|
+
|
|
|
+ //页面数据
|
|
|
+ var SystemMenuPermissionData = _SystemMenuPermissionRepository.GetSystemMenuViweData(_SystemMenuPermissionRepository, mod.Id, dto.pageSize,dto.currentPage);
|
|
|
+ if (SystemMenuPermissionData.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(SystemMenuPermissionData.Msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ //公司数据
|
|
|
+ var CompanyDataResult = _CompanyRepository.GetCompanyData(_CompanyRepository);
|
|
|
+ if (CompanyDataResult.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(CompanyDataResult.Msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ result.Code = 0;
|
|
|
+ result.Msg = "成功!";
|
|
|
+ var Dyresult = new
|
|
|
+ {
|
|
|
+ setDataResult = setDataResult.Data,
|
|
|
+ CompanyDataResult = CompanyDataResult.Data,
|
|
|
+ SystemMenuPermissionData = SystemMenuPermissionData.Data
|
|
|
+ };
|
|
|
+
|
|
|
+ return Ok(JsonView(200 ,"成功!", Dyresult));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查询部门
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="companyid"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Authorize]
|
|
|
+ [HttpPost("QueryDepartmentListByCompId")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public IActionResult QueryDepartmentListByCompId(int companyid)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return Ok(JsonView(""));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|