|
@@ -1552,20 +1552,21 @@ public class OrderController : BaseController
|
|
|
var setting = _systemSettingCacheManager.GetSetting(SettingConstants.ScreenApplyNum);
|
|
|
int count = await _orderScreenRepository.CountAsync(x =>
|
|
|
x.OrderId == dto.Data.OrderId && x.Status == EScreenStatus.Refuse);
|
|
|
- if (count > int.Parse(setting?.SettingValue[0]))
|
|
|
+ if (count > int.Parse(setting?.SettingValue[0]) && int.Parse(setting?.SettingValue[0]) > 0)
|
|
|
throw UserFriendlyException.SameMessage("甄别申请已超过系统预定设置,不能申请");
|
|
|
|
|
|
var visit = await _orderVisitRepository.GetAsync(dto.Data.VisitId, HttpContext.RequestAborted);
|
|
|
setting = _systemSettingCacheManager.GetSetting(SettingConstants.ScreenApplyEndTime);
|
|
|
var endTime = _timeLimitDomainService
|
|
|
.CalcEndTime(visit.VisitTime.Value, ETimeType.WorkDay, int.Parse(setting?.SettingValue[0]), 0).EndTime;
|
|
|
- if (DateTime.Now > endTime)
|
|
|
+ if (DateTime.Now > endTime && int.Parse(setting?.SettingValue[0]) > 0)
|
|
|
throw UserFriendlyException.SameMessage("甄别申请时限已超过系统预定设置,不能申请");
|
|
|
|
|
|
var model = _mapper.Map<OrderScreen>(dto.Data);
|
|
|
model.Status = EScreenStatus.Apply;
|
|
|
model.ApplyEndTime = endTime;
|
|
|
- model.InitId();
|
|
|
+ model.TimeConsuming = _timeLimitDomainService.CalcWorkTimeToDecimal(visit.VisitTime.Value,DateTime.Now,false);
|
|
|
+ model.InitId();
|
|
|
if (dto.Data.Files.Any())
|
|
|
model.FileJson = await _fileRepository.AddFileAsync(dto.Data.Files, model.Id, "", HttpContext.RequestAborted);
|
|
|
await _orderScreenRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
@@ -2512,18 +2513,18 @@ public class OrderController : BaseController
|
|
|
NearlyExpiredTime = timeResult.NearlyExpiredTime
|
|
|
};
|
|
|
}
|
|
|
- else if (dto.Workflow.FlowDirection == EFlowDirection.CenterToCenter)
|
|
|
- {
|
|
|
- var timeResult = _timeLimitDomainService.CalcEndTime(DateTime.Now, ETimeType.WorkDay, 1, 0);
|
|
|
- expiredTimeConfig = new ExpiredTimeWithConfig
|
|
|
- {
|
|
|
- Count = 1,
|
|
|
- TimeType = ETimeType.WorkDay,
|
|
|
- TimeText = "1个工作日",
|
|
|
- ExpiredTime = timeResult.EndTime,
|
|
|
- NearlyExpiredTime = timeResult.NearlyExpiredTime
|
|
|
- };
|
|
|
- }
|
|
|
+ //else if (dto.Workflow.FlowDirection == EFlowDirection.CenterToCenter)
|
|
|
+ //{
|
|
|
+ // var timeResult = _timeLimitDomainService.CalcEndTime(DateTime.Now, ETimeType.WorkDay, 1, 0);
|
|
|
+ // expiredTimeConfig = new ExpiredTimeWithConfig
|
|
|
+ // {
|
|
|
+ // Count = 1,
|
|
|
+ // TimeType = ETimeType.WorkDay,
|
|
|
+ // TimeText = "1个工作日",
|
|
|
+ // ExpiredTime = timeResult.EndTime,
|
|
|
+ // NearlyExpiredTime = timeResult.NearlyExpiredTime
|
|
|
+ // };
|
|
|
+ //}
|
|
|
else
|
|
|
{
|
|
|
//期满时间
|
|
@@ -3076,11 +3077,46 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 工单业务退回审批列表
|
|
|
+ /// 工单业务批量退回审批
|
|
|
/// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
- [Permission(EPermission.OrderPreviousList)]
|
|
|
+ [HttpPost("order_previous_audit_batch")]
|
|
|
+ public async Task AuditBatch([FromBody] BatchAuditSendBackDto dto)
|
|
|
+ {
|
|
|
+ foreach (string id in dto.Ids)
|
|
|
+ {
|
|
|
+ if (dto.State == ESendBackAuditState.Refuse && string.IsNullOrEmpty(dto.AuditContent))
|
|
|
+ throw UserFriendlyException.SameMessage("退回拒绝,请填写审批拒绝原因");
|
|
|
+ //验证是否存在退回
|
|
|
+ var sendBack = await _orderSendBackAuditRepository.GetAsync(id, HttpContext.RequestAborted);
|
|
|
+ if (sendBack is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效退回");
|
|
|
+ if (sendBack.State != ESendBackAuditState.Apply)
|
|
|
+ throw UserFriendlyException.SameMessage("退回已审批,请勿重复审批");
|
|
|
+
|
|
|
+ _mapper.Map(dto, sendBack);
|
|
|
+ sendBack.AuditId = _sessionContext.UserId;
|
|
|
+ sendBack.AuditUser = _sessionContext.UserName;
|
|
|
+ sendBack.AuditTime = DateTime.Now;
|
|
|
+
|
|
|
+ //执行退回
|
|
|
+ if (sendBack.State == ESendBackAuditState.End)
|
|
|
+ {
|
|
|
+ await _workflowApplication.PreviousAsync(sendBack.SendBackData, sendBack.WorkflowUserId, HttpContext.RequestAborted);
|
|
|
+ //发送短信TODO
|
|
|
+
|
|
|
+ }
|
|
|
+ await _orderSendBackAuditRepository.UpdateAsync(sendBack, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 工单业务退回审批列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.OrderPreviousList)]
|
|
|
[HttpGet("order_previous_list")]
|
|
|
public async Task<PagedDto<SendBackDto>> AuditList([FromQuery] SendBackListDto dto)
|
|
|
{
|
|
@@ -3156,7 +3192,7 @@ public class OrderController : BaseController
|
|
|
foreach (var item in dto.OrderIds)
|
|
|
{
|
|
|
//验证工单是否可以申请
|
|
|
- var order = await _orderRepository.GetAsync(item, HttpContext.RequestAborted);
|
|
|
+ var order = await _orderRepository.GetAsync(item.OrderId, HttpContext.RequestAborted);
|
|
|
if (order is null)
|
|
|
{
|
|
|
errorCount++;
|
|
@@ -3175,7 +3211,7 @@ public class OrderController : BaseController
|
|
|
var model = new OrderSendBack()
|
|
|
{
|
|
|
Content = dto.Content,
|
|
|
- OrderId = item,
|
|
|
+ OrderId = item.OrderId,
|
|
|
Destination = ESendBackDestination.Province
|
|
|
};
|
|
|
await _orderSendBackRepository.AddAsync(model, HttpContext.RequestAborted);
|
|
@@ -3535,30 +3571,24 @@ public class OrderController : BaseController
|
|
|
.FirstAsync(d => d.Id == dto.Id);
|
|
|
if (special is null) throw UserFriendlyException.SameMessage("无效特提审批信息!");
|
|
|
if (special.State != 0) throw UserFriendlyException.SameMessage("无效特提审批信息,特提审批信息错误,该信息已审核!");
|
|
|
- if (string.IsNullOrEmpty(dto.NextStepName)) dto.NextStepName = special.NextStepName;
|
|
|
- if (string.IsNullOrEmpty(dto.NextStepCode)) dto.NextStepCode = special.NextStepCode;
|
|
|
- if (dto.NextHandlers.Count <= 0) dto.NextHandlers = special.NextHandlers;
|
|
|
- dto.FlowDirection ??= special.FlowDirection;
|
|
|
- dto.HandlerType ??= special.HandlerType;
|
|
|
- dto.BusinessType ??= special.BusinessType;
|
|
|
- _mapper.Map(dto, special);
|
|
|
- if (dto.Files.Any())
|
|
|
- special.ReplyFileJson =
|
|
|
- await _fileRepository.AddFileAsync(dto.Files, special.Id, "", HttpContext.RequestAborted);
|
|
|
+ special.State = dto.State;
|
|
|
+ special.Opinion = dto.Opinion;
|
|
|
+ if (dto.Files.Any())
|
|
|
+ special.ReplyFileJson = await _fileRepository.AddFileAsync(dto.Files, special.Id, "", HttpContext.RequestAborted);
|
|
|
await _orderSpecialRepository.UpdateAsync(special, HttpContext.RequestAborted);
|
|
|
var order = await _orderRepository.GetAsync(x => x.Id == special.OrderId);
|
|
|
if (special.State == 1)
|
|
|
{
|
|
|
var recall = new RecallDto
|
|
|
{
|
|
|
- WorkflowId = dto.WorkflowId!,
|
|
|
- NextStepCode = dto.NextStepCode,
|
|
|
- NextStepName = dto.NextStepName,
|
|
|
- NextHandlers = dto.NextHandlers,
|
|
|
+ WorkflowId = special.WorkflowId!,
|
|
|
+ NextStepCode = special.NextStepCode,
|
|
|
+ NextStepName = special.NextStepName,
|
|
|
+ NextHandlers = special.NextHandlers,
|
|
|
Opinion = dto.Opinion,
|
|
|
- FlowDirection = dto.FlowDirection,
|
|
|
- HandlerType = dto.HandlerType.Value,
|
|
|
- BusinessType = dto.BusinessType.Value
|
|
|
+ FlowDirection = special.FlowDirection,
|
|
|
+ HandlerType = special.HandlerType.Value,
|
|
|
+ BusinessType = special.BusinessType.Value
|
|
|
};
|
|
|
//if (dto.AlterTime)
|
|
|
// recall.External = new External { TimeLimit = dto.TimeLimit, TimeLimitUnit = dto.TimeLimitUnit };
|
|
@@ -3620,12 +3650,110 @@ public class OrderController : BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 获取工单特提信息列表
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.AuditSpecialOrderList)]
|
|
|
+ /// <summary>
|
|
|
+ /// 批量审批工单特提
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dtos"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPut("special_batch")]
|
|
|
+ [LogFilter("批量审批工单特提")]
|
|
|
+ public async Task UpdateBatch([FromBody] BatchAuditOrderSpecialDto dto)
|
|
|
+ {
|
|
|
+ foreach (string id in dto.ids)
|
|
|
+ {
|
|
|
+ var special = await _orderSpecialRepository
|
|
|
+ .Queryable()
|
|
|
+ .Includes(d => d.Order)
|
|
|
+ .FirstAsync(d => d.Id == id);
|
|
|
+ if (special is null) throw UserFriendlyException.SameMessage("无效特提审批信息!");
|
|
|
+ if (special.State != 0) throw UserFriendlyException.SameMessage("无效特提审批信息,特提审批信息错误,该信息已审核!");
|
|
|
+ special.State = dto.State;
|
|
|
+ special.Opinion = dto.Opinion;
|
|
|
+ if (dto.Files.Any())
|
|
|
+ special.ReplyFileJson = await _fileRepository.AddFileAsync(dto.Files, special.Id, "", HttpContext.RequestAborted);
|
|
|
+ await _orderSpecialRepository.UpdateAsync(special, HttpContext.RequestAborted);
|
|
|
+ var order = await _orderRepository.GetAsync(x => x.Id == special.OrderId);
|
|
|
+ if (special.State == 1)
|
|
|
+ {
|
|
|
+ var recall = new RecallDto
|
|
|
+ {
|
|
|
+ WorkflowId = special.WorkflowId!,
|
|
|
+ NextStepCode = special.NextStepCode,
|
|
|
+ NextStepName = special.NextStepName,
|
|
|
+ NextHandlers = special.NextHandlers,
|
|
|
+ Opinion = dto.Opinion,
|
|
|
+ FlowDirection = special.FlowDirection,
|
|
|
+ HandlerType = special.HandlerType.Value,
|
|
|
+ BusinessType = special.BusinessType.Value
|
|
|
+ };
|
|
|
+ //if (dto.AlterTime)
|
|
|
+ // recall.External = new External { TimeLimit = dto.TimeLimit, TimeLimitUnit = dto.TimeLimitUnit };
|
|
|
+ //if (dto.Files.Any()) recall.Files = dto.Files;
|
|
|
+ // 计算期满时间
|
|
|
+ //if (dto.AlterTime)
|
|
|
+ //{
|
|
|
+ var expiredTime = _timeLimitDomainService.CalcEndTime(DateTime.Now, order.AcceptTypeCode);
|
|
|
+ await _orderRepository.Updateable().SetColumns(o => new Order() { ExpiredTime = expiredTime.ExpiredTime, NearlyExpiredTime = expiredTime.NearlyExpiredTime })
|
|
|
+ .Where(o => o.Id == order.Id).ExecuteCommandAsync(HttpContext.RequestAborted);
|
|
|
+ var orderDto = _mapper.Map<OrderDto>(order);
|
|
|
+ await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderExpiredTimeUpdate, orderDto, cancellationToken: HttpContext.RequestAborted);
|
|
|
+ //}
|
|
|
+
|
|
|
+ //todo 特提重办,按审批通过时间依据中心派至部门的规则计算期满时间,更新order
|
|
|
+
|
|
|
+ await _workflowApplication.RecallAsync(recall, expiredTime.ExpiredTime, HttpContext.RequestAborted);
|
|
|
+ var publish = await _orderPublishRepository.GetAsync(x => x.OrderId == special.OrderId);
|
|
|
+ if (publish != null)
|
|
|
+ {
|
|
|
+ var publishHistory = _mapper.Map<OrderPublishHistory>(publish);
|
|
|
+ publishHistory.OrderPublishId = publish.Id;
|
|
|
+ publishHistory.ArrangeTitleAfter = publish.ArrangeTitle;
|
|
|
+ publishHistory.ArrangeTitleBefor = publish.ArrangeTitle;
|
|
|
+ publishHistory.ArrangeContentAfter = publish.ArrangeContent;
|
|
|
+ publishHistory.ArrangeContentBefor = publish.ArrangeContent;
|
|
|
+ publishHistory.ArrangeOpinionAfter = publish.ArrangeOpinion;
|
|
|
+ publishHistory.ArrangeOpinionBefor = publish.ArrangeOpinion;
|
|
|
+ await _orderPublishHistoryRepository.AddAsync(publishHistory, HttpContext.RequestAborted);
|
|
|
+ await _orderPublishRepository.RemoveAsync(publish, false, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ var visit = await _orderVisitRepository.GetAsync(x => x.OrderId == special.OrderId && x.VisitState != EVisitState.None);
|
|
|
+ if (visit != null)
|
|
|
+ {
|
|
|
+ visit.VisitState = EVisitState.None;
|
|
|
+ await _orderVisitRepository.UpdateAsync(visit, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (order != null && ("001171".Equals(special.OrgId) ||
|
|
|
+ "001178".Equals(special.OrgId) ||
|
|
|
+ "001180".Equals(special.OrgId)))
|
|
|
+ {
|
|
|
+ await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFlowRecalled,
|
|
|
+ new PublishSpecialDto { Order = _mapper.Map<OrderDto>(order), Special = _mapper.Map<OrderSpecialDto>(special) }, cancellationToken: HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ //try
|
|
|
+ //{
|
|
|
+ // await _provinceService.RevokeOrder(
|
|
|
+ // new PublishSpecialDto
|
|
|
+ // { Order = _mapper.Map<OrderDto>(order), Special = _mapper.Map<OrderSpecialDto>(special) },
|
|
|
+ // HttpContext.RequestAborted);
|
|
|
+ //}
|
|
|
+ //catch (Exception e)
|
|
|
+ //{
|
|
|
+ // _logger.LogError("_provinceService.RevokeOrder throw exception: {ex}", e.Message);
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单特提信息列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.AuditSpecialOrderList)]
|
|
|
[HttpGet("special/list")]
|
|
|
public async Task<PagedDto<OrderSpecialDto>> List([FromQuery] OrderSpecialListDto dto)
|
|
|
{
|