From 99335c9291eeae811531835da3766356a5aa733c Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 18 May 2021 16:26:47 +0800
Subject: [PATCH] 20210518 委托单
---
src/main/java/com/xcong/excoin/modules/otc/entity/OtcEntrustOrderEntity.java | 67 +++++++++++
src/main/java/com/xcong/excoin/modules/otc/controller/OtcController.java | 10 +
src/main/resources/mapper/modules/OtcEntrustOrderMapper.xml | 27 ++++
src/main/resources/templates/febs/views/modules/otc/otcEntrustList.html | 182 ++++++++++++++++++++++++++++++
src/main/java/com/xcong/excoin/modules/otc/mapper/OtcEntrustOrderMapper.java | 14 ++
src/main/java/com/xcong/excoin/modules/otc/controller/ViewController.java | 10 +
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java | 11 +
src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java | 3
8 files changed, 323 insertions(+), 1 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 57dbe5d..7b3a7a6 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
@@ -5,6 +5,7 @@
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
import com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity;
+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.service.OtcService;
@@ -84,4 +85,13 @@
return otcService.dealDone(id);
}
+ /**
+ * 委托单列表
+ */
+ @GetMapping("otcEntrustList")
+ public FebsResponse otcEntrustList(OtcEntrustOrderEntity otcEntrustOrderEntity, QueryRequest request) {
+ Map<String, Object> data = getDataTable(otcService.otcEntrustList(otcEntrustOrderEntity, 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 0b8ffcc..a74a309 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,9 +24,17 @@
public String otcShopList() {
return FebsUtil.view("modules/otc/otcShopList");
}
+ /**
+ * 获取委托单列表
+ */
+ @GetMapping("otcEntrustList")
+ @RequiresPermissions("otcEntrustList:view")
+ public String otcEntrustList() {
+ return FebsUtil.view("modules/otc/otcEntrustList");
+ }
/**
- * 获取商户审核列表
+ * 获取申诉列表
*/
@GetMapping("otcAppealList")
@RequiresPermissions("otcAppealList:view")
diff --git a/src/main/java/com/xcong/excoin/modules/otc/entity/OtcEntrustOrderEntity.java b/src/main/java/com/xcong/excoin/modules/otc/entity/OtcEntrustOrderEntity.java
new file mode 100644
index 0000000..ac311d7
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/otc/entity/OtcEntrustOrderEntity.java
@@ -0,0 +1,67 @@
+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;
+
+//otc委托单
+@Data
+@TableName("otc_entrust_order")
+public class OtcEntrustOrderEntity extends BaseEntity {
+
+ //会员ID
+ private long memberId;
+
+ //市商ID
+ private long mbId;
+
+ //单价
+ private BigDecimal unitPrice;
+
+ //数量
+ private BigDecimal coinAmount;
+
+ //剩余数量
+ private BigDecimal remainCoinAmount;
+
+ //最小限额
+ private BigDecimal limitMinAmount;
+
+ //最大限额
+ private BigDecimal limitMaxAmount;
+
+ //委托单类型 B-买S-卖
+ private String orderType;
+ public static final String ORDERTYPE_B = "B";
+ public static final String ORDERTYPE_S = "S";
+
+ //上下线 1-上线2-下线
+ private Integer status;
+ public static final Integer STATUS_ONE = 1;
+ public static final Integer STATUS_TWO = 2;
+
+ //是否市商 1-是 2-否
+ private Integer isMb;
+
+ //委托总金额
+ private BigDecimal totalAmount;
+
+ @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/OtcEntrustOrderMapper.java b/src/main/java/com/xcong/excoin/modules/otc/mapper/OtcEntrustOrderMapper.java
new file mode 100644
index 0000000..409540e
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/otc/mapper/OtcEntrustOrderMapper.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.OtcEntrustOrderEntity;
+import org.apache.ibatis.annotations.Param;
+
+public interface OtcEntrustOrderMapper extends BaseMapper<OtcEntrustOrderEntity> {
+
+ IPage<OtcEntrustOrderEntity> otcEntrustList(Page<OtcEntrustOrderEntity> page,
+ @Param("record")OtcEntrustOrderEntity otcEntrustOrderEntity);
+
+}
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 463f996..e1fafce 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
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
+import com.xcong.excoin.modules.otc.entity.OtcEntrustOrderEntity;
import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity;
import com.xcong.excoin.modules.otc.entity.OtcOrderAppealEntity;
@@ -20,4 +21,6 @@
FebsResponse dealDone(Long id);
FebsResponse dealIng(Long id);
+
+ IPage<OtcEntrustOrderEntity> otcEntrustList(OtcEntrustOrderEntity otcEntrustOrderEntity, 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 c38d754..48f0e33 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
@@ -8,8 +8,10 @@
import com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity;
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.member.mapper.MemberMapper;
+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.mapper.OtcEntrustOrderMapper;
import com.xcong.excoin.modules.otc.mapper.OtcMarketBussinessMapper;
import com.xcong.excoin.modules.otc.mapper.OtcOrderAppealMapper;
import com.xcong.excoin.modules.otc.service.OtcService;
@@ -27,6 +29,8 @@
private OtcMarketBussinessMapper otcMarketBussinessMapper;
@Resource
private OtcOrderAppealMapper otcOrderAppealMapper;
+ @Resource
+ private OtcEntrustOrderMapper otcEntrustOrderMapper;
@Resource
private MemberMapper memberMapper;
@@ -107,4 +111,11 @@
return new FebsResponse().success();
}
+ @Override
+ public IPage<OtcEntrustOrderEntity> otcEntrustList(OtcEntrustOrderEntity otcEntrustOrderEntity, QueryRequest request) {
+ Page<OtcEntrustOrderEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
+ IPage<OtcEntrustOrderEntity> otcEntrustOrderEntitys = otcEntrustOrderMapper.otcEntrustList(page, otcEntrustOrderEntity);
+ return otcEntrustOrderEntitys;
+ }
+
}
diff --git a/src/main/resources/mapper/modules/OtcEntrustOrderMapper.xml b/src/main/resources/mapper/modules/OtcEntrustOrderMapper.xml
new file mode 100644
index 0000000..077808c
--- /dev/null
+++ b/src/main/resources/mapper/modules/OtcEntrustOrderMapper.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.OtcEntrustOrderMapper">
+
+ <select id="otcEntrustList" resultType="com.xcong.excoin.modules.otc.entity.OtcEntrustOrderEntity">
+ SELECT
+ *,
+ concat(b.first_name,b.second_name) realName
+ FROM
+ otc_entrust_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.mb_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.orderType!=null and record.orderType!=''">
+ and a.order_type= #{record.orderType}
+ </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/otcEntrustList.html b/src/main/resources/templates/febs/views/modules/otc/otcEntrustList.html
new file mode 100644
index 0000000..3dc942e
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/otc/otcEntrustList.html
@@ -0,0 +1,182 @@
+<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="orderType">
+ <option value="">请选择</option>
+ <option value="B">买入</option>
+ <option value="S">卖出</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"></i>
+ </div>
+ <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
+ <i class="layui-icon"></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"></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/otcEntrustList',
+ cols: [[
+ {field: 'phone', title: '手机号', minWidth: 150,align:'left'},
+ {field: 'realName', title: '姓名', minWidth: 100,align:'left'},
+ {field: 'inviteId', title: '邀请码', minWidth: 80,align:'center'},
+ {field: 'orderType', title: '类型',
+ templet: function (d) {
+ if (d.orderType === 'B') {
+ return '<span style="color:blue;">买入</span>'
+ } else if (d.orderType === 'S') {
+ return '<span style="color:green;">卖出</span>'
+ } else{
+ return ''
+ }
+ }, 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: 'nikename', title: '商户昵称',minWidth: 100,align:'center'},
+ {field: 'remainCoinAmount', title: '剩余数量',minWidth: 100,align:'center'},
+ {field: 'limitMinAmount', title: '最小限额',minWidth: 100,align:'center'},
+ {field: 'limitMaxAmount', title: '最大限额',minWidth: 100,align:'center'},
+ {field: 'status', title: '类型',
+ templet: function (d) {
+ if (d.status === 1) {
+ return '<span style="color:blue;">上线</span>'
+ } else if (d.status === 2) {
+ return '<span style="color:green;">下线</span>'
+ } else{
+ return ''
+ }
+ }, minWidth: 80,align:'center'},
+
+ {field: 'isMb', title: '是否市商',
+ templet: function (d) {
+ if (d.isMb === 1) {
+ return '<span style="color:blue;">是</span>'
+ } else if (d.isMb === 2) {
+ return '<span style="color:green;">否</span>'
+ } else{
+ return ''
+ }
+ }, minWidth: 80,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(),
+ orderType: $searchForm.find("select[name='orderType']").val(),
+ };
+ }
+
+ })
+</script>
\ No newline at end of file
--
Gitblit v1.9.1