完善系统参数配置和数据字典管理模块
This commit is contained in:
@@ -1,10 +1,35 @@
|
||||
using Model;
|
||||
using Model.Dto.Asset;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Service.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 二维码 服务接口
|
||||
/// 设备二维码 服务接口
|
||||
/// 编码内容为扫码直达 URL:{baseUrl}/asset/ledger/equipment?id={equipmentId}
|
||||
/// baseUrl 由 Controller 从 HTTP 请求构造(scheme://host)后传入,保持 Service 层框架无关
|
||||
/// 生成时把 URL 写入 EquipmentEntity.QrCodeUrl;打印返回 HTML 页面(含 base64 二维码图)
|
||||
/// </summary>
|
||||
public interface IQrCodeService
|
||||
{
|
||||
// TODO: 定义 二维码 相关方法
|
||||
/// <summary>生成二维码 URL 并写入设备(baseUrl 形如 http://host:port)</summary>
|
||||
Task<Result<QrCodeDto>> GenerateAsync(long equipmentId, string baseUrl);
|
||||
|
||||
/// <summary>生成二维码 PNG 图片字节(同时确保 URL 已写库)</summary>
|
||||
Task<Result<byte[]>> GenerateImageAsync(long equipmentId, string baseUrl);
|
||||
|
||||
/// <summary>批量生成二维码 URL(逐个写库,单条失败不影响其它)</summary>
|
||||
Task<Result<List<QrCodeBatchResultDto>>> BatchGenerateAsync(long[] equipmentIds, string baseUrl);
|
||||
|
||||
/// <summary>设备二维码列表(分页,关键字匹配 Code/Name;qrOnly=1 仅看已生成)</summary>
|
||||
Task<Result<List<QrCodeDto>>> GetListPagedAsync(int pageIndex, int pageSize, RefAsync<int> total, string? keyword = null, bool qrOnly = false);
|
||||
|
||||
/// <summary>获取打印用 HTML 页面(含二维码 base64 图 + 设备信息,浏览器 Ctrl+P 打印)</summary>
|
||||
Task<Result<string>> GetPrintHtmlAsync(long equipmentId, string baseUrl);
|
||||
|
||||
/// <summary>绑定 RFID 编号到设备(覆盖式写入 RfidCode)</summary>
|
||||
Task<Result> BindRfidAsync(long equipmentId, string rfidCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using Model;
|
||||
using Model.Dto.System;
|
||||
using Model.Entity.System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Service.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储 Provider 抽象(Local 落地;MinIO/OSS 留扩展点)
|
||||
/// 实现类命名约定:XxxFileStorageProvider,由 DependencyInjection 手动注册到 IFileStorageProvider
|
||||
/// FileStorageService 通过 IEnumerable<IFileStorageProvider> 按配置 Provider 字段挑选实例
|
||||
/// </summary>
|
||||
public interface IFileStorageProvider
|
||||
{
|
||||
/// <summary>Provider 标识(local/minio/oss),与 FileStorageConfigEntity.Provider 对应</summary>
|
||||
string ProviderName { get; }
|
||||
|
||||
/// <summary>上传文件,返回存储后的文件名(含相对路径)、访问 URL、扩展名、大小</summary>
|
||||
Task<Result<FileUploadResultDto>> UploadAsync(Stream stream, string originalName, long size, FileStorageConfigEntity config);
|
||||
|
||||
/// <summary>删除文件(按存储后的相对文件名)</summary>
|
||||
Task<Result> DeleteAsync(string storedFileName, FileStorageConfigEntity config);
|
||||
|
||||
/// <summary>测试连接/可用性(Local:检查目录可写;MinIO/OSS:检查 Bucket 可访问)</summary>
|
||||
Task<Result> TestConnectionAsync(FileStorageConfigEntity config);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,54 @@
|
||||
using Model;
|
||||
using Model.Dto.System;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Service.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据字典管理 服务接口
|
||||
/// 约定:字典分类(DictType) + 字典项(DictItem) 二层结构,不支持级联
|
||||
/// </summary>
|
||||
public interface IDictService
|
||||
{
|
||||
// TODO: 定义 数据字典管理 相关方法
|
||||
// ==================== 字典分类 ====================
|
||||
|
||||
/// <summary>分页查询字典分类(关键字匹配 Code/Name)</summary>
|
||||
Task<Result<List<DictTypeDto>>> GetTypesPagedAsync(int pageIndex, int pageSize, RefAsync<int> total, string? keyword = null);
|
||||
|
||||
/// <summary>全部启用的字典分类(下拉用,不缓存)</summary>
|
||||
Task<Result<List<DictTypeDto>>> GetTypesAllAsync();
|
||||
|
||||
/// <summary>字典分类详情</summary>
|
||||
Task<Result<DictTypeDto>> GetTypeByIdAsync(long id);
|
||||
|
||||
/// <summary>新增字典分类(校验编码唯一)</summary>
|
||||
Task<Result<DictTypeDto>> AddTypeAsync(DictTypeDto dto);
|
||||
|
||||
/// <summary>修改字典分类</summary>
|
||||
Task<Result<DictTypeDto>> UpdateTypeAsync(DictTypeDto dto);
|
||||
|
||||
/// <summary>删除字典分类(分类下有字典项时禁止删除)</summary>
|
||||
Task<Result> DeleteTypeAsync(long id);
|
||||
|
||||
// ==================== 字典项 ====================
|
||||
|
||||
/// <summary>查询指定分类下的字典项(按 Sort、CreateTime 倒序)</summary>
|
||||
Task<Result<List<DictItemDto>>> GetItemsByTypeAsync(long typeId);
|
||||
|
||||
/// <summary>新增字典项(校验同分类下编码唯一;IsDefault=1 时清零其它默认项)</summary>
|
||||
Task<Result<DictItemDto>> AddItemAsync(DictItemDto dto);
|
||||
|
||||
/// <summary>修改字典项</summary>
|
||||
Task<Result<DictItemDto>> UpdateItemAsync(DictItemDto dto);
|
||||
|
||||
/// <summary>删除字典项</summary>
|
||||
Task<Result> DeleteItemAsync(long id);
|
||||
|
||||
// ==================== 业务侧(无权限,供其它模块调用) ====================
|
||||
|
||||
/// <summary>按字典编码查询启用项(带 IMemoryCache 缓存,增删改时失效)</summary>
|
||||
Task<Result<List<DictOptionDto>>> GetOptionsByCodeAsync(string typeCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,50 @@
|
||||
using Model;
|
||||
using Model.Dto.System;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Service.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储管理 服务接口
|
||||
/// 管理侧:存储配置 CRUD + 设默认 + 连接测试;上传侧:按默认配置上传,登记 sys_file_record
|
||||
/// </summary>
|
||||
public interface IFileStorageService
|
||||
{
|
||||
// TODO: 定义 文件存储管理 相关方法
|
||||
// ==================== 存储配置 ====================
|
||||
|
||||
/// <summary>分页查询存储配置(关键字匹配 Name/Provider)</summary>
|
||||
Task<Result<List<FileStorageConfigDto>>> GetListPagedAsync(int pageIndex, int pageSize, RefAsync<int> total, string? keyword = null);
|
||||
|
||||
/// <summary>存储配置详情</summary>
|
||||
Task<Result<FileStorageConfigDto>> GetByIdAsync(long id);
|
||||
|
||||
/// <summary>新增存储配置(校验 Provider 支持范围;IsDefault=1 时清零其它默认)</summary>
|
||||
Task<Result<FileStorageConfigDto>> AddAsync(FileStorageConfigDto dto);
|
||||
|
||||
/// <summary>修改存储配置(AccessKey/SecretKey 为掩码时保留原值)</summary>
|
||||
Task<Result<FileStorageConfigDto>> UpdateAsync(FileStorageConfigDto dto);
|
||||
|
||||
/// <summary>删除存储配置(默认配置禁止删除)</summary>
|
||||
Task<Result> DeleteAsync(long id);
|
||||
|
||||
/// <summary>设为默认(清零其它默认)</summary>
|
||||
Task<Result> SetDefaultAsync(long id);
|
||||
|
||||
/// <summary>测试连接(按配置调用对应 Provider 的 TestConnectionAsync)</summary>
|
||||
Task<Result> TestAsync(long id);
|
||||
|
||||
// ==================== 文件上传/记录 ====================
|
||||
|
||||
/// <summary>上传文件(使用默认启用的存储配置;校验大小/扩展名;登记 sys_file_record)</summary>
|
||||
Task<Result<FileRecordDto>> UploadAsync(Stream stream, string originalName, long size, string? bizType = null, string? bizId = null, string? uploader = null);
|
||||
|
||||
/// <summary>文件记录分页查询(可按 BizType / 关键字过滤)</summary>
|
||||
Task<Result<List<FileRecordDto>>> GetFileListPagedAsync(int pageIndex, int pageSize, RefAsync<int> total, string? keyword = null, string? bizType = null);
|
||||
|
||||
/// <summary>文件记录详情</summary>
|
||||
Task<Result<FileRecordDto>> GetFileByIdAsync(long id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,44 @@
|
||||
using Model;
|
||||
using Model.Dto.System;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Service.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统参数配置 服务接口
|
||||
/// 管理侧:CRUD(按 Group 分组、关键字检索);业务侧:按 Key 单/批量取值(带缓存)
|
||||
/// 内置参数(IsSystem=1)禁止删除,仅允许修改 Value
|
||||
/// </summary>
|
||||
public interface ISystemParamService
|
||||
{
|
||||
// TODO: 定义 系统参数配置 相关方法
|
||||
// ==================== 管理侧 ====================
|
||||
|
||||
/// <summary>分页查询(关键字匹配 ParamKey/ParamName;可选 Group 过滤)</summary>
|
||||
Task<Result<List<SystemParamDto>>> GetListPagedAsync(int pageIndex, int pageSize, RefAsync<int> total, string? keyword = null, string? group = null);
|
||||
|
||||
/// <summary>参数详情</summary>
|
||||
Task<Result<SystemParamDto>> GetByIdAsync(long id);
|
||||
|
||||
/// <summary>新增参数(校验 ParamKey 唯一)</summary>
|
||||
Task<Result<SystemParamDto>> AddAsync(SystemParamDto dto);
|
||||
|
||||
/// <summary>修改参数(内置参数仅允许改 Value/Remark;非内置可改全字段;Key 变更时同步失效缓存)</summary>
|
||||
Task<Result<SystemParamDto>> UpdateAsync(SystemParamDto dto);
|
||||
|
||||
/// <summary>删除参数(内置参数禁止删除)</summary>
|
||||
Task<Result> DeleteAsync(long id);
|
||||
|
||||
/// <summary>清空参数值缓存(运维用)</summary>
|
||||
Task<Result> ReloadCacheAsync();
|
||||
|
||||
// ==================== 业务侧(无权限,供其它模块调用) ====================
|
||||
|
||||
/// <summary>按 Key 取单个值(带缓存;不存在返回空字符串)</summary>
|
||||
Task<Result<string>> GetValueAsync(string key);
|
||||
|
||||
/// <summary>按 Key 列表批量取值(带缓存)</summary>
|
||||
Task<Result<List<SystemParamValueDto>>> GetValuesAsync(string[] keys);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user