xiaoyong931011
2022-02-24 9ee5d996a6537121aad58c46adb066c82381fa1c
20222223
3 files added
12 files modified
395 ■■■■ changed files
src/main/java/com/xcong/excoin/common/enumerates/MemberWalletCoinEnum.java 1 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java 46 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/dao/ZhiYaRecordDao.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/ShuhuiGusdDto.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/UsdtToGusdDto.java 6 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberGusdInfoVo.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/UsdtToGusdVo.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/ZhiyaInfoVo.java 49 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java 10 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java 159 ●●●● patch | view | raw | blame | history
src/main/resources/i18n/messages_en_US.properties 5 ●●●●● patch | view | raw | blame | history
src/main/resources/i18n/messages_zh_CN.properties 5 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml 13 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/walletCoinOrder/ZhiYaRecordDao.xml 22 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/common/enumerates/MemberWalletCoinEnum.java
@@ -18,6 +18,7 @@
    
    CONTENTFROMAGENT("0005","由代理账户转入"),
    ZHIYATOGUSD("0006","兑换GUSD"),
    ZHIYATOUSDT("0007","兑换USDT"),
    WALLETCOINCODE("USDT", "USDT"),
    WALLETGUSDCOINCODE("GUSD", "GUSD"),
src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java
@@ -6,13 +6,7 @@
import javax.validation.Valid;
import com.xcong.excoin.modules.coin.parameter.dto.*;
import com.xcong.excoin.modules.coin.parameter.vo.AllWalletCoinVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberAgentIntoInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletAgentInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletContractInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.*;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.GetMapping;
@@ -197,6 +191,16 @@
    }
    /**
     * 获取GUSD账户信息
     */
    @ApiOperation(value="获取GUSD账户信息", notes="获取GUSD账户信息")
    @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberGusdInfoVo.class)})
    @GetMapping(value="/findMemberGusdInfo")
    public Result findMemberGusdInfo() {
        return coinService.findMemberGusdInfo();
    }
    /**
     * USDT兌換成GUSD
     * @return
     */
@@ -204,7 +208,19 @@
    @PostMapping(value="/usdtToGusd")
    public Result  usdtToGusd(@RequestBody @Valid UsdtToGusdDto usdtToGusdDto) {
        BigDecimal balance = usdtToGusdDto.getBalance();
        return coinService.usdtToGusd(balance);
        Integer type = usdtToGusdDto.getType();
        return coinService.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 coinService.getusdtToGusdRecords(recordsPageDto);
    }
    /**
@@ -218,13 +234,25 @@
    }
    /**
     *  获取质押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 coinService.getZhiyaRecords(recordsPageDto);
    }
    /**
     * 赎回GUSD
     */
    @ApiOperation(value="赎回GUSD", notes="赎回GUSD")
    @PostMapping(value="/shuhuiGusd")
    public Result  shuhuiGusd(@RequestBody @Valid ShuhuiGusdDto shuhuiGusdDto) {
        BigDecimal balance = shuhuiGusdDto.getBalance();
        return coinService.shuhuiGusd(balance);
        Long id = shuhuiGusdDto.getId();
        return coinService.shuhuiGusd(balance,id);
    }
    
src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java
@@ -2,6 +2,8 @@
import java.util.List;
import com.xcong.excoin.modules.coin.parameter.vo.UsdtToGusdVo;
import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -32,4 +34,5 @@
    IPage<MemberAccountMoneyChange> selectWalletAgentIntoRecordsByMemIdTypeSymbol(Page<OrderCoinsDealEntity> page,
            @Param("record")MemberAccountMoneyChange memberAccountMoneyChange);
    IPage<UsdtToGusdVo> selectByMemberIdInPage(Page<UsdtToGusdVo> page, @Param("record")MemberAccountMoneyChange memberAccountMoneyChange);
}
src/main/java/com/xcong/excoin/modules/coin/dao/ZhiYaRecordDao.java
@@ -1,13 +1,25 @@
package com.xcong.excoin.modules.coin.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.entity.OrderCoinsEntity;
import com.xcong.excoin.modules.coin.entity.ZhiYaEntity;
import com.xcong.excoin.modules.coin.entity.ZhiYaRecordEntity;
import com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ZhiYaRecordDao extends BaseMapper<ZhiYaRecordEntity> {
    long getOrderCountByToday(@Param("now")String now, @Param("tomorrow") String tomorrow);
    ZhiYaRecordEntity selectByMemberIdAndOrderStatus(@Param("memberId")Long memberId,@Param("orderStatus") Integer orderStatus);
    ZhiYaRecordEntity selectByIdAndMemberId(@Param("id") Long id,@Param("memberId")Long memberId);
    List<ZhiyaInfoVo> selectByMemberId(@Param("memberId")Long memberId);
    IPage<ZhiyaInfoVo> selectByMemberIdInPage(Page<ZhiyaInfoVo> page, @Param("record") ZhiYaEntity zhiya);
}
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/ShuhuiGusdDto.java
@@ -11,6 +11,10 @@
@ApiModel(value = "ShuhuiGusdDto", description = "参数接收类")
public class ShuhuiGusdDto {
    @NotNull(message = "不能为空")
    @ApiModelProperty(value = "ID", example = "1")
    private Long id;
    @NotNull(message = "金额不能为空")
    @ApiModelProperty(value = "金额", example = "100")
    private BigDecimal balance;
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/UsdtToGusdDto.java
@@ -15,8 +15,8 @@
    @ApiModelProperty(value = "划转金额", example = "100")
    private BigDecimal balance;
    @NotNull(message = "币种不能为空")
    @ApiModelProperty(value = "币种", example = "USDT")
    private String symbol;
    @NotNull(message = "转换类型 1:USDT转GUSD 2GUSD转USDT")
    @ApiModelProperty(value = "币种", example = "1")
    private Integer type;
}
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberGusdInfoVo.java
New file
@@ -0,0 +1,34 @@
package com.xcong.excoin.modules.coin.parameter.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class MemberGusdInfoVo {
    /**
     * 用户Id
     */
    @ApiModelProperty(value = "用户Id")
    private Long memberId;
    /**
     * 可用余额
     */
    @ApiModelProperty(value = "可用余额")
    private BigDecimal availableBalance;
    /**
     * 总金额
     */
    @ApiModelProperty(value = "总金额")
    private BigDecimal totalBalance;
    /**
     * 冻结金额
     */
    @ApiModelProperty(value = "冻结金额")
    private BigDecimal frozenBalance;
}
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/UsdtToGusdVo.java
New file
@@ -0,0 +1,26 @@
package com.xcong.excoin.modules.coin.parameter.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "UsdtToGusdVo", description = "返回参数类")
public class UsdtToGusdVo {
    private Long memberId;
    /**
     * 金额
     */
    private BigDecimal amount;
    /**
     * 记录内容
     */
    private String content;
    /**
     * 状态【0:待审核 1:成功2:失败】
     */
    private int status;
}
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/ZhiyaInfoVo.java
New file
@@ -0,0 +1,49 @@
package com.xcong.excoin.modules.coin.parameter.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "ZhiyaInfoVo", description = "返回参数类")
public class ZhiyaInfoVo {
    private Long id;
    /**
     * 会员ID
     */
    @ApiModelProperty(value = "会员ID")
    private Long memberId;
    /**
     * 编号
     */
    @ApiModelProperty(value = "编号")
    private String orderNo;
    /**
     * 币种
     */
    @ApiModelProperty(value = "币种")
    private String symbol;
    /**
     * 委托量
     */
    @ApiModelProperty(value = "数量")
    private BigDecimal zhiyaCnt;
    /**
     * 状态 1:生效中 2:已赎回
     */
    @ApiModelProperty(value = "状态 1:生效中 2:已赎回")
    private Integer orderStatus;
    /**
     * 生效日期
     */
    @ApiModelProperty(value = "生效日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date effectDate;
}
src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java
@@ -42,9 +42,15 @@
    void updateWalletBalance(@Param("id") Long id, @Param("availableBalance")BigDecimal availableBalance,@Param("totalBalance")BigDecimal totalBalance, @Param("frozenBalance")BigDecimal frozenBalance);
    Result usdtToGusd(BigDecimal balance);
    Result usdtToGusd(BigDecimal balance,Integer type);
    Result zhiYaGusd(BigDecimal balance);
    Result shuhuiGusd(BigDecimal balance);
    Result shuhuiGusd(BigDecimal balance,Long id);
    Result findMemberGusdInfo();
    Result getZhiyaRecords(RecordsPageDto recordsPageDto);
    Result getusdtToGusdRecords(RecordsPageDto recordsPageDto);
}
src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
@@ -11,6 +11,7 @@
import com.xcong.excoin.modules.coin.dao.ZhiYaRecordDao;
import com.xcong.excoin.modules.coin.entity.ZhiYaEntity;
import com.xcong.excoin.modules.coin.entity.ZhiYaRecordEntity;
import com.xcong.excoin.modules.coin.parameter.vo.*;
import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -27,13 +28,6 @@
import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
import com.xcong.excoin.modules.coin.mapper.MemberAccountMoneyChangeMapper;
import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
import com.xcong.excoin.modules.coin.parameter.vo.AllWalletCoinVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberAgentIntoInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletAgentInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinInfoVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinVo;
import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletContractInfoVo;
import com.xcong.excoin.modules.coin.service.CoinService;
import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao;
import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
@@ -60,8 +54,6 @@
    @Resource
    MemberWalletCoinDao memberWalletCoinDao;
    @Resource
    ZhiYaDao zhiYaDao;
    @Resource
    MemberWalletContractDao memberWalletContractDao;
    @Resource
    MemberAccountMoneyChangeDao memberAccountMoneyChangeDao;
@@ -69,6 +61,8 @@
    MemberWalletAgentDao memberWalletAgentDao;
    @Resource
    ZhiYaRecordDao zhiYaRecordDao;
    @Resource
    ZhiYaDao zhiYaDao;
    @Resource
    RedisUtils redisUtils;
@@ -618,13 +612,13 @@
    }
    @Override
    public Result usdtToGusd(BigDecimal balance) {
    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);
@@ -649,14 +643,14 @@
        //添加资金划转历史记录
        MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange();
        //获取usdt兑换gusd的兑换比例
        ZhiYaEntity zhiya = zhiYaDao.selectByMemberId(memberId);
            BigDecimal usdtToGusd = new BigDecimal(redisUtils.getString("USDTTOGSD"));
            BigDecimal gusdBalance = balance.multiply(usdtToGusd);
//        String gusdName = MemberWalletCoinEnum.WALLETGUSDCOINCODE.getValue();
//        MemberWalletCoinEntity gusdMemberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, gusdName);
            ZhiYaEntity zhiya = zhiYaDao.selectByMemberId(memberId);
        BigDecimal gusdAvailableBalance = zhiya.getAvailableBalance();
        BigDecimal gusdTotalBalance = zhiya.getTotalBalance();
        zhiya.setAvailableBalance(gusdAvailableBalance.add(balance));
        zhiya.setTotalBalance(gusdTotalBalance.add(balance));
            zhiya.setAvailableBalance(gusdAvailableBalance.add(gusdBalance));
            zhiya.setTotalBalance(gusdTotalBalance.add(gusdBalance));
        int updateById = zhiYaDao.updateById(zhiya);
        if (updateById < 1) {
@@ -669,8 +663,60 @@
        memberAccountRecord.setSymbol(walletCode);
        memberAccountRecord.setContent(MemberWalletCoinEnum.ZHIYATOGUSD.getValue());
        memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN);
        memberAccountRecord.setAmount(balance);
            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"));
    }
@@ -680,12 +726,10 @@
        //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        if (balance.compareTo(new BigDecimal(100)) < 0) {
            return Result.fail(MessageSourceUtils.getString("member_service_0005"));
            return Result.fail(MessageSourceUtils.getString("zhiya_service_0006"));
        }
        //质押Gusd,质押数量进入冻结余额,
//        String gusdName = MemberWalletCoinEnum.WALLETGUSDCOINCODE.getValue();
//        MemberWalletCoinEntity gusdMemberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, gusdName);
        //质押Gusd,质押数量进入冻结余额,
        ZhiYaEntity zhiya = zhiYaDao.selectByMemberId(memberId);
        BigDecimal gusdAvailableBalance = zhiya.getAvailableBalance();
        BigDecimal gusdTotalBalance = zhiya.getTotalBalance();
@@ -693,13 +737,13 @@
        BigDecimal available = gusdAvailableBalance.subtract(balance);
        if (available.compareTo(BigDecimal.ZERO) < 0) {
            return Result.fail(MessageSourceUtils.getString("member_service_0005"));
            return Result.fail(MessageSourceUtils.getString("zhiya_service_0005"));
        }
        BigDecimal total = gusdTotalBalance.subtract(balance);
        if (total.compareTo(BigDecimal.ZERO) < 0) {
            return Result.fail(MessageSourceUtils.getString("member_service_0005"));
            return Result.fail(MessageSourceUtils.getString("zhiya_service_0005"));
        }
        zhiya.setFrozenBalance(gusdfrozenBalance.add(gusdfrozenBalance));
        zhiya.setFrozenBalance(gusdfrozenBalance.add(balance));
        zhiya.setAvailableBalance(gusdAvailableBalance.subtract(balance));
        int updateById = zhiYaDao.updateById(zhiya);
@@ -732,15 +776,30 @@
    }
    @Override
    public Result shuhuiGusd(BigDecimal balance) {
    public Result shuhuiGusd(BigDecimal balance,Long id) {
        //获取用户ID
        Long memberId = LoginUserUtils.getAppLoginUser().getId();
        if (balance.compareTo(BigDecimal.ZERO) <= 0) {
            return Result.fail(MessageSourceUtils.getString("order_service_0010"));
            return Result.fail(MessageSourceUtils.getString("zhiya_service_0004"));
        }
        //质押Gusd,质押数量进入冻结余额,
//        String gusdName = MemberWalletCoinEnum.WALLETGUSDCOINCODE.getValue();
//        MemberWalletCoinEntity gusdMemberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, gusdName);
        //赎回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){
            zhiYaRecordEntity.setOrderStatus(2);
        }
        zhiYaRecordDao.updateById(zhiYaRecordEntity);
        //赎回Gusd,质押数量进入可用余额,
        ZhiYaEntity zhiya = zhiYaDao.selectByMemberId(memberId);
        BigDecimal gusdAvailableBalance = zhiya.getAvailableBalance();
        BigDecimal gusdTotalBalance = zhiya.getTotalBalance();
@@ -754,7 +813,47 @@
        if (total.compareTo(BigDecimal.ZERO) < 0) {
            return Result.fail(MessageSourceUtils.getString("member_service_0005"));
        }
        return null;
        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);
    }
    public String generateSimpleSerialno(String userId) {
src/main/resources/i18n/messages_en_US.properties
@@ -242,4 +242,9 @@
submit_repeat=Do not repeat submission
zhiya_service_0001=Redemption quantity is greater than pledge quantity
zhiya_service_0002=Data does not exist, please refresh and try again
zhiya_service_0003=Only valid documents can be redeemed
zhiya_service_0004=Please enter the correct and reasonable quantity
zhiya_service_0005=Insufficient available balance
zhiya_service_0006=The minimum quantity is 100
src/main/resources/i18n/messages_zh_CN.properties
@@ -242,3 +242,8 @@
submit_repeat=请勿重复提交
zhiya_service_0001=赎回数量大于质押数量
zhiya_service_0002=数据不存在,请刷新后重试
zhiya_service_0003=只有生效中的单据才能赎回
zhiya_service_0004=请输入正确合理的数量
zhiya_service_0005=可用余额不足
zhiya_service_0006=数量最少需要100
src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml
@@ -64,4 +64,17 @@
        order by id desc
    </select>
    <select id="selectByMemberIdInPage" resultType="com.xcong.excoin.modules.coin.parameter.vo.UsdtToGusdVo">
        select * from member_account_money_change
            <if test="record != null">
                <where>
                    type = 1 and (content = '兑换GUSD' or content = '兑换USDT')
                    <if test="record.memberId != null" >
                        and member_id=#{record.memberId}
                    </if>
                </where>
            </if>
        order by id desc
    </select>
</mapper>
src/main/resources/mapper/walletCoinOrder/ZhiYaRecordDao.xml
@@ -8,7 +8,27 @@
    </select>
    <select id="selectByMemberIdAndOrderStatus" resultType="com.xcong.excoin.modules.coin.entity.ZhiYaRecordEntity">
        SELECT *  FROM zhiya_record a where a.member_id= #{memberId} and a.order_status = #{orderStatus}
        SELECT a.*  FROM zhiya_record a where a.member_id= #{memberId} and a.order_status = #{orderStatus}
    </select>
    <select id="selectByIdAndMemberId" resultType="com.xcong.excoin.modules.coin.entity.ZhiYaRecordEntity">
        SELECT a.*  FROM zhiya_record a where a.member_id= #{memberId} and a.id = #{id}
    </select>
    <select id="selectByMemberId" resultType="com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo">
        SELECT a.*  FROM zhiya_record a where a.member_id= #{memberId}
    </select>
    <select id="selectByMemberIdInPage" resultType="com.xcong.excoin.modules.coin.parameter.vo.ZhiyaInfoVo">
        select * from zhiya_record
            <if test="record != null">
                <where>
                    <if test="record.memberId != null" >
                        and member_id=#{record.memberId}
                    </if>
                </where>
            </if>
        order by id desc
    </select>
</mapper>