From c463451f04087e034176f84d7effd53bf36f5cf6 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Wed, 10 Jun 2020 10:41:37 +0800 Subject: [PATCH] Merge branch 'master' of https://gitee.com/chonggaoxiao/new_excoin --- src/main/java/com/xcong/excoin/modules/coin/parameter/dto/RecordsPageDto.java | 23 ++ src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java | 28 +++ src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java | 28 +- src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java | 87 +++------ src/main/resources/mapper/member/MemberCoinAddressDao.xml | 14 + src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java | 12 + src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java | 15 + src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java | 7 src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinAddressDao.java | 4 src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml | 15 + src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java | 157 ++++++++-------- src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java | 27 +- src/main/java/com/xcong/excoin/modules/coin/mapper/MemberAccountMoneyChangeMapper.java | 25 ++ src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java | 15 - src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java | 3 src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java | 5 src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml | 37 ++++ src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java | 8 18 files changed, 331 insertions(+), 179 deletions(-) diff --git a/src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java b/src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java index 31b0a2d..bf4af09 100644 --- a/src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java +++ b/src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java @@ -1,78 +1,79 @@ -package com.xcong.excoin.configurations.security; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpMethod; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.crypto.password.PasswordEncoder; -import org.springframework.security.web.AuthenticationEntryPoint; -import org.springframework.security.web.access.AccessDeniedHandler; - -import javax.annotation.Resource; - -/** - * @author wzy - * @date 2020-05-11 - **/ -@Slf4j -@Configuration -@EnableWebSecurity -@EnableGlobalMethodSecurity(prePostEnabled = true) -public class WebSecurityConfig extends WebSecurityConfigurerAdapter { - - @Resource - private UserDetailsService userDetailsService; - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.httpBasic().and(). - cors().and().csrf().disable() - .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint()) - .and() - .authorizeRequests() - .antMatchers(HttpMethod.OPTIONS, "/**").permitAll() - .antMatchers("/login").permitAll() - .antMatchers("/register").permitAll() - .antMatchers("/swagger**/**").permitAll() - .antMatchers("/webjars/**").permitAll() - .antMatchers("/v2/**").permitAll() - .antMatchers("/api/symbols/**").permitAll() - .antMatchers("/common/**").permitAll() - .antMatchers("/api/exchange/**").permitAll() - .antMatchers("/api/member/getMemberAccountInfo").permitAll() - .antMatchers("/api/member/memberForgetPwd").permitAll() - .anyRequest().authenticated() - .and().apply(securityConfiguereAdapter()); - } - - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { - auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); - } - - @Bean - public PasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); - } - - @Bean - public AccessDeniedHandler accessDeniedHandler() { - return new CustomAccessDeniedHandler(); - } - - @Bean - public AuthenticationEntryPoint authenticationEntryPoint() { - return new CustomAuthenticationEntryPoint(); - } - - public TokenConfigurer securityConfiguereAdapter() { - return new TokenConfigurer(); - } -} +package com.xcong.excoin.configurations.security; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.security.web.access.AccessDeniedHandler; + +import javax.annotation.Resource; + +/** + * @author wzy + * @date 2020-05-11 + **/ +@Slf4j +@Configuration +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true) +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + + @Resource + private UserDetailsService userDetailsService; + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.httpBasic().and(). + cors().and().csrf().disable() + .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint()) + .and() + .authorizeRequests() + .antMatchers(HttpMethod.OPTIONS, "/**").permitAll() + .antMatchers("/login").permitAll() + .antMatchers("/register").permitAll() + .antMatchers("/swagger**/**").permitAll() + .antMatchers("/webjars/**").permitAll() + .antMatchers("/v2/**").permitAll() + .antMatchers("/api/symbols/**").permitAll() + .antMatchers("/common/**").permitAll() + .antMatchers("/api/exchange/**").permitAll() + .antMatchers("/api/member/getMemberAccountInfo").permitAll() + .antMatchers("/api/member/memberForgetPwd").permitAll() + .antMatchers("/api/orderCoin/searchSymbolResultList").permitAll() + .anyRequest().authenticated() + .and().apply(securityConfiguereAdapter()); + } + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); + } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Bean + public AccessDeniedHandler accessDeniedHandler() { + return new CustomAccessDeniedHandler(); + } + + @Bean + public AuthenticationEntryPoint authenticationEntryPoint() { + return new CustomAuthenticationEntryPoint(); + } + + public TokenConfigurer securityConfiguereAdapter() { + return new TokenConfigurer(); + } +} 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 e6e5d33..a30b9cc 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 @@ -5,7 +5,7 @@ import javax.annotation.Resource; import javax.validation.Valid; -import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeVo; +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; @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; import com.xcong.excoin.modules.coin.parameter.dto.TransferOfBalanceDto; import com.xcong.excoin.modules.coin.parameter.dto.TransferOfBalanceFromAgentDto; import com.xcong.excoin.modules.coin.service.CoinService; @@ -111,10 +112,10 @@ * @return */ @ApiOperation(value="获取币币资产交易记录", notes="获取币币资产交易记录") - @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeVo.class)}) - @GetMapping(value="/getWalletCoinRecords") - public Result getWalletCoinRecords() { - return coinService.getWalletCoinRecords(); + @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeInfoVo.class)}) + @PostMapping(value="/getWalletCoinRecords") + public Result getWalletCoinRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) { + return coinService.getWalletCoinRecords(recordsPageDto); } /** @@ -122,10 +123,10 @@ * @return */ @ApiOperation(value="获取合约资产交易记录", notes="获取合约资产交易记录") - @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeVo.class)}) - @GetMapping(value="/getWalletContractRecords") - public Result getWalletContractRecords() { - return coinService.getWalletContractRecords(); + @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeInfoVo.class)}) + @PostMapping(value="/getWalletContractRecords") + public Result getWalletContractRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) { + return coinService.getWalletContractRecords(recordsPageDto); } /** @@ -133,10 +134,10 @@ * @return */ @ApiOperation(value="获取代理资产交易记录", notes="获取代理资产交易记录") - @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeVo.class)}) - @GetMapping(value="/getWalletAgentRecords") - public Result getWalletAgentRecords() { - return coinService.getWalletAgentRecords(); + @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeInfoVo.class)}) + @PostMapping(value="/getWalletAgentRecords") + public Result getWalletAgentRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) { + return coinService.getWalletAgentRecords(recordsPageDto); } /** diff --git a/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java b/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java index 75c871c..f9f4ece 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java +++ b/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java @@ -5,6 +5,7 @@ import javax.annotation.Resource; import javax.validation.Valid; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -13,11 +14,11 @@ import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.coin.parameter.dto.CancelEntrustWalletCoinOrderDto; +import com.xcong.excoin.modules.coin.parameter.dto.FindAllWalletCoinOrderDto; import com.xcong.excoin.modules.coin.parameter.dto.FindCollectDto; import com.xcong.excoin.modules.coin.parameter.dto.SubmitSalesWalletCoinOrderDto; import com.xcong.excoin.modules.coin.parameter.vo.FindCollectListVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberSelectSymbolsVo; -import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealListVo; import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo; import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinListVo; import com.xcong.excoin.modules.coin.parameter.vo.TransactionPageOfWalletCoinVo; @@ -27,7 +28,6 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import lombok.extern.slf4j.Slf4j; @@ -101,13 +101,10 @@ * @return */ @ApiOperation(value = "获取币币交易历史订单信息", notes = "获取币币交易历史订单信息") - @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealListVo.class)}) - @ApiImplicitParams({ - @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query") - }) - @GetMapping(value = "/findAllWalletCoinOrder") - public Result findAllWalletCoinOrder(String symbol) { - return orderCoinService.findAllWalletCoinOrder(symbol); + @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealVo.class)}) + @PostMapping(value="/findAllWalletCoinOrder") + public Result findAllWalletCoinOrder(@RequestBody @Validated FindAllWalletCoinOrderDto findAllWalletCoinOrderDto) { + return orderCoinService.findAllWalletCoinOrder(findAllWalletCoinOrderDto); } /** 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 fbaba05..0eeda45 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 @@ -5,7 +5,10 @@ import org.apache.ibatis.annotations.Param; 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.MemberAccountMoneyChange; +import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity; public interface MemberAccountMoneyChangeDao extends BaseMapper<MemberAccountMoneyChange>{ @@ -17,4 +20,13 @@ List<MemberAccountMoneyChange> selectWalletAgentIntoRecordsByMemIdTypeSymbol(@Param("memberId")Long memberId); + IPage<MemberAccountMoneyChange> selectWalletCoinRecordsInPage(Page<OrderCoinsDealEntity> page, + @Param("record") MemberAccountMoneyChange memberAccountMoneyChange); + + IPage<MemberAccountMoneyChange> selectWalletContractRecordsInPage(Page<OrderCoinsDealEntity> page, + @Param("record") MemberAccountMoneyChange memberAccountMoneyChange); + + IPage<MemberAccountMoneyChange> selectWalletAgentRecordsInPage(Page<OrderCoinsDealEntity> page, + @Param("record") MemberAccountMoneyChange memberAccountMoneyChange); + } diff --git a/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java b/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java index 9d4ec60..ab900b8 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java +++ b/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java @@ -5,7 +5,10 @@ import org.apache.ibatis.annotations.Param; 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.OrderCoinsDealEntity; +import com.xcong.excoin.modules.contract.entity.ContractOrderEntity; public interface OrderCoinDealDao extends BaseMapper<OrderCoinsDealEntity>{ @@ -14,5 +17,9 @@ List<OrderCoinsDealEntity> selectAllWalletCoinOrderBySymbol(@Param("memberId")Long memberId,@Param("symbol")String symbol); OrderCoinsDealEntity selectWalletCoinOrder(@Param("memberId")Long memberId,@Param("orderId")Long orderId); + + IPage<OrderCoinsDealEntity> findAllWalletCoinOrderInPage(Page<OrderCoinsDealEntity> page, + @Param("record") OrderCoinsDealEntity orderCoinsDealEntity); + } diff --git a/src/main/java/com/xcong/excoin/modules/coin/mapper/MemberAccountMoneyChangeMapper.java b/src/main/java/com/xcong/excoin/modules/coin/mapper/MemberAccountMoneyChangeMapper.java new file mode 100644 index 0000000..6ff5422 --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/coin/mapper/MemberAccountMoneyChangeMapper.java @@ -0,0 +1,25 @@ +package com.xcong.excoin.modules.coin.mapper; + +import java.util.List; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; +import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo; + +@Mapper +public abstract class MemberAccountMoneyChangeMapper { + + public static final MemberAccountMoneyChangeMapper INSTANCE = Mappers.getMapper(MemberAccountMoneyChangeMapper.class); + + public abstract MemberAccountMoneyChangeInfoVo entityToVoOrder(MemberAccountMoneyChange memberAccountMoneyChange); + + public abstract List<MemberAccountMoneyChangeInfoVo> orderEntitiesToOrderListVo(List<MemberAccountMoneyChange> memberAccountMoneyChanges); + + public abstract Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo(IPage<MemberAccountMoneyChange> memberAccountMoneyChanges); + + +} diff --git a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java index 5844ba7..ddd13a3 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java +++ b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java @@ -1,8 +1,12 @@ package com.xcong.excoin.modules.coin.mapper; +import java.util.List; + import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity; import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo; @@ -12,5 +16,9 @@ public static final OrderWalletCoinDealMapper INSTANCE = Mappers.getMapper(OrderWalletCoinDealMapper.class); public abstract OrderWalletCoinDealVo entityToVoOrder(OrderCoinsDealEntity orderCoinsDealEntity); + + public abstract List<OrderWalletCoinDealVo> orderEntitiesToOrderListVo(List<OrderCoinsDealEntity> orderEntities); + + public abstract Page<OrderWalletCoinDealVo> pageEntityToPageVo(IPage<OrderCoinsDealEntity> orderCoins); } diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java new file mode 100644 index 0000000..7990a5d --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java @@ -0,0 +1,28 @@ +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 = "FindAllWalletCoinOrderDto", description = "获取币币交易历史订单信息参数接受类") +public class FindAllWalletCoinOrderDto { + + @NotNull + @Min(1) + @ApiModelProperty(value = "第几页", example = "1") + private int pageNum; + + @NotNull + @ApiModelProperty(value = "每页数量", example = "10") + private int pageSize; + + @NotNull + @ApiModelProperty(value = "币种", example = "BTC") + private String symbol; + +} diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/RecordsPageDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/RecordsPageDto.java new file mode 100644 index 0000000..c1e9fdd --- /dev/null +++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/RecordsPageDto.java @@ -0,0 +1,23 @@ +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 = "RecordsPageDto", description = "资产交易记录参数接受类") +public class RecordsPageDto { + + @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/coin/service/CoinService.java b/src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java index fd61a18..c3ca269 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 @@ -2,8 +2,11 @@ import java.math.BigDecimal; +import javax.validation.Valid; + import com.baomidou.mybatisplus.extension.service.IService; import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; public interface CoinService extends IService<MemberWalletCoinEntity>{ @@ -20,12 +23,6 @@ public Result findWalletCoinBySymbol(String symbol); - public Result getWalletCoinRecords(); - - public Result getWalletContractRecords(); - - public Result getWalletAgentRecords(); - public Result agentTransferToWalletCoin(BigDecimal balance, Integer transfertype); public Result findWalletAgentBySymbol(); @@ -34,4 +31,10 @@ public Result getWalletAgentIntoRecords(); + public Result getWalletCoinRecords(@Valid RecordsPageDto recordsPageDto); + + public Result getWalletContractRecords(@Valid RecordsPageDto recordsPageDto); + + public Result getWalletAgentRecords(@Valid RecordsPageDto recordsPageDto); + } diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java b/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java index 0cfd4f8..c71455c 100644 --- a/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java +++ b/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity; +import com.xcong.excoin.modules.coin.parameter.dto.FindAllWalletCoinOrderDto; public interface OrderCoinService extends IService<OrderCoinsEntity>{ @@ -19,7 +20,7 @@ public Result cancelEntrustWalletCoinOrder(String orderId); - public Result findAllWalletCoinOrder(String symbol); + public Result findAllWalletCoinOrder(FindAllWalletCoinOrderDto findAllWalletCoinOrderDto); public Result findWalletCoinOrder(Long orderId); 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 bab36aa..7f14be4 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 @@ -8,6 +8,9 @@ import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +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.CoinTypeEnum; @@ -15,6 +18,9 @@ import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao; 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.RecordsPageDto; 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; @@ -344,72 +350,45 @@ } @Override - public Result getWalletCoinRecords() { + public Result getWalletCoinRecords(RecordsPageDto recordsPageDto) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); - List<MemberAccountMoneyChange> coinRecordList = memberAccountMoneyChangeDao.selectWalletCoinRecordsByMemIdTypeSymbol(memberId); - List<MemberAccountMoneyChangeInfoVo> arrayList = new ArrayList<>(); - if (CollUtil.isNotEmpty(coinRecordList)) { - for (MemberAccountMoneyChange memberAccountMoneyChange : coinRecordList) { - MemberAccountMoneyChangeInfoVo memberAccountMoneyChangeInfoVo = new MemberAccountMoneyChangeInfoVo(); - memberAccountMoneyChangeInfoVo.setAmount(memberAccountMoneyChange.getAmount()); - memberAccountMoneyChangeInfoVo.setContent(memberAccountMoneyChange.getContent()); - memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus()); - memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol()); - memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType()); - memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime()); - arrayList.add(memberAccountMoneyChangeInfoVo); - } - } - return Result.ok(arrayList); + + Page<OrderCoinsDealEntity> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize()); + MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange(); + memberAccountMoneyChange.setMemberId(memberId); + IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletCoinRecordsInPage(page, memberAccountMoneyChange); + Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo = MemberAccountMoneyChangeMapper.INSTANCE.pageEntityToPageVo(list); + + return Result.ok(pageEntityToPageVo); } @Override - public Result getWalletContractRecords() { + public Result getWalletContractRecords(RecordsPageDto recordsPageDto) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); - String symbol = MemberWalletCoinEnum.WALLETCOINCODE.getValue(); - List<MemberAccountMoneyChange> contractRecordList = memberAccountMoneyChangeDao.selectWalletContractRecordsByMemIdTypeSymbol(symbol, memberId); - - List<MemberAccountMoneyChangeInfoVo> arrayList = new ArrayList<>(); - if (ObjectUtil.isNotNull(contractRecordList)) { - for (MemberAccountMoneyChange memberAccountMoneyChange : contractRecordList) { - MemberAccountMoneyChangeInfoVo memberAccountMoneyChangeInfoVo = new MemberAccountMoneyChangeInfoVo(); - memberAccountMoneyChangeInfoVo.setAmount(memberAccountMoneyChange.getAmount()); - memberAccountMoneyChangeInfoVo.setContent(memberAccountMoneyChange.getContent()); - memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus()); - memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol()); - memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType()); - memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime()); - arrayList.add(memberAccountMoneyChangeInfoVo); - } - } - - return Result.ok(arrayList); + + Page<OrderCoinsDealEntity> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize()); + MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange(); + memberAccountMoneyChange.setMemberId(memberId); + IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletContractRecordsInPage(page, memberAccountMoneyChange); + Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo = MemberAccountMoneyChangeMapper.INSTANCE.pageEntityToPageVo(list); + + return Result.ok(pageEntityToPageVo); } @Override - public Result getWalletAgentRecords() { + public Result getWalletAgentRecords(RecordsPageDto recordsPageDto) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); - - List<MemberAccountMoneyChange> contractRecordList = - memberAccountMoneyChangeDao.selectWalletAgentRecordByMemIdTypeSymbol(MemberWalletCoinEnum.WALLETCOINCODE.getValue(), memberId); - - List<MemberAccountMoneyChangeInfoVo> arrayList = new ArrayList<>(); - if (ObjectUtil.isNotNull(contractRecordList)) { - for (MemberAccountMoneyChange memberAccountMoneyChange : contractRecordList) { - MemberAccountMoneyChangeInfoVo memberAccountMoneyChangeInfoVo = new MemberAccountMoneyChangeInfoVo(); - memberAccountMoneyChangeInfoVo.setAmount(memberAccountMoneyChange.getAmount()); - memberAccountMoneyChangeInfoVo.setContent(memberAccountMoneyChange.getContent()); - memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus()); - memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol()); - memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType()); - memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime()); - arrayList.add(memberAccountMoneyChangeInfoVo); - } - } - return Result.ok(arrayList); + + Page<OrderCoinsDealEntity> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize()); + MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange(); + memberAccountMoneyChange.setMemberId(memberId); + IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletAgentRecordsInPage(page, memberAccountMoneyChange); + Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo = MemberAccountMoneyChangeMapper.INSTANCE.pageEntityToPageVo(list); + + return Result.ok(pageEntityToPageVo); } @Override 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 8fff3e0..0dbfb7a 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 @@ -19,6 +19,8 @@ import org.springframework.transaction.annotation.Transactional; import com.baomidou.mybatisplus.core.conditions.Wrapper; +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; @@ -32,6 +34,7 @@ import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity; import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinDealMapper; import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinMapper; +import com.xcong.excoin.modules.coin.parameter.dto.FindAllWalletCoinOrderDto; import com.xcong.excoin.modules.coin.parameter.vo.FindCollectListVo; import com.xcong.excoin.modules.coin.parameter.vo.MemberSelectSymbolsVo; import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealListVo; @@ -40,6 +43,9 @@ import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinVo; import com.xcong.excoin.modules.coin.parameter.vo.TransactionPageOfWalletCoinVo; import com.xcong.excoin.modules.coin.service.OrderCoinService; +import com.xcong.excoin.modules.contract.entity.ContractOrderEntity; +import com.xcong.excoin.modules.contract.mapper.ContractOrderEntityMapper; +import com.xcong.excoin.modules.contract.parameter.vo.OrderListVo; import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao; import com.xcong.excoin.modules.member.entity.MemberSelectSymbolsEntity; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; @@ -399,22 +405,18 @@ } @Override - public Result findAllWalletCoinOrder(String symbol) { + public Result findAllWalletCoinOrder(FindAllWalletCoinOrderDto findAllWalletCoinOrderDto) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); - OrderWalletCoinDealListVo orderWalletCoinDealListVo = new OrderWalletCoinDealListVo(); - List<OrderWalletCoinDealVo> arrayList = new ArrayList<OrderWalletCoinDealVo>(); - - List<OrderCoinsDealEntity> selectAllWalletCoinOrder = orderCoinDealDao.selectAllWalletCoinOrderBySymbol(memberId,symbol); - if(CollUtil.isNotEmpty(selectAllWalletCoinOrder)) { - for(OrderCoinsDealEntity orderCoinsDealEntity: selectAllWalletCoinOrder) { - OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(orderCoinsDealEntity); - arrayList.add(entityToVo); - } - } - orderWalletCoinDealListVo.setOrderWalletCoinDealVo(arrayList); - return Result.ok(orderWalletCoinDealListVo); + Page<OrderCoinsDealEntity> page = new Page<>(findAllWalletCoinOrderDto.getPageNum(), findAllWalletCoinOrderDto.getPageSize()); + OrderCoinsDealEntity orderCoinsDealEntity = new OrderCoinsDealEntity(); + orderCoinsDealEntity.setMemberId(memberId); + orderCoinsDealEntity.setSymbol(findAllWalletCoinOrderDto.getSymbol()); + IPage<OrderCoinsDealEntity> list = orderCoinDealDao.findAllWalletCoinOrderInPage(page, orderCoinsDealEntity); + Page<OrderWalletCoinDealVo> pageEntityToPageVo = OrderWalletCoinDealMapper.INSTANCE.pageEntityToPageVo(list); + + return Result.ok(pageEntityToPageVo); } @Override diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinAddressDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinAddressDao.java index ade4d94..067cea1 100644 --- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinAddressDao.java +++ b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinAddressDao.java @@ -1,5 +1,7 @@ package com.xcong.excoin.modules.member.dao; +import java.util.List; + import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.core.mapper.BaseMapper; @@ -12,6 +14,8 @@ MemberCoinAddressEntity selectBlockAddressWithTag(@Param("memberId")Long memberId, @Param("symbol")String symbol, @Param("tag")String tag); MemberCoinAddressEntity selectBlockAddress(@Param("memberId")Long memberId, @Param("symbol")String symbol); + List<MemberCoinAddressEntity> selectCoinAddressListByMap(@Param("symbol")String symbol, @Param("memberId")Long memberId); + } 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 044d8f6..20c0715 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 @@ -608,10 +608,7 @@ public Result memberCoinAddressList(String symbol) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); - Map<String, Object> columnMap = new HashMap<>(); - columnMap.put("member_id", memberId); - columnMap.put("symbol", symbol); - List<MemberCoinAddressEntity> selectByMap = memberCoinAddressDao.selectByMap(columnMap); + List<MemberCoinAddressEntity> selectByMap = memberCoinAddressDao.selectCoinAddressListByMap(symbol,memberId); MemberCoinAddressListVo memberCoinAddressListVo = new MemberCoinAddressListVo(); List<MemberCoinAddressVo> arrayList = new ArrayList<>(); if (CollUtil.isNotEmpty(selectByMap)) { diff --git a/src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml b/src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml index 383b1d5..aeb75cc 100644 --- a/src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml +++ b/src/main/resources/mapper/member/MemberAccountMoneyChangeDao.xml @@ -17,7 +17,42 @@ <select id="selectWalletAgentIntoRecordsByMemIdTypeSymbol" resultType="com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange"> select * from member_account_money_change where type = 3 and content like '%佣金入账%' and member_id = #{memberId} order by id desc </select> + + <select id="selectWalletCoinRecordsInPage" resultType="com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange"> + select * from member_account_money_change + <if test="record != null"> + <where> + type = 1 + <if test="record.memberId != null" > + and member_id=#{record.memberId} + </if> + </where> + </if> + order by id desc + </select> + + <select id="selectWalletContractRecordsInPage" resultType="com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange"> + select * from member_account_money_change <if test="record != null"> + <where> + type = 2 + <if test="record.memberId != null" > + and member_id=#{record.memberId} + </if> + </where> + </if> + order by id desc + </select> - + <select id="selectWalletAgentRecordsInPage" resultType="com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange"> + select * from member_account_money_change <if test="record != null"> + <where> + type = 3 + <if test="record.memberId != null" > + and member_id=#{record.memberId} + </if> + </where> + </if> + order by id desc + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/member/MemberCoinAddressDao.xml b/src/main/resources/mapper/member/MemberCoinAddressDao.xml index 7355ec0..ade0be5 100644 --- a/src/main/resources/mapper/member/MemberCoinAddressDao.xml +++ b/src/main/resources/mapper/member/MemberCoinAddressDao.xml @@ -36,5 +36,19 @@ </if> </where> </select> + + <select id="selectCoinAddressListByMap" resultType="com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity"> + select * from member_coin_address + <where> + is_biyict = 1 + and symbolscoin_id IS NOT NULL + <if test="memberId != null and memberId != ''"> + and member_id = #{memberId} + </if> + <if test="symbol != null and symbol != ''"> + and symbol = #{symbol} + </if> + </where> + </select> </mapper> \ No newline at end of file diff --git a/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml b/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml index f498ab6..5cf439d 100644 --- a/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml +++ b/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml @@ -28,4 +28,19 @@ select * from coins_order_deal where order_id= #{orderId} and member_id = #{memberId} </select> + <select id="selectContractOrderInPage" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity"> + select * from coins_order_deal + <if test="record != null"> + <where> + <if test="record.memberId != null" > + and member_id=#{record.memberId} + </if> + <if test="record.symbol != null and record.symbol != ''"> + and symbol = #{record.symbol} + </if> + </where> + </if> + order by create_time desc + </select> + </mapper> -- Gitblit v1.9.1