|
|
using Furion.DependencyInjection;
|
|
|
using Furion.DynamicApiController;
|
|
|
using Furion.FriendlyException;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
using Myshipping.Core.Entity;
|
|
|
using Myshipping.Core.Entity.CommonDB;
|
|
|
using Myshipping.Core.Service.Dict.Dto;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace Myshipping.Core.Service;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 系统缓存服务
|
|
|
/// </summary>
|
|
|
[ApiDescriptionSettings(Name = "Cache", Order = 100)]
|
|
|
|
|
|
public class SysCacheService : ISysCacheService, IDynamicApiController, ISingleton
|
|
|
{
|
|
|
private readonly ICache _cache;
|
|
|
private readonly CacheOptions _cacheOptions;
|
|
|
private readonly ILogger<SysCacheService> _logger;
|
|
|
|
|
|
public SysCacheService(IOptions<CacheOptions> cacheOptions, ILogger<SysCacheService> logger, Func<string, ISingleton, object> resolveNamed)
|
|
|
{
|
|
|
_logger = logger;
|
|
|
_cacheOptions = cacheOptions.Value;
|
|
|
_cache = resolveNamed(_cacheOptions.CacheType.ToString(), default) as ICache;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取数据范围缓存(机构Id集合)
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<long>> GetDataScope(long userId)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_DATASCOPE + $"{userId}";
|
|
|
return await _cache.GetAsync<List<long>>(cacheKey);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取数据范围缓存(用户Id集合)
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<long>> GetUsersDataScope(long userId)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_USERSDATASCOPE + $"{userId}";
|
|
|
return await _cache.GetAsync<List<long>>(cacheKey);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 缓存数据范围(机构Id集合)
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <param name="dataScopes"></param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public async Task SetDataScope(long userId, List<long> dataScopes)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_DATASCOPE + $"{userId}";
|
|
|
await _cache.SetAsync(cacheKey, dataScopes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 缓存数据范围(用户Id集合)
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <param name="dataScopes"></param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public async Task SetUsersDataScope(long userId, List<long> dataScopes)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_USERSDATASCOPE + $"{userId}";
|
|
|
await _cache.SetAsync(cacheKey, dataScopes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取菜单缓存
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <param name="appCode"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<AntDesignTreeNode>> GetMenu(long userId, string appCode)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_MENU + $"{userId}-{appCode}";
|
|
|
return await _cache.GetAsync<List<AntDesignTreeNode>>(cacheKey);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 缓存菜单
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <param name="appCode"></param>
|
|
|
/// <param name="menus"></param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public async Task SetMenu(long userId, string appCode, List<AntDesignTreeNode> menus)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_MENU + $"{userId}-{appCode}";
|
|
|
await _cache.SetAsync(cacheKey, menus);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取权限缓存(按钮)
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<string>> GetPermission(long userId)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_PERMISSION + $"{userId}";
|
|
|
return await _cache.GetAsync<List<string>>(cacheKey);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 缓存权限
|
|
|
/// </summary>
|
|
|
/// <param name="userId"></param>
|
|
|
/// <param name="permissions"></param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public async Task SetPermission(long userId, List<string> permissions)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_PERMISSION + $"{userId}";
|
|
|
await _cache.SetAsync(cacheKey, permissions);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取所有缓存关键字
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public List<string> GetAllCacheKeys()
|
|
|
{
|
|
|
var cacheItems = _cache.GetAllKeys();
|
|
|
if (cacheItems == null) return new List<string>();
|
|
|
return cacheItems.Where(u => !u.ToString().StartsWith("mini-profiler")).Select(u => u).ToList();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取所有按钮权限
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<string>> GetAllPermission()
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_ALLPERMISSION;
|
|
|
return await _cache.GetAsync<List<string>>(cacheKey);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置所有按钮权限
|
|
|
/// </summary>
|
|
|
/// <param name="permissions"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task SetAllPermission(List<string> permissions)
|
|
|
{
|
|
|
var cacheKey = CommonConst.CACHE_KEY_ALLPERMISSION;
|
|
|
await _cache.SetAsync(cacheKey, permissions);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除指定关键字缓存
|
|
|
/// </summary>
|
|
|
/// <param name="key"></param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public bool Del(string key)
|
|
|
{
|
|
|
_cache.Del(key);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除指定关键字缓存
|
|
|
/// </summary>
|
|
|
/// <param name="key"></param>
|
|
|
/// <returns></returns>
|
|
|
public Task<bool> DelAsync(string key)
|
|
|
{
|
|
|
_cache.DelAsync(key);
|
|
|
return Task.FromResult(true);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除某特征关键字缓存
|
|
|
/// </summary>
|
|
|
/// <param name="key"></param>
|
|
|
/// <returns></returns>
|
|
|
public Task<bool> DelByPatternAsync(string key)
|
|
|
{
|
|
|
_cache.DelByPatternAsync(key);
|
|
|
return Task.FromResult(true);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置缓存
|
|
|
/// </summary>
|
|
|
/// <param name="key"></param>
|
|
|
/// <param name="value"></param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public bool Set(string key, object value)
|
|
|
{
|
|
|
return _cache.Set(key, value);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置缓存
|
|
|
/// </summary>
|
|
|
/// <param name="key"></param>
|
|
|
/// <param name="value"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<bool> SetAsync(string key, object value)
|
|
|
{
|
|
|
return await _cache.SetAsync(key, value);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置缓存,并带有过期时间
|
|
|
/// </summary>
|
|
|
/// <param name="key"></param>
|
|
|
/// <param name="value"></param>
|
|
|
/// <param name="ts"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<bool> SetTimeoutAsync(string key, object value, TimeSpan ts)
|
|
|
{
|
|
|
return await _cache.SetAsync(key, value, ts);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取缓存
|
|
|
/// </summary>
|
|
|
/// <param name="key"></param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public string Get(string key)
|
|
|
{
|
|
|
return _cache.Get(key);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取缓存
|
|
|
/// </summary>
|
|
|
/// <param name="key"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<string> GetAsync(string key)
|
|
|
{
|
|
|
return await _cache.GetAsync(key);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取缓存
|
|
|
/// </summary>
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
/// <param name="key"></param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public T Get<T>(string key)
|
|
|
{
|
|
|
return _cache.Get<T>(key);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取缓存
|
|
|
/// </summary>
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
/// <param name="key"></param>
|
|
|
/// <returns></returns>
|
|
|
public Task<T> GetAsync<T>(string key)
|
|
|
{
|
|
|
return _cache.GetAsync<T>(key);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 检查给定 key 是否存在
|
|
|
/// </summary>
|
|
|
/// <param name="key">键</param>
|
|
|
/// <returns></returns>
|
|
|
[NonAction]
|
|
|
public bool Exists(string key)
|
|
|
{
|
|
|
return _cache.Exists(key);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 检查给定 key 是否存在
|
|
|
/// </summary>
|
|
|
/// <param name="key">键</param>
|
|
|
/// <returns></returns>
|
|
|
public Task<bool> ExistsAsync(string key)
|
|
|
{
|
|
|
return _cache.ExistsAsync(key);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 公共库缓存
|
|
|
/// <summary>
|
|
|
/// 获取公共库 船公司
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeCarrier>> GetAllCodeCarrier()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeCarrier>>(CommonConst.CACHE_KEY_COMMON_DB_CARRIER);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 船名
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeVessel>> GetAllCodeVessel()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeVessel>>(CommonConst.CACHE_KEY_COMMON_DB_VESSEL);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 船代
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeForwarder>> GetAllCodeForwarder()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeForwarder>>(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 场站
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeYard>> GetAllCodeYard()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeYard>>(CommonConst.CACHE_KEY_COMMON_DB_YARD);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 起始港
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodePortLoad>> GetAllCodePortLoad()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodePortLoad>>(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 目的港
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodePort>> GetAllCodePort()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodePort>>(CommonConst.CACHE_KEY_COMMON_DB_PORT);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 包装
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodePackage>> GetAllCodePackage()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodePackage>>(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 运输方式
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeService>> GetAllCodeService()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeService>>(CommonConst.CACHE_KEY_COMMON_DB_SERVICE);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 箱型
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeCtn>> GetAllCodeCtn()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeCtn>>(CommonConst.CACHE_KEY_COMMON_DB_CTN);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 付费方式
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeFrt>> GetAllCodeFrt()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeFrt>>(CommonConst.CACHE_KEY_COMMON_DB_FRT);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 航线
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeLane>> GetAllCodeLane()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeLane>>(CommonConst.CACHE_KEY_COMMON_DB_LANE);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 航线与港口的的关系表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<RelaPortCarrierLane>> GetAllRelaPortCarrierLane()
|
|
|
{
|
|
|
return _cache.GetAsync<List<RelaPortCarrierLane>>(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 起运港与船代的关系表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<RelaPortLoadForwarder>> GetAllRelaPortLoadForwarder()
|
|
|
{
|
|
|
return _cache.GetAsync<List<RelaPortLoadForwarder>>(CommonConst.CACHE_KEY_COMMON_DB_RELA_PORTLOAD_FORWARDER);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 国家
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeCountry>> GetAllCodeCountry()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeCountry>>(CommonConst.CACHE_KEY_COMMON_DB_COUNTRY);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 箱型映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingCtn>> GetAllMappingCtn()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingCtn>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 船司映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingCarrier>> GetAllMappingCarrier()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingCarrier>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CARRIER);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 费用方式映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingFrt>> GetAllMappingFrt()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingFrt>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FRT);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 船名映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingVessel>> GetAllMappingVessel()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingVessel>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 场站映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingYard>> GetAllMappingYard()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingYard>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取公共库 船代映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingForwarder>> GetAllMappingForwarder()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingForwarder>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FORWARDER);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 船公司
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeCarrier(List<CodeCarrier> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_CARRIER, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 船名
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeVessel(List<CodeVessel> list)
|
|
|
{
|
|
|
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_VESSEL, list.ToJsonString());
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 船代
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeForwarder(List<CodeForwarder> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_FORWARDER, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 场站
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeYard(List<CodeYard> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_YARD, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 起始港
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodePortLoad(List<CodePortLoad> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_PORTLOAD, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 目的港
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodePort(List<CodePort> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_PORT, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 包装
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodePackage(List<CodePackage> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_PACKAGE, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 运输方式
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeService(List<CodeService> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_SERVICE, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 箱型
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeCtn(List<CodeCtn> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_CTN, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 付费方式
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeFrt(List<CodeFrt> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_FRT, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 航线
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeLane(List<CodeLane> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_LANE, list);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 航线与港口的的关系表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllRelaPortCarrierLane(List<RelaPortCarrierLane> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_LANE_PORT, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 起运港与船代的关系表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllRelaPortLoadForwarder(List<RelaPortLoadForwarder> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_RELA_PORTLOAD_FORWARDER, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 国家
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeCountry(List<CodeCountry> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_COUNTRY, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 箱型映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingCtn(List<MappingCtn> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CTN, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 船司映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingCarrier(List<MappingCarrier> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CARRIER, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 费用方式映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingFrt(List<MappingFrt> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FRT, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 船名映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingVessel(List<MappingVessel> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_VESSEL, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 场站映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingYard(List<MappingYard> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_YARD, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 船代映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingForwarder(List<MappingForwarder> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_FORWARDER, list);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 设置公共库 起始港映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingPortLoad(List<MappingPortLoad> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORTLOAD, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 起始港映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingPortLoad>> GetAllMappingPortLoad()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingPortLoad>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORTLOAD);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 目的港映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingPort>> GetAllMappingPort()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingPort>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORT);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 设置公共库 目的港映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingPort(List<MappingPort> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PORT, list);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 设置公共库 包装映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingPackage(List<MappingPackage> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PACKAGE, list);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取公共库 包装映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingPackage>> GetAllMappingPackage()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingPackage>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_PACKAGE);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取公共库 运输条款映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingService>> GetAllMappingService()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingService>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_SERVICE);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 设置公共库 运输条款映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingService(List<MappingService> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_SERVICE, list);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 签单方式
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeIssueType>> GetAllCodeIssueType()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeIssueType>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 设置公共库 签单方式
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeIssueType(List<CodeIssueType> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_CODEISSUETYPE, list);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 签单方式映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<MappingIssueType>> GetAllMappingIssueType()
|
|
|
{
|
|
|
return _cache.GetAsync<List<MappingIssueType>>(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 签单方式映射
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllMappingIssueType(List<MappingIssueType> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_MAPPING_ISSUETYPE, list);
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region DJY
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取租户参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<DjyTenantParamValue>> GetAllTenantParam()
|
|
|
{
|
|
|
return _cache.GetAsync<List<DjyTenantParamValue>>(CommonConst.CACHE_KEY_COMMON_DB_TENANT_PARAM_VALUE);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置租户参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllTenantParam(List<DjyTenantParamValue> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_TENANT_PARAM_VALUE, list);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取字典缓存
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<DictDataDto>> GetAllDictData()
|
|
|
{
|
|
|
return _cache.GetAsync<List<DictDataDto>>(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA);
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置字典参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public Task SetAllDictData(List<DictDataDto> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_DICT_DATA, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取EDI参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<DjyEdiSetting>> GetAllEdiSetting()
|
|
|
{
|
|
|
return _cache.GetAsync<List<DjyEdiSetting>>(CommonConst.CACHE_KEY_DJY_EDI_SETTING);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置EDI参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllEdiSetting(List<DjyEdiSetting> list)
|
|
|
{
|
|
|
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_DJY_EDI_SETTING, list);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 更新配置缓存
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllSysConfig(List<SysConfig> list)
|
|
|
{
|
|
|
|
|
|
return _cache.SetAsync(CommonConst.DJY_CONST, list);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取配置缓存
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public async Task<List<SysConfig>> GetAllSysConfig()
|
|
|
{
|
|
|
return await _cache.GetAsync<List<SysConfig>>(CommonConst.DJY_CONST);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公共库 城市信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeCity>> GetAllCodeCity()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeCity>>(CommonConst.CACHE_KEY_COMMON_DB_CITY);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取公共库 城市信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task<List<CodeProvince>> GetAllCodeProvince()
|
|
|
{
|
|
|
return _cache.GetAsync<List<CodeProvince>>(CommonConst.CACHE_KEY_COMMON_DB_PROVINCE);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 设置公共库 城市信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeCity(List<CodeCity> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_CITY, list);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 设置公共库 城市信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public Task SetAllCodeProvince(List<CodeProvince> list)
|
|
|
{
|
|
|
return _cache.SetAsync(CommonConst.CACHE_KEY_COMMON_DB_PROVINCE, list);
|
|
|
}
|
|
|
#endregion
|
|
|
}
|