😎1、优化同步行政区划 2、调整sqlsugar缓存和扩展
This commit is contained in:
parent
67aeba5345
commit
7c6bcffcd6
@ -56,7 +56,7 @@
|
||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.2" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1196" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1197" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
</ItemGroup>
|
||||
@ -76,9 +76,9 @@
|
||||
<PackageReference Include="AspNet.Security.OAuth.Gitee" Version="9.0.0" />
|
||||
<PackageReference Include="AspNet.Security.OAuth.Weixin" Version="9.0.0" />
|
||||
<PackageReference Include="Lazy.Captcha.Core" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" Version="9.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.5.0" />
|
||||
<PackageReference Include="My.Extensions.Localization.Json" Version="3.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -76,10 +76,10 @@ public class ConfigConst
|
||||
///// </summary>
|
||||
//public const string SysTenantHostLogin = "sys_tenant_host_login";
|
||||
|
||||
/// <summary>
|
||||
/// 行政区划同步层级 1-省级,2-市级,3-区县级,4-街道级,5-村级
|
||||
/// </summary>
|
||||
public const string SysRegionSyncLevel = "sys_region_sync_level";
|
||||
///// <summary>
|
||||
///// 行政区划同步层级 1-省级,2-市级,3-区县级,4-街道级,5-村级
|
||||
///// </summary>
|
||||
//public const string SysRegionSyncLevel = "sys_region_sync_level";
|
||||
|
||||
/// <summary>
|
||||
/// 开启强制修改密码
|
||||
|
||||
@ -29,7 +29,7 @@ public class SysConfigSeedData : ISqlSugarEntitySeedData<SysConfig>
|
||||
new SysConfig{ Id=1300000000171, Name="RefreshToken过期时间", Code=ConfigConst.SysRefreshTokenExpire, Value="20160", SysFlag=YesNoEnum.Y, Remark="刷新Token过期时间(分钟)(一般 refresh_token 的有效时间 > 2 * access_token 的有效时间)", OrderNo=100, GroupCode=ConfigConst.SysDefaultGroup, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
|
||||
new SysConfig{ Id=1300000000181, Name="发送异常日志邮件", Code=ConfigConst.SysErrorMail, Value="False", SysFlag=YesNoEnum.Y, Remark="是否发送异常日志邮件", OrderNo=110, GroupCode=ConfigConst.SysDefaultGroup, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
|
||||
new SysConfig{ Id=1300000000191, Name="域登录验证", Code=ConfigConst.SysDomainLogin, Value="False", SysFlag=YesNoEnum.Y, Remark="是否开启域登录验证", OrderNo=120, GroupCode=ConfigConst.SysDefaultGroup, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
|
||||
new SysConfig{ Id=1300000000201, Name="行政区划同步层级", Code=ConfigConst.SysRegionSyncLevel, Value="3", SysFlag=YesNoEnum.Y, Remark="行政区划同步层级 1-省级,2-市级,3-区县级,4-街道级,5-村级", OrderNo=150, GroupCode=ConfigConst.SysDefaultGroup, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
|
||||
//new SysConfig{ Id=1300000000201, Name="行政区划同步层级", Code=ConfigConst.SysRegionSyncLevel, Value="3", SysFlag=YesNoEnum.Y, Remark="行政区划同步层级 1-省级,2-市级,3-区县级,4-街道级,5-村级", OrderNo=150, GroupCode=ConfigConst.SysDefaultGroup, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
|
||||
// 业务系统记得改密匙(修改密匙要重新生成数据库/账号表),通过接口(http://localhost:5005/api/sysCommon/smKeyPair)获取
|
||||
//new SysConfig{ Id=1300000000211, Name="国密SM2密匙", Code=ConfigConst.SysSM2Key, Value="04851D329AA3E38C2E7670AFE70E6E70E92F8769CA27C8766B12209A0FFBA4493B603EF7A0B9B1E16F0E8930C0406EA0B179B68DF28E25334BDEC4AE76D907E9E9;3A61D1D30C6302DABFF36201D936D0143EEF0C850AF28C5CA6D5C045AF8C5C8A", SysFlag=YesNoEnum.Y, Remark="国密SM2密匙", OrderNo=160, GroupCode=ConfigConst.SysDefaultGroup, CreateTime=DateTime.Parse("2024-11-21 00:00:00") },
|
||||
new SysConfig{ Id=1300000000221, Name="开启强制修改密码", Code=ConfigConst.SysForceChangePassword, Value="False", SysFlag=YesNoEnum.Y, Remark="开启强制修改密码", OrderNo=170, GroupCode=ConfigConst.SysDefaultGroup, CreateTime=DateTime.Parse("2022-02-10 00:00:00") },
|
||||
|
||||
17
Admin.NET/Admin.NET.Core/Service/Region/Dto/GDInput.cs
Normal file
17
Admin.NET/Admin.NET.Core/Service/Region/Dto/GDInput.cs
Normal file
@ -0,0 +1,17 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core.Service;
|
||||
|
||||
/// <summary>
|
||||
/// 高德
|
||||
/// </summary>
|
||||
public class GDInput
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Keywords { get; set; }
|
||||
public int Level { get; set; }
|
||||
}
|
||||
16
Admin.NET/Admin.NET.Core/Service/Region/Dto/McaInput.cs
Normal file
16
Admin.NET/Admin.NET.Core/Service/Region/Dto/McaInput.cs
Normal file
@ -0,0 +1,16 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core.Service;
|
||||
|
||||
/// <summary>
|
||||
/// 国家地名信息库
|
||||
/// </summary>
|
||||
public class McaInput
|
||||
{
|
||||
public long Code { get; set; }
|
||||
public int Level { get; set; }
|
||||
}
|
||||
15
Admin.NET/Admin.NET.Core/Service/Region/Dto/MzbInput.cs
Normal file
15
Admin.NET/Admin.NET.Core/Service/Region/Dto/MzbInput.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core.Service;
|
||||
|
||||
/// <summary>
|
||||
/// 民政部
|
||||
/// </summary>
|
||||
public class MzbInput
|
||||
{
|
||||
public int Level { get; set; }
|
||||
}
|
||||
@ -13,13 +13,11 @@ namespace Admin.NET.Core.Service;
|
||||
public class SysRegionService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly SqlSugarRepository<SysRegion> _sysRegionRep;
|
||||
private readonly SysConfigService _sysConfigService;
|
||||
private readonly IHttpRemoteService _httpRemoteService;
|
||||
|
||||
public SysRegionService(SqlSugarRepository<SysRegion> sysRegionRep, SysConfigService sysConfigService, IHttpRemoteService httpRemoteService)
|
||||
public SysRegionService(SqlSugarRepository<SysRegion> sysRegionRep, IHttpRemoteService httpRemoteService)
|
||||
{
|
||||
_sysRegionRep = sysRegionRep;
|
||||
_sysConfigService = sysConfigService;
|
||||
_httpRemoteService = httpRemoteService;
|
||||
}
|
||||
|
||||
@ -35,6 +33,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
.WhereIF(input.Pid > 0, u => u.Pid == input.Pid || u.Id == input.Pid)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code))
|
||||
.OrderBy(u => new { u.Code })
|
||||
.ToPagedListAsync(input.Page, input.PageSize);
|
||||
}
|
||||
|
||||
@ -58,7 +57,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
[DisplayName("获取指定层级行政区划子树")]
|
||||
public async Task<List<SysRegion>> GetChildTree(long pid, int level)
|
||||
{
|
||||
var iSugarQueryable = _sysRegionRep.AsQueryable().OrderBy(u => new { u.OrderNo });
|
||||
var iSugarQueryable = _sysRegionRep.AsQueryable().OrderBy(u => new { u.Code });
|
||||
return await iSugarQueryable.Where(u => u.Level < level).ToTreeAsync(u => u.Children, u => u.Pid, pid);
|
||||
}
|
||||
|
||||
@ -70,7 +69,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
[DisplayName("获取指定层级行政区划子列表")]
|
||||
public async Task<List<SysRegion>> GetChildList(long pid)
|
||||
{
|
||||
return await _sysRegionRep.AsQueryable().Where(u => u.Pid == pid).OrderBy(u => new { u.OrderNo }).ToListAsync();
|
||||
return await _sysRegionRep.AsQueryable().Where(u => u.Pid == pid).OrderBy(u => new { u.Code }).ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -87,6 +86,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Type), u => u.Type == input.Type)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code))
|
||||
.OrderBy(u => new { u.Code })
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
@ -175,71 +175,77 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
/// <summary>
|
||||
/// 同步行政区划(民政部) 🔖
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("同步行政区划(民政部)")]
|
||||
public async Task SyncRegionMzb()
|
||||
public async Task SyncRegionMzb(MzbInput input)
|
||||
{
|
||||
var syncLevel = await _sysConfigService.GetConfigValueByCode<int>(ConfigConst.SysRegionSyncLevel);
|
||||
if (syncLevel is < 1 or > 5) syncLevel = 3; // 默认区县级
|
||||
|
||||
var html = await _httpRemoteService.GetAsStringAsync("http://xzqh.mca.gov.cn/map");
|
||||
var municipalityList = new List<string> { "北京", "天津", "上海", "重庆" };
|
||||
var provList = JSON.Deserialize<List<Dictionary<string, string>>>(Regex.Match(html, @"(?<=var json = )(\[\{.*?\}\])(?=;)").Value);
|
||||
foreach (var dict1 in provList)
|
||||
try
|
||||
{
|
||||
var list = new List<SysRegion>();
|
||||
var provName = dict1.GetValueOrDefault("shengji");
|
||||
var province = new SysRegion
|
||||
{
|
||||
Id = YitIdHelper.NextId(),
|
||||
Name = Regex.Replace(provName, "[((].*?[))]", ""),
|
||||
Code = dict1.GetValueOrDefault("quHuaDaiMa"),
|
||||
CityCode = dict1.GetValueOrDefault("quhao"),
|
||||
Level = 1,
|
||||
Pid = 0,
|
||||
};
|
||||
if (municipalityList.Any(m => province.Name.StartsWith(m))) province.Name += "(省)";
|
||||
list.Add(province);
|
||||
var html = await _httpRemoteService.GetAsStringAsync("http://xzqh.mca.gov.cn/map");
|
||||
var municipalityList = new List<string> { "北京", "天津", "上海", "重庆" };
|
||||
|
||||
if (syncLevel <= 1) continue;
|
||||
|
||||
var prefList = await GetSelectList(provName);
|
||||
foreach (var dict2 in prefList)
|
||||
var provList = JSON.Deserialize<List<Dictionary<string, string>>>(Regex.Match(html, @"(?<=var json = )(\[\{.*?\}\])(?=;)").Value);
|
||||
foreach (var dict1 in provList)
|
||||
{
|
||||
var prefName = dict2.GetValueOrDefault("diji");
|
||||
var city = new SysRegion
|
||||
var list = new List<SysRegion>();
|
||||
var provName = dict1.GetValueOrDefault("shengji");
|
||||
var province = new SysRegion
|
||||
{
|
||||
Id = YitIdHelper.NextId(),
|
||||
Code = dict2.GetValueOrDefault("quHuaDaiMa"),
|
||||
CityCode = dict2.GetValueOrDefault("quhao"),
|
||||
Pid = province.Id,
|
||||
Name = prefName,
|
||||
Level = 2
|
||||
Name = Regex.Replace(provName, "[((].*?[))]", ""),
|
||||
Code = dict1.GetValueOrDefault("quHuaDaiMa"),
|
||||
CityCode = dict1.GetValueOrDefault("quhao"),
|
||||
Level = 1,
|
||||
Pid = 0,
|
||||
};
|
||||
if (municipalityList.Any(m => city.Name.StartsWith(m))) city.Name += "(地)";
|
||||
list.Add(city);
|
||||
if (municipalityList.Any(m => province.Name.StartsWith(m))) province.Name += "(省)";
|
||||
list.Add(province);
|
||||
|
||||
if (syncLevel <= 2) continue;
|
||||
if (input.Level <= 1) continue;
|
||||
|
||||
var countyList = await GetSelectList(provName, prefName);
|
||||
foreach (var dict3 in countyList)
|
||||
var prefList = await GetSelectList(provName);
|
||||
foreach (var dict2 in prefList)
|
||||
{
|
||||
var countyName = dict3.GetValueOrDefault("xianji");
|
||||
var county = new SysRegion
|
||||
var prefName = dict2.GetValueOrDefault("diji");
|
||||
var city = new SysRegion
|
||||
{
|
||||
Id = YitIdHelper.NextId(),
|
||||
Code = dict3.GetValueOrDefault("quHuaDaiMa"),
|
||||
CityCode = dict3.GetValueOrDefault("quhao"),
|
||||
Name = countyName,
|
||||
Pid = city.Id,
|
||||
Level = 3
|
||||
Code = dict2.GetValueOrDefault("quHuaDaiMa"),
|
||||
CityCode = dict2.GetValueOrDefault("quhao"),
|
||||
Pid = province.Id,
|
||||
Name = prefName,
|
||||
Level = 2
|
||||
};
|
||||
list.Add(county);
|
||||
}
|
||||
}
|
||||
if (municipalityList.Any(m => city.Name.StartsWith(m))) city.Name += "(地)";
|
||||
list.Add(city);
|
||||
|
||||
await _sysRegionRep.AsDeleteable().ExecuteCommandAsync();
|
||||
await _sysRegionRep.Context.Fastest<SysRegion>().BulkCopyAsync(list);
|
||||
if (input.Level <= 2) continue;
|
||||
|
||||
var countyList = await GetSelectList(provName, prefName);
|
||||
foreach (var dict3 in countyList)
|
||||
{
|
||||
var countyName = dict3.GetValueOrDefault("xianji");
|
||||
var county = new SysRegion
|
||||
{
|
||||
Id = YitIdHelper.NextId(),
|
||||
Code = dict3.GetValueOrDefault("quHuaDaiMa"),
|
||||
CityCode = dict3.GetValueOrDefault("quhao"),
|
||||
Name = countyName,
|
||||
Pid = city.Id,
|
||||
Level = 3
|
||||
};
|
||||
list.Add(county);
|
||||
}
|
||||
}
|
||||
|
||||
await _sysRegionRep.AsDeleteable().ExecuteCommandAsync();
|
||||
await _sysRegionRep.Context.Fastest<SysRegion>().BulkCopyAsync(list);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw Oops.Oh(ex);
|
||||
}
|
||||
|
||||
// 获取选择数据
|
||||
@ -257,18 +263,15 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
/// <summary>
|
||||
/// 同步行政区划(高德) 🔖
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("同步行政区划(高德)")]
|
||||
public async Task SyncRegionGD(string key)
|
||||
public async Task SyncRegionGD(GDInput input)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(key) || key.Length < 30)
|
||||
if (string.IsNullOrWhiteSpace(input.Key) || input.Key.Length < 30)
|
||||
throw Oops.Oh("请正确输入高德地图开发者 Key 值");
|
||||
|
||||
var syncLevel = await _sysConfigService.GetConfigValueByCode<int>(ConfigConst.SysRegionSyncLevel);
|
||||
if (syncLevel is < 1 or > 5) syncLevel = 3; // 默认区县级
|
||||
|
||||
var res = await _httpRemoteService.GetAsync($"https://restapi.amap.com/v3/config/district?subdistrict={syncLevel}&key={key}");
|
||||
var res = await _httpRemoteService.GetAsync($"https://restapi.amap.com/v3/config/district?keywords={input.Keywords}&subdistrict={input.Level}&key={input.Key}");
|
||||
if (!res.IsSuccessStatusCode) return;
|
||||
|
||||
var gdResponse = JSON.Deserialize<GDResponse<List<GDRegionResponse>>>(res.Content.ReadAsStringAsync().Result);
|
||||
@ -301,9 +304,9 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[DisplayName("同步行政区划数据(国家地名信息库)")]
|
||||
public async Task<int> SyncRegionMca(long code)
|
||||
public async Task<int> SyncRegionMca(McaInput input)
|
||||
{
|
||||
var url = $"https://dmfw.mca.gov.cn/9095/xzqh/getList?code={code}&maxLevel=4";
|
||||
var url = $"https://dmfw.mca.gov.cn/9095/xzqh/getList?code={input.Code}&maxLevel={input.Level}";
|
||||
|
||||
var regionLevel0 = await _httpRemoteService.GetAsAsync<SysRegion>(url);
|
||||
if (regionLevel0 == null) return 0;
|
||||
@ -389,10 +392,10 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
}
|
||||
}
|
||||
|
||||
if (code == 0)
|
||||
if (input.Code == 0)
|
||||
await _sysRegionRep.AsDeleteable().ExecuteCommandAsync();
|
||||
else if (await _sysRegionRep.IsAnyAsync(u => u.Id == code)) // 如果存在指定行政区划则删除
|
||||
await DeleteRegion(new DeleteRegionInput { Id = code });
|
||||
else if (await _sysRegionRep.IsAnyAsync(u => u.Id == input.Code)) // 如果存在指定行政区划则删除
|
||||
await DeleteRegion(new DeleteRegionInput { Id = input.Code });
|
||||
return await _sysRegionRep.AsInsertable(areaList).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
@ -407,7 +410,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
||||
var url = $"http://api.tianditu.gov.cn/v2/administrative?keyword={input.Keyword}&childLevel={input.ChildLevel}&extensions={input.Extensions}&tk={input.Tk}";
|
||||
|
||||
var res = await _httpRemoteService.GetAsAsync<TiandituDto>(url);
|
||||
if (res == null) return 0;
|
||||
if (res == null || res.District == null) return 0;
|
||||
|
||||
var parent = res.District[0];
|
||||
var areaList = new List<SysRegion>()
|
||||
|
||||
56
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarExtensions.cs
Normal file
56
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarExtensions.cs
Normal file
@ -0,0 +1,56 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
namespace Admin.NET.Core.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// 切换数据库
|
||||
/// </summary>
|
||||
public static class SqlSugarExtensions
|
||||
{
|
||||
public static ISqlSugarClient ForTenant<TEntity>(this ISqlSugarClient db)
|
||||
{
|
||||
var attr = typeof(TEntity).GetCustomAttribute<TenantAttribute>();
|
||||
var tenantId = attr != null ? GetConfigIdFromAttribute(attr) : SqlSugarConst.DefaultTenantId;
|
||||
return db.AsTenant().GetConnection(tenantId ?? SqlSugarConst.DefaultTenantId);
|
||||
}
|
||||
|
||||
private static object GetConfigIdFromAttribute(TenantAttribute attr)
|
||||
{
|
||||
const string targetKey = "configId";
|
||||
var type = attr.GetType();
|
||||
|
||||
// 方式1:尝试通过属性获取
|
||||
var prop = type.GetProperty(targetKey, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
if (prop != null) return prop.GetValue(attr);
|
||||
|
||||
// 方式2:尝试通过私有字段获取
|
||||
var fieldNames = new[]
|
||||
{
|
||||
$"<{targetKey}>k__BackingField", // 自动属性字段
|
||||
$"_{targetKey}", // 常规私有字段 (如_configId)
|
||||
$"m_{targetKey}", // 匈牙利命名法
|
||||
"configId" // 直接字段访问
|
||||
};
|
||||
|
||||
foreach (var name in fieldNames)
|
||||
{
|
||||
var field = type.GetField(name, BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (field != null) return field.GetValue(attr);
|
||||
}
|
||||
|
||||
// 方式3:通过Dynamic访问(备用方案)
|
||||
try
|
||||
{
|
||||
dynamic d = attr;
|
||||
return d.configId;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,58 +0,0 @@
|
||||
|
||||
namespace Admin.NET.Core.Utils;
|
||||
public static class SqlSugarExtensions
|
||||
{
|
||||
private const string DefaultTenantId = "1300000000001";
|
||||
|
||||
public static ISqlSugarClient ForTenant<TEntity>(this ISqlSugarClient db)
|
||||
{
|
||||
var attr = typeof(TEntity).GetCustomAttribute<TenantAttribute>();
|
||||
var tenantId = attr != null ? GetConfigIdFromAttribute(attr) : DefaultTenantId;
|
||||
return db.AsTenant().GetConnection(tenantId ?? DefaultTenantId);
|
||||
}
|
||||
|
||||
private static string GetConfigIdFromAttribute(TenantAttribute attr)
|
||||
{
|
||||
const string targetKey = "configId";
|
||||
var type = attr.GetType();
|
||||
|
||||
// 方式1:尝试通过属性获取
|
||||
var prop = type.GetProperty(targetKey,
|
||||
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
if (prop != null)
|
||||
{
|
||||
return prop.GetValue(attr) as string;
|
||||
}
|
||||
|
||||
// 方式2:尝试通过私有字段获取
|
||||
var fieldNames = new[]
|
||||
{
|
||||
$"<{targetKey}>k__BackingField", // 自动属性字段
|
||||
$"_{targetKey}", // 常规私有字段 (如_configId)
|
||||
$"m_{targetKey}", // 匈牙利命名法
|
||||
"configId" // 直接字段访问
|
||||
};
|
||||
|
||||
foreach (var name in fieldNames)
|
||||
{
|
||||
var field = type.GetField(name,
|
||||
BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (field != null)
|
||||
{
|
||||
return field.GetValue(attr) as string;
|
||||
}
|
||||
}
|
||||
|
||||
// 方式3:通过Dynamic访问(备用方案)
|
||||
try
|
||||
{
|
||||
dynamic d = attr;
|
||||
return d.configId;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IGeekFan.AspNetCore.Knife4jUI" Version="0.0.16" />
|
||||
<PackageReference Include="MQTTnet.AspNetCore" Version="5.0.1.1416" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.2" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
@if(@Model.NameSpace != "Admin.NET.Core"){
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
@if(@Model.NameSpace != "Admin.NET.Core"){
|
||||
@:using Admin.NET.Core;
|
||||
}
|
||||
namespace @(@Model.NameSpace);
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
||||
@{
|
||||
|
||||
@ -1,4 +1,10 @@
|
||||
@{
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
@{
|
||||
string joinTableName = "u";
|
||||
Dictionary<string, int> definedObjects = new Dictionary<string, int>();
|
||||
bool haveLikeCdt = false;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
@{
|
||||
long lastId=0;
|
||||
long pid=0;
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
"vue3-flag-icons": "^0.0.3",
|
||||
"vue3-tree-org": "^4.2.2",
|
||||
"vxe-pc-ui": "^4.4.9",
|
||||
"vxe-table": "^4.11.20",
|
||||
"vxe-table": "^4.11.21",
|
||||
"vxe-table-plugin-element": "^4.0.4",
|
||||
"vxe-table-plugin-export-xlsx": "^4.0.7",
|
||||
"xe-utils": "^3.7.4",
|
||||
|
||||
@ -23,7 +23,10 @@ import { AdminNETResultInt64 } from '../models';
|
||||
import { AdminNETResultListSysRegion } from '../models';
|
||||
import { AdminNETResultSqlSugarPagedListSysRegion } from '../models';
|
||||
import { DeleteRegionInput } from '../models';
|
||||
import { GDInput } from '../models';
|
||||
import { GenOrgInput } from '../models';
|
||||
import { McaInput } from '../models';
|
||||
import { MzbInput } from '../models';
|
||||
import { PageRegionInput } from '../models';
|
||||
import { QueryRegionInput } from '../models';
|
||||
import { TiandituInput } from '../models';
|
||||
@ -433,17 +436,12 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划(高德) 🔖
|
||||
* @param {string} key
|
||||
* @param {GDInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiSysRegionSyncRegionGDKeyPost: async (key: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'key' is not null or undefined
|
||||
if (key === null || key === undefined) {
|
||||
throw new RequiredError('key','Required parameter key was null or undefined when calling apiSysRegionSyncRegionGDKeyPost.');
|
||||
}
|
||||
const localVarPath = `/api/sysRegion/syncRegionGD/{key}`
|
||||
.replace(`{${"key"}}`, encodeURIComponent(String(key)));
|
||||
apiSysRegionSyncRegionGDPost: async (body?: GDInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/sysRegion/syncRegionGD`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
let baseOptions;
|
||||
@ -463,6 +461,8 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
@ -473,6 +473,8 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
@ -482,17 +484,12 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划数据(国家地名信息库,最多支持2级深度) 🔖
|
||||
* @param {number} code
|
||||
* @param {McaInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiSysRegionSyncRegionMcaCodePost: async (code: number, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'code' is not null or undefined
|
||||
if (code === null || code === undefined) {
|
||||
throw new RequiredError('code','Required parameter code was null or undefined when calling apiSysRegionSyncRegionMcaCodePost.');
|
||||
}
|
||||
const localVarPath = `/api/sysRegion/syncRegionMca/{code}`
|
||||
.replace(`{${"code"}}`, encodeURIComponent(String(code)));
|
||||
apiSysRegionSyncRegionMcaPost: async (body?: McaInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/sysRegion/syncRegionMca`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
let baseOptions;
|
||||
@ -512,6 +509,8 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
@ -522,6 +521,8 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
@ -531,10 +532,11 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划(民政部) 🔖
|
||||
* @param {MzbInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiSysRegionSyncRegionMzbPost: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
apiSysRegionSyncRegionMzbPost: async (body?: MzbInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/sysRegion/syncRegionMzb`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
@ -555,6 +557,8 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
||||
}
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json-patch+json';
|
||||
|
||||
const query = new URLSearchParams(localVarUrlObj.search);
|
||||
for (const key in localVarQueryParameter) {
|
||||
query.set(key, localVarQueryParameter[key]);
|
||||
@ -565,6 +569,8 @@ export const SysRegionApiAxiosParamCreator = function (configuration?: Configura
|
||||
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
|
||||
localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || "");
|
||||
|
||||
return {
|
||||
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||
@ -792,12 +798,12 @@ export const SysRegionApiFp = function(configuration?: Configuration) {
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划(高德) 🔖
|
||||
* @param {string} key
|
||||
* @param {GDInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysRegionSyncRegionGDKeyPost(key: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||
const localVarAxiosArgs = await SysRegionApiAxiosParamCreator(configuration).apiSysRegionSyncRegionGDKeyPost(key, options);
|
||||
async apiSysRegionSyncRegionGDPost(body?: GDInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||
const localVarAxiosArgs = await SysRegionApiAxiosParamCreator(configuration).apiSysRegionSyncRegionGDPost(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
@ -806,12 +812,12 @@ export const SysRegionApiFp = function(configuration?: Configuration) {
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划数据(国家地名信息库,最多支持2级深度) 🔖
|
||||
* @param {number} code
|
||||
* @param {McaInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysRegionSyncRegionMcaCodePost(code: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminNETResultInt32>>> {
|
||||
const localVarAxiosArgs = await SysRegionApiAxiosParamCreator(configuration).apiSysRegionSyncRegionMcaCodePost(code, options);
|
||||
async apiSysRegionSyncRegionMcaPost(body?: McaInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminNETResultInt32>>> {
|
||||
const localVarAxiosArgs = await SysRegionApiAxiosParamCreator(configuration).apiSysRegionSyncRegionMcaPost(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
@ -820,11 +826,12 @@ export const SysRegionApiFp = function(configuration?: Configuration) {
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划(民政部) 🔖
|
||||
* @param {MzbInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysRegionSyncRegionMzbPost(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||
const localVarAxiosArgs = await SysRegionApiAxiosParamCreator(configuration).apiSysRegionSyncRegionMzbPost(options);
|
||||
async apiSysRegionSyncRegionMzbPost(body?: MzbInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||
const localVarAxiosArgs = await SysRegionApiAxiosParamCreator(configuration).apiSysRegionSyncRegionMzbPost(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
@ -951,31 +958,32 @@ export const SysRegionApiFactory = function (configuration?: Configuration, base
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划(高德) 🔖
|
||||
* @param {string} key
|
||||
* @param {GDInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysRegionSyncRegionGDKeyPost(key: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysRegionApiFp(configuration).apiSysRegionSyncRegionGDKeyPost(key, options).then((request) => request(axios, basePath));
|
||||
async apiSysRegionSyncRegionGDPost(body?: GDInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysRegionApiFp(configuration).apiSysRegionSyncRegionGDPost(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划数据(国家地名信息库,最多支持2级深度) 🔖
|
||||
* @param {number} code
|
||||
* @param {McaInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysRegionSyncRegionMcaCodePost(code: number, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultInt32>> {
|
||||
return SysRegionApiFp(configuration).apiSysRegionSyncRegionMcaCodePost(code, options).then((request) => request(axios, basePath));
|
||||
async apiSysRegionSyncRegionMcaPost(body?: McaInput, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminNETResultInt32>> {
|
||||
return SysRegionApiFp(configuration).apiSysRegionSyncRegionMcaPost(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划(民政部) 🔖
|
||||
* @param {MzbInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysRegionSyncRegionMzbPost(options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysRegionApiFp(configuration).apiSysRegionSyncRegionMzbPost(options).then((request) => request(axios, basePath));
|
||||
async apiSysRegionSyncRegionMzbPost(body?: MzbInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysRegionApiFp(configuration).apiSysRegionSyncRegionMzbPost(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -1099,34 +1107,35 @@ export class SysRegionApi extends BaseAPI {
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划(高德) 🔖
|
||||
* @param {string} key
|
||||
* @param {GDInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SysRegionApi
|
||||
*/
|
||||
public async apiSysRegionSyncRegionGDKeyPost(key: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysRegionApiFp(this.configuration).apiSysRegionSyncRegionGDKeyPost(key, options).then((request) => request(this.axios, this.basePath));
|
||||
public async apiSysRegionSyncRegionGDPost(body?: GDInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysRegionApiFp(this.configuration).apiSysRegionSyncRegionGDPost(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划数据(国家地名信息库,最多支持2级深度) 🔖
|
||||
* @param {number} code
|
||||
* @param {McaInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SysRegionApi
|
||||
*/
|
||||
public async apiSysRegionSyncRegionMcaCodePost(code: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultInt32>> {
|
||||
return SysRegionApiFp(this.configuration).apiSysRegionSyncRegionMcaCodePost(code, options).then((request) => request(this.axios, this.basePath));
|
||||
public async apiSysRegionSyncRegionMcaPost(body?: McaInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminNETResultInt32>> {
|
||||
return SysRegionApiFp(this.configuration).apiSysRegionSyncRegionMcaPost(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @summary 同步行政区划(民政部) 🔖
|
||||
* @param {MzbInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SysRegionApi
|
||||
*/
|
||||
public async apiSysRegionSyncRegionMzbPost(options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysRegionApiFp(this.configuration).apiSysRegionSyncRegionMzbPost(options).then((request) => request(this.axios, this.basePath));
|
||||
public async apiSysRegionSyncRegionMzbPost(body?: MzbInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysRegionApiFp(this.configuration).apiSysRegionSyncRegionMzbPost(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
||||
40
Web/src/api-services/models/gdinput.ts
Normal file
40
Web/src/api-services/models/gdinput.ts
Normal file
@ -0,0 +1,40 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Admin.NET 通用权限开发平台
|
||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 高德
|
||||
*
|
||||
* @export
|
||||
* @interface GDInput
|
||||
*/
|
||||
export interface GDInput {
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
* @memberof GDInput
|
||||
*/
|
||||
key?: string | null;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
* @memberof GDInput
|
||||
*/
|
||||
keywords?: string | null;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @memberof GDInput
|
||||
*/
|
||||
level?: number;
|
||||
}
|
||||
@ -231,6 +231,7 @@ export * from './filter-logic-enum';
|
||||
export * from './filter-operator-enum';
|
||||
export * from './finish-status-enum';
|
||||
export * from './from';
|
||||
export * from './gdinput';
|
||||
export * from './gen-auth-url-input';
|
||||
export * from './gen-org-input';
|
||||
export * from './gender-enum';
|
||||
@ -268,6 +269,7 @@ export * from './login-output';
|
||||
export * from './login-phone-input';
|
||||
export * from './login-user-output';
|
||||
export * from './mapping-type';
|
||||
export * from './mca-input';
|
||||
export * from './member-info';
|
||||
export * from './member-types';
|
||||
export * from './menu-output';
|
||||
@ -283,6 +285,7 @@ export * from './module-handle';
|
||||
export * from './mqtt-client-status';
|
||||
export * from './mqtt-protocol-version';
|
||||
export * from './mqtt-session-status';
|
||||
export * from './mzb-input';
|
||||
export * from './navigate';
|
||||
export * from './notice-input';
|
||||
export * from './notice-status-enum';
|
||||
|
||||
34
Web/src/api-services/models/mca-input.ts
Normal file
34
Web/src/api-services/models/mca-input.ts
Normal file
@ -0,0 +1,34 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Admin.NET 通用权限开发平台
|
||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 国家地名信息库
|
||||
*
|
||||
* @export
|
||||
* @interface McaInput
|
||||
*/
|
||||
export interface McaInput {
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @memberof McaInput
|
||||
*/
|
||||
code?: number;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @memberof McaInput
|
||||
*/
|
||||
level?: number;
|
||||
}
|
||||
28
Web/src/api-services/models/mzb-input.ts
Normal file
28
Web/src/api-services/models/mzb-input.ts
Normal file
@ -0,0 +1,28 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Admin.NET 通用权限开发平台
|
||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 民政部
|
||||
*
|
||||
* @export
|
||||
* @interface MzbInput
|
||||
*/
|
||||
export interface MzbInput {
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @memberof MzbInput
|
||||
*/
|
||||
level?: number;
|
||||
}
|
||||
@ -19,6 +19,20 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-form-item label="查询关键字(行政区名称、citycode、adcode)">
|
||||
<el-input v-model="state.ruleForm.keywords" placeholder="查询关键字" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-form-item label="行政区级数(不支持村级)">
|
||||
<el-input-number v-model="state.ruleForm.level" placeholder="行政区级数" class="w100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
@ -45,7 +59,10 @@ const emits = defineEmits(['handleQuery']);
|
||||
const ruleFormRef = ref();
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
ruleForm: {} as any,
|
||||
ruleForm: {
|
||||
keywords: '天津市',
|
||||
level: 5,
|
||||
} as any,
|
||||
isShowDialog: false,
|
||||
});
|
||||
|
||||
@ -83,10 +100,10 @@ const submit = () => {
|
||||
position: 'bottom-right',
|
||||
});
|
||||
state.loading = true;
|
||||
await getAPI(SysRegionApi).apiSysRegionSyncRegionGDKeyPost(state.ruleForm.key);
|
||||
await getAPI(SysRegionApi).apiSysRegionSyncRegionGDPost(state.ruleForm);
|
||||
closeDialog();
|
||||
|
||||
ElMessage.success('生成成功');
|
||||
state.loading = false;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -11,7 +11,14 @@
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-form-item label="指定区划代码 (0或不输入,导入全部数据)" prop="code">
|
||||
<el-input v-model="state.ruleForm.code" placeholder="指定区划代码" clearable />
|
||||
<el-input-number v-model="state.ruleForm.code" placeholder="指定区划代码" class="w100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-form-item label="行政区级数(最大查询深度,最多支持2级深度,不支持村级)">
|
||||
<el-input-number v-model="state.ruleForm.level" placeholder="行政区级数" class="w100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -44,13 +51,16 @@ const emits = defineEmits(['handleQuery']);
|
||||
const ruleFormRef = ref();
|
||||
const state = reactive({
|
||||
loading: false,
|
||||
ruleForm: {} as any,
|
||||
ruleForm: {
|
||||
code: 120000000000,
|
||||
level: 2,
|
||||
} as any,
|
||||
isShowDialog: false,
|
||||
});
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
state.ruleForm.code = '';
|
||||
state.ruleForm.code = 120000000000;
|
||||
ruleFormRef.value?.resetFields();
|
||||
state.isShowDialog = true;
|
||||
};
|
||||
@ -78,17 +88,10 @@ const submit = () => {
|
||||
position: 'bottom-right',
|
||||
});
|
||||
state.loading = true;
|
||||
try {
|
||||
if (state.ruleForm.code == '') {
|
||||
await getAPI(SysRegionApi).apiSysRegionSyncRegionMcaCodePost(0);
|
||||
} else {
|
||||
await getAPI(SysRegionApi).apiSysRegionSyncRegionMcaCodePost(state.ruleForm.code);
|
||||
}
|
||||
closeDialog();
|
||||
ElMessage.success('生成成功');
|
||||
} finally {
|
||||
state.loading = false;
|
||||
}
|
||||
await getAPI(SysRegionApi).apiSysRegionSyncRegionMcaPost(state.ruleForm);
|
||||
closeDialog();
|
||||
ElMessage.success('生成成功');
|
||||
state.loading = false;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -92,8 +92,8 @@ const submit = () => {
|
||||
state.loading = true;
|
||||
await getAPI(SysRegionApi).apiSysRegionSyncRegionTiandituPost(state.ruleForm);
|
||||
closeDialog();
|
||||
|
||||
ElMessage.success('生成成功');
|
||||
state.loading = false;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -271,6 +271,7 @@ const syncMzbRegion = async () => {
|
||||
await getAPI(SysRegionApi).apiSysRegionSyncRegionMzbPost();
|
||||
options.loading = false;
|
||||
ElMessage.success('生成成功');
|
||||
options.loading = false;
|
||||
};
|
||||
|
||||
// 生成组织架构
|
||||
|
||||
Loading…
Reference in New Issue
Block a user