空值判断

This commit is contained in:
2024-09-29 14:08:01 +08:00
parent 1fb0994005
commit be273c5f7c
@@ -20,15 +20,20 @@ class AddCityRegionPrice {
for(def r : regions){ for(def r : regions){
def startObj = CommonDatautils.queryCityOrRegionPrice(c, r, 1) def startObj = CommonDatautils.queryCityOrRegionPrice(c, r, 1)
def endObj = CommonDatautils.queryCityOrRegionPrice(c, r, -1) def endObj = CommonDatautils.queryCityOrRegionPrice(c, r, -1)
def betweenDates = DateUtil.getWeekendBetweenDates(startObj.weekend, endObj.weekend); if(startObj && endObj){
for(def weekend : betweenDates ){ def betweenDates = DateUtil.getWeekendBetweenDates(startObj.weekend, endObj.weekend);
def price = CommonDatautils.findCityOrRegionPrice(c, r, weekend) for(def weekend : betweenDates ){
if(!price){ def price = CommonDatautils.findCityOrRegionPrice(c, r, weekend)
add++ if(!price){
insertBatch.saveCityCalcCommand(c,r,null, weekend, "fangjia-priceanalysis-0") add++
println "[add] ${add} "+c+" "+r+" "+DateUtil.formatByPattern(weekend, "yyyy-MM-dd") insertBatch.saveCityCalcCommand(c,r,null, weekend, "fangjia-priceanalysis-0")
println "[add] ${add} "+c+" "+r+" "+DateUtil.formatByPattern(weekend, "yyyy-MM-dd")
}
} }
}else{
println c+" "+r+" ÓпÕÖµ"
} }
} }
} }