wet 1 year ago
commit eba2086eed

@ -35,6 +35,11 @@ namespace Myshipping.Application.Entity
/// </summary>
public string STATUS_TRIGGER_NAME { get; set; }
/// <summary>
/// 触发器说明
/// </summary>
public string STATUS_TRIGGER_NOTE { get; set; }
/// <summary>
/// 是否启用
/// </summary>

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 状态触发器操作类型枚举
/// </summary>
public enum StatusTriggerOperTypeEnum
{
/// <summary>
/// 等于
/// </summary>
[Description("等于")]
EQUALS,
/// <summary>
/// 不等于
/// </summary>
[Description("不等于")]
DOES_NOT_EQUAL,
/// <summary>
/// 大于
/// </summary>
[Description("大于")]
GREATER_THAN,
/// <summary>
/// 大于等于
/// </summary>
[Description("大于等于")]
GREATER_THEN_EQUAL,
/// <summary>
/// 小于
/// </summary>
[Description("小于")]
LESS_THAN,
/// <summary>
/// 小于等于
/// </summary>
[Description("小于等于")]
LESS_THAN_EQUAL,
/// <summary>
/// 或者
/// </summary>
[Description("或者")]
LOGICAL_OR,
/// <summary>
/// 并且
/// </summary>
[Description("并且")]
LOGICAL_AND,
/// <summary>
/// 第N天后
/// </summary>
[Description("第N天后")]
DATE_NEXT_DAY
}
}

@ -6,7 +6,59 @@ using System.Threading.Tasks;
namespace Myshipping.Application
{
internal class QueryStatusTriggerBaseDto
/// <summary>
/// 触发器查询条件
/// </summary>
public class QueryStatusTriggerBaseDto : QueryTaskManageBaseDto
{
/// <summary>
/// 创建日期起始
/// </summary>
/// <example></example>
public string CreateBegin { get; set; }
/// <summary>
/// 创建日期结束
/// </summary>
/// <example></example>
public string CreateEnd { get; set; }
/// <summary>
/// 更新日期起始
/// </summary>
/// <example></example>
public string UpdateBegin { get; set; }
/// <summary>
/// 更新日期结束
/// </summary>
/// <example></example>
public string UpdateEnd { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string CreateUser { get; set; }
/// <summary>
/// 更新人
/// </summary>
public string UpdateUser { get; set; }
/// <summary>
/// 是否启用 1-已启用 2-未启用
/// </summary>
/// <example></example>
public string IsEnable { get; set; }
/// <summary>
/// 触发器名称
/// </summary>
public string StatusTriggerName { get; set; }
/// <summary>
/// 触发器说明
/// </summary>
public string StatusTriggerNote { get; set; }
}
}

@ -26,6 +26,11 @@ namespace Myshipping.Application
/// </summary>
public string StatusTriggerName { get; set; }
/// <summary>
/// 触发器说明
/// </summary>
public string StatusTriggerNote { get; set; }
/// <summary>
/// 触发条件
/// </summary>

@ -10,7 +10,7 @@ namespace Myshipping.Application
/// <summary>
/// 状态触发器
/// </summary>
internal interface IStatusTriggerBaseService
public interface IStatusTriggerBaseService
{
/// <summary>
/// 保存
@ -29,23 +29,23 @@ namespace Myshipping.Application
/// <summary>
/// 启用
/// </summary>
/// <param name="pkId">状态触发器主键</param>
/// <param name="pkIds">状态触发器主键数组</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SetEnable(string pkId);
Task<TaskManageOrderResultDto> SetEnable(string[] pkIds);
/// <summary>
/// 取消启用
/// </summary>
/// <param name="pkId">状态触发器主键</param>
/// <param name="pkIds">状态触发器主键数组</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SetUnEnable(string pkId);
Task<TaskManageOrderResultDto> SetUnEnable(string[] pkIds);
/// <summary>
/// 删除
/// </summary>
/// <param name="pkId">状态触发器主键</param>
/// <param name="pkIds">状态触发器主键数组</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> Delete(string pkId);
Task<TaskManageOrderResultDto> Delete(string[] pkIds);
/// <summary>
/// 获取状态触发器详情
@ -69,5 +69,17 @@ namespace Myshipping.Application
/// <returns>返回结果</returns>
Task<SqlSugarPagedList<StatusTriggerBasePageDto>> GetPageAsync(QueryStatusTriggerBaseDto QuerySearch);
/// <summary>
/// 获取状态触发器操作类型列表
/// </summary>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetTriggerOperTypeList();
/// <summary>
/// 生成LIQUID表达式
/// </summary>
/// <param name="info">状态触发器条件详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CreateLiquidExpression(StatusTriggerConditionDto info);
}
}

@ -612,7 +612,7 @@ namespace Myshipping.Application
//这里因为返回给前端的台账数据是DTO所以这里排序时候需要转换成Entity对应的字段
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
entityOrderCol = MapsterExtHelper.GetAdaptProperty<BookingTruckDto, BookingTruck>(QuerySearch.SortField);
entityOrderCol = MapsterExtHelper.GetAdaptProperty<ServiceProjectBasePageDto, ServiceProjectBaseInfo>(QuerySearch.SortField);
var entities = await _serviceProjectBaseInfoRepository.AsQueryable()
.WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime >= createBegin)

@ -613,7 +613,7 @@ namespace Myshipping.Application
//这里因为返回给前端的台账数据是DTO所以这里排序时候需要转换成Entity对应的字段
if (!string.IsNullOrWhiteSpace(QuerySearch.SortField))
entityOrderCol = MapsterExtHelper.GetAdaptProperty<BookingTruckDto, BookingTruck>(QuerySearch.SortField);
entityOrderCol = MapsterExtHelper.GetAdaptProperty<StatusSkuBasePageDto, StatusSkuBaseInfo>(QuerySearch.SortField);
var entities = await _statusSkuBaseInfoRepository.AsQueryable()
.WhereIF(createBegin != DateTime.MinValue, t => t.CreatedTime >= createBegin)

@ -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;
}
}
}
Loading…
Cancel
Save