|
|
@@ -27,15 +27,17 @@ public class ExceptionClosureBizHandler : IFlowBizHandler, ITransient
|
|
|
{
|
|
|
var e = await _rep.GetByIdAsync(bizId) ?? throw new S8BizException("异常不存在");
|
|
|
e.ActiveFlowInstanceId = instanceId;
|
|
|
+ e.ActiveFlowBizType = BizType;
|
|
|
e.UpdatedAt = DateTime.Now;
|
|
|
await _rep.UpdateAsync(e);
|
|
|
- await InsertTimelineAsync(e.Id, "CLOSURE_START", "发起关闭确认", null, null, instanceId, null);
|
|
|
+ await InsertTimelineAsync(e.Id, "CLOSE_START", "发起关闭确认", null, null, instanceId, null);
|
|
|
}
|
|
|
|
|
|
public async Task OnFlowCompleted(long bizId, long instanceId, FlowInstanceStatusEnum finalStatus, long? lastApproverId)
|
|
|
{
|
|
|
var e = await _rep.GetByIdAsync(bizId) ?? throw new S8BizException("异常不存在");
|
|
|
e.ActiveFlowInstanceId = null;
|
|
|
+ e.ActiveFlowBizType = null;
|
|
|
e.UpdatedAt = DateTime.Now;
|
|
|
|
|
|
if (finalStatus == FlowInstanceStatusEnum.Approved)
|
|
|
@@ -43,14 +45,21 @@ public class ExceptionClosureBizHandler : IFlowBizHandler, ITransient
|
|
|
e.Status = "CLOSED";
|
|
|
e.ClosedAt = DateTime.Now;
|
|
|
await _rep.UpdateAsync(e);
|
|
|
- await InsertTimelineAsync(e.Id, "CLOSURE_APPROVED", "关闭已确认", "RESOLVED", "CLOSED",
|
|
|
+ await InsertTimelineAsync(e.Id, "CLOSE_APPROVED", "关闭已确认", "RESOLVED", "CLOSED",
|
|
|
+ instanceId, lastApproverId);
|
|
|
+ }
|
|
|
+ else if (finalStatus == FlowInstanceStatusEnum.Cancelled)
|
|
|
+ {
|
|
|
+ // 撤回:状态维持 RESOLVED,不写终态
|
|
|
+ await _rep.UpdateAsync(e);
|
|
|
+ await InsertTimelineAsync(e.Id, "CLOSE_CANCELLED", "处理人撤回关闭申请", null, null,
|
|
|
instanceId, lastApproverId);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
e.Status = "IN_PROGRESS";
|
|
|
await _rep.UpdateAsync(e);
|
|
|
- await InsertTimelineAsync(e.Id, "CLOSURE_REJECTED", "关闭被驳回", "RESOLVED", "IN_PROGRESS",
|
|
|
+ await InsertTimelineAsync(e.Id, "CLOSE_REJECTED", "关闭被驳回", "RESOLVED", "IN_PROGRESS",
|
|
|
instanceId, lastApproverId);
|
|
|
}
|
|
|
}
|
|
|
@@ -61,14 +70,14 @@ public class ExceptionClosureBizHandler : IFlowBizHandler, ITransient
|
|
|
if (e == null) return new Dictionary<string, object>();
|
|
|
return new Dictionary<string, object>
|
|
|
{
|
|
|
- ["sceneCode"] = e.SceneCode,
|
|
|
+ ["sceneCode"] = e.SceneCode ?? string.Empty,
|
|
|
+ ["factoryCode"] = e.FactoryId.ToString(),
|
|
|
};
|
|
|
}
|
|
|
|
|
|
private async Task InsertTimelineAsync(long exceptionId, string code, string label,
|
|
|
string? from, string? to, long? instanceId, long? approverId)
|
|
|
{
|
|
|
- // P4-17: 补齐审批人 ID 到 Timeline 留痕
|
|
|
string? remark = null;
|
|
|
if (instanceId.HasValue && approverId.HasValue)
|
|
|
remark = $"审批实例ID: {instanceId},审批人: {approverId}";
|
|
|
@@ -84,6 +93,7 @@ public class ExceptionClosureBizHandler : IFlowBizHandler, ITransient
|
|
|
ActionLabel = label,
|
|
|
FromStatus = from,
|
|
|
ToStatus = to,
|
|
|
+ OperatorId = approverId,
|
|
|
ActionRemark = remark,
|
|
|
CreatedAt = DateTime.Now
|
|
|
});
|