Merge branch 'master' of http://60.209.125.238:20010/chenjingyong/ds8-solution-pro
commit
697609c5c9
@ -0,0 +1,81 @@
|
||||
using System.Diagnostics;
|
||||
using System.Security.Claims;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.Log;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NetTaste;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Parser = UAParser.Parser;
|
||||
|
||||
namespace DS.Module.Core.Filters;
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志 过滤器
|
||||
/// </summary>
|
||||
public class OperationLogFilter: IAsyncActionFilter
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly SqlSugarScope db;
|
||||
public OperationLogFilter(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = (SqlSugarScope)_serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
}
|
||||
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||
{
|
||||
var httpContext = context.HttpContext;
|
||||
var httpRequest = httpContext.Request;
|
||||
|
||||
var sw = new Stopwatch();
|
||||
sw.Start();
|
||||
var actionContext = await next();
|
||||
sw.Stop();
|
||||
|
||||
var sw2 = Stopwatch.StartNew();
|
||||
|
||||
//判断是否请求成功(没有异常就是请求成功)
|
||||
var isRequestSucceed = actionContext.Exception == null;
|
||||
var headers = httpRequest.Headers;
|
||||
var clientInfo = headers.ContainsKey("User-Agent") ? Parser.GetDefault().Parse(headers["User-Agent"]) : null;
|
||||
var actionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;
|
||||
var isWriteLog = false;
|
||||
|
||||
//请求异常时记录日志
|
||||
if (!isRequestSucceed || AppSetting.app("Middleware", "RecordAccessLogs", "Enabled").ObjToBool())
|
||||
{
|
||||
isWriteLog = true;
|
||||
}
|
||||
|
||||
var res = actionContext.Result?.GetType() == typeof(DataResult) ? actionContext.Result.ToJsonString() : "";
|
||||
if (isWriteLog)
|
||||
{
|
||||
var log = new SysLogOperation()
|
||||
{
|
||||
// Name = context.User?.FindFirstValue(ClaimConst.CLAINM_NAME),
|
||||
Ip = HttpUtil.GetClientIP(httpContext),
|
||||
Success = isRequestSucceed ? true : false,
|
||||
Location = HttpUtil.GetRequestUrlAddress(httpRequest),
|
||||
Browser = clientInfo?.UA.Family + clientInfo?.UA.Major,
|
||||
Os = clientInfo?.OS.Family + clientInfo?.OS.Major,
|
||||
Url = httpRequest.Path,
|
||||
ClassName = context.Controller.ToString(),
|
||||
MethodName = actionDescriptor?.ActionName,
|
||||
ReqMethod = httpRequest.Method,
|
||||
Param = context.ActionArguments.Count < 1 ? "" : context.ActionArguments.ToJsonString(),
|
||||
Result = actionContext.Result.ToJsonString(),
|
||||
ElapsedTime = sw.ElapsedMilliseconds,
|
||||
OpTime = DateTime.Now,
|
||||
};
|
||||
|
||||
await db.GetConnection(1288018625843826680).Insertable(log).ExecuteCommandAsync();
|
||||
httpContext.Response.Headers["CheckTimeActionExecute"] = sw.ElapsedMilliseconds.ToString();
|
||||
|
||||
sw2.Stop();
|
||||
httpContext.Response.Headers["CheckTimeRequestActionFilter"] = sw2.ElapsedMilliseconds.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
using System.Text;
|
||||
using DS.Module.Core.Extensions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace DS.Module.Core;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class HttpUtil
|
||||
{
|
||||
public static string GetClientIP(HttpContext context)
|
||||
{
|
||||
var ip = context.Request.Headers["X-Forwarded-For"].ObjToString();
|
||||
if (string.IsNullOrEmpty(ip))
|
||||
{
|
||||
ip = context.Connection.RemoteIpAddress.ObjToString();
|
||||
}
|
||||
|
||||
return ip;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取响应内容
|
||||
/// </summary>
|
||||
/// <param name="response"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<string> GetResponse(HttpResponse response)
|
||||
{
|
||||
response.Body.Seek(0, SeekOrigin.Begin);
|
||||
var text = await new StreamReader(response.Body).ReadToEndAsync();
|
||||
response.Body.Seek(0, SeekOrigin.Begin);
|
||||
return text;
|
||||
}
|
||||
|
||||
//
|
||||
// 摘要:
|
||||
// 获取完整请求地址
|
||||
//
|
||||
// 参数:
|
||||
// request:
|
||||
public static string GetRequestUrlAddress(HttpRequest request)
|
||||
{
|
||||
return new StringBuilder().Append(request.Scheme).Append("://").Append(request.Host)
|
||||
.Append(request.PathBase)
|
||||
.Append(request.Path)
|
||||
.Append(request.QueryString)
|
||||
.ToString();
|
||||
}
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
using System.Diagnostics;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.Log;
|
||||
using DS.Module.UserModule;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NetTaste;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using UAParser;
|
||||
using Parser = UAParser.Parser;
|
||||
|
||||
namespace DS.Module.Middleware;
|
||||
|
||||
/// <summary>
|
||||
/// 中间件
|
||||
/// 记录用户方访问数据
|
||||
/// </summary>
|
||||
public class OperationLogMiddleware
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
private Stopwatch _stopwatch;
|
||||
private readonly IUser user;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly SqlSugarScope db;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="next"></param>
|
||||
public OperationLogMiddleware(RequestDelegate next, IServiceProvider serviceProvider)
|
||||
{
|
||||
_next = next;
|
||||
|
||||
_stopwatch = new Stopwatch();
|
||||
_serviceProvider = serviceProvider;
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
db = (SqlSugarScope)_serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
if (AppSetting.app("Middleware", "RecordAccessLogs", "Enabled").ObjToBool())
|
||||
{
|
||||
var api = context.Request.Path.ObjToString().TrimEnd('/').ToLower();
|
||||
if (context.Request.Path.HasValue
|
||||
&&
|
||||
(
|
||||
context.Request.Path.Value.IndexOf("SignalR", StringComparison.InvariantCultureIgnoreCase) > -1
|
||||
|| context.Request.Path.Value.IndexOf("swagger", StringComparison.InvariantCultureIgnoreCase) > -1
|
||||
|| context.Request.Path.Value.IndexOf("HealthCheck", StringComparison.InvariantCultureIgnoreCase) >
|
||||
-1
|
||||
)
|
||||
)
|
||||
{
|
||||
await _next(context);
|
||||
}
|
||||
|
||||
var ignoreApis = AppSetting.app("Middleware", "RecordAccessLogs", "IgnoreApis");
|
||||
|
||||
// 过滤,只有接口
|
||||
if (api.Contains("api") && !ignoreApis.Contains(api))
|
||||
{
|
||||
_stopwatch.Restart();
|
||||
HttpRequest request = context.Request;
|
||||
//判断是否请求成功(没有异常就是请求成功)
|
||||
var headers = request.Headers;
|
||||
var clientInfo = headers.ContainsKey("User-Agent")
|
||||
? Parser.GetDefault().Parse(headers["User-Agent"])
|
||||
: null;
|
||||
var isWriteLog = false;
|
||||
|
||||
var log = new SysLogOperation()
|
||||
{
|
||||
// Name = context.User?.FindFirstValue(ClaimConst.CLAINM_NAME),
|
||||
Ip = GetClientIP(context),
|
||||
Location = GetRequestUrlAddress(request),
|
||||
Browser = clientInfo?.UA.Family + clientInfo?.UA.Major,
|
||||
Os = clientInfo?.OS.Family + clientInfo?.OS.Major,
|
||||
Url = request.Path,
|
||||
// ClassName = context.Controller.ToString(),
|
||||
// MethodName = actionDescriptor?.ActionName,
|
||||
ReqMethod = request.Method,
|
||||
OpTime = DateTime.Now,
|
||||
};
|
||||
|
||||
// 获取请求body内容
|
||||
if (request.Method.ToLower().Equals("post") || request.Method.ToLower().Equals("put"))
|
||||
{
|
||||
// 启用倒带功能,就可以让 Request.Body 可以再次读取
|
||||
request.EnableBuffering();
|
||||
|
||||
Stream stream = request.Body;
|
||||
byte[] buffer = new byte[request.ContentLength.Value];
|
||||
stream.Read(buffer, 0, buffer.Length);
|
||||
log.Param = Encoding.UTF8.GetString(buffer);
|
||||
|
||||
request.Body.Position = 0;
|
||||
}
|
||||
else if (request.Method.ToLower().Equals("get") || request.Method.ToLower().Equals("delete"))
|
||||
{
|
||||
log.Param =
|
||||
HttpUtility.UrlDecode(request.QueryString.ObjToString(), Encoding.UTF8);
|
||||
}
|
||||
await _next(context);
|
||||
// // 获取Response.Body内容
|
||||
// var originalBodyStream = context.Response.Body;
|
||||
//
|
||||
// using (var responseBody = new MemoryStream())
|
||||
// {
|
||||
// context.Response.Body = responseBody;
|
||||
// log.Result = await GetResponse(context.Response);
|
||||
//
|
||||
// await responseBody.CopyToAsync(originalBodyStream);
|
||||
// }
|
||||
|
||||
// 响应完成记录时间和存入日志
|
||||
context.Response.OnCompleted(() =>
|
||||
{
|
||||
_stopwatch.Stop();
|
||||
|
||||
if (context.Response.StatusCode == 200 && !context.Response.HasStarted)
|
||||
{
|
||||
log.Success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Success = false;
|
||||
}
|
||||
|
||||
log.ElapsedTime = _stopwatch.ElapsedMilliseconds;
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
await _next(context);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await _next(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetClientIP(HttpContext context)
|
||||
{
|
||||
var ip = context.Request.Headers["X-Forwarded-For"].ObjToString();
|
||||
if (string.IsNullOrEmpty(ip))
|
||||
{
|
||||
ip = context.Connection.RemoteIpAddress.ObjToString();
|
||||
}
|
||||
|
||||
return ip;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取响应内容
|
||||
/// </summary>
|
||||
/// <param name="response"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetResponse(HttpResponse response)
|
||||
{
|
||||
response.Body.Seek(0, SeekOrigin.Begin);
|
||||
var text = await new StreamReader(response.Body).ReadToEndAsync();
|
||||
response.Body.Seek(0, SeekOrigin.Begin);
|
||||
return text;
|
||||
}
|
||||
//
|
||||
// 摘要:
|
||||
// 获取完整请求地址
|
||||
//
|
||||
// 参数:
|
||||
// request:
|
||||
public static string GetRequestUrlAddress(HttpRequest request)
|
||||
{
|
||||
return new StringBuilder().Append(request.Scheme).Append("://").Append(request.Host)
|
||||
.Append(request.PathBase)
|
||||
.Append(request.Path)
|
||||
.Append(request.QueryString)
|
||||
.ToString();
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
using System.Text;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.Module.SqlSugar;
|
||||
/// <summary>
|
||||
/// sqlsuagr差异帮助类
|
||||
/// </summary>
|
||||
public static class SqlSugarDiffUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// 比较两个数据对象的修改内容
|
||||
/// </summary>
|
||||
/// <param name="beforeData"></param>
|
||||
/// <param name="afterData"></param>
|
||||
/// <returns></returns>
|
||||
public static DiffLog GetDiff(List<DiffLogTableInfo> beforeData, List<DiffLogTableInfo> afterData)
|
||||
{
|
||||
string mianID = null;
|
||||
if (beforeData != null)
|
||||
{
|
||||
var keyCoulumn = beforeData[0].Columns.FirstOrDefault(p => p.IsPrimaryKey == true);
|
||||
if (keyCoulumn != null)
|
||||
{
|
||||
mianID = keyCoulumn.Value.ToString();
|
||||
}
|
||||
}
|
||||
else if (afterData != null)
|
||||
{
|
||||
var keyCoulumn = afterData[0].Columns.FirstOrDefault(p => p.IsPrimaryKey == true);
|
||||
if (keyCoulumn != null)
|
||||
{
|
||||
mianID = keyCoulumn.Value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (beforeData != null && afterData != null)
|
||||
{
|
||||
var befroeColumns = beforeData[0].Columns;
|
||||
var afterCloums = afterData[0].Columns;
|
||||
foreach (var item in befroeColumns)
|
||||
{
|
||||
if (IgnoreColumns.Contains(item.ColumnName))
|
||||
continue;
|
||||
var afterItem = afterCloums.FirstOrDefault(p => p.ColumnName == item.ColumnName && !p.Value.Equals(item.Value));
|
||||
if (afterItem != null)
|
||||
{
|
||||
sb.Append($"[字段:{item.ColumnDescription},修改前:{item.Value},修改后:{afterItem.Value}]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new DiffLog { Id = mianID, DiffData = sb.ToString() };
|
||||
}
|
||||
public class DiffLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
/// 差异数据
|
||||
/// </summary>
|
||||
public string DiffData { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 忽略的字段
|
||||
/// </summary>
|
||||
private static readonly List<string> IgnoreColumns = new List<string>()
|
||||
{
|
||||
"CreateTime",
|
||||
"CreateBy",
|
||||
"UpdateTime",
|
||||
"UpdateBy",
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
using DS.WMS.Core.Code.Interface;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DS.WMS.AdminApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 付费方式服务
|
||||
/// </summary>
|
||||
public class CodeFrtController : ApiController
|
||||
{
|
||||
private readonly ICodeFrtService _invokeService;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="invokeService"></param>
|
||||
public CodeFrtController(ICodeFrtService invokeService)
|
||||
{
|
||||
_invokeService = invokeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("GetCodeFrtList")]
|
||||
public DataResult<List<CodeFrtRes>> GetCodeFrtList([FromBody] PageRequest request)
|
||||
{
|
||||
var res = _invokeService.GetListByPage(request);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("EditCodeFrt")]
|
||||
public DataResult EditCodeFrt([FromBody] CodeFrtReq model)
|
||||
{
|
||||
var res = _invokeService.EditCodeFrt(model);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetCodeFrtInfo")]
|
||||
public DataResult<CodeFrtRes> GetCodeFrtInfo([FromQuery] string id)
|
||||
{
|
||||
var res = _invokeService.GetCodeFrtInfo(id);
|
||||
return res;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
using DS.WMS.Core.Code.Interface;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace DS.WMS.AdminApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 结算方式服务
|
||||
/// </summary>
|
||||
public class CodeStlModeController : ApiController
|
||||
{
|
||||
private readonly ICodeStlModeService _invokeService;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="invokeService"></param>
|
||||
public CodeStlModeController(ICodeStlModeService invokeService)
|
||||
{
|
||||
_invokeService = invokeService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("GetCodeStlModeList")]
|
||||
public DataResult<List<CodeStlModeRes>> GetCodeStlModeList([FromBody] PageRequest request)
|
||||
{
|
||||
var res = _invokeService.GetListByPage(request);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("EditCodeStlMode")]
|
||||
public DataResult EditCodeStlMode([FromBody] CodeStlModeReq model)
|
||||
{
|
||||
var res = _invokeService.EditCodeStlMode(model);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetCodeStlModeInfo")]
|
||||
public DataResult<CodeStlModeRes> GetCodeStlModeInfo([FromQuery] string id)
|
||||
{
|
||||
var res = _invokeService.GetCodeStlModeInfo(id);
|
||||
return res;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
using DS.Module.Core;
|
||||
using FluentValidation;
|
||||
|
||||
namespace DS.WMS.Core.Code.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 付费方式请求实体
|
||||
/// </summary>
|
||||
public class CodeFrtReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 付费方式-英文名称
|
||||
/// </summary>
|
||||
public string FrtName { get; set; }= "";
|
||||
/// <summary>
|
||||
/// 中文名称
|
||||
/// </summary>
|
||||
public string CnName { get; set; }= "";
|
||||
|
||||
/// <summary>
|
||||
/// EDI代码
|
||||
/// </summary>
|
||||
public string EdiCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证
|
||||
/// </summary>
|
||||
public class CodeFrtReqValidator : AbstractValidator<CodeFrtReq>
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public CodeFrtReqValidator()
|
||||
{
|
||||
this.RuleFor(o => o.FrtName)
|
||||
.NotEmpty().WithName("付费方式-英文名称");
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.Code.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 结算方式信息返回
|
||||
/// </summary>
|
||||
public class CodeVesselRes
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 付费方式-英文名称
|
||||
/// </summary>
|
||||
public string FrtName { get; set; }
|
||||
/// <summary>
|
||||
/// 中文名称
|
||||
/// </summary>
|
||||
public string CnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// EDI代码
|
||||
/// </summary>
|
||||
public string EdiCode { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
using DS.Module.Core;
|
||||
using FluentValidation;
|
||||
|
||||
namespace DS.WMS.Core.Code.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 结算方式请求实体
|
||||
/// </summary>
|
||||
public class CodeStlModeReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 结算方式唯一代码
|
||||
/// </summary>
|
||||
public string StlCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 结算方式名称
|
||||
/// </summary>
|
||||
public string StlName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
public string EnName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 财务软件代码
|
||||
/// </summary>
|
||||
public string FinanceSoftCode { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证
|
||||
/// </summary>
|
||||
public class CodeStlModeReqValidator : AbstractValidator<CodeStlModeReq>
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public CodeStlModeReqValidator()
|
||||
{
|
||||
this.RuleFor(o => o.StlCode)
|
||||
.NotEmpty().WithName("结算方式唯一代码");
|
||||
this.RuleFor(o => o.StlName)
|
||||
.NotEmpty().WithName("结算方式名称");
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.Code.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 结算方式返回
|
||||
/// </summary>
|
||||
public class CodeStlModeRes
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 结算方式唯一代码
|
||||
/// </summary>
|
||||
public string StlCode { get; set; }
|
||||
/// <summary>
|
||||
/// 结算方式名称
|
||||
/// </summary>
|
||||
public string StlName { get; set; }
|
||||
/// <summary>
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
public string EnName { get; set; }
|
||||
/// <summary>
|
||||
/// 财务软件代码
|
||||
/// </summary>
|
||||
public string FinanceSoftCode { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Entity;
|
||||
/// <summary>
|
||||
/// 付费方式表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("op_code_frt","付费方式表")]
|
||||
public class CodeFrt: BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 付费方式-英文名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "付费方式-英文名称", Length = 100)]
|
||||
public string FrtName { get; set; }
|
||||
/// <summary>
|
||||
/// 中文名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "中文名称", Length = 50)]
|
||||
public string CnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// EDI代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "EDI代码", Length = 5)]
|
||||
public string EdiCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0启用 1禁用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Entity;
|
||||
/// <summary>
|
||||
/// 结算方式表
|
||||
/// </summary>
|
||||
// ReSharper disable once StringLiteralTypo
|
||||
[SqlSugar.SugarTable("op_code_stlmode","结算方式表")]
|
||||
public class CodeStlMode: BaseModel<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 结算方式唯一代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "结算方式唯一代码", Length = 10)]
|
||||
public string StlCode { get; set; }
|
||||
/// <summary>
|
||||
/// 结算方式名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "结算方式名称", Length = 30)]
|
||||
public string StlName { get; set; }
|
||||
/// <summary>
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "英文名称", Length = 100)]
|
||||
public string EnName { get; set; }
|
||||
/// <summary>
|
||||
/// 财务软件代码
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "财务软件代码", Length = 30)]
|
||||
public string FinanceSoftCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0启用 1禁用
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
|
||||
namespace DS.WMS.Core.Code.Interface;
|
||||
|
||||
public interface ICodeFrtService
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<CodeFrtRes>> GetListByPage(PageRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditCodeFrt(CodeFrtReq req);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<CodeFrtRes> GetCodeFrtInfo(string id);
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<CodeFrtRes>> GetClientListByPage(PageRequest request);
|
||||
/// <summary>
|
||||
/// 编辑-客户端
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditClientCodeFrt(CodeFrtReq req);
|
||||
/// <summary>
|
||||
/// 获取详情 -客户端
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult<CodeFrtRes> GetClientCodeFrtInfo(string id);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取付费方式列表-基础库
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<CodeFrtRes>> GetCodeFrtList(PageRequest request);
|
||||
/// <summary>
|
||||
/// 导入付费方式列表
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
DataResult ImportCodeFrt(IdModel req);
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前租户已有的付费方式
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DataResult<List<string>> GetExistCodeFrtList();
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
|
||||
namespace DS.WMS.Core.Code.Interface;
|
||||
|
||||
public interface ICodeStlModeService
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<CodeStlModeRes>> GetListByPage(PageRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditCodeStlMode(CodeStlModeReq req);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<CodeStlModeRes> GetCodeStlModeInfo(string id);
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<CodeStlModeRes>> GetClientListByPage(PageRequest request);
|
||||
/// <summary>
|
||||
/// 编辑-客户端
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditClientCodeStlMode(CodeStlModeReq req);
|
||||
/// <summary>
|
||||
/// 获取详情 -客户端
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult<CodeStlModeRes> GetClientCodeStlModeInfo(string id);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取结算方式列表-基础库
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<CodeStlModeRes>> GetCodeStlModeList(PageRequest request);
|
||||
/// <summary>
|
||||
/// 导入结算方式列表
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
DataResult ImportCodeStlMode(IdModel req);
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前租户已有的结算方式
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DataResult<List<string>> GetExistCodeStlModeList();
|
||||
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
using DS.WMS.Core.Code.Entity;
|
||||
using DS.WMS.Core.Code.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Method;
|
||||
|
||||
public class CodeFrtService:ICodeFrtService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ISaasDbService saasService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public CodeFrtService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
||||
}
|
||||
|
||||
public DataResult<List<CodeFrtRes>> GetListByPage(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<CodeFrt>()
|
||||
.Where(whereList)
|
||||
.Select<CodeFrtRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult EditCodeFrt(CodeFrtReq req)
|
||||
{
|
||||
if (req.Id == 0)
|
||||
{
|
||||
|
||||
if (db.Queryable<CodeFrt>().Where(x=>x.FrtName == req.FrtName.Trim()).Any())
|
||||
{
|
||||
return DataResult.Failed("付费方式已存在!",MultiLanguageConst.CodeFrtExist);
|
||||
}
|
||||
|
||||
var data = req.Adapt<CodeFrt>();
|
||||
|
||||
var entity = db.Insertable(data).ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = db.Queryable<CodeFrt>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
public DataResult<CodeFrtRes> GetCodeFrtInfo(string id)
|
||||
{
|
||||
var data = db.Queryable<CodeFrt>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<CodeFrtRes>()
|
||||
.First();
|
||||
return DataResult<CodeFrtRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
|
||||
public DataResult<List<CodeFrtRes>> GetClientListByPage(PageRequest request)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = tenantDb.Queryable<CodeFrt>()
|
||||
.Where(whereList)
|
||||
.Select<CodeFrtRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult EditClientCodeFrt(CodeFrtReq req)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
if (req.Id == 0)
|
||||
{
|
||||
|
||||
if (tenantDb.Queryable<CodeFrt>().Where(x=>x.FrtName == req.FrtName.Trim()).Any())
|
||||
{
|
||||
return DataResult.Failed("付费方式已存在!",MultiLanguageConst.CodeFrtExist);
|
||||
}
|
||||
|
||||
var data = req.Adapt<CodeFrt>();
|
||||
|
||||
var entity = tenantDb.Insertable(data).EnableDiffLogEvent().ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = tenantDb.Queryable<CodeFrt>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
public DataResult<CodeFrtRes> GetClientCodeFrtInfo(string id)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
var data = tenantDb.Queryable<CodeFrt>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<CodeFrtRes>()
|
||||
.First();
|
||||
return DataResult<CodeFrtRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
|
||||
public DataResult<List<CodeFrtRes>> GetCodeFrtList(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<CodeFrt>().Where(a=>a.Status == StatusEnum.Enable)
|
||||
.Where(whereList)
|
||||
.Select<CodeFrtRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult ImportCodeFrt(IdModel req)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
var list = db.Queryable<CodeFrt>().Where(x =>req.Ids.Contains(x.Id) ).ToList();
|
||||
if (list.Count == 0)
|
||||
{
|
||||
return DataResult.Failed("付费方式导入无数据!",MultiLanguageConst.CodeFrtImportNoData);
|
||||
}
|
||||
|
||||
if (tenantDb.Queryable<CodeFrt>().Where(x =>req.Ids.Contains(x.Id) ).Any())
|
||||
{
|
||||
return DataResult.Failed("存在已导入的付费方式!",MultiLanguageConst.CodeFrtImportAlready);
|
||||
}
|
||||
|
||||
tenantDb.Insertable(list).ExecuteCommand();
|
||||
return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前租户已有的船名
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DataResult<List<string>> GetExistCodeFrtList()
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
var data = tenantDb.Queryable<CodeFrt>()
|
||||
.Select(n=>n.Id.ToString())
|
||||
.ToList();
|
||||
return DataResult<List<string>>.Success(data);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Data;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.Code.Dtos;
|
||||
using DS.WMS.Core.Code.Entity;
|
||||
using DS.WMS.Core.Code.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Code.Method;
|
||||
|
||||
public class CodeStlModeService:ICodeStlModeService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ISaasDbService saasService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public CodeStlModeService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
||||
}
|
||||
|
||||
public DataResult<List<CodeStlModeRes>> GetListByPage(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<CodeStlMode>()
|
||||
.Where(whereList)
|
||||
.Select<CodeStlModeRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult EditCodeStlMode(CodeStlModeReq req)
|
||||
{
|
||||
if (req.Id == 0)
|
||||
{
|
||||
|
||||
if (db.Queryable<CodeStlMode>().Where(x=>x.StlCode == req.StlCode.Trim()).Any())
|
||||
{
|
||||
return DataResult.Failed("结算方式已存在!",MultiLanguageConst.CodeStlModeExist);
|
||||
}
|
||||
|
||||
var data = req.Adapt<CodeStlMode>();
|
||||
|
||||
var entity = db.Insertable(data).ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = db.Queryable<CodeStlMode>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
public DataResult<CodeStlModeRes> GetCodeStlModeInfo(string id)
|
||||
{
|
||||
var data = db.Queryable<CodeStlMode>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<CodeStlModeRes>()
|
||||
.First();
|
||||
return DataResult<CodeStlModeRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
|
||||
public DataResult<List<CodeStlModeRes>> GetClientListByPage(PageRequest request)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = tenantDb.Queryable<CodeStlMode>()
|
||||
.Where(whereList)
|
||||
.Select<CodeStlModeRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult EditClientCodeStlMode(CodeStlModeReq req)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
if (req.Id == 0)
|
||||
{
|
||||
|
||||
if (tenantDb.Queryable<CodeStlMode>().Where(x=>x.StlCode == req.StlCode.Trim()).Any())
|
||||
{
|
||||
return DataResult.Failed("结算方式已存在!",MultiLanguageConst.CodeStlModeExist);
|
||||
}
|
||||
|
||||
var data = req.Adapt<CodeStlMode>();
|
||||
|
||||
var entity = tenantDb.Insertable(data).EnableDiffLogEvent().ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = tenantDb.Queryable<CodeStlMode>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
|
||||
public DataResult<CodeStlModeRes> GetClientCodeStlModeInfo(string id)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
var data = tenantDb.Queryable<CodeStlMode>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<CodeStlModeRes>()
|
||||
.First();
|
||||
return DataResult<CodeStlModeRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
|
||||
public DataResult<List<CodeStlModeRes>> GetCodeStlModeList(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<CodeStlMode>().Where(a=>a.Status == StatusEnum.Enable)
|
||||
.Where(whereList)
|
||||
.Select<CodeStlModeRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult ImportCodeStlMode(IdModel req)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
var list = db.Queryable<CodeStlMode>().Where(x =>req.Ids.Contains(x.Id) ).ToList();
|
||||
if (list.Count == 0)
|
||||
{
|
||||
return DataResult.Failed("结算方式导入无数据!",MultiLanguageConst.CodeStlModeImportNoData);
|
||||
}
|
||||
|
||||
if (tenantDb.Queryable<CodeStlMode>().Where(x =>req.Ids.Contains(x.Id) ).Any())
|
||||
{
|
||||
return DataResult.Failed("存在已导入的结算方式!",MultiLanguageConst.CodeStlModeImportAlready);
|
||||
}
|
||||
|
||||
tenantDb.Insertable(list).ExecuteCommand();
|
||||
return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前租户已有的船名
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DataResult<List<string>> GetExistCodeStlModeList()
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
||||
var data = tenantDb.Queryable<CodeStlMode>()
|
||||
.Select(n=>n.Id.ToString())
|
||||
.ToList();
|
||||
return DataResult<List<string>>.Success(data);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 审计日志返回实体
|
||||
/// </summary>
|
||||
public class AuditLogRes
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 业务id
|
||||
/// </summary>
|
||||
public long KeyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sql语句
|
||||
/// </summary>
|
||||
public string Sql { get; set; }
|
||||
/// <summary>
|
||||
/// 请求参数
|
||||
/// </summary>
|
||||
public string Param { get; set; }
|
||||
/// <summary>
|
||||
/// 旧值
|
||||
/// </summary>
|
||||
public string OldValue { get; set; }
|
||||
/// <summary>
|
||||
/// 新值
|
||||
/// </summary>
|
||||
public string NewValue { get; set; }
|
||||
/// <summary>
|
||||
/// 业务数据
|
||||
/// </summary>
|
||||
public string AopData { get; set; }
|
||||
/// <summary>
|
||||
/// 差异数据
|
||||
/// </summary>
|
||||
public string DiffData { get; set; }
|
||||
/// <summary>
|
||||
/// 操作方式:新增、更新、删除
|
||||
/// </summary>
|
||||
|
||||
public string OperateType { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 租户id
|
||||
/// </summary>
|
||||
public long TenantId { get; set; }
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 异常日志返回实体
|
||||
/// </summary>
|
||||
public class ExceptionLogRes
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类名称
|
||||
/// </summary>
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 方法名称
|
||||
/// </summary>
|
||||
public string MethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常名称
|
||||
/// </summary>
|
||||
public string ExceptionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常信息
|
||||
/// </summary>
|
||||
public string ExceptionMsg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常源
|
||||
/// </summary>
|
||||
public string ExceptionSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 堆栈信息
|
||||
/// </summary>
|
||||
public string StackTrace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数对象
|
||||
/// </summary>
|
||||
public string ParamsObj { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
public string CreateBy { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 租户id
|
||||
/// </summary>
|
||||
public long? TenantId { get; set; }
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 租户表单设置请求实体
|
||||
/// </summary>
|
||||
public class FormSetReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 权限Id
|
||||
/// </summary>
|
||||
public long? PermissionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段设置
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
namespace DS.WMS.Core.System.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 租户表单设置返回实体
|
||||
/// </summary>
|
||||
public class FormSetRes
|
||||
{
|
||||
/// <summary>
|
||||
/// 权限Id
|
||||
/// </summary>
|
||||
public long? PermissionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段设置
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface IFormSetService
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<FormSetRes>> GetListByPage(PageRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditFormSet(FormSetReq model);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<FormSetRes> GetFormSetInfo(string id);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface ILogAuditService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 审计日志列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<AuditLogRes>> GetAuditLogList(PageRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 审计日志详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<AuditLogRes> GetAuditLogInfo(string id);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface ILogExceptionService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 异常日志列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<ExceptionLogRes>> GetExceptionLogList(PageRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 异常日志详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<ExceptionLogRes> GetExceptionLogInfo(string id);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface ILogOperationService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<OperationLogRes>> GetOperationLogList(PageRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<OperationLogRes> GetOperationLogInfo(string id);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
|
||||
namespace DS.WMS.Core.System.Interface;
|
||||
|
||||
public interface ILogVisitService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 访问日志列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<VisitLogRes>> GetVisitLogList(PageRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 访问日志详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<VisitLogRes> GetVisitLogInfo(string id);
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using DS.WMS.Core.System.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.System.Method;
|
||||
|
||||
public class FormSetService : IFormSetService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public FormSetService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult<List<FormSetRes>> GetListByPage(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<SysFormSet>()
|
||||
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
|
||||
.Where(whereList)
|
||||
.Select<FormSetRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult EditFormSet(FormSetReq req)
|
||||
{
|
||||
var info = db.Queryable<SysFormSet>()
|
||||
.Where(x => x.TenantId == long.Parse(user.TenantId) && x.PermissionId == req.PermissionId).First();
|
||||
|
||||
if (info.IsNull())
|
||||
{
|
||||
var entity = new SysFormSet
|
||||
{
|
||||
TenantId = long.Parse(user.TenantId),
|
||||
PermissionId = req.PermissionId,
|
||||
Content = req.Content
|
||||
};
|
||||
db.Insertable(entity).ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
info.Content = req.Content;
|
||||
db.Updateable(info).ExecuteCommand();
|
||||
}
|
||||
|
||||
return DataResult.Successed("更新成功",MultiLanguageConst.DataUpdateSuccess);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="permissionId"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult<FormSetRes> GetFormSetInfo(string permissionId)
|
||||
{
|
||||
var data = db.Queryable<SysFormSet>()
|
||||
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
|
||||
.Where(x => x.TenantId == long.Parse(user.TenantId) && x.PermissionId == long.Parse(permissionId))
|
||||
.Select<FormSetRes>()
|
||||
.First();
|
||||
return DataResult<FormSetRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.Log;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using DS.WMS.Core.System.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.System.Method;
|
||||
|
||||
public class LogAuditService : ILogAuditService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ISaasDbService saasService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public LogAuditService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
||||
}
|
||||
|
||||
public DataResult<List<AuditLogRes>> GetAuditLogList(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = saasService.GetLogDb().Queryable<SysLogAudit>().Filter(null,true)
|
||||
.Where(whereList)
|
||||
.Select<AuditLogRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult<AuditLogRes> GetAuditLogInfo(string id)
|
||||
{
|
||||
var data = saasService.GetLogDb().Queryable<SysLogAudit>().Filter(null,true)
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<AuditLogRes>()
|
||||
.First();
|
||||
return DataResult<AuditLogRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.Log;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using DS.WMS.Core.System.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.System.Method;
|
||||
|
||||
public class LogExceptionService : ILogExceptionService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ISaasDbService saasService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public LogExceptionService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
||||
}
|
||||
|
||||
public DataResult<List<ExceptionLogRes>> GetExceptionLogList(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = saasService.GetLogDb().Queryable<SysLogException>().Filter(null,true)
|
||||
.Where(whereList)
|
||||
.Select<ExceptionLogRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult<ExceptionLogRes> GetExceptionLogInfo(string id)
|
||||
{
|
||||
var data = saasService.GetLogDb().Queryable<SysLogException>().Filter(null,true)
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<ExceptionLogRes>()
|
||||
.First();
|
||||
return DataResult<ExceptionLogRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.Log;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using DS.WMS.Core.System.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.System.Method;
|
||||
|
||||
public class LogOperationService : ILogOperationService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ISaasDbService saasService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public LogOperationService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
||||
}
|
||||
|
||||
public DataResult<List<OperationLogRes>> GetOperationLogList(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = saasService.GetLogDb().Queryable<SysLogOperation>().Filter(null,true)
|
||||
.Where(whereList)
|
||||
.Select<OperationLogRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult<OperationLogRes> GetOperationLogInfo(string id)
|
||||
{
|
||||
var data = saasService.GetLogDb().Queryable<SysLogOperation>().Filter(null,true)
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<OperationLogRes>()
|
||||
.First();
|
||||
return DataResult<OperationLogRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.Core.Log;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.System.Dtos;
|
||||
using DS.WMS.Core.System.Entity;
|
||||
using DS.WMS.Core.System.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.System.Method;
|
||||
|
||||
public class LogVisitService : ILogVisitService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
private readonly ISaasDbService saasService;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public LogVisitService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
||||
}
|
||||
|
||||
public DataResult<List<VisitLogRes>> GetVisitLogList(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = saasService.GetLogDb().Queryable<SysLogVisit>().Filter(null,true)
|
||||
.Where(whereList)
|
||||
.Select<VisitLogRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
|
||||
public DataResult<VisitLogRes> GetVisitLogInfo(string id)
|
||||
{
|
||||
var data = saasService.GetLogDb().Queryable<SysLogVisit>().Filter(null,true)
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<VisitLogRes>()
|
||||
.First();
|
||||
return DataResult<VisitLogRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue