From 89b7fb1d316cfce7eb98a27c8d668da493933f7f Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 25 Feb 2022 16:29:07 +0800 Subject: [PATCH] 20222223 --- src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java | 2 src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java | 11 src/main/java/com/xcong/excoin/utils/CoinTypeConvert.java | 12 src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberTeamVo.java | 21 + src/main/java/com/xcong/excoin/websocket/TradePlateSendWebSocket.java | 4 src/main/java/com/xcong/excoin/common/enumerates/CoinTypeEnum.java | 2 src/main/java/com/xcong/excoin/modules/member/controller/MemberController.java | 44 +-- src/main/java/com/xcong/excoin/processor/DefaultCoinProcessor.java | 2 src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java | 8 src/main/java/com/xcong/excoin/common/enumerates/SymbolEnum.java | 2 src/main/java/com/xcong/excoin/modules/coin/controller/ZhiyaController.java | 110 ++++++++ src/main/java/com/xcong/excoin/modules/coin/service/impl/ZhiyaServiceImpl.java | 380 +++++++++++++++++++++++++++++ src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberTeamRecordsPageDto.java | 25 + src/main/java/com/xcong/excoin/quartz/job/ZhiyarRewardJob.java | 6 src/main/java/com/xcong/excoin/modules/coin/controller/GbzOrderController.java | 10 src/main/java/com/xcong/excoin/modules/coin/service/ZhiyaService.java | 28 ++ src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java | 29 + src/main/resources/mapper/member/MemberDao.xml | 8 src/main/java/com/xcong/excoin/modules/symbols/constants/SymbolsConstats.java | 4 src/main/java/com/xcong/excoin/rabbit/consumer/ExchangeConsumer.java | 2 src/main/java/com/xcong/excoin/modules/member/dao/MemberDao.java | 5 src/main/java/com/xcong/excoin/modules/member/service/MemberService.java | 15 - 22 files changed, 646 insertions(+), 84 deletions(-) diff --git a/src/main/java/com/xcong/excoin/common/enumerates/CoinTypeEnum.java b/src/main/java/com/xcong/excoin/common/enumerates/CoinTypeEnum.java index 8fe6b6a..0d2d8b0 100644 --- a/src/main/java/com/xcong/excoin/common/enumerates/CoinTypeEnum.java +++ b/src/main/java/com/xcong/excoin/common/enumerates/CoinTypeEnum.java @@ -7,6 +7,6 @@ */ public enum CoinTypeEnum { // USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,BEA,GUSD,GOLDRICE, - USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,GOLDRICE, + USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,GRICE, // USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,GUSD,GOLDRICE, } diff --git a/src/main/java/com/xcong/excoin/common/enumerates/SymbolEnum.java b/src/main/java/com/xcong/excoin/common/enumerates/SymbolEnum.java index 4a5ebc2..19950fa 100644 --- a/src/main/java/com/xcong/excoin/common/enumerates/SymbolEnum.java +++ b/src/main/java/com/xcong/excoin/common/enumerates/SymbolEnum.java @@ -9,7 +9,7 @@ public enum SymbolEnum { // BEA("BEA", "BEA/USDT") // ,GUSD("GUSD", "GUSD/USDT") - GOLDRICE("GOLDRICE", "GOLDRICE/USDT") + GRICE("GRICE", "GRICE/USDT") ,BTC("BTC", "BTC/USDT") ,ETH("ETH", "ETH/USDT") ,LTC("LTC", "LTC/USDT") diff --git a/src/main/java/com/xcong/excoin/modules/coin/controller/GbzOrderController.java b/src/main/java/com/xcong/excoin/modules/coin/controller/GbzOrderController.java index e6e415e..0419268 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/controller/GbzOrderController.java +++ b/src/main/java/com/xcong/excoin/modules/coin/controller/GbzOrderController.java @@ -74,7 +74,7 @@ } if (Integer.parseInt(total) < gbzAddDto.getCount()) { - return Result.fail("GOLDRICE数量不足"); + return Result.fail("GRICE数量不足"); } GbzOrderEntity gbzOrder = new GbzOrderEntity(); @@ -82,14 +82,14 @@ gbzOrder.setAmount(amount); gbzOrder.setCnt(gbzAddDto.getCount()); gbzOrder.setMemberId(loginUser.getId()); - gbzOrder.setSymbol(CoinTypeEnum.GOLDRICE.name()); + gbzOrder.setSymbol(CoinTypeEnum.GRICE.name()); gbzOrder.setStatus(1); gbzOrderDao.insert(gbzOrder); memberWalletCoinDao.updateBlockBalance(wallet.getId(), amount.negate(), BigDecimal.ZERO, 0); redisUtils.set("bea_coin_total", Integer.parseInt(total) - gbzAddDto.getCount()); - LogRecordUtils.insertMemberAccountMoneyChange(loginUser.getId(), "购买GOLDRICE", amount, "USDT", 1, 1); + LogRecordUtils.insertMemberAccountMoneyChange(loginUser.getId(), "购买GRICE", amount, "USDT", 1, 1); return Result.ok("购买成功"); } @@ -144,11 +144,11 @@ } MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), CoinTypeEnum - .GOLDRICE.name()); + .GRICE.name()); memberWalletCoinDao.updateBlockBalance(wallet.getId(), totalAmount, BigDecimal.ZERO, 0); gbzOrderDao.updateStatus(member.getId()); - LogRecordUtils.insertMemberAccountMoneyChange(member.getId(), "提取GOLDRICE到资产", totalAmount, "GOLDRICE", 1, 1); + LogRecordUtils.insertMemberAccountMoneyChange(member.getId(), "提取GRICE到资产", totalAmount, "GRICE", 1, 1); return Result.ok("提取成功"); } } diff --git a/src/main/java/com/xcong/excoin/modules/coin/controller/ZhiyaController.java b/src/main/java/com/xcong/excoin/modules/coin/controller/ZhiyaController.java new file mode 100644 index 0000000..d8a5f7a --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/coin/controller/ZhiyaController.java @@ -0,0 +1,110 @@ +package com.xcong.excoin.modules.coin.controller; + +import com.xcong.excoin.common.annotations.SubmitRepeat; +import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.coin.parameter.dto.*; +import com.xcong.excoin.modules.coin.parameter.vo.MemberGusdInfoVo; +import com.xcong.excoin.modules.coin.parameter.vo.UsdtToGusdVo; +import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo; +import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaRewardVo; +import com.xcong.excoin.modules.coin.service.CoinService; +import com.xcong.excoin.modules.coin.service.ZhiyaService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.math.BigDecimal; + +@Slf4j +@Api(value = "质押接口", tags = "质押接口") +@RestController +@RequestMapping(value = "/api/zhiya") +public class ZhiyaController { + + @Resource + private ZhiyaService zhiyaService; + + /** + * 获取GUSD账户信息 + */ + @ApiOperation(value="获取GUSD账户信息", notes="获取GUSD账户信息") + @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberGusdInfoVo.class)}) + @GetMapping(value="/findMemberGusdInfo") + public Result findMemberGusdInfo() { + return zhiyaService.findMemberGusdInfo(); + } + + /** + * USDT兌換成GUSD + * @return + */ + @ApiOperation(value="USDT兌換成GUSD", notes="USDT兌換成GUSD") + @PostMapping(value="/usdtToGusd") + @SubmitRepeat + public Result usdtToGusd(@RequestBody @Valid UsdtToGusdDto usdtToGusdDto) { + BigDecimal balance = usdtToGusdDto.getBalance(); + Integer type = usdtToGusdDto.getType(); + return zhiyaService.usdtToGusd(balance,type); + } + + /** + * 获取兌換GUSD记录 + * @return + */ + @ApiOperation(value="获取兌換GUSD记录", notes="获取兌換GUSD记录") + @ApiResponses({@ApiResponse( code = 200, message = "success", response = UsdtToGusdVo.class)}) + @PostMapping(value="/getusdtToGusdRecords") + public Result getusdtToGusdRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) { + return zhiyaService.getusdtToGusdRecords(recordsPageDto); + } + + /** + * 质押GUSD + */ + @ApiOperation(value="质押GUSD", notes="质押GUSD") + @PostMapping(value="/zhiYaGusd") + @SubmitRepeat + public Result zhiYaGusd(@RequestBody @Valid ZhiYaGusdDto zhiYaGusdDto) { + BigDecimal balance = zhiYaGusdDto.getBalance(); + return zhiyaService.zhiYaGusd(balance); + } + + /** + * 获取质押GUSD记录 + * @return + */ + @ApiOperation(value="获取质押GUSD记录", notes="获取质押GUSD记录") + @ApiResponses({@ApiResponse( code = 200, message = "success", response = ZhiyaInfoVo.class)}) + @PostMapping(value="/getZhiyaRecords") + public Result getZhiyaRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) { + return zhiyaService.getZhiyaRecords(recordsPageDto); + } + + /** + * 赎回GUSD + */ + @ApiOperation(value="赎回GUSD", notes="赎回GUSD") + @PostMapping(value="/shuhuiGusd") + @SubmitRepeat + public Result shuhuiGusd(@RequestBody @Valid ShuhuiGusdDto shuhuiGusdDto) { + BigDecimal balance = shuhuiGusdDto.getBalance(); + Long id = shuhuiGusdDto.getId(); + return zhiyaService.shuhuiGusd(balance,id); + } + + /** + * 获取质押GUSD奖励记录 + * @return + */ + @ApiOperation(value="获取质押GUSD奖励记录", notes="获取质押GUSD奖励记录") + @ApiResponses({@ApiResponse( code = 200, message = "success", response = ZhiyaRewardVo.class)}) + @PostMapping(value="/getZhiyaReward") + public Result getZhiyaReward(@RequestBody @Valid ZhiyaRewardRecordsPageDto recordsPageDto) { + return zhiyaService.getZhiyaReward(recordsPageDto); + } +} diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/ZhiyaService.java b/src/main/java/com/xcong/excoin/modules/coin/service/ZhiyaService.java new file mode 100644 index 0000000..4e0e95a --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/coin/service/ZhiyaService.java @@ -0,0 +1,28 @@ +package com.xcong.excoin.modules.coin.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.coin.entity.ZhiYaEntity; +import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; +import com.xcong.excoin.modules.coin.parameter.dto.ZhiyaRewardRecordsPageDto; + +import java.math.BigDecimal; + +public interface ZhiyaService extends IService<ZhiYaEntity> { + + Result usdtToGusd(BigDecimal balance, Integer type); + + Result zhiYaGusd(BigDecimal balance); + + Result shuhuiGusd(BigDecimal balance,Long id); + + Result findMemberGusdInfo(); + + Result getZhiyaRecords(RecordsPageDto recordsPageDto); + + Result getusdtToGusdRecords(RecordsPageDto recordsPageDto); + + void grantZhiyaAmount(); + + Result getZhiyaReward(ZhiyaRewardRecordsPageDto recordsPageDto); +} diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java index 6c8fb65..a7d058c 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java @@ -470,7 +470,7 @@ } Long memberId = memberCoinAddress.getMemberId(); // 查询钱包 并更新 - MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.GOLDRICE.name()); + MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.GRICE.name()); if (walletCoinEntity == null) { // 创建一个钱包 // 创建这个钱包 @@ -486,15 +486,15 @@ memberWalletCoinDao.updateBlockBalance(walletCoinEntity.getId(), balance, BigDecimal.ZERO, 0); - String orderNo = insertCoinCharge(address, memberId, balance, CoinTypeEnum.GOLDRICE.name(), "", BigDecimal.ZERO, null); + String orderNo = insertCoinCharge(address, memberId, balance, CoinTypeEnum.GRICE.name(), "", BigDecimal.ZERO, null); // 插入财务记录 - LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", balance, CoinTypeEnum.GOLDRICE.name(), 1, 1); + LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", balance, CoinTypeEnum.GRICE.name(), 1, 1); try { ThreadPoolUtils.sendDingTalk(5); MemberEntity member = memberDao.selectById(memberId); if (StrUtil.isNotBlank(member.getPhone())) { - String amount = balance.toPlainString() + "GOLDRICE"; + String amount = balance.toPlainString() + "GRICE"; Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); } else { SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java index fa81e53..fbb1d90 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java @@ -150,7 +150,7 @@ memberWalletCoinlist.add(coin); // coin.setWalletCode(CoinTypeEnum.GUSD.toString()); // memberWalletCoinlist.add(coin); - coin.setWalletCode(CoinTypeEnum.GOLDRICE.toString()); + coin.setWalletCode(CoinTypeEnum.GRICE.toString()); memberWalletCoinlist.add(coin); MemberWalletCoinVo memberWalletCoinVo = new MemberWalletCoinVo(); @@ -774,6 +774,9 @@ // zhiYaRecord.setEffectDate(newDate); // zhiYaRecordDao.updateById(zhiYaRecord); // } + //更新团队算力表 + //只计算直属团队的算力信息 + return Result.ok(MessageSourceUtils.getString("member_service_0024")); } @@ -864,7 +867,7 @@ @Override @Transactional public void grantZhiyaAmount() { - //获取每日总奖励 + //获取每日总产出 BigDecimal gusdReward = new BigDecimal(redisUtils.getString("GUSDREWARD")); //获取每日质押总数 Long totalGusd = zhiYaRecordDao.selectTotalGusdByStatueAndTime(1,new Date()); @@ -884,6 +887,10 @@ zhiyaRewardEntity.setMemberId(zhiYaRecordEntity.getMemberId()); zhiyaRewardEntity.setRewardAmout(divide.multiply(zhiYaRecordEntity.getZhiyaCnt())); zhiyaRewardDao.insert(zhiyaRewardEntity); + + //给团队上级发送奖励goldrice + //给账户的冻结 + } } } diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java index 58fb1de..cafef80 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java @@ -809,7 +809,7 @@ @Override public Result findAllWalletCoinOrder() { - List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.GOLDRICE.toString()); + List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.GRICE.toString()); return Result.ok(orderCoinsDealEntities); } diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/ZhiyaServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/ZhiyaServiceImpl.java new file mode 100644 index 0000000..dba4d77 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/ZhiyaServiceImpl.java @@ -0,0 +1,380 @@ +package com.xcong.excoin.modules.coin.service.impl; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.xcong.excoin.common.LoginUserUtils; +import com.xcong.excoin.common.enumerates.MemberWalletCoinEnum; +import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao; +import com.xcong.excoin.modules.coin.dao.ZhiYaDao; +import com.xcong.excoin.modules.coin.dao.ZhiYaRecordDao; +import com.xcong.excoin.modules.coin.dao.ZhiyaRewardDao; +import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; +import com.xcong.excoin.modules.coin.entity.ZhiYaEntity; +import com.xcong.excoin.modules.coin.entity.ZhiYaRecordEntity; +import com.xcong.excoin.modules.coin.entity.ZhiyaRewardEntity; +import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; +import com.xcong.excoin.modules.coin.parameter.dto.ZhiyaRewardRecordsPageDto; +import com.xcong.excoin.modules.coin.parameter.vo.MemberGusdInfoVo; +import com.xcong.excoin.modules.coin.parameter.vo.UsdtToGusdVo; +import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo; +import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaRewardVo; +import com.xcong.excoin.modules.coin.service.ZhiyaService; +import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao; +import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; +import com.xcong.excoin.utils.MessageSourceUtils; +import com.xcong.excoin.utils.RedisUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; + +@Service +public class ZhiyaServiceImpl extends ServiceImpl<ZhiYaDao, ZhiYaEntity> implements ZhiyaService { + + @Resource + MemberWalletCoinDao memberWalletCoinDao; + @Resource + MemberAccountMoneyChangeDao memberAccountMoneyChangeDao; + @Resource + ZhiYaRecordDao zhiYaRecordDao; + @Resource + ZhiyaRewardDao zhiyaRewardDao; + @Resource + ZhiYaDao zhiYaDao; + @Resource + RedisUtils redisUtils; + @Override + @Transactional + public Result usdtToGusd(BigDecimal balance, Integer type) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + if (balance.compareTo(BigDecimal.ZERO) <= 0) { + return Result.fail(MessageSourceUtils.getString("member_service_0004")); + } + if(1 == type){ + // 扣币 + String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue(); + MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode); + BigDecimal availableBalance = memberWalletCoinEntity.getAvailableBalance(); + BigDecimal totalBalance = memberWalletCoinEntity.getTotalBalance(); + + BigDecimal available = availableBalance.subtract(balance); + if (available.compareTo(BigDecimal.ZERO) < 0) { + return Result.fail(MessageSourceUtils.getString("member_service_0005")); + } + BigDecimal total = totalBalance.subtract(balance); + if (total.compareTo(BigDecimal.ZERO) < 0) { + return Result.fail(MessageSourceUtils.getString("member_service_0005")); + } + + memberWalletCoinEntity.setAvailableBalance(available); + memberWalletCoinEntity.setTotalBalance(total); + int i = memberWalletCoinDao.updateById(memberWalletCoinEntity); + if (i < 1) { + return Result.fail(MessageSourceUtils.getString("member_service_0096")); + } + //添加资金划转历史记录 + MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange(); + //获取usdt兑换gusd的兑换比例 + BigDecimal usdtToGusd = new BigDecimal(redisUtils.getString("USDTTOGSD")); + BigDecimal gusdBalance = balance.multiply(usdtToGusd); + + ZhiYaEntity zhiya = zhiYaDao.selectByMemberId(memberId); + BigDecimal gusdAvailableBalance = zhiya.getAvailableBalance(); + BigDecimal gusdTotalBalance = zhiya.getTotalBalance(); + zhiya.setAvailableBalance(gusdAvailableBalance.add(gusdBalance)); + zhiya.setTotalBalance(gusdTotalBalance.add(gusdBalance)); + + int updateById = zhiYaDao.updateById(zhiya); + if (updateById < 1) { + return Result.fail(MessageSourceUtils.getString("member_service_0096")); + } + + //添加资金划转历史记录 + memberAccountRecord.setMemberId(memberId); + memberAccountRecord.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER); + memberAccountRecord.setSymbol(walletCode); + memberAccountRecord.setContent(MemberWalletCoinEnum.ZHIYATOGUSD.getValue()); + memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN); + memberAccountRecord.setAmount(gusdBalance); + memberAccountMoneyChangeDao.insert(memberAccountRecord); + }else if(2 == type){ + // 扣币 + ZhiYaEntity zhiya = zhiYaDao.selectByMemberId(memberId); + BigDecimal availableBalance = zhiya.getAvailableBalance(); + BigDecimal totalBalance = zhiya.getTotalBalance(); + + BigDecimal available = availableBalance.subtract(balance); + if (available.compareTo(BigDecimal.ZERO) < 0) { + return Result.fail(MessageSourceUtils.getString("member_service_0005")); + } + BigDecimal total = totalBalance.subtract(balance); + if (total.compareTo(BigDecimal.ZERO) < 0) { + return Result.fail(MessageSourceUtils.getString("member_service_0005")); + } + + zhiya.setAvailableBalance(available); + zhiya.setTotalBalance(total); + int i = zhiYaDao.updateById(zhiya); + if (i < 1) { + return Result.fail(MessageSourceUtils.getString("member_service_0096")); + } + //添加资金划转历史记录 + MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange(); + //获取usdt兑换gusd的兑换比例 + BigDecimal usdtToGusd = new BigDecimal(redisUtils.getString("USDTTOGSD")); + BigDecimal usdtBalance = balance.divide(usdtToGusd); + + String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue(); + MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode); + + BigDecimal gusdAvailableBalance = memberWalletCoinEntity.getAvailableBalance(); + BigDecimal gusdTotalBalance = memberWalletCoinEntity.getTotalBalance(); + memberWalletCoinEntity.setAvailableBalance(gusdAvailableBalance.add(usdtBalance)); + memberWalletCoinEntity.setTotalBalance(gusdTotalBalance.add(usdtBalance)); + + int updateById = memberWalletCoinDao.updateById(memberWalletCoinEntity); + if (updateById < 1) { + return Result.fail(MessageSourceUtils.getString("member_service_0096")); + } + + //添加资金划转历史记录 + memberAccountRecord.setMemberId(memberId); + memberAccountRecord.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER); + memberAccountRecord.setSymbol(walletCode); + memberAccountRecord.setContent(MemberWalletCoinEnum.ZHIYATOUSDT.getValue()); + memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN); + memberAccountRecord.setAmount(usdtBalance); + memberAccountMoneyChangeDao.insert(memberAccountRecord); + + }else{ + return Result.fail("member_controller_0005"); + } + + return Result.ok(MessageSourceUtils.getString("member_service_0024")); + } + + @Override + @Transactional + public Result zhiYaGusd(BigDecimal balance) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + if (balance.compareTo(new BigDecimal(100)) < 0) { + return Result.fail(MessageSourceUtils.getString("zhiya_service_0006")); + } + + //质押Gusd,质押数量进入冻结余额, + ZhiYaEntity zhiya = zhiYaDao.selectByMemberId(memberId); + BigDecimal gusdAvailableBalance = zhiya.getAvailableBalance(); + BigDecimal gusdTotalBalance = zhiya.getTotalBalance(); + BigDecimal gusdfrozenBalance = zhiya.getFrozenBalance(); + + BigDecimal available = gusdAvailableBalance.subtract(balance); + if (available.compareTo(BigDecimal.ZERO) < 0) { + return Result.fail(MessageSourceUtils.getString("zhiya_service_0005")); + } + BigDecimal total = gusdTotalBalance.subtract(balance); + if (total.compareTo(BigDecimal.ZERO) < 0) { + return Result.fail(MessageSourceUtils.getString("zhiya_service_0005")); + } + zhiya.setFrozenBalance(gusdfrozenBalance.add(balance)); + zhiya.setAvailableBalance(gusdAvailableBalance.subtract(balance)); + + int updateById = zhiYaDao.updateById(zhiya); + if (updateById < 1) { + return Result.fail(MessageSourceUtils.getString("member_service_0096")); + } + //产生质押单,当前有的话,累加质押数量 + // ZhiYaRecordEntity zhiYaRecord = zhiYaRecordDao.selectByMemberIdAndOrderStatus(memberId,1); + // if(ObjectUtil.isEmpty(zhiYaRecord)){ + //产生一条质押记录 + ZhiYaRecordEntity zhiYaRecordEntity = new ZhiYaRecordEntity(); + zhiYaRecordEntity.setMemberId(memberId); + zhiYaRecordEntity.setOrderNo(generateSimpleSerialno(memberId.toString())); + zhiYaRecordEntity.setSymbol(MemberWalletCoinEnum.WALLETGUSDCOINCODE.getValue()); + zhiYaRecordEntity.setZhiyaCnt(balance); + zhiYaRecordEntity.setOrderStatus(1); + Date date = new Date(); + Date newDate = DateUtil.offsetDay(date, 1); + zhiYaRecordEntity.setEffectDate(newDate); + zhiYaRecordDao.insert(zhiYaRecordEntity); + // }else{ + // zhiYaRecord.setZhiyaCnt(zhiYaRecord.getZhiyaCnt().add(balance)); + // Date date = new Date(); + // Date newDate = DateUtil.offsetDay(date, 1); + // zhiYaRecord.setEffectDate(newDate); + // zhiYaRecordDao.updateById(zhiYaRecord); + // } + //更新团队算力表 + //只计算直属团队的算力信息 + + + return Result.ok(MessageSourceUtils.getString("member_service_0024")); + } + + @Override + @Transactional + public Result shuhuiGusd(BigDecimal balance,Long id) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + if (balance.compareTo(BigDecimal.ZERO) <= 0) { + return Result.fail(MessageSourceUtils.getString("zhiya_service_0004")); + } + //赎回Gusd,获取质押单据, + ZhiYaRecordEntity zhiYaRecordEntity = zhiYaRecordDao.selectByIdAndMemberId(id,memberId); + if(ObjectUtil.isEmpty(zhiYaRecordEntity)){ + return Result.fail(MessageSourceUtils.getString("zhiya_service_0002")); + } + if(1 != zhiYaRecordEntity.getOrderStatus()){ + return Result.fail(MessageSourceUtils.getString("zhiya_service_0003")); + } + BigDecimal zhiyaCnt = zhiYaRecordEntity.getZhiyaCnt(); + if(balance.compareTo(zhiyaCnt) > 0){ + return Result.fail(MessageSourceUtils.getString("zhiya_service_0004")); + } + // zhiYaRecordEntity.setZhiyaCnt(zhiyaCnt.subtract(balance)); + if(zhiyaCnt.compareTo(balance) != 0){ + return Result.fail(MessageSourceUtils.getString("zhiya_service_0001")); + } + zhiYaRecordEntity.setOrderStatus(2); + zhiYaRecordDao.updateById(zhiYaRecordEntity); + //赎回Gusd,质押数量进入可用余额, + ZhiYaEntity zhiya = zhiYaDao.selectByMemberId(memberId); + BigDecimal gusdAvailableBalance = zhiya.getAvailableBalance(); + BigDecimal gusdTotalBalance = zhiya.getTotalBalance(); + BigDecimal gusdfrozenBalance = zhiya.getFrozenBalance(); + + BigDecimal frozen = gusdfrozenBalance.subtract(balance); + if (frozen.compareTo(BigDecimal.ZERO) < 0) { + return Result.fail(MessageSourceUtils.getString("zhiya_service_0001")); + } + BigDecimal total = gusdTotalBalance.subtract(balance); + if (total.compareTo(BigDecimal.ZERO) < 0) { + return Result.fail(MessageSourceUtils.getString("member_service_0005")); + } + zhiya.setFrozenBalance(gusdfrozenBalance.subtract(balance)); + zhiya.setAvailableBalance(gusdAvailableBalance.add(balance)); + zhiYaDao.updateById(zhiya); + return Result.ok(MessageSourceUtils.getString("member_service_0024")); + } + + @Override + public Result findMemberGusdInfo() { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + ZhiYaEntity zhiYaEntity = zhiYaDao.selectByMemberId(memberId); + MemberGusdInfoVo memberGusdInfoVo = new MemberGusdInfoVo(); + memberGusdInfoVo.setMemberId(memberId); + memberGusdInfoVo.setFrozenBalance(zhiYaEntity.getFrozenBalance()); + memberGusdInfoVo.setTotalBalance(zhiYaEntity.getTotalBalance()); + memberGusdInfoVo.setAvailableBalance(zhiYaEntity.getAvailableBalance()); + return Result.ok(memberGusdInfoVo); + } + + @Override + public Result getZhiyaRecords(RecordsPageDto recordsPageDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + + Page<ZhiyaInfoVo> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize()); + ZhiYaEntity zhiya = new ZhiYaEntity(); + zhiya.setMemberId(memberId); + IPage<ZhiyaInfoVo> lists = zhiYaRecordDao.selectByMemberIdInPage(page, zhiya); + return Result.ok(lists); + } + + @Override + public Result getusdtToGusdRecords(RecordsPageDto recordsPageDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + + Page<UsdtToGusdVo> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize()); + MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange(); + memberAccountMoneyChange.setMemberId(memberId); + IPage<UsdtToGusdVo> lists = memberAccountMoneyChangeDao.selectByMemberIdInPage(page, memberAccountMoneyChange); + return Result.ok(lists); + } + + @Override + @Transactional + public void grantZhiyaAmount() { + //获取每日总产出 + BigDecimal gusdReward = new BigDecimal(redisUtils.getString("GUSDREWARD")); + //获取每日质押总数 + Long totalGusd = zhiYaRecordDao.selectTotalGusdByStatueAndTime(1,new Date()); + BigDecimal totalGusdBigDecimal = new BigDecimal(totalGusd); + if(totalGusdBigDecimal.compareTo(BigDecimal.ZERO) > 0){ + //平均一个获取奖励数量 + BigDecimal divide = gusdReward.divide(totalGusdBigDecimal,2, BigDecimal.ROUND_HALF_UP); + //获取今天之前满足发放奖励的全部质押单 + //生效时间小于当前时间 + //状态为生效中 + List<ZhiYaRecordEntity> lists = zhiYaRecordDao.selectZhiYaRewardByStatueAndTime(1,new Date()); + if(CollUtil.isNotEmpty(lists)){ + for(ZhiYaRecordEntity zhiYaRecordEntity : lists){ + ZhiyaRewardEntity zhiyaRewardEntity = new ZhiyaRewardEntity(); + zhiyaRewardEntity.setRecordId(zhiYaRecordEntity.getId()); + zhiyaRewardEntity.setRecordNo(zhiYaRecordEntity.getOrderNo()); + zhiyaRewardEntity.setMemberId(zhiYaRecordEntity.getMemberId()); + zhiyaRewardEntity.setRewardAmout(divide.multiply(zhiYaRecordEntity.getZhiyaCnt())); + zhiyaRewardDao.insert(zhiyaRewardEntity); + + //给团队上级发送奖励goldrice + //给账户的冻结 + + } + } + } + } + + @Override + public Result getZhiyaReward(ZhiyaRewardRecordsPageDto recordsPageDto) { + + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + + Page<ZhiyaRewardVo> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize()); + ZhiyaRewardEntity zhiyaRewardEntity = new ZhiyaRewardEntity(); + zhiyaRewardEntity.setMemberId(memberId); + zhiyaRewardEntity.setRecordNo(recordsPageDto.getOrderNo()); + IPage<ZhiyaRewardVo> lists = zhiYaRecordDao.selectZhiyaRewardByMemberIdInPage(page, zhiyaRewardEntity); + return Result.ok(lists); + } + + public String generateSimpleSerialno(String userId) { + StringBuilder sb = new StringBuilder(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd"); + Date now = new Date(); + sb.append(sd.format(now)); + Calendar calendar = new GregorianCalendar(); + calendar.setTime(now); + calendar.add(calendar.DATE, 1); + Date nextDate = calendar.getTime(); + if (StrUtil.isNotEmpty(userId)) { + sb.append(userId); + } + sb.append(RandomUtil.randomInt(2)); + long count = zhiYaRecordDao.getOrderCountByToday(sdf.format(now), sdf.format(nextDate)); + count++; + int size = 4; + for (int i = 0; i < size - String.valueOf(count).length(); i++) { + sb.append("0"); + } + sb.append(count); + return sb.toString(); + } +} diff --git a/src/main/java/com/xcong/excoin/modules/member/controller/MemberController.java b/src/main/java/com/xcong/excoin/modules/member/controller/MemberController.java index 439ab1d..b5f50d1 100644 --- a/src/main/java/com/xcong/excoin/modules/member/controller/MemberController.java +++ b/src/main/java/com/xcong/excoin/modules/member/controller/MemberController.java @@ -3,33 +3,13 @@ import javax.annotation.Resource; import javax.validation.Valid; +import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; +import com.xcong.excoin.modules.member.parameter.dto.*; +import com.xcong.excoin.modules.member.parameter.vo.*; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import com.xcong.excoin.common.response.Result; -import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberAuthenticationDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindEmailDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindPhoneDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberForgetPwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberSubmitCoinApplyDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdatePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradersPwdTimeDto; -import com.xcong.excoin.modules.member.parameter.vo.AppVersionListVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberAuthenticationInfoVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberAvivableCoinInfoVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressCountListVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressListVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberCoinInfoListVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberInfoVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberPaymethodDetailListVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberPaymethodDetailVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberPersonCenterInfoVo; -import com.xcong.excoin.modules.member.parameter.vo.MemberSendCodeWayVo; import com.xcong.excoin.modules.member.service.MemberService; import io.swagger.annotations.Api; @@ -178,9 +158,6 @@ /** * 设置交易密码 - * @param code - * @param password - * @param token * @return */ @ApiOperation(value="设置交易密码", notes="设置交易密码") @@ -334,8 +311,6 @@ /** * 提币币种可用资金 - * @param token - * @param coinVo * @return */ @ApiOperation(value = "提币币种可用资金", notes = "提币币种可用资金") @@ -350,8 +325,6 @@ /** * 提币申请 - * @param token - * @param coinVo * @return */ @ApiOperation(value="提交提币申请", notes="提交提币申请") @@ -360,5 +333,16 @@ return Result.fail("暂未开放提币"); // return memberService.memberSubmitCoinApply(memberSubmitCoinApplyDto); } + + /** + * 我的直属团队 + * @return + */ + @ApiOperation(value = "我的直属团队", notes = "我的直属团队") + @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberTeamVo.class)}) + @PostMapping(value="/memberTeam") + public Result memberTeam(@RequestBody @Valid MemberTeamRecordsPageDto memberTeamRecordsPageDto) { + return memberService.memberTeam(memberTeamRecordsPageDto); + } } diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberDao.java index b7e285a..c0e85fa 100644 --- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberDao.java +++ b/src/main/java/com/xcong/excoin/modules/member/dao/MemberDao.java @@ -1,8 +1,12 @@ package com.xcong.excoin.modules.member.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo; import com.xcong.excoin.modules.member.entity.MemberEntity; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; +import com.xcong.excoin.modules.member.parameter.vo.MemberTeamVo; import com.xcong.excoin.modules.member.parameter.vo.NeedMoneyMemberVo; import org.apache.ibatis.annotations.Param; @@ -21,4 +25,5 @@ public List<NeedMoneyMemberVo> selectAllNeedMoneyMember(@Param("list") List<String> list); + IPage<MemberTeamVo> selectAllTeamByInviteIdInPage(Page<MemberTeamVo> page, @Param("record")MemberEntity memberEntity); } diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberTeamRecordsPageDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberTeamRecordsPageDto.java new file mode 100644 index 0000000..643223e --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberTeamRecordsPageDto.java @@ -0,0 +1,25 @@ +package com.xcong.excoin.modules.member.parameter.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +@Data +@ApiModel(value = "MemberTeamRecordsPageDto", description = "参数接受类") +public class MemberTeamRecordsPageDto { + +// @NotNull(message = "编号不能为空") +// @ApiModelProperty(value = "编号", example = "1") +// private String orderNo; + + @NotNull + @Min(1) + @ApiModelProperty(value = "第几页", example = "1") + private int pageNum; + + @NotNull + @ApiModelProperty(value = "每页数量", example = "10") + private int pageSize; +} diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberTeamVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberTeamVo.java new file mode 100644 index 0000000..d64bd18 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberTeamVo.java @@ -0,0 +1,21 @@ +package com.xcong.excoin.modules.member.parameter.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +@ApiModel(value = "MemberTeamVo", description = "返回参数") +public class MemberTeamVo { + + @ApiModelProperty(value = "账号") + private String account; + + @ApiModelProperty(value = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + +} diff --git a/src/main/java/com/xcong/excoin/modules/member/service/MemberService.java b/src/main/java/com/xcong/excoin/modules/member/service/MemberService.java index ae6e757..9712db0 100644 --- a/src/main/java/com/xcong/excoin/modules/member/service/MemberService.java +++ b/src/main/java/com/xcong/excoin/modules/member/service/MemberService.java @@ -6,18 +6,7 @@ import com.xcong.excoin.common.response.Result; import com.xcong.excoin.common.system.dto.RegisterDto; import com.xcong.excoin.modules.member.entity.MemberEntity; -import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberAuthenticationDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindEmailDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindPhoneDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberForgetPwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberSubmitCoinApplyDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdatePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradersPwdTimeDto; +import com.xcong.excoin.modules.member.parameter.dto.*; import com.xcong.excoin.modules.member.parameter.vo.NeedMoneyMemberVo; import org.apache.ibatis.annotations.Param; @@ -90,5 +79,5 @@ public Result getPcVersionInfo(); - + Result memberTeam(MemberTeamRecordsPageDto memberTeamRecordsPageDto); } diff --git a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java index ad7f7f9..a6addc9 100644 --- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java @@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.crypto.SecureUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xcong.excoin.common.LoginUserUtils; import com.xcong.excoin.common.contants.AppContants; @@ -17,20 +19,10 @@ import com.xcong.excoin.modules.coin.dao.ZhiYaDao; import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; import com.xcong.excoin.modules.coin.entity.ZhiYaEntity; +import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo; import com.xcong.excoin.modules.member.dao.*; import com.xcong.excoin.modules.member.entity.*; -import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberAuthenticationDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindEmailDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberBindPhoneDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelCoinAddressDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberDelPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberForgetPwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberSubmitCoinApplyDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdatePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradePwdDto; -import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradersPwdTimeDto; +import com.xcong.excoin.modules.member.parameter.dto.*; import com.xcong.excoin.modules.member.parameter.vo.*; import com.xcong.excoin.modules.member.service.MemberService; import com.xcong.excoin.modules.platform.dao.PlatformFeeSettingDao; @@ -1033,6 +1025,19 @@ } return Result.ok(arrayList); } + + @Override + public Result memberTeam(MemberTeamRecordsPageDto memberTeamRecordsPageDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + MemberEntity member = memberDao.selectById(memberId); + Page<MemberTeamVo> page = new Page<>(memberTeamRecordsPageDto.getPageNum(), memberTeamRecordsPageDto.getPageSize()); + MemberEntity memberEntity = new MemberEntity(); + memberEntity.setId(memberId); + memberEntity.setInviteId(member.getInviteId()); + IPage<MemberTeamVo> lists = memberDao.selectAllTeamByInviteIdInPage(page, memberEntity); + return Result.ok(lists); + } } diff --git a/src/main/java/com/xcong/excoin/modules/symbols/constants/SymbolsConstats.java b/src/main/java/com/xcong/excoin/modules/symbols/constants/SymbolsConstats.java index 9767032..33f0bb9 100644 --- a/src/main/java/com/xcong/excoin/modules/symbols/constants/SymbolsConstats.java +++ b/src/main/java/com/xcong/excoin/modules/symbols/constants/SymbolsConstats.java @@ -5,8 +5,8 @@ public class SymbolsConstats { public final static List<String> EXCHANGE_SYMBOLS = new ArrayList<>(); - public final static String ROC = "GOLDRICE"; + public final static String ROC = "GRICE"; static { - EXCHANGE_SYMBOLS.add("GOLDRICE"); + EXCHANGE_SYMBOLS.add("GRICE"); } } diff --git a/src/main/java/com/xcong/excoin/processor/DefaultCoinProcessor.java b/src/main/java/com/xcong/excoin/processor/DefaultCoinProcessor.java index e5023eb..e4a08b8 100644 --- a/src/main/java/com/xcong/excoin/processor/DefaultCoinProcessor.java +++ b/src/main/java/com/xcong/excoin/processor/DefaultCoinProcessor.java @@ -382,7 +382,7 @@ kLine.setLow(kLine.getClose()); kLine.setHigh(kLine.getClose()); kLine.setVolume(BigDecimal.ZERO); - redisUtils.set("GOLDRICE/USDT",kLine); + redisUtils.set("GRICE/USDT",kLine); } } diff --git a/src/main/java/com/xcong/excoin/quartz/job/ZhiyarRewardJob.java b/src/main/java/com/xcong/excoin/quartz/job/ZhiyarRewardJob.java index e166ba6..92172e7 100644 --- a/src/main/java/com/xcong/excoin/quartz/job/ZhiyarRewardJob.java +++ b/src/main/java/com/xcong/excoin/quartz/job/ZhiyarRewardJob.java @@ -1,6 +1,6 @@ package com.xcong.excoin.quartz.job; -import com.xcong.excoin.modules.coin.service.CoinService; +import com.xcong.excoin.modules.coin.service.ZhiyaService; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -16,7 +16,7 @@ @Resource - private CoinService coinService; + private ZhiyaService zhiyaService; /** * 质押奖励计算 @@ -25,7 +25,7 @@ public void updateDoingPrice() { log.info("#质押奖励计算#"); try { - coinService.grantZhiyaAmount(); + zhiyaService.grantZhiyaAmount(); } catch (Exception e) { log.error("#质押奖励计算错误#", e); } diff --git a/src/main/java/com/xcong/excoin/rabbit/consumer/ExchangeConsumer.java b/src/main/java/com/xcong/excoin/rabbit/consumer/ExchangeConsumer.java index 72351aa..4e35640 100644 --- a/src/main/java/com/xcong/excoin/rabbit/consumer/ExchangeConsumer.java +++ b/src/main/java/com/xcong/excoin/rabbit/consumer/ExchangeConsumer.java @@ -52,7 +52,7 @@ @RabbitListener(queues = RabbitMqConfig.QUEUE_TRADE_PLATE) public void tradePlate(String content) { //log.info("--发送盘口消息--"); - tradePlateSendWebSocket.sendMessagePlate("GOLDRICE/USDT",content,null); + tradePlateSendWebSocket.sendMessagePlate("GRICE/USDT",content,null); } /** diff --git a/src/main/java/com/xcong/excoin/utils/CoinTypeConvert.java b/src/main/java/com/xcong/excoin/utils/CoinTypeConvert.java index a0df7eb..e83e01f 100644 --- a/src/main/java/com/xcong/excoin/utils/CoinTypeConvert.java +++ b/src/main/java/com/xcong/excoin/utils/CoinTypeConvert.java @@ -22,8 +22,8 @@ return "EOS/USDT"; case "etcusdt": return "ETC/USDT"; - case "goldriceusdt": - return "GOLDRICE/USDT"; + case "griceusdt": + return "GRICE/USDT"; default: return null; } @@ -33,8 +33,8 @@ switch (symbol) { case "BTC/USDT": return "btcusdt"; - case "GOLDRICE/USDT": - return "goldriceusdt"; + case "GRICE/USDT": + return "griceusdt"; default: return null; } @@ -56,8 +56,8 @@ return "EOS_NEW_PRICE"; case "ETC/USDT": return "ETC_NEW_PRICE"; - case "GOLDRICE/USDT": - return "GOLDRICE_NEW_PRICE"; + case "GRICE/USDT": + return "GRICE_NEW_PRICE"; default: return null; } diff --git a/src/main/java/com/xcong/excoin/websocket/TradePlateSendWebSocket.java b/src/main/java/com/xcong/excoin/websocket/TradePlateSendWebSocket.java index c559b7c..c676e8c 100644 --- a/src/main/java/com/xcong/excoin/websocket/TradePlateSendWebSocket.java +++ b/src/main/java/com/xcong/excoin/websocket/TradePlateSendWebSocket.java @@ -98,7 +98,7 @@ // 发送订阅消息 String nekk = factory.getTrader(SymbolsConstats.ROC).sendTradePlateMessage(); SubResultModel subResultModel = new SubResultModel(); - subResultModel.setId("goldriceusdt"); + subResultModel.setId("griceusdt"); subResultModel.setSubbed(sub); synchronized (session) { try { @@ -220,7 +220,7 @@ String key = "KINE_{}_{}"; // 币币k线数据 //key = StrUtil.format(key, symbol, period); - key = StrUtil.format(key, "GOLDRICE/USDT", period); + key = StrUtil.format(key, "GRICE/USDT", period); RedisUtils bean = SpringContextHolder.getBean(RedisUtils.class); Object o = bean.get(key); List<CandlestickModel> candlestickModels = new ArrayList<>(); diff --git a/src/main/resources/mapper/member/MemberDao.xml b/src/main/resources/mapper/member/MemberDao.xml index 7debfd9..aa15dbf 100644 --- a/src/main/resources/mapper/member/MemberDao.xml +++ b/src/main/resources/mapper/member/MemberDao.xml @@ -44,4 +44,12 @@ #{item} </foreach > </select> + + <select id="selectAllTeamByInviteIdInPage" resultType="com.xcong.excoin.modules.member.parameter.vo.MemberTeamVo"> + SELECT + m.phone account, + m.create_time createTime + FROM member m where m.referer_id = #{record.inviteId} + order by m.create_time desc + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.1