同步任务修改
parent
3b74511e0e
commit
3d3c4f90f0
|
|
@ -45,4 +45,6 @@ public class Const {
|
|||
SMS_TEMP_MAP.put(TEMP_CODE_REFUND_SUCCESS, "${time}${customer_name}在${vendor}的退款${amount}元,合计余额${surplus}元。");
|
||||
SMS_TEMP_MAP.put(TEMP_CODE_AGGR_DAY_STAT, "截至${time1}累计销售黄砂${aggr_weight}吨,共计${aggr_price}元,运输${aggr_cnt}辆次。${time2}当日销售黄砂${total_weight}吨,共计${total_price}元,运输${total_cnt}辆次。");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.jfinal.plugin.activerecord.cache.ICache;
|
|||
import com.jfinal.plugin.redis.Redis;
|
||||
|
||||
public class RedisArpCache implements ICache {
|
||||
|
||||
@Override
|
||||
public <T> T get(String cacheName, Object key) {
|
||||
return Redis.use(cacheName).get(key);
|
||||
|
|
|
|||
|
|
@ -253,6 +253,24 @@ public class SyncTaskService {
|
|||
|
||||
long st = System.currentTimeMillis();
|
||||
|
||||
String redisKey = Config.dbprop.get("redis.basekey") + Const.REDIS_SEPARATE + SyncTask.tablename + Const.REDIS_SEPARATE + recvdata.getString("id");
|
||||
|
||||
// 0,待同步,1已同步 2执行中
|
||||
String status = Redis.use().get(redisKey);
|
||||
|
||||
if (status == null){
|
||||
Redis.use().set(redisKey,"2");
|
||||
status = "0";
|
||||
}
|
||||
|
||||
if ( status.equals("2")){
|
||||
log.info("任务执行中: %s" ,recvdata.getString("id"));
|
||||
return false;
|
||||
}
|
||||
if (status.equals("1")){
|
||||
log.info("任务执行过: %s" ,recvdata.getString("id"));
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
JSONObject save_data = JSONObject.parseObject(recvdata.getString("save_data"));
|
||||
JSONObject update_data = JSONObject.parseObject(recvdata.getString("update_data"));
|
||||
|
|
@ -566,6 +584,9 @@ public class SyncTaskService {
|
|||
}
|
||||
});
|
||||
|
||||
// 执行完成添加状态
|
||||
Redis.use().set(redisKey,"1");
|
||||
|
||||
log.debug("recv 2 time: %s", System.currentTimeMillis() - st);
|
||||
return ret;
|
||||
} catch (Exception e) {
|
||||
|
|
@ -574,6 +595,8 @@ public class SyncTaskService {
|
|||
log.debug("recv 3 time: %s", System.currentTimeMillis() - st);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue