|
|
@@ -4,7 +4,11 @@ using OASystem.Domain;
|
|
|
using OASystem.Domain.Dtos.Groups;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
using OASystem.Domain.Entities.Resource;
|
|
|
+using OASystem.Domain.ViewModels.Groups;
|
|
|
+using Org.BouncyCastle.Asn1.X500;
|
|
|
using System.Reflection;
|
|
|
+using System.Runtime.Intrinsics.Arm;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
@@ -841,11 +845,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(g => g.Id == groupId);
|
|
|
if (groupInfo == null) return temps;
|
|
|
|
|
|
- // 检查是否已存在流程
|
|
|
- var existingProcesses = await _sqlSugar.Queryable<Grp_ConfProcessOverview>()
|
|
|
- .Where(p => p.IsDel == 0 && p.GroupId == groupId)
|
|
|
- .ToListAsync();
|
|
|
- if (existingProcesses.Any()) return temps;
|
|
|
+ //// 检查是否已存在流程
|
|
|
+ //var existingProcesses = await _sqlSugar.Queryable<Grp_ConfProcessOverview>()
|
|
|
+ // .Where(p => p.IsDel == 0 && p.GroupId == groupId)
|
|
|
+ // .ToListAsync();
|
|
|
+ //if (existingProcesses.Any()) return temps;
|
|
|
|
|
|
#region 会务流程
|
|
|
//参与人 participators
|
|
|
@@ -882,9 +886,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
/// <summary>
|
|
|
/// 团组会务流程初始化
|
|
|
/// </summary>
|
|
|
- /// <param name="request">创建流程请求参数</param>
|
|
|
+ /// <param name="groupId">团组Id</param>
|
|
|
+ /// <param name="currUserId">当前用户Id</param>
|
|
|
+ /// <param name="nodeTempId">节点模板Id</param>
|
|
|
/// <returns>创建的流程信息</returns>
|
|
|
- public async Task<Result> ConfProcessInitAsync(int groupId, int currUserId)
|
|
|
+ public async Task<Result> ConfProcessInitAsync(int groupId, int currUserId,int nodeTempId = 1)
|
|
|
{
|
|
|
//团组验证
|
|
|
var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(g => g.Id == groupId);
|
|
|
@@ -907,7 +913,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (temps == null || temps.Count < 1)
|
|
|
return new Result { Code = 400, Msg = "团组会务默认流程不存在" };
|
|
|
|
|
|
- var process = temps.FirstOrDefault(x => x.ProcessOrder == 1);
|
|
|
+ var process = temps.FirstOrDefault(x => x.ProcessOrder == nodeTempId);
|
|
|
process.CreateUserId = currUserId;
|
|
|
_sqlSugar.BeginTran();
|
|
|
|
|
|
@@ -968,9 +974,10 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
/// <summary>
|
|
|
/// 获取团组会务流程及节点详情
|
|
|
/// </summary>
|
|
|
- /// <param name="request">创建流程请求参数</param>
|
|
|
- /// <returns>创建的流程信息</returns>
|
|
|
- public async Task<Result> ConfProcessesDetailsAsync(int groupId)
|
|
|
+ /// <param name="groupId">团组Id</param>
|
|
|
+ /// <param name="currUserId">当前用户Id</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> ConfProcessesDetailsAsync(int groupId, int currUserId = 4)
|
|
|
{
|
|
|
//团组验证
|
|
|
var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(g => g.Id == groupId);
|
|
|
@@ -986,7 +993,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (!existingProcesses.Any())
|
|
|
{
|
|
|
//新建团组流程
|
|
|
- var res = await ConfProcessInitAsync(groupId, 4);
|
|
|
+ var res = await ConfProcessInitAsync(groupId, currUserId);
|
|
|
if (res.Code != 200)
|
|
|
{
|
|
|
return res;
|
|
|
@@ -1008,11 +1015,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
var orderedNodes = p.Nodes.OrderBy(n => n.NodeOrder).ToList();
|
|
|
var totalNodes = orderedNodes.Count;
|
|
|
|
|
|
- return new
|
|
|
+ return new ConfProcessOverInfoView()
|
|
|
{
|
|
|
- p.Id,
|
|
|
- p.GroupId,
|
|
|
- p.ProcessType,
|
|
|
+ Id = p.Id,
|
|
|
+ GroupId = p.GroupId,
|
|
|
+ ProcessType = p.ProcessType,
|
|
|
ProcessName = p.ProcessType.GetEnumDescription(),
|
|
|
Nodes = orderedNodes.Select((n, index) =>
|
|
|
{
|
|
|
@@ -1049,20 +1056,20 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
operatorName = name;
|
|
|
}
|
|
|
|
|
|
- return new
|
|
|
+ return new ConfProcessNodeInfoView()
|
|
|
{
|
|
|
- n.Id,
|
|
|
- n.ProcessId,
|
|
|
- n.NodeOrder,
|
|
|
- n.NodeName,
|
|
|
- n.NodeDescTips,
|
|
|
- n.OverallStatus,
|
|
|
- participators,
|
|
|
+ Id = n.Id,
|
|
|
+ ProcessId = n.ProcessId,
|
|
|
+ NodeOrder = n.NodeOrder,
|
|
|
+ NodeName = n.NodeName,
|
|
|
+ NodeDescTips = n.NodeDescTips,
|
|
|
+ OverallStatus = n.OverallStatus,
|
|
|
+ Participators = participators,
|
|
|
StatusText = n.OverallStatus.GetEnumDescription(),
|
|
|
Operator = operatorName,
|
|
|
OpeateTime = n.OperationTime?.ToString("yyyy-MM-dd HH:mm:ss") ?? "-",
|
|
|
ActualDone = n.ActualDone?.ToString("yyyy-MM-dd HH:mm:ss") ?? "",
|
|
|
- n.IsFileUp, // 票据上传节点 存储值
|
|
|
+ IsFileUp = n.IsFileUp, // 票据上传节点 存储值
|
|
|
};
|
|
|
}).ToList()
|
|
|
};
|
|
|
@@ -1071,6 +1078,81 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
return new Result { Code = 200, Data = processes, Msg = "查询成功!" };
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新节点模板
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="groupId">团组Id</param>
|
|
|
+ /// <param name="nodeTempId">节点模板Id</param>
|
|
|
+ /// <param name="currUserId">当前用户Id</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<Result> ConfProcessChangeNodeTempSaveAsync(int groupId, int nodeTempId, int currUserId)
|
|
|
+ {
|
|
|
+ //节点模板id验证
|
|
|
+ var nodeTempIds = new List<int>() { 1, 2 };
|
|
|
+ if (!nodeTempIds.Contains(nodeTempId))
|
|
|
+ {
|
|
|
+ return new Result { Code = 400, Msg = "请传入有效的节点模板Id" };
|
|
|
+ }
|
|
|
+
|
|
|
+ //团组验证
|
|
|
+ var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(g => g.Id == groupId);
|
|
|
+ if (groupInfo == null)
|
|
|
+ {
|
|
|
+ return new Result { Code = 400, Msg = "团组不存在" };
|
|
|
+ }
|
|
|
+
|
|
|
+ _sqlSugar.BeginTran();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 检查是否已存在流程
|
|
|
+ var existingProcesses = await _sqlSugar.Queryable<Grp_ConfProcessOverview>()
|
|
|
+ .Where(p => p.IsDel == 0 && p.GroupId == groupId)
|
|
|
+ .ToListAsync();
|
|
|
+ if (existingProcesses.Any())
|
|
|
+ {
|
|
|
+ //删除 原有的节点模板
|
|
|
+ var parentIds = existingProcesses.Select(x => x.Id).ToList();
|
|
|
+ var updProcesses = await _sqlSugar.Updateable<Grp_ConfProcessOverview>()
|
|
|
+ .SetColumns(x => x.DeleteUserId == currUserId)
|
|
|
+ .SetColumns(x => x.DeleteTime == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .SetColumns(x => x.IsDel == 1)
|
|
|
+ .Where(x => parentIds.Contains(x.Id))
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+
|
|
|
+ var updProcessNodes = await _sqlSugar.Updateable<Grp_ConfProcessNode>()
|
|
|
+ .SetColumns(x => x.DeleteUserId == currUserId)
|
|
|
+ .SetColumns(x => x.DeleteTime == DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
|
|
|
+ .SetColumns(x => x.IsDel == 1)
|
|
|
+ .Where(x => parentIds.Contains(x.ProcessId))
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新模板节点信息
|
|
|
+ var result = await ConfProcessInitAsync(groupId,currUserId,nodeTempId);
|
|
|
+
|
|
|
+ if (result.Code == 200)
|
|
|
+ {
|
|
|
+
|
|
|
+ var infoResult = await ConfProcessesDetailsAsync(groupId, currUserId);
|
|
|
+
|
|
|
+ if (infoResult.Code == 200)
|
|
|
+ {
|
|
|
+ _sqlSugar.CommitTran();
|
|
|
+ return infoResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ return new Result { Code = 500, Msg = $"操作失败!Msg:{result.Msg}" };
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ return new Result { Code = 500, Msg = $"操作失败!Msg:{ex.Message}" };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 更新团组会务流程节点状态
|
|
|
/// </summary>
|