From 5b818c73e70ef4618681fd103ca593020431eeef Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Tue, 21 Nov 2023 18:02:25 +0800
Subject: [PATCH] 匹配

---
 src/main/java/cc/mrbird/febs/mall/dto/ApiOrderBuyInfoDto.java                 |   14 
 src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java                   |   22 +
 src/main/resources/templates/febs/views/modules/news/productSellList.html     |   19 
 src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyRecordMapper.java      |   14 
 src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellRecordMapper.java     |    7 
 src/main/resources/mapper/modules/MallProductSellRecordMapper.xml             |   22 +
 src/main/java/cc/mrbird/febs/mall/service/IMallNewsInfoService.java           |   10 
 src/main/java/cc/mrbird/febs/mall/mapper/MallProductNftMapper.java            |    6 
 src/main/java/cc/mrbird/febs/mall/entity/MallProductSell.java                 |    5 
 src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellMapper.java           |    9 
 src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java     |   21 +
 src/main/java/cc/mrbird/febs/mall/entity/MallProductBuy.java                  |    7 
 src/main/java/cc/mrbird/febs/mall/vo/ApiOrderSellRecordInfoVo.java            |   29 +
 src/main/resources/templates/febs/views/modules/news/productSellPick.html     |  154 +++++++++
 src/main/java/cc/mrbird/febs/mall/vo/ApiOrderListVo.java                      |   26 +
 src/main/java/cc/mrbird/febs/mall/entity/MallProductBuyRecord.java            |   23 +
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java |   79 ++++
 src/main/java/cc/mrbird/febs/mall/vo/AdminMallProductSellPickVo.java          |   13 
 src/main/java/cc/mrbird/febs/mall/service/IApiMallProductService.java         |   10 
 src/main/java/cc/mrbird/febs/mall/controller/ApiMallProductController.java    |   37 ++
 src/main/resources/mapper/modules/MallProductBuyMapper.xml                    |   52 +-
 src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyRecordInfoVo.java             |   29 +
 src/main/resources/mapper/modules/MallProductNftMapper.xml                    |   62 +++
 src/main/java/cc/mrbird/febs/mall/dto/AdminPickSellRecordDtoDto.java          |   11 
 src/main/resources/mapper/modules/MallProductBuyRecordMapper.xml              |   22 +
 src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java   |   86 ++++
 src/main/java/cc/mrbird/febs/mall/dto/ApiOrderSellInfoDto.java                |   15 
 src/main/resources/mapper/modules/MallProductSellMapper.xml                   |   19 +
 src/main/java/cc/mrbird/febs/mall/dto/ApiOrderListDto.java                    |   25 +
 src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyMapper.java            |    8 
 src/main/java/cc/mrbird/febs/mall/vo/ApiOrderSellInfoVo.java                  |   22 +
 src/main/java/cc/mrbird/febs/mall/controller/ViewNewsController.java          |   15 
 src/main/resources/templates/febs/views/modules/news/productBuyList.html      |   33 +
 33 files changed, 843 insertions(+), 83 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java
index a766cc9..a2aa5e6 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java
@@ -6,11 +6,13 @@
 import cc.mrbird.febs.common.entity.QueryRequest;
 import cc.mrbird.febs.common.enumerates.ProductEnum;
 import cc.mrbird.febs.mall.dto.AdminMallProductNftDto;
+import cc.mrbird.febs.mall.dto.AdminPickSellRecordDtoDto;
 import cc.mrbird.febs.mall.dto.MallNewsInfoDto;
 import cc.mrbird.febs.mall.entity.*;
 import cc.mrbird.febs.mall.mapper.MallProductNftMapper;
 import cc.mrbird.febs.mall.service.IMallNewsInfoService;
 import cc.mrbird.febs.mall.vo.AdminMallProductNftVo;
+import cc.mrbird.febs.mall.vo.AdminMallProductSellPickVo;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
@@ -107,6 +109,25 @@
     }
 
     /**
+     * 用户NFT提现-匹配提现用户列表
+     * @return
+     */
+    @GetMapping(value = "findSellList")
+    public FebsResponse findSellList() {
+        List<AdminMallProductSellPickVo> categories = mallNewsInfoService.findSellList();
+        return new FebsResponse().success().data(categories);
+    }
+
+    /**
+     * 用户NFT提现-手动分配
+     */
+    @PostMapping("pickSellRecord")
+    @ControllerEndpoint(operation = "用户NFT提现-手动分配", exceptionMessage = "操作失败")
+    public FebsResponse pickSellRecord(@Valid AdminPickSellRecordDtoDto pickSellRecordDto) {
+        return mallNewsInfoService.pickSellRecord(pickSellRecordDto);
+    }
+
+    /**
      * 新闻中心-列表
      * @param mallNewsInfo
      * @param request
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallProductController.java b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallProductController.java
index 2c9a301..e17c388 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallProductController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallProductController.java
@@ -2,11 +2,10 @@
 
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.mall.dto.*;
-import cc.mrbird.febs.mall.entity.MallNewsInfo;
-import cc.mrbird.febs.mall.service.IApiMallNewsService;
 import cc.mrbird.febs.mall.service.IApiMallProductService;
-import cc.mrbird.febs.mall.vo.NewsListVo;
-import cc.mrbird.febs.mall.vo.OrderListVo;
+import cc.mrbird.febs.mall.vo.ApiOrderBuyInfoVo;
+import cc.mrbird.febs.mall.vo.ApiOrderSellInfoVo;
+import cc.mrbird.febs.mall.vo.ApiOrderListVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiResponse;
@@ -32,16 +31,46 @@
     public FebsResponse productNFTList() {
         return new FebsResponse().success().data(iApiMallProductService.productNFTList());
     }
+
     @ApiOperation(value = "预约", notes = "预约")
     @PostMapping(value = "/createNFT")
     public FebsResponse createNFT(@RequestBody @Valid ApiCreateNFTDto createNFTDto) {
         return iApiMallProductService.createNFT(createNFTDto);
     }
+
+    @ApiOperation(value = "订单管理-列表", notes = "订单管理-列表")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "success", response = ApiOrderListVo.class)
+    })
+    @PostMapping(value = "/orderList")
+    public FebsResponse orderList(@RequestBody @Valid ApiOrderListDto apiOrderListDto) {
+        return iApiMallProductService.orderList(apiOrderListDto);
+    }
+
+    @ApiOperation(value = "订单管理-查看提现详情", notes = "订单管理-查看提现详情")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "success", response = ApiOrderSellInfoVo.class)
+    })
+    @PostMapping(value = "/orderSell")
+    public FebsResponse orderSell(@RequestBody @Valid ApiOrderSellInfoDto apiOrderSellInfoDto) {
+        return iApiMallProductService.orderSell(apiOrderSellInfoDto);
+    }
+
+    @ApiOperation(value = "订单管理-查看预约详情", notes = "订单管理-查看预约详情")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "success", response = ApiOrderBuyInfoVo.class)
+    })
+    @PostMapping(value = "/orderBuy")
+    public FebsResponse orderBuy(@RequestBody @Valid ApiOrderBuyInfoDto apiOrderBuyInfoDto) {
+        return iApiMallProductService.orderBuy(apiOrderBuyInfoDto);
+    }
+
     @ApiOperation(value = "FCM提现", notes = "FCM提现")
     @PostMapping(value = "/outFcm")
     public FebsResponse outFcm(@RequestBody @Valid ApiOutFcmDto outFcmDto) {
         return iApiMallProductService.outFcm(outFcmDto);
     }
+
     @ApiOperation(value = "NFT提现", notes = "NFT提现")
     @PostMapping(value = "/outNFT")
     public FebsResponse outNFT(@RequestBody @Valid ApiOutNFTDto outNFTDto) {
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewNewsController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewNewsController.java
index c16302a..12dc11c 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ViewNewsController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewNewsController.java
@@ -4,7 +4,9 @@
 import cc.mrbird.febs.common.utils.FebsUtil;
 import cc.mrbird.febs.mall.entity.MallNewsCategory;
 import cc.mrbird.febs.mall.entity.MallNewsInfo;
+import cc.mrbird.febs.mall.entity.MallProductBuy;
 import cc.mrbird.febs.mall.entity.MallProductNft;
+import cc.mrbird.febs.mall.mapper.MallProductBuyMapper;
 import cc.mrbird.febs.mall.mapper.MallProductNftMapper;
 import cc.mrbird.febs.mall.service.IMallNewsInfoService;
 import lombok.RequiredArgsConstructor;
@@ -26,6 +28,7 @@
 
     private final IMallNewsInfoService mallNewsInfoService;
     private final MallProductNftMapper mallProductNftMapper;
+    private final MallProductBuyMapper mallProductBuyMapper;
 
     /**
      * NFT预约产品
@@ -76,6 +79,18 @@
     }
 
     /**
+     * 用户NFT提现-手动分配
+     * @return
+     */
+    @GetMapping("productSellPick/{id}")
+    @RequiresPermissions("productSellPick:update")
+    public String productSellPick(@PathVariable long id, Model model) {
+        MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(id);
+        model.addAttribute("mallProductBuy", mallProductBuy);
+        return FebsUtil.view("modules/news/productSellPick");
+    }
+
+    /**
      * 新闻中心-列表
      * @return
      */
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/AdminPickSellRecordDtoDto.java b/src/main/java/cc/mrbird/febs/mall/dto/AdminPickSellRecordDtoDto.java
new file mode 100644
index 0000000..f9e7c6c
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/AdminPickSellRecordDtoDto.java
@@ -0,0 +1,11 @@
+package cc.mrbird.febs.mall.dto;
+
+import lombok.Data;
+
+@Data
+public class AdminPickSellRecordDtoDto {
+
+    private Long productSellId;
+    private Long id;
+    private String pickNftCnt;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderBuyInfoDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderBuyInfoDto.java
new file mode 100644
index 0000000..acab120
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderBuyInfoDto.java
@@ -0,0 +1,14 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+@ApiModel(value = "ApiOrderBuyInfoDto", description = "参数接收类")
+public class ApiOrderBuyInfoDto {
+
+    @NotNull(message = "类型参数不能为空")
+    private Long id;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderListDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderListDto.java
new file mode 100644
index 0000000..c30fef9
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderListDto.java
@@ -0,0 +1,25 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+@ApiModel(value = "ApiOrderListDto", description = "参数接收类")
+public class ApiOrderListDto {
+
+    @ApiModelProperty(value = "一页数量", example = "10")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "第几页", example = "1")
+    private Integer pageNum;
+
+    @ApiModelProperty(hidden = true)
+    private Long memberId;
+
+    @NotNull(message = "类型参数不能为空")
+    @ApiModelProperty(value = "类型:1:提现(卖单), 2:预约(买单)", example = "1")
+    private Integer orderType;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderSellInfoDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderSellInfoDto.java
new file mode 100644
index 0000000..206fd8c
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ApiOrderSellInfoDto.java
@@ -0,0 +1,15 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Data
+@ApiModel(value = "ApiOrderSellInfoDto", description = "参数接收类")
+public class ApiOrderSellInfoDto {
+
+    @NotNull(message = "类型参数不能为空")
+    private Long id;
+
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallProductBuy.java b/src/main/java/cc/mrbird/febs/mall/entity/MallProductBuy.java
index 1123f40..e8ae233 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/MallProductBuy.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallProductBuy.java
@@ -1,6 +1,7 @@
 package cc.mrbird.febs.mall.entity;
 
 import cc.mrbird.febs.common.entity.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -13,12 +14,16 @@
 public class MallProductBuy extends BaseEntity {
 
     private Long memberId;//
+    private String orderNo;
     private Long sellId;//出售ID
-    private Long productNftId;//预约NFT编码
+    private Long productNftId;//预约NFTID
     private int state;//预约状态  0:失败 1:进行中 2:超时  3:已完成
     private int mateState;//匹配状态0:失败 1:匹配中 2:待支付 3:已支付 4:对方已确认 5:已完成
     private BigDecimal nftTotal;//nft预约额度
     private BigDecimal nftAva;//nft分配额度
     private Date orderTime;//匹配时间
     private Date payTime;//支付时间
+
+    @TableField(exist = false)
+    private String accountLogin;
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallProductBuyRecord.java b/src/main/java/cc/mrbird/febs/mall/entity/MallProductBuyRecord.java
new file mode 100644
index 0000000..7a20e4e
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallProductBuyRecord.java
@@ -0,0 +1,23 @@
+package cc.mrbird.febs.mall.entity;
+
+import cc.mrbird.febs.common.entity.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@TableName("mall_product_buy_record")
+public class MallProductBuyRecord extends BaseEntity {
+
+    private Long memberId;//
+    private Long buyId;//
+    private Long sellRecordId;//
+    private BigDecimal pickNftCnt;//分配额度、支付金额
+    private Integer state;//匹配状态0:失败 1:匹配中 2:待支付 3:已支付 4:对方已确认 5:已完成
+    private Date orderTime;//匹配时间
+    private Date payTime;//支付时间
+    private String nftImg;//支付凭证
+    private Integer type;//支付类型 1:微信 2:支付宝 3:银行转账 4:USDT转账
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallProductSell.java b/src/main/java/cc/mrbird/febs/mall/entity/MallProductSell.java
index f37423b..af043e4 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/MallProductSell.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallProductSell.java
@@ -1,6 +1,7 @@
 package cc.mrbird.febs.mall.entity;
 
 import cc.mrbird.febs.common.entity.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -11,10 +12,14 @@
 public class MallProductSell extends BaseEntity {
 
     private Long memberId;//
+    private String orderNo;
     private BigDecimal nftTotal;//动态NFT总数
     private BigDecimal nftCnt;//实际提现数量
     private BigDecimal nftCntAva;//剩余数量
     private BigDecimal nftFee;//NFT手续费
     private BigDecimal fcmFee;//代币手续费
     private Integer state;//预约状态  0:失败 1:进行中 2:超时  3:已完成
+
+    @TableField(exist = false)
+    private String accountLogin;
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyMapper.java
index 3212291..857b95d 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyMapper.java
@@ -1,7 +1,11 @@
 package cc.mrbird.febs.mall.mapper;
 
+import cc.mrbird.febs.mall.dto.ApiOrderListDto;
 import cc.mrbird.febs.mall.entity.MallProductBuy;
+import cc.mrbird.febs.mall.vo.ApiOrderBuyInfoVo;
+import cc.mrbird.febs.mall.vo.ApiOrderListVo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
 
 public interface MallProductBuyMapper extends BaseMapper<MallProductBuy> {
@@ -9,4 +13,8 @@
                                                               @Param("productNFTId")Long productNFTId,
                                                               @Param("state")Integer state,
                                                               @Param("mateState")Integer mateState);
+
+    IPage<ApiOrderListVo> selectListInPage(IPage<ApiOrderListVo> page, @Param("record")ApiOrderListDto apiOrderListDto);
+
+    ApiOrderBuyInfoVo selectBuyById(@Param("id")Long productBuyId);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyRecordMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyRecordMapper.java
new file mode 100644
index 0000000..9f01524
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductBuyRecordMapper.java
@@ -0,0 +1,14 @@
+package cc.mrbird.febs.mall.mapper;
+
+import cc.mrbird.febs.mall.entity.MallProductBuyRecord;
+import cc.mrbird.febs.mall.vo.ApiOrderBuyRecordInfoVo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface MallProductBuyRecordMapper extends BaseMapper<MallProductBuyRecord> {
+
+    List<ApiOrderBuyRecordInfoVo> selectByBuyId(@Param("productBuyId")Long productBuyId);
+
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductNftMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductNftMapper.java
index d2142ae..4e64adc 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductNftMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductNftMapper.java
@@ -3,10 +3,7 @@
 import cc.mrbird.febs.mall.entity.MallProductBuy;
 import cc.mrbird.febs.mall.entity.MallProductNft;
 import cc.mrbird.febs.mall.entity.MallProductSell;
-import cc.mrbird.febs.mall.vo.AdminMallProductBuyVo;
-import cc.mrbird.febs.mall.vo.AdminMallProductNftVo;
-import cc.mrbird.febs.mall.vo.AdminMallProductSellVo;
-import cc.mrbird.febs.mall.vo.ApiMallProductNftVo;
+import cc.mrbird.febs.mall.vo.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -24,4 +21,5 @@
 
     IPage<AdminMallProductSellVo> getSellList(Page<AdminMallProductSellVo> page, @Param("record")MallProductSell mallProductSell);
 
+    List<AdminMallProductSellPickVo> selectProductSellByState(@Param("state")int value);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellMapper.java
index 09541dd..89f3f32 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellMapper.java
@@ -1,7 +1,16 @@
 package cc.mrbird.febs.mall.mapper;
 
+import cc.mrbird.febs.mall.dto.ApiOrderListDto;
 import cc.mrbird.febs.mall.entity.MallProductSell;
+import cc.mrbird.febs.mall.vo.ApiOrderListVo;
+import cc.mrbird.febs.mall.vo.ApiOrderSellInfoVo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
 
 public interface MallProductSellMapper extends BaseMapper<MallProductSell> {
+
+    IPage<ApiOrderListVo> selectListInPage(IPage<ApiOrderListVo> page, @Param("record")ApiOrderListDto apiOrderListDto);
+
+    ApiOrderSellInfoVo selectSellInfoById(@Param("id")Long productSellId);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellRecordMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellRecordMapper.java
index 8cb5822..ed0f200 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellRecordMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallProductSellRecordMapper.java
@@ -1,7 +1,14 @@
 package cc.mrbird.febs.mall.mapper;
 
 import cc.mrbird.febs.mall.entity.MallProductSellRecord;
+import cc.mrbird.febs.mall.vo.ApiOrderSellRecordInfoVo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface MallProductSellRecordMapper extends BaseMapper<MallProductSellRecord> {
+
+    List<ApiOrderSellRecordInfoVo> selectBySellId(@Param("productSellId")Long productSellId);
+
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IApiMallProductService.java b/src/main/java/cc/mrbird/febs/mall/service/IApiMallProductService.java
index 8388b5e..2c7897e 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IApiMallProductService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IApiMallProductService.java
@@ -1,9 +1,7 @@
 package cc.mrbird.febs.mall.service;
 
 import cc.mrbird.febs.common.entity.FebsResponse;
-import cc.mrbird.febs.mall.dto.ApiCreateNFTDto;
-import cc.mrbird.febs.mall.dto.ApiOutFcmDto;
-import cc.mrbird.febs.mall.dto.ApiOutNFTDto;
+import cc.mrbird.febs.mall.dto.*;
 import cc.mrbird.febs.mall.entity.MallNewsCategory;
 import cc.mrbird.febs.mall.entity.MallProductNft;
 import cc.mrbird.febs.mall.vo.ApiMallProductNftVo;
@@ -19,4 +17,10 @@
     FebsResponse outFcm(ApiOutFcmDto outFcmDto);
 
     FebsResponse outNFT(ApiOutNFTDto outNFTDto);
+
+    FebsResponse orderList(ApiOrderListDto apiOrderListDto);
+
+    FebsResponse orderSell(ApiOrderSellInfoDto apiOrderSellInfoDto);
+
+    FebsResponse orderBuy(ApiOrderBuyInfoDto apiOrderBuyInfoDto);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IMallNewsInfoService.java b/src/main/java/cc/mrbird/febs/mall/service/IMallNewsInfoService.java
index 762d896..695f658 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IMallNewsInfoService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IMallNewsInfoService.java
@@ -3,12 +3,10 @@
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
 import cc.mrbird.febs.mall.dto.AdminMallProductNftDto;
+import cc.mrbird.febs.mall.dto.AdminPickSellRecordDtoDto;
 import cc.mrbird.febs.mall.dto.MallNewsInfoDto;
 import cc.mrbird.febs.mall.entity.*;
-import cc.mrbird.febs.mall.vo.AdminMallNewsInfoVo;
-import cc.mrbird.febs.mall.vo.AdminMallProductBuyVo;
-import cc.mrbird.febs.mall.vo.AdminMallProductNftVo;
-import cc.mrbird.febs.mall.vo.AdminMallProductSellVo;
+import cc.mrbird.febs.mall.vo.*;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -47,4 +45,8 @@
     IPage<AdminMallProductBuyVo> getBuyList(MallProductBuy mallProductBuy, QueryRequest request);
 
     IPage<AdminMallProductSellVo> getSellList(MallProductSell mallProductSell, QueryRequest request);
+
+    List<AdminMallProductSellPickVo> findSellList();
+
+    FebsResponse pickSellRecord(AdminPickSellRecordDtoDto pickSellRecordDto);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
index c2750fd..bc49198 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallProductServiceImpl.java
@@ -8,17 +8,18 @@
 import cc.mrbird.febs.common.exception.FebsException;
 import cc.mrbird.febs.common.utils.LoginUserUtil;
 import cc.mrbird.febs.common.utils.MallUtils;
-import cc.mrbird.febs.mall.dto.ApiCreateNFTDto;
-import cc.mrbird.febs.mall.dto.ApiOutFcmDto;
-import cc.mrbird.febs.mall.dto.ApiOutNFTDto;
+import cc.mrbird.febs.mall.dto.*;
 import cc.mrbird.febs.mall.entity.*;
 import cc.mrbird.febs.mall.mapper.*;
 import cc.mrbird.febs.mall.service.IApiMallProductService;
 import cc.mrbird.febs.mall.service.IMallMoneyFlowService;
-import cc.mrbird.febs.mall.vo.ApiMallProductNftVo;
+import cc.mrbird.febs.mall.vo.*;
 import cc.mrbird.febs.rabbit.producter.AgentProducer;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.crypto.SecureUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -26,6 +27,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 
 @Slf4j
@@ -41,6 +43,7 @@
     private final AgentProducer agentProducer;
     private final MallProductSellMapper mallProductSellMapper;
     private final MallProductSellRecordMapper mallProductSellRecordMapper;
+    private final MallProductBuyRecordMapper mallProductBuyRecordMapper;
 
     @Override
     public List<ApiMallProductNftVo> productNFTList() {
@@ -81,8 +84,11 @@
          || priceToken.compareTo(mallMemberAmount.getTokenAva()) > 0){
             throw new FebsException("余额不足");
         }
+
+        String orderNo = MallUtils.getOrderNum("YY");
         mallProductBuy = new MallProductBuy();
         mallProductBuy.setMemberId(memberId);
+        mallProductBuy.setOrderNo(orderNo);
         mallProductBuy.setProductNftId(mallProductNft.getId());
         mallProductBuy.setState(ProductEnum.PRODUCT_BUY_ON_GOING.getValue());
         mallProductBuy.setMateState(ProductEnum.PRODUCT_MATE_STATE_ON_GOING.getValue());
@@ -93,8 +99,6 @@
         mallMemberAmount.setTokenAva(mallMemberAmount.getTokenAva().subtract(priceToken));
         mallMemberAmount.setTokenFrozen(mallMemberAmount.getTokenFrozen().add(priceToken));
         mallMemberAmountMapper.updateTokenAvaAndTokenFrozenById(mallMemberAmount);
-
-        String orderNo = MallUtils.getOrderNum("YY");
         iMallMoneyFlowService.addMoneyFlow(
                 memberId,
                 priceToken.negate(),
@@ -227,8 +231,10 @@
         BigDecimal fcmPrice = ObjectUtil.isEmpty(fcmPriceDic) ? new BigDecimal(2) : new BigDecimal(fcmPriceDic.getValue());
         BigDecimal fcmFeeCnt = nftFee.divide(fcmPrice, 2, BigDecimal.ROUND_DOWN);
 
+        String orderNo = MallUtils.getOrderNum("NFT");
         MallProductSell mallProductSell = new MallProductSell();
         mallProductSell.setMemberId(memberId);
+        mallProductSell.setOrderNo(orderNo);
         mallProductSell.setNftTotal(nftCnt);
         mallProductSell.setNftCnt(nftCntAva);
         mallProductSell.setNftCntAva(nftCntAva);
@@ -242,7 +248,6 @@
 
         mallMemberAmount.setFrozenNft(mallMemberAmount.getFrozenNft().add(nftCntAva));
         mallMemberAmountMapper.updateFrozenNftById(mallMemberAmount);
-        String orderNo = MallUtils.getOrderNum("NFT");
         iMallMoneyFlowService.addMoneyFlow(
                 memberId,
                 nftCnt.negate(),
@@ -263,4 +268,64 @@
         agentProducer.sendFcmNFTExchangeMsg(fcmFeeCnt.toString());
         return new FebsResponse().success();
     }
+
+    @Override
+    public FebsResponse orderList(ApiOrderListDto apiOrderListDto) {
+        Long memberId = LoginUserUtil.getLoginUser().getId();
+        List<ApiOrderListVo> objects = new ArrayList<>();
+        Integer orderType = apiOrderListDto.getOrderType();
+        apiOrderListDto.setMemberId(memberId);
+        //买单
+        if(2 == orderType){
+            IPage<ApiOrderListVo> page = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
+            IPage<ApiOrderListVo> apiOrderListVoIPageBuy = mallProductBuyMapper.selectListInPage(page, apiOrderListDto);
+            if(CollUtil.isNotEmpty(apiOrderListVoIPageBuy.getRecords())){
+                for(ApiOrderListVo apiOrderListVo : apiOrderListVoIPageBuy.getRecords()){
+                    objects.add(apiOrderListVo);
+                }
+            }
+        }
+        //卖单
+        if(1 == orderType){
+            IPage<ApiOrderListVo> page = new Page<>(apiOrderListDto.getPageNum(), apiOrderListDto.getPageSize());
+            IPage<ApiOrderListVo> apiOrderListVoIPageSell = mallProductSellMapper.selectListInPage(page, apiOrderListDto);
+            if(CollUtil.isNotEmpty(apiOrderListVoIPageSell.getRecords())){
+                for(ApiOrderListVo apiOrderListVo : apiOrderListVoIPageSell.getRecords()){
+                    objects.add(apiOrderListVo);
+                }
+            }
+        }
+
+        return new FebsResponse().success().data(objects);
+    }
+
+    @Override
+    public FebsResponse orderSell(ApiOrderSellInfoDto apiOrderSellInfoDto) {
+        Long productSellId = apiOrderSellInfoDto.getId();
+        Long memberId = LoginUserUtil.getLoginUser().getId();
+        ApiOrderSellInfoVo apiOrderSellInfoVo = mallProductSellMapper.selectSellInfoById(productSellId);
+        if(ObjectUtil.isEmpty(apiOrderSellInfoVo)){
+            throw new FebsException("记录不存在");
+        }
+        List<ApiOrderSellRecordInfoVo> apiOrderSellRecordInfoVos = mallProductSellRecordMapper.selectBySellId(productSellId);
+        if(CollUtil.isNotEmpty(apiOrderSellRecordInfoVos)){
+            apiOrderSellInfoVo.setApiOrderSellRecordInfoVos(apiOrderSellRecordInfoVos);
+        }
+        return new FebsResponse().success().data(apiOrderSellInfoVo);
+    }
+
+    @Override
+    public FebsResponse orderBuy(ApiOrderBuyInfoDto apiOrderBuyInfoDto) {
+        Long productBuyId = apiOrderBuyInfoDto.getId();
+        Long memberId = LoginUserUtil.getLoginUser().getId();
+        ApiOrderBuyInfoVo apiOrderBuyInfoVo = mallProductBuyMapper.selectBuyById(productBuyId);
+        if(ObjectUtil.isEmpty(apiOrderBuyInfoVo)){
+            throw new FebsException("记录不存在");
+        }
+        List<ApiOrderBuyRecordInfoVo> apiOrderBuyRecordInfoVos = mallProductBuyRecordMapper.selectByBuyId(productBuyId);
+        if(CollUtil.isNotEmpty(apiOrderBuyRecordInfoVos)){
+            apiOrderBuyInfoVo.setApiOrderBuyRecordInfoVos(apiOrderBuyRecordInfoVos);
+        }
+        return new FebsResponse().success().data(apiOrderBuyInfoVo);
+    }
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java
index 1a68d76..d2aff70 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MallNewsInfoServiceImpl.java
@@ -2,19 +2,18 @@
 
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.enumerates.ProductEnum;
 import cc.mrbird.febs.mall.conversion.MallProductNftConversion;
 import cc.mrbird.febs.mall.dto.AdminMallProductNftDto;
+import cc.mrbird.febs.mall.dto.AdminPickSellRecordDtoDto;
 import cc.mrbird.febs.mall.dto.MallNewsInfoDto;
 import cc.mrbird.febs.mall.entity.*;
-import cc.mrbird.febs.mall.mapper.MallNewsCategoryMapper;
-import cc.mrbird.febs.mall.mapper.MallNewsInfoMapper;
-import cc.mrbird.febs.mall.mapper.MallProductNftMapper;
+import cc.mrbird.febs.mall.mapper.*;
 import cc.mrbird.febs.mall.service.IMallNewsInfoService;
-import cc.mrbird.febs.mall.vo.AdminMallNewsInfoVo;
-import cc.mrbird.febs.mall.vo.AdminMallProductBuyVo;
-import cc.mrbird.febs.mall.vo.AdminMallProductNftVo;
-import cc.mrbird.febs.mall.vo.AdminMallProductSellVo;
+import cc.mrbird.febs.mall.vo.*;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -24,6 +23,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -37,6 +37,10 @@
 
     private final MallNewsCategoryMapper mallNewsCategoryMapper;
     private final MallProductNftMapper mallProductNftMapper;
+    private final MallProductBuyMapper mallProductBuyMapper;
+    private final MallProductSellMapper mallProductSellMapper;
+    private final MallProductSellRecordMapper mallProductSellRecordMapper;
+    private final MallProductBuyRecordMapper mallProductBuyRecordMapper;
 
     @Override
     public IPage<AdminMallNewsInfoVo> getNewInfoList(MallNewsInfo mallNewsInfo, QueryRequest request) {
@@ -199,4 +203,72 @@
         IPage<AdminMallProductSellVo> adminMallProductSellVoIPage = mallProductNftMapper.getSellList(page, mallProductSell);
         return adminMallProductSellVoIPage;
     }
+
+    @Override
+    public List<AdminMallProductSellPickVo> findSellList() {
+        List<AdminMallProductSellPickVo> list = mallProductNftMapper.selectProductSellByState(ProductEnum.PRODUCT_SELL_ON_GOING.getValue());
+        return list;
+    }
+
+    @Override
+    public FebsResponse pickSellRecord(AdminPickSellRecordDtoDto pickSellRecordDto) {
+        /**
+         * 买单条件是否满足
+         * 卖单条件是否满足
+         * 生成卖单子记录
+         * 生成买单子记录
+         * 更新卖单状态
+         * 更新买单状态
+         */
+        Long productBuyId = pickSellRecordDto.getId();
+        Long productSellId = pickSellRecordDto.getProductSellId();
+        BigDecimal pickNftCnt = new BigDecimal(pickSellRecordDto.getPickNftCnt());
+        //买单
+        MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(productBuyId);
+        int state = mallProductBuy.getState();
+        if(ProductEnum.PRODUCT_BUY_ON_GOING.getValue() != state){
+            return new FebsResponse().fail().message("预约状态不是进行中");
+        }
+        BigDecimal nftAva = mallProductBuy.getNftAva();
+        if(BigDecimal.ZERO.compareTo(pickNftCnt) >= 0){
+            return new FebsResponse().fail().message("本次金额不能小于等于零");
+        }
+        if(nftAva.compareTo(pickNftCnt) < 0){
+            return new FebsResponse().fail().message("可分配不足");
+        }
+        //卖单
+        MallProductSell mallProductSell = mallProductSellMapper.selectById(productSellId);
+        BigDecimal nftCntAva = mallProductSell.getNftCntAva();
+        if(ProductEnum.PRODUCT_SELL_ON_GOING.getValue() != mallProductSell.getState()){
+            return new FebsResponse().fail().message("预约状态不是进行中");
+        }
+        if(nftCntAva.compareTo(pickNftCnt) < 0){
+            return new FebsResponse().fail().message("匹配提现剩余不足");
+        }
+        DateTime orderTime = DateUtil.date();
+        //生成卖单子记录
+        MallProductSellRecord mallProductSellRecord = new MallProductSellRecord();
+        mallProductSellRecord.setSellId(mallProductSell.getId());
+        mallProductSellRecord.setMemberId(mallProductBuy.getMemberId());
+        mallProductSellRecord.setOrderTime(orderTime);
+        mallProductSellRecord.setNftCnt(pickNftCnt);
+        mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_WAIT_PAY.getValue());
+        mallProductSellRecordMapper.insert(mallProductSellRecord);
+        //生成买单子记录
+        MallProductBuyRecord mallProductBuyRecord = new MallProductBuyRecord();
+        mallProductBuyRecord.setBuyId(mallProductBuy.getId());
+        mallProductBuyRecord.setMemberId(mallProductSell.getMemberId());
+        mallProductBuyRecord.setSellRecordId(mallProductSellRecord.getId());
+        mallProductBuyRecord.setPickNftCnt(pickNftCnt);
+        mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_WAIT_PAY.getValue());
+        mallProductBuyRecord.setOrderTime(orderTime);
+        mallProductBuyRecordMapper.insert(mallProductBuyRecord);
+        //更新卖单
+        mallProductSell.setNftCntAva(mallProductSell.getNftCntAva().subtract(pickNftCnt));
+        mallProductSellMapper.updateById(mallProductSell);
+        //更新买单
+        mallProductBuy.setNftAva(mallProductBuy.getNftAva().subtract(pickNftCnt));
+        mallProductBuyMapper.updateById(mallProductBuy);
+        return new FebsResponse().success();
+    }
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminMallProductSellPickVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminMallProductSellPickVo.java
new file mode 100644
index 0000000..d3cd9d4
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminMallProductSellPickVo.java
@@ -0,0 +1,13 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AdminMallProductSellPickVo", description = "信息返回类")
+public class AdminMallProductSellPickVo {
+
+
+    private Long id;//编码
+    private String name;//编码
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java
new file mode 100644
index 0000000..75f3c43
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyInfoVo.java
@@ -0,0 +1,22 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@Data
+@ApiModel(value = "ApiOrderBuyInfoVo", description = "信息返回类")
+public class ApiOrderBuyInfoVo {
+    private Long id;
+    private String orderNo;
+    private int state;//预约状态  0:失败 1:进行中 2:超时  3:已完成
+    private int mateState;//匹配状态0:失败 1:匹配中 2:待支付 3:已支付 4:对方已确认 5:已完成
+    private BigDecimal nftTotal;//nft预约额度
+    private BigDecimal nftAva;//nft分配额度
+    private Date orderTime;//匹配时间
+    private Date payTime;//支付时间
+    private List<ApiOrderBuyRecordInfoVo> apiOrderBuyRecordInfoVos;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyRecordInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyRecordInfoVo.java
new file mode 100644
index 0000000..b32d899
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderBuyRecordInfoVo.java
@@ -0,0 +1,29 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@ApiModel(value = "ApiOrderBuyRecordInfoVo", description = "信息返回类")
+public class ApiOrderBuyRecordInfoVo {
+    private Long id;//
+    private String accountLogin;//
+    private BigDecimal pickNftCnt;//分配额度、支付金额
+    private Integer state;//匹配状态0:失败 1:匹配中 2:待支付 3:已支付 4:对方已确认 5:已完成
+    private Date orderTime;//匹配时间
+    private Date payTime;//支付时间
+    private String nftImg;//支付凭证
+    private Integer type;//支付类型 1:微信 2:支付宝 3:银行转账 4:USDT转账
+
+    private String wxQrcode;//微信收款码
+    private String aliQrcode;//支付宝收款码
+    private String bankName;//真实姓名
+    private String bankNo;//银行卡号
+    private String bank;//开户行
+    private String phone;//手机号
+    private String usdtTongdao;//USDT通道类型:  TRC20 BEP20
+    private String usdtAddress;//USDT地址
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderListVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderListVo.java
new file mode 100644
index 0000000..e68bd81
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderListVo.java
@@ -0,0 +1,26 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@ApiModel(value = "ApiOrderListVo", description = "信息返回类")
+public class ApiOrderListVo {
+
+    @ApiModelProperty(value = "ID")
+    private Long id;
+    @ApiModelProperty(value = "状态  0:失败 1:进行中 2:超时  3:已完成")
+    private Integer state;
+    @ApiModelProperty(value = "订单编号")
+    private String orderNo;
+    @ApiModelProperty(value = "类型:1:提现(卖单), 2:预约(买单)")
+    private String type;
+    @ApiModelProperty(value = "数量")
+    private BigDecimal nftTotal;
+    @ApiModelProperty(value = "时间")
+    private Date createdTime;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderSellInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderSellInfoVo.java
new file mode 100644
index 0000000..a76190d
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderSellInfoVo.java
@@ -0,0 +1,22 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+@ApiModel(value = "ApiOrderSellInfoVo", description = "信息返回类")
+public class ApiOrderSellInfoVo {
+    private Long id;
+    private String orderNo;
+    private BigDecimal nftTotal;//动态NFT总数
+    private BigDecimal nftCnt;//实际提现数量
+    private BigDecimal nftCntAva;//剩余数量
+    private BigDecimal nftFee;//NFT手续费
+    private BigDecimal fcmFee;//代币手续费
+    private Integer state;//预约状态  0:失败 1:进行中 2:超时  3:已完成
+    private List<ApiOrderSellRecordInfoVo> apiOrderSellRecordInfoVos;
+
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderSellRecordInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderSellRecordInfoVo.java
new file mode 100644
index 0000000..389d211
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ApiOrderSellRecordInfoVo.java
@@ -0,0 +1,29 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@ApiModel(value = "ApiOrderSellRecordInfoVo", description = "信息返回类")
+public class ApiOrderSellRecordInfoVo {
+    private Long id;
+    private String accountLogin;//
+    private Date orderTime;//匹配时间
+    private Date payTime;//支付时间
+    private BigDecimal nftCnt;//支付数量
+    private String nftImg;//支付凭证
+    private Integer type;//支付类型 1:微信 2:支付宝 3:银行转账 4:USDT转账
+    private Integer state;//匹配状态0:失败 1:匹配中 2:待支付 3:已支付 4:对方已确认 5:已完成
+
+    private String wxQrcode;//微信收款码
+    private String aliQrcode;//支付宝收款码
+    private String bankName;//真实姓名
+    private String bankNo;//银行卡号
+    private String bank;//开户行
+    private String phone;//手机号
+    private String usdtTongdao;//USDT通道类型:  TRC20 BEP20
+    private String usdtAddress;//USDT地址
+}
diff --git a/src/main/resources/mapper/modules/MallProductBuyMapper.xml b/src/main/resources/mapper/modules/MallProductBuyMapper.xml
index 25a8ecf..1b8f410 100644
--- a/src/main/resources/mapper/modules/MallProductBuyMapper.xml
+++ b/src/main/resources/mapper/modules/MallProductBuyMapper.xml
@@ -1,37 +1,33 @@
 <?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="cc.mrbird.febs.mall.mapper.MallProductNftMapper">
+<mapper namespace="cc.mrbird.febs.mall.mapper.MallProductBuyMapper">
 
-    <select id="getProductNFTList" resultType="cc.mrbird.febs.mall.vo.AdminMallProductNftVo">
-        SELECT
-            a.*
-        FROM mall_product_nft a
+    <select id="selectMemberIdAndNFTIdAndStateAndMateState" resultType="cc.mrbird.febs.mall.entity.MallProductBuy">
+        select * from mall_product_buy
+        <where>
+            member_id = #{memberId}
+            and product_nft_id = #{productNFTId}
+            <if test="state != null">
+                and state = #{state}
+            </if>
+            <if test="mateState != null">
+                and mate_state = #{mateState}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectListInPage" resultType="cc.mrbird.febs.mall.vo.ApiOrderListVo">
+        select a.id,a.order_no,a.CREATED_TIME,a.nft_total,a.state,2 as type
+        from mall_product_buy a
+        where a.state = 1
+          and a.member_id = #{record.memberId}
         order by a.CREATED_TIME desc
     </select>
 
-    <select id="selectByState" resultType="cc.mrbird.febs.mall.vo.ApiMallProductNftVo">
-        SELECT
-            a.*
-        FROM mall_product_nft a
-        where a.state = #{state}
-    </select>
-
-    <select id="getBuyList" resultType="cc.mrbird.febs.mall.vo.AdminMallProductBuyVo">
-        SELECT
-            a.*,
-               b.account_login
-        FROM mall_product_buy a
-        left join mall_member b on a.member_id = b.id
-        order by a.CREATED_TIME desc
-    </select>
-
-    <select id="getSellList" resultType="cc.mrbird.febs.mall.vo.AdminMallProductSellVo">
-        SELECT
-            a.*,
-               b.account_login
-        FROM mall_product_sell a
-        left join mall_member b on a.member_id = b.id
-        order by a.CREATED_TIME desc
+    <select id="selectBuyById" resultType="cc.mrbird.febs.mall.vo.ApiOrderBuyInfoVo">
+        select a.*
+        from mall_product_buy a
+        where a.id = #{id}
     </select>
 
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/modules/MallProductBuyRecordMapper.xml b/src/main/resources/mapper/modules/MallProductBuyRecordMapper.xml
new file mode 100644
index 0000000..155ce35
--- /dev/null
+++ b/src/main/resources/mapper/modules/MallProductBuyRecordMapper.xml
@@ -0,0 +1,22 @@
+<?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="cc.mrbird.febs.mall.mapper.MallProductBuyRecordMapper">
+
+    <select id="selectByBuyId" resultType="cc.mrbird.febs.mall.vo.ApiOrderBuyRecordInfoVo">
+        select a.*,
+               b.account_login,
+               c.wx_qrcode,
+               c.ali_qrcode,
+               c.bank_name,
+               c.phone,
+               c.bank,
+               c.bank_no,
+               c.usdt_tongdao,
+               c.usdt_address
+        from mall_product_buy_record a
+        left join mall_member b on a.member_id = b.id
+        left join mall_member_payment c on a.member_id = c.member_id
+        where a.buy_id = #{productBuyId}
+    </select>
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/modules/MallProductNftMapper.xml b/src/main/resources/mapper/modules/MallProductNftMapper.xml
index 7a702a3..eb5ddcd 100644
--- a/src/main/resources/mapper/modules/MallProductNftMapper.xml
+++ b/src/main/resources/mapper/modules/MallProductNftMapper.xml
@@ -1,19 +1,61 @@
 <?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="cc.mrbird.febs.mall.mapper.MallProductBuyMapper">
+<mapper namespace="cc.mrbird.febs.mall.mapper.MallProductNftMapper">
 
-    <select id="selectMemberIdAndNFTIdAndStateAndMateState" resultType="cc.mrbird.febs.mall.entity.MallProductBuy">
-        select * from mall_product_buy
+    <select id="getProductNFTList" resultType="cc.mrbird.febs.mall.vo.AdminMallProductNftVo">
+        SELECT
+            a.*
+        FROM mall_product_nft a
+        order by a.CREATED_TIME desc
+    </select>
+
+    <select id="selectByState" resultType="cc.mrbird.febs.mall.vo.ApiMallProductNftVo">
+        SELECT
+            a.*
+        FROM mall_product_nft a
+        where a.state = #{state}
+    </select>
+
+    <select id="getBuyList" resultType="cc.mrbird.febs.mall.vo.AdminMallProductBuyVo">
+        SELECT
+            a.*,
+               b.account_login
+        FROM mall_product_buy a
+        left join mall_member b on a.member_id = b.id
         <where>
-            member_id = #{memberId}
-            and product_nft_id = #{productNFTId}
-            <if test="state != null">
-                and state = #{state}
-            </if>
-            <if test="mateState != null">
-                and mate_state = #{mateState}
+            <if test="record != null" >
+                <if test="record.accountLogin!=null and record.accountLogin!=''">
+                    and b.account_login like concat('%',  #{record.accountLogin},'%')
+                </if>
             </if>
         </where>
+        order by a.CREATED_TIME desc
+    </select>
+
+    <select id="getSellList" resultType="cc.mrbird.febs.mall.vo.AdminMallProductSellVo">
+        SELECT
+            a.*,
+               b.account_login
+        FROM mall_product_sell a
+        left join mall_member b on a.member_id = b.id
+        <where>
+            <if test="record != null" >
+                <if test="record.accountLogin!=null and record.accountLogin!=''">
+                    and b.account_login like concat('%',  #{record.accountLogin},'%')
+                </if>
+            </if>
+        </where>
+        order by a.CREATED_TIME desc
+    </select>
+
+    <select id="selectProductSellByState" resultType="cc.mrbird.febs.mall.vo.AdminMallProductSellPickVo">
+        SELECT
+            a.id id,
+            CONCAT(b.account_login,'-总数:',a.nft_cnt,'-剩余:',a.nft_cnt_ava) name
+        FROM mall_product_sell a
+        left join mall_member b on a.member_id = b.id
+        where a.state = #{state}
+        and a.nft_cnt_ava > 0
     </select>
 
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/modules/MallProductSellMapper.xml b/src/main/resources/mapper/modules/MallProductSellMapper.xml
new file mode 100644
index 0000000..51ebf42
--- /dev/null
+++ b/src/main/resources/mapper/modules/MallProductSellMapper.xml
@@ -0,0 +1,19 @@
+<?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="cc.mrbird.febs.mall.mapper.MallProductSellMapper">
+
+    <select id="selectListInPage" resultType="cc.mrbird.febs.mall.vo.ApiOrderListVo">
+        select a.id,a.order_no,a.CREATED_TIME,a.nft_total,a.state,1 as type
+        from mall_product_sell a
+        where a.state = 1
+          and a.member_id = #{record.memberId}
+        order by a.CREATED_TIME desc
+    </select>
+
+    <select id="selectSellInfoById" resultType="cc.mrbird.febs.mall.vo.ApiOrderSellInfoVo">
+        select a.*
+        from mall_product_sell a
+        where a.id = #{id}
+    </select>
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/modules/MallProductSellRecordMapper.xml b/src/main/resources/mapper/modules/MallProductSellRecordMapper.xml
new file mode 100644
index 0000000..02cfb1f
--- /dev/null
+++ b/src/main/resources/mapper/modules/MallProductSellRecordMapper.xml
@@ -0,0 +1,22 @@
+<?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="cc.mrbird.febs.mall.mapper.MallProductSellRecordMapper">
+
+    <select id="selectBySellId" resultType="cc.mrbird.febs.mall.vo.ApiOrderSellRecordInfoVo">
+        select a.*,
+               b.account_login,
+               c.wx_qrcode,
+               c.ali_qrcode,
+               c.bank_name,
+               c.phone,
+               c.bank,
+               c.bank_no,
+               c.usdt_tongdao,
+               c.usdt_address
+        from mall_product_sell_record a
+        left join mall_member b on a.member_id = b.id
+        left join mall_member_payment c on a.member_id = c.member_id
+        where a.sell_id = #{productSellId}
+    </select>
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/templates/febs/views/modules/news/productBuyList.html b/src/main/resources/templates/febs/views/modules/news/productBuyList.html
index 8001b1f..b124c77 100644
--- a/src/main/resources/templates/febs/views/modules/news/productBuyList.html
+++ b/src/main/resources/templates/febs/views/modules/news/productBuyList.html
@@ -5,10 +5,21 @@
                 <div class="layui-card-body febs-table-full">
                     <form class="layui-form layui-table-form" lay-filter="user-table-form">
                         <div class="layui-row">
-                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
-                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add">
-                                    新增
+
+                            <div class="layui-col-md10">
+                                <div class="layui-form-item">
+                                    <div class="layui-inline">
+                                        <label class="layui-form-label">登录账户:</label>
+                                        <div class="layui-input-inline">
+                                            <input type="text" placeholder="登录账户" name="accountLogin" autocomplete="off" class="layui-input">
+                                        </div>
+                                    </div>
                                 </div>
+                            </div>
+                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
+<!--                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add">-->
+<!--                                    新增-->
+<!--                                </div>-->
                                 <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
                                     <i class="layui-icon">&#xe848;</i>
                                 </div>
@@ -93,11 +104,11 @@
         table.on('tool(buyTable)', function (obj) {
             var data = obj.data,
                 layEvent = obj.event;
-            if (layEvent === 'productNFTUpdate') {
-                febs.modal.open('编辑', 'modules/news/productNFTUpdate/' + data.id, {
+            if (layEvent === 'productSellPick') {
+                febs.modal.open('编辑', 'modules/news/productSellPick/' + data.id, {
                     btn: ['提交', '取消'],
                     yes: function (index, layero) {
-                        $('#nftInfo-update').find('#submit').trigger('click');
+                        $('#product-sell-pick').find('#submit').trigger('click');
                     },
                     btn2: function () {
                         layer.closeAll();
@@ -151,17 +162,16 @@
                 cols: [[
                     {field: 'accountLogin', title: '登录账户', minWidth: 120,align:'center'},
                     {field: 'nftTotal', title: '预约额度', minWidth: 120,align:'center'},
-                    {field: 'nftAva', title: '已分配', minWidth: 120,align:'center'},
+                    {field: 'nftAva', title: '可分配', minWidth: 120,align:'center'},
                     {field: 'orderTime', title: '匹配时间', minWidth: 120,align:'center'},
                     {templet: '#isBuyState', title: '预约状态', minWidth: 120,align:'center'},
                     {templet: '#isBuyMateState', title: '匹配状态', minWidth: 120,align:'center'},
                     {title: '操作',
                         templet: function (d) {
-                        if(d.state == 1){
-                            return ''
+                        if(d.mateState == 1){
+                            return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="productSellPick" shiro:hasPermission="user:update">手动匹配</button>'
                         }else{
-                            return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="productNFTUpdate" shiro:hasPermission="user:update">编辑</button>'
-                                +'<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delNFT" shiro:hasPermission="user:update">删除</button>'
+                            return ''
                         }
                         },minWidth: 300,align:'center'}
                 ]]
@@ -171,6 +181,7 @@
         // 获取查询参数
         function getQueryParams() {
             return {
+                accountLogin: $searchForm.find('input[name="accountLogin"]').val().trim(),
             };
         }
 
diff --git a/src/main/resources/templates/febs/views/modules/news/productSellList.html b/src/main/resources/templates/febs/views/modules/news/productSellList.html
index e3ad58d..efeedd2 100644
--- a/src/main/resources/templates/febs/views/modules/news/productSellList.html
+++ b/src/main/resources/templates/febs/views/modules/news/productSellList.html
@@ -1,14 +1,24 @@
-<div class="layui-fluid layui-anim febs-anim" id="febs-product-sell" lay-title="NFT提现记录">
+<div class="layui-fluid layui-anim febs-anim" id="febs-product-sell" lay-title="用户NFT提现">
     <div class="layui-row febs-container">
         <div class="layui-col-md12">
             <div class="layui-card">
                 <div class="layui-card-body febs-table-full">
                     <form class="layui-form layui-table-form" lay-filter="user-table-form">
                         <div class="layui-row">
-                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
-                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add">
-                                    新增
+                            <div class="layui-col-md10">
+                                <div class="layui-form-item">
+                                    <div class="layui-inline">
+                                        <label class="layui-form-label">登录账户:</label>
+                                        <div class="layui-input-inline">
+                                            <input type="text" placeholder="登录账户" name="accountLogin" autocomplete="off" class="layui-input">
+                                        </div>
+                                    </div>
                                 </div>
+                            </div>
+                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
+<!--                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="add">-->
+<!--                                    新增-->
+<!--                                </div>-->
                                 <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
                                     <i class="layui-icon">&#xe848;</i>
                                 </div>
@@ -156,6 +166,7 @@
         // 获取查询参数
         function getQueryParams() {
             return {
+                accountLogin: $searchForm.find('input[name="accountLogin"]').val().trim(),
             };
         }
     })
diff --git a/src/main/resources/templates/febs/views/modules/news/productSellPick.html b/src/main/resources/templates/febs/views/modules/news/productSellPick.html
new file mode 100644
index 0000000..80be54c
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/news/productSellPick.html
@@ -0,0 +1,154 @@
+<style>
+    #product-sell-pick {
+        padding: 20px 25px 25px 0;
+    }
+
+    #product-sell-pick .layui-treeSelect .ztree li a, .ztree li span {
+        margin: 0 0 2px 3px !important;
+    }
+    #product-sell-pick #data-permission-tree-block {
+        border: 1px solid #eee;
+        border-radius: 2px;
+        padding: 3px 0;
+    }
+    #product-sell-pick .layui-treeSelect .ztree li span.button.switch {
+        top: 1px;
+        left: 3px;
+    }
+    #product-sell-pick img{
+        max-width:100px
+    }
+
+</style>
+<div class="layui-fluid" id="product-sell-pick">
+    <form class="layui-form" action="" lay-filter="product-sell-pick-form">
+        <div class="layui-form-item febs-hide">
+            <label class="layui-form-label febs-form-item-require">id:</label>
+            <div class="layui-input-block">
+                <input type="text" name="id">
+            </div>
+        </div>
+        <div class="layui-row layui-col-space10 layui-form-item">
+            <div class="layui-col-lg6">
+                <label class="layui-form-label febs-form-item-require">预约额度:</label>
+                <div class="layui-input-block">
+                    <input type="text" name="nftTotal" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" readonly>
+                </div>
+            </div>
+        </div>
+        <div class="layui-row layui-col-space10 layui-form-item">
+            <div class="layui-col-lg6">
+                <label class="layui-form-label febs-form-item-require">可分配:</label>
+                <div class="layui-input-block">
+                    <input type="text" name="nftAva" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" readonly>
+                </div>
+            </div>
+        </div>
+
+        <blockquote class="layui-elem-quote blue-border">匹配设置</blockquote>
+        <div class="layui-row layui-col-space10 layui-form-item">
+            <div class="layui-form-item sell-pick-list">
+                <div class="layui-col-lg6">
+                    <label class="layui-form-label febs-form-item-require">匹配提现:</label>
+                    <div class="layui-input-block">
+                        <div id="sell-pick-list"></div>
+                    </div>
+                </div>
+            </div>
+            <div class="layui-col-lg6">
+                <label class="layui-form-label febs-form-item-require">本次金额:</label>
+                <div class="layui-input-block">
+                    <input type="text" name="pickNftCnt" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
+                </div>
+            </div>
+        </div>
+        <div class="layui-form-item febs-hide">
+            <button class="layui-btn" lay-submit="" lay-filter="product-sell-pick-form-submit" id="submit"></button>
+        </div>
+    </form>
+</div>
+
+<script data-th-inline="javascript">
+    layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','layedit', 'laydate', 'upload', 'xmSelect'], function () {
+        var $ = layui.$,
+            febs = layui.febs,
+            layer = layui.layer,
+            upload = layui.upload,
+            formSelects = layui.formSelects,
+            form = layui.form,
+            laydate = layui.laydate,
+            layedit = layui.layedit,
+            mallProductBuy = [[${mallProductBuy}]],
+            $view = $('#product-sell-pick'),
+            validate = layui.validate;
+
+        var sellPick = xmSelect.render({
+            el: '#sell-pick-list',
+            filterable: true,//设置搜索框
+            filterMethod: function(val, item, index, prop){
+                if(val == item.value){//把value相同的搜索出来
+                    return true;
+                }
+                if(item.name.indexOf(val) != -1){//名称中包含的搜索出来
+                    return true;
+                }
+                return false;//不知道的就不管了
+            },
+            language: 'zn',
+            prop : {
+                value : 'id',
+                children : 'child'
+            },
+            iconfont: {
+                parent: 'hidden',
+            },
+            radio: true,//单选
+            clickClose: true,
+            tree: {
+                show: true,
+                //非严格模式
+                strict: false,
+            },
+            data: []
+        })
+
+        febs.get(ctx + 'admin/news/findSellList', null, function(res) {
+            sellPick.update({
+                data : res.data,
+                autoRow: true,
+            });
+        })
+        initPickValue();
+        form.render();
+        laydate.render({
+            elem: '#febs-form-group-date'
+        });
+
+        formSelects.render();
+        form.on('submit(product-sell-pick-form-submit)', function (data) {
+            let sellPickList = sellPick.getValue();
+            if (sellPickList.length > 0) {
+                var sellPickId = null;
+                layui.each(sellPickList, function (key, item) {
+                    sellPickId = item.id
+                });
+                data.field.productSellId = sellPickId;
+            }
+            febs.post(ctx + 'admin/news/pickSellRecord', data.field, function () {
+                layer.closeAll();
+                febs.alert.success('操作成功');
+                $('#febs-product-buy').find('#reset').click();
+            });
+            return false;
+        });
+
+
+        function initPickValue() {
+            form.val("product-sell-pick-form", {
+                "id": mallProductBuy.id,
+                "nftTotal": mallProductBuy.nftTotal,
+                "nftAva": mallProductBuy.nftAva,
+            });
+        }
+    });
+</script>
\ No newline at end of file

--
Gitblit v1.9.1