😎1、优化同步行政区划(同步民政部) 2、升级依赖

This commit is contained in:
zuohuaijun 2025-04-10 02:58:10 +08:00
parent 5f0201bd98
commit 986de8e331
6 changed files with 49 additions and 39 deletions

View File

@ -22,15 +22,15 @@
<ItemGroup>
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="3.1.2" />
<PackageReference Include="AlipaySDKNet.Standard" Version="4.9.448" />
<PackageReference Include="AlipaySDKNet.Standard" Version="4.9.481" />
<PackageReference Include="AngleSharp" Version="1.2.0" />
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.1" Aliases="BouncyCastleV2" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.17.3" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.38" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.38" />
<PackageReference Include="Furion.Pure" Version="4.9.7.38" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.17.4" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.39" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.39" />
<PackageReference Include="Furion.Pure" Version="4.9.7.39" />
<PackageReference Include="Hardware.Info" Version="101.0.1" />
<PackageReference Include="Hashids.net" Version="1.7.0" />
<PackageReference Include="IPTools.China" Version="1.6.0" />
@ -50,13 +50,13 @@
<PackageReference Include="QRCoder" Version="1.6.0" />
<PackageReference Include="RabbitMQ.Client" Version="7.1.2" />
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.4" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.7.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.8.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.11.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.188" />
<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.1216" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1217" />
<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.2.0" />
<PackageReference Include="AspNet.Security.OAuth.Weixin" Version="9.2.0" />
<PackageReference Include="Lazy.Captcha.Core" Version="2.1.0" />
<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.AspNetCore.DataProtection.StackExchangeRedis" Version="9.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" Version="9.0.4" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.5.0" />
<PackageReference Include="My.Extensions.Localization.Json" Version="3.4.0" />
</ItemGroup>

View File

@ -187,17 +187,19 @@ public class SysRegionService : IDynamicApiController, ITransient
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)
var aa = Regex.Match(html, @"(?<=var json = )(\[\{.*?\}\])(?=;)").Value;
dynamic provList = Clay.Parse(aa);
var list = new List<SysRegion>();
foreach (var proItem in provList)
{
var list = new List<SysRegion>();
var provName = dict1.GetValueOrDefault("shengji");
var provName = proItem.shengji;
var province = new SysRegion
{
Id = YitIdHelper.NextId(),
Name = Regex.Replace(provName, "[(].*?[)]", ""),
Code = dict1.GetValueOrDefault("quHuaDaiMa"),
CityCode = dict1.GetValueOrDefault("quhao"),
Code = proItem.quHuaDaiMa,
CityCode = proItem.quhao,
Level = 1,
Pid = 0,
};
@ -206,17 +208,17 @@ public class SysRegionService : IDynamicApiController, ITransient
if (input.Level <= 1) continue;
var prefList = await GetSelectList(provName);
foreach (var dict2 in prefList)
var cityList = await GetSelectList(provName);
foreach (var cityItem in cityList)
{
var prefName = dict2.GetValueOrDefault("diji");
var cityName = cityItem.diji;
var city = new SysRegion
{
Id = YitIdHelper.NextId(),
Code = dict2.GetValueOrDefault("quHuaDaiMa"),
CityCode = dict2.GetValueOrDefault("quhao"),
Code = cityItem.quHuaDaiMa,
CityCode = cityItem.quhao,
Pid = province.Id,
Name = prefName,
Name = cityName,
Level = 2
};
if (municipalityList.Any(m => city.Name.StartsWith(m))) city.Name += "(地)";
@ -224,23 +226,31 @@ public class SysRegionService : IDynamicApiController, ITransient
if (input.Level <= 2) continue;
var countyList = await GetSelectList(provName, prefName);
foreach (var dict3 in countyList)
var countyList = await GetSelectList(provName, cityName);
foreach (var countyItem in countyList)
{
var countyName = dict3.GetValueOrDefault("xianji");
var countyName = countyItem.xianji;
var county = new SysRegion
{
Id = YitIdHelper.NextId(),
Code = dict3.GetValueOrDefault("quHuaDaiMa"),
CityCode = dict3.GetValueOrDefault("quhao"),
Code = countyItem.quHuaDaiMa,
CityCode = countyItem.quhao,
Name = countyName,
Pid = city.Id,
Level = 3
};
if (city.Code.IsNullOrEmpty())
{
// 省直辖县级行政单位 节点无Code编码处理
city.Code = county.Code.Substring(0, 3).PadRight(6, '0');
}
list.Add(county);
}
}
}
if (list.Count > 0)
{
await _sysRegionRep.AsDeleteable().ExecuteCommandAsync();
await _sysRegionRep.Context.Fastest<SysRegion>().BulkCopyAsync(list);
}
@ -251,14 +261,14 @@ public class SysRegionService : IDynamicApiController, ITransient
}
// 获取选择数据
async Task<List<Dictionary<string, string>>> GetSelectList(string prov, string prefecture = null)
async Task<Clay> GetSelectList(string prov, string prefecture = null)
{
var json = await _httpRemoteService.PostAsStringAsync("http://xzqh.mca.gov.cn/selectJson", builder => builder.SetJsonContent(new
{
shengji = prov,
diji = prefecture,
}));
return JSON.Deserialize<List<Dictionary<string, string>>>(json);
return Clay.Parse(json);
}
}

View File

@ -109,7 +109,7 @@ public static class VerifyFileExtensionName
foreach (var len in dic)
{
byte[] b = new byte[len];
_ = stream.Read(b, 0, b.Length);
stream.ReadExactly(b);
// string fileType = System.Text.Encoding.UTF8.GetString(b);
string fileKey = GetFileHeader(b);
if (DicsExt.ContainsKey(fileKey))

View File

@ -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.3" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="9.0.4" />
</ItemGroup>
<ItemGroup>

View File

@ -26,7 +26,7 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.13.0" />
<PackageReference Include="Rezero.Api" Version="1.8.5" />
<PackageReference Include="Rezero.Api" Version="1.8.7" />
</ItemGroup>
<ItemGroup>

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro",
"type": "module",
"version": "2.4.33",
"lastBuildTime": "2025.04.05",
"lastBuildTime": "2025.04.10",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun",
"license": "MIT",
@ -25,7 +25,7 @@
"@vue-office/docx": "^1.6.2",
"@vue-office/excel": "^1.7.14",
"@vue-office/pdf": "^2.0.9",
"@vueuse/core": "^13.0.0",
"@vueuse/core": "^13.1.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"animate.css": "^4.1.1",
@ -53,7 +53,7 @@
"mqtt": "^5.10.4",
"nprogress": "^0.2.0",
"ol": "^10.5.0",
"pinia": "^3.0.1",
"pinia": "^3.0.2",
"print-js": "^1.6.0",
"push.js": "^1.0.12",
"qrcodejs2-fixes": "^0.0.2",
@ -77,7 +77,7 @@
"vue-signature-pad": "^3.0.2",
"vue3-flag-icons": "^0.0.3",
"vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.5.12",
"vxe-pc-ui": "^4.5.16",
"vxe-table": "^4.12.5",
"vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.7",
@ -91,8 +91,8 @@
"@types/node": "^20.17.30",
"@types/nprogress": "^0.2.3",
"@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.29.0",
"@typescript-eslint/eslint-plugin": "^8.29.1",
"@typescript-eslint/parser": "^8.29.1",
"@vitejs/plugin-vue": "^5.2.3",
"@vitejs/plugin-vue-jsx": "^4.1.2",
"@vue/compiler-sfc": "^3.5.13",
@ -101,7 +101,7 @@
"eslint-plugin-vue": "^10.0.0",
"globals": "^16.0.0",
"less": "^4.3.0",
"openapi-ts-request": "^1.3.0",
"openapi-ts-request": "^1.3.1",
"prettier": "^3.5.3",
"rollup-plugin-visualizer": "^5.14.0",
"sass": "^1.86.3",