|
@@ -1,6 +1,7 @@
|
|
|
using Aliyun.Credentials.Utils;
|
|
|
using Aspose.Cells;
|
|
|
using FluentValidation;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
using NPOI.POIFS.Crypt.Dsig;
|
|
@@ -10,6 +11,7 @@ using OASystem.API.OAMethodLib.Hub.Hubs;
|
|
|
using OASystem.API.OAMethodLib.QiYeWeChatAPI;
|
|
|
using OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice;
|
|
|
using OASystem.API.OAMethodLib.Quartz.Business;
|
|
|
+using OASystem.API.OAMethodLib.SignalR.Hubs;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
|
using OASystem.Domain.Dtos.PersonnelModule;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
@@ -25,6 +27,7 @@ using System.Data;
|
|
|
using System.Diagnostics;
|
|
|
using System.Globalization;
|
|
|
using System.IO;
|
|
|
+using static OASystem.API.OAMethodLib.JWTHelper;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -54,8 +57,17 @@ namespace OASystem.API.Controllers
|
|
|
/// <param name="wageSheetRep"></param>
|
|
|
/// <param name="usersRep"></param>
|
|
|
/// <param name="mapper"></param>
|
|
|
- public PersonnelModuleController(IQiYeWeChatApiService qiYeWeChatApiService, WageSheetRepository wageSheetRep, UsersRepository usersRep, IMapper mapper,
|
|
|
- TaskAllocationRepository taskAllocationRep, IHubContext<ChatHub, IChatClient> hubContext, GoodsRepository goodsRep)
|
|
|
+ /// <param name="taskAllocationRep"></param>
|
|
|
+ /// <param name="hubContext"></param>
|
|
|
+ /// <param name="goodsRep"></param>
|
|
|
+ public PersonnelModuleController(IQiYeWeChatApiService qiYeWeChatApiService,
|
|
|
+ WageSheetRepository wageSheetRep,
|
|
|
+ UsersRepository usersRep,
|
|
|
+ IMapper mapper,
|
|
|
+ TaskAllocationRepository taskAllocationRep,
|
|
|
+ IHubContext<ChatHub, IChatClient> hubContext,
|
|
|
+ GoodsRepository goodsRep
|
|
|
+ )
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
_usersRep = usersRep;
|
|
@@ -73,6 +85,7 @@ namespace OASystem.API.Controllers
|
|
|
this._taskAllocationRep = taskAllocationRep;
|
|
|
_hubContext = hubContext;
|
|
|
_goodsRep = goodsRep;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#region 工资表单
|
|
@@ -1809,7 +1822,7 @@ namespace OASystem.API.Controllers
|
|
|
/// 物品 详情
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- [HttpGet]
|
|
|
+ [HttpGet()]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> GoodsInfo(int portType, int id)
|
|
|
{
|
|
@@ -1828,6 +1841,9 @@ namespace OASystem.API.Controllers
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> GoodsOP(GoodsOPDTO _dto)
|
|
|
{
|
|
|
+ var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
|
|
|
+ if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
|
|
|
+
|
|
|
var validator = new GoodsOPDTOValidator();
|
|
|
var validatorRes = await validator.ValidateAsync(_dto);
|
|
|
if (!validatorRes.IsValid)
|
|
@@ -1837,7 +1853,7 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(false, sb.ToString()));
|
|
|
}
|
|
|
|
|
|
- return Ok(await _goodsRep.GoodsOP(_dto));
|
|
|
+ return Ok(await _goodsRep.GoodsOP(_dto, _currUserInfo.UserId));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1847,12 +1863,14 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpDelete("{id}")]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> GoodsDel(int id,[FromQuery] int currUserId)
|
|
|
+ public async Task<IActionResult> GoodsDel(int id)
|
|
|
{
|
|
|
if (id < 1) return Ok(JsonView(false, MsgTips.Id));
|
|
|
- if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
|
|
|
|
|
|
- return Ok(await _goodsRep.GoodsDel(id,currUserId));
|
|
|
+ var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
|
|
|
+ if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
|
|
|
+
|
|
|
+ return Ok(await _goodsRep.GoodsDel(id, _currUserInfo.UserId));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1875,14 +1893,14 @@ namespace OASystem.API.Controllers
|
|
|
/// 入库 详情
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- [HttpGet]
|
|
|
+ [HttpGet("{id}")]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> GoodsStorageInfo(int portType, int id)
|
|
|
+ public async Task<IActionResult> GoodsStorageInfo([FromQuery] int portType, int id)
|
|
|
{
|
|
|
if (portType > 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
|
|
|
if (id < 1) return Ok(JsonView(false, MsgTips.Id));
|
|
|
|
|
|
- return Ok(await _goodsRep.GoodsStorageInfo(portType,id));
|
|
|
+ return Ok(await _goodsRep.GoodsStorageInfo(portType, id));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1894,6 +1912,9 @@ namespace OASystem.API.Controllers
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> GoodsStorageOP(GoodsStorageOPDTO _dto)
|
|
|
{
|
|
|
+ var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
|
|
|
+ if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
|
|
|
+
|
|
|
var vadalitor = new GoodsStorageOPDTOValidator();
|
|
|
var vadalitorRes = await vadalitor.ValidateAsync(_dto);
|
|
|
if (!vadalitorRes.IsValid)
|
|
@@ -1903,7 +1924,7 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(false, sb.ToString()));
|
|
|
}
|
|
|
|
|
|
- return Ok(await _goodsRep.GoodsStorageOP(_dto));
|
|
|
+ return Ok(await _goodsRep.GoodsStorageOP(_dto, _currUserInfo.UserId));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1912,13 +1933,16 @@ namespace OASystem.API.Controllers
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpDelete("{id}")]
|
|
|
+ [Authorize]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> GoodsStorageDel(int id, [FromQuery] int currUserId)
|
|
|
+ public async Task<IActionResult> GoodsStorageDel(int id)
|
|
|
{
|
|
|
+ var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
|
|
|
+ if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
|
|
|
+
|
|
|
if (id < 1) return Ok(JsonView(false, MsgTips.Id));
|
|
|
- if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
|
|
|
|
|
|
- return Ok(await _goodsRep.GoodsStorageDel(id,currUserId));
|
|
|
+ return Ok(await _goodsRep.GoodsStorageDel(id, _currUserInfo.UserId));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1941,9 +1965,9 @@ namespace OASystem.API.Controllers
|
|
|
/// 领用详情
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- [HttpGet]
|
|
|
+ [HttpGet("{id}")]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> GoodsReceiveInfo(int portType, int id)
|
|
|
+ public async Task<IActionResult> GoodsReceiveInfo([FromQuery]int portType, int id)
|
|
|
{
|
|
|
if (portType > 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
|
|
|
if (id < 1) return Ok(JsonView(false, MsgTips.Id));
|
|
@@ -1960,6 +1984,9 @@ namespace OASystem.API.Controllers
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> GoodsReceiveOP(GoodsReceiveOPDTO _dto)
|
|
|
{
|
|
|
+ var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
|
|
|
+ if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
|
|
|
+
|
|
|
var vadalitor = new GoodsReceiveOPDTOValidator();
|
|
|
var vadalitorRes = await vadalitor.ValidateAsync(_dto);
|
|
|
if (!vadalitorRes.IsValid)
|
|
@@ -1969,7 +1996,7 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(false, sb.ToString()));
|
|
|
}
|
|
|
|
|
|
- return Ok(await _goodsRep.GoodsReceiveOP(_dto));
|
|
|
+ return Ok(await _goodsRep.GoodsReceiveOP(_dto, _currUserInfo.UserId));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1982,6 +2009,9 @@ namespace OASystem.API.Controllers
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> GoodsReceiveAudit(GoodsReceiveAuditDTO _dto)
|
|
|
{
|
|
|
+ var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
|
|
|
+ if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
|
|
|
+
|
|
|
var vadalitor = new GoodsReceiveAuditDTOValidator();
|
|
|
var vadalitorRes = await vadalitor.ValidateAsync(_dto);
|
|
|
if (!vadalitorRes.IsValid)
|
|
@@ -1999,7 +2029,7 @@ namespace OASystem.API.Controllers
|
|
|
else return id;
|
|
|
})
|
|
|
.ToArray();
|
|
|
- return Ok(await _goodsRep.GoodsReceiveAudit(idArray,_dto.CurrUserId,_dto.AuditEnum));
|
|
|
+ return Ok(await _goodsRep.GoodsReceiveAudit(idArray, _currUserInfo.UserId, _dto.AuditEnum));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -2009,12 +2039,14 @@ namespace OASystem.API.Controllers
|
|
|
/// <returns></returns>
|
|
|
[HttpDelete("{id}")]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> GoodsReceiveDel(int id, [FromQuery] int currUserId)
|
|
|
+ public async Task<IActionResult> GoodsReceiveDel(int id)
|
|
|
{
|
|
|
+ var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
|
|
|
+ if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
|
|
|
+
|
|
|
if (id < 1) return Ok(JsonView(false, MsgTips.Id));
|
|
|
- if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
|
|
|
|
|
|
- return Ok(await _goodsRep.GoodsReceiveDel(id, currUserId));
|
|
|
+ return Ok(await _goodsRep.GoodsReceiveDel(id, _currUserInfo.UserId));
|
|
|
}
|
|
|
#endregion
|
|
|
}
|