|
|
@@ -37,7 +37,96 @@ public class SyncJob implements Job {
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
con();
|
|
|
- doSync();
|
|
|
+// doSync();
|
|
|
+// fix();
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void fix() {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ List<Record> datas = Db.find("select * from jinzai_jxs_area_xian where id = 10284");
|
|
|
+ codeNameMap.clear();
|
|
|
+ List<Record> areas = Db.find("select code,name,parent_code,type from tb_map_area_copy241023 where type<=4");
|
|
|
+ Map<String,Record> codeMap = new HashMap<String, Record>();
|
|
|
+ for (Record record : areas) {
|
|
|
+ String str = record.getStr("code");
|
|
|
+ String name = record.getStr("name");
|
|
|
+ codeMap.put(name, record);
|
|
|
+ codeNameMap.put(str, name);
|
|
|
+ }
|
|
|
+ List<Record> list = new ArrayList<Record>();
|
|
|
+ for (Record data :datas) {
|
|
|
+ String name = data.getStr("jxs");
|
|
|
+ String code = data.getStr("code");
|
|
|
+ String city = null;
|
|
|
+ if(WxUtil.isNull(name)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(name.length()<6){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Record info = new Record();
|
|
|
+ String temp = name.substring(0,3);
|
|
|
+
|
|
|
+ String lastStr = "";
|
|
|
+
|
|
|
+ String province = null;
|
|
|
+ int index = 2;
|
|
|
+ if(temp.endsWith("省") || "黑龙江".equals(temp) || "内蒙古".equals(temp)){
|
|
|
+ province = name.substring(0,3);
|
|
|
+ lastStr = name.substring(3);
|
|
|
+ index = 3;
|
|
|
+ }else{
|
|
|
+ lastStr = name.substring(2);
|
|
|
+ province = name.substring(0,2);
|
|
|
+ }
|
|
|
+ int length = lastStr.length();
|
|
|
+ String userName = lastStr.substring(length-2,length);
|
|
|
+ String cityName = null;
|
|
|
+ try{
|
|
|
+ cityName = lastStr.substring(0,length-2);
|
|
|
+ }catch(Exception e){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isBigCity(province)){
|
|
|
+ province = city = province+"市";
|
|
|
+ }else{
|
|
|
+ String containName = containName(codeMap,cityName);
|
|
|
+ if(containName != null){
|
|
|
+ String[] find = find(codeMap, containName);
|
|
|
+ province = find[0];
|
|
|
+ city = find[1];
|
|
|
+ }else{
|
|
|
+ userName = lastStr.substring(length-3);
|
|
|
+ cityName = lastStr.substring(0,length-3);
|
|
|
+ containName = containName(codeMap,cityName);
|
|
|
+ if(containName != null){
|
|
|
+ String[] find = find(codeMap, containName);
|
|
|
+ province = find[0];
|
|
|
+ city = find[1];
|
|
|
+ }else{
|
|
|
+ if(cityName.length() >=3){
|
|
|
+ cityName = cityName.substring(0,2);
|
|
|
+ }
|
|
|
+ containName = containName(codeMap,cityName);
|
|
|
+ if(containName != null){
|
|
|
+ String[] find = find(codeMap, containName);
|
|
|
+ province = find[0];
|
|
|
+ city = find[1];
|
|
|
+ }else{
|
|
|
+ System.out.println("无法获取,"+name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info.set("jxs", name).set("code", code).set("city", city).set("province", province);
|
|
|
+
|
|
|
+ list.add(info);
|
|
|
+
|
|
|
+ }
|
|
|
+ WxUtil.batchSaveReplace("jinzai_jxs_area", list, "");
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private static void doSync() {
|
|
|
@@ -217,7 +306,7 @@ public class SyncJob implements Job {
|
|
|
|
|
|
@Override
|
|
|
public void execute(JobExecutionContext arg0) throws JobExecutionException {
|
|
|
- doSync();
|
|
|
+// doSync();
|
|
|
}
|
|
|
|
|
|
private static String getAiChuangToken() {
|