|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
using Myshipping.Core;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 服务流程
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ApiDescriptionSettings("Application", Name = "ServiceWorkFlowBase", Order = 10)]
|
|
|
|
|
public class ServiceWorkFlowBaseService : IServiceWorkFlowBaseService, IDynamicApiController, ITransient
|
|
|
|
|
{
|
|
|
|
|
private readonly SqlSugarRepository<ServiceWorkFlowBaseInfo> _serviceWorkFlowBaseRepository;
|
|
|
|
|
private readonly SqlSugarRepository<ServiceWorkFlowActivitiesInfo> _serviceWorkFlowActivitiesInfoRepository;
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<ServiceWorkFlowBaseService> _logger;
|
|
|
|
|
public ServiceWorkFlowBaseService(SqlSugarRepository<ServiceWorkFlowBaseInfo> serviceWorkFlowBaseRepository,
|
|
|
|
|
ILogger<StatusSkuBaseService> logger,
|
|
|
|
|
SqlSugarRepository<ServiceWorkFlowActivitiesInfo> serviceWorkFlowActivitiesInfoRepository)
|
|
|
|
|
{
|
|
|
|
|
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
|
|
|
|
|
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="info">服务流程详情</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpPost("/ServiceWorkFlowBase/Save")]
|
|
|
|
|
public async Task<TaskManageOrderResultDto> Save([FromBody] ServiceWorkFlowBaseDto info)
|
|
|
|
|
{
|
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var id = await InnerSave(info);
|
|
|
|
|
|
|
|
|
|
result.succ = true;
|
|
|
|
|
result.msg = "保存成功";
|
|
|
|
|
result.ext = id;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.succ = false;
|
|
|
|
|
result.msg = $"保存服务项目异常,原因:{ex.Message}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 保存内部方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存内部方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="info">服务项目详情</param>
|
|
|
|
|
/// <param name="isSetEnable">是否启用</param>
|
|
|
|
|
/// <returns>返回派车Id</returns>
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
private async Task<string> InnerSave(StatusSkuBaseDto info, bool isSetEnable = false)
|
|
|
|
|
{
|
|
|
|
|
StatusSkuBaseInfo entity = info.Adapt<StatusSkuBaseInfo>();
|
|
|
|
|
|
|
|
|
|
if (isSetEnable)
|
|
|
|
|
{
|
|
|
|
|
entity.IS_ENABLE = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (entity == null)
|
|
|
|
|
throw Oops.Oh($"服务项目不能为空", typeof(InvalidOperationException));
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"服务项目保存 JSON={JSON.Serialize(entity)} user={UserManager.UserId}");
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(entity.PK_ID))
|
|
|
|
|
{
|
|
|
|
|
_statusSkuBaseInfoRepository.Insert(entity);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var model = InnerGetInfo(entity.PK_ID);
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"更新状态前,获取原始记录 JSON={JSON.Serialize(model)}");
|
|
|
|
|
|
|
|
|
|
if (!entity.STATUS_SKU_CODE.Equals(model.STATUS_SKU_CODE, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
ValidateServiceProject(entity, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
entity.UpdatedTime = DateTime.Now;
|
|
|
|
|
entity.UpdatedUserId = UserManager.UserId;
|
|
|
|
|
entity.UpdatedUserName = UserManager.Name;
|
|
|
|
|
|
|
|
|
|
await _statusSkuBaseInfoRepository.AsUpdateable(entity).IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.TenantId,
|
|
|
|
|
it.TenantName,
|
|
|
|
|
it.CreatedTime,
|
|
|
|
|
it.CreatedUserId,
|
|
|
|
|
it.CreatedUserName,
|
|
|
|
|
it.IsDeleted,
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return entity.PK_ID;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 单票查询
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 单票查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkId">状态主键</param>
|
|
|
|
|
private StatusSkuBaseInfo InnerGetInfo(string pkId)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(pkId))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Oh($"状态主键不能为空", typeof(InvalidOperationException));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var model = _statusSkuBaseInfoRepository.AsQueryable().First(a => a.PK_ID == pkId);
|
|
|
|
|
|
|
|
|
|
if (model == null)
|
|
|
|
|
throw Oops.Oh($"状态获取失败,状态信息不存在或已作废", typeof(InvalidOperationException));
|
|
|
|
|
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存并启用
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="info">服务流程详情</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SaveAndEnable(ServiceWorkFlowBaseDto info)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 启用
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkId">服务流程主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SetEnable(string pkId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 取消启用
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkId">服务流程主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SetUnEnable(string pkId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkId">服务流程主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> Delete(string pkId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 复制
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkId">服务流程主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> Copy(string pkId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取服务流程详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkId">服务流程主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> GetInfo(string pkId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 检索服务流程列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="queryItem">检索值</param>
|
|
|
|
|
/// <param name="topNum">最大返回行数(默认15)</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> QueryList(string queryItem, int topNum = 15)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 服务流程台账查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="QuerySearch">服务流程台账查询请求</param>
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
public async Task<SqlSugarPagedList<ServiceWorkFlowBasePageDto>> GetPageAsync(QueryServiceWorkFlowBaseDto QuerySearch)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发布服务流程
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkId">服务流程主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> PublishRelease(string pkId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取展示服务流程时间轴列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkId">服务流程主键</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
public async Task<TaskManageOrderResultDto> GetShowTimeLine(string pkId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
}
|