From 6a615efb2051fee8aa119ffc9e6fa0c991c7758c Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 22 Jan 2021 17:25:59 +0800 Subject: [PATCH] 20210122 --- src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinWithdrawDao.java | 7 + src/main/resources/mapper/member/MemberCoinWithdrawDao.xml | 11 ++ src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java | 13 ++ src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountMoneyChange.java | 8 + src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CoinInListDto.java | 26 +++++ src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinChargeDao.java | 6 + src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java | 119 +++++++++++++++++++++++ src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java | 3 src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java | 3 src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml | 10 + src/main/resources/mapper/member/MemberCoinChargeDao.xml | 6 + src/main/java/com/xcong/excoin/modules/coin/parameter/vo/CoinInListVo.java | 43 ++++++++ 12 files changed, 254 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java b/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java index d49da18..06ba293 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java +++ b/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java @@ -6,6 +6,7 @@ import javax.validation.Valid; import com.xcong.excoin.modules.coin.parameter.vo.AllWalletCoinVo; +import com.xcong.excoin.modules.coin.parameter.vo.CoinInListVo; import com.xcong.excoin.modules.coin.parameter.vo.ContractSymbolListVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberAgentIntoInfoVo; @@ -22,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController; import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.coin.parameter.dto.CoinInListDto; import com.xcong.excoin.modules.coin.parameter.dto.ContractInTransferDto; import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; import com.xcong.excoin.modules.coin.parameter.dto.TransferOfBalanceDto; @@ -123,6 +125,17 @@ } /** + * 记录 + * @return + */ + @ApiOperation(value="记录", notes="记录") + @ApiResponses({@ApiResponse( code = 200, message = "success", response = CoinInListVo.class)}) + @PostMapping(value="/coinInList") + public Result coinInList(@RequestBody @Valid CoinInListDto coinInListDto) { + return coinService.coinInList(coinInListDto); + } + + /** * 获取币币资产交易记录 * @return */ diff --git a/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java b/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java index 2319534..4dd8b0e 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java +++ b/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java @@ -32,4 +32,7 @@ IPage<MemberAccountMoneyChange> selectWalletAgentIntoRecordsByMemIdTypeSymbol(Page<OrderCoinsDealEntity> page, @Param("record")MemberAccountMoneyChange memberAccountMoneyChange); + IPage<MemberAccountMoneyChange> coinInList(Page<MemberAccountMoneyChange> page, + @Param("record")MemberAccountMoneyChange memberAccountMoneyChange); + } diff --git a/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountMoneyChange.java b/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountMoneyChange.java index 35f5d7a..bdc07b5 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountMoneyChange.java +++ b/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountMoneyChange.java @@ -3,9 +3,11 @@ import java.math.BigDecimal; import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.xcong.excoin.common.system.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @@ -54,5 +56,11 @@ * 提币ID */ private Long withdrawId; + /** + * 类型 + * 1:充币,2:提币,3:划转,4:其他 + */ + @TableField(exist = false) + private int typeCoin; } diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CoinInListDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CoinInListDto.java new file mode 100644 index 0000000..ca8ea9a --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CoinInListDto.java @@ -0,0 +1,26 @@ +package com.xcong.excoin.modules.coin.parameter.dto; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +@Data +@ApiModel(value = "CoinInListDto", description = "记录参数接受类") +public class CoinInListDto { + + @NotNull + @Min(1) + @ApiModelProperty(value = "第几页", example = "1") + private int pageNum; + + @NotNull + @ApiModelProperty(value = "每页数量", example = "10") + private int pageSize; + + @NotNull + @ApiModelProperty(value = "1:充币,2:提币,3:划转,4:其他", example = "1") + private int type; + +} \ No newline at end of file diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/CoinInListVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/CoinInListVo.java new file mode 100644 index 0000000..7c104b9 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/CoinInListVo.java @@ -0,0 +1,43 @@ +package com.xcong.excoin.modules.coin.parameter.vo; + +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +@Data +@ApiModel(value = "CoinInListVo", description = "记录返回") +public class CoinInListVo { + + /** + * 币种 + */ + @ApiModelProperty(value = "币种") + private String symbol; + /** + * 金额 + */ + @ApiModelProperty(value = "金额") + private BigDecimal amount; + /** + * 记录内容 + */ + @ApiModelProperty(value = "记录内容") + private String content; + /** + * 状态【0:待审核 1:成功2:失败】 + */ + @ApiModelProperty(value = "状态【0:待审核 1:成功2:失败】") + private int status; + + @ApiModelProperty(value = "时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date updateTime; + + @ApiModelProperty(value = "是否内部转账 Y-是N-不是") + private String isInside; + +} diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java b/src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java index d02dc57..7722fdf 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.coin.parameter.dto.CoinInListDto; import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; @@ -49,4 +50,6 @@ public Result contractInTransfer(BigDecimal balance, String symbolIn, String symbolOut); + public Result coinInList(@Valid CoinInListDto coinInListDto); + } 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 c4cc3dc..7e308a9 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 @@ -7,6 +7,7 @@ import java.util.Map; import javax.annotation.Resource; +import javax.validation.Valid; import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity; import org.springframework.stereotype.Service; @@ -23,8 +24,10 @@ import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity; import com.xcong.excoin.modules.coin.mapper.MemberAccountMoneyChangeMapper; +import com.xcong.excoin.modules.coin.parameter.dto.CoinInListDto; 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.CoinInListVo; import com.xcong.excoin.modules.coin.parameter.vo.ContractSymbolListVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletAgentInfoVo; @@ -32,14 +35,19 @@ 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.MemberCoinChargeDao; +import com.xcong.excoin.modules.member.dao.MemberCoinWithdrawDao; import com.xcong.excoin.modules.member.dao.MemberDao; import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao; import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao; import com.xcong.excoin.modules.member.dao.MemberWalletContractDao; +import com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity; +import com.xcong.excoin.modules.member.entity.MemberCoinWithdrawEntity; import com.xcong.excoin.modules.member.entity.MemberEntity; import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity; +import com.xcong.excoin.modules.member.vo.MemberCoinChargeVo; import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao; import com.xcong.excoin.utils.CoinTypeConvert; import com.xcong.excoin.utils.MessageSourceUtils; @@ -67,6 +75,10 @@ MemberWalletAgentDao memberWalletAgentDao; @Resource MemberDao memberDao; + @Resource + MemberCoinChargeDao memberCoinChargeDao; + @Resource + MemberCoinWithdrawDao memberCoinWithdrawDao; @Resource RedisUtils redisUtils; @@ -886,6 +898,113 @@ return Result.ok(MessageSourceUtils.getString("member_service_0006")); } + + @Override + public Result coinInList(@Valid CoinInListDto coinInListDto) { + //获取用户ID + Long memberId = LoginUserUtils.getAppLoginUser().getId(); + int type = coinInListDto.getType(); + //充币记录 + if(type == 1) { + Page<MemberCoinChargeEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + MemberCoinChargeEntity memberCoinChargeEntity = new MemberCoinChargeEntity(); + memberCoinChargeEntity.setMemberId(memberId); + IPage<MemberCoinChargeEntity> memberCoinCharge = memberCoinChargeDao.findMemberCoinChargeInPage(page, memberCoinChargeEntity); + List<MemberCoinChargeEntity> records = memberCoinCharge.getRecords(); + + Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + if(CollUtil.isNotEmpty(records)) { + ArrayList<CoinInListVo> arrayList = new ArrayList<>(); + for(MemberCoinChargeEntity memberCoinChargeEntitys : records) { + CoinInListVo coinInListVo = new CoinInListVo(); + coinInListVo.setSymbol(memberCoinChargeEntitys.getSymbol()); + coinInListVo.setAmount(memberCoinChargeEntitys.getAmount()); + coinInListVo.setContent("充币"); + coinInListVo.setStatus(memberCoinChargeEntitys.getStatus()); + coinInListVo.setUpdateTime(memberCoinChargeEntitys.getUpdateTime()); + arrayList.add(coinInListVo); + } + responsePage.setRecords(arrayList); + } + return Result.ok(responsePage); + } + //提币记录 + if(type == 2) { + Page<MemberCoinWithdrawEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity(); + memberCoinWithdrawEntity.setMemberId(memberId); + IPage<MemberCoinWithdrawEntity> memberCoinWithdraw = memberCoinWithdrawDao.findMemberCoinWithdrawInPage(page, memberCoinWithdrawEntity); + List<MemberCoinWithdrawEntity> records = memberCoinWithdraw.getRecords(); + + Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + if(CollUtil.isNotEmpty(records)) { + ArrayList<CoinInListVo> arrayList = new ArrayList<>(); + for(MemberCoinWithdrawEntity memberCoinWithdrawEntitys : records) { + CoinInListVo coinInListVo = new CoinInListVo(); + coinInListVo.setSymbol(memberCoinWithdrawEntitys.getSymbol()); + coinInListVo.setAmount(memberCoinWithdrawEntitys.getAmount()); + coinInListVo.setContent("提币"); + coinInListVo.setStatus(memberCoinWithdrawEntitys.getStatus()); + coinInListVo.setUpdateTime(memberCoinWithdrawEntitys.getUpdateTime()); + coinInListVo.setIsInside(memberCoinWithdrawEntitys.getIsInside()); + arrayList.add(coinInListVo); + } + responsePage.setRecords(arrayList); + } + return Result.ok(responsePage); + } + //划转记录 + if(type == 3) { + Page<MemberAccountMoneyChange> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange(); + memberAccountMoneyChange.setMemberId(memberId); + IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.coinInList(page, memberAccountMoneyChange); + List<MemberAccountMoneyChange> records = list.getRecords(); + + Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + if(CollUtil.isNotEmpty(records)) { + ArrayList<CoinInListVo> arrayList = new ArrayList<>(); + for(MemberAccountMoneyChange memberAccountMoneyChanges : records) { + CoinInListVo coinInListVo = new CoinInListVo(); + coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol()); + coinInListVo.setAmount(memberAccountMoneyChanges.getAmount()); + coinInListVo.setContent(memberAccountMoneyChanges.getContent()); + coinInListVo.setStatus(memberAccountMoneyChanges.getStatus()); + coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime()); + arrayList.add(coinInListVo); + } + responsePage.setRecords(arrayList); + } + return Result.ok(responsePage); + } + //其他记录 + if(type == 4) { + Page<OrderCoinsDealEntity> page = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange(); + memberAccountMoneyChange.setMemberId(memberId); + IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletAgentIntoRecordsByMemIdTypeSymbol(page, memberAccountMoneyChange); + List<MemberAccountMoneyChange> records = list.getRecords(); + + Page<CoinInListVo> responsePage = new Page<>(coinInListDto.getPageNum(), coinInListDto.getPageSize()); + if(CollUtil.isNotEmpty(records)) { + ArrayList<CoinInListVo> arrayList = new ArrayList<>(); + for(MemberAccountMoneyChange memberAccountMoneyChanges : records) { + CoinInListVo coinInListVo = new CoinInListVo(); + coinInListVo.setSymbol(memberAccountMoneyChanges.getSymbol()); + coinInListVo.setAmount(memberAccountMoneyChanges.getAmount()); + coinInListVo.setContent(memberAccountMoneyChanges.getContent()); + coinInListVo.setStatus(memberAccountMoneyChanges.getStatus()); + coinInListVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime()); + arrayList.add(coinInListVo); + } + responsePage.setRecords(arrayList); + } + return Result.ok(responsePage); + } + + return Result.fail(MessageSourceUtils.getString("member_controller_0005")); + + } diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinChargeDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinChargeDao.java index c35bdb0..26b5cec 100644 --- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinChargeDao.java +++ b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinChargeDao.java @@ -1,7 +1,10 @@ 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.member.entity.MemberCoinChargeEntity; + import org.apache.ibatis.annotations.Param; import java.util.List; @@ -12,4 +15,7 @@ List<MemberCoinChargeEntity> selectAllBySymbolAndTag(@Param("symbol") String symbol, @Param("tag") String tag, @Param("status") Integer status); + public IPage<MemberCoinChargeEntity> findMemberCoinChargeInPage(Page<MemberCoinChargeEntity> page, + @Param("record")MemberCoinChargeEntity memberCoinChargeEntity); + } diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinWithdrawDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinWithdrawDao.java index 75ce0f4..217881d 100644 --- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinWithdrawDao.java +++ b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinWithdrawDao.java @@ -1,8 +1,15 @@ 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.member.entity.MemberCoinWithdrawEntity; +import io.lettuce.core.dynamic.annotation.Param; + public interface MemberCoinWithdrawDao extends BaseMapper<MemberCoinWithdrawEntity> { + IPage<MemberCoinWithdrawEntity> findMemberCoinWithdrawInPage(Page<MemberCoinWithdrawEntity> page, + @Param("record")MemberCoinWithdrawEntity memberCoinWithdrawEntity); + } diff --git a/src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml b/src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml index 1c47b40..d17c724 100644 --- a/src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml +++ b/src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml @@ -2,6 +2,13 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao"> + <select id="coinInList" resultType="com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange"> + select * from member_account_money_change + where member_id = #{record.memberId} + and content like '%转%' + order by create_time desc + </select> + <select id="selectWalletCoinRecordsByMemIdTypeSymbol" resultType="com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange"> select * from member_account_money_change where type = 1 and member_id = #{memberId} order by id desc </select> @@ -52,7 +59,8 @@ </select> <select id="selectWalletAgentIntoRecordsByMemIdTypeSymbol" resultType="com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange"> - select * from member_account_money_change <if test="record != null"> + select * from member_account_money_change + <if test="record != null"> <where> type = 3 and content like '%佣金到账%' diff --git a/src/main/resources/mapper/member/MemberCoinChargeDao.xml b/src/main/resources/mapper/member/MemberCoinChargeDao.xml index e875705..680663e 100644 --- a/src/main/resources/mapper/member/MemberCoinChargeDao.xml +++ b/src/main/resources/mapper/member/MemberCoinChargeDao.xml @@ -2,6 +2,12 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.xcong.excoin.modules.member.dao.MemberCoinChargeDao"> + <select id="findMemberCoinChargeInPage" resultType="com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity"> + select * from member_coin_charge + where member_id=#{record.memberId} + order by create_time desc + </select> + <select id="selectNewestChargeRecord" resultType="com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity"> select * from member_coin_charge where member_id=#{memberId} diff --git a/src/main/resources/mapper/member/MemberCoinWithdrawDao.xml b/src/main/resources/mapper/member/MemberCoinWithdrawDao.xml new file mode 100644 index 0000000..5aec529 --- /dev/null +++ b/src/main/resources/mapper/member/MemberCoinWithdrawDao.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.xcong.excoin.modules.member.dao.MemberCoinWithdrawDao"> + + <select id="findMemberCoinChargeInPage" resultType="com.xcong.excoin.modules.member.entity.MemberCoinWithdrawEntity"> + select * from member_coin_withdraw + where member_id=#{record.memberId} + order by create_time desc + </select> + +</mapper> \ No newline at end of file -- Gitblit v1.9.1