| | |
| | | private readonly IFunSettingServer _setting; //功能设定 |
| | | private readonly IInterfaceServer _interface;//接口管理 |
| | | private readonly IOperationSysServer _operation; //操作日志 |
| | | private readonly IRoleWareHouseServer _roleWareSvs; //操作日志 |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | |
| | | /// <param name="department">部门</param> |
| | | /// <param name="setting">功能设定</param> |
| | | /// <param name="operation">操作日志</param> |
| | | public BasisController(ICustomerServer customerSvc, ILogisticsInfoServer logisticsSvc, IUserInforServer userInforServer, IRolesServer rolesServer, IRoleRightServer roleRightServer, IRBACServer rBACServer, IUnitServer unitSvc, IPackagServer packagServer, IMaterialsServer mate, IDepartmentServer department, IFunSettingServer setting, IInterfaceServer interfaceS, IOperationSysServer operation) |
| | | public BasisController(ICustomerServer customerSvc, ILogisticsInfoServer logisticsSvc, IUserInforServer userInforServer, IRolesServer rolesServer, IRoleRightServer roleRightServer, IRBACServer rBACServer, IUnitServer unitSvc, IPackagServer packagServer, IMaterialsServer mate, IDepartmentServer department, IFunSettingServer setting, IInterfaceServer interfaceS, IOperationSysServer operation, IRoleWareHouseServer roleWareSvs) |
| | | { |
| | | _customerSvc = customerSvc;//客户Svc |
| | | _logisticsSvc = logisticsSvc;//物流Svc |
| | |
| | | _setting = setting; //功能设定 |
| | | _interface = interfaceS;//接口管理 |
| | | _operation = operation; //操作日志 |
| | | _roleWareSvs = roleWareSvs; |
| | | } |
| | | //基本信息管理 |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 角色仓库权限 |
| | | |
| | | /// <summary> |
| | | /// 获取角色权限信息列表(单表) |
| | | /// </summary> |
| | | /// <param name="id">角色权限id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetRoleWareHouseOneListById(int id) |
| | | { |
| | | try |
| | | { |
| | | List<SysRoleWareHouse> roleRights = _roleWareSvs.GetRoleWareHouseOneListById(id); |
| | | return Ok(new { data = roleRights, msg = "成功", core = 0 }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", msg = e.Message, core = 1 }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 根据角色id获取当前所拥有权限 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetHouseList() |
| | | { |
| | | try |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | var housedto = _roleWareSvs.GetHouseList(UserId); |
| | | return Ok(new { data = housedto, code = 0, msg = "成功" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { data = "", msg = e.Message, core = 1 }); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分配角色权限信息 |
| | | /// </summary> |
| | | /// <param name="WareHouseNo">菜单号</param> |
| | | /// <param name="id">角色id</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> InsertRoleWareHouse(string WareHouseNo, int id) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | |
| | | //根据Id获取角色号 |
| | | SysRoles roles = _rolesServer.GetRoleInfoById(id); |
| | | |
| | | //保存角色权限信息 |
| | | int i = await _roleWareSvs.InsertRoleWareHouse(WareHouseNo, roles.RoleNo, userId); |
| | | //判断是否新增成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new { data = i, msg = "分配失败", code = 1 }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("系统设置", "角色权限", roles.RoleNo, "修改", "分配仓库权限 角色号:" + roles.RoleNo, Convert.ToInt32(userId)); |
| | | return Ok(new { data = i, msg = "分配成功", code = 0 }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return Ok(new { data = "", msg = "新增角色权限信息异常"+ ex.Message, code = 1 }); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 部门管理 |
| | | |
| | | /// <summary> |