Compare commits

...

2 Commits

Author SHA1 Message Date
王文艳 3c10c22dc3 添加月度均价定时任务 2026-06-18 15:30:19 +08:00
王文艳 23d26b75f8 添加月度均价定时任务 2026-06-18 15:28:10 +08:00
2 changed files with 42 additions and 42 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
# 江南空白日更新楼盘刷新
*/10 * * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/jiangnanblank/DayUpdateDistRefreshBatch > /home/goojia/logs/DayUpdateDistRefreshBatch.log 2>&1
# 楼盘在售统计(福州,月底补跑+工作时段高频)
#10 0 2 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/DistrictSellStatBatch > /home/goojia/logs/DistrictSellStatBatch.log 2>&1
40 15 18 * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/DistrictSellStatBatch > /home/goojia/logs/DistrictSellStatBatch.log 2>&1
#*/10 8-23 * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/fuzhou/DistrictSellStatBatch > /home/goojia/logs/DistrictSellStatBatch.log 2>&1
# 开放API使用量监控
15 * * * * cd /home/goojia/webapps/fangjia-script && ./run.sh com/fangjia/script/api/OpenApiUseStatMonitorBatch > /home/goojia/logs/OpenApiUseStatMonitorBatch.log 2>&1
@@ -41,48 +41,48 @@ class DistrictSellStatBatch extends BaseBatch {
@Override
void process(Object args) {
// def months = DateUtils.getMonthList(202510)
// months = months[0..(months.size()-1)]
// println months
// for(def month : months){
// def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd")
// 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 months = DateUtils.getMonthList(202606)
months = months[0..(months.size()-1)]
println months
for(def month : months){
def curDate = DateUtils.parseFromTightByPattern(month.toString()+"01", "yyyyMMdd")
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))
// }
// }
// }
// }
// }
}