|
|
package com.yoho.unions.server.task;
|
|
|
|
|
|
import java.net.InetAddress;
|
|
|
import java.net.UnknownHostException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
...
|
...
|
@@ -9,6 +11,7 @@ import java.util.Map; |
|
|
import java.util.concurrent.locks.Lock;
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -43,6 +46,19 @@ public class UnionClickCountDayTask { |
|
|
//@Scheduled(cron = "* 0/2 * * * ?")
|
|
|
public void run() {
|
|
|
|
|
|
try {
|
|
|
InetAddress addr = InetAddress.getLocalHost();
|
|
|
String ip = addr.getHostAddress();
|
|
|
logger.info("当前ip是:{}", ip);
|
|
|
if (!StringUtils.equals("172.31.70.253", ip)) {
|
|
|
logger.info("当前环境不是目标环境,不执行操作!");
|
|
|
return;
|
|
|
}
|
|
|
} catch (UnknownHostException e1) {
|
|
|
logger.error("获取ip地址出错!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
Calendar time = Calendar.getInstance();
|
|
|
time.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
time.set(Calendar.MINUTE, 0);
|
...
|
...
|
|