...
|
...
|
@@ -34,36 +34,17 @@ public class CpsSettlementMessageTask { |
|
|
// @Scheduled(cron = "0 0 10 20,28 * ?")
|
|
|
public void run(){
|
|
|
//竞争任务处理者
|
|
|
// CpsMessageTaskBo bo = new CpsMessageTaskBo();
|
|
|
// bo.setIp(LocalhostIpFetcher.fetchLocalIP());
|
|
|
// bo.setTime(Long.toString(System.currentTimeMillis()));
|
|
|
// CpsMessageTaskBo cacheBo=redisValueCache.get(SETTLEMENT_TASK_KEY+ DateUtil.getToday("yyyyMMdd"), CpsMessageTaskBo.class);
|
|
|
// if (cacheBo != null) {
|
|
|
// logger.info("other get task,it is {}.this is {}.",cacheBo,bo);
|
|
|
// }
|
|
|
// redisValueCache.set(SETTLEMENT_TASK_KEY+DateUtil.getToday("yyyyMMdd"),bo,2, TimeUnit.DAYS);
|
|
|
// try {
|
|
|
// Thread.sleep(1000);
|
|
|
// } catch (InterruptedException e) {
|
|
|
// logger.warn("thread sleep error,e is {}",e);
|
|
|
// }
|
|
|
// cacheBo=redisValueCache.get(SETTLEMENT_TASK_KEY+DateUtil.getToday("yyyyMMdd"), CpsMessageTaskBo.class);
|
|
|
// if (cacheBo == null) {
|
|
|
// logger.error("redis error.");
|
|
|
// return;
|
|
|
// }
|
|
|
// if (!cacheBo.getIp().equals(bo.getIp()) || !cacheBo.getTime().equals(bo.getTime())) {
|
|
|
// logger.info("The competition failure,other get task,it is {}.this is {}.",cacheBo,bo);
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
CpsMessageTaskBo bo = new CpsMessageTaskBo();
|
|
|
bo.setIp(LocalhostIpFetcher.fetchLocalIP());
|
|
|
bo.setTime(Long.toString(System.currentTimeMillis()));
|
|
|
String key = SETTLEMENT_TASK_KEY + DateUtil.getToday("yyyyMMdd");
|
|
|
boolean lock = globalRedisValueCache.getLock(key,2, TimeUnit.DAYS);
|
|
|
boolean lock = globalRedisValueCache.getLock(key,bo,2, TimeUnit.DAYS);
|
|
|
if (!lock) {
|
|
|
logger.info("The competition failure,other get task.");
|
|
|
CpsMessageTaskBo cacheBo=globalRedisValueCache.get(key, CpsMessageTaskBo.class);
|
|
|
logger.info("The competition failure,other get task,it is {}.this is {}.",cacheBo,bo);
|
|
|
return;
|
|
|
}
|
|
|
logger.info("get this task,ip is {}",LocalhostIpFetcher.fetchLocalIP());
|
|
|
logger.info("get this task,this is {}",bo);
|
|
|
//今天更新的数据
|
|
|
int startTime=DateUtil.getLastDayInt(0);
|
|
|
int endTime= DateUtil.getLastDayInt(-1);
|
...
|
...
|
|