From a3b14dfe561ce0a590645208abbaf0223975daa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Mon, 29 Jun 2026 18:03:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=88=E5=BA=A6=E5=9D=87?= =?UTF-8?q?=E4=BB=B7=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fuzhou/DistrictSellStatBatch.groovy | 81 +++++++++---------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy index ce888e6a7..149db47c5 100644 --- a/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy +++ b/projects/fangjia-script/src/main/groovy/com/fangjia/script/fuzhou/DistrictSellStatBatch.groovy @@ -42,48 +42,47 @@ class DistrictSellStatBatch extends BaseBatch { @Override void process(Object args) { - 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)) -// } -// } -// } -// } +// 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)) + } + } + } + } + } }