+9
-8
@@ -23,6 +23,7 @@ import java.sql.ResultSet
|
|||||||
import java.util.concurrent.CountDownLatch
|
import java.util.concurrent.CountDownLatch
|
||||||
import java.util.concurrent.ExecutorService
|
import java.util.concurrent.ExecutorService
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
|
|
||||||
@BatchOwner(Watcher.GaoJuan)
|
@BatchOwner(Watcher.GaoJuan)
|
||||||
@@ -90,6 +91,7 @@ class ImportIndexStats extends BaseBatch{
|
|||||||
def map = [:]
|
def map = [:]
|
||||||
map.year = year
|
map.year = year
|
||||||
map.month = month
|
map.month = month
|
||||||
|
map.date = date
|
||||||
runDates << map
|
runDates << map
|
||||||
s = DateUtils.addMonth(date, 1, "yyyyMM")
|
s = DateUtils.addMonth(date, 1, "yyyyMM")
|
||||||
|
|
||||||
@@ -98,14 +100,14 @@ class ImportIndexStats extends BaseBatch{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(def map : runDates){
|
for(def map : runDates){
|
||||||
calculatePriceIndex(map.year, map.month);
|
calculatePriceIndex(map.year, map.month, map.date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//计算统计局没有发布的城市的价格指数
|
//计算统计局没有发布的城市的价格指数
|
||||||
def calculatePriceIndex(def year, def month){
|
def calculatePriceIndex(def year, def month, def date){
|
||||||
def citys =CommonDatautils.findAllCity();
|
def citys =CommonDatautils.findAllCity();
|
||||||
def date = createDateString(year, month, 0, "");
|
// def date = createDateString(year, month, 0, "");
|
||||||
def haveIndexCitys = findPriceIndexCitys(date.toInteger());
|
def haveIndexCitys = findPriceIndexCitys(date.toInteger());
|
||||||
|
|
||||||
def totalCount = new AtomicLong()
|
def totalCount = new AtomicLong()
|
||||||
@@ -130,7 +132,7 @@ class ImportIndexStats extends BaseBatch{
|
|||||||
void run() {
|
void run() {
|
||||||
try{
|
try{
|
||||||
totalCount.addAndGet(1)
|
totalCount.addAndGet(1)
|
||||||
def result = calculating(city, year, month);
|
def result = calculating(city, year, month, date);
|
||||||
println result
|
println result
|
||||||
println "${city}[${totalCount.get()}/${total}]运行......"+year+"-"+month+" 完成"
|
println "${city}[${totalCount.get()}/${total}]运行......"+year+"-"+month+" 完成"
|
||||||
|
|
||||||
@@ -142,11 +144,10 @@ class ImportIndexStats extends BaseBatch{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
latch.await()
|
latch.await(5, TimeUnit.MINUTES);
|
||||||
return addCount.get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def calculating(city, year, month){
|
def calculating(city, year, month, date){
|
||||||
def result = [:];
|
def result = [:];
|
||||||
calculateAvgPriceIndex(city, year, month, result);
|
calculateAvgPriceIndex(city, year, month, result);
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ class ImportIndexStats extends BaseBatch{
|
|||||||
checkPriceIndex(result);//涨跌幅控制
|
checkPriceIndex(result);//涨跌幅控制
|
||||||
if(result){
|
if(result){
|
||||||
result.city = city;
|
result.city = city;
|
||||||
result.yearmonth = (year.toString()+month.toString()).toInteger();
|
result.yearmonth = date;
|
||||||
result.source = 2;
|
result.source = 2;
|
||||||
result.remark = "均价计算";
|
result.remark = "均价计算";
|
||||||
result.cat = "district";
|
result.cat = "district";
|
||||||
|
|||||||
Reference in New Issue
Block a user