Merge branch 'script_gj' of http://gitlab.fangjia.com/dev0/main into script_gj

This commit is contained in:
2022-04-19 19:33:51 +08:00
2 changed files with 29 additions and 1 deletions
@@ -12,7 +12,8 @@ import com.fangjia.script.util.DateUtils
class DingTalkUtils {
static main(String[] args) {
Date now = DateUtils.parseFromTightByPattern("2021-08-01", "yyyy-MM-dd") ;
// 要导出的月份第一天
Date now = DateUtils.parseFromTightByPattern("2022-03-01", "yyyy-MM-dd") ;
String startTime = DateUtils.addMonth(now, -1) + " 00:00:00"
String monthStartTime = DateUtils.formatDateByPattern(now, "yyyy-MM-dd HH:mm:ss")
@@ -0,0 +1,27 @@
package com.fangjia.script.temp.shenjian.poi
import com.fangjia.core.util.GeoUtils
import com.fangjia.script.statistics.poi.AmapPoi
import com.fangjia.script.temp.shenjian.util.GaoDeUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
import org.apache.commons.collections.CollectionUtils
import org.apache.commons.lang.StringUtils
def ZS_MONGODB_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009";
final DBCollection ZS_REGION_CONN = MongoUtils.getCollectionByName2("fangjia", "region_block", ZS_MONGODB_URL)
ZS_REGION_CONN.find(new BasicDBObject()).batchSize(1000).each {obj ->
def city = obj.city
def org_name = obj.org_name
List<AmapPoi> result = GaoDeUtils.searchPoi(city, org_name, org_name, null)
if (CollectionUtils.isNotEmpty(result)) {
def location = result.get(0).location
def lon = location.split(",")[0]
def lat = location.split(",")[1]
ZS_REGION_CONN.update(new BasicDBObject("_id", obj._id),
new BasicDBObject('$set',new BasicDBObject("location", new BasicDBObject("lon", lon).append("lat", lat))))
}
}