From be56dcfa574c8c26b70c7be939bf563bbeef3ad8 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 25 May 2021 14:42:48 +0800
Subject: [PATCH] 20210525  申诉

---
 src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java |   33 ++++++++++++++++
 src/main/java/com/xcong/excoin/modules/otc/controller/OtcOrderController.java    |    7 +++
 src/main/java/com/xcong/excoin/modules/otc/service/OtcOrderService.java          |    3 +
 src/main/java/com/xcong/excoin/modules/otc/dto/OrderApealDto.java                |   26 +++++++++++++
 src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderAppeal.java            |    6 +++
 5 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcOrderController.java b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcOrderController.java
index 15c1179..cec320b 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcOrderController.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcOrderController.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.xcong.excoin.common.response.Result;
 import com.xcong.excoin.modules.otc.dto.HasPayDto;
+import com.xcong.excoin.modules.otc.dto.OrderApealDto;
 import com.xcong.excoin.modules.otc.dto.OrderListDto;
 import com.xcong.excoin.modules.otc.dto.OtcOrderAddDto;
 import com.xcong.excoin.modules.otc.service.OtcOrderService;
@@ -90,4 +91,10 @@
         otcOrderService.cancelOrder(id);
         return Result.ok("操作成功");
     }
+
+    @ApiOperation(value = "申诉")
+    @PostMapping(value = "/orderApeal")
+    public Result orderApeal(@RequestBody OrderApealDto orderApealDto) {
+        return otcOrderService.orderApeal(orderApealDto);
+    }
 }
diff --git a/src/main/java/com/xcong/excoin/modules/otc/dto/OrderApealDto.java b/src/main/java/com/xcong/excoin/modules/otc/dto/OrderApealDto.java
new file mode 100644
index 0000000..c936f05
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/otc/dto/OrderApealDto.java
@@ -0,0 +1,26 @@
+package com.xcong.excoin.modules.otc.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "OrderApealDto", description = "参数接收类")
+public class OrderApealDto {
+
+    @ApiModelProperty(value = "订单ID", example = "1")
+    private Long orderId;
+
+    /**
+     * 申诉原因
+     */
+    @ApiModelProperty(value = "申诉原因", example = "1")
+    private String reason;
+
+    /**
+     * 申诉内容
+     */
+    @ApiModelProperty(value = "申诉内容", example = "1")
+    private String content;
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderAppeal.java b/src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderAppeal.java
index fc5ec0d..5ce16d1 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderAppeal.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderAppeal.java
@@ -22,4 +22,10 @@
      * 申诉内容
      */
     private String content;
+
+    //申诉状态  1:待处理 2:处理中 3:已处理
+    private Integer status;
+    public static final Integer STATUS_ONE = 1;
+    public static final Integer STATUS_TWO = 2;
+    public static final Integer STATUS_THREE = 3;
 }
diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/OtcOrderService.java b/src/main/java/com/xcong/excoin/modules/otc/service/OtcOrderService.java
index 813a90d..2f77b52 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/service/OtcOrderService.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/service/OtcOrderService.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.xcong.excoin.common.response.Result;
 import com.xcong.excoin.modules.otc.dto.HasPayDto;
+import com.xcong.excoin.modules.otc.dto.OrderApealDto;
 import com.xcong.excoin.modules.otc.dto.OrderListDto;
 import com.xcong.excoin.modules.otc.dto.OtcOrderAddDto;
 import com.xcong.excoin.modules.otc.entity.OtcOrder;
@@ -26,4 +27,6 @@
     Result findSaleOrderDetail(Long id);
 
     void cancelOrder(Long id);
+
+    Result orderApeal(OrderApealDto orderApealDto);
 }
diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
index 063802d..c422f84 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcOrderServiceImpl.java
@@ -3,6 +3,7 @@
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.crypto.SecureUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -20,13 +21,16 @@
 import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
 import com.xcong.excoin.modules.otc.dao.OtcEntrustOrderDao;
 import com.xcong.excoin.modules.otc.dao.OtcMarketBussinessDao;
+import com.xcong.excoin.modules.otc.dao.OtcOrderAppealDao;
 import com.xcong.excoin.modules.otc.dto.HasPayDto;
+import com.xcong.excoin.modules.otc.dto.OrderApealDto;
 import com.xcong.excoin.modules.otc.dto.OrderListDto;
 import com.xcong.excoin.modules.otc.dto.OtcOrderAddDto;
 import com.xcong.excoin.modules.otc.entity.OtcEntrustOrder;
 import com.xcong.excoin.modules.otc.entity.OtcMarketBussiness;
 import com.xcong.excoin.modules.otc.entity.OtcOrder;
 import com.xcong.excoin.modules.otc.dao.OtcOrderDao;
+import com.xcong.excoin.modules.otc.entity.OtcOrderAppeal;
 import com.xcong.excoin.modules.otc.service.OtcOrderService;
 import com.xcong.excoin.modules.otc.vo.BuyOrderDetailVo;
 import com.xcong.excoin.modules.otc.vo.OrderListVo;
@@ -48,6 +52,7 @@
 
     private final OtcMarketBussinessDao otcMarketBussinessDao;
     private final OtcEntrustOrderDao otcEntrustOrderDao;
+    private final OtcOrderAppealDao otcOrderAppealDao;
     private final CommonService commonService;
     private final MemberWalletCoinDao memberWalletCoinDao;
     private final MemberDao memberDao;
@@ -396,4 +401,32 @@
         otcEntrustOrderDao.updateRemainAmount(otcOrder.getEntrustOrderId(), otcOrder.getCoinAmount());
         this.baseMapper.updateOrderStatusByOrderNo(OtcOrder.STATUS_CANCEL, null, otcOrder.getOrderNo());
     }
+
+    @Override
+    public Result orderApeal(OrderApealDto orderApealDto) {
+        MemberEntity member = LoginUserUtils.getAppLoginUser();
+        Long memberId = member.getId();
+//        long memberId = 446L;
+        Long orderId = orderApealDto.getOrderId();
+        OtcOrder otcOrder = this.baseMapper.selectById(orderId);
+        if(ObjectUtil.isEmpty(otcOrder)){
+            return Result.fail("订单不存在");
+        }
+        String reason = orderApealDto.getReason();
+        if(StrUtil.isEmpty(reason)){
+            return Result.fail("请填写申诉原因");
+        }
+        String content = orderApealDto.getContent();
+        if(StrUtil.isEmpty(content)){
+            return Result.fail("请填写申诉内容");
+        }
+        OtcOrderAppeal otcOrderAppeal = new OtcOrderAppeal();
+        otcOrderAppeal.setMemberId(memberId);
+        otcOrderAppeal.setOrderId(orderId);
+        otcOrderAppeal.setReason(reason);
+        otcOrderAppeal.setContent(content);
+        otcOrderAppeal.setStatus(OtcOrderAppeal.STATUS_ONE);
+        otcOrderAppealDao.insert(otcOrderAppeal);
+        return Result.ok("成功");
+    }
 }

--
Gitblit v1.9.1