feat(workflow): 添加拟办功能并优化查询逻辑
- 在CustomWorkflowController中添加SaveDraft方法用于保存拟办 - 更新发起流程注释说明拟办需要重新提交 - 修改拟办查询逻辑移除处理人非空限制并添加角色筛选todo - 在工作项创建时添加发起人姓名字段 - 实现SaveDraft方法支持业务数据保存到IllegalConstructionAssessment表 - 优化SQL查询条件适配新的拟办状态处理需求main
parent
ca6a76dbf9
commit
59208062ea
|
|
@ -254,15 +254,16 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
|
|||
var pageIndex = pageQueryDto.PageIndex < 1 ? 1 : pageQueryDto.PageIndex;
|
||||
var pageSize = pageQueryDto.PageSize < 1 ? 10 : pageQueryDto.PageSize;
|
||||
|
||||
// 拟办不应该是针对个人的吗?
|
||||
// 拟办逻辑:工作项状态为"Draft"(拟办)、对应角色匹配当前用户、未分配具体处理人
|
||||
var draftQuery = _sqlSugar
|
||||
.Queryable<ZyFlowWorkitem, ZyFlowNode>((w, n) => new JoinQueryInfos(
|
||||
JoinType.Inner, w.NodeId == n.NodeId))
|
||||
.Where((w, n) =>
|
||||
w.Status == "Draft"
|
||||
// todo 角色得改_auditDeptRoleIds
|
||||
&& _auditDeptRoleIds.Contains(n.RoleId)
|
||||
&& (w.HandlerId == null || w.HandlerId == 0)
|
||||
&& w.HandlerName != "")
|
||||
&& (w.HandlerId == null || w.HandlerId == 0))
|
||||
.OrderByDescending((w, n) => w.ReceiveTime);
|
||||
|
||||
// 分页查询
|
||||
|
|
@ -294,7 +295,7 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
|
|||
NodeName = workitem.NodeName,
|
||||
Status = "Draft", // 拟办状态
|
||||
CreateTime = flowInstance.CreateTime,
|
||||
InitiatorName = flowInstance.InitiatorName
|
||||
InitiatorName = flowInstance.InitiatorName //发起人姓名
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -958,4 +959,29 @@ public class WorkflowEngineApp : SqlSugarBaseApp<SysCategoryType, SugarDbContext
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 保存拟办
|
||||
/// </summary>
|
||||
/// <param name="requestDto"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public object SaveDraft(InitiateFlowRequestDto requestDto)
|
||||
{
|
||||
var user = _auth.GetCurrentUser().User;
|
||||
var illegalConstructionAssessment = new IllegalConstructionAssessment
|
||||
{
|
||||
Id = requestDto.BusinessNo,
|
||||
Title = requestDto.Title,
|
||||
BusinessNumber = requestDto.BusinessNo,
|
||||
Attachments = requestDto.Attachments != null ? SaveAttachments(requestDto.Attachments) : string.Empty,
|
||||
AcceptanceTime = DateTime.Now,
|
||||
Status = "Draft",
|
||||
CreateTime = DateTime.Now,
|
||||
CreateUser = user.Name,
|
||||
UpdateTime = DateTime.Now,
|
||||
};
|
||||
_sqlSugar.Insertable(illegalConstructionAssessment).ExecuteCommand();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ public class WorkflowController : ControllerBase
|
|||
#region 一、流程操作接口
|
||||
|
||||
/// <summary>
|
||||
/// 发起流程(区县提交)
|
||||
/// 发起流程(区县提交) 拟办需要重新提交
|
||||
/// </summary>
|
||||
/// <param name="requestDto">发起流程请求参数</param>
|
||||
/// <returns>流程实例ID</returns>
|
||||
|
|
@ -89,7 +89,29 @@ public class WorkflowController : ControllerBase
|
|||
#region 二、完整查询接口(拟办/待办/已办/未办结/已完成/全部事项)
|
||||
|
||||
/// <summary>
|
||||
/// 查询我的拟办(未认领/待分配事项)
|
||||
/// 保存拟办(逻辑待完善)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult<ApiResponseDto<bool>> SaveDraft([FromBody] InitiateFlowRequestDto requestDto)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 获取当前登录用户(实际项目中从Token/IAuth中解析)
|
||||
var currentUser = _auth.GetCurrentUser().User;
|
||||
if (currentUser == null)
|
||||
return BadRequest(ApiResponseDto<bool>.Fail("未登录或登录过期"));
|
||||
var result = _workflowEngineApp.SaveDraft(requestDto);
|
||||
return Ok(ApiResponseDto<bool>.Success());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, ApiResponseDto<bool>.Fail(ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询我的拟办(未完成)
|
||||
/// </summary>
|
||||
/// <param name="pageQueryDto">分页查询参数</param>
|
||||
/// <returns>分页拟办结果</returns>
|
||||
|
|
|
|||
Loading…
Reference in New Issue