Merge remote-tracking branch 'origin/master'

This commit is contained in:
majintao
2024-09-02 10:01:45 +08:00
2 changed files with 97 additions and 21 deletions
@@ -192,12 +192,78 @@ class DevProcess {
}
}
def findDev(city, name){
def findDev( name){
def obj = findDevByName(name)
if(!obj){
obj = findDevByAlias(name)
if(obj){
obj.match_way = "别名"
}
}else{
obj.match_way = "相同"
}
return obj
}
def findDebBySimlar(def devs, def name, def city){
name = name.replace("经济开发区", "经济技术开发区").replace("工业园区", "工业园")
def last = null
for(def d : devs){
def alias1 = null
if(!d.alias){
alias1 = []
}else{
alias1 = d.alias
}
if(!alias1.contains(d.name)){
alias1 << d.name
}
if(alias1){
try {
for(def n : alias1){
n = n.replace("经济开发区", "经济技术开发区").replace("工业园区", "工业园")
if(d.city && d.city.contains(city) && (n.contains(name) || name.contains(n))){
last = d
break
}
}
}catch(exception){
println alias1
}
}
if(last){
break
}
}
return last
}
def findDevByName(name){
def q = new BasicDBObject()
q.put("name", name)
q.put("city", city)
def obj = development_zone_CONN.findOne(q)
return obj
return development_zone_CONN.findOne(q)
}
def findDevByAlias(name){
def q = new BasicDBObject()
q.put('alias', new BasicDBObject('$in',[name]))
return development_zone_CONN.findOne(q)
}
def findDevBySimlar(name){
def q = new BasicDBObject()
q.put('name',new BasicDBObject('$regex', Pattern.compile('^.*'+name+'.*$', Pattern.CASE_INSENSITIVE))) //名称 模糊查询
return development_zone_CONN.findOne(q)
}
def findDevByPark(prov, city, name){
def q = new BasicDBObject()
q.put('province',new BasicDBObject('$regex', Pattern.compile('^.*'+prov+'.*$', Pattern.CASE_INSENSITIVE))) //名称 模糊查询
q.put('city',new BasicDBObject('$regex', Pattern.compile('^.*'+city+'.*$', Pattern.CASE_INSENSITIVE))) //名称 模糊查询
q.put('park',new BasicDBObject('$regex', Pattern.compile('^.*'+name+'.*$', Pattern.CASE_INSENSITIVE))) //名称 模糊查询
q.put("type", "园区")
return dev_mapping_CONN.findOne(q)
}
def devSplitRoad(){
@@ -205,32 +271,32 @@ class DevProcess {
while(i<20){
def fileName = "/home/goojia/gj/qzd-${i}.xlsx"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\数据建设\\名录集\\qzd-${i}.xlsx"
fileName = "D:\\数据\\数据建设\\开发区\\新跑省份\\河北省\\test-${i}.xlsx"
}
File file=new File(fileName);
if(file.exists()){
ExcelUtils.multiThreadingModify(fileName,{d->
if(d['C'] && !d['R']){
if(d['C'] && !d['F']){
def jsonObject1 = com.fangjia.script.gj.district.FangjiaClientUtils.formatNinelevel(d['B'], d['C'])
if(jsonObject1) {
if (jsonObject1.get("dev") && jsonObject1.get("dev") != "null") {
def devName = jsonObject1.get("dev")
def obj = findDev(d['B'], devName)
def obj = findDev(devName)
d['F'] = devName
if(jsonObject1.containsKey("detail") && jsonObject1.detail.dev_confi!='null'){
d['U'] = jsonObject1.detail.dev_confi
d['S'] = jsonObject1.detail.dev_confi
}
if (obj) {
d['Q'] = obj._id.toString()
d['R'] = obj.name
d['O'] = obj._id.toString()
d['P'] = obj.name
d['U'] = obj.match_way
}
}
}
}
if(d['E'] && !d['S']) {
if(d['E'] && !d['M']) {
def jsonObject = com.fangjia.script.gj.district.FangjiaClientUtils.formatNinelevel(d['B'], d['E'])
def street = jsonObject.get("street")
def streetNumber = jsonObject.get("streetNumber")
@@ -280,14 +346,15 @@ class DevProcess {
if (jsonObject.get("dev") && jsonObject.get("dev") != "null") {
def devName = jsonObject.get("dev")
def obj = findDev(d['B'], devName)
def obj = findDev(devName)
d['M'] = devName
if (obj) {
d['S'] = obj._id.toString()
d['T'] = obj.name
d['Q'] = obj._id.toString()
d['R'] = obj.name
d['V'] = obj.match_way
}
if(jsonObject.containsKey("detail") && jsonObject.detail.dev_confi!='null'){
d['V'] = jsonObject.detail.dev_confi
d['T'] = jsonObject.detail.dev_confi
}
}
}
@@ -1,6 +1,7 @@
package com.fangjia.script.gj.district
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.addrepo.InvokeHttpRequest
import com.fangjia.script.statistics.poi.AmapPoi
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
import com.fangjia.script.temp.shenjian.util.HttpUtils
@@ -353,18 +354,26 @@ class FangjiaClientUtils {
def jsonObj = null
def content = null
def url = null
try {
address = address.replace("{","")
address = address.replace("{","")
int retryCount = 0
while (retryCount < 3) {
url = "http://192.168.0.93:8080/FangJiaNlpService/formatNinelevel?address="+URLEncoder.encode(address,"UTF-8")+"&complete=false&useMap=false&addressAssessment=true&fields=dev_confi"
if(city){
url = url +"&city="+URLEncoder.encode(city,"UTF-8")
}
content = new HttpRequest().newGet(url, null, "utf-8")
if (content) {
break
}
retryCount++
}
if (!content) {
return null
}
try {
jsonObj = JSONObject.fromObject(content)
// println jsonObj
} catch (Exception e) {
println address +" "+content
e.printStackTrace();
println address +" "+content+" "+e.getMessage()
}
return jsonObj;
}