解决文件本地上传报错问题,速率限制独立配置文件,解决通知公告修改删除报错,nlog增加速率限制日志文件写入,增加业务单号模块,生成业务单号工具类,IIS部署用web.config
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
namespace ZR.Model.System;
|
||||
/// <summary>
|
||||
/// 编码规则表
|
||||
/// </summary>
|
||||
[SugarTable("base_coderule")]
|
||||
[Tenant("0")]
|
||||
public class BaseCodeRule
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前缀
|
||||
/// </summary>
|
||||
public string Prefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 宽度
|
||||
/// </summary>
|
||||
public int Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始值
|
||||
/// </summary>
|
||||
public int IniVal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 增量
|
||||
/// </summary>
|
||||
public int Step { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 终止值
|
||||
/// </summary>
|
||||
public int FinishVal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 循环
|
||||
/// </summary>
|
||||
public int Cycle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后缀
|
||||
/// </summary>
|
||||
public string Sufix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分隔符
|
||||
/// </summary>
|
||||
public string JoinChar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 填充符
|
||||
/// </summary>
|
||||
public string FillChar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型值
|
||||
/// </summary>
|
||||
public string TypeVal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 循环号
|
||||
/// </summary>
|
||||
public int CycleVal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前值
|
||||
/// </summary>
|
||||
public int CurrVal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
/// </summary>
|
||||
public int Version { get; set; }
|
||||
}
|
||||
@@ -15,6 +15,7 @@ namespace ZR.ServiceCore.Model.Dto
|
||||
public string NoticeContent { get; set; }
|
||||
public int Status { get; set; }
|
||||
public string Remark { get; set; }
|
||||
public string Create_name { get; set; }
|
||||
public DateTime Create_time { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -39,9 +39,13 @@
|
||||
/// </summary>
|
||||
public string FileExt { get; set; }
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public string Create_by { get; set; }
|
||||
public long Create_by { get; set; }
|
||||
/// <summary>
|
||||
/// 创建者名称
|
||||
/// </summary>
|
||||
public string Create_name { get; set; }
|
||||
/// <summary>
|
||||
/// 上传时间
|
||||
/// </summary>
|
||||
@@ -56,14 +60,16 @@
|
||||
public string AccessUrl { get; set; }
|
||||
|
||||
public SysFile() { }
|
||||
public SysFile(string originFileName, string fileName, string ext, string fileSize, string storePath, string create_by)
|
||||
public SysFile(string originFileName, string fileName, string ext, string fileSize, string storePath,
|
||||
long createBy, string createName)
|
||||
{
|
||||
StorePath = storePath;
|
||||
RealName = originFileName;
|
||||
FileName = fileName;
|
||||
FileExt = ext;
|
||||
FileSize = fileSize;
|
||||
Create_by = create_by;
|
||||
Create_by = createBy;
|
||||
Create_name = createName;
|
||||
Create_time = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Infrastructure.Attribute;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service;
|
||||
using ZR.Service.System.IService;
|
||||
using ZR.ServiceCore.Services.IService;
|
||||
|
||||
namespace ZR.ServiceCore.Services;
|
||||
|
||||
[AppService(ServiceType = typeof(IBaseCodeRuleService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class BaseCodeRuleService : BaseService<BaseCodeRule>, IBaseCodeRuleService
|
||||
{
|
||||
public Task<int> InsertBaseCodeRuleAsync(BaseCodeRule baseCodeRule)
|
||||
{
|
||||
return Insertable(baseCodeRule).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
public Task<int> DeleteBaseCodeRuleAsync(string code)
|
||||
{
|
||||
return Deleteable().Where(m => m.Code == code).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
public Task<int> UpdateBaseCodeRule(BaseCodeRule baseCodeRule)
|
||||
{
|
||||
return Updateable(baseCodeRule).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
public PagedInfo<BaseCodeRule> SelectBaseCodeRulePage(BaseCodeRule baseCodeRule, PagerInfo pager)
|
||||
{
|
||||
var exp = Expressionable.Create<BaseCodeRule>();
|
||||
return GetPages(exp.ToExpression(), pager);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service;
|
||||
|
||||
namespace ZR.ServiceCore.Services.IService;
|
||||
|
||||
public interface IBaseCodeRuleService : IBaseService<BaseCodeRule>
|
||||
{
|
||||
public Task<int> InsertBaseCodeRuleAsync(BaseCodeRule baseCodeRule);
|
||||
|
||||
public Task<int> DeleteBaseCodeRuleAsync(string code);
|
||||
|
||||
public Task<int> UpdateBaseCodeRule(BaseCodeRule baseCodeRule);
|
||||
|
||||
public PagedInfo<BaseCodeRule> SelectBaseCodeRulePage(BaseCodeRule baseCodeRule, PagerInfo pager);
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using ZR.Service;
|
||||
using ZR.ServiceCore.Model;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
namespace ZR.ServiceCore.Services.IService
|
||||
{
|
||||
public interface ISysFileService : IBaseService<SysFile>
|
||||
{
|
||||
@@ -19,7 +17,8 @@ namespace ZR.Service.System.IService
|
||||
/// <param name="rootPath"></param>
|
||||
/// <param name="userName"></param>
|
||||
/// <returns>文件对象</returns>
|
||||
Task<SysFile> SaveFileToLocal(string rootPath, string fileName, string fileDir, string userName, IFormFile formFile, string uploadUrl);
|
||||
Task<SysFile> SaveFileToLocal(string rootPath, string fileName, string fileDir, long userId, string userName,
|
||||
IFormFile formFile, string uploadUrl);
|
||||
|
||||
Task<SysFile> SaveFileToAliyun(SysFile file, IFormFile formFile);
|
||||
/// <summary>
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
using Infrastructure;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using ZR.Common;
|
||||
using ZR.Model.System;
|
||||
using ZR.Service;
|
||||
using ZR.Service.System.IService;
|
||||
using ZR.ServiceCore.Model;
|
||||
using ZR.ServiceCore.Services.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
namespace ZR.ServiceCore.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件管理
|
||||
@@ -38,7 +39,8 @@ namespace ZR.Service.System
|
||||
/// <param name="formFile">上传的文件流</param>
|
||||
/// <param name="userName"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<SysFile> SaveFileToLocal(string rootPath, string fileName, string fileDir, string userName, IFormFile formFile, string uploadUrl)
|
||||
public async Task<SysFile> SaveFileToLocal(string rootPath, string fileName, string fileDir, long userId, string userName,
|
||||
IFormFile formFile, string uploadUrl)
|
||||
{
|
||||
string fileExt = Path.GetExtension(formFile.FileName);
|
||||
fileName = (fileName.IsEmpty() ? HashFileName() : fileName) + fileExt;
|
||||
@@ -58,7 +60,7 @@ namespace ZR.Service.System
|
||||
}
|
||||
// string uploadUrl = OptionsSetting.Upload.UploadUrl;
|
||||
string accessPath = string.Concat(uploadUrl, "/", filePath.Replace("\\", "/"), "/", fileName);
|
||||
SysFile file = new(formFile.FileName, fileName, fileExt, fileSize + "kb", filePath, userName)
|
||||
SysFile file = new(formFile.FileName, fileName, fileExt, fileSize + "kb", filePath, userId, userName)
|
||||
{
|
||||
StoreType = (int)StoreType.LOCAL,
|
||||
FileType = formFile.ContentType,
|
||||
|
||||
Reference in New Issue
Block a user