From 7d098b8c03c2a3f2dc7b51f73cc8d16b56dfa764 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 18 May 2021 16:44:41 +0800
Subject: [PATCH] 20210518  订单

---
 src/main/resources/mapper/modules/OtcOrderMapper.xml                        |   27 ++++
 src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderEntity.java       |   69 +++++++++++
 src/main/resources/templates/febs/views/modules/otc/otcOrderList.html       |  167 +++++++++++++++++++++++++++
 src/main/java/com/xcong/excoin/modules/otc/controller/OtcController.java    |   10 +
 src/main/java/com/xcong/excoin/modules/otc/controller/ViewController.java   |   10 +
 src/main/java/com/xcong/excoin/modules/otc/mapper/OtcOrderMapper.java       |   14 ++
 src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java |   12 ++
 src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java          |    3 
 8 files changed, 312 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcController.java b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcController.java
index 7b3a7a6..de52620 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/controller/OtcController.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/controller/OtcController.java
@@ -8,6 +8,7 @@
 import com.xcong.excoin.modules.otc.entity.OtcEntrustOrderEntity;
 import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity;
 import com.xcong.excoin.modules.otc.entity.OtcOrderAppealEntity;
+import com.xcong.excoin.modules.otc.entity.OtcOrderEntity;
 import com.xcong.excoin.modules.otc.service.OtcService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.validation.annotation.Validated;
@@ -94,4 +95,13 @@
         return new FebsResponse().success().data(data);
     }
 
+    /**
+     * 订单列表
+     */
+    @GetMapping("otcOrderList")
+    public FebsResponse otcOrderList(OtcOrderEntity otcOrderEntity, QueryRequest request) {
+        Map<String, Object> data = getDataTable(otcService.otcOrderList(otcOrderEntity, request));
+        return new FebsResponse().success().data(data);
+    }
+
 }
diff --git a/src/main/java/com/xcong/excoin/modules/otc/controller/ViewController.java b/src/main/java/com/xcong/excoin/modules/otc/controller/ViewController.java
index a74a309..4fa9d6f 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/controller/ViewController.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/controller/ViewController.java
@@ -24,6 +24,7 @@
     public String otcShopList() {
         return FebsUtil.view("modules/otc/otcShopList");
     }
+
     /**
      * 获取委托单列表
      */
@@ -34,6 +35,15 @@
     }
 
     /**
+     * 获取订单列表
+     */
+    @GetMapping("otcOrderList")
+    @RequiresPermissions("otcOrderList:view")
+    public String otcOrderList() {
+        return FebsUtil.view("modules/otc/otcOrderList");
+    }
+
+    /**
      * 获取申诉列表
      */
     @GetMapping("otcAppealList")
diff --git a/src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderEntity.java b/src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderEntity.java
new file mode 100644
index 0000000..f2acbfe
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderEntity.java
@@ -0,0 +1,69 @@
+package com.xcong.excoin.modules.otc.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.xcong.excoin.common.entity.BaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+//交易订单
+@Data
+@TableName("otc_order")
+public class OtcOrderEntity extends BaseEntity {
+
+    //会员ID
+    private long memberId;
+
+    //订单编号
+    private String orderNo;
+
+    //单价
+    private BigDecimal unitPrice;
+
+    //交易数量
+    private BigDecimal coinAmount;
+
+    //交易总额
+    private BigDecimal totalAmount;
+
+    //订单状态 1-已提交未付款2-已付款3-已完成4-已取消
+    private Integer status;
+    public static final Integer STATUS_ONE = 1;
+    public static final Integer STATUS_TWO = 2;
+    public static final Integer STATUS_THREE = 3;
+    public static final Integer STATUS_FOUR = 4;
+
+    //付款时间
+    private Date payTime;
+
+    //完成时间
+    private Date finishTime;
+
+    //委托单ID
+    private long entrustOrderId;
+
+    //市商ID
+    private long mdId;
+
+    //支付市商ID
+    private long payMdId;
+
+    @TableField(exist = false)
+    private String account;
+
+    @TableField(exist = false)
+    private String phone;
+
+    @TableField(exist = false)
+    private String inviteId;
+
+    @TableField(exist = false)
+    private String realName;
+
+    @TableField(exist = false)
+    private String nickname;
+
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/otc/mapper/OtcOrderMapper.java b/src/main/java/com/xcong/excoin/modules/otc/mapper/OtcOrderMapper.java
new file mode 100644
index 0000000..d91bbb4
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/otc/mapper/OtcOrderMapper.java
@@ -0,0 +1,14 @@
+package com.xcong.excoin.modules.otc.mapper;
+
+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.otc.entity.OtcOrderEntity;
+import org.apache.ibatis.annotations.Param;
+
+public interface OtcOrderMapper extends BaseMapper<OtcOrderEntity> {
+
+    IPage<OtcOrderEntity> otcOrderList(Page<OtcOrderEntity> page,
+                                       @Param("record")OtcOrderEntity otcOrderEntity);
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java b/src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java
index e1fafce..84c3f68 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java
@@ -7,6 +7,7 @@
 import com.xcong.excoin.modules.otc.entity.OtcEntrustOrderEntity;
 import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity;
 import com.xcong.excoin.modules.otc.entity.OtcOrderAppealEntity;
+import com.xcong.excoin.modules.otc.entity.OtcOrderEntity;
 
 public interface OtcService extends IService<OtcMarketBussinessEntity> {
 
@@ -23,4 +24,6 @@
     FebsResponse dealIng(Long id);
 
     IPage<OtcEntrustOrderEntity> otcEntrustList(OtcEntrustOrderEntity otcEntrustOrderEntity, QueryRequest request);
+
+    IPage<OtcOrderEntity> otcOrderList(OtcOrderEntity otcOrderEntity, QueryRequest request);
 }
diff --git a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java
index 48f0e33..ae69ac7 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java
@@ -11,9 +11,11 @@
 import com.xcong.excoin.modules.otc.entity.OtcEntrustOrderEntity;
 import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity;
 import com.xcong.excoin.modules.otc.entity.OtcOrderAppealEntity;
+import com.xcong.excoin.modules.otc.entity.OtcOrderEntity;
 import com.xcong.excoin.modules.otc.mapper.OtcEntrustOrderMapper;
 import com.xcong.excoin.modules.otc.mapper.OtcMarketBussinessMapper;
 import com.xcong.excoin.modules.otc.mapper.OtcOrderAppealMapper;
+import com.xcong.excoin.modules.otc.mapper.OtcOrderMapper;
 import com.xcong.excoin.modules.otc.service.OtcService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
@@ -31,6 +33,8 @@
     private OtcOrderAppealMapper otcOrderAppealMapper;
     @Resource
     private OtcEntrustOrderMapper otcEntrustOrderMapper;
+    @Resource
+    private OtcOrderMapper otcOrderMapper;
     @Resource
     private MemberMapper memberMapper;
 
@@ -99,6 +103,7 @@
     }
 
     @Override
+    @Transactional
     public FebsResponse dealIng(Long id) {
         OtcOrderAppealEntity otcOrderAppealEntity = otcOrderAppealMapper.selectById(id);
         Integer status = otcOrderAppealEntity.getStatus();
@@ -118,4 +123,11 @@
         return otcEntrustOrderEntitys;
     }
 
+    @Override
+    public IPage<OtcOrderEntity> otcOrderList(OtcOrderEntity otcOrderEntity, QueryRequest request) {
+        Page<OtcOrderEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
+        IPage<OtcOrderEntity> otcOrderEntitys = otcOrderMapper.otcOrderList(page, otcOrderEntity);
+        return otcOrderEntitys;
+    }
+
 }
diff --git a/src/main/resources/mapper/modules/OtcOrderMapper.xml b/src/main/resources/mapper/modules/OtcOrderMapper.xml
new file mode 100644
index 0000000..ee4104e
--- /dev/null
+++ b/src/main/resources/mapper/modules/OtcOrderMapper.xml
@@ -0,0 +1,27 @@
+<?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="com.xcong.excoin.modules.otc.mapper.OtcOrderMapper">
+
+    <select id="otcOrderList" resultType="com.xcong.excoin.modules.otc.entity.OtcOrderEntity">
+        SELECT
+        *,
+        concat(b.first_name,b.second_name) realName
+        FROM
+        otc_order a
+        LEFT JOIN member m ON m.id = a.member_id
+        LEFT JOIN member_authentication b ON b.member_id = a.member_id
+        LEFT JOIN otc_market_bussiness c ON c.id = a.pay_md_id
+        <where>
+            <if test="record != null" >
+                <if test="record.account!=null and record.account!=''">
+                    and (m.phone = #{record.account} or m.email = #{record.account} or m.invite_id=#{record.account})
+                </if>
+                <if test="record.status!=null and record.status!=''">
+                    and a.status= #{record.status}
+                </if>
+            </if>
+        </where>
+        order by m.create_time desc
+    </select>
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/templates/febs/views/modules/otc/otcOrderList.html b/src/main/resources/templates/febs/views/modules/otc/otcOrderList.html
new file mode 100644
index 0000000..5bd5136
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/otc/otcOrderList.html
@@ -0,0 +1,167 @@
+<div class="layui-fluid layui-anim febs-anim" id="febs-user" lay-title="订单">
+    <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-md10">
+                                <div class="layui-form-item">
+                                    <div class="layui-inline">
+                                        <div class="layui-input-inline">
+                                            <input type="text" placeholder="手机号/邀请码" name="account" autocomplete="off" class="layui-input">
+                                        </div>
+                                    </div>
+                                    <div class="layui-inline">
+                                        <label class="layui-form-label layui-form-label-sm">类型</label>
+                                        <div class="layui-input-inline">
+                                            <select name="status">
+                                                <option value="">请选择</option>
+                                                <option value="1">未付款</option>
+                                                <option value="2">已付款</option>
+                                                <option value="3">已完成</option>
+                                                <option value="4">已取消</option>
+                                            </select>
+                                        </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-blue-plain table-action" id="query">
+                                    <i class="layui-icon">&#xe848;</i>
+                                </div>
+                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
+                                    <i class="layui-icon">&#xe79b;</i>
+                                </div>
+                            </div>
+                        </div>
+                    </form>
+                    <table lay-filter="userTable" lay-data="{id: 'userTable'}"></table>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<!-- 表格操作栏 start -->
+<script type="text/html" id="user-option">
+    <span shiro:lacksPermission="user:view,user:update,user:delete">
+        <span class="layui-badge-dot febs-bg-orange"></span> 无权限
+    </span>
+    <a lay-event="edit" shiro:hasPermission="user:update"><i
+            class="layui-icon febs-edit-area febs-blue">&#xe7a5;</i></a>
+</script>
+<!-- 表格操作栏 end -->
+<script data-th-inline="none" type="text/javascript">
+    // 引入组件并初始化
+    layui.use([ 'jquery', 'form', 'table', 'febs'], function () {
+        var $ = layui.jquery,
+            febs = layui.febs,
+            form = layui.form,
+            table = layui.table,
+            $view = $('#febs-user'),
+            $query = $view.find('#query'),
+            $reset = $view.find('#reset'),
+            $searchForm = $view.find('form'),
+            sortObject = {field: 'phone', type: null},
+            tableIns;
+
+        form.render();
+
+        // 表格初始化
+        initTable();
+
+        // 初始化表格操作栏各个按钮功能
+        table.on('tool(userTable)', function (obj) {
+            var data = obj.data,
+                layEvent = obj.event;
+            if (layEvent === 'dealIng') {
+                febs.modal.confirm('处理', '开始处理申诉?', function () {
+                    dealIng(data.id);
+                });
+            }
+            if (layEvent === 'dealDone') {
+                febs.modal.confirm('处理结束', '确认已处理结束?', function () {
+                    dealDone(data.id);
+                });
+            }
+        });
+        function dealIng(id) {
+            febs.get(ctx + 'otc/dealIng/' + id, null, function () {
+                febs.alert.success('成功');
+                $query.click();
+            });
+        }
+        function dealDone(id) {
+            febs.get(ctx + 'otc/dealDone/' + id, null, function () {
+                febs.alert.success('成功');
+                $query.click();
+            });
+        }
+
+
+        // 查询按钮
+        $query.on('click', function () {
+            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
+            tableIns.reload({where: params, page: {curr: 1}});
+        });
+
+        // 刷新按钮
+        $reset.on('click', function () {
+            $searchForm[0].reset();
+            sortObject.type = 'null';
+            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
+        });
+
+        function initTable() {
+            tableIns = febs.table.init({
+                elem: $view.find('table'),
+                id: 'userTable',
+                url: ctx + 'otc/otcOrderList',
+                cols: [[
+                    {field: 'phone', title: '手机号', minWidth: 150,align:'left'},
+                    {field: 'realName', title: '姓名', minWidth: 100,align:'left'},
+                    {field: 'inviteId', title: '邀请码', minWidth: 80,align:'center'},
+                    {field: 'order_no', title: '订单编号', minWidth: 80,align:'center'},
+                    {field: 'unitPrice', title: '单价',minWidth: 100,align:'center'},
+                    {field: 'coinAmount', title: '数量',minWidth: 100,align:'center'},
+                    {field: 'totalAmount', title: '委托总金额',minWidth: 100,align:'center'},
+                    {field: 'status', title: '订单状态',
+                        templet: function (d) {
+                            if (d.status === 1) {
+                                return '<span style="color:red;">未付款</span>'
+                            } else if (d.status === 2) {
+                                return '<span style="color:blue;">已付款</span>'
+                            }else if (d.status === 3) {
+                                return '<span style="color:green;">已完成</span>'
+                            } else if (d.status === 4) {
+                                return '<span>已取消</span>'
+                            }  else{
+                                return ''
+                            }
+                        }, minWidth: 80,align:'center'},
+                    {field: 'nickname', title: '商家昵称',minWidth: 100,align:'center'},
+                    {field: 'payTime', title: '付款时间',minWidth: 100,align:'center'},
+                    {field: 'finishTime', title: '完成时间',minWidth: 100,align:'center'},
+                    // {title: '操作',templet: function (d) {
+                    //         if(d.status === 1){
+                    //             return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="dealIng" shiro:hasPermission="user:update">马上处理</button>'
+                    //         }else if(d.status === 2){
+                    //             return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="dealDone" shiro:hasPermission="user:update">已处理</button>'
+                    //         }else{
+                    //             return ''
+                    //         }
+                    //     },minWidth: 200,align:'center'}
+                ]]
+            });
+        }
+
+        // 获取查询参数
+        function getQueryParams() {
+            return {
+                account: $searchForm.find('input[name="account"]').val().trim(),
+                status: $searchForm.find("select[name='status']").val(),
+            };
+        }
+
+    })
+</script>
\ No newline at end of file

--
Gitblit v1.9.1