update 矿机离线邮箱发送定时任务修改

This commit is contained in:
yyb
2025-10-13 13:33:04 +08:00
parent 4e9d55aab6
commit 6ed6c2fc70
9 changed files with 213 additions and 94 deletions

View File

@@ -44,6 +44,6 @@ public class PoolInfoDto implements Serializable {
private String model ="PPLNS";
/** 费率% 默认为1%**/
private int fee = 1;
private double fee = 1;
}

View File

@@ -288,4 +288,6 @@ public interface PoolMapper {
int deleteUsers30m(@Param("coin") String coin,@Param("date") String date);
List<NoticeMinerCoinListDto> getEmailByUsers(@Param("list") List<OfflineUserMinerDto> list,@Param("coin")String coin );
}

View File

@@ -102,4 +102,10 @@ public interface UserAccountMapper {
public boolean batchDeleteAPIByIdsAndUser(@Param("ids") List<String> ids,@Param("user") String user);
/**
* 删除挖矿账户对应的只读页面
* @param list
* @return
*/
int deleteBatchReadOnlyPage(@Param("list")List<UserAccountDto> list);
}

View File

@@ -116,6 +116,10 @@ public class PoolServiceImpl implements PoolService {
dto.setPrice(price.toEngineeringString()+ " USD");
}
}
if("sha3x".equals(pool.getCoin())){
dto.setFee(0.4);
}
//从enums中拿币种名、页面显示名、币种对应算法
dto.setCoin(pool.getCoin());

View File

@@ -267,17 +267,20 @@ public class UserMinerServiceImpl implements UserMinserService {
if(idStrs.length > 20){
return AjaxResult.error("最多同时删除20个账号");
}
List<UserAccountDto> list = new ArrayList<>();
//校验挖矿账户名是否已存在
/** 判断是否已绑定过该挖矿账号 */
Map<String,Long> map =new HashMap<>();
for(String id : idStrs){
Long maId = Convert.toLong(id,0L);
UserAccountDto dto = uaMapper.getAccountByUserAccountId(username, maId);
//删除挖矿账户对应的只读页面
if(StringUtils.isNull(dto)){
return AjaxResult.error("挖矿账号异常:未找到id:"+maId+"对应的账户");
}
map.put(id,maId);
list.add(dto);
}
//查询是否开启双重验证
@@ -293,11 +296,15 @@ public class UserMinerServiceImpl implements UserMinserService {
List<Long> idsList = map.values().stream().collect(Collectors.toList());
//删除用户挖矿账号 逻辑删除
if(uaMapper.batchDelAccount(idsList)){
//todo 修改钱包表钱包数据状态、并
//todo 日志记录
uaMapper.deleteBatchReadOnlyPage(list);
return AjaxResult.success("账号删除成功");
}else {
return AjaxResult.error("数据库执行异常");

View File

@@ -493,7 +493,7 @@ public class NeaxPriceTask {
//xtm 不通过coinmarketcap 获取币价
BlockInfo sha3xBlockInfoForXml = getSha3xBlockInfoForXml();
if (StringUtils.isNotNull(sha3xBlockInfoForXml)){
map.put("sha3x",sha3xBlockInfoForXml.getPrice());
map.put("sha3x",sha3xBlockInfoForXml.getPrice().divide(BigDecimal.valueOf(7.1),8,BigDecimal.ROUND_HALF_UP));
}
return map;

View File

@@ -70,56 +70,60 @@ public class OffLineNoticeTask {
System.out.println("查询到离线矿机结果 "+list.size()+"");
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表 TODO 这里查询notice_info为空,notice_info 里面存的从哪里来?
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.NEXA.getCoin());
System.out.println("查询到离线通知列表"+nmcList);
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"nexa");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表 TODO 这里查询notice_info为空,notice_info 里面存的从哪里来? (这张表不再使用)
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.NEXA.getCoin());
//System.out.println("查询到离线通知列表"+nmcList);
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0 TODO 这里也没看到redis里面存储的位置
Map<String, Long> map = redisService.getCacheMap("NEXA_USERS_OFFLINE");
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0 TODO 这里也没看到redis里面存储的位置
Map<String, Long> map = redisService.getCacheMap("NEXA_USERS_OFFLINE");
list.stream().forEach(e -> {
long lastOff = 0;
if(StringUtils.isNotNull(map)){
lastOff =map.getOrDefault(e.getUser(),0L);
}
if(e.getOffline() > lastOff){
//对比redis中该挖矿账户上一次离线矿机数 上一次不存在则设上一次离线数为0来进行比较
//仅当本次离线数大于上次离线数时才通知
//执行通知
List<String> emails = userEmails.getOrDefault(e.getUser(), null);
if(StringUtils.isNotNull(emails)){
String text = "您的"+Pools.NEXA.getCoin()+"下挖矿账户: "+e.getUser()+"有矿机离线!离线矿机列表如下:\n" +
e.getMiners() + " \n"+
"若您的矿机是因异常断开,请及时处理!";
emails.stream().forEach(email ->{
System.out.println("用户"+e.getUser()+"矿机离线通知到"+email);
EmailEntity entity = new EmailEntity();
entity.setSubject("[M2Pool] 矿机离线提示");
entity.setEmail(email);
entity.setText(text);
mailService.sendTextMail(entity);
});
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
list.stream().forEach(e -> {
long lastOff = 0;
if(StringUtils.isNotNull(map)){
lastOff = map.getOrDefault(e.getUser(),0L);
}
if(e.getOffline() > lastOff){
//对比redis中该挖矿账户上一次离线矿机数 上一次不存在则设上一次离线数为0来进行比较
//仅当本次离线数大于上次离线数时才通知
//执行通知
List<String> emails = userEmails.getOrDefault(e.getUser(), null);
if(StringUtils.isNotNull(emails)){
String text = "您的"+Pools.NEXA.getCoin()+"下挖矿账户: "+e.getUser()+"有矿机离线!离线矿机列表如下:\n" +
e.getMiners() + " \n"+
"若您的矿机是因异常断开,请及时处理!";
emails.stream().forEach(email ->{
System.out.println("用户"+e.getUser()+"矿机离线通知到"+email);
EmailEntity entity = new EmailEntity();
entity.setSubject("[M2Pool] 矿机离线提示");
entity.setEmail(email);
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("NEXA_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
//不满足通知条件 不通知
System.out.println("挖矿账户"+e.getUser()+"本次无需通知,本次离线为"+e.getOffline()+",上次离线数"+
map.getOrDefault(e.getUser(),0L));
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
});
}else {
System.out.println("未获取到nexa下相关的离线告警订阅信息");
}
}else {
//不满足通知条件 不通知
System.out.println("挖矿账户"+e.getUser()+"本次无需通知,本次离线为"+e.getOffline()+",上次离线数"+
map.getOrDefault(e.getUser(),0L));
}
});
}
@@ -154,21 +158,27 @@ public class OffLineNoticeTask {
List<OfflineUserMinerDto> list = poolMapper.getOfflineList(Pools.GRS.getMhs() + "30m", nowStr);
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.NEXA.getCoin());
System.out.println("查询到离线通知列表"+nmcList);
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"grs");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.NEXA.getCoin());
//System.out.println("查询到离线通知列表"+nmcList);
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0
Map<String, Long> map = redisService.getCacheMap("NEXA_USERS_OFFLINE");
Map<String, Long> map = redisService.getCacheMap("GRS_USERS_OFFLINE");
list.stream().forEach(e -> {
long lastOff = 0;
if(StringUtils.isNotNull(map)){
@@ -191,6 +201,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("GRS_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -233,17 +244,23 @@ public class OffLineNoticeTask {
List<OfflineUserMinerDto> list = poolMapper.getOfflineList(Pools.MONA.getMhs() + "30m", nowStr);
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.MONA.getCoin());
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"mona");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.MONA.getCoin());
//
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0
@@ -271,6 +288,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("MONA_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -313,17 +331,23 @@ public class OffLineNoticeTask {
List<OfflineUserMinerDto> list = poolMapper.getOfflineList(Pools.DGBO.getMhs() + "30m", nowStr);
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.DGBO.getCoin());
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"dgbo");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.DGBO.getCoin());
//
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0
@@ -350,6 +374,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("DGBO_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -392,17 +417,23 @@ public class OffLineNoticeTask {
List<OfflineUserMinerDto> list = poolMapper.getOfflineList(Pools.DGBQ.getMhs() + "30m", nowStr);
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.DGBQ.getCoin());
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"dgbq");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.DGBQ.getCoin());
//
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0
@@ -429,6 +460,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("DGBQ_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -471,17 +503,23 @@ public class OffLineNoticeTask {
List<OfflineUserMinerDto> list = poolMapper.getOfflineList(Pools.DGBS.getMhs() + "30m", nowStr);
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.DGBS.getCoin());
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"dgbs");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.DGBS.getCoin());
//
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0
@@ -508,6 +546,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("DGBS_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -550,17 +589,23 @@ public class OffLineNoticeTask {
List<OfflineUserMinerDto> list = poolMapper.getOfflineList(Pools.RXD.getMhs() + "30m", nowStr);
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.RXD.getCoin());
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"rxd");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.RXD.getCoin());
//
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0
@@ -587,6 +632,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("RXD_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -629,17 +675,23 @@ public class OffLineNoticeTask {
List<OfflineUserMinerDto> list = poolMapper.getOfflineList(Pools.ALPH.getMhs() + "30m", nowStr);
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.ALPH.getCoin());
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"alph");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.ALPH.getCoin());
//
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0
@@ -666,6 +718,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("ALPH_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -708,17 +761,23 @@ public class OffLineNoticeTask {
List<OfflineUserMinerDto> list = poolMapper.getOfflineList(Pools.ENX.getMhs() + "30m", nowStr);
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.ENX.getCoin());
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"enx");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.ENX.getCoin());
//
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0
@@ -745,6 +804,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("ENX_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -790,17 +850,23 @@ public class OffLineNoticeTask {
System.out.println("查询到离线矿机结果 "+list.size()+"");
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表 TODO 这里查询notice_info为空,notice_info 里面存的从哪里来?
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.MONERO.getCoin());
System.out.println("查询到离线通知列表"+nmcList);
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"monero");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表 TODO 这里查询notice_info为空,notice_info 里面存的从哪里来?
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.MONERO.getCoin());
//System.out.println("查询到离线通知列表"+nmcList);
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0 TODO 这里也没看到redis里面存储的位置
@@ -827,6 +893,7 @@ public class OffLineNoticeTask {
entity.setText(text);
mailService.sendTextMail(entity);
});
redisService.setCacheMapValue("MONERO_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
@@ -874,17 +941,23 @@ public class OffLineNoticeTask {
System.out.println("查询到离线矿机结果 "+list.size()+"");
if(StringUtils.isNotEmpty(list)){
//list不为空才处理
//先获取通知列表 TODO 这里查询notice_info为空,notice_info 里面存的从哪里来?
List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.SHA3X.getCoin());
System.out.println("查询到离线通知列表"+nmcList);
//获取user 对应的邮箱
List<NoticeMinerCoinListDto> nmcList = poolMapper.getEmailByUsers(list,"sha3x");
Map<String, List<String>> userEmails = nmcList.stream().
collect(Collectors.groupingBy(
NoticeMinerCoinListDto::getMiner,
Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
));
//先获取通知列表 TODO 这里查询notice_info为空,notice_info 里面存的从哪里来?
//List<NoticeMinerCoinListDto> nmcList = noticeMapper.getNoticeEmailListByMinerAndCoin(list, Pools.SHA3X.getCoin());
//System.out.println("查询到离线通知列表"+nmcList);
//Map<String, List<String>> userEmails = nmcList.stream().
// collect(Collectors.groupingBy(
// NoticeMinerCoinListDto::getMiner,
// Collectors.mapping(NoticeMinerCoinListDto::getEmail, Collectors.toList())
// ));
if(StringUtils.isNotEmpty(userEmails)){
//获取上一次离线矿机数 可能为null 要做处理 如果没有redis记录 则上次离线数设置为0 若有redis但是key没有此挖矿账户也设置上次离线数为0 TODO 这里也没看到redis里面存储的位置
@@ -914,6 +987,7 @@ public class OffLineNoticeTask {
}else {
System.out.println("该用户未添加离线通知 :"+userEmails.toString());
}
redisService.setCacheMapValue("SHA3X_USERS_OFFLINE",e.getUser(),e.getOffline());
}else {
//不满足通知条件 不通知

View File

@@ -1018,6 +1018,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select height,difficulty,power,reward,fees,profit from sha3x_block_info order by id desc limit 1;
</select>
<insert id="insertXtmBlockInfo">
insert into sha3x_block_info (height,difficulty,power,reward,fees,profit,price)
values(#{blockInfo.height}
@@ -1033,6 +1034,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteMhs30m">delete from ${coin}_mhs30m where `date` = #{date} </delete>
<delete id="deletePool30m">delete from ${coin}_pool_30m where `date` = #{date}</delete>
<delete id="deleteUsers30m">delete from ${coin}_users_30m where `date` = #{date}</delete>
<select id="getEmailByUsers" resultType="com.m2pool.pool.dto.NoticeMinerCoinListDto">
select
`user` email,
miner_user miner
from
user_miner_account
where
coin = #{coin} and `miner_user` in
<foreach collection="list" item="i" separator="," open="(" close=")" index="index">
#{i.user}
</foreach>
</select>
</mapper>

View File

@@ -131,6 +131,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
and `user` = #{user}
</delete>
<delete id="deleteBatchReadOnlyPage">
DELETE FROM user_page_info
WHERE (
<foreach collection="list" item="item" separator=" OR ">
`user` = #{item.user}
AND account = #{item.account}
AND coin = #{item.coin}
</foreach>
)
</delete>
<select id="getAccountByUserAndMinerAccount" resultType="com.m2pool.pool.dto.UserAccountDto">
select
@@ -255,7 +266,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
user_page_info
where
`user` =#{user}
order by create_time desc
order by coin,create_time desc
</select>
<select id="getPageInfoByKey" resultType="com.m2pool.pool.entity.UserReadOnlyPageInfo">