...
|
...
|
@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
import static com.yoho.tools.common.utils.RandomUtil.getRandom;
|
...
|
...
|
@@ -66,12 +68,14 @@ public class GrassUserVirtualImpl implements IGrassVirtualService{ |
|
|
|
|
|
private static final int recPraise = 2;
|
|
|
|
|
|
private ExecutorService executorService = Executors.newSingleThreadExecutor();
|
|
|
|
|
|
private static final String MESSAGE_KEY = "yh:pfcms:grass:auto_praise:list";
|
|
|
private static final String MESSAGE_SENDING_FLAG = "yh:pfcms:grass:auto_praise:sending";
|
|
|
|
|
|
@PostConstruct
|
|
|
public void startSendMessageTask(){
|
|
|
new Thread(() -> {
|
|
|
executorService.execute(() -> {
|
|
|
while(true){
|
|
|
List<GrassInBoxAddReq> messageList = platformRedis.range(MESSAGE_KEY, "all",
|
|
|
GrassInBoxAddReq.class, 0, -1);
|
...
|
...
|
@@ -119,7 +123,7 @@ public class GrassUserVirtualImpl implements IGrassVirtualService{ |
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}).start();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|