Selaa lähdekoodia

自动生成学校Code方法,和AzureStorageTable的查询和删除方法

Li 3 vuotta sitten
vanhempi
commit
573f1ed324

+ 82 - 0
TEAMModelOS.SDK/DI/AzureStorage/AzureStorageTableExtensions.cs

@@ -513,5 +513,87 @@ namespace TEAMModelOS.SDK.DI
                 default: return null;
             }
         }
+
+
+        /// <summary>
+        /// 查询条件传string类型
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="azureStorage"></param>
+        /// <param name="strWhere">查询条件| 例:$"RowKey {QueryComparisons.GreaterThanOrEqual} '{123456}' {TableOperators.And} RowKey {QueryComparisons.LessThanOrEqual} '{123456}'" </param>
+        /// <returns></returns>
+        public static async Task<List<T>> QueryWhereString<T>(this AzureStorageFactory azureStorage, string strWhere = null) where T : TableEntity, new()
+        {
+            CloudTable TableName = await azureStorage.InitializeTable<T>();
+            var exQuery = new TableQuery<T>();
+            exQuery.Where(strWhere);
+            return await QueryList<T>(exQuery, TableName);
+        }
+
+        /// <summary>
+        /// 删除单个记录
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="azureStorage"></param>
+        /// <param name="partitionKey"></param>
+        /// <param name="rowKey"></param>
+        /// <returns></returns>
+        public static async Task<TableResult> DeleteSingle<T>(this AzureStorageFactory azureStorage, string partitionKey, string rowKey) where T : ITableEntity, new()
+        {
+            // query all rows
+            CloudTable TableName = await azureStorage.InitializeTable<T>();
+            var queryOperation = TableOperation.Retrieve<T>(partitionKey, rowKey);
+
+            var tableResult = await TableName.ExecuteAsync(queryOperation);
+            if (tableResult.Result is T item)
+            {
+                var deleteOperation = TableOperation.Delete(item);
+                var dels = await TableName.ExecuteAsync(deleteOperation);
+                return dels;
+            }
+            else return null;
+        }
+
+        /// <summary>
+        /// 删除多个  带有后期优化该方法
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="azureStorage"></param>
+        /// <param name="rowKey"></param>
+        /// <returns></returns>
+        public static async Task<List<string>> DeleteStringWhere<T>(this AzureStorageFactory azureStorage, string rowKey) where T : ITableEntity, new()
+        {
+            // query all rows
+            CloudTable TableName = await azureStorage.InitializeTable<T>();
+
+            var exQuery = new TableQuery<T>();
+            exQuery.Where(rowKey);
+            TableContinuationToken continuationToken = null;
+            List<T> entitys = new List<T>();
+            do
+            {
+                var result = await TableName.ExecuteQuerySegmentedAsync(exQuery, continuationToken);                
+                if (result.Results.Count > 0)
+                {
+                    entitys.AddRange(result.ToList());
+                }
+                continuationToken = result.ContinuationToken;
+            } while (continuationToken != null);
+
+            List<string> ster = new List<string>();
+            foreach (var item in entitys)
+            {
+                var queryOperation = TableOperation.Retrieve<T>(item.PartitionKey, item.RowKey);
+                var tableResult = await TableName.ExecuteAsync(queryOperation);
+                if (tableResult.Result is T items)
+                {
+                    var deleteOperation = TableOperation.Delete(items);
+                    await TableName.ExecuteAsync(deleteOperation);
+                    ster.Add(items.RowKey);
+                }
+            }
+
+            return ster;
+        }
     }
 }

+ 19 - 0
TEAMModelOS.SDK/Models/Cosmos/BI/CreateSchoolInfo.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TEAMModelOS.SDK.Models.Cosmos.BI
+{
+    /// <summary>
+    /// 创校使用
+    /// </summary>
+    public class CreateSchoolInfo
+    {
+        public string province { get; set; }
+        public string id { get; set; }
+        public int createCount { get; set; }
+        public string name { get; set; }
+        public string city { get; set; }
+        public string aname { get; set; }
+    }
+}

+ 653 - 0
TEAMModelOS.SDK/Models/Service/SchoolCode.cs

@@ -0,0 +1,653 @@
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.International.Converters.PinYinConverter;
+using Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK.Extension;
+using TEAMModelOS.SDK.Models.Cosmos.BI;
+
+namespace TEAMModelOS.SDK.Models.Service
+{
+    public class SchoolCode
+    {
+        /// <summary>
+        /// 依据彬哥写的生成的学校Code所改的方法
+        /// </summary>
+        /// <param name="json"></param>
+        /// <param name="_dingDing"></param>
+        /// <param name="_environment"></param>
+        /// <returns></returns>
+        public static async Task<CreateSchoolInfo> GenerateSchoolCode(CreateSchoolInfo schoolInfo, DingDing _dingDing, IWebHostEnvironment _environment)
+        {
+            string path = $"{_environment.ContentRootPath}/JsonFile/Region/region.json";
+
+            StreamReader streamReader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Encoding.UTF8);
+            StringBuilder stringBuilder = new StringBuilder();
+            string text;
+            while ((text = streamReader.ReadLine()) != null)
+            {
+                stringBuilder.Append(text.ToString());
+            }
+            streamReader.Close();
+            string input = stringBuilder.ToString();
+            List<Region> region = input.ToObject<List<Region>>();
+            schoolInfo.province = ChineseConverter.Convert(schoolInfo.province, ChineseConversionDirection.TraditionalToSimplified);
+            if (String.IsNullOrEmpty(schoolInfo.city))
+            {
+                schoolInfo.city = schoolInfo.province;
+            }
+            else
+            {
+                schoolInfo.city = ChineseConverter.Convert(schoolInfo.city, ChineseConversionDirection.TraditionalToSimplified);
+            }
+
+            schoolInfo.name = ChineseConverter.Convert(schoolInfo.name, ChineseConversionDirection.TraditionalToSimplified);
+            comeRemoveStr.ForEach(c => { schoolInfo.province = schoolInfo.province.Replace(c, ""); });
+            prvcRemoveStr.ForEach(c => { schoolInfo.province = schoolInfo.province.Replace(c, ""); });
+            var province = region.Find(r => r.name.Contains(schoolInfo.province));
+            string tmpprovince = schoolInfo.province;
+            string tmpcity = schoolInfo.city;
+            if (province != null)
+            {
+                schoolInfo.province = province.name;
+                comeRemoveStr.ForEach(c => { schoolInfo.city = schoolInfo.city.Replace(c, ""); });
+                cityRemoveStr.ForEach(c => { schoolInfo.city = schoolInfo.city.Replace(c, ""); });
+                nationRemoveStr.ForEach(c => { schoolInfo.city = schoolInfo.city.Replace(c, ""); });
+
+                tmpcity = schoolInfo.city;
+                var city = province.children.Find(r => r.name.Contains(schoolInfo.city));
+
+                if (city == null)
+                {
+                    city = province.children.Find(r => r.name.Contains(schoolInfo.city));
+                    if (city == null)
+                    {
+                        city = province.children.SelectMany(x => x.children).ToList().Find(r => r.name.Contains(schoolInfo.city));
+                    }
+                }
+                if (city != null)
+                {
+                    schoolInfo.city = city.name;
+                }
+            }
+
+            string name = schoolInfo.name;
+            //去除冗余的学校信息,只保留地名和校名关键信息
+            schemoveStr.ForEach(str =>
+            {
+                name = name.Replace(str, "");
+            });
+            string[] names = name.Split("(");
+
+            if (names.Length > 1)
+            {
+                name = $"{names[0]}";
+                for (int index = 1; index < names.Length; index++)
+                {
+                    name = $"{name}{names[index].Substring(0, 1)}";
+                    var afnames = names[index].Split(")");
+                    if (afnames.Length > 1)
+                    {
+                        for (int i = 1; i < afnames.Length; i++)
+                        {
+                            name = $"{name}{afnames[i]}";
+                        }
+                    }
+                }
+            }
+
+            names = name.Split("(");
+            if (names.Length > 1)
+            {
+                name = $"{names[0]}";
+                for (int index = 1; index < names.Length; index++)
+                {
+                    name = $"{name}{names[index].Substring(0, 1)}";
+                    var afnames = names[index].Split(")");
+                    if (afnames.Length > 1)
+                    {
+                        for (int i = 1; i < afnames.Length; i++)
+                        {
+                            name = $"{name}{afnames[i]}";
+                        }
+                    }
+                }
+            }
+
+            name = Regex.Replace(name, "[ \\[ \\] \\^ \\-|()【】/' {}_*×――(^)$%~!@#$…&%¥—+=<>《》!!???::•`·、。,;,.;\"‘’“”-]", " ");
+            //检查是否有英文
+            if (Regex.Matches(name, "[a-zA-Z]").Count > 0)
+            {
+                var array = Regex.Split(name, "\\s+", RegexOptions.IgnoreCase);
+                StringBuilder tmpname = new StringBuilder();
+                if (array.Length > 1)
+                {
+                    foreach (var item in array)
+                    {
+                        var arr = item.Select(x => $"{x}");
+                        int index = 0;
+                        foreach (var stra in arr)
+                        {
+                            if (Regex.Matches(stra, "[a-zA-Z]").Count > 0)
+                            {
+                                if (index == 1 || index == 0)
+                                {
+                                    tmpname.Append(stra);
+                                }
+                                else
+                                {
+
+                                }
+                            }
+                            else
+                            {
+                                tmpname.Append(stra);
+                            }
+                            index++;
+                        }
+                    }
+                }
+                else
+                {
+                    var arr = name.Select(x => $"{x}");
+                    int index = 0;
+                    foreach (var stra in arr)
+                    {
+                        if (Regex.Matches(stra, "[A-Z]").Count > 0)
+                        {
+                            tmpname.Append(stra);
+                        }
+                        else if (Regex.Matches(stra, "[a-z]").Count > 0)
+                        {
+                        }
+                        else
+                        {
+                            tmpname.Append(stra);
+                        }
+                        index++;
+                    }
+
+                }
+                name = tmpname.ToString();
+            }
+
+            name = Regex.Replace(name, @"\s", "");
+            name = name.Replace("\\", "");
+            if (name.Length > 6)
+            {
+                //新区,高新,产业等非新政单位
+                areaRemoveStr.ForEach(str =>
+                {
+                    name = name.Replace(str.Key, str.Value);
+                });
+                //去除冗余的学校信息,只保留地名和校名关键信息
+                schooRemoveStr.ForEach(str =>
+                {
+                    name = name.Replace(str, "");
+                });
+
+                //替换民族信息词
+                if (name.Length > 6)
+                {
+                    nationRemoveStr.ForEach(str =>
+                    {
+                        name = name.Replace(str, "");
+                    });
+                }
+                //替换学校信息的副词
+                if (name.Length > 6)
+                {
+                    foreach (var str in schooReplaceStr)
+                    {
+                        if (name.Length <= 6)
+                        {
+                            break;
+                        }
+                        name = name.Replace(str.Key, str.Value);
+
+                    }
+                }
+                //替换省简称信息词
+                string tmpname = name;
+                if (name.Length > 6)
+                {
+                    proReplaceStr.ForEach(str =>
+                    {
+                        name = name.Replace(str.Key, str.Value);
+                    });
+                    //如果替换后仍然大于6位,则取消,直接替换省份完整的词
+                    if (name.Length > 6)
+                    {
+                        name = tmpname.Replace(tmpprovince, "");
+                    }
+                }
+                //替换城市信息词
+                if (name.Length > 6)
+                {
+                    name = name.Replace(tmpcity, "");
+                }
+
+            }
+            int len = name.Length;
+            if (len > 6)
+            {
+                foreach (var str in afterSchoolRm)
+                {
+                    if (name.Length <= 6)
+                    {
+                        break;
+                    }
+                    name = name.Replace(str, "");
+                }
+            }
+            len = name.Length;
+            if (len >= 6)
+            {
+                name = $"{name.Substring(0, 1)}{name.Substring(len - 5, 3)}{name.Substring(len - 2, 2)}";
+            }
+            //if (len <= 7 && len > 6)
+            //{
+            //    name = name.Substring(len - 6);
+            //}
+            if (len <= 4)
+            {
+                name = $"{schoolInfo.city.Substring(0, 2)}{name}";
+            }
+            if (len == 5)
+            {
+                name = $"{schoolInfo.city.Substring(0, 1)}{name}";
+            }
+            string code = ToFirstPinYin(name);
+            schoolInfo.aname = name;
+            schoolInfo.id = code;
+
+            switch (schoolInfo.createCount)
+            {
+                case 1:
+                    if (schoolInfo.id.Equals(code))
+                    {
+                        string a_z = "abcdefghijklmnopqrstuvwxyz";
+                        var fs = schoolInfo.aname.Select(x => x).ToArray();
+                        var sp = schoolInfo.name.Select(x => x).ToArray();
+                        int Len = sp.Length;
+                        if (sp.Length >= fs.Length)
+                        {
+                            len = fs.Count();
+                        }
+
+                        for (int index = 0; index < len; index++)
+                        {
+                            if ($"{sp[index]}".Equals($"{fs[index]}"))
+                            {
+                                short st = ChineseChar.GetStrokeNumber(sp[index]);
+                                if (st > 0)
+                                {
+                                    var ins = st % 27;
+                                    var insch = a_z[ins];
+                                    if (schoolInfo.aname.EndsWith($"{insch}"))
+                                    {
+                                        ins = (st + 1) % 27;
+                                        insch = a_z[ins];
+                                    }
+                                    schoolInfo.id = schoolInfo.id.Insert(index, $"{insch}").Remove(index + 1, 1);
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                    break;
+                case 2:
+                    if (schoolInfo.id.Equals(code))
+                    {
+                        var fs = schoolInfo.aname.Select(x => x).ToArray();
+                        var sp = schoolInfo.name.Select(x => x).ToArray();
+                        int Len = sp.Length;
+                        if (sp.Length >= fs.Length)
+                        {
+                            len = fs.Count();
+                        }
+
+                        for (int index = 0; index < len; index++)
+                        {
+                            if (!$"{sp[index]}".Equals($"{fs[index]}"))
+                            {
+                                var spstr = ToPinYin($"{sp[index]}");
+                                var fsstr = ToPinYin($"{fs[index]}");
+                                var insch = spstr.Select(x => $"{x}").Except(fsstr.Select(z => $"{z}"));
+                                if (insch != null && insch.Count() > 0)
+                                {
+                                    if (index > 1)
+                                    {
+                                        schoolInfo.id = schoolInfo.id.Insert(index - 1, insch.First()).Remove(index, 1);
+                                    }
+                                    else if (index == 1)
+                                    {
+                                        schoolInfo.id = schoolInfo.id.Insert(index, insch.First()).Remove(index - 1, 1);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    break;
+                case 3:
+                    if (schoolInfo.id.Equals(code))
+                    {
+                        string letter = RandomSmallLetter(1, false);
+                        string small = code.Substring(0, code.Length - 1);
+                        bool end = code.EndsWith(letter);
+                        if (end)
+                        {
+                            string tempLetter = RandomSmallLetter(1, false);
+                            schoolInfo.id = $"{small}{tempLetter}";
+                        }
+                        else 
+                        {
+                            schoolInfo.id = $"{small}{letter}";
+                        }
+                    }
+                    break;
+                default:
+                    break;
+            }
+
+            return schoolInfo;
+        }
+
+        /// <summary>
+        /// 生成随机字母
+        /// </summary>
+        /// <param name="Length">长度</param>
+        /// <param name="Sleep">是否要在生成前将当前线程阻止以避免重复</param>
+        /// <returns></returns>
+        public static string RandomSmallLetter(int Length, bool Sleep)
+        {
+            if (Sleep) System.Threading.Thread.Sleep(3);
+            char[] Pattern = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
+            string result = "";
+            int n = Pattern.Length;
+            System.Random random = new Random(~unchecked((int)DateTime.Now.Ticks));
+            for (int i = 0; i < Length; i++)
+            {
+                int rnd = random.Next(0, n);
+                result += Pattern[rnd];
+            }
+            return result;
+        }
+
+        public static string ToPinYin(string val)
+        {
+            StringBuilder sb = new StringBuilder();
+            val.ToCharArray().ToList().ForEach(x =>
+            {
+                if (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z') || ('0' <= x && x <= '9'))
+                {
+                    sb.Append(x);
+                }
+                else
+                {
+                    try
+                    {
+                        ChineseChar cc = new ChineseChar(x);
+                        if (cc.Pinyins.Count > 0 && cc.Pinyins[0].Length > 0)
+                        {
+                            sb.Append(cc.Pinyins[0]);
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                    }
+                }
+            });
+            return sb.ToString().ToLower();
+        }
+        public static string ToFirstPinYin(string val)
+        {
+            StringBuilder sb = new StringBuilder();
+            val.ToCharArray().ToList().ForEach(x =>
+            {
+                if (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z') || ('0' <= x && x <= '9'))
+                {
+                    sb.Append(x);
+                }
+                else
+                {
+                    try
+                    {
+                        ChineseChar cc = new ChineseChar(x);
+                        if (cc.Pinyins.Count > 0 && cc.Pinyins[0].Length > 0)
+                        {
+                            sb.Append(cc.Pinyins[0][0]);
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                    }
+                }
+            });
+            return sb.ToString().ToLower();
+        }
+
+        public static List<string> comeRemoveStr = new List<string>() { "省", "市", "区", "州", "县", "旗", "盟", "自治" };
+        public static List<string> prvcRemoveStr = new List<string>() { "回族", "维吾尔", "壮族", };
+        public static List<string> cityRemoveStr = new List<string>() { "蒙古族", "地区", "壮族", "朝鲜族", "直辖" };
+        public static List<string> nationRemoveStr = new List<string> {
+            "维吾尔","回族", "自治", "满族", "蒙古", "壮族", "苗族" , "侗族", "瑶族",
+            "达斡尔","鄂温克","朝鲜","畲族","土家","各族","仫佬","毛南","羌族","彝族","仡佬","布依","水族",
+            "傣族","纳西","哈尼","拉祜","佤族","傈僳","独龙","怒族","白族","普米","固族","哈萨克","土族","撒拉","景颇","族"
+        };
+        public static List<string> schemoveStr = new List<string> { "第", "校区", "部", "楼", "与", "学校", "校园", };
+        public static List<string> schooRemoveStr = new List<string>() {"省", "市",  "区", "州", "县", "旗", "盟","办事处","街道", "自治",
+           "镇","村","乡","街","路","站","馆"
+        };
+        public static List<string> afterSchoolRm = new List<string>() {"校","园","院", "湾","峡","沟","山","庄",
+            "堡","江","屯","岭","溪","河","桥","营","铺","坡","寨","场","湖","巷","集","关","庙","寺","矿","塘"};
+        public static List<KeyValuePair<string, string>> areaRemoveStr = new List<KeyValuePair<string, string>>{
+            new KeyValuePair<string, string>("高新技术产业开发区", "高") ,
+             new KeyValuePair<string, string>("经济技术开发区", "经") ,
+            new KeyValuePair<string, string>("国际", "际") ,
+            new KeyValuePair<string, string>("中国", ""),
+            new KeyValuePair<string, string>("国家", ""),
+            new KeyValuePair<string, string>("新区", ""),
+            new KeyValuePair<string, string>("高新", "高"),
+            new KeyValuePair<string, string>("园区", ""),
+            new KeyValuePair<string, string>("产业", "产"),
+            new KeyValuePair<string, string>("经济", "经"),
+            new KeyValuePair<string, string>("开发", "开"),
+            new KeyValuePair<string, string>("中心", "") ,
+            new KeyValuePair<string, string>("集团", "") ,
+            new KeyValuePair<string, string>("公司", "") ,
+            new KeyValuePair<string, string>("有限", "") ,
+            new KeyValuePair<string, string>("股份", "") ,
+            new KeyValuePair<string, string>("服务", "") ,
+            new KeyValuePair<string, string>("基地", "") ,
+            new KeyValuePair<string, string>("社区", "社") ,
+            new KeyValuePair<string, string>("职工", "") ,
+            new KeyValuePair<string, string>("专修", ""),
+            new KeyValuePair<string, string>("实验", "验"),
+            new KeyValuePair<string, string>("完全", ""),
+            new KeyValuePair<string, string>("一贯制", "") ,
+            new KeyValuePair<string, string>("联办", ""),
+            new KeyValuePair<string, string>("联合", ""),
+            new KeyValuePair<string, string>("完小", "小"),
+            new KeyValuePair<string, string>("义务", ""),
+            new KeyValuePair<string, string>("基础", ""),
+            new KeyValuePair<string, string>("制造", "")
+        };
+        public static List<KeyValuePair<string, string>> schooReplaceStr = new List<KeyValuePair<string, string>> {
+            new KeyValuePair<string, string>("分校", "分") ,
+            new KeyValuePair<string, string>("分园", "分") ,
+            new KeyValuePair<string, string>("分院", "分") ,
+            new KeyValuePair<string, string>("藏文", "藏"),
+            new KeyValuePair<string, string>("职业技术学院", "职") ,
+            new KeyValuePair<string, string>("创新创业", "创") ,
+            new KeyValuePair<string, string>("就业创业", "就") ,
+            new KeyValuePair<string, string>("应用核技术", "核") ,
+            new KeyValuePair<string, string>("职业学院", "职") ,
+            new KeyValuePair<string, string>("幼儿园", "幼") ,
+            new KeyValuePair<string, string>("幼儿", "幼") ,
+            new KeyValuePair<string, string>("小学", "小") ,
+            new KeyValuePair<string, string>("中学", "中") ,
+            new KeyValuePair<string, string>("中等", "中") ,
+            new KeyValuePair<string, string>("双语", "双") ,
+            new KeyValuePair<string, string>("初中", "初") ,
+            new KeyValuePair<string, string>("初级", "初") ,
+            new KeyValuePair<string, string>("广播", "广"),
+            new KeyValuePair<string, string>("高中", "高") ,
+            new KeyValuePair<string, string>("高级", "高") ,
+            new KeyValuePair<string, string>("大学", "大") ,
+            new KeyValuePair<string, string>("学院", "院") ,
+            new KeyValuePair<string, string>("综合", "综") ,
+            new KeyValuePair<string, string>("职业", "职") ,
+            new KeyValuePair<string, string>("技术", "技") ,
+            new KeyValuePair<string, string>("专科", "专") ,
+            new KeyValuePair<string, string>("外国语", "外"),
+            new KeyValuePair<string, string>("九年", "九") ,
+            new KeyValuePair<string, string>("五年", "五") ,
+            new KeyValuePair<string, string>("年制", "制") ,
+            new KeyValuePair<string, string>("高等", "高") ,
+            new KeyValuePair<string, string>("院校", "院") ,
+            new KeyValuePair<string, string>("初等", "小") ,
+            new KeyValuePair<string, string>("附属", "附"),
+            new KeyValuePair<string, string>("寄宿制", "寄") ,
+            new KeyValuePair<string, string>("寄宿", "寄") ,
+            new KeyValuePair<string, string>("卫生", "卫") ,
+            new KeyValuePair<string, string>("创业", "创") ,
+            new KeyValuePair<string, string>("继续", "继") ,
+            new KeyValuePair<string, string>("开放", "开") ,
+            new KeyValuePair<string, string>("技师", "技") ,
+            new KeyValuePair<string, string>("成人", "成") ,
+            new KeyValuePair<string, string>("教育", "教") ,
+            new KeyValuePair<string, string>("科技", "科") ,
+            new KeyValuePair<string, string>("行政", "政") ,
+            new KeyValuePair<string, string>("生物", "生") ,
+            new KeyValuePair<string, string>("美术", "美") ,
+            new KeyValuePair<string, string>("设计", "设") ,
+            new KeyValuePair<string, string>("传播", "传") ,
+            new KeyValuePair<string, string>("计算机", "算") ,
+            new KeyValuePair<string, string>("土木", "土") ,
+            new KeyValuePair<string, string>("石油", "油") ,
+            new KeyValuePair<string, string>("科普", "普") ,
+            new KeyValuePair<string, string>("电信", "信") ,
+            new KeyValuePair<string, string>("联合", "联") ,
+            new KeyValuePair<string, string>("电商", "商") ,
+            new KeyValuePair<string, string>("纺织", "织") ,
+            new KeyValuePair<string, string>("服装", "服") ,
+            new KeyValuePair<string, string>("新闻", "新") ,
+            new KeyValuePair<string, string>("网络", "网") ,
+            new KeyValuePair<string, string>("应用", "应") ,
+            new KeyValuePair<string, string>("畜牧", "畜") ,
+            new KeyValuePair<string, string>("兽医", "兽") ,
+            new KeyValuePair<string, string>("师范", "师") ,
+            new KeyValuePair<string, string>("人文", "文") ,
+            new KeyValuePair<string, string>("创新", "创") ,
+            new KeyValuePair<string, string>("法官", "法") ,
+            new KeyValuePair<string, string>("邮电", "邮") ,
+            new KeyValuePair<string, string>("文化", "文") ,
+            new KeyValuePair<string, string>("函授", "函") ,
+            new KeyValuePair<string, string>("科学", "科") ,
+            new KeyValuePair<string, string>("信息", "息") ,
+            new KeyValuePair<string, string>("水利", "利") ,
+            new KeyValuePair<string, string>("水电", "电") ,
+            new KeyValuePair<string, string>("电力", "力") ,
+            new KeyValuePair<string, string>("环境", "环") ,
+            new KeyValuePair<string, string>("建材", "材") ,
+            new KeyValuePair<string, string>("机电", "机") ,
+            new KeyValuePair<string, string>("航空", "空") ,
+            new KeyValuePair<string, string>("航天", "天") ,
+            new KeyValuePair<string, string>("警察", "警") ,
+            new KeyValuePair<string, string>("警官", "警") ,
+            new KeyValuePair<string, string>("财贸", "财") ,
+            new KeyValuePair<string, string>("电子", "电") ,
+            new KeyValuePair<string, string>("建筑", "筑") ,
+            new KeyValuePair<string, string>("艺术", "艺") ,
+            new KeyValuePair<string, string>("体育", "体") ,
+            new KeyValuePair<string, string>("城市", "城") ,
+            new KeyValuePair<string, string>("地质", "地") ,
+            new KeyValuePair<string, string>("医药", "药") ,
+            new KeyValuePair<string, string>("政法", "法") ,
+            new KeyValuePair<string, string>("铁路", "铁") ,
+            new KeyValuePair<string, string>("铁道", "道") ,
+            new KeyValuePair<string, string>("轨道", "轨") ,
+            new KeyValuePair<string, string>("交通", "通") ,
+            new KeyValuePair<string, string>("医学院", "医") ,
+            new KeyValuePair<string, string>("医学", "医") ,
+            new KeyValuePair<string, string>("传媒", "媒") ,
+            new KeyValuePair<string, string>("工程", "程") ,
+            new KeyValuePair<string, string>("临床", "临") ,
+            new KeyValuePair<string, string>("化工", "化") ,
+            new KeyValuePair<string, string>("林业", "林") ,
+            new KeyValuePair<string, string>("老年", "老") ,
+            new KeyValuePair<string, string>("旅游", "游") ,
+            new KeyValuePair<string, string>("护理", "护") ,
+            new KeyValuePair<string, string>("贸易", "贸") ,
+            new KeyValuePair<string, string>("中医药", "中医") ,
+            new KeyValuePair<string, string>("资源", "源") ,
+            new KeyValuePair<string, string>("冶金", "冶") ,
+            new KeyValuePair<string, string>("能源", "能") ,
+            new KeyValuePair<string, string>("汽车", "车") ,
+            new KeyValuePair<string, string>("医科", "医") ,
+            new KeyValuePair<string, string>("机械", "械") ,
+            new KeyValuePair<string, string>("应用", "应") ,
+            new KeyValuePair<string, string>("电气", "电") ,
+            new KeyValuePair<string, string>("材料", "材") ,
+            new KeyValuePair<string, string>("劳动", "劳") ,
+            new KeyValuePair<string, string>("轻工", "轻") ,
+            new KeyValuePair<string, string>("农业", "农") ,
+            new KeyValuePair<string, string>("委员会", "委") ,
+             new KeyValuePair<string, string>("专业", "专") ,
+            new KeyValuePair<string, string>("广播", "广"),
+            new KeyValuePair<string, string>("电视", "电") ,
+            new KeyValuePair<string, string>("工商", "商") ,
+            new KeyValuePair<string, string>("工业", "工") ,
+            new KeyValuePair<string, string>("管理", "管") ,
+            new KeyValuePair<string, string>("社会主义", "社") ,
+            new KeyValuePair<string, string>("社会", "社") ,
+            new KeyValuePair<string, string>("自动化", "自") ,
+        };
+        public static List<KeyValuePair<string, string>> proReplaceStr = new List<KeyValuePair<string, string>> {
+            new KeyValuePair<string, string>("北京","京") ,
+            new KeyValuePair<string, string>("天津","津") ,
+            new KeyValuePair<string, string>("河北","冀") ,
+            new KeyValuePair<string, string>("山西","晋") ,
+            new KeyValuePair<string, string>("内蒙古","蒙") ,
+            new KeyValuePair<string, string>("辽宁","辽") ,
+            new KeyValuePair<string, string>("吉林","吉") ,
+            new KeyValuePair<string, string>("黑龙江","黑") ,
+            new KeyValuePair<string, string>("上海","沪") ,
+            new KeyValuePair<string, string>("江苏","苏") ,
+            new KeyValuePair<string, string>("浙江","浙") ,
+            new KeyValuePair<string, string>("安徽","皖") ,
+            new KeyValuePair<string, string>("福建","闽") ,
+            new KeyValuePair<string, string>("江西","赣") ,
+            new KeyValuePair<string, string>("山东","鲁") ,
+            new KeyValuePair<string, string>("河南","豫") ,
+            new KeyValuePair<string, string>("湖北","鄂") ,
+            new KeyValuePair<string, string>("湖南","湘") ,
+            new KeyValuePair<string, string>("广东","粤") ,
+            new KeyValuePair<string, string>("广西","桂") ,
+            new KeyValuePair<string, string>("海南","琼") ,
+            new KeyValuePair<string, string>("四川","川") ,
+            new KeyValuePair<string, string>("贵州","贵") ,
+            new KeyValuePair<string, string>("云南","云") ,
+            new KeyValuePair<string, string>("重庆","渝") ,
+            new KeyValuePair<string, string>("西藏","藏") ,
+            new KeyValuePair<string, string>("陕西","陕") ,
+            new KeyValuePair<string, string>("甘肃","甘") ,
+            new KeyValuePair<string, string>("青海","青") ,
+            new KeyValuePair<string, string>("宁夏","宁") ,
+            new KeyValuePair<string, string>("新疆","新") ,
+            new KeyValuePair<string, string>("香港","港") ,
+            new KeyValuePair<string, string>("澳门","澳") ,
+            new KeyValuePair<string, string>("台湾","台")
+        };
+
+    }
+}