添加月度均价定时任务
This commit is contained in:
+40
-41
@@ -42,48 +42,47 @@ class DistrictSellStatBatch extends BaseBatch {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void process(Object args) {
|
void process(Object args) {
|
||||||
def months = DateUtils.getMonthList(202606)
|
// def months = DateUtils.getMonthList(202606)
|
||||||
months = months[0..(months.size()-1)]
|
// months = months[0..(months.size()-1)]
|
||||||
println months
|
// println months
|
||||||
for(def month : months){
|
// for(def month : months){
|
||||||
def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd")
|
// def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd")
|
||||||
calcMonthlyPrice(curDate)
|
// calcMonthlyPrice(curDate)
|
||||||
}
|
|
||||||
|
|
||||||
// def date = new Date()
|
|
||||||
// def day = date.getDate()
|
|
||||||
// def hours = date.getHours()
|
|
||||||
// if(day == 2 && hours<7){
|
|
||||||
// calcMonthlyPrice() //正常算一期
|
|
||||||
// }else{
|
|
||||||
// //根据calc_type算历史
|
|
||||||
// def q = new BasicDBObject("category" ,"sell_month")
|
|
||||||
// def commands = COMMAND_COLL.find(q)
|
|
||||||
// println "共 【"+commands.size()+"】 个小区重算 "+new Date()
|
|
||||||
// for(def command : commands){
|
|
||||||
// def calc_type = command.calc_type
|
|
||||||
// def id = command._id
|
|
||||||
// if(calc_type==1){
|
|
||||||
// //找出第一次均价计算的时间
|
|
||||||
// def obj = CommonDatautils.queryFirstOrLastDistrictPrice(command.city, command.region, command.name, 1)
|
|
||||||
// if(obj){
|
|
||||||
// def weekend = obj.weekend
|
|
||||||
// def startMonth = DateUtils.formatDateByPattern(weekend, "yyyyMM").toInteger()
|
|
||||||
// def months = DateUtils.getMonthList(startMonth)
|
|
||||||
// if(months.size()>1){
|
|
||||||
// months = months[1..(months.size()-1)]
|
|
||||||
// println months
|
|
||||||
// for(def month : months){
|
|
||||||
// def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd")
|
|
||||||
// calcMonthlyPriceByName(curDate, command.city, command.region, command.name)
|
|
||||||
// }
|
|
||||||
// //删除命令
|
|
||||||
// COMMAND_COLL.remove(new BasicDBObject("_id", id))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
// }
|
||||||
|
def date = new Date()
|
||||||
|
def day = date.getDate()
|
||||||
|
def hours = date.getHours()
|
||||||
|
if(day == 2 && hours<7){
|
||||||
|
calcMonthlyPrice() //正常算一期
|
||||||
|
}else{
|
||||||
|
//根据calc_type算历史
|
||||||
|
def q = new BasicDBObject("category" ,"sell_month")
|
||||||
|
def commands = COMMAND_COLL.find(q)
|
||||||
|
println "共 【"+commands.size()+"】 个小区重算 "+new Date()
|
||||||
|
for(def command : commands){
|
||||||
|
def calc_type = command.calc_type
|
||||||
|
def id = command._id
|
||||||
|
if(calc_type==1){
|
||||||
|
//找出第一次均价计算的时间
|
||||||
|
def obj = CommonDatautils.queryFirstOrLastDistrictPrice(command.city, command.region, command.name, 1)
|
||||||
|
if(obj){
|
||||||
|
def weekend = obj.weekend
|
||||||
|
def startMonth = DateUtils.formatDateByPattern(weekend, "yyyyMM").toInteger()
|
||||||
|
def months = DateUtils.getMonthList(startMonth)
|
||||||
|
if(months.size()>1){
|
||||||
|
months = months[1..(months.size()-1)]
|
||||||
|
println months
|
||||||
|
for(def month : months){
|
||||||
|
def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd")
|
||||||
|
calcMonthlyPriceByName(curDate, command.city, command.region, command.name)
|
||||||
|
}
|
||||||
|
//删除命令
|
||||||
|
COMMAND_COLL.remove(new BasicDBObject("_id", id))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user