修改脚本
This commit is contained in:
-5
@@ -6,8 +6,6 @@ import com.fangjia.core.util.DateUtil;
|
||||
import com.fangjia.dal.mongo.model.OperationLog;
|
||||
import com.fangjia.service.mongo.bkoff.OperationLogService;
|
||||
import org.sothis.core.util.Pager;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -28,7 +26,6 @@ public class OperationLogController{
|
||||
put( "block" , "板块" );
|
||||
put( "address" , "地址" );
|
||||
put( "loop_line_info" , "环线" );
|
||||
put( "loop_line_info" , "环线" );
|
||||
put( "estate_type2" , "物业类型" );
|
||||
put( "street_community" , "街道社区" );
|
||||
put( "household_count" , "户数" );
|
||||
@@ -58,7 +55,6 @@ public class OperationLogController{
|
||||
put( "house_height" , "楼高" );
|
||||
put( "lease_term","租赁年限");
|
||||
put( "payment_pattern","付款方式");
|
||||
put( "rent_price","出租价格");
|
||||
put( "sell_price","出售价格");
|
||||
put( "floor","建筑楼层");
|
||||
put( "floor_info","楼层状况");
|
||||
@@ -66,7 +62,6 @@ public class OperationLogController{
|
||||
put( "characteristic","项目特色");
|
||||
put( "bay_area","开间面积");
|
||||
put( "finish_building_date","竣工时间");
|
||||
put( "live_date","开业时间");
|
||||
put( "divisible","是否可分割");
|
||||
put( "unified_manage","是否统一管理");
|
||||
put( "metro_info","地铁沿线");
|
||||
|
||||
+79
-69
@@ -15,7 +15,8 @@ import org.apache.commons.lang.StringUtils
|
||||
public class DistrictRegionTransfer {
|
||||
|
||||
|
||||
static final DBCollection TASK_COLL = MongoUtils.getCollectionByName("fangjia", "district_update_task", "mongo.db.fangjia.com")
|
||||
static final DBCollection DISTRICT_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com")
|
||||
static final DBCollection SQMETRE_RENT = MongoUtils.getCollectionByName("fangjia", "sqmetre_rent", "mongo.db.fangjia.com")
|
||||
static final DBCollection REGION_MIGRATE_COLL = MongoUtils.getCollectionByName("fangjia_log", "region_migrate", "mongo.db.fangjia.com")
|
||||
static final List<String> IGNORE_FIELDS = ["_id", "region", "city", "flag", "estate_type2", "c_date", "m_date", "other_info", "mark_map", "addr_alias", "alias", "name", "address", "status"]
|
||||
static List ALL_CITY = CommonUtils.findAllCity()
|
||||
@@ -31,15 +32,24 @@ public class DistrictRegionTransfer {
|
||||
copyDistrictInfo(orgDistrict, destDistrict)
|
||||
DbUtils.seaweed.save(destDistrict)
|
||||
DbUtils.deleteOnSeaweed(orgDistrict._id.toString())
|
||||
sendRelatedInfoMigrateCommand(orgDistrict, destDistrict)
|
||||
saveMigrateLog(orgDistrict, destDistrict)
|
||||
} else {
|
||||
destDistrict = (BasicDBObject) orgDistrict.clone()
|
||||
destDistrict.city = newCity
|
||||
destDistrict.region = newRegion
|
||||
DbUtils.seaweed.save(destDistrict)
|
||||
sendRelatedInfoMigrateCommand(orgDistrict, destDistrict)
|
||||
saveMigrateLog(orgDistrict, destDistrict)
|
||||
DISTRICT_STAT.remove(new BasicDBObject("city", newCity).append("region", newRegion).append("district_name", orgDistrict.name))
|
||||
DISTRICT_STAT.find(new BasicDBObject("city", newCity).append("region", orgDistrict.region).append("district_name", orgDistrict.name)).each {BasicDBObject stat->
|
||||
stat.region = newRegion
|
||||
DISTRICT_STAT.save(stat)
|
||||
}
|
||||
SQMETRE_RENT.remove(new BasicDBObject("city", newCity).append("region", newRegion).append("district_name", orgDistrict.name))
|
||||
SQMETRE_RENT.find(new BasicDBObject("city", newCity).append("region", orgDistrict.region).append("district_name", orgDistrict.name)).each {BasicDBObject stat->
|
||||
stat.region = newRegion
|
||||
SQMETRE_RENT.save(stat)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,72 +70,72 @@ public class DistrictRegionTransfer {
|
||||
}
|
||||
}
|
||||
|
||||
def sendRelatedInfoMigrateCommand(BasicDBObject orgDistrict, BasicDBObject destDistrict) {
|
||||
|
||||
BasicDBObject task = new BasicDBObject()
|
||||
task.append("city", orgDistrict.city)
|
||||
task.append("new_city", destDistrict.city)
|
||||
task.append("region", orgDistrict.region)
|
||||
task.append("new_region", destDistrict.region)
|
||||
task.append("new_name", orgDistrict.name)
|
||||
task.append("name", destDistrict.name)
|
||||
task.append("type", 2)
|
||||
task.append("c_date", new Date())
|
||||
task.append("status", 1)
|
||||
String estateType;
|
||||
if ("district" == orgDistrict.cat) {
|
||||
if (StringUtils.isNotBlank(destDistrict.estate_type2)) {
|
||||
if (destDistrict.getString("estate_type2").contains("别墅")) {
|
||||
estateType = "villa"
|
||||
} else {
|
||||
estateType = "district"
|
||||
}
|
||||
} else {
|
||||
if (StringUtils.isNotBlank(destDistrict.estate_type2)) {
|
||||
if (destDistrict.getString("estate_type").contains("别墅")) {
|
||||
estateType = "villa"
|
||||
} else {
|
||||
estateType = "district"
|
||||
}
|
||||
} else {
|
||||
estateType = "district"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
estateType = destDistrict.getString("cat")
|
||||
}
|
||||
task.append("estate_type", estateType)
|
||||
def query = new BasicDBObject()
|
||||
query.append("city", task.city)
|
||||
query.append("region", task.region)
|
||||
query.append("name", task.name)
|
||||
query.append("type", task.type)
|
||||
TASK_COLL.update(query, new BasicDBObject('$set', task), true, false)
|
||||
|
||||
def params = [:]
|
||||
params.city = orgDistrict.city
|
||||
params.region = orgDistrict.region
|
||||
params.name = orgDistrict.name
|
||||
params.estateType = orgDistrict.estate_type2
|
||||
|
||||
params.newCity = destDistrict.city
|
||||
params.newRegion = destDistrict.region
|
||||
params.newName = destDistrict.name
|
||||
params.newEstateType = destDistrict.estate_type2
|
||||
int count = 3
|
||||
while (count-- > 0) {
|
||||
try {
|
||||
JSONObject json = new HttpRequest().getJsonContent("http://192.168.0.24:9080/command/transfer", params, "UTF-8")
|
||||
if (json && json.getInt("code") == 200) {
|
||||
println("均价重算命令发从成功:" + params)
|
||||
break
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// def sendRelatedInfoMigrateCommand(BasicDBObject orgDistrict, BasicDBObject destDistrict) {
|
||||
//
|
||||
// BasicDBObject task = new BasicDBObject()
|
||||
// task.append("city", orgDistrict.city)
|
||||
// task.append("new_city", destDistrict.city)
|
||||
// task.append("region", orgDistrict.region)
|
||||
// task.append("new_region", destDistrict.region)
|
||||
// task.append("new_name", orgDistrict.name)
|
||||
// task.append("name", destDistrict.name)
|
||||
// task.append("type", 2)
|
||||
// task.append("c_date", new Date())
|
||||
// task.append("status", 1)
|
||||
// String estateType;
|
||||
// if ("district" == orgDistrict.cat) {
|
||||
// if (StringUtils.isNotBlank(destDistrict.estate_type2)) {
|
||||
// if (destDistrict.getString("estate_type2").contains("别墅")) {
|
||||
// estateType = "villa"
|
||||
// } else {
|
||||
// estateType = "district"
|
||||
// }
|
||||
// } else {
|
||||
// if (StringUtils.isNotBlank(destDistrict.estate_type2)) {
|
||||
// if (destDistrict.getString("estate_type").contains("别墅")) {
|
||||
// estateType = "villa"
|
||||
// } else {
|
||||
// estateType = "district"
|
||||
// }
|
||||
// } else {
|
||||
// estateType = "district"
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// estateType = destDistrict.getString("cat")
|
||||
// }
|
||||
// task.append("estate_type", estateType)
|
||||
// def query = new BasicDBObject()
|
||||
// query.append("city", task.city)
|
||||
// query.append("region", task.region)
|
||||
// query.append("name", task.name)
|
||||
// query.append("type", task.type)
|
||||
// TASK_COLL.update(query, new BasicDBObject('$set', task), true, false)
|
||||
//
|
||||
// def params = [:]
|
||||
// params.city = orgDistrict.city
|
||||
// params.region = orgDistrict.region
|
||||
// params.name = orgDistrict.name
|
||||
// params.estateType = orgDistrict.estate_type2
|
||||
//
|
||||
// params.newCity = destDistrict.city
|
||||
// params.newRegion = destDistrict.region
|
||||
// params.newName = destDistrict.name
|
||||
// params.newEstateType = destDistrict.estate_type2
|
||||
// int count = 3
|
||||
// while (count-- > 0) {
|
||||
// try {
|
||||
// JSONObject json = new HttpRequest().getJsonContent("http://192.168.0.24:9080/command/transfer", params, "UTF-8")
|
||||
// if (json && json.getInt("code") == 200) {
|
||||
// println("均价重算命令发从成功:" + params)
|
||||
// break
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
def saveMigrateLog(BasicDBObject orgDistrict, BasicDBObject destDistrict) {
|
||||
|
||||
|
||||
+4
-4
@@ -8,10 +8,10 @@ import static com.mongodb.client.model.Filters.*
|
||||
import com.fangjia.core.util.Mongo3Utils
|
||||
|
||||
|
||||
def city = "ÂåÑô"
|
||||
def destCity = "ÂåÑô"
|
||||
def region = "¼ªÀû"
|
||||
def destRegion = "ÃϽò"
|
||||
def city = "ÖÐɽ"
|
||||
def destCity = "ÖÐɽ"
|
||||
def region = "»ð¾æ"
|
||||
def destRegion = "ÖÐɽ¸Û"
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user