update 广播模块,新增广播按钮和跳转路径。定时任务新增开关功能
This commit is contained in:
@@ -11,10 +11,12 @@ import com.m2pool.pool.enums.PoolCalParamConfig;
|
||||
import com.m2pool.pool.enums.PoolUnits;
|
||||
import com.m2pool.pool.enums.Pools;
|
||||
import com.m2pool.pool.mapper.PoolMapper;
|
||||
import lombok.Data;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -32,10 +34,14 @@ import java.util.stream.Collectors;
|
||||
* @Date 2024/6/14 14:03
|
||||
* @Author dy
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "task.data")
|
||||
@EnableScheduling
|
||||
public class DataTask {
|
||||
|
||||
private boolean enable;
|
||||
|
||||
@Autowired
|
||||
private PoolMapper poolMapper;
|
||||
|
||||
@@ -51,7 +57,10 @@ public class DataTask {
|
||||
@Scheduled(cron = "20 1,3,10,31,33,40 * * * ?")
|
||||
public void NEXA30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
System.out.println("DataTask 定时任务已关闭,请在nacos修改配置");
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -229,6 +238,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "0 1,3,5 0 * * ?")
|
||||
public void NEXADailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -382,7 +394,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "50 0,1,30,31 * * * ?")
|
||||
public void NEXAUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -408,6 +422,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "30 3 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void NEXALuckyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
log.info("nexa幸运值---定时任务开始");
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
@@ -500,7 +517,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "11 1,3,11,31,33,41 * * * ?")
|
||||
public void GRS30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -665,6 +684,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "1 1,3,5 0 * * ?")
|
||||
public void GRSDailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -819,7 +841,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "51 0,1,30,31 * * * ?")
|
||||
public void GRSUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -849,6 +873,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "31 3 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void GRSLuckyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
log.info("GRS幸运值---定时任务开始");
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
@@ -912,7 +939,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "12 1,3,12,31,33,42 * * * ?")
|
||||
public void MONA30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -1074,6 +1103,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "2 1,3,5 0 * * ?")
|
||||
public void MONADailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -1230,7 +1262,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "52 0,1,30,31 * * * ?")
|
||||
public void MONAUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -1259,6 +1293,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "32 3 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void MONALuckyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
log.info("MONA幸运值---定时任务开始");
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
@@ -1325,7 +1362,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "14 1,3,9,31,33,39 * * * ?")
|
||||
public void DGBO30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -1487,6 +1526,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "4 1,3,5 0 * * ?")
|
||||
public void DGBODailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -1643,7 +1685,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "54 0,1,30,31 * * * ?")
|
||||
public void DGBOUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -1673,7 +1717,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "34 3 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void DGBOLuckyDataToDB(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
log.info("DGBO幸运值---定时任务开始");
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
@@ -1740,7 +1786,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "16 1,3,8,31,33,38 * * * ?")
|
||||
public void DGBQ30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -1902,6 +1950,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "6 1,3,5 0 * * ?")
|
||||
public void DGBQDailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -2058,7 +2109,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "56 0,1,30,31 * * * ?")
|
||||
public void DGBQUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -2087,6 +2140,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "36 3 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void DGBQLuckyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
log.info("DGBQ幸运值---定时任务开始");
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
@@ -2153,7 +2209,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "18 1,3,7,31,33,37 * * * ?")
|
||||
public void DGBS30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -2315,6 +2373,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "8 1,3,5 0 * * ?")
|
||||
public void DGBSDailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -2469,7 +2530,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "58 0,1,30,31 * * * ?")
|
||||
public void DGBSUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -2498,6 +2561,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "38 3 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void DGBSLuckyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
log.info("DGBS幸运值---定时任务开始");
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
@@ -2564,7 +2630,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "19 1,3,13,31,33,43 * * * ?")
|
||||
public void RXD30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -2724,6 +2792,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "9 1,3,5 0 * * ?")
|
||||
public void RXDDailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -2877,7 +2948,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "59 0,1,30,31 * * * ?")
|
||||
public void RXDUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -2901,6 +2974,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "39 3 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void RXDLuckyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
log.info("rxd幸运值---定时任务开始");
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
|
||||
@@ -2966,7 +3042,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "21 1,3,13,31,33,43 * * * ?")
|
||||
public void ENX30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -3126,6 +3204,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "10 1,3,5 0 * * ?")
|
||||
public void ENXDailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -3279,7 +3360,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "53 0,1,30,31 * * * ?")
|
||||
public void ENXUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -3303,6 +3386,9 @@ public class DataTask {
|
||||
//@Scheduled(cron = "30 2,7 0,12 * * ?")
|
||||
@Scheduled(cron = "41 2,5 0/12 * * ?")
|
||||
public void ENXLuckyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
int time = 0;
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD));
|
||||
@@ -3531,7 +3617,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "23 1,3,13,31,33,43 * * * ?")
|
||||
public void ALPH30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -3691,6 +3779,9 @@ public class DataTask {
|
||||
|
||||
@Scheduled(cron = "12 1,3,5 0 * * ?")
|
||||
public void ALPHDailyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
String nowStr = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD);
|
||||
Date now = DateUtils.parseDate( nowStr);
|
||||
|
||||
@@ -3841,7 +3932,9 @@ public class DataTask {
|
||||
@Scheduled(cron = "52 0,1,30,31 * * * ?")
|
||||
public void ALPHUserPowerRatioDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
now.setHours(0);
|
||||
now.setMinutes(0);
|
||||
@@ -3865,6 +3958,9 @@ public class DataTask {
|
||||
//@Scheduled(cron = "30 2,7 0,12 * * ?")
|
||||
@Scheduled(cron = "42 2,5 0/12 * * ?")
|
||||
public void ALPHLuckyDataToDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
int time = 0;
|
||||
LuckDto dto = new LuckDto();
|
||||
Date end = DateUtils.parseDate(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD));
|
||||
|
||||
@@ -9,8 +9,10 @@ import com.m2pool.common.redis.service.RedisService;
|
||||
import com.m2pool.pool.mapper.PoolMapper;
|
||||
import com.m2pool.pool.utils.NodeRpc;
|
||||
import com.m2pool.pool.vo.DateValueVo;
|
||||
import lombok.Data;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -25,10 +27,14 @@ import java.util.Map;
|
||||
* @Date 2024/6/14 14:03
|
||||
* @Author dy
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "task.price")
|
||||
@EnableScheduling
|
||||
public class NeaxPriceTask {
|
||||
|
||||
private boolean enable;
|
||||
|
||||
@Autowired
|
||||
private PoolMapper poolMapper;
|
||||
|
||||
@@ -45,6 +51,10 @@ public class NeaxPriceTask {
|
||||
@Scheduled(cron = "0 0,3,30,33 * * * ?")
|
||||
public void NEXAPriceToRedis()
|
||||
{
|
||||
if(!enable){
|
||||
System.out.println("NeaxPriceTask 定时任务已关闭,请在nacos修改配置");
|
||||
return;
|
||||
}
|
||||
Map<String, BigDecimal> map = getResultFromNetByAllCoins();
|
||||
int count = 1;
|
||||
while (StringUtils.isNull(map)
|
||||
|
||||
@@ -10,9 +10,13 @@ import com.m2pool.pool.entity.BlockInfo;
|
||||
import com.m2pool.pool.mapper.PoolMapper;
|
||||
import com.m2pool.pool.utils.NodeRpc;
|
||||
import com.m2pool.pool.vo.DateValueVo;
|
||||
import lombok.Data;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -32,10 +36,13 @@ import java.util.Map;
|
||||
* @Date 2024/6/14 14:03
|
||||
* @Author dy
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "task.node")
|
||||
@EnableScheduling
|
||||
public class NodeTask {
|
||||
|
||||
private boolean enable;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(NodeTask.class);
|
||||
|
||||
@@ -49,9 +56,14 @@ public class NodeTask {
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
@Scheduled(cron = "5 0,30 * * * ?")
|
||||
public void NEXABlockInfoToRedisAndDB(){
|
||||
if(!enable){
|
||||
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("nexa");
|
||||
|
||||
int count = 1;
|
||||
@@ -83,6 +95,10 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "0 0/1 * * * ?")
|
||||
public void NEXABlockInfoToRedis(){
|
||||
if(!enable){
|
||||
System.out.println("NodeTask 定时任务已关闭,请在nacos修改配置");
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("nexa");
|
||||
int count = 0;
|
||||
while (StringUtils.isNull(blockInfo)){
|
||||
@@ -109,6 +125,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "10 0,30 * * * ?")
|
||||
public void GRSBlockInfoToRedisAndDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("grs");
|
||||
|
||||
int count = 1;
|
||||
@@ -139,27 +158,32 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "2 0/1 * * * ?")
|
||||
public void GRSBlockInfoToRedis(){
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("grs");
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("grs");
|
||||
if(StringUtils.isNotNull(blockInfo)){
|
||||
if(StringUtils.isNotNull(blockInfo.getPower())){
|
||||
|
||||
if(StringUtils.isNotNull(blockInfo)){
|
||||
if(StringUtils.isNotNull(blockInfo.getPower())){
|
||||
if (redisService.hasKey("grs_block")){
|
||||
redisService.deleteObject("grs_block");
|
||||
redisService.setCacheObject("grs_block",blockInfo);
|
||||
}else {
|
||||
redisService.setCacheObject("grs_block",blockInfo);
|
||||
}
|
||||
|
||||
if (redisService.hasKey("grs_block")){
|
||||
redisService.deleteObject("grs_block");
|
||||
redisService.setCacheObject("grs_block",blockInfo);
|
||||
}else {
|
||||
redisService.setCacheObject("grs_block",blockInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println("未从节点获取到grs最新数据 :"+DateUtils.dateTimeNow());
|
||||
}
|
||||
else {
|
||||
System.out.println("未从节点获取到grs最新数据 :"+DateUtils.dateTimeNow());
|
||||
}
|
||||
}
|
||||
|
||||
@Scheduled(cron = "15 0,30 * * * ?")
|
||||
public void MONABlockInfoToRedisAndDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("mona");
|
||||
|
||||
int count = 1;
|
||||
@@ -191,6 +215,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "4 0/1 * * * ?")
|
||||
public void MONABlockInfoToRedis(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("mona");
|
||||
|
||||
if(StringUtils.isNotNull(blockInfo)){
|
||||
@@ -212,6 +239,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "20 0,30 * * * ?")
|
||||
public void DGBBlockInfoToRedisAndDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Map<String, BlockInfo> dgbMap = NodeRpc.getDGBBlock();
|
||||
int count = 1;
|
||||
while (StringUtils.isNull(dgbMap)){
|
||||
@@ -299,6 +329,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "6 0/1 * * * ?")
|
||||
public void DGBBlockInfoToRedis(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Map<String, BlockInfo> dgbMap = NodeRpc.getDGBBlock();
|
||||
if(StringUtils.isNotNull(dgbMap)){
|
||||
BlockInfo dgbo = dgbMap.getOrDefault("dgbo", null);
|
||||
@@ -344,6 +377,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "25 0,30 * * * ?")
|
||||
public void RXDBlockInfoToRedisAndDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("rxd");
|
||||
|
||||
int count = 1;
|
||||
@@ -375,6 +411,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "8 0/1 * * * ?")
|
||||
public void RXDBlockInfoToRedis(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("rxd");
|
||||
|
||||
if(StringUtils.isNotNull(blockInfo)){
|
||||
@@ -396,6 +435,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "30 0,30 * * * ?")
|
||||
public void ALPHBlockInfoToRedisAndDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("alph");
|
||||
//改成根据swagger api调用 用与原有节点调用相比新的路径、新的api
|
||||
|
||||
@@ -428,6 +470,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "14 0/1 * * * ?")
|
||||
public void ALPHBlockInfoToRedis(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("alph");
|
||||
|
||||
if(StringUtils.isNotNull(blockInfo)){
|
||||
@@ -449,6 +494,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "35 0,30 * * * ?")
|
||||
public void ENXBlockInfoToRedisAndDB(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("enx");
|
||||
|
||||
int count = 1;
|
||||
@@ -480,6 +528,9 @@ public class NodeTask {
|
||||
|
||||
@Scheduled(cron = "12 0/1 * * * ?")
|
||||
public void ENXBlockInfoToRedis(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
BlockInfo blockInfo = NodeRpc.getBlock("enx");
|
||||
|
||||
if(StringUtils.isNotNull(blockInfo)){
|
||||
@@ -506,6 +557,9 @@ public class NodeTask {
|
||||
@Scheduled(cron = "0 2 0/1 * * ?")
|
||||
//@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void insertNetBlock(){
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
insertBlockWithRetry("nexa", "nexa_net_block", 5);
|
||||
insertBlockWithRetry("mona", "mona_net_block", 5);
|
||||
insertBlockWithRetry("rxd", "rxd_net_block", 5);
|
||||
|
||||
@@ -9,7 +9,9 @@ import com.m2pool.pool.mapper.NoticeMapper;
|
||||
import com.m2pool.pool.mapper.PoolMapper;
|
||||
import com.m2pool.system.api.RemoteMailService;
|
||||
import com.m2pool.system.api.entity.EmailEntity;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -22,9 +24,12 @@ import java.util.stream.Collectors;
|
||||
* @Date 2024/6/14 14:03
|
||||
* @Author dy
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "task.notice")
|
||||
@EnableScheduling
|
||||
public class OffLineNoticeTask {
|
||||
private boolean enable;
|
||||
|
||||
@Autowired
|
||||
private PoolMapper poolMapper;
|
||||
@@ -43,7 +48,10 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "20 15,45 * * * ?")
|
||||
public void NEXA30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
System.out.println("OffLineNoticeTask 定时任务已关闭,请在nacos修改配置");
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -125,7 +133,9 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "11 16,46 * * * ?")
|
||||
public void GRS30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -203,7 +213,9 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "12 17,47 * * * ?")
|
||||
public void MONA30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -281,7 +293,9 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "14 18,48 * * * ?")
|
||||
public void DGBO30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -358,7 +372,9 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "16 19,49 * * * ?")
|
||||
public void DGBQ30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -435,7 +451,9 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "18 20,50 * * * ?")
|
||||
public void DGBS30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -512,7 +530,9 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "19 21,51 * * * ?")
|
||||
public void RXD30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -589,7 +609,9 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "20 23,53 * * * ?")
|
||||
public void ALPH30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
@@ -666,7 +688,9 @@ public class OffLineNoticeTask {
|
||||
@Scheduled(cron = "21 25,55 * * * ?")
|
||||
public void ENX30mDataToDB(){
|
||||
//String nowStr = DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:00");
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
Date now = new Date();
|
||||
int minute = (now.getMinutes() / 30) * 30;
|
||||
now.setMinutes( minute);
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.m2pool.common.core.utils.DateUtils;
|
||||
import com.m2pool.common.redis.service.RedisService;
|
||||
import com.m2pool.pool.dto.BlockInfoDto;
|
||||
import com.m2pool.pool.mapper.PoolMapper;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -18,10 +20,14 @@ import java.util.List;
|
||||
* @Date 2024/6/14 14:03
|
||||
* @Author dy
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "task.pool")
|
||||
@EnableScheduling
|
||||
public class PoolBlkStatsTask {
|
||||
|
||||
private boolean enable;
|
||||
|
||||
@Autowired
|
||||
private PoolMapper poolMapper;
|
||||
|
||||
@@ -30,6 +36,10 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "0 0/2 * * * ?")
|
||||
public void NEXABlockInfoToRedis(){
|
||||
if(!enable){
|
||||
System.out.println("PoolBlkStatsTask 定时任务已关闭,请在nacos修改配置");
|
||||
return;
|
||||
}
|
||||
|
||||
boolean result = NEXABlockInfo();
|
||||
|
||||
@@ -46,7 +56,9 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "5 0/2 * * * ?")
|
||||
public void GRSBlockInfoToRedis(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
boolean result = GRSBlockInfo();
|
||||
|
||||
int count = 1;
|
||||
@@ -62,7 +74,9 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "10 0/2 * * * ?")
|
||||
public void MONABlockInfoToRedis(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
boolean result = MONABlockInfo();
|
||||
|
||||
int count = 1;
|
||||
@@ -78,7 +92,9 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "15 0/2 * * * ?")
|
||||
public void DGBOBlockInfoToRedis(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
boolean result = DGBOBlockInfo();
|
||||
|
||||
int count = 1;
|
||||
@@ -94,7 +110,9 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "20 0/2 * * * ?")
|
||||
public void DGBQBlockInfoToRedis(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
boolean result = DGBQBlockInfo();
|
||||
|
||||
int count = 1;
|
||||
@@ -110,7 +128,9 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "25 0/2 * * * ?")
|
||||
public void DGBSBlockInfoToRedis(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
boolean result = DGBSBlockInfo();
|
||||
|
||||
int count = 1;
|
||||
@@ -126,7 +146,9 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "30 0/2 * * * ?")
|
||||
public void RXDBlockInfoToRedis(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
boolean result = RXDBlockInfo();
|
||||
|
||||
int count = 1;
|
||||
@@ -142,7 +164,9 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "35 0/2 * * * ?")
|
||||
public void ALPHBlockInfoToRedis(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
boolean result = ALPHBlockInfo();
|
||||
|
||||
int count = 1;
|
||||
@@ -158,7 +182,9 @@ public class PoolBlkStatsTask {
|
||||
|
||||
@Scheduled(cron = "40 0/2 * * * ?")
|
||||
public void ENXBlockInfoToRedis(){
|
||||
|
||||
if(!enable){
|
||||
return;
|
||||
}
|
||||
boolean result = ENXBlockInfo();
|
||||
|
||||
int count = 1;
|
||||
|
||||
@@ -2,12 +2,14 @@ package com.m2pool.pool.utils;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.m2pool.common.core.utils.DateUtils;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
@@ -25,15 +27,19 @@ public class SocketDemo {
|
||||
//} catch (IOException e) {
|
||||
// System.out.println("连接失败: " + e.getMessage());
|
||||
//}
|
||||
String url = "http://10.168.2.167:12973/blockflow/chain-info?fromGroup=0&toGroup=0";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Content-Type","application/json");
|
||||
headers.add("User-Agent", "Mozilla/5.0");
|
||||
headers.add("apikey","0x09e220e226f2feb7a971a2b6f958e7d4b1c187c8");
|
||||
HttpEntity<String> httpEntity = new HttpEntity<String>(null, headers);
|
||||
String s = HttpUtil.get(url);
|
||||
//String url = "http://10.168.2.167:12973/blockflow/chain-info?fromGroup=0&toGroup=0";
|
||||
//HttpHeaders headers = new HttpHeaders();
|
||||
//headers.add("Content-Type","application/json");
|
||||
//headers.add("User-Agent", "Mozilla/5.0");
|
||||
//headers.add("apikey","0x09e220e226f2feb7a971a2b6f958e7d4b1c187c8");
|
||||
//HttpEntity<String> httpEntity = new HttpEntity<String>(null, headers);
|
||||
//String s = HttpUtil.get(url);
|
||||
//
|
||||
//JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
//int currentHeight = jsonObject.getIntValue("currentHeight");
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||
int currentHeight = jsonObject.getIntValue("currentHeight");
|
||||
Date endDate = DateUtils.getPreviousHalfHourOrFullHour(new Date());
|
||||
Date startDate = DateUtils.getOneMonthAgo(endDate);
|
||||
System.out.println(startDate+" "+endDate);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user