Merge branch 'script_gj' into 'master'
Script gj See merge request !336
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ class ExportDistrictRongHe extends BaseBatch{
|
||||
@Override
|
||||
void process(Object args) {
|
||||
def curDate = DateUtils.formatDateByPattern(new Date()+1, "yyyyMMdd")
|
||||
def new_dists = ["350604","350605","410307","410308","450181"]
|
||||
def new_dists = []//["350604","350605","410307","410308","450181"]
|
||||
//按天导(每天一个文件夹)
|
||||
exportBigdataDealFJW2(curDate, DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()+1,-1), "yyyy-MM-dd"), new_dists)
|
||||
|
||||
|
||||
+31
-28
@@ -834,39 +834,42 @@ class CommonDatautils {
|
||||
if(!id){
|
||||
return null;
|
||||
}
|
||||
DBObject q = new BasicDBObject();
|
||||
q.put("_id", new ObjectId(id.toString().replace("[","").replace("]","")));
|
||||
|
||||
DBObject keys = new BasicDBObject();
|
||||
keys.put("alias", 1);
|
||||
keys.put("addr_alias", 1);
|
||||
keys.put("city", 1);
|
||||
keys.put("region", 1);
|
||||
keys.put("name", 1);
|
||||
keys.put("estate_type2", 1);
|
||||
keys.put("address", 1);
|
||||
keys.put("build_structure", 1);
|
||||
keys.put("out_pics", 1);
|
||||
keys.put("lat", 1);
|
||||
keys.put("lng", 1);
|
||||
keys.put("lat2", 1);
|
||||
keys.put("lng2", 1);
|
||||
keys.put("name_cat", 1);
|
||||
keys.put("finish_building_date", 1)
|
||||
keys.put("mapping_alias", 1)
|
||||
keys.put("sid", 1)
|
||||
try{
|
||||
DSCursor cursor = getDataStoreConnection().find(q, keys);
|
||||
if(cursor){
|
||||
for(def obj : cursor){
|
||||
return obj;
|
||||
DBObject q = new BasicDBObject();
|
||||
q.put("_id", new ObjectId(id.toString().replace("[","").replace("]","")));
|
||||
|
||||
DBObject keys = new BasicDBObject();
|
||||
keys.put("alias", 1);
|
||||
keys.put("addr_alias", 1);
|
||||
keys.put("city", 1);
|
||||
keys.put("region", 1);
|
||||
keys.put("name", 1);
|
||||
keys.put("estate_type2", 1);
|
||||
keys.put("address", 1);
|
||||
keys.put("build_structure", 1);
|
||||
keys.put("out_pics", 1);
|
||||
keys.put("lat", 1);
|
||||
keys.put("lng", 1);
|
||||
keys.put("lat2", 1);
|
||||
keys.put("lng2", 1);
|
||||
keys.put("name_cat", 1);
|
||||
keys.put("finish_building_date", 1)
|
||||
keys.put("mapping_alias", 1)
|
||||
keys.put("sid", 1)
|
||||
try{
|
||||
DSCursor cursor = getDataStoreConnection().find(q, keys);
|
||||
if(cursor){
|
||||
for(def obj : cursor){
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
println "error_id:"+id
|
||||
e.printStackTrace()
|
||||
}
|
||||
}catch(Exception e){
|
||||
println "error_id:"+id
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.fangjia.script.temp.shenjian.oracle;
|
||||
|
||||
import com.fangjia.core.RegionData
|
||||
import com.fangjia.core.util.DistrictCodeUtils
|
||||
import com.fangjia.script.commData.CommonDatautils
|
||||
import com.fangjia.script.gj.district.FangjiaClientUtils
|
||||
import com.fangjia.script.lixue.util.DBUtils
|
||||
import com.fangjia.script.util.DataUtil
|
||||
import com.fangjia.script.util.DateUtils
|
||||
import com.fangjia.script.util.DbUtils
|
||||
import com.fangjia.script.util.ElasticUtils
|
||||
import com.fangjia.script.util.ExcelUtils
|
||||
import com.fangjia.script.util.MongoUtils
|
||||
import com.mongodb.BasicDBObject
|
||||
import com.mongodb.DBCollection
|
||||
import com.mongodb.DBObject
|
||||
import groovy.sql.Sql
|
||||
|
||||
/**
|
||||
* 导出异常价格
|
||||
*/
|
||||
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
|
||||
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
|
||||
|
||||
def sql = "SELECT id, cityname, distname, commid, commname, calc_type, avg_price, year_month FROM community_base_price_gj WHERE year_month IN('202206', '202205') " +
|
||||
" AND cityname IN ('东莞', '上海') AND rownum <= 10 ORDER BY cityname, distname, commid, commname, year_month"
|
||||
def result = []
|
||||
result << ["城市", "区域", "小区ID", "小区名", "五月均价", "五月计算方式", "六月均价", "六月计算方式"]
|
||||
Map<String, Integer> fiveMap = new HashMap<>()
|
||||
Map<String, Integer> sixMap = new HashMap<>()
|
||||
sqlInstance.eachRow(sql, { r ->
|
||||
def year_month = r['year_month']
|
||||
String key = r['cityname'] + "," + r['distname'] + "," + r['commid'] + "," + r['commname']
|
||||
if (year_month == '202205') {
|
||||
fiveMap.put(key, r['avg_price'] + "|" + r['calc_type'])
|
||||
} else if ((year_month == '202206')) {
|
||||
fiveMap.put(key, r['avg_price'] + "|" + r['calc_type'])
|
||||
}
|
||||
})
|
||||
for (String key : sixMap.keySet()) {
|
||||
Integer fivePrice = fiveMap.get(key).split("|")[0]
|
||||
Integer sixPrice = sixMap.get(key).split("|")[0]
|
||||
if (fivePrice != null && sixPrice != null) {
|
||||
if (Math.abs(sixPrice - fivePrice) * 100 / fivePrice > 10) {
|
||||
def info = key.split(",")
|
||||
result << [info[0], info[1], info[2], info[3], fivePrice, fiveMap.get(key).split("|")[1], sixPrice, sixMap.get(key).split("|")[1]]
|
||||
}
|
||||
}
|
||||
}
|
||||
ExcelUtils.write("F:\\数据\\价格\\东莞上海价格偏差大.xlsx", result, "统计")
|
||||
Reference in New Issue
Block a user