src/main/java/com/xcong/excoin/configurations/ScheduleConfig.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/xcong/excoin/quartz/job/BlockCoinUpdateJob.java | ●●●●● patch | view | raw | blame | history |
src/main/java/com/xcong/excoin/configurations/ScheduleConfig.java
New file @@ -0,0 +1,18 @@ package com.xcong.excoin.configurations; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.config.ScheduledTaskRegistrar; import java.util.concurrent.Executors; @Configuration public class ScheduleConfig implements SchedulingConfigurer { @Override public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { taskRegistrar.setScheduler(Executors.newScheduledThreadPool(50)); } } src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcEntrustOrderServiceImpl.java
@@ -2,6 +2,7 @@ import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -32,12 +33,15 @@ import com.xcong.excoin.modules.otc.vo.EntrustListVo; import com.xcong.excoin.modules.otc.vo.EntrustOrderDetailVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import netscape.javascript.JSObject; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.List; @Slf4j @Service @RequiredArgsConstructor public class OtcEntrustOrderServiceImpl extends ServiceImpl<OtcEntrustOrderDao, OtcEntrustOrder> implements OtcEntrustOrderService { @@ -76,8 +80,8 @@ if (OtcEntrustOrder.ORDER_TYPE_S.equals(addDto.getType())) { MemberWalletCoinEntity coinWallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), "USDT"); BigDecimal multiply = addDto.getUnitPrice().multiply(coinWallet.getAvailableBalance()); if(multiply.compareTo(totalAmount) < 0) { // BigDecimal multiply = addDto.getUnitPrice().multiply(coinWallet.getAvailableBalance()); if(coinWallet.getAvailableBalance().compareTo(addDto.getAmount()) < 0) { throw new GlobalException("可用金额不足"); } @@ -192,7 +196,7 @@ if (OtcEntrustOrder.ORDER_TYPE_S.equals(otcEntrustOrder.getOrderType())) { MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), "USDT"); memberWalletCoinDao.subFrozenBalance(member.getId(), wallet.getId(), wallet.getFrozenBalance()); memberWalletCoinDao.subFrozenBalance(member.getId(), wallet.getId(), otcEntrustOrder.getRemainCoinAmount()); } otcEntrustOrder = new OtcEntrustOrder(); src/main/java/com/xcong/excoin/quartz/job/BlockCoinUpdateJob.java
@@ -53,7 +53,6 @@ if (blocnNum == null) { return; } log.info("=====>>{}", blocnNum); usdtUpdateProducer.sendTrc20BlockMsg(blocnNum.toString()); redisUtils.set("USDT_TRC20_CURRENT_BLOCK_NUM", blocnNum); // try { @@ -72,7 +71,6 @@ public void usdtTc20UpdateQueue() { // 查询最新区块号 long getnowblock = trxUsdtUpdateService.getnowblockFromTronScan() - 25; log.info("=======>{}", getnowblock); // 拿到redis里最新区块 Object trc20BlockNum = redisUtils.get("USDT_TRC20_BLOCK_NUM"); if (trc20BlockNum == null) {