|
@@ -1,6 +1,9 @@
|
|
|
using Aspose.Cells;
|
|
|
+using Microsoft.AspNetCore.SignalR;
|
|
|
using NPOI.POIFS.Crypt.Dsig;
|
|
|
using OASystem.API.OAMethodLib;
|
|
|
+using OASystem.API.OAMethodLib.Hub.HubClients;
|
|
|
+using OASystem.API.OAMethodLib.Hub.Hubs;
|
|
|
using OASystem.API.OAMethodLib.QiYeWeChatAPI;
|
|
|
using OASystem.Domain.Dtos.PersonnelModule;
|
|
|
using OASystem.Domain.Entities.PersonnelModule;
|
|
@@ -32,6 +35,7 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
private string url;
|
|
|
private string path;
|
|
|
+ private readonly IHubContext<ChatHub, IChatClient> _hubContext;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 初始化
|
|
@@ -41,7 +45,7 @@ namespace OASystem.API.Controllers
|
|
|
/// <param name="usersRep"></param>
|
|
|
/// <param name="mapper"></param>
|
|
|
public PersonnelModuleController(IQiYeWeChatApiService qiYeWeChatApiService,WageSheetRepository wageSheetRep, UsersRepository usersRep, IMapper mapper,
|
|
|
- TaskAllocationRepository taskAllocationRep)
|
|
|
+ TaskAllocationRepository taskAllocationRep, IHubContext<ChatHub, IChatClient> hubContext)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
_usersRep = usersRep;
|
|
@@ -57,6 +61,7 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
this._taskAllocationRep = taskAllocationRep;
|
|
|
+ _hubContext = hubContext;
|
|
|
}
|
|
|
|
|
|
#region 工资表单
|
|
@@ -1183,6 +1188,15 @@ namespace OASystem.API.Controllers
|
|
|
var _view = await _taskAllocationRep._AddOrEdit(_dto);
|
|
|
if (_view.Code == 0)
|
|
|
{
|
|
|
+
|
|
|
+ if (_dto.Id == 0) //添加提示任务单创建
|
|
|
+ {
|
|
|
+ string title = $"[{_dto.TaskName}] 任务新建成功!";
|
|
|
+ string content = $"[{_dto.TaskName}] 任务新建成功,请前往任务页面查看详情!";
|
|
|
+
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate,title,content,_dto.UserIds);
|
|
|
+ }
|
|
|
+
|
|
|
return Ok(JsonView(true, "操作成功!"));
|
|
|
}
|
|
|
|
|
@@ -1233,6 +1247,34 @@ namespace OASystem.API.Controllers
|
|
|
var _view = await _taskAllocationRep._TaskerSetStartStatus(_dto.UserId, _dto.Id);
|
|
|
if (_view.Code == 0)
|
|
|
{
|
|
|
+ //发送消息
|
|
|
+ var taskData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskAllocation>().Where(it => it.Id == _dto.Id).First();
|
|
|
+ if (taskData != null)
|
|
|
+ {
|
|
|
+ var taskUserIds = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskRelevanceUser>().Where(it => it.TAId == _dto.Id).Select(it => it.UserId).ToList();
|
|
|
+ if (taskUserIds.Count > 0)
|
|
|
+ {
|
|
|
+ taskUserIds.Remove(_dto.UserId);
|
|
|
+ }
|
|
|
+
|
|
|
+ var UserName = _taskAllocationRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == _dto.UserId).Select(it => it.CnName).First();
|
|
|
+
|
|
|
+ string title_createUser = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string conten_createUser = $"[{UserName}] 已开始任务,请注意该工作人员任务进度!";
|
|
|
+
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title_createUser, conten_createUser, new List<int>() { taskData.CreateUserId }); //创建人发送消息
|
|
|
+
|
|
|
+ string title = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string content = $"[{UserName}] 已开始任务.若需查看,请前往任务页面查看详情!";
|
|
|
+
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content, taskUserIds); //其他人发送消息
|
|
|
+
|
|
|
+
|
|
|
+ string content1 = $"任务已开始,请在规定时间完成!若需查看,请前往任务页面查看详情!";
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content1, new List<int>() { _dto.UserId }); //设置任务人 发送消息
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return Ok(JsonView(true, "操作成功!"));
|
|
|
}
|
|
|
|
|
@@ -1258,6 +1300,34 @@ namespace OASystem.API.Controllers
|
|
|
var _view = await _taskAllocationRep._TaskerSetOverStatus(_dto.UserId, _dto.Id);
|
|
|
if (_view.Code == 0)
|
|
|
{
|
|
|
+ //发送消息
|
|
|
+ var taskData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskAllocation>().Where(it => it.Id == _dto.Id).First();
|
|
|
+ if (taskData != null)
|
|
|
+ {
|
|
|
+ var taskUserIds = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskRelevanceUser>().Where(it => it.TAId == _dto.Id).Select(it => it.UserId).ToList();
|
|
|
+ if (taskUserIds.Count > 0)
|
|
|
+ {
|
|
|
+ taskUserIds.Remove(_dto.UserId);
|
|
|
+ }
|
|
|
+
|
|
|
+ var UserName = _taskAllocationRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == _dto.UserId).Select(it => it.CnName).First();
|
|
|
+
|
|
|
+ string title_createUser = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string conten_createUser = $"[{UserName}] 已完成任务,请前往任务页面进行审核操作!";
|
|
|
+
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title_createUser, conten_createUser, new List<int>() { taskData.CreateUserId }); //创建人发送消息
|
|
|
+
|
|
|
+ string title = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string content = $"[{UserName}] 已完成任务,请注意在规定时间内完成任务.若需查看,请前往任务页面查看详情!";
|
|
|
+
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content, taskUserIds); //其他人发送消息
|
|
|
+
|
|
|
+
|
|
|
+ string content1 = $"任务已完成,等待任务发布人审核!若需查看,请前往任务页面查看详情!";
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content1, new List<int>() { _dto.UserId }); //设置任务人 发送消息
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return Ok(JsonView(true, "操作成功!"));
|
|
|
}
|
|
|
|
|
@@ -1280,10 +1350,31 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
var _view = await _taskAllocationRep._TaskSetHaveStatus(_dto.SubId);
|
|
|
if (_view.Code == 0)
|
|
|
{
|
|
|
+ //发送消息
|
|
|
+ var taskUserData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskRelevanceUser>().Where(it => it.Id == _dto.SubId).First();
|
|
|
+ if (taskUserData != null)
|
|
|
+ {
|
|
|
+ var taskData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskAllocation>().Where(it => it.Id == taskUserData.TAId).First();
|
|
|
+
|
|
|
+ if (taskData != null)
|
|
|
+ {
|
|
|
+
|
|
|
+ var UserName = _taskAllocationRep._sqlSugar.Queryable<Sys_Users>().Where(it => it.Id == taskData.CreateUserId).Select(it => it.CnName).First();
|
|
|
+
|
|
|
+ string title = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string conten_createUser = $"[{UserName}] 已知晓任务.若需查看,请前往任务页面查看详情!";
|
|
|
+
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, conten_createUser, new List<int>() { taskData.CreateUserId }); //创建人发送消息
|
|
|
+
|
|
|
+ string content = $"请注意任务完成时间!若需查看,请前往任务页面查看详情!";
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content, new List<int>() { taskUserData.UserId }); //设置任务人 发送消息
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return Ok(JsonView(true, "操作成功!"));
|
|
|
}
|
|
|
|
|
@@ -1306,10 +1397,24 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
-
|
|
|
var _view = await _taskAllocationRep._TaskSetAuditStatus(_dto.SubId);
|
|
|
if (_view.Code == 0)
|
|
|
{
|
|
|
+ //发送消息
|
|
|
+ var taskUserData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskRelevanceUser>().Where(it => it.Id == _dto.SubId).First();
|
|
|
+ if (taskUserData != null)
|
|
|
+ {
|
|
|
+ var taskData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskAllocation>().Where(it => it.Id == taskUserData.TAId).First();
|
|
|
+
|
|
|
+ if (taskData != null)
|
|
|
+ {
|
|
|
+ string title = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string content = $"任务已完成!若需查看,请前往任务页面查看详情!";
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content, new List<int>() { taskUserData.UserId }); //设置任务人 发送消息
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return Ok(JsonView(true, "操作成功!"));
|
|
|
}
|
|
|
|
|
@@ -1336,6 +1441,21 @@ namespace OASystem.API.Controllers
|
|
|
var _view = await _taskAllocationRep._TaskSetUnFinishedStatus(_dto.SubId,_dto.Cause);
|
|
|
if (_view.Code == 0)
|
|
|
{
|
|
|
+ //发送消息
|
|
|
+ var taskUserData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskRelevanceUser>().Where(it => it.Id == _dto.SubId).First();
|
|
|
+ if (taskUserData != null)
|
|
|
+ {
|
|
|
+ var taskData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskAllocation>().Where(it => it.Id == taskUserData.TAId).First();
|
|
|
+
|
|
|
+ if (taskData != null)
|
|
|
+ {
|
|
|
+ string title = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string content = $"任务未完成!若需查看,请前往任务页面查看详情!";
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content, new List<int>() { taskUserData.UserId }); //设置任务人 发送消息
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return Ok(JsonView(true, "操作成功!"));
|
|
|
}
|
|
|
|
|
@@ -1456,6 +1576,21 @@ namespace OASystem.API.Controllers
|
|
|
var _view = await _taskAllocationRep._TaskScore(_dto);
|
|
|
if (_view.Code == 0)
|
|
|
{
|
|
|
+ //发送消息
|
|
|
+ var taskUserData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskRelevanceUser>().Where(it => it.Id == _dto.SubId).First();
|
|
|
+ if (taskUserData != null)
|
|
|
+ {
|
|
|
+ var taskData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskAllocation>().Where(it => it.Id == taskUserData.TAId).First();
|
|
|
+
|
|
|
+ if (taskData != null)
|
|
|
+ {
|
|
|
+ string title = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string content = $"任务评分已完成!若需查看,请前往任务页面查看详情!";
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content, new List<int>() { taskUserData.UserId }); //设置任务人 发送消息
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return Ok(JsonView(true, "操作成功!"));
|
|
|
}
|
|
|
|
|
@@ -1469,7 +1604,7 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
/// <summary>
|
|
|
/// 任务分配
|
|
|
- /// 任务发布者 任务终止
|
|
|
+ /// 任务发布者 任务终止
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost]
|
|
@@ -1496,6 +1631,20 @@ namespace OASystem.API.Controllers
|
|
|
var _view = await _taskAllocationRep._TaskTermination(_dto.Id);
|
|
|
if (_view.Code == 0)
|
|
|
{
|
|
|
+ //发送消息
|
|
|
+ var taskData = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskAllocation>().Where(it => it.Id == _dto.Id).First();
|
|
|
+ if (taskData != null)
|
|
|
+ {
|
|
|
+ var taskUserIds = _taskAllocationRep._sqlSugar.Queryable<Pm_TaskRelevanceUser>().Where(it => it.Id == _dto.Id).Select(it => it.UserId).ToList();
|
|
|
+ taskUserIds.Add(taskData.CreateUserId);
|
|
|
+
|
|
|
+
|
|
|
+ string title = $"[{taskData.TaskName}] 进度更新!";
|
|
|
+ string content = $"任务已终止!若需查看,请前往任务页面查看详情!";
|
|
|
+ await GeneralMethod.MessageIssueAndNotification(MessageTypeEnum.TaskProgressUpdate, title, content, taskUserIds); //设置任务人 发送消息
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return Ok(JsonView(true, "操作成功!"));
|
|
|
}
|
|
|
|