Commit b72dec2e authored by Quxl's avatar Quxl

x

parent a72328ba
package com.egolm.film.api.service.impl; package com.egolm.film.api.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.egolm.film.api.service.CountryService; import com.egolm.film.api.service.CountryService;
@Service @Service
public class CountryServiceImpl implements CountryService { public class CountryServiceImpl implements CountryService {
private static final String en = "Albania,Algeria,Afghanistan,Argentina,The United Arab Emirates,Aruba,Oman,Azerbaijan,Egypt,Ethiopia,Ireland,Estonia,Andorra,Angola,Antigua,Austria,Australia,Barbados,papua new guinea,Bahamas,Pakistan,Paraguay,Palestine,Bahrain,Panama,Brazil,Belarus,Bermuda,Bulgaria,Benin,Belgium,Iceland,Puerto Rico,poland,Republic of Bosnia and Herzegovina,bolivia,belize,botswana,Bhutan,burkina faso,burundi,North Korea,Equatorial Guinea,Denmark,Germany,Timor-Leste,Togo,Dominican Republic,Russia,Ecuador,France,The Philippines,Fiji,Finland,Cape Verde,Gambia,Congo,Columbia,Costa Rica,Grenada,Georgia,Cuba,Guam,Guyana,Kazakhstan,Haiti,The Republic of Korea,Netherlands,The Netherlands Antilles,Djibouti,Kyrgyzstan,Guinea,Canada,Ghana,Gabon,Cambodia,Czech Republic,zimbabwe,Cameroon,Qatar,Cayman Islands,comodo,Ivory Coast,Kuwait,Republic of Croatia,Kenya,The Republic of Kurdistan,Cook Islands,Latvia,Lesotho,Laos,Lebanon,Lithuania,Liberia,Libya,Liechtenstein,Luxembourg,Rwanda,Romania,Madagascar,Maldives,Malta,Malawi,Malaysia,Mali,Macedonia,Mauritius,Mauritania,U.S.A,American Samoa,Mongolia,bangladesh,Peru,Myanmar,Moldova,Morocco,Monaco,Mozambique,Mexico,Namibia,South Africa,Yugoslavia,Nauru,Nepal,Nicaragua,Niger,Nigeria,Norway,Portugal,Trinidad island and Tobey Island,Japan,Sweden,Switzerland,Salvatore,Serbia,Sierra leone,Senegal,Cyprus,Saudi Arabia,Sao Tome and Principe generation,Saint Lucia,San Marino,Sri Lanka,Slovakia,Slovenia,Swaziland,Sultan,Suriname,Solomon Islands,Somalia,Tajikistan,Thailand,Tanzania,Tonga,Tunisia,Turkey,Turkmenistan,Vanuatu,Guatemala,Virgin Islands,Venezuela,Brunei,Uganda,Ukraine,Uruguay,Uzbekistan,Spain,Samoa,Greece,Singapore,New Zealand,Hungary,Syria,Jamaica,Armenia,Yemen,Iraq,Iran,Israel,Italy,India,Indonesia,Britain,British Virgin Islands,Jordan,Vietnam,Zambia,zaire,Chad,Chile,Central African,Macao,Taiwan,Hong Kong,China,Montenegro,Kosovo"; //private static final String en = "Albania,Algeria,Afghanistan,Argentina,The United Arab Emirates,Aruba,Oman,Azerbaijan,Egypt,Ethiopia,Ireland,Estonia,Andorra,Angola,Antigua,Austria,Australia,Barbados,papua new guinea,Bahamas,Pakistan,Paraguay,Palestine,Bahrain,Panama,Brazil,Belarus,Bermuda,Bulgaria,Benin,Belgium,Iceland,Puerto Rico,poland,Republic of Bosnia and Herzegovina,bolivia,belize,botswana,Bhutan,burkina faso,burundi,North Korea,Equatorial Guinea,Denmark,Germany,Timor-Leste,Togo,Dominican Republic,Russia,Ecuador,France,The Philippines,Fiji,Finland,Cape Verde,Gambia,Congo,Columbia,Costa Rica,Grenada,Georgia,Cuba,Guam,Guyana,Kazakhstan,Haiti,The Republic of Korea,Netherlands,The Netherlands Antilles,Djibouti,Kyrgyzstan,Guinea,Canada,Ghana,Gabon,Cambodia,Czech Republic,zimbabwe,Cameroon,Qatar,Cayman Islands,comodo,Ivory Coast,Kuwait,Republic of Croatia,Kenya,The Republic of Kurdistan,Cook Islands,Latvia,Lesotho,Laos,Lebanon,Lithuania,Liberia,Libya,Liechtenstein,Luxembourg,Rwanda,Romania,Madagascar,Maldives,Malta,Malawi,Malaysia,Mali,Macedonia,Mauritius,Mauritania,U.S.A,American Samoa,Mongolia,bangladesh,Peru,Myanmar,Moldova,Morocco,Monaco,Mozambique,Mexico,Namibia,South Africa,Yugoslavia,Nauru,Nepal,Nicaragua,Niger,Nigeria,Norway,Portugal,Trinidad island and Tobey Island,Japan,Sweden,Switzerland,Salvatore,Serbia,Sierra leone,Senegal,Cyprus,Saudi Arabia,Sao Tome and Principe generation,Saint Lucia,San Marino,Sri Lanka,Slovakia,Slovenia,Swaziland,Sultan,Suriname,Solomon Islands,Somalia,Tajikistan,Thailand,Tanzania,Tonga,Tunisia,Turkey,Turkmenistan,Vanuatu,Guatemala,Virgin Islands,Venezuela,Brunei,Uganda,Ukraine,Uruguay,Uzbekistan,Spain,Samoa,Greece,Singapore,New Zealand,Hungary,Syria,Jamaica,Armenia,Yemen,Iraq,Iran,Israel,Italy,India,Indonesia,Britain,British Virgin Islands,Jordan,Vietnam,Zambia,zaire,Chad,Chile,Central African,Macao,Taiwan,Hong Kong,China,Montenegro,Kosovo";
private static final String zh = "阿尔巴尼亚,阿尔及利亚,阿富汗,阿根廷,阿拉伯联合酋长国,阿卢巴岛,阿曼,阿塞拜疆,埃及,埃塞俄比亚,爱尔兰,爱沙尼亚,安道尔,安哥拉,安提,奥地利,澳大利亚,巴巴多斯,巴布亚新几内亚,巴哈马,巴基斯坦,巴拉圭,巴勒斯坦,巴林,巴拿马,巴西,白俄罗斯,百慕大群岛,保加利亚,贝宁,比利时,冰岛,波多黎各,波兰,波斯尼亚和黑塞哥维那共和国,玻利维亚,伯里兹,博茨瓦纳,不丹,布基纳法索,布隆迪,朝鲜,赤道几内亚,丹麦,德国,东帝汶,多哥,多米尼加共和国,俄罗斯,厄瓜多尔,法国,菲律宾,斐济,芬兰,佛得角,冈比亚,刚果,哥伦比亚,哥斯达黎加,格林纳达,格鲁吉亚,古巴,关岛,圭亚那,哈萨克斯坦,海地,韩国,荷兰,荷属安的列斯,吉布提,吉尔吉斯斯坦,几内亚,加拿大,加纳,加蓬,柬埔寨,捷克共和国,津巴布韦,喀麦隆,卡塔尔,开曼群岛,科摩多,科特迪瓦,科威特,克罗地亚共和国,肯尼亚,库尔德斯坦共和国,库克群岛,拉脱维亚,莱索托,老挝,黎巴嫩,立陶宛,利比里亚,利比亚,列支敦士登,卢森堡,卢旺达,罗马尼亚,马达加斯加,马尔代夫,马耳他,马拉维,马来西亚,马里,马其顿,毛里求斯,毛里塔尼亚,美国,美属萨摩亚,蒙古,孟加拉国,秘鲁,缅甸,摩尔多瓦,摩洛哥,摩纳哥,莫桑比克,墨西哥,纳米比亚,南非,南斯拉夫,瑙鲁,尼泊尔,尼加拉瓜,尼日尔,尼日利亚,挪威,葡萄牙,千里达岛和托贝哥岛,日本,瑞典,瑞士,萨尔瓦多,塞尔维亚,塞拉里昂,塞内加尔,塞浦路斯,沙特阿拉伯,圣多美和普林西代,圣路西亚,圣马力诺,斯里兰卡,斯洛伐克,斯洛文尼亚,斯威士兰,苏丹,苏里南,所罗门群岛,索马里,塔吉克斯坦,泰国,坦桑尼亚,汤加,突尼斯,土耳其,土库曼斯坦,瓦努阿图,危地马拉,维尔京群岛,委内瑞拉,文莱,乌干达,乌克兰,乌拉圭,乌兹别克斯坦,西班牙,西属萨摩亚,希腊,新加坡,新西兰,匈牙利,叙利亚,牙买加,亚美尼亚,也门,伊拉克,伊朗,以色列,意大利,印度,印度尼西亚,英国,英属维尔京群岛,约旦,越南,赞比亚,扎伊尔,乍得,智利,中非,澳门,台湾,香港,中国,黑山,科索沃"; //private static final String zh = "阿尔巴尼亚,阿尔及利亚,阿富汗,阿根廷,阿拉伯联合酋长国,阿卢巴岛,阿曼,阿塞拜疆,埃及,埃塞俄比亚,爱尔兰,爱沙尼亚,安道尔,安哥拉,安提,奥地利,澳大利亚,巴巴多斯,巴布亚新几内亚,巴哈马,巴基斯坦,巴拉圭,巴勒斯坦,巴林,巴拿马,巴西,白俄罗斯,百慕大群岛,保加利亚,贝宁,比利时,冰岛,波多黎各,波兰,波斯尼亚和黑塞哥维那共和国,玻利维亚,伯里兹,博茨瓦纳,不丹,布基纳法索,布隆迪,朝鲜,赤道几内亚,丹麦,德国,东帝汶,多哥,多米尼加共和国,俄罗斯,厄瓜多尔,法国,菲律宾,斐济,芬兰,佛得角,冈比亚,刚果,哥伦比亚,哥斯达黎加,格林纳达,格鲁吉亚,古巴,关岛,圭亚那,哈萨克斯坦,海地,韩国,荷兰,荷属安的列斯,吉布提,吉尔吉斯斯坦,几内亚,加拿大,加纳,加蓬,柬埔寨,捷克共和国,津巴布韦,喀麦隆,卡塔尔,开曼群岛,科摩多,科特迪瓦,科威特,克罗地亚共和国,肯尼亚,库尔德斯坦共和国,库克群岛,拉脱维亚,莱索托,老挝,黎巴嫩,立陶宛,利比里亚,利比亚,列支敦士登,卢森堡,卢旺达,罗马尼亚,马达加斯加,马尔代夫,马耳他,马拉维,马来西亚,马里,马其顿,毛里求斯,毛里塔尼亚,美国,美属萨摩亚,蒙古,孟加拉国,秘鲁,缅甸,摩尔多瓦,摩洛哥,摩纳哥,莫桑比克,墨西哥,纳米比亚,南非,南斯拉夫,瑙鲁,尼泊尔,尼加拉瓜,尼日尔,尼日利亚,挪威,葡萄牙,千里达岛和托贝哥岛,日本,瑞典,瑞士,萨尔瓦多,塞尔维亚,塞拉里昂,塞内加尔,塞浦路斯,沙特阿拉伯,圣多美和普林西代,圣路西亚,圣马力诺,斯里兰卡,斯洛伐克,斯洛文尼亚,斯威士兰,苏丹,苏里南,所罗门群岛,索马里,塔吉克斯坦,泰国,坦桑尼亚,汤加,突尼斯,土耳其,土库曼斯坦,瓦努阿图,危地马拉,维尔京群岛,委内瑞拉,文莱,乌干达,乌克兰,乌拉圭,乌兹别克斯坦,西班牙,西属萨摩亚,希腊,新加坡,新西兰,匈牙利,叙利亚,牙买加,亚美尼亚,也门,伊拉克,伊朗,以色列,意大利,印度,印度尼西亚,英国,英属维尔京群岛,约旦,越南,赞比亚,扎伊尔,乍得,智利,中非,澳门,台湾,香港,中国,黑山,科索沃";
private static final String json = "[{\"China\":\"中国\"},{\"U.S.A\":\"美国\"},{\"Germany\":\"德国\"},{\"Japan\":\"日本\"},{\"France\":\"法国\"},{\"Italy\":\"意大利\"},{\"Canada\":\"加拿大\"},{\"Brazil\":\"巴西\"},{\"Spain\":\"西班牙\"},{\"India\":\"印度\"},{\"Thailand\":\"泰国\"},{\"Indonesia\":\"印度尼西亚\"},{\"Albania\":\"阿尔巴尼亚\"},{\"Algeria\":\"阿尔及利亚\"},{\"Afghanistan\":\"阿富汗\"},{\"Argentina\":\"阿根廷\"},{\"The United Arab Emirates\":\"阿拉伯联合酋长国\"},{\"Aruba\":\"阿卢巴岛\"},{\"Oman\":\"阿曼\"},{\"Azerbaijan\":\"阿塞拜疆\"},{\"Egypt\":\"埃及\"},{\"Ethiopia\":\"埃塞俄比亚\"},{\"Ireland\":\"爱尔兰\"},{\"Estonia\":\"爱沙尼亚\"},{\"Andorra\":\"安道尔\"},{\"Angola\":\"安哥拉\"},{\"Antigua\":\"安提\"},{\"Austria\":\"奥地利\"},{\"Australia\":\"澳大利亚\"},{\"Barbados\":\"巴巴多斯\"},{\"papua new guinea\":\"巴布亚新几内亚\"},{\"Bahamas\":\"巴哈马\"},{\"Pakistan\":\"巴基斯坦\"},{\"Paraguay\":\"巴拉圭\"},{\"Palestine\":\"巴勒斯坦\"},{\"Bahrain\":\"巴林\"},{\"Panama\":\"巴拿马\"},{\"Belarus\":\"白俄罗斯\"},{\"Bermuda\":\"百慕大群岛\"},{\"Bulgaria\":\"保加利亚\"},{\"Benin\":\"贝宁\"},{\"Belgium\":\"比利时\"},{\"Iceland\":\"冰岛\"},{\"Puerto Rico\":\"波多黎各\"},{\"poland\":\"波兰\"},{\"Republic of Bosnia and Herzegovina\":\"波斯尼亚和黑塞哥维那共和国\"},{\"bolivia\":\"玻利维亚\"},{\"belize\":\"伯里兹\"},{\"botswana\":\"博茨瓦纳\"},{\"Bhutan\":\"不丹\"},{\"burkina faso\":\"布基纳法索\"},{\"burundi\":\"布隆迪\"},{\"North Korea\":\"朝鲜\"},{\"Equatorial Guinea\":\"赤道几内亚\"},{\"Denmark\":\"丹麦\"},{\"Timor-Leste\":\"东帝汶\"},{\"Togo\":\"多哥\"},{\"Dominican Republic\":\"多米尼加共和国\"},{\"Russia\":\"俄罗斯\"},{\"Ecuador\":\"厄瓜多尔\"},{\"The Philippines\":\"菲律宾\"},{\"Fiji\":\"斐济\"},{\"Finland\":\"芬兰\"},{\"Cape Verde\":\"佛得角\"},{\"Gambia\":\"冈比亚\"},{\"Congo\":\"刚果\"},{\"Columbia\":\"哥伦比亚\"},{\"Costa Rica\":\"哥斯达黎加\"},{\"Grenada\":\"格林纳达\"},{\"Georgia\":\"格鲁吉亚\"},{\"Cuba\":\"古巴\"},{\"Guam\":\"关岛\"},{\"Guyana\":\"圭亚那\"},{\"Kazakhstan\":\"哈萨克斯坦\"},{\"Haiti\":\"海地\"},{\"The Republic of Korea\":\"韩国\"},{\"Netherlands\":\"荷兰\"},{\"The Netherlands Antilles\":\"荷属安的列斯\"},{\"Djibouti\":\"吉布提\"},{\"Kyrgyzstan\":\"吉尔吉斯斯坦\"},{\"Guinea\":\"几内亚\"},{\"Ghana\":\"加纳\"},{\"Gabon\":\"加蓬\"},{\"Cambodia\":\"柬埔寨\"},{\"Czech Republic\":\"捷克共和国\"},{\"zimbabwe\":\"津巴布韦\"},{\"Cameroon\":\"喀麦隆\"},{\"Qatar\":\"卡塔尔\"},{\"Cayman Islands\":\"开曼群岛\"},{\"comodo\":\"科摩多\"},{\"Ivory Coast\":\"科特迪瓦\"},{\"Kuwait\":\"科威特\"},{\"Republic of Croatia\":\"克罗地亚共和国\"},{\"Kenya\":\"肯尼亚\"},{\"The Republic of Kurdistan\":\"库尔德斯坦共和国\"},{\"Cook Islands\":\"库克群岛\"},{\"Latvia\":\"拉脱维亚\"},{\"Lesotho\":\"莱索托\"},{\"Laos\":\"老挝\"},{\"Lebanon\":\"黎巴嫩\"},{\"Lithuania\":\"立陶宛\"},{\"Liberia\":\"利比里亚\"},{\"Libya\":\"利比亚\"},{\"Liechtenstein\":\"列支敦士登\"},{\"Luxembourg\":\"卢森堡\"},{\"Rwanda\":\"卢旺达\"},{\"Romania\":\"罗马尼亚\"},{\"Madagascar\":\"马达加斯加\"},{\"Maldives\":\"马尔代夫\"},{\"Malta\":\"马耳他\"},{\"Malawi\":\"马拉维\"},{\"Malaysia\":\"马来西亚\"},{\"Mali\":\"马里\"},{\"Macedonia\":\"马其顿\"},{\"Mauritius\":\"毛里求斯\"},{\"Mauritania\":\"毛里塔尼亚\"},{\"American Samoa\":\"美属萨摩亚\"},{\"Mongolia\":\"蒙古\"},{\"bangladesh\":\"孟加拉国\"},{\"Peru\":\"秘鲁\"},{\"Myanmar\":\"缅甸\"},{\"Moldova\":\"摩尔多瓦\"},{\"Morocco\":\"摩洛哥\"},{\"Monaco\":\"摩纳哥\"},{\"Mozambique\":\"莫桑比克\"},{\"Mexico\":\"墨西哥\"},{\"Namibia\":\"纳米比亚\"},{\"South Africa\":\"南非\"},{\"Yugoslavia\":\"南斯拉夫\"},{\"Nauru\":\"瑙鲁\"},{\"Nepal\":\"尼泊尔\"},{\"Nicaragua\":\"尼加拉瓜\"},{\"Niger\":\"尼日尔\"},{\"Nigeria\":\"尼日利亚\"},{\"Norway\":\"挪威\"},{\"Portugal\":\"葡萄牙\"},{\"Trinidad island and Tobey Island\":\"千里达岛和托贝哥岛\"},{\"Sweden\":\"瑞典\"},{\"Switzerland\":\"瑞士\"},{\"Salvatore\":\"萨尔瓦多\"},{\"Serbia\":\"塞尔维亚\"},{\"Sierra leone\":\"塞拉里昂\"},{\"Senegal\":\"塞内加尔\"},{\"Cyprus\":\"塞浦路斯\"},{\"Saudi Arabia\":\"沙特阿拉伯\"},{\"Sao Tome and Principe generation\":\"圣多美和普林西代\"},{\"Saint Lucia\":\"圣路西亚\"},{\"San Marino\":\"圣马力诺\"},{\"Sri Lanka\":\"斯里兰卡\"},{\"Slovakia\":\"斯洛伐克\"},{\"Slovenia\":\"斯洛文尼亚\"},{\"Swaziland\":\"斯威士兰\"},{\"Sultan\":\"苏丹\"},{\"Suriname\":\"苏里南\"},{\"Solomon Islands\":\"所罗门群岛\"},{\"Somalia\":\"索马里\"},{\"Tajikistan\":\"塔吉克斯坦\"},{\"Tanzania\":\"坦桑尼亚\"},{\"Tonga\":\"汤加\"},{\"Tunisia\":\"突尼斯\"},{\"Turkey\":\"土耳其\"},{\"Turkmenistan\":\"土库曼斯坦\"},{\"Vanuatu\":\"瓦努阿图\"},{\"Guatemala\":\"危地马拉\"},{\"Virgin Islands\":\"维尔京群岛\"},{\"Venezuela\":\"委内瑞拉\"},{\"Brunei\":\"文莱\"},{\"Uganda\":\"乌干达\"},{\"Ukraine\":\"乌克兰\"},{\"Uruguay\":\"乌拉圭\"},{\"Uzbekistan\":\"乌兹别克斯坦\"},{\"Samoa\":\"西属萨摩亚\"},{\"Greece\":\"希腊\"},{\"Singapore\":\"新加坡\"},{\"New Zealand\":\"新西兰\"},{\"Hungary\":\"匈牙利\"},{\"Syria\":\"叙利亚\"},{\"Jamaica\":\"牙买加\"},{\"Armenia\":\"亚美尼亚\"},{\"Yemen\":\"也门\"},{\"Iraq\":\"伊拉克\"},{\"Iran\":\"伊朗\"},{\"Israel\":\"以色列\"},{\"Britain\":\"英国\"},{\"British Virgin Islands\":\"英属维尔京群岛\"},{\"Jordan\":\"约旦\"},{\"Vietnam\":\"越南\"},{\"Zambia\":\"赞比亚\"},{\"zaire\":\"扎伊尔\"},{\"Chad\":\"乍得\"},{\"Chile\":\"智利\"},{\"Central African\":\"中非\"},{\"Macao\":\"澳门\"},{\"Taiwan\":\"台湾\"},{\"Hong Kong\":\"香港\"},{\"Montenegro\":\"黑山\"},{\"Kosovo\":\"科索沃\"}]";
public List<Map<String, String>> queryCountryList() { public List<Map<String, String>> queryCountryList() {
List<Map<String, String>> list = new ArrayList<Map<String, String>>(); List<Map<String, String>> list = new ArrayList<Map<String, String>>();
String[] keys = en.split(","); for(Object obj: JSON.parseArray(json)) {
String[] vals = zh.split(","); Map<?, ?> objMap = (Map<?, ?>)obj;
if(keys.length == vals.length) { list.add(objMap.entrySet().stream().collect(Collectors.toMap((e) -> (String)e.getKey(), (e) -> (String)e.getValue())));
for(int i = 0; i < keys.length; i++) {
Map<String, String> map = new HashMap<String, String>();
map.put(vals[i], keys[i]);
list.add(map);
}
} }
return list; return list;
} }
public static void main(String[] args) {
System.out.println(JSON.toJSONString(new CountryServiceImpl().queryCountryList()));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment