From 6c2e9ba62c418185361179e7014862c481f34e17 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 09 Mar 2022 14:22:09 +0800
Subject: [PATCH] conflect merge

---
 src/main/java/com/xcong/excoin/modules/otc/controller/OtcEntrustOrderController.java |  122 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 122 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcEntrustOrderController.java b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcEntrustOrderController.java
new file mode 100644
index 0000000..324e1ba
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcEntrustOrderController.java
@@ -0,0 +1,122 @@
+package com.xcong.excoin.modules.otc.controller;
+
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.xcong.excoin.common.LoginUserUtils;
+import com.xcong.excoin.common.response.Result;
+import com.xcong.excoin.modules.member.entity.MemberEntity;
+import com.xcong.excoin.modules.otc.dao.OtcSettingDao;
+import com.xcong.excoin.modules.otc.dto.EntrustOrderAddDto;
+import com.xcong.excoin.modules.otc.dto.EntrustOrderListDto;
+import com.xcong.excoin.modules.otc.entity.OtcEntrustOrder;
+import com.xcong.excoin.modules.otc.entity.OtcSetting;
+import com.xcong.excoin.modules.otc.service.OtcEntrustOrderService;
+import com.xcong.excoin.modules.otc.vo.EntrustListInfoVo;
+import com.xcong.excoin.modules.otc.vo.EntrustListVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.web3j.abi.datatypes.Int;
+
+import javax.validation.Valid;
+
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping(value = "/api/otcOrder")
+@Validated
+@Api(value = "OtcEntrustOrderController", tags = "otc委托订单接口类")
+public class OtcEntrustOrderController {
+
+    private final OtcEntrustOrderService otcEntrustOrderService;
+    private final OtcSettingDao otcSettingDao;
+
+    @ApiOperation(value = "添加otc委托单", notes = "添加otc委托单")
+    @PostMapping(value = "/addEntrustOrder")
+    public Result addEntrustOrder(@RequestBody EntrustOrderAddDto addDto) {
+        otcEntrustOrderService.add(addDto);
+        return Result.ok("添加成功");
+    }
+
+    @ApiOperation(value = "获取市商条件")
+    @ApiResponses({
+            @ApiResponse(code  = 200, message = "success", response = OtcSetting.class)
+    })
+    @GetMapping(value = "/findCondition")
+    public Result findCondition() {
+        OtcSetting setting = otcSettingDao.selectById(1L);
+        return Result.ok(setting);
+    }
+
+    @ApiOperation(value = "编辑otc委托单", notes = "编辑otc委托单")
+    @PostMapping(value = "/modifyEntrustOrder")
+    public Result modifyEntrustOrder(@RequestBody EntrustOrderAddDto modifyDto) {
+        otcEntrustOrderService.modify(modifyDto);
+        return Result.ok("编辑成功");
+    }
+
+    @ApiOperation(value = "获取otc委托单列表", notes = "获取otc委托单列表")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "success", response = EntrustListVo.class)
+    })
+    @PostMapping(value = "/findEntrustOrderList")
+    public Result findEntrustOrderList(@RequestBody EntrustOrderListDto orderListDto) {
+        IPage<EntrustListVo> result = this.otcEntrustOrderService.findEntrustListInPage(orderListDto);
+        return Result.ok(result.getRecords());
+    }
+
+    @ApiOperation(value = "获取我的委托单列表", notes = "获取我的委托单列表")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "success", response = EntrustListInfoVo.class)
+    })
+    @PostMapping(value = "/findOwnEntrustOrderList")
+    public Result findOwnEntrustOrderList(@RequestBody EntrustOrderListDto orderListDto) {
+        return Result.ok(otcEntrustOrderService.findOwnEntrustOrder(orderListDto));
+    }
+
+    @ApiOperation(value = "获取我的委托单详情")
+    @GetMapping(value = "/findOwnOrderDetail/{id}")
+    public Result findOwnOrderDetail(@PathVariable("id") Long id) {
+        return otcEntrustOrderService.findEntrustOrderDetail(id);
+    }
+
+    @ApiOperation(value = "上/下线接口")
+    @PostMapping(value = "/upOrDownList/{id}")
+    public Result upOrDownList(@PathVariable("id") Long id) {
+        MemberEntity member = LoginUserUtils.getAppLoginUser();
+        OtcEntrustOrder otcEntrustOrder = this.otcEntrustOrderService.getById(id);
+        if (otcEntrustOrder == null) {
+            return Result.fail("数据不存在");
+        }
+
+        if (!member.getId().equals(otcEntrustOrder.getMemberId())) {
+            return Result.fail("数据错误");
+        }
+
+        Integer status = otcEntrustOrder.getStatus();
+        otcEntrustOrder = new OtcEntrustOrder();
+        otcEntrustOrder.setId(id);
+        if (status.equals(OtcEntrustOrder.LINE_DOWN)) {
+            otcEntrustOrder.setStatus(OtcEntrustOrder.LINE_UP);
+        } else {
+            otcEntrustOrder.setStatus(OtcEntrustOrder.LINE_DOWN);
+        }
+
+        this.otcEntrustOrderService.updateById(otcEntrustOrder);
+        return Result.ok("修改成功");
+    }
+
+    @ApiOperation(value = "撤销委托单")
+    @PostMapping(value = "/cancelOrder/{id}")
+    public Result cancelOrder(@PathVariable("id") Long id) {
+        this.otcEntrustOrderService.cancelEntrustOrder(id);
+        return Result.ok("撤销成功");
+    }
+
+}

--
Gitblit v1.9.1