1811 lines
74 KiB
C#
1811 lines
74 KiB
C#
using Learun.Util;
|
||
using Learun.Util.SqlSugar;
|
||
using SqlSugar;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Text;
|
||
|
||
namespace Learun.Application.WorkFlow
|
||
{
|
||
/// <summary>
|
||
/// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
|
||
/// Copyright (c) 2013-2018 Hexagon PPM
|
||
/// 创建人:研发部
|
||
/// 日 期:2018.12.07
|
||
/// 描 述:流程进程
|
||
/// </summary>
|
||
public class NWFProcessSericve
|
||
{
|
||
#region 仓储
|
||
Repository<NWFProcessEntity> _NWFProcessRepository => new Repository<NWFProcessEntity>();
|
||
Repository<NWFDelegateRuleEntity> _NWFDelegateRuleRepository => new Repository<NWFDelegateRuleEntity>();
|
||
Repository<NWFTaskEntity> _NWFTaskRepository => new Repository<NWFTaskEntity>();
|
||
Repository<NWFTaskRelationEntity> _NWFTaskRelationRepository => new Repository<NWFTaskRelationEntity>();
|
||
Repository<NWFTaskMsgEntity> _NWFTaskMsgRepository => new Repository<NWFTaskMsgEntity>();
|
||
Repository<NWFTaskLogEntity> _NWFTaskLogRepository => new Repository<NWFTaskLogEntity>();
|
||
Repository<NWFConfluenceEntity> _NWFConfluenceRepository => new Repository<NWFConfluenceEntity>();
|
||
#endregion
|
||
#region 获取数据
|
||
/// <summary>
|
||
/// 获取流程进程实体
|
||
/// </summary>
|
||
/// <param name="keyValue">主键</param>
|
||
/// <returns></returns>
|
||
public NWFProcessEntity GetEntity(string keyValue)
|
||
{
|
||
try
|
||
{
|
||
//return this.BaseRepository().FindEntity<NWFProcessEntity>(keyValue);
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t1.*
|
||
,t2.ProjectName
|
||
FROM LR_NWF_Process t1
|
||
LEFT JOIN ec_project t2 ON t1.ProjectId=t2.ProjectId
|
||
WHERE t1.F_Id = @keyValue ");
|
||
var dp = new List<SugarParameter>();
|
||
dp.Add(new SugarParameter("keyValue", keyValue));
|
||
//return this.BaseRepository().FindEntity<NWFProcessEntity>(strSql.ToString(), dp);
|
||
return SqlSugarHelper.Db.Ado.SqlQuerySingle<NWFProcessEntity>(strSql.ToString(), dp);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取流程进程实例
|
||
/// </summary>
|
||
/// <param name="processId">父流程进程主键</param>
|
||
/// <param name="nodeId">节点主键</param>
|
||
/// <returns></returns>
|
||
public NWFProcessEntity GetEntityByProcessId(string processId, string nodeId) {
|
||
try
|
||
{
|
||
//return this.BaseRepository().FindEntity<NWFProcessEntity>(t=>t.F_ParentProcessId == processId && t.F_ParentNodeId == nodeId);
|
||
return _NWFProcessRepository.GetFirst(t => t.F_ParentProcessId == processId && t.F_ParentNodeId == nodeId);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取子流程列表
|
||
/// </summary>
|
||
/// <param name="parentProcessId">父流程进程主键</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetChildProcessList(string parentProcessId) {
|
||
try
|
||
{
|
||
//return this.BaseRepository().FindList<NWFProcessEntity>(t => t.F_ParentProcessId == parentProcessId);
|
||
return _NWFProcessRepository.GetList(t => t.F_ParentProcessId == parentProcessId);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取流程信息列表
|
||
/// </summary>
|
||
/// <param name="pagination">分页参数</param>
|
||
/// <param name="queryJson">查询条件</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetPageList(Pagination pagination, string queryJson)
|
||
{
|
||
try
|
||
{
|
||
var expression = LinqExtensions.True<NWFProcessEntity>();
|
||
var queryParam = queryJson.ToJObject();
|
||
// 分类
|
||
if (!queryParam["categoryId"].IsEmpty()) // 1:未完成 2:已完成
|
||
{
|
||
if (queryParam["categoryId"].ToString() == "1")
|
||
{
|
||
expression = expression.And(t => t.F_IsFinished == 0);
|
||
}
|
||
else
|
||
{
|
||
expression = expression.And(t => t.F_IsFinished == 1);
|
||
}
|
||
}
|
||
//项目
|
||
if (!queryParam["ProjectId"].IsEmpty())
|
||
{
|
||
string ProjectId = queryParam["ProjectId"].ToString();
|
||
expression = expression.And(t => t.ProjectId == ProjectId);
|
||
}else
|
||
{
|
||
//expression = expression.And(t => t.ProjectId == "");
|
||
}
|
||
// 操作时间
|
||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
|
||
{
|
||
DateTime startTime = queryParam["StartTime"].ToDate();
|
||
DateTime endTime = queryParam["EndTime"].ToDate();
|
||
expression = expression.And(t => t.F_CreateDate >= startTime && t.F_CreateDate <= endTime);
|
||
}
|
||
// 关键字
|
||
if (!queryParam["keyword"].IsEmpty())
|
||
{
|
||
string keyword = queryParam["keyword"].ToString();
|
||
expression = expression.And(t => t.F_Title.Contains(keyword) || t.F_SchemeName.Contains(keyword) || t.F_CreateUserName.Contains(keyword));
|
||
}
|
||
expression = expression.And(t => t.F_EnabledMark != 2);
|
||
expression = expression.And(t => t.F_IsChild == 0);
|
||
|
||
//return this.BaseRepository().FindList<NWFProcessEntity>(expression, pagination);
|
||
return _NWFProcessRepository.GetPageList(expression, new PageModel() { PageIndex = pagination.page, PageSize = pagination.rows });
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取我的流程信息列表
|
||
/// </summary>
|
||
/// <param name="userId">用户主键</param>
|
||
/// <param name="pagination">分页参数</param>
|
||
/// <param name="queryJson">查询条件</param>
|
||
/// <param name="schemeCode">流程模板编码</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetMyPageList(string userId, Pagination pagination, string queryJson, string schemeCode, string ProjectId)
|
||
{
|
||
try
|
||
{
|
||
var expression = LinqExtensions.True<NWFProcessEntity>();
|
||
var queryParam = queryJson.ToJObject();
|
||
|
||
//update by chenkai 20210421 单位平台时显示所有流程
|
||
ProjectId = (string.IsNullOrEmpty(ProjectId) || ProjectId.ToLower() == "null") ? "" : ProjectId;
|
||
if (!string.IsNullOrEmpty(ProjectId))
|
||
{
|
||
expression = expression.And(t => t.ProjectId == ProjectId);
|
||
}
|
||
|
||
expression = expression.And(t => t.F_CreateUserId == userId);
|
||
|
||
// 操作时间
|
||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
|
||
{
|
||
DateTime startTime = queryParam["StartTime"].ToDate();
|
||
DateTime endTime = queryParam["EndTime"].ToDate();
|
||
expression = expression.And(t => t.F_CreateDate >= startTime && t.F_CreateDate <= endTime);
|
||
}
|
||
// 关键字
|
||
if (!queryParam["keyword"].IsEmpty())
|
||
{
|
||
string keyword = queryParam["keyword"].ToString();
|
||
expression = expression.And(t => t.F_Title.Contains(keyword) || t.F_SchemeName.Contains(keyword));
|
||
}
|
||
if (!string.IsNullOrEmpty(schemeCode)) {
|
||
expression = expression.And(t => t.F_SchemeCode.Equals(schemeCode));
|
||
}
|
||
expression = expression.And(t => t.F_IsChild == 0);
|
||
return _NWFProcessRepository.GetPageList(expression, new PageModel() { PageIndex = pagination.page, PageSize = pagination.rows });
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取我的流程信息列表
|
||
/// </summary>
|
||
/// <param name="userId">用户主键</param>
|
||
/// <param name="pagination">分页参数</param>
|
||
/// <param name="schemeCode">流程模板编码</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetMyPageList(string userId, string queryJson, string schemeCode)
|
||
{
|
||
try
|
||
{
|
||
var expression = LinqExtensions.True<NWFProcessEntity>();
|
||
var queryParam = queryJson.ToJObject();
|
||
expression = expression.And(t => t.F_CreateUserId == userId);
|
||
// 操作时间
|
||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
|
||
{
|
||
DateTime startTime = queryParam["StartTime"].ToDate();
|
||
DateTime endTime = queryParam["EndTime"].ToDate();
|
||
expression = expression.And(t => t.F_CreateDate >= startTime && t.F_CreateDate <= endTime);
|
||
}
|
||
// 关键字
|
||
if (!queryParam["keyword"].IsEmpty())
|
||
{
|
||
string keyword = queryParam["keyword"].ToString();
|
||
expression = expression.And(t => t.F_Title.Contains(keyword) || t.F_SchemeName.Contains(keyword));
|
||
}
|
||
if (!string.IsNullOrEmpty(schemeCode))
|
||
{
|
||
expression = expression.And(t => t.F_SchemeCode.Equals(schemeCode));
|
||
}
|
||
expression = expression.And(t => t.F_IsChild == 0);
|
||
return _NWFProcessRepository.GetList(expression);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取我的待办任务列表
|
||
/// </summary>
|
||
/// <param name="userInfo">用户信息</param>
|
||
/// <param name="pagination">翻页信息</param>
|
||
/// <param name="queryJson">查询条件</param>
|
||
/// <param name="schemeCode">流程模板编码</param>
|
||
/// <param name="isBatchAudit">true获取批量审核任务</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetMyTaskPageList(UserInfo userInfo, Pagination pagination, string queryJson,string schemeCode, string ProjectId, bool isBatchAudit = false)
|
||
{
|
||
try
|
||
{
|
||
string userId = userInfo.userId;
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t.F_Id AS F_TaskId,
|
||
t.F_Type AS F_TaskType,
|
||
t.F_NodeName AS F_TaskName,
|
||
t.F_IsUrge,
|
||
t.F_ModifyDate as F_CreateDate,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Title,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart,
|
||
p.F_ObjectId
|
||
FROM
|
||
(
|
||
SELECT
|
||
F_TaskId
|
||
FROM
|
||
LR_NWF_TaskRelation r1
|
||
INNER JOIN LR_NWF_Task t1 ON r1.F_TaskId = t1.F_Id
|
||
WHERE r1.F_Mark = 0 AND r1.F_Result = 0 AND (r1.F_UserId = @userId
|
||
");
|
||
|
||
|
||
// 添加委托信息
|
||
List<UserInfo> delegateList = GetDelegateProcess(userId);
|
||
foreach (var item in delegateList)
|
||
{
|
||
string processId = "'" + item.wfProcessId.Replace(",", "','") + "'";
|
||
string userI2 = "'" + item.userId + "'";
|
||
|
||
strSql.Append(" OR (r1.F_UserId =" + userI2 + " AND t1.F_ProcessId in (" + processId + ") AND t1.F_Type != 2 )");
|
||
}
|
||
strSql.Append(@") GROUP BY
|
||
F_TaskId
|
||
) r
|
||
INNER JOIN LR_NWF_Task t ON t.F_Id = r.F_TaskId
|
||
INNER JOIN LR_NWF_Process p ON p.F_Id = t.F_ProcessId
|
||
WHERE t.F_IsFinished = 0 AND (p.F_IsFinished = 0 OR t.F_Type = 2 OR t.F_Type = 4 OR t.F_Type = 6)");
|
||
|
||
var queryParam = queryJson.ToJObject();
|
||
DateTime startTime = DateTime.Now, endTime = DateTime.Now;
|
||
if (string.IsNullOrEmpty(ProjectId) && !queryParam["ProjectId"].IsEmpty())
|
||
{
|
||
ProjectId = queryParam["ProjectId"].ToString();
|
||
}
|
||
|
||
//update by chenkai 20210421 单位平台时显示所有流程
|
||
ProjectId = (string.IsNullOrEmpty(ProjectId) || ProjectId.ToLower() == "null") ? "" : ProjectId;
|
||
if (!string.IsNullOrEmpty(ProjectId))
|
||
{
|
||
strSql.Append(" AND p.ProjectId=@ProjectId ");
|
||
}
|
||
|
||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
|
||
{
|
||
startTime = queryParam["StartTime"].ToDate();
|
||
endTime = queryParam["EndTime"].ToDate();
|
||
strSql.Append(" AND ( t.F_ModifyDate >= @startTime AND t.F_ModifyDate <= @endTime ) ");
|
||
}
|
||
string keyword = "";
|
||
if (!queryParam["keyword"].IsEmpty())
|
||
{
|
||
keyword = "%" + queryParam["keyword"].ToString() + "%";
|
||
strSql.Append(" AND ( p.F_Title like @keyword OR p.F_SchemeName like @keyword ) ");
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(schemeCode)) {
|
||
strSql.Append(" AND p.F_SchemeCode = @schemeCode ");
|
||
}
|
||
|
||
if (isBatchAudit)
|
||
{
|
||
strSql.Append(" AND t.F_IsBatchAudit = 1 ");
|
||
}
|
||
|
||
//return this.BaseRepository().FindList<NWFProcessEntity>(strSql.ToString(), new { userId, ProjectId, startTime, endTime, keyword, schemeCode }, pagination);
|
||
return SqlSugarHelper.Db.SqlQueryable<NWFProcessEntity>(strSql.ToString()).AddParameters(new { userId, ProjectId, startTime, endTime, keyword, schemeCode }).ToPageList(pagination.page, pagination.rows);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取我的代办任务列表
|
||
/// </summary>
|
||
/// <param name="userInfo">用户信息</param>
|
||
/// <param name="queryJson">查询条件</param>
|
||
/// <param name="schemeCode">流程模板编码</param>
|
||
/// <param name="isBatchAudit">true获取批量审核任务</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetMyTaskPageList(UserInfo userInfo, string queryJson, string schemeCode, bool isBatchAudit = false)
|
||
{
|
||
try
|
||
{
|
||
string userId = userInfo.userId;
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t.F_Id AS F_TaskId,
|
||
t.F_Type AS F_TaskType,
|
||
t.F_NodeName AS F_TaskName,
|
||
t.F_IsUrge,
|
||
t.F_ModifyDate as F_CreateDate,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Title,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart
|
||
FROM
|
||
(
|
||
SELECT
|
||
F_TaskId
|
||
FROM
|
||
LR_NWF_TaskRelation r1
|
||
INNER JOIN LR_NWF_Task t1 ON r1.F_TaskId = t1.F_Id
|
||
WHERE r1.F_Mark = 0 AND r1.F_Result = 0 AND (r1.F_UserId = @userId
|
||
");
|
||
|
||
|
||
// 添加委托信息
|
||
List<UserInfo> delegateList = GetDelegateProcess(userId);
|
||
foreach (var item in delegateList)
|
||
{
|
||
string processId = "'" + item.wfProcessId.Replace(",", "','") + "'";
|
||
string userI2 = "'" + item.userId + "'";
|
||
|
||
strSql.Append(" OR (r1.F_UserId =" + userI2 + " AND t1.F_ProcessId in (" + processId + ") AND t1.F_Type != 2 )");
|
||
}
|
||
strSql.Append(@") GROUP BY
|
||
F_TaskId
|
||
) r
|
||
INNER JOIN LR_NWF_Task t ON t.F_Id = r.F_TaskId
|
||
INNER JOIN LR_NWF_Process p ON p.F_Id = t.F_ProcessId
|
||
WHERE
|
||
p.ProjectId=@ProjectId AND t.F_IsFinished = 0 AND (p.F_IsFinished = 0 OR t.F_Type = 2 OR t.F_Type = 4 OR t.F_Type = 6)");
|
||
|
||
var queryParam = queryJson.ToJObject();
|
||
DateTime startTime = DateTime.Now, endTime = DateTime.Now;
|
||
|
||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
|
||
{
|
||
startTime = queryParam["StartTime"].ToDate();
|
||
endTime = queryParam["EndTime"].ToDate();
|
||
strSql.Append(" AND ( t.F_ModifyDate >= @startTime AND t.F_ModifyDate <= @endTime ) ");
|
||
}
|
||
string keyword = "";
|
||
if (!queryParam["keyword"].IsEmpty())
|
||
{
|
||
keyword = "%" + queryParam["keyword"].ToString() + "%";
|
||
strSql.Append(" AND ( p.F_Title like @keyword OR p.F_SchemeName like @keyword ) ");
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(schemeCode))
|
||
{
|
||
strSql.Append(" AND p.F_SchemeCode = @schemeCode ");
|
||
}
|
||
|
||
if (isBatchAudit) {
|
||
strSql.Append(" AND t.F_IsBatchAudit = 1 ");
|
||
}
|
||
|
||
//return this.BaseRepository().FindList<NWFProcessEntity>(strSql.ToString(), new { userId,startTime, endTime, keyword, schemeCode });
|
||
return SqlSugarHelper.Db.SqlQueryable<NWFProcessEntity>(strSql.ToString()).AddParameters(new { userId, startTime, endTime, keyword, schemeCode }).ToList();
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取我的待办任务列表 首页
|
||
/// </summary>
|
||
/// <param name="userInfo">用户信息</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetMyTaskList(UserInfo userInfo)
|
||
{
|
||
try
|
||
{
|
||
string userId = userInfo.userId;
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t.F_Id AS F_TaskId,
|
||
t.F_Type AS F_TaskType,
|
||
t.F_NodeName AS F_TaskName,
|
||
t.F_IsUrge,
|
||
t.F_ModifyDate as F_CreateDate,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Title,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart,
|
||
p.F_ObjectId,
|
||
p.ProjectId
|
||
FROM
|
||
(
|
||
SELECT
|
||
F_TaskId
|
||
FROM
|
||
LR_NWF_TaskRelation r1
|
||
INNER JOIN LR_NWF_Task t1 ON r1.F_TaskId = t1.F_Id
|
||
WHERE r1.F_Mark = 0 AND r1.F_Result = 0 AND (r1.F_UserId = @userId
|
||
");
|
||
|
||
|
||
// 添加委托信息
|
||
List<UserInfo> delegateList = GetDelegateProcess(userId);
|
||
foreach (var item in delegateList)
|
||
{
|
||
string processId = "'" + item.wfProcessId.Replace(",", "','") + "'";
|
||
string userI2 = "'" + item.userId + "'";
|
||
|
||
strSql.Append(" OR (r1.F_UserId =" + userI2 + " AND t1.F_ProcessId in (" + processId + ") AND t1.F_Type != 2 )");
|
||
}
|
||
strSql.Append(@") GROUP BY
|
||
F_TaskId
|
||
) r
|
||
INNER JOIN LR_NWF_Task t ON t.F_Id = r.F_TaskId
|
||
INNER JOIN LR_NWF_Process p ON p.F_Id = t.F_ProcessId
|
||
INNER JOIN ec_project j on j.ProjectId=p.ProjectId
|
||
WHERE
|
||
t.F_IsFinished = 0 AND (p.F_IsFinished = 0 OR t.F_Type = 2 OR t.F_Type = 4 OR t.F_Type = 6)");
|
||
|
||
strSql.Append(" ORDER BY t.F_ModifyDate DESC");
|
||
|
||
//return this.BaseRepository().FindList<NWFProcessEntity>(strSql.ToString(), new { userId});
|
||
return SqlSugarHelper.Db.SqlQueryable<NWFProcessEntity>(strSql.ToString()).AddParameters(new { userId }).ToList();
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取我的已办任务列表
|
||
/// </summary>
|
||
/// <param name="userId">用户主键</param>
|
||
/// <param name="pagination">翻页信息</param>
|
||
/// <param name="queryJson">查询条件</param>
|
||
/// <param name="schemeCode">流程模板编码</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetMyFinishTaskPageList(UserInfo userInfo, Pagination pagination, string queryJson, string schemeCode, string ProjectId)
|
||
{
|
||
try
|
||
{
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t.F_TaskId,
|
||
t.F_TaskType,
|
||
t.F_TaskName,
|
||
t.F_CreateDate,
|
||
p.F_Title,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart
|
||
FROM
|
||
(
|
||
SELECT
|
||
MAX(t.F_Id) AS F_TaskId,
|
||
MAX(t.F_Type) AS F_TaskType,
|
||
MAX(t.F_NodeName) AS F_TaskName,
|
||
MAX(r.F_Time) AS F_CreateDate,
|
||
t.F_ProcessId
|
||
FROM
|
||
LR_NWF_Task t
|
||
INNER JOIN LR_NWF_TaskRelation r ON r.F_TaskId = t.F_Id
|
||
WHERE
|
||
(
|
||
r.F_Result = 1
|
||
OR r.F_Result = 2
|
||
OR r.F_Result = 4
|
||
)
|
||
AND r.F_UserId = @userId
|
||
GROUP BY
|
||
t.F_NodeId,F_ProcessId
|
||
) t
|
||
INNER JOIN LR_NWF_Process p ON t.F_ProcessId = p.F_Id
|
||
");
|
||
|
||
|
||
var queryParam = queryJson.ToJObject();
|
||
DateTime startTime = DateTime.Now, endTime = DateTime.Now;
|
||
|
||
//update by chenkai 20210421 单位平台时显示所有流程
|
||
ProjectId = (string.IsNullOrEmpty(ProjectId) || ProjectId.ToLower() == "null") ? "" : ProjectId;
|
||
if (!string.IsNullOrEmpty(ProjectId))
|
||
{
|
||
strSql.Append(" AND p.ProjectId=@ProjectId ");
|
||
}
|
||
|
||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
|
||
{
|
||
startTime = queryParam["StartTime"].ToDate();
|
||
endTime = queryParam["EndTime"].ToDate();
|
||
strSql.Append(" AND ( t.F_CreateDate >= @startTime AND t.F_CreateDate <= @endTime ) ");
|
||
}
|
||
string keyword = "";
|
||
if (!queryParam["keyword"].IsEmpty())
|
||
{
|
||
keyword = "%" + queryParam["keyword"].ToString() + "%";
|
||
strSql.Append(" AND ( p.F_Title like @keyword OR p.F_SchemeName like @keyword ) ");
|
||
}
|
||
if (!string.IsNullOrEmpty(schemeCode))
|
||
{
|
||
strSql.Append(" AND p.F_SchemeCode = @schemeCode ");
|
||
}
|
||
|
||
//return this.BaseRepository().FindList<NWFProcessEntity>(strSql.ToString(), new { userInfo.userId, ProjectId, startTime, endTime, keyword, schemeCode }, pagination);
|
||
return SqlSugarHelper.Db.SqlQueryable<NWFProcessEntity>(strSql.ToString()).AddParameters(new { userInfo.userId, ProjectId, startTime, endTime, keyword, schemeCode }).ToPageList(pagination.page, pagination.rows);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取我的已办任务列表
|
||
/// </summary>
|
||
/// <param name="userId">用户主键</param>
|
||
/// <param name="queryJson">查询条件</param>
|
||
/// <param name="schemeCode">流程模板编码</param>
|
||
/// <returns></returns>
|
||
public IEnumerable<NWFProcessEntity> GetMyFinishTaskPageList(UserInfo userInfo, string queryJson, string schemeCode)
|
||
{
|
||
try
|
||
{
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t.F_TaskId,
|
||
t.F_TaskType,
|
||
t.F_TaskName,
|
||
t.F_CreateDate,
|
||
p.F_Title,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart
|
||
FROM
|
||
(
|
||
SELECT
|
||
MAX (t.F_Id) AS F_TaskId,
|
||
MAX (t.F_Type) AS F_TaskType,
|
||
MAX (t.F_NodeName) AS F_TaskName,
|
||
MAX (r.F_Time) AS F_CreateDate,
|
||
t.F_ProcessId
|
||
FROM
|
||
LR_NWF_Task t
|
||
INNER JOIN LR_NWF_TaskRelation r ON r.F_TaskId = t.F_Id
|
||
WHERE
|
||
(
|
||
r.F_Result = 1
|
||
OR r.F_Result = 2
|
||
OR r.F_Result = 4
|
||
)
|
||
AND r.F_UserId = @userId
|
||
GROUP BY
|
||
t.F_NodeId,F_ProcessId
|
||
) t
|
||
INNER JOIN LR_NWF_Process p ON t.F_ProcessId = p.F_Id
|
||
");
|
||
|
||
|
||
var queryParam = queryJson.ToJObject();
|
||
DateTime startTime = DateTime.Now, endTime = DateTime.Now;
|
||
|
||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
|
||
{
|
||
startTime = queryParam["StartTime"].ToDate();
|
||
endTime = queryParam["EndTime"].ToDate();
|
||
strSql.Append(" AND ( t.F_CreateDate >= @startTime AND t.F_CreateDate <= @endTime ) ");
|
||
}
|
||
string keyword = "";
|
||
if (!queryParam["keyword"].IsEmpty())
|
||
{
|
||
keyword = "%" + queryParam["keyword"].ToString() + "%";
|
||
strSql.Append(" AND ( p.F_Title like @keyword OR p.F_SchemeName like @keyword ) ");
|
||
}
|
||
if (!string.IsNullOrEmpty(schemeCode))
|
||
{
|
||
strSql.Append(" AND p.F_SchemeCode = @schemeCode ");
|
||
}
|
||
|
||
//return this.BaseRepository().FindList<NWFProcessEntity>(strSql.ToString(), new { userInfo.userId, startTime, endTime, keyword, schemeCode });
|
||
return SqlSugarHelper.Db.SqlQueryable<NWFProcessEntity>(strSql.ToString()).AddParameters(new { userInfo.userId, startTime, endTime, keyword, schemeCode }).ToList();
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取委托人关联的流程进程列表
|
||
/// </summary>
|
||
/// <param name="userId">当前用户主键</param>
|
||
/// <returns></returns>
|
||
public List<UserInfo> GetDelegateProcess(string userId)
|
||
{
|
||
try
|
||
{
|
||
List<UserInfo> delegateUserlist = new List<UserInfo>();
|
||
DateTime datatime = DateTime.Now;
|
||
IEnumerable<NWFDelegateRuleEntity> wfDelegateRuleList = _NWFDelegateRuleRepository.GetList(t => t.F_ToUserId == userId && t.F_BeginDate <= datatime && t.F_EndDate >= datatime);
|
||
foreach (var item in wfDelegateRuleList)
|
||
{
|
||
UserInfo userinfo = new UserInfo();
|
||
userinfo.userId = item.F_CreateUserId;
|
||
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
p.F_Id
|
||
FROM
|
||
LR_NWF_DelegateRelation d
|
||
LEFT JOIN LR_NWF_SchemeInfo s ON s.F_Id = d.F_SchemeInfoId
|
||
LEFT JOIN LR_NWF_Process p ON p.F_SchemeCode = s.F_Code
|
||
WHERE
|
||
p.F_Id IS NOT NULL
|
||
AND p.F_IsFinished = 0
|
||
AND d.F_DelegateRuleId = @DelegateRuleId ");
|
||
|
||
DataTable dt = SqlSugarHelper.Db.Ado.GetDataTable(strSql.ToString(), new { DelegateRuleId = item.F_Id });
|
||
userinfo.wfProcessId = "";
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
if (!string.IsNullOrEmpty(dr[0].ToString()))
|
||
{
|
||
if (!string.IsNullOrEmpty(userinfo.wfProcessId))
|
||
{
|
||
userinfo.wfProcessId += ",";
|
||
}
|
||
userinfo.wfProcessId += dr[0].ToString();
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(userinfo.wfProcessId))
|
||
{
|
||
delegateUserlist.Add(userinfo);
|
||
}
|
||
}
|
||
return delegateUserlist;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
public IEnumerable<NWFProcessEntity> GetMyMessageList(UserInfo userInfo, Pagination pagination, string queryJson, string schemeCode, string ProjectId, bool isBatchAudit = false)
|
||
{
|
||
try
|
||
{
|
||
string userId = userInfo.userId;
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t.F_Id AS F_TaskId,
|
||
t.F_Type AS F_TaskType,
|
||
t.F_NodeName AS F_TaskName,
|
||
t.F_IsUrge,
|
||
t.F_ModifyDate as F_CreateDate,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Title,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart
|
||
FROM
|
||
(
|
||
SELECT
|
||
F_TaskId
|
||
FROM
|
||
LR_NWF_TaskRelation r1
|
||
INNER JOIN LR_NWF_Task t1 ON r1.F_TaskId = t1.F_Id
|
||
WHERE r1.F_Mark = 0 AND r1.F_Result = 0 AND (r1.F_UserId = @userId
|
||
");
|
||
|
||
|
||
// 添加委托信息
|
||
List<UserInfo> delegateList = GetDelegateProcess(userId);
|
||
foreach (var item in delegateList)
|
||
{
|
||
string processId = "'" + item.wfProcessId.Replace(",", "','") + "'";
|
||
string userI2 = "'" + item.userId + "'";
|
||
|
||
strSql.Append(" OR (r1.F_UserId =" + userI2 + " AND t1.F_ProcessId in (" + processId + ") AND t1.F_Type != 2 )");
|
||
}
|
||
strSql.Append(@") GROUP BY
|
||
F_TaskId
|
||
) r
|
||
INNER JOIN LR_NWF_Task t ON t.F_Id = r.F_TaskId
|
||
INNER JOIN LR_NWF_Process p ON p.F_Id = t.F_ProcessId
|
||
WHERE t.F_IsFinished = 0 AND (p.F_IsFinished = 0 OR t.F_Type = 2 OR t.F_Type = 4 OR t.F_Type = 6)");
|
||
|
||
//update by chenkai 20210421 单位平台时显示所有流程
|
||
ProjectId = (string.IsNullOrEmpty(ProjectId) || ProjectId.ToLower() == "null") ? "" : ProjectId;
|
||
if (!string.IsNullOrEmpty(ProjectId))
|
||
{
|
||
strSql.Append(" AND p.ProjectId = @ProjectId");
|
||
}
|
||
|
||
var queryParam = queryJson.ToJObject();
|
||
DateTime startTime = DateTime.Now, endTime = DateTime.Now;
|
||
|
||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
|
||
{
|
||
startTime = queryParam["StartTime"].ToDate();
|
||
endTime = queryParam["EndTime"].ToDate();
|
||
strSql.Append(" AND ( t.F_ModifyDate >= @startTime AND t.F_ModifyDate <= @endTime ) ");
|
||
}
|
||
string keyword = "";
|
||
if (!queryParam["keyword"].IsEmpty())
|
||
{
|
||
keyword = "%" + queryParam["keyword"].ToString() + "%";
|
||
strSql.Append(" AND ( p.F_Title like @keyword OR p.F_SchemeName like @keyword ) ");
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(schemeCode))
|
||
{
|
||
strSql.Append(" AND p.F_SchemeCode = @schemeCode ");
|
||
}
|
||
|
||
if (isBatchAudit)
|
||
{
|
||
strSql.Append(" AND t.F_IsBatchAudit = 1 ");
|
||
}
|
||
|
||
//return this.BaseRepository().FindList<NWFProcessEntity>(strSql.ToString(), new { userId, ProjectId, startTime, endTime, keyword, schemeCode }, pagination);
|
||
return SqlSugarHelper.Db.SqlQueryable<NWFProcessEntity>(strSql.ToString()).AddParameters(new { userId, ProjectId, startTime, endTime, keyword, schemeCode }).ToPageList(pagination.page, pagination.rows);
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
#region 获取sql语句
|
||
/// <summary>
|
||
/// 获取我的流程信息列表SQL语句
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public string GetMySql()
|
||
{
|
||
try
|
||
{
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
p.F_CreateDate,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Title,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart
|
||
FROM
|
||
LR_NWF_Process p
|
||
WHERE
|
||
p.F_CreateUserId = @userId AND p.F_IsChild = 0
|
||
");
|
||
|
||
return strSql.ToString();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取我的代办任务列表SQL语句
|
||
/// </summary>
|
||
/// <param name="userInfo">用户信息</param>
|
||
/// <param name="isBatchAudit">true获取批量审核任务</param>
|
||
/// <returns></returns>
|
||
public string GetMyTaskSql(UserInfo userInfo, bool isBatchAudit = false)
|
||
{
|
||
try
|
||
{
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t.F_Id AS F_TaskId,
|
||
t.F_Type AS F_TaskType,
|
||
t.F_NodeName AS F_TaskName,
|
||
t.F_IsUrge,
|
||
t.F_ModifyDate as F_CreateDate,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Title,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart
|
||
FROM
|
||
(
|
||
SELECT
|
||
F_TaskId
|
||
FROM
|
||
LR_NWF_TaskRelation r1
|
||
LEFT JOIN LR_NWF_Task t1 ON r1.F_TaskId = t1.F_Id
|
||
WHERE r1.F_Mark = 0 AND r1.F_Result = 0 AND (r1.F_UserId = @userId
|
||
");
|
||
|
||
|
||
// 添加委托信息
|
||
List<UserInfo> delegateList = GetDelegateProcess(userInfo.userId);
|
||
foreach (var item in delegateList)
|
||
{
|
||
string processId = "'" + item.wfProcessId.Replace(",", "','") + "'";
|
||
string userI2 = "'" + item.userId + "'";
|
||
|
||
strSql.Append(" OR (r1.F_UserId =" + userI2 + " AND t1.F_ProcessId in (" + processId + ") AND t1.F_Type != 2 )");
|
||
}
|
||
strSql.Append(@") GROUP BY
|
||
F_TaskId
|
||
) r
|
||
LEFT JOIN LR_NWF_Task t ON t.F_Id = r.F_TaskId
|
||
LEFT JOIN LR_NWF_Process p ON p.F_Id = t.F_ProcessId
|
||
WHERE
|
||
t.F_IsFinished = 0 AND (p.F_IsFinished = 0 OR t.F_Type = 2)");
|
||
|
||
if (isBatchAudit)
|
||
{
|
||
strSql.Append(" AND t.F_IsBatchAudit = 1 ");
|
||
}
|
||
|
||
return strSql.ToString();
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 获取我的已办任务列表SQL语句
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public string GetMyFinishTaskSql()
|
||
{
|
||
try
|
||
{
|
||
var strSql = new StringBuilder();
|
||
strSql.Append(@"SELECT
|
||
t.F_TaskId,
|
||
t.F_TaskType,
|
||
t.F_TaskName,
|
||
t.F_CreateDate,
|
||
p.F_Title,
|
||
p.F_Id,
|
||
p.F_SchemeId,
|
||
p.F_SchemeCode,
|
||
p.F_SchemeName,
|
||
p.F_Level,
|
||
p.F_EnabledMark,
|
||
p.F_IsAgain,
|
||
p.F_IsFinished,
|
||
p.F_IsChild,
|
||
p.F_ParentTaskId,
|
||
p.F_ParentProcessId,
|
||
p.F_CreateUserId,
|
||
p.F_CreateUserName,
|
||
p.F_IsStart
|
||
FROM
|
||
(
|
||
SELECT
|
||
MAX (t.F_Id) AS F_TaskId,
|
||
MAX (t.F_Type) AS F_TaskType,
|
||
MAX (t.F_NodeName) AS F_TaskName,
|
||
MAX (r.F_Time) AS F_CreateDate,
|
||
t.F_ProcessId
|
||
FROM
|
||
LR_NWF_Task t
|
||
LEFT JOIN LR_NWF_TaskRelation r ON r.F_TaskId = t.F_Id
|
||
WHERE
|
||
(
|
||
r.F_Result = 1
|
||
OR r.F_Result = 2
|
||
OR r.F_Result = 4
|
||
)
|
||
AND r.F_UserId = @userId
|
||
GROUP BY
|
||
t.F_NodeId,F_ProcessId
|
||
) t
|
||
LEFT JOIN LR_NWF_Process p ON t.F_ProcessId = p.F_Id
|
||
");
|
||
|
||
return strSql.ToString();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region 保存信息
|
||
/// <summary>
|
||
/// 保存流程进程数据
|
||
/// </summary>
|
||
/// <param name="nWFProcessEntity">流程进程</param>
|
||
/// <param name="taskList">流程任务列表</param>
|
||
/// <param name="taskMsgList">流程消息列表</param>
|
||
/// <param name="taskLogEntity">任务日志</param>
|
||
public void Save(NWFProcessEntity nWFProcessEntity,List<NWFTaskEntity> taskList,List<NWFTaskMsgEntity> taskMsgList, NWFTaskLogEntity taskLogEntity) {
|
||
NWFProcessEntity nWFProcessEntityTmp = _NWFProcessRepository.GetById(nWFProcessEntity.F_Id);
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
if (nWFProcessEntityTmp == null)
|
||
{
|
||
_NWFProcessRepository.Insert(nWFProcessEntity);
|
||
//db.Commit();
|
||
}
|
||
else {
|
||
_NWFProcessRepository.Update(nWFProcessEntity);
|
||
}
|
||
foreach (var task in taskList) {
|
||
task.F_ModifyDate = DateTime.Now;
|
||
_NWFTaskRepository.Insert(task);
|
||
//db.Commit();
|
||
int num = 1;
|
||
if (task.nWFUserInfoList != null) {
|
||
foreach (var taskUser in task.nWFUserInfoList)
|
||
{
|
||
NWFTaskRelationEntity nWFTaskRelationEntity = new NWFTaskRelationEntity();
|
||
nWFTaskRelationEntity.Create();
|
||
nWFTaskRelationEntity.F_TaskId = task.F_Id;
|
||
nWFTaskRelationEntity.F_UserId = taskUser.Id;
|
||
nWFTaskRelationEntity.F_Mark = taskUser.Mark;
|
||
nWFTaskRelationEntity.F_Result = 0;
|
||
nWFTaskRelationEntity.F_Sort = num;
|
||
nWFTaskRelationEntity.CreateTime= DateTime.Now;
|
||
nWFTaskRelationEntity.CreateUserId = LoginUserInfo.Get().userId;
|
||
_NWFTaskRelationRepository.Insert(nWFTaskRelationEntity);
|
||
num++;
|
||
}
|
||
}
|
||
}
|
||
foreach (var taskMsg in taskMsgList)
|
||
{
|
||
_NWFTaskMsgRepository.Insert(taskMsg);
|
||
}
|
||
|
||
_NWFTaskLogRepository.Insert(taskLogEntity);
|
||
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 保存流程进程信息
|
||
/// </summary>
|
||
/// <param name="taskLogEntity">任务日志</param>
|
||
/// <param name="taskRelationEntity">任务执行人状态更新</param>
|
||
/// <param name="taskEntityUpdate">任务状态更新</param>
|
||
/// <param name="processEntity">流程进程状态更新</param>
|
||
/// <param name="confluenceList">会签信息</param>
|
||
/// <param name="closeTaskList">会签需要关闭的任务</param>
|
||
/// <param name="taskList">新的任务列表</param>
|
||
/// <param name="taskMsgList">新的任务消息列表</param>
|
||
public void Save(NWFTaskLogEntity taskLogEntity, NWFTaskRelationEntity taskRelationEntity, NWFTaskEntity taskEntityUpdate, NWFProcessEntity processEntity, List<NWFConfluenceEntity> confluenceList, List<NWFTaskEntity> closeTaskList, List<NWFTaskEntity> taskList, List<NWFTaskMsgEntity> taskMsgList, NWFProcessEntity pProcessEntity = null)
|
||
{
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
_NWFTaskLogRepository.Insert(taskLogEntity);
|
||
_NWFTaskRelationRepository.Update(taskRelationEntity);
|
||
_NWFTaskRepository.Update(taskEntityUpdate);
|
||
|
||
if (processEntity != null)
|
||
{
|
||
_NWFProcessRepository.Update(processEntity);
|
||
}
|
||
|
||
if (pProcessEntity != null)
|
||
{
|
||
_NWFProcessRepository.Update(pProcessEntity);
|
||
}
|
||
|
||
if (confluenceList != null) {
|
||
foreach (var item in confluenceList)
|
||
{
|
||
if (item.isClear)
|
||
{
|
||
string processId = item.F_ProcessId;
|
||
string nodeId = item.F_NodeId;
|
||
_NWFConfluenceRepository.Delete(t => t.F_ProcessId == processId && t.F_NodeId == nodeId);
|
||
// 增加一条会签审核记录
|
||
NWFTaskLogEntity nWFTaskLogEntity = new NWFTaskLogEntity()
|
||
{
|
||
F_ProcessId = processId,
|
||
F_OperationCode = "confluence",
|
||
F_OperationName = "会签" +(item.confluenceRes == 1?"通过":"不通过"),
|
||
F_NodeId = item.F_NodeId,
|
||
F_TaskType = 7
|
||
};
|
||
nWFTaskLogEntity.Create();
|
||
_NWFTaskLogRepository.Insert(nWFTaskLogEntity);
|
||
}
|
||
else
|
||
{
|
||
_NWFConfluenceRepository.Insert(item);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (closeTaskList != null) {
|
||
foreach (var item in closeTaskList) {
|
||
_NWFTaskRepository.Update(item);
|
||
}
|
||
}
|
||
|
||
foreach (var task in taskList)
|
||
{
|
||
task.F_ModifyDate = DateTime.Now;
|
||
_NWFTaskRepository.Insert(task);
|
||
int num = 1;
|
||
if (task.nWFUserInfoList != null) {
|
||
foreach (var taskUser in task.nWFUserInfoList)
|
||
{
|
||
NWFTaskRelationEntity nWFTaskRelationEntity = new NWFTaskRelationEntity();
|
||
nWFTaskRelationEntity.Create();
|
||
nWFTaskRelationEntity.F_TaskId = task.F_Id;
|
||
nWFTaskRelationEntity.F_UserId = taskUser.Id;
|
||
nWFTaskRelationEntity.F_Mark = taskUser.Mark;
|
||
nWFTaskRelationEntity.F_Result = 0;
|
||
nWFTaskRelationEntity.F_Sort = num;
|
||
nWFTaskRelationEntity.CreateTime = DateTime.Now;
|
||
nWFTaskRelationEntity.CreateUserId= LoginUserInfo.Get().userId;
|
||
_NWFTaskRelationRepository.Insert(nWFTaskRelationEntity);
|
||
num++;
|
||
}
|
||
}
|
||
}
|
||
foreach (var taskMsg in taskMsgList)
|
||
{
|
||
_NWFTaskMsgRepository.Insert(taskMsg);
|
||
}
|
||
|
||
|
||
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 保存流程进程数据
|
||
/// </summary>
|
||
/// <param name="nWFProcessEntity">流程进程</param>
|
||
public void Save(NWFProcessEntity nWFProcessEntity)
|
||
{
|
||
try
|
||
{
|
||
_NWFProcessRepository.Insert(nWFProcessEntity);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
public void UpdateProcessEntiy(NWFProcessEntity nWFProcessEntity)
|
||
{
|
||
try
|
||
{
|
||
_NWFProcessRepository.Update(nWFProcessEntity);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 保存流程进程数据
|
||
/// </summary>
|
||
/// <param name="nWFTaskLogEntity">任务日志数据</param>
|
||
/// <param name="taskUserUpdateList">任务执行人需要更新状态数据</param>
|
||
/// <param name="nWFTaskMsgEntity">任务消息</param>
|
||
public void Save(NWFTaskLogEntity nWFTaskLogEntity, List<NWFTaskRelationEntity> taskUserUpdateList, NWFTaskMsgEntity nWFTaskMsgEntity) {
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
_NWFTaskLogRepository.Insert(nWFTaskLogEntity);
|
||
|
||
foreach (var item in taskUserUpdateList) {
|
||
_NWFTaskRelationRepository.Update(item);
|
||
}
|
||
_NWFTaskMsgRepository.Insert(nWFTaskMsgEntity);
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 保存流程进程数据
|
||
/// </summary>
|
||
/// <param name="nWFTaskLogEntity">任务日志数据</param>
|
||
/// <param name="nWFTaskRelationEntity">任务执行人需要更新状态数据</param>
|
||
/// <param name="taskEntity">任务</param>
|
||
public void Save(NWFTaskLogEntity nWFTaskLogEntity, NWFTaskRelationEntity nWFTaskRelationEntity, NWFTaskEntity taskEntity)
|
||
{
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
_NWFTaskLogRepository.Insert(nWFTaskLogEntity);
|
||
_NWFTaskRelationRepository.Update(nWFTaskRelationEntity);
|
||
if (taskEntity != null) {
|
||
taskEntity.F_ModifyDate = DateTime.Now;
|
||
_NWFTaskRepository.Update(taskEntity);
|
||
}
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 保存流程进程数据
|
||
/// </summary>
|
||
/// <param name="nWFTaskLogEntity">任务日志数据</param>
|
||
/// <param name="taskList">需要更新的任务列表</param>
|
||
/// <param name="taskMsgList">任务消息列表</param>
|
||
public void Save(NWFTaskLogEntity nWFTaskLogEntity, List<NWFTaskEntity>taskList, List<NWFTaskMsgEntity> taskMsgList)
|
||
{
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
_NWFTaskLogRepository.Insert(nWFTaskLogEntity);
|
||
foreach (var item in taskList) {
|
||
item.F_ModifyDate = DateTime.Now;
|
||
_NWFTaskRepository.Update(item);
|
||
}
|
||
foreach (var item in taskMsgList)
|
||
{
|
||
_NWFTaskMsgRepository.Insert(item);
|
||
}
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 保存流程进程数据
|
||
/// </summary>
|
||
/// <param name="nWFTaskLogEntity">任务日志数据</param>
|
||
/// <param name="taskList">需要更新的任务列表</param>
|
||
/// <param name="taskMsgList">任务消息列表</param>
|
||
public void Save(NWFTaskLogEntity nWFTaskLogEntity, NWFTaskEntity task, List<NWFTaskMsgEntity> taskMsgList)
|
||
{
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
_NWFTaskLogRepository.Insert(nWFTaskLogEntity);
|
||
task.F_ModifyDate = DateTime.Now;
|
||
_NWFTaskRepository.Update(task);
|
||
foreach (var item in taskMsgList)
|
||
{
|
||
_NWFTaskMsgRepository.Insert(item);
|
||
}
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 保存流程进程信息
|
||
/// </summary>
|
||
/// <param name="taskLogEntity">任务日志</param>
|
||
/// <param name="taskRelationEntity">任务执行人状态更新</param>
|
||
/// <param name="taskEntityUpdate">任务状态更新</param>
|
||
/// <param name="processEntity">流程进程状态更新</param>
|
||
/// <param name="taskList">新的任务列表</param>
|
||
/// <param name="taskMsgList">新的任务消息列表</param>
|
||
public void Save(NWFTaskLogEntity pTaskLogEntity, NWFTaskRelationEntity pTaskRelationEntity, NWFTaskEntity pTaskEntityUpdate, NWFProcessEntity pProcessEntity, List<NWFTaskEntity> pTaskList, List<NWFTaskMsgEntity> pTaskMsgList, NWFProcessEntity nWFProcessEntity, List<NWFTaskEntity> taskList, List<NWFTaskMsgEntity> taskMsgList, NWFTaskLogEntity taskLogEntity)
|
||
{
|
||
NWFProcessEntity nWFProcessEntityTmp = _NWFProcessRepository.GetById(nWFProcessEntity.F_Id);
|
||
IEnumerable<NWFTaskEntity> uTaskList = _NWFTaskRepository.GetList(t=>t.F_ProcessId == nWFProcessEntity.F_Id && t.F_NodeId == taskLogEntity.F_NodeId && t.F_IsFinished == 0);
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
if (nWFProcessEntityTmp == null)
|
||
{
|
||
_NWFProcessRepository.Insert(nWFProcessEntity);
|
||
}
|
||
else
|
||
{
|
||
_NWFProcessRepository.Update(nWFProcessEntity);
|
||
}
|
||
foreach (var task in taskList)
|
||
{
|
||
task.F_ModifyDate = DateTime.Now;
|
||
_NWFTaskRepository.Insert(task);
|
||
int num = 1;
|
||
if (task.nWFUserInfoList != null) {
|
||
foreach (var taskUser in task.nWFUserInfoList)
|
||
{
|
||
NWFTaskRelationEntity nWFTaskRelationEntity = new NWFTaskRelationEntity();
|
||
nWFTaskRelationEntity.Create();
|
||
nWFTaskRelationEntity.F_TaskId = task.F_Id;
|
||
nWFTaskRelationEntity.F_UserId = taskUser.Id;
|
||
nWFTaskRelationEntity.F_Mark = taskUser.Mark;
|
||
nWFTaskRelationEntity.F_Result = 0;
|
||
nWFTaskRelationEntity.F_Sort = num;
|
||
_NWFTaskRelationRepository.Insert(nWFTaskRelationEntity);
|
||
num++;
|
||
}
|
||
}
|
||
}
|
||
foreach (var taskMsg in taskMsgList)
|
||
{
|
||
_NWFTaskMsgRepository.Insert(taskMsg);
|
||
}
|
||
|
||
_NWFTaskLogRepository.Insert(taskLogEntity);
|
||
foreach (var item in uTaskList) {
|
||
item.F_IsFinished = 1;
|
||
_NWFTaskRepository.Update(item);
|
||
}
|
||
|
||
|
||
// 父流程
|
||
_NWFTaskLogRepository.Insert(pTaskLogEntity);
|
||
_NWFTaskRelationRepository.Update(pTaskRelationEntity);
|
||
_NWFTaskRepository.Update(pTaskEntityUpdate);
|
||
if (pProcessEntity != null)
|
||
{
|
||
_NWFProcessRepository.Update(pProcessEntity);
|
||
}
|
||
|
||
foreach (var task in pTaskList)
|
||
{
|
||
task.F_ModifyDate = DateTime.Now;
|
||
_NWFTaskRepository.Insert(task);
|
||
int num = 1;
|
||
if (task.nWFUserInfoList != null) {
|
||
foreach (var taskUser in task.nWFUserInfoList)
|
||
{
|
||
NWFTaskRelationEntity nWFTaskRelationEntity = new NWFTaskRelationEntity();
|
||
nWFTaskRelationEntity.Create();
|
||
nWFTaskRelationEntity.F_TaskId = task.F_Id;
|
||
nWFTaskRelationEntity.F_UserId = taskUser.Id;
|
||
nWFTaskRelationEntity.F_Mark = taskUser.Mark;
|
||
nWFTaskRelationEntity.F_Result = 0;
|
||
nWFTaskRelationEntity.F_Sort = num;
|
||
_NWFTaskRelationRepository.Insert(nWFTaskRelationEntity);
|
||
num++;
|
||
}
|
||
}
|
||
}
|
||
foreach (var taskMsg in pTaskMsgList)
|
||
{
|
||
_NWFTaskMsgRepository.Insert(taskMsg);
|
||
}
|
||
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// (流程撤销)
|
||
/// </summary>
|
||
/// <param name="processId">流程进程实例</param>
|
||
/// <param name="taskList">流程任务列表</param>
|
||
/// <param name="EnabledMark">2草稿3作废</param>
|
||
public void Save(string processId, IEnumerable<NWFTaskEntity> taskList, int EnabledMark, NWFTaskLogEntity nWFTaskLogEntity = null)
|
||
{
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
NWFProcessEntity nWFProcessEntity = new NWFProcessEntity();
|
||
nWFProcessEntity.F_Id = processId;
|
||
nWFProcessEntity.F_EnabledMark = EnabledMark;
|
||
_NWFProcessRepository.Update(nWFProcessEntity);
|
||
if (EnabledMark == 2)
|
||
{
|
||
_NWFTaskLogRepository.Delete(t => t.F_ProcessId == processId);
|
||
}
|
||
foreach (var task in taskList)
|
||
{
|
||
_NWFTaskRepository.Delete(task);
|
||
string taskId = task.F_Id;
|
||
_NWFTaskMsgRepository.Delete(t => t.F_TaskId == taskId);
|
||
_NWFTaskRelationRepository.Delete(t => t.F_TaskId == taskId);
|
||
}
|
||
if (nWFTaskLogEntity != null) {
|
||
_NWFTaskLogRepository.Insert(nWFTaskLogEntity);
|
||
}
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除流程进程实体
|
||
/// </summary>
|
||
/// <param name="processId">流程进程主键</param>
|
||
public void DeleteEntity(string processId) {
|
||
try
|
||
{
|
||
_NWFProcessRepository.Delete(t=>t.F_Id == processId);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除流程进程所有信息(流程撤销)
|
||
/// </summary>
|
||
/// <param name="processId">流程进程实例</param>
|
||
/// <param name="taskList">流程任务列表</param>
|
||
public void Delete(string processId, IEnumerable<NWFTaskEntity> taskList) {
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
_NWFProcessRepository.Delete(t=>t.F_Id == processId);
|
||
_NWFTaskLogRepository.Delete(t=>t.F_ProcessId == processId);
|
||
foreach (var task in taskList) {
|
||
_NWFTaskRepository.Delete(task);
|
||
string taskId = task.F_Id;
|
||
_NWFTaskMsgRepository.Delete(t=>t.F_TaskId == taskId);
|
||
_NWFTaskRelationRepository.Delete(t=>t.F_TaskId == taskId);
|
||
}
|
||
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 撤销审核
|
||
/// </summary>
|
||
/// <param name="taskList">需要撤回的任务节点</param>
|
||
/// <param name="taskUser">当前处理人</param>
|
||
/// <param name="taskEntity">当前任务</param>
|
||
/// <param name="taskLogEntity">日志信息</param>
|
||
/// <param name="taskUserNew">当前任务节点的处理人(串行多人审核)</param>
|
||
public void RevokeAudit(List<string> taskList, NWFTaskRelationEntity taskUser,NWFTaskEntity taskEntity,NWFTaskLogEntity taskLogEntity, NWFTaskRelationEntity taskUserNew = null)
|
||
{
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
if (taskList != null) {
|
||
foreach (var taskId in taskList)
|
||
{
|
||
_NWFTaskRepository.Delete(t => t.F_Id == taskId);
|
||
_NWFTaskRelationRepository.Delete(t => t.F_TaskId == taskId);
|
||
_NWFTaskMsgRepository.Delete(t => t.F_TaskId == taskId);
|
||
}
|
||
|
||
}
|
||
|
||
if (taskEntity != null) {
|
||
_NWFTaskRepository.Update(taskEntity);
|
||
}
|
||
|
||
taskUser.F_Mark = 0;
|
||
taskUser.F_Result = 0;
|
||
_NWFTaskRelationRepository.Update(taskUser);
|
||
|
||
_NWFTaskLogRepository.Insert(taskLogEntity);
|
||
|
||
if (taskUserNew != null) {
|
||
taskUserNew.F_Mark = 1;
|
||
taskUserNew.F_Result = 0;
|
||
_NWFTaskRelationRepository.Update(taskUserNew);
|
||
}
|
||
|
||
|
||
// 更新下流程实例(处理重新发起状态)
|
||
NWFProcessEntity nWFProcessEntity = new NWFProcessEntity();
|
||
nWFProcessEntity.F_Id = taskLogEntity.F_ProcessId;
|
||
nWFProcessEntity.F_IsAgain = 0;
|
||
_NWFProcessRepository.Update(nWFProcessEntity);
|
||
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 更新任务
|
||
/// </summary>
|
||
/// <param name="taskEntity">任务信息</param>
|
||
/// <param name="taskRelationEntity">当前处理人信息</param>
|
||
|
||
public void UpdateEntiy(NWFTaskEntity taskEntity,NWFTaskRelationEntity taskRelationEntity)
|
||
{
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
_NWFTaskRepository.Update(taskEntity);
|
||
_NWFTaskRelationRepository.Update(taskRelationEntity);
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 更新处理人信息集合
|
||
/// </summary>
|
||
/// <param name="taskRelationEntityList">处理人信息集合</param>
|
||
public void UpdateTaskRelationEntityList(List<NWFTaskRelationEntity> taskRelationEntityList)
|
||
{
|
||
SqlSugarHelper.Db.BeginTran();
|
||
try
|
||
{
|
||
_NWFTaskRelationRepository.UpdateRange(taskRelationEntityList);
|
||
SqlSugarHelper.Db.CommitTran();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SqlSugarHelper.Db.RollbackTran();
|
||
if (ex is ExceptionEx)
|
||
{
|
||
throw;
|
||
}
|
||
else
|
||
{
|
||
throw ExceptionEx.ThrowServiceException(ex);
|
||
}
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
}
|
||
}
|