xiaoyong931011
2020-06-09 33bf873937ae03b96ce6d217c24d0b403b4468a1
20200609 代码提交
6 files modified
1 files added
98 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java 12 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java 28 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java 3 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java 29 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml 15 ●●●●● patch | view | raw | blame | history
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,6 +14,7 @@
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;
@@ -22,6 +24,7 @@
import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinListVo;
import com.xcong.excoin.modules.coin.parameter.vo.TransactionPageOfWalletCoinVo;
import com.xcong.excoin.modules.coin.service.OrderCoinService;
import com.xcong.excoin.modules.contract.parameter.dto.OrderListDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -102,12 +105,9 @@
     */
    @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);
    @PostMapping(value="/findAllWalletCoinOrder")
    public Result  findAllWalletCoinOrder(@RequestBody @Validated FindAllWalletCoinOrderDto findAllWalletCoinOrderDto) {
        return orderCoinService.findAllWalletCoinOrder(findAllWalletCoinOrderDto);
    }
    
    /**
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,
            OrderCoinsDealEntity orderCoinsDealEntity);
    
}
src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java
@@ -3,6 +3,8 @@
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 +14,7 @@
    public static final OrderWalletCoinDealMapper INSTANCE = Mappers.getMapper(OrderWalletCoinDealMapper.class);
    
    public abstract OrderWalletCoinDealVo entityToVoOrder(OrderCoinsDealEntity orderCoinsDealEntity);
    public abstract Page<OrderWalletCoinDealVo> pageEntityToPageVo(IPage<OrderCoinsDealEntity> orderCoins);
}
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java
New file
@@ -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;
}
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);
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,19 @@
    }
    @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
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>