...
|
...
|
@@ -28,30 +28,66 @@ import java.util.concurrent.TimeUnit; |
|
|
public class DeliveryMinutesService {
|
|
|
private static final Logger logger = LoggerFactory.getLogger(DeliveryMinutesService.class);
|
|
|
|
|
|
//缓存
|
|
|
private LocalCache localCache_onlineTimeEx = new LocalCache();
|
|
|
private static final String ONLINE_TIME_EX_CACHE_KEY = "sellerDeliverNewOnlineTimeExCacheKey";
|
|
|
|
|
|
@Autowired
|
|
|
private ConfigReader configReader;
|
|
|
|
|
|
|
|
|
@Value("${mq.seller.deliverNotice.second}")
|
|
|
private int minutes_deliverNotice_second;
|
|
|
|
|
|
@Value("${mq.seller.deliverNotice.old.second}")
|
|
|
private int minutes_deliverNotice_second_old;
|
|
|
|
|
|
@Value("${mq.seller.deliverNotice.third}")
|
|
|
private int minutes_deliverNotice_third;
|
|
|
|
|
|
public int getDeliverMinutesSecond(){
|
|
|
@Value("${mq.seller.deliverNotice.old.third}")
|
|
|
private int minutes_deliverNotice_third_old;
|
|
|
|
|
|
@PostConstruct
|
|
|
private void init() {
|
|
|
localCache_onlineTimeEx.init(ONLINE_TIME_EX_CACHE_KEY, 10, TimeUnit.MINUTES, (String s, Object o) -> {
|
|
|
logger.info("init ONLINE_TIME_EX_CACHE_KEY s = {}, o = {}", s, o);
|
|
|
return configReader.getInt("ufo.order.sellerDeliverNewOnlineTimeEx",1550073600);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
private int getOnlineTime(){
|
|
|
Object value=localCache_onlineTimeEx.get(ONLINE_TIME_EX_CACHE_KEY);
|
|
|
if(null == value) {
|
|
|
return 1550073600;
|
|
|
}
|
|
|
return (Integer) value;
|
|
|
}
|
|
|
|
|
|
public int getDeliverMinutesSecond(int ts){
|
|
|
if(ts<getOnlineTime()){
|
|
|
return minutes_deliverNotice_second_old;
|
|
|
}
|
|
|
return minutes_deliverNotice_second;
|
|
|
}
|
|
|
|
|
|
public int getDeliverMinutesThird(){
|
|
|
public int getDeliverMinutesThird(int ts){
|
|
|
if(ts<getOnlineTime()){
|
|
|
return minutes_deliverNotice_third_old;
|
|
|
}
|
|
|
return minutes_deliverNotice_third;
|
|
|
}
|
|
|
|
|
|
public int getDeliverMinutesThird_hours(){
|
|
|
int minutes = getDeliverMinutesThird();
|
|
|
public int getDeliverMinutesThird_hours(int ts){
|
|
|
int minutes = getDeliverMinutesThird(ts);
|
|
|
return minutes/60 ;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@Autowired
|
|
|
private ConfigReader configReader;
|
|
|
|
|
|
//缓存
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
private LocalCache localCache_onlineTime = new LocalCache();
|
|
|
private static final String ONLINE_TIME_CACHE_KEY = "sellerDeliverNewOnlineTimeCacheKey";
|
|
|
|
...
|
...
|
|