From b2ec644128294893de349262672658261a78da82 Mon Sep 17 00:00:00 2001
From: gao <gaoleox@163>
Date: Wed, 27 May 2020 16:39:40 +0800
Subject: [PATCH] 查下所有的买卖记录

---
 src/main/java/com/xcong/excoin/modules/home/service/impl/MemberQuickBuySaleServiceImpl.java |   20 ++++++++++++++++----
 src/main/java/com/xcong/excoin/modules/home/service/MemberQuickBuySaleService.java          |    2 ++
 src/main/java/com/xcong/excoin/modules/home/controller/MemberQuickBuySaleController.java    |    7 +++++++
 src/main/java/com/xcong/excoin/modules/home/mapper/MemberQuickBuySaleEntityMapper.java      |    9 ++++++---
 4 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/home/controller/MemberQuickBuySaleController.java b/src/main/java/com/xcong/excoin/modules/home/controller/MemberQuickBuySaleController.java
index 8b7b99a..d172586 100644
--- a/src/main/java/com/xcong/excoin/modules/home/controller/MemberQuickBuySaleController.java
+++ b/src/main/java/com/xcong/excoin/modules/home/controller/MemberQuickBuySaleController.java
@@ -8,6 +8,7 @@
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.alibaba.druid.util.StringUtils;
@@ -77,6 +78,12 @@
 		return memberQuickBuySaleService.selectById(id);
 	}
 	
+	@ApiOperation(value = "selectAll", notes = "查询用户所有的买卖记录")
+	@GetMapping(value = "/selectAll")
+	public Result selectAll(@RequestParam(value = "type") String type) {
+		return memberQuickBuySaleService.selectAll(type);
+	}
+	
 	@ApiOperation(value = "cancel", notes = "充值撤销")
 	@GetMapping(value = "/cancel/{id}")
 	public Result cancel(@PathVariable(value = "id") Long id) {
diff --git a/src/main/java/com/xcong/excoin/modules/home/mapper/MemberQuickBuySaleEntityMapper.java b/src/main/java/com/xcong/excoin/modules/home/mapper/MemberQuickBuySaleEntityMapper.java
index c1a10dd..c79e48e 100644
--- a/src/main/java/com/xcong/excoin/modules/home/mapper/MemberQuickBuySaleEntityMapper.java
+++ b/src/main/java/com/xcong/excoin/modules/home/mapper/MemberQuickBuySaleEntityMapper.java
@@ -1,12 +1,13 @@
 package com.xcong.excoin.modules.home.mapper;
 
-import com.xcong.excoin.modules.home.entity.MemberQuickBuySaleEntity;
+import java.util.List;
+
 import org.mapstruct.Mapper;
 import org.mapstruct.factory.Mappers;
 
 import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleDto;
 import com.xcong.excoin.modules.home.entity.MemberQuickBuySaleEntity;
-import com.xcong.excoin.modules.home.vo.MemberQuickBuySaleVo;
+import com.xcong.excoin.modules.home.vo.MemberQuickBuySaleDetailVo;
 
 
 @Mapper
@@ -14,8 +15,10 @@
 
     public static final MemberQuickBuySaleEntityMapper INSTANCE = Mappers.getMapper(MemberQuickBuySaleEntityMapper.class);
 
-    public abstract MemberQuickBuySaleVo entityToVo(MemberQuickBuySaleEntity memberQuickBuySaleEntity);
+    public abstract MemberQuickBuySaleDetailVo entityToVo(MemberQuickBuySaleEntity memberQuickBuySaleEntity);
     
     public abstract MemberQuickBuySaleEntity dtoToEntity(MemberQuickBuySaleDto dto);
+    
+    public abstract List<MemberQuickBuySaleDetailVo> entityListToVoList(List<MemberQuickBuySaleEntity> memberQuickBuySaleEntityList);
 
 }
diff --git a/src/main/java/com/xcong/excoin/modules/home/service/MemberQuickBuySaleService.java b/src/main/java/com/xcong/excoin/modules/home/service/MemberQuickBuySaleService.java
index d7bf632..4e8327e 100644
--- a/src/main/java/com/xcong/excoin/modules/home/service/MemberQuickBuySaleService.java
+++ b/src/main/java/com/xcong/excoin/modules/home/service/MemberQuickBuySaleService.java
@@ -15,6 +15,8 @@
 	
 	public Result selectById(Long id);
 	
+	public Result selectAll(String type);
+	
 	public Result cancelRecharge(Long id);
 	
 	public Result sell(MemberEntity member,MemberQuickBuySaleDto memberQuickBuySaleDto);
diff --git a/src/main/java/com/xcong/excoin/modules/home/service/impl/MemberQuickBuySaleServiceImpl.java b/src/main/java/com/xcong/excoin/modules/home/service/impl/MemberQuickBuySaleServiceImpl.java
index 829d135..4a602c5 100644
--- a/src/main/java/com/xcong/excoin/modules/home/service/impl/MemberQuickBuySaleServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/home/service/impl/MemberQuickBuySaleServiceImpl.java
@@ -22,6 +22,7 @@
 import com.xcong.excoin.modules.home.entity.MemberQuickBuySaleEntity;
 import com.xcong.excoin.modules.home.mapper.MemberQuickBuySaleEntityMapper;
 import com.xcong.excoin.modules.home.service.MemberQuickBuySaleService;
+import com.xcong.excoin.modules.home.vo.MemberQuickBuySaleDetailVo;
 import com.xcong.excoin.modules.home.vo.MemberQuickBuySaleVo;
 import com.xcong.excoin.modules.member.dao.MemberDao;
 import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
@@ -89,7 +90,7 @@
 	@Override
 	public Result selectById(Long id) {
 		MemberQuickBuySaleEntity memberQuickBuySaleEntity = memberQuickBuySaleDao.selectById(id);
-		MemberQuickBuySaleVo memberQuickBuySaleVo = MemberQuickBuySaleEntityMapper.INSTANCE.entityToVo(memberQuickBuySaleEntity);
+		MemberQuickBuySaleDetailVo memberQuickBuySaleDetailVo = MemberQuickBuySaleEntityMapper.INSTANCE.entityToVo(memberQuickBuySaleEntity);
 		// 收款信息
 		QueryWrapper<PlatformPaymentMethodEntity> queryWrapper = new QueryWrapper<>();
 		queryWrapper.eq("status", "1");
@@ -98,12 +99,23 @@
 		if (CollectionUtils.isEmpty(paymentMethodList)) {
 			return Result.fail("收款方式为空");
 		}
-		memberQuickBuySaleVo.setPlatforPaymentMethodList(paymentMethodList);
+		memberQuickBuySaleDetailVo.setPlatforPaymentMethodList(paymentMethodList);
 		long startTime = memberQuickBuySaleEntity.getCreateTime().getTime();
 		long nowTime = new Date().getTime();
 		long third = 30*60*1000;
-		memberQuickBuySaleVo.setTimeLeft((third-nowTime+startTime)/1000);
-		return Result.ok(memberQuickBuySaleVo);
+		memberQuickBuySaleDetailVo.setTimeLeft((third-nowTime+startTime)/1000);
+		return Result.ok(memberQuickBuySaleDetailVo);
+	}
+	
+	@Override
+	public Result selectAll(String type) {
+		MemberEntity member = LoginUserUtils.getAppLoginUser();
+		QueryWrapper<MemberQuickBuySaleEntity> queryWrapper = new QueryWrapper<>();
+		queryWrapper.eq("member_id", member.getId());
+		queryWrapper.eq("order_type", type);
+		List<MemberQuickBuySaleEntity> memberQuickBuySaleEntityList = memberQuickBuySaleDao.selectList(queryWrapper);
+		List<MemberQuickBuySaleDetailVo> memberQuickBuySaleDetailVoList = MemberQuickBuySaleEntityMapper.INSTANCE.entityListToVoList(memberQuickBuySaleEntityList);
+		return Result.ok(memberQuickBuySaleDetailVoList);
 	}
 
 	@Override

--
Gitblit v1.9.1