update 新增挖矿账户缓存删除
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.m2pool.lease.task;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -13,6 +14,7 @@ import com.m2pool.lease.entity.*;
|
||||
import com.m2pool.lease.mapper.*;
|
||||
import com.m2pool.lease.mq.message.RabbitmqDeleteWalletMessage;
|
||||
import com.m2pool.lease.mq.message.RabbitmqPayAutoMessage;
|
||||
import com.m2pool.lease.redis.service.RedisService;
|
||||
import com.m2pool.lease.service.LeaseOrderItemService;
|
||||
import com.m2pool.lease.service.LeasePayRecordMessageInfoService;
|
||||
import com.m2pool.lease.service.LeasePayRecordMessageService;
|
||||
@@ -20,7 +22,9 @@ import com.m2pool.lease.service.LeaseUserOwnedProductService;
|
||||
import com.m2pool.lease.utils.DateUtils;
|
||||
import com.m2pool.lease.utils.HashUtils;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@@ -91,6 +95,8 @@ public class OrderAndPayTask {
|
||||
private LeaseMachineMapper leaseMachineMapper;
|
||||
@Resource
|
||||
private LedgerLogService ledgerLogService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
|
||||
/**
|
||||
* 检查钱包半年内是否有 支付,充值,提现操作
|
||||
@@ -787,6 +793,7 @@ public class OrderAndPayTask {
|
||||
Map<Long, LeaseShop> sellerInfoMap = leaseShops.stream().collect(Collectors.toMap(LeaseShop::getId, Function.identity()));
|
||||
|
||||
List<LeasePayRecordMessage> reocrdList = new ArrayList<>();
|
||||
Map<String,String> redisMapKeyFiled = new HashMap<>();
|
||||
//遍历按订单id分组后的map
|
||||
orderItemMap.forEach((orderId, orderItemList) -> {
|
||||
LeaseOrderItem firstItem = orderItemList.get(0);
|
||||
@@ -808,6 +815,9 @@ public class OrderAndPayTask {
|
||||
//实际支付金额 = 累积的实际支付金额
|
||||
totalRealAmount = totalRealAmount.add(item.getSettlePayRealAmount());
|
||||
totalNeedAmount = totalNeedAmount.add(item.getSettlePayRealAmount());
|
||||
if (!StringUtils.isEmpty(item.getUser())){
|
||||
redisMapKeyFiled.put(combinationKey(item.getPool(),item.getUser(),item.getCoin(),item.getAlgorithm()),item.getMiner());
|
||||
}
|
||||
}
|
||||
|
||||
LeasePayRecordMessage build = LeasePayRecordMessage.builder()
|
||||
@@ -867,6 +877,8 @@ public class OrderAndPayTask {
|
||||
//修改买家和卖家账户余额
|
||||
int buyerUpdate = leaseUserWalletDataMapper.updateBalanceAndBlockBalanceById(buyerUpdateRecords);
|
||||
int sellerUpdate = leaseShopConfigMapper.updateBalanceById(sellerUpdateRecords);
|
||||
|
||||
redisService.deleteCacheMapValue7(redisMapKeyFiled);
|
||||
if (buyerUpdate > 0 || sellerUpdate > 0){
|
||||
for (LeasePayRecordMessage item : reocrdList) {
|
||||
recordLog(item);
|
||||
@@ -874,6 +886,11 @@ public class OrderAndPayTask {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String combinationKey(String pool,String walletAddress,String coin,String algo){
|
||||
return pool +":"+ walletAddress +":"+ coin +":"+ algo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并相同卖家条件的支付记录消息(按 toAddress, fromSymbol, fromChain)
|
||||
* @param records 支付记录消息列表
|
||||
|
||||
Reference in New Issue
Block a user