src/main/java/com/xcong/excoin/common/system/controller/CommonController.java
@@ -7,6 +7,7 @@ import com.xcong.excoin.common.system.dto.Base64UploadDto; import com.xcong.excoin.common.system.service.CommonService; import com.xcong.excoin.configurations.properties.AliOssProperties; import com.xcong.excoin.modules.blackchain.service.TrxUsdtUpdateService; import com.xcong.excoin.utils.MessageSourceUtils; import com.xcong.excoin.utils.OssUtils; import com.xcong.excoin.utils.RedisUtils; @@ -19,10 +20,13 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.BigInteger; import java.util.HashMap; import java.util.Map; @@ -107,4 +111,21 @@ } return Result.fail(MessageSourceUtils.getString("uploadFile_controller_0001")); } @Autowired private TrxUsdtUpdateService trxUsdtUpdateService; @ApiOperation(value = "trc20测试") @GetMapping(value = "/getTrc20Test") public Result getTrc20Test() { long start = System.currentTimeMillis(); System.out.println(start); long getnowblock = trxUsdtUpdateService.getnowblock(); System.out.println(System.currentTimeMillis()); Object trc20BlockNum = redisUtils.get("USDT_TRC20_BLOCK_NUM"); TrxUsdtUpdateService.getblockbynum(BigInteger.valueOf(Long.parseLong(trc20BlockNum.toString()))); long end = System.currentTimeMillis(); System.out.println(end); return Result.ok(end - start); } } src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java
@@ -128,6 +128,7 @@ } } catch (Exception e) { log.error("平仓异常", e); throw e; } } @@ -181,13 +182,12 @@ // 盈亏比例(回报率) BigDecimal rewardRatio = profitOrLoss.divide(holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()), 8, BigDecimal.ROUND_DOWN); FollowTraderInfoEntity traderInfoEntity = null; FollowTraderInfoEntity traderInfoEntity = followTraderInfoDao.selectTraderInfoByOrderId(holdOrderEntity.getId()); // 判断当前订单是否为跟单 if (ContractOrderEntity.CONTRACTTYPE_DOCUMENTARY == holdOrderEntity.getContractType()) { // 若不为交易员且不是测试账号,则计算跟随者订单返利 if (!MemberEntity.IS_TRADER_Y.equals(memberEntity.getIsTrader()) && !MemberEntity.ACCOUNT_TYPE_TEST.equals(memberEntity.getAccountType())) { traderInfoEntity = followTraderInfoDao.selectTraderInfoByOrderId(holdOrderEntity.getId()); if (profitOrLoss.compareTo(BigDecimal.ZERO) > 0) { // 计算需返利给交易员的金额 BigDecimal returnMoney = profitOrLoss.multiply(traderInfoEntity.getProfitRatio()); src/main/java/com/xcong/excoin/quartz/job/BlockCoinUpdateJob.java
@@ -6,6 +6,7 @@ import com.xcong.excoin.modules.member.dao.MemberCoinAddressDao; import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity; import com.xcong.excoin.utils.RedisUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Async; @@ -23,6 +24,7 @@ * @author wzy * @date 2020-07-02 **/ @Slf4j @Component //@ConditionalOnProperty(prefix = "app", name = "block-job", havingValue = "true") public class BlockCoinUpdateJob { @@ -44,7 +46,7 @@ /** * TRC20_USDT 同步 */ @Scheduled(cron = "0/2 * * * * ? ") @Scheduled(cron = "0/3 * * * * ? ") @Async public void usdtTc20Update() { // 波场3秒出一个块