|
|
@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
using Furion.DependencyInjection;
|
|
|
|
|
|
|
|
using Furion.DynamicApiController;
|
|
|
|
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
|
|
|
using Mapster;
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
using Myshipping.Application.Entity;
|
|
|
|
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
|
|
|
|
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 = "StatusTriggerBase", Order = 20)]
|
|
|
|
|
|
|
|
public class StatusTriggerBaseService: IStatusTriggerBaseService, IDynamicApiController, ITransient
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<StatusTriggerBaseInfo> _statusTriggerBaseInfoRepository;
|
|
|
|
|
|
|
|
private readonly SqlSugarRepository<StatusTriggerConditionInfo> _statusTriggerConditionInfoRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly ILogger<StatusTriggerBaseService> _logger;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public StatusTriggerBaseService(SqlSugarRepository<StatusTriggerBaseInfo> statusTriggerBaseInfoRepository,
|
|
|
|
|
|
|
|
SqlSugarRepository<StatusTriggerConditionInfo> statusTriggerConditionInfoRepository,
|
|
|
|
|
|
|
|
ILogger<StatusTriggerBaseService> logger)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_statusTriggerBaseInfoRepository = statusTriggerBaseInfoRepository;
|
|
|
|
|
|
|
|
_statusTriggerConditionInfoRepository = statusTriggerConditionInfoRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger = logger;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 保存
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="info">状态触发器详情</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> Save(StatusTriggerBaseDto 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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 保存并启用
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="info">状态触发器详情</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SaveAndEnable(StatusTriggerBaseDto 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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 启用
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="pkIds">状态触发器主键数组</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SetEnable(string[] pkIds)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 取消启用
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="pkIds">状态触发器主键数组</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> SetUnEnable(string[] pkIds)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 删除
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="pkIds">状态触发器主键数组</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> Delete(string[] pkIds)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取状态触发器详情
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="pkId">状态触发器主键</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> GetInfo(string pkId)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 检索状态触发器列表
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="queryItem">检索值</param>
|
|
|
|
|
|
|
|
/// <param name="topNum">最大返回行数(默认15)</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> QueryList(string queryItem, int topNum = 15)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 状态触发器台账查询
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="QuerySearch">状态触发器台账查询请求</param>
|
|
|
|
|
|
|
|
/// <returns>返回结果</returns>
|
|
|
|
|
|
|
|
public async Task<SqlSugarPagedList<StatusTriggerBasePageDto>> GetPageAsync(QueryStatusTriggerBaseDto QuerySearch)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//制单日期
|
|
|
|
|
|
|
|
DateTime createBegin = DateTime.MinValue;
|
|
|
|
|
|
|
|
DateTime createEnd = DateTime.MinValue;
|
|
|
|
|
|
|
|
//更新日期
|
|
|
|
|
|
|
|
DateTime updateBegin = DateTime.MinValue;
|
|
|
|
|
|
|
|
DateTime updateEnd = DateTime.MinValue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//制单日期
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.CreateBegin))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.CreateBegin, out createBegin))
|
|
|
|
|
|
|
|
throw Oops.Oh($"创建起始日期格式错误,{QuerySearch.CreateBegin}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.CreateEnd))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.CreateEnd, out createEnd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"创建结束日期格式错误,{QuerySearch.CreateEnd}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createEnd = createEnd.AddDays(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新日期
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.UpdateBegin))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.UpdateBegin, out updateBegin))
|
|
|
|
|
|
|
|
throw Oops.Oh($"更新起始日期格式错误,{QuerySearch.UpdateBegin}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.UpdateEnd))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!DateTime.TryParse(QuerySearch.UpdateEnd, out updateEnd))
|
|
|
|
|
|
|
|
throw Oops.Oh($"更新结束日期格式错误,{QuerySearch.UpdateEnd}");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateEnd = updateEnd.AddDays(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string entityOrderCol = "CreatedTime";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//这里因为返回给前端的台账数据是DTO,所以这里排序时候需要转换成Entity对应的字段
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
|
|
|
|
|
|
|
|
entityOrderCol = MapsterExtHelper.GetAdaptProperty<StatusTriggerBasePageDto, StatusTriggerBaseInfo>(QuerySearch.SortField);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entities = await _statusTriggerBaseInfoRepository.AsQueryable()
|
|
|
|
|
|
|
|
.WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime >= createBegin)
|
|
|
|
|
|
|
|
.WhereIF(createEnd != DateTime.MinValue, t => t.CreatedTime < createEnd)
|
|
|
|
|
|
|
|
.WhereIF(updateBegin != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value >= updateBegin)
|
|
|
|
|
|
|
|
.WhereIF(updateEnd != DateTime.MinValue, t => t.UpdatedTime.HasValue && t.UpdatedTime.Value < updateEnd)
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.IsEnable) && QuerySearch.IsEnable == "1", t => t.IS_ENABLE == 1)
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.IsEnable) && QuerySearch.IsEnable == "2", t => t.IS_ENABLE == 0)
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.StatusTriggerName), t => t.STATUS_TRIGGER_NAME.Contains(QuerySearch.StatusTriggerName) ||
|
|
|
|
|
|
|
|
t.STATUS_TRIGGER_CODE.Contains(QuerySearch.StatusTriggerName))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.StatusTriggerNote), t => t.STATUS_TRIGGER_NOTE.Contains(QuerySearch.StatusTriggerNote))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.CreateUser), t => t.CreatedUserName.Contains(QuerySearch.CreateUser))
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(QuerySearch.UpdateUser), t => t.UpdatedUserName.Contains(QuerySearch.UpdateUser))
|
|
|
|
|
|
|
|
.OrderBy(entityOrderCol + (QuerySearch.descSort ? " asc " : " desc "))
|
|
|
|
|
|
|
|
.ToPagedListAsync(QuerySearch.PageNo, QuerySearch.PageSize);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return entities.Adapt<SqlSugarPagedList<StatusTriggerBasePageDto>>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取状态触发器操作类型列表
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> GetTriggerOperTypeList()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 生成LIQUID表达式
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="info">状态触发器条件详情</param>
|
|
|
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
|
|
|
public async Task<TaskManageOrderResultDto> CreateLiquidExpression(StatusTriggerConditionDto 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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|