diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index 6042e405..06754eb5 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -4,8 +4,6 @@ using BBWY.Common.Extensions; using BBWY.Common.Http; using BBWY.Common.Models; using GalaSoft.MvvmLight.Command; -using Jd.Api; -using Jd.Api.Request; using Microsoft.Web.WebView2.Core; using System; using System.Collections.Generic; diff --git a/BBWY.Test/Program.cs b/BBWY.Test/Program.cs index 47af5573..631ac2e5 100644 --- a/BBWY.Test/Program.cs +++ b/BBWY.Test/Program.cs @@ -2,8 +2,9 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text; using System.Text.RegularExpressions; - +using io = System.IO; namespace BBWY.Test { internal class Program @@ -12,30 +13,30 @@ namespace BBWY.Test static void Main(string[] args) { - IDictionary deliverySelfDic = new Dictionary() - { - {2 , "1274"} //厂家自送 - }; - var wayBillNoResponse = JObject.Parse("{\"LogisticsCompanyId\":\"101\",\"LogisticsCompanyName\":\"圆通速递(YTO)\",\"WayBillNo\":\"YT8150425043862\"}"); - var logisticsCompanyList = JArray.Parse("[{\"Id\":\"2087\",\"Name\":\"京东快递\"},{\"Id\":\"463\",\"Name\":\"圆通快递\"},{\"Id\":\"2170\",\"Name\":\"邮政快递包裹\"},{\"Id\":\"1327\",\"Name\":\"韵达快递\"},{\"Id\":\"680414\",\"Name\":\"中通快运\"},{\"Id\":\"467\",\"Name\":\"顺丰快递\"},{\"Id\":\"256122\",\"Name\":\"UPS\"},{\"Id\":\"1747\",\"Name\":\"优速快递\"},{\"Id\":\"3046\",\"Name\":\"德邦快递\"},{\"Id\":\"465\",\"Name\":\"邮政EMS\"},{\"Id\":\"1665004\",\"Name\":\"云仓速递\"},{\"Id\":\"4832\",\"Name\":\"安能物流\"},{\"Id\":\"1499\",\"Name\":\"中通速递\"}]"); - - var companyId = ConvertLogisticsCompanyId(wayBillNoResponse.Value("LogisticsCompanyName"), logisticsCompanyList, 2, deliverySelfDic); - Console.WriteLine(companyId); - Console.ReadKey(); - } + var rootPath = @"C:\Users\pengcong001\Desktop"; + var resultList = new List(); + var minDate = 11; var maxDate = 25; + rootPath = @"C:\Users\pengcong001\Desktop\test"; - - private static string ConvertLogisticsCompanyId(string sourceLogisticsCompanyName, IList targetLogisticsList, int tagetLogisticsPlatform, IDictionary deliverySelfDic) - { - var match = Regex.Match(sourceLogisticsCompanyName, "(中通|圆通|申通|顺丰|韵达|邮政快递包裹|平邮|EMS|德邦|百世|天天|优速)"); - if (match.Success) + for (var i = minDate; i <= maxDate; i++) { - var sname = match.Groups[1].Value; - var targetLogistics = targetLogisticsList.FirstOrDefault(t => t.Value("Name").Contains(sname)); - if (targetLogistics != null) - return targetLogistics.Value("Id"); + var content = io.File.ReadAllText(io.Path.Combine(rootPath, $"2022-05-{i}.txt"), Encoding.UTF8); + var matches = Regex.Matches(content, @"""logisticsCompanyName"":\s*""(.+)"","); + foreach (Match match in matches) + { + if (match.Success) + { + var _1688logisticsCompanyName = match.Groups[1].Value; + if (!resultList.Any(s => s.Equals(_1688logisticsCompanyName))) + resultList.Add(_1688logisticsCompanyName); + } + } } - return deliverySelfDic[tagetLogisticsPlatform]; + Console.WriteLine(resultList.Count()); + + foreach (var s in resultList) + Console.WriteLine(s); + Console.ReadKey(); } } }