|
@@ -76,7 +76,7 @@ public class OrderController : BaseController
|
|
|
private readonly IRepository<OrderObserve> _orderObserveRepository;
|
|
|
|
|
|
|
|
|
- public OrderController(
|
|
|
+ public OrderController(
|
|
|
IOrderDomainService orderDomainService,
|
|
|
IOrderRepository orderRepository,
|
|
|
IWorkflowApplication workflowApplication,
|
|
@@ -110,7 +110,7 @@ public class OrderController : BaseController
|
|
|
IRepeatableEventDetailRepository repeatableEventDetailRepository,
|
|
|
IRepository<OrderWord> orderWrodRepository,
|
|
|
IRepository<OrderObserve> orderObserveRepository
|
|
|
- )
|
|
|
+ )
|
|
|
{
|
|
|
_orderDomainService = orderDomainService;
|
|
|
_orderRepository = orderRepository;
|
|
@@ -146,7 +146,7 @@ public class OrderController : BaseController
|
|
|
_orderWrodRepository = orderWrodRepository;
|
|
|
_orderObserveRepository = orderObserveRepository;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
#region 工单发布
|
|
|
|
|
@@ -603,15 +603,15 @@ public class OrderController : BaseController
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[Permission(EPermission.QueryOrderRedoRecord)]
|
|
|
- [HttpGet("redo")]
|
|
|
- public async Task<PagedDto<OrderRedo>> QueryOrderRedo([FromQuery] QueryOrderRedoRecordDto dto)
|
|
|
- {
|
|
|
- var (total, items) = await _orderRedoRepository.Queryable()
|
|
|
- .Includes(x => x.Order)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
- d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
|
|
|
- .OrderByDescending(x => x.CreationTime)
|
|
|
- .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ [HttpGet("redo")]
|
|
|
+ public async Task<PagedDto<OrderRedo>> QueryOrderRedo([FromQuery] QueryOrderRedoRecordDto dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderRedoRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Keyword),
|
|
|
+ d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
|
|
|
+ .OrderByDescending(x => x.CreationTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
|
|
|
return new PagedDto<OrderRedo>(total, items);
|
|
|
}
|
|
@@ -831,9 +831,44 @@ public class OrderController : BaseController
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("delay/province/result")]
|
|
|
- public async Task DelayProvinceResult()
|
|
|
+ public async Task DelayProvinceResult([FromBody] DelayProvinceResultDto dto)
|
|
|
{
|
|
|
- //pass, reject
|
|
|
+ var orderDelay = await _orderDelayRepository.Queryable()
|
|
|
+ .Includes(d => d.Order)
|
|
|
+ .Includes(d=>d.Workflow)
|
|
|
+ .FirstAsync(d => d.Order.ProvinceNo == dto.No && d.DelayState == EDelayState.Examining,
|
|
|
+ HttpContext.RequestAborted);
|
|
|
+ if (orderDelay is null)
|
|
|
+ throw new UserFriendlyException("无效省工单编号");
|
|
|
+
|
|
|
+ if (dto.IsPass)
|
|
|
+ {
|
|
|
+ var nextDtos =
|
|
|
+ await _workflowApplication.GetNextStepsAsync(orderDelay.WorkflowId, HttpContext.RequestAborted);
|
|
|
+ var nextStep = nextDtos.Steps.FirstOrDefault(d => d.Key == "end");
|
|
|
+ if (nextStep is null)
|
|
|
+ throw new UserFriendlyException("未查询到结束节点");
|
|
|
+
|
|
|
+ var nextDto = new NextWorkflowDto
|
|
|
+ {
|
|
|
+ WorkflowId = orderDelay.WorkflowId,
|
|
|
+ StepExpiredTime = orderDelay.Workflow.ExpiredTime,
|
|
|
+ NextStepCode = nextStep.Key,
|
|
|
+ NextStepName = nextStep.Value,
|
|
|
+ NextMainHandler = nextStep.Key,
|
|
|
+ Opinion = dto.Opinion
|
|
|
+ };
|
|
|
+ await _workflowApplication.NextAsync(nextDto, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var rejectDto = new RejectDto
|
|
|
+ {
|
|
|
+ WorkflowId = orderDelay.WorkflowId,
|
|
|
+ Opinion = dto.Opinion,
|
|
|
+ };
|
|
|
+ await _workflowApplication.RejectAsync(rejectDto, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1443,7 +1478,7 @@ public class OrderController : BaseController
|
|
|
.Where(x => x.OrderId == id).Distinct().ToListAsync();
|
|
|
var repeatables = _mapper.Map<List<RepeatableEventDetailOpDto>>(repeatablesMap);
|
|
|
dto.RepeatableEventDetails = repeatables;
|
|
|
- return dto;
|
|
|
+ return dto;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1511,15 +1546,15 @@ public class OrderController : BaseController
|
|
|
{
|
|
|
var reAdds = dto.RepeatableEventDetails.Where(x => string.IsNullOrEmpty(x.OrderId) && !x.IsDeleted).ToList();
|
|
|
var reDeletes = dto.RepeatableEventDetails.Where(x => !string.IsNullOrEmpty(x.OrderId) && x.IsDeleted).ToList();
|
|
|
- reAdds.ForEach(x => x.OrderId = dto.Id);
|
|
|
- List<RepeatableEventDetail> repeatables = _mapper.Map<List<RepeatableEventDetail>>(reAdds);
|
|
|
- await _repeatableEventDetailRepository.AddRangeAsync(repeatables, HttpContext.RequestAborted);
|
|
|
- if (reDeletes?.Any()?? false)
|
|
|
- {
|
|
|
+ reAdds.ForEach(x => x.OrderId = dto.Id);
|
|
|
+ List<RepeatableEventDetail> repeatables = _mapper.Map<List<RepeatableEventDetail>>(reAdds);
|
|
|
+ await _repeatableEventDetailRepository.AddRangeAsync(repeatables, HttpContext.RequestAborted);
|
|
|
+ if (reDeletes?.Any() ?? false)
|
|
|
+ {
|
|
|
await _repeatableEventDetailRepository.DeleteAsync(reDeletes, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
- _mapper.Map(dto, order);
|
|
|
+ _mapper.Map(dto, order);
|
|
|
await _orderRepository.UpdateOrderNavAsync(order, HttpContext.RequestAborted);
|
|
|
}
|
|
|
|
|
@@ -1623,7 +1658,7 @@ public class OrderController : BaseController
|
|
|
ChannelOptions = _sysDicDataCacheManager.GetSysDicDataCache(TimeLimitBaseDataConsts.SourceChannel),
|
|
|
AcceptTypeOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.AcceptType),
|
|
|
EmergencyLevelOptions = EnumExts.GetDescriptions<EEmergencyLevel>(),
|
|
|
- PushTypeOptions =_sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.PushType),
|
|
|
+ PushTypeOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.PushType),
|
|
|
GenderOptions = EnumExts.GetDescriptions<EGender>(),
|
|
|
IdentityTypeOptions = EnumExts.GetDescriptions<EIdentityType>(),
|
|
|
LicenceTypeOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.LicenceType),
|
|
@@ -1649,8 +1684,8 @@ public class OrderController : BaseController
|
|
|
NationOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.Nation),
|
|
|
MarketTypeOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.MarketType),
|
|
|
IndustryClassifyOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.IndustryClassify),
|
|
|
- BrandOptions =_sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.Brand),
|
|
|
- ObjectClassifyOptions =_sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.ObjectClassify),
|
|
|
+ BrandOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.Brand),
|
|
|
+ ObjectClassifyOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.ObjectClassify),
|
|
|
ComplainClassifyOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.ComplainClassify),
|
|
|
ReportClassifyOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.ReportClassify),
|
|
|
SalesModeOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.SalesMode),
|
|
@@ -1663,23 +1698,23 @@ public class OrderController : BaseController
|
|
|
return rsp;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 扩展信息新增页面基础数据
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpPost("order_repeatable_event")]
|
|
|
- public async Task<bool> RepeatableEvent(QueryRepeatableEventDto dto)
|
|
|
- {
|
|
|
- var exp = Expressionable.Create<Order>()
|
|
|
- .OrIF(!string.IsNullOrEmpty(dto.HotspotSpliceName), x => x.HotspotSpliceName.EndsWith(dto.HotspotSpliceName!))
|
|
|
- .OrIF(!string.IsNullOrEmpty(dto.Address), x => x.Address != null && x.Address.EndsWith(dto.Address!));
|
|
|
- var count = await _orderRepository.Queryable()
|
|
|
- .Where(exp.ToExpression())
|
|
|
- .Where(d => d.CreationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
|
|
- .CountAsync();
|
|
|
- var setting = _systemSettingCacheManager.GetSetting(SettingConstants.RepeatableEventNum);
|
|
|
- return count >= int.Parse(setting?.SettingValue[0] ?? "0");
|
|
|
- }
|
|
|
+ /// <summary>
|
|
|
+ /// 扩展信息新增页面基础数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("order_repeatable_event")]
|
|
|
+ public async Task<bool> RepeatableEvent(QueryRepeatableEventDto dto)
|
|
|
+ {
|
|
|
+ var exp = Expressionable.Create<Order>()
|
|
|
+ .OrIF(!string.IsNullOrEmpty(dto.HotspotSpliceName), x => x.HotspotSpliceName.EndsWith(dto.HotspotSpliceName!))
|
|
|
+ .OrIF(!string.IsNullOrEmpty(dto.Address), x => x.Address != null && x.Address.EndsWith(dto.Address!));
|
|
|
+ var count = await _orderRepository.Queryable()
|
|
|
+ .Where(exp.ToExpression())
|
|
|
+ .Where(d => d.CreationTime.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"))
|
|
|
+ .CountAsync();
|
|
|
+ var setting = _systemSettingCacheManager.GetSetting(SettingConstants.RepeatableEventNum);
|
|
|
+ return count >= int.Parse(setting?.SettingValue[0] ?? "0");
|
|
|
+ }
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -1917,24 +1952,24 @@ public class OrderController : BaseController
|
|
|
await _repeatableEventDetailRepository.RemoveAsync(x => x.RepeatableId == dto.Id);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 删除重复性事件明细
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.DeleteRepeatableEventDetail)]
|
|
|
- [HttpDelete("repeatable_event_detail/{id}")]
|
|
|
- public async Task Delete([FromBody] string id )
|
|
|
+ /// <summary>
|
|
|
+ /// 删除重复性事件明细
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.DeleteRepeatableEventDetail)]
|
|
|
+ [HttpDelete("repeatable_event_detail/{id}")]
|
|
|
+ public async Task Delete([FromBody] string id)
|
|
|
{
|
|
|
- await _repeatableEventDetailRepository.RemoveAsync(x => x.Id == id);
|
|
|
+ await _repeatableEventDetailRepository.RemoveAsync(x => x.Id == id);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 更新重复性事件
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.UpdateRepeatableEvent)]
|
|
|
+ /// <summary>
|
|
|
+ /// 更新重复性事件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.UpdateRepeatableEvent)]
|
|
|
[HttpPut("repeatable_event")]
|
|
|
public async Task Update([FromBody] RepeatableEventUpdateDto dto)
|
|
|
{
|
|
@@ -1990,168 +2025,168 @@ public class OrderController : BaseController
|
|
|
.Includes(x => x.Details, y => y.Order)
|
|
|
.FirstAsync(x => x.Id == dto.Id);
|
|
|
}
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 工单词库
|
|
|
- /// <summary>
|
|
|
- /// 新增工单词库
|
|
|
- /// </summary>
|
|
|
- /// <param name="dtos"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.AddOrderWord)]
|
|
|
- [HttpPost("order_word")]
|
|
|
- public async Task Add([FromBody] OrderWordAddDto dto)
|
|
|
- {
|
|
|
- var word = _mapper.Map<OrderWord>(dto);
|
|
|
- await _orderWrodRepository.AddAsync(word, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 删除工单词库
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.DeleteOrderWord)]
|
|
|
- [HttpDelete("order_word")]
|
|
|
- public async Task Delete([FromBody] OrderWordDeleteDto dto)
|
|
|
- {
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 工单词库
|
|
|
+ /// <summary>
|
|
|
+ /// 新增工单词库
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dtos"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.AddOrderWord)]
|
|
|
+ [HttpPost("order_word")]
|
|
|
+ public async Task Add([FromBody] OrderWordAddDto dto)
|
|
|
+ {
|
|
|
+ var word = _mapper.Map<OrderWord>(dto);
|
|
|
+ await _orderWrodRepository.AddAsync(word, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 删除工单词库
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.DeleteOrderWord)]
|
|
|
+ [HttpDelete("order_word")]
|
|
|
+ public async Task Delete([FromBody] OrderWordDeleteDto dto)
|
|
|
+ {
|
|
|
await _orderRepository.RemoveOrderWrodBatchAsync(dto.Ids, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 更新工单词库
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.UpdateOrderWord)]
|
|
|
- [HttpPut("order_word")]
|
|
|
- public async Task Update([FromBody] OrderWordUpdateDto dto)
|
|
|
- {
|
|
|
- var word = await _orderWrodRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
- if (word is null)
|
|
|
- throw UserFriendlyException.SameMessage("无效工单词库");
|
|
|
- _mapper.Map(dto, word);
|
|
|
- word.LastModificationName = _sessionContext.UserName;
|
|
|
- await _orderWrodRepository.UpdateAsync(word, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取工单词库列表
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.OrderWordList)]
|
|
|
- [HttpGet("order_word/list")]
|
|
|
- public async Task<PagedDto<OrderWordDto>> List([FromQuery] OrderWordListDto dto)
|
|
|
- {
|
|
|
- var (total, items) = await _orderWrodRepository.Queryable()
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Tag), x => x.Tag == dto.Tag!)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Classify), x => x.Classify.Contains(dto.Classify!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Synonym), x => x.Synonym != null && x.Synonym.Contains(dto.Synonym!))
|
|
|
- .OrderByDescending(x => x.CreationTime)
|
|
|
- .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
- return new PagedDto<OrderWordDto>(total, _mapper.Map<IReadOnlyList<OrderWordDto>>(items));
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取工单词库
|
|
|
- /// </summary>
|
|
|
- /// <param name="id"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpGet("order_word/{id}")]
|
|
|
- public async Task<OrderWord> OrderWordEntity(string id)
|
|
|
- {
|
|
|
- return await _orderWrodRepository.Queryable()
|
|
|
- .FirstAsync(x => x.Id == id);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取工单词库基本信息
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpGet("order_word/base")]
|
|
|
- public async Task<object> Base()
|
|
|
- {
|
|
|
- var rsp = new
|
|
|
- {
|
|
|
- OrderWordClassify = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.OrderWordClassify),
|
|
|
- };
|
|
|
- return rsp;
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 工单观察
|
|
|
- /// <summary>
|
|
|
- /// 新增工单观察
|
|
|
- /// </summary>
|
|
|
- /// <param name="dtos"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.AddOrderObserve)]
|
|
|
- [HttpPost("order_observe")]
|
|
|
- public async Task Add([FromBody] OrderObserveAddDto dto)
|
|
|
- {
|
|
|
- var observe = _mapper.Map<OrderObserve>(dto);
|
|
|
- await _orderObserveRepository.AddAsync(observe, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 删除工单观察
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.DeleteOrderObserve)]
|
|
|
- [HttpDelete("order_observe")]
|
|
|
- public async Task Delete([FromBody] OrderObserveDeleteDto dto)
|
|
|
- {
|
|
|
- await _orderRepository.RemoveOrderObserveBatchAsync(dto.Ids, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 更新工单观察
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.UpdateOrderObserve)]
|
|
|
- [HttpPut("order_observe")]
|
|
|
- public async Task Update([FromBody] OrderObserveUpdateDto dto)
|
|
|
- {
|
|
|
- var word = await _orderObserveRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
- if (word is null)
|
|
|
- throw UserFriendlyException.SameMessage("无效工单观察");
|
|
|
- _mapper.Map(dto, word);
|
|
|
- await _orderObserveRepository.UpdateAsync(word, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取工单观察列表
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [Permission(EPermission.OrderObserveList)]
|
|
|
- [HttpGet("order_observe/list")]
|
|
|
- public async Task<PagedDto<OrderObserveDto>> List([FromQuery] OrderObserveListDto dto)
|
|
|
- {
|
|
|
- var (total, items) = await _orderObserveRepository.Queryable()
|
|
|
- .Includes(x=>x.Order)
|
|
|
- .WhereIF(dto.IsProvince.HasValue, x => x.Order.IsProvince == dto.IsProvince)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.Order.Title.Contains(dto.Title!))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.Order.No.Contains(dto.No!))
|
|
|
- .OrderByDescending(x => x.CreationTime)
|
|
|
- .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
- return new PagedDto<OrderObserveDto>(total, _mapper.Map<IReadOnlyList<OrderObserveDto>>(items));
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获取工单观察
|
|
|
- /// </summary>
|
|
|
- /// <param name="id"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpGet("order_observe/{id}")]
|
|
|
- public async Task<OrderObserve> OrderObserveEntity(string id)
|
|
|
- {
|
|
|
- return await _orderObserveRepository.Queryable()
|
|
|
- .FirstAsync(x => x.Id == id);
|
|
|
- }
|
|
|
- #endregion
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新工单词库
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.UpdateOrderWord)]
|
|
|
+ [HttpPut("order_word")]
|
|
|
+ public async Task Update([FromBody] OrderWordUpdateDto dto)
|
|
|
+ {
|
|
|
+ var word = await _orderWrodRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (word is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效工单词库");
|
|
|
+ _mapper.Map(dto, word);
|
|
|
+ word.LastModificationName = _sessionContext.UserName;
|
|
|
+ await _orderWrodRepository.UpdateAsync(word, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单词库列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.OrderWordList)]
|
|
|
+ [HttpGet("order_word/list")]
|
|
|
+ public async Task<PagedDto<OrderWordDto>> List([FromQuery] OrderWordListDto dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderWrodRepository.Queryable()
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Tag), x => x.Tag == dto.Tag!)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Classify), x => x.Classify.Contains(dto.Classify!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Synonym), x => x.Synonym != null && x.Synonym.Contains(dto.Synonym!))
|
|
|
+ .OrderByDescending(x => x.CreationTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<OrderWordDto>(total, _mapper.Map<IReadOnlyList<OrderWordDto>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单词库
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("order_word/{id}")]
|
|
|
+ public async Task<OrderWord> OrderWordEntity(string id)
|
|
|
+ {
|
|
|
+ return await _orderWrodRepository.Queryable()
|
|
|
+ .FirstAsync(x => x.Id == id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单词库基本信息
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("order_word/base")]
|
|
|
+ public async Task<object> Base()
|
|
|
+ {
|
|
|
+ var rsp = new
|
|
|
+ {
|
|
|
+ OrderWordClassify = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.OrderWordClassify),
|
|
|
+ };
|
|
|
+ return rsp;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 工单观察
|
|
|
+ /// <summary>
|
|
|
+ /// 新增工单观察
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dtos"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.AddOrderObserve)]
|
|
|
+ [HttpPost("order_observe")]
|
|
|
+ public async Task Add([FromBody] OrderObserveAddDto dto)
|
|
|
+ {
|
|
|
+ var observe = _mapper.Map<OrderObserve>(dto);
|
|
|
+ await _orderObserveRepository.AddAsync(observe, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 删除工单观察
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.DeleteOrderObserve)]
|
|
|
+ [HttpDelete("order_observe")]
|
|
|
+ public async Task Delete([FromBody] OrderObserveDeleteDto dto)
|
|
|
+ {
|
|
|
+ await _orderRepository.RemoveOrderObserveBatchAsync(dto.Ids, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 更新工单观察
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.UpdateOrderObserve)]
|
|
|
+ [HttpPut("order_observe")]
|
|
|
+ public async Task Update([FromBody] OrderObserveUpdateDto dto)
|
|
|
+ {
|
|
|
+ var word = await _orderObserveRepository.GetAsync(dto.Id, HttpContext.RequestAborted);
|
|
|
+ if (word is null)
|
|
|
+ throw UserFriendlyException.SameMessage("无效工单观察");
|
|
|
+ _mapper.Map(dto, word);
|
|
|
+ await _orderObserveRepository.UpdateAsync(word, HttpContext.RequestAborted);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单观察列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [Permission(EPermission.OrderObserveList)]
|
|
|
+ [HttpGet("order_observe/list")]
|
|
|
+ public async Task<PagedDto<OrderObserveDto>> List([FromQuery] OrderObserveListDto dto)
|
|
|
+ {
|
|
|
+ var (total, items) = await _orderObserveRepository.Queryable()
|
|
|
+ .Includes(x => x.Order)
|
|
|
+ .WhereIF(dto.IsProvince.HasValue, x => x.Order.IsProvince == dto.IsProvince)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.Order.Title.Contains(dto.Title!))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.No), x => x.Order.No.Contains(dto.No!))
|
|
|
+ .OrderByDescending(x => x.CreationTime)
|
|
|
+ .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
|
|
|
+ return new PagedDto<OrderObserveDto>(total, _mapper.Map<IReadOnlyList<OrderObserveDto>>(items));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取工单观察
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("order_observe/{id}")]
|
|
|
+ public async Task<OrderObserve> OrderObserveEntity(string id)
|
|
|
+ {
|
|
|
+ return await _orderObserveRepository.Queryable()
|
|
|
+ .FirstAsync(x => x.Id == id);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
}
|