src/main/java/com/xcong/excoin/modules/coin/parameter/vo/CoinInListVo.java
@@ -21,7 +21,7 @@ * 金额 */ @ApiModelProperty(value = "金额") private BigDecimal amount; private String amount; /** * 记录内容 */ src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
@@ -93,7 +93,7 @@ public Result getWalletCoin() { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); // Long memberId = 446L; // Long memberId = 444L; PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne(); BigDecimal cnyUsdt = cnyUsdtExchange.getValue(); @@ -107,10 +107,10 @@ for (MemberWalletCoinEntity memberWalletCoinEntity : memberWalletCoinlist) { if ("USDT".equals(memberWalletCoinEntity.getWalletCode()) || "XCH".equals(memberWalletCoinEntity.getWalletCode())) { MemberWalletCoinInfoVo memberWalletCoinInfoVo = new MemberWalletCoinInfoVo(); memberWalletCoinInfoVo.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN)); memberWalletCoinInfoVo.setFrozenBalance(memberWalletCoinEntity.getFrozenBalance().setScale(4, BigDecimal.ROUND_DOWN)); memberWalletCoinInfoVo.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance().setScale(8, BigDecimal.ROUND_DOWN)); memberWalletCoinInfoVo.setFrozenBalance(memberWalletCoinEntity.getFrozenBalance().setScale(8, BigDecimal.ROUND_DOWN)); memberWalletCoinInfoVo.setMemberId(memberWalletCoinEntity.getMemberId()); memberWalletCoinInfoVo.setTotalBalance(memberWalletCoinEntity.getTotalBalance().setScale(4, BigDecimal.ROUND_DOWN)); memberWalletCoinInfoVo.setTotalBalance(memberWalletCoinEntity.getTotalBalance().setScale(8, BigDecimal.ROUND_DOWN)); memberWalletCoinInfoVo.setWalletCode(memberWalletCoinEntity.getWalletCode()); memberWalletCoinInfoVolist.add(memberWalletCoinInfoVo); } @@ -1035,7 +1035,7 @@ for(MemberCoinChargeEntity memberCoinChargeEntitys : records) { CoinInListVo coinInListVo = new CoinInListVo(); coinInListVo.setSymbol(memberCoinChargeEntitys.getSymbol()); coinInListVo.setAmount(memberCoinChargeEntitys.getAmount()); coinInListVo.setAmount(memberCoinChargeEntitys.getAmount().toPlainString()); coinInListVo.setContent("充币"); coinInListVo.setStatus(memberCoinChargeEntitys.getStatus()); coinInListVo.setUpdateTime(memberCoinChargeEntitys.getUpdateTime()); @@ -1059,7 +1059,7 @@ for(MemberCoinWithdrawEntity memberCoinWithdrawEntitys : records) { CoinInListVo coinInListVo = new CoinInListVo(); coinInListVo.setSymbol(memberCoinWithdrawEntitys.getSymbol()); coinInListVo.setAmount(memberCoinWithdrawEntitys.getAmount()); coinInListVo.setAmount(memberCoinWithdrawEntitys.getAmount().toPlainString()); coinInListVo.setContent("提币"); int status = memberCoinWithdrawEntitys.getStatus(); int statusOut = 0; @@ -1095,7 +1095,7 @@ for(MemberAccountMoneyChange memberAccountMoneyChanges : records) { CoinInListVo coinInListVo = new CoinInListVo(); coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol()); coinInListVo.setAmount(memberAccountMoneyChanges.getAmount()); coinInListVo.setAmount(memberAccountMoneyChanges.getAmount().toPlainString()); coinInListVo.setContent(memberAccountMoneyChanges.getContent()); coinInListVo.setStatus(memberAccountMoneyChanges.getStatus()); coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime()); @@ -1119,7 +1119,7 @@ for(MemberAccountMoneyChange memberAccountMoneyChanges : records) { CoinInListVo coinInListVo = new CoinInListVo(); coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol()); coinInListVo.setAmount(memberAccountMoneyChanges.getAmount()); coinInListVo.setAmount(memberAccountMoneyChanges.getAmount().toPlainString()); coinInListVo.setContent(memberAccountMoneyChanges.getContent()); coinInListVo.setStatus(memberAccountMoneyChanges.getStatus()); coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime()); src/main/java/com/xcong/excoin/modules/yunding/dao/YdOrderDao.java
@@ -30,4 +30,6 @@ IPage<AgentVo> getAgentList(Page<AgentVo> page, @Param("record") YdBasicLevelSettingEntity ydBasicLevelSettingEntity); List<YdOrderEntity> selectTeamAllPower(@Param("inviteId") String inviteId); int updateOrderProfit(@Param("profit") BigDecimal profit, @Param("id") Long id); } src/main/java/com/xcong/excoin/modules/yunding/service/Impl/XchProfitServiceImpl.java
@@ -16,6 +16,7 @@ import com.xcong.excoin.modules.yunding.entity.YdOrderEntity; import com.xcong.excoin.modules.yunding.entity.YdProductEntity; import com.xcong.excoin.modules.yunding.service.XchProfitService; import com.xcong.excoin.rabbit.producer.YunDingProducter; import com.xcong.excoin.utils.LogRecordUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -44,6 +45,9 @@ @Autowired private YdBasicLevelSettingDao ydBasicLevelSettingDao; @Autowired private YunDingProducter yunDingProducter; @Override @Transactional(rollbackFor = Exception.class) public void autoBeAgent(Long id) { @@ -68,7 +72,7 @@ update.setAgentLevel(2); memberDao.updateById(update); } } else if (memberEntity.getAgentLevel() != null && member.getAgentLevel() == 2){ } else if (memberEntity.getAgentLevel() != null && memberEntity.getAgentLevel() == 2){ // 判断是否达到总代标准 if(becomeZd(memberEntity, settings.get(0))) { update.setAgentLevel(1); @@ -147,6 +151,8 @@ public void usdtProfitDistributorByOrderId(Long id) { YdOrderEntity ydOrderEntity = ydOrderDao.selectById(id); usdtProfitDistributor(ydOrderEntity); yunDingProducter.sendYunDingAutoAgent(ydOrderEntity.getMemberId()); } private void usdtProfitDistributor(YdOrderEntity order) { @@ -257,11 +263,12 @@ } } remainProfit = remainProfit.subtract(orderProfit.subtract(orderProfit.multiply(order.getYdProductEntity().getManageExpense()))); remainProfit = remainProfit.subtract(orderProfit.multiply(order.getYdProductEntity().getManageExpense())); String content = "XCH收益"; LogRecordUtils.insertMemberAccountMoneyChangeWithId(order.getMemberId(), content, remainProfit, "XCH", 1, 4, order.getId()); MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(order.getMemberId(), "XCH"); ydOrderDao.updateOrderProfit(remainProfit, order.getId()); memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), remainProfit, BigDecimal.ZERO, 0); } } src/main/java/com/xcong/excoin/modules/yunding/service/Impl/YunDingServiceImpl.java
@@ -109,7 +109,7 @@ for(YdProductVo ydProductVo : records){ ydProductVo.setProfitT(prifitT); if(ydProductVo.getTotalT().compareTo(BigDecimal.ZERO) < 1) { if(ydProductVo.getSurplusT().compareTo(BigDecimal.ZERO) < 1) { ydProductVo.setStatus(2); } } @@ -148,10 +148,8 @@ Date endTime = DateUtil.offsetDay(workTime, proCycle); ydProductVo.setEndTime(endTime); if (ydProductVo.getTotalT().compareTo(BigDecimal.ZERO) < 1) { if (ydProductVo.getSurplusT().compareTo(BigDecimal.ZERO) < 1) { ydProductVo.setStatus(2); } else { ydProductVo.setStatus(1); } return Result.ok(ydProductVo); } @@ -282,7 +280,6 @@ "USDT", 1, 3, ydOrderEntity.getId()); yunDingProducter.sendYunDingUsdtProfit(ydOrderEntity.getId()); yunDingProducter.sendYunDingAutoAgent(ydOrderEntity.getMemberId()); return Result.ok("支付成功"); } @@ -587,7 +584,6 @@ memberEntity.setAgentLevel(id.intValue()); LoginUserUtils.resetAppLoginUser(memberEntity); yunDingProducter.sendYunDingAutoAgent(memberId); yunDingProducter.sendYunDingUsdtProfit(orderEntity.getId()); return Result.ok("购买成功"); } src/main/java/com/xcong/excoin/rabbit/consumer/YunDingConsumer.java
@@ -29,7 +29,11 @@ public void xchAutoAgent(Message message, Channel channel) { String content = new String(message.getBody()); log.info("自动升级代理消息 : {}", content); try { xchProfitService.autoBeAgent(Long.parseLong(content)); } catch (Exception e) { log.info("错误",e); } } src/main/resources/application.yml
@@ -108,7 +108,7 @@ rabbit-consumer: false block-job: false xch-job: false yunding-consumer: true yunding-consumer: false aliyun: oss: src/main/resources/mapper/member/MemberDao.xml
@@ -56,13 +56,14 @@ <association property="ydBasicLevelSettingEntity" javaType="com.xcong.excoin.modules.yunding.entity.YdBasicLevelSettingEntity"> <result property="level" column="level"/> <result property="usdtRatio" column="usdt_ratio" /> <result property="xchRatio" column="xch_ratio" /> </association> </resultMap> <select id="selectYdParentAgent" resultMap="memberAgentMap"> select a.*, b.level, b.usdt_ratio from member a select a.*, b.level, b.usdt_ratio, b.xch_ratio from member a inner join yd_basic_level_setting b on a.agent_level=b.id where a.invite_id in where a.invite_id!='rxadr3' and a.invite_id in <foreach collection = "list" item = "item" separator="," open = "(" close = ")" > #{item} </foreach > src/main/resources/mapper/yunding/YdOrderDao.xml
@@ -96,4 +96,11 @@ inner join yd_product c on c.id = a.product_id where a.type=1 </select> <update id="updateOrderProfit"> update yd_order set total_profit=total_profit+#{profit}, today_profit=#{profit} where id=#{id} </update> </mapper> src/test/java/com/xcong/excoin/XchTest.java
@@ -3,6 +3,8 @@ import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import com.xcong.excoin.modules.coin.parameter.dto.CoinInListDto; import com.xcong.excoin.modules.coin.service.CoinService; import com.xcong.excoin.modules.yunding.dao.YdOrderDao; import com.xcong.excoin.modules.yunding.entity.YdOrderEntity; import com.xcong.excoin.modules.yunding.service.XchProfitService; @@ -65,4 +67,16 @@ public void xchProfitTest() { xchProfitService.xchProfitDistributor(BigDecimal.valueOf(1)); } @Autowired private CoinService coinService; @Test public void coinTest() { CoinInListDto coin = new CoinInListDto(); coin.setType(4); coin.setPageNum(1); coin.setPageSize(10); coinService.coinInList(coin); } }