From 0830a387f0c28c2d448714ad184fd0c17bf27ea9 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 25 May 2021 10:30:50 +0800
Subject: [PATCH] 20210525 回款

---
 src/main/java/com/xcong/excoin/modules/otc/entity/OtcMarketBussinessEntity.java   |   11 ++
 src/main/resources/templates/febs/views/modules/otc/otcOrderList.html             |    4 
 src/main/resources/templates/febs/views/modules/otc/otcShopList.html              |   58 +++++++----
 src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java |    4 
 src/main/java/com/xcong/excoin/modules/otc/controller/OtcController.java          |   10 ++
 src/main/resources/templates/febs/views/modules/otc/otcHuiKuan.html               |   93 ++++++++++++++++++
 src/main/java/com/xcong/excoin/modules/otc/controller/ViewController.java         |   12 ++
 src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java       |   37 +++++++
 src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java                |    4 
 src/main/resources/templates/febs/views/modules/member/allData/allDataInfo.html   |   38 +++---
 10 files changed, 226 insertions(+), 45 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
index e70ba1f..8032a52 100644
--- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -2235,14 +2235,14 @@
 	@Override
 	public IPage<MemberDataInfoVo> findAllDataInfoListInPage(MemberEntity memberEntity, QueryRequest request) {
 		String account = memberEntity.getAccount();
-		String isTest = memberEntity.getIsTest();
+//		String isTest = memberEntity.getIsTest();
 		//如果account为空,查询全部,account不为空查询对应的memberEntity
 		if(StrUtil.isNotEmpty(account)) {
 			memberEntity = memberMapper.selectMemberByAccount(account);
 		}else {
 			memberEntity = memberMapper.selectMemberByAccount(MemberEntity.SYSTEM_REFERER);
 		}
-		memberEntity.setIsTest(isTest);
+//		memberEntity.setIsTest("");
 		Page<MemberEntity> page = new Page<>(request.getPageNum(), request.getPageSize());
 		IPage<MemberDataInfoVo> selectMemberListInPage = memberMapper.findMemberDataInfoOneAllRealInPage(page, memberEntity);
 		//USDT充币总额+USDT提币总额
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 243ed27..7892228 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
@@ -113,4 +113,14 @@
         return otcService.updateOrderInfo(otcOrderEntity);
     }
 
+    /**
+     *回款
+     * @return
+     */
+    @PostMapping("otcHuiKuan")
+    @ControllerEndpoint(operation = "订单列表---付款人", exceptionMessage = "失败")
+    public FebsResponse otcHuiKuan(@Valid OtcMarketBussinessEntity otcMarketBussinessEntity) {
+        return otcService.otcHuiKuan(otcMarketBussinessEntity);
+    }
+
 }
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 7074b12..2f63c3d 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
@@ -3,6 +3,7 @@
 import com.xcong.excoin.common.entity.FebsConstant;
 import com.xcong.excoin.common.utils.FebsUtil;
 import com.xcong.excoin.modules.member.vo.MemberAuthenticationVo;
+import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity;
 import com.xcong.excoin.modules.otc.entity.OtcOrderEntity;
 import com.xcong.excoin.modules.otc.service.OtcService;
 import com.xcong.excoin.modules.otc.vo.OtcAppealInfoVo;
@@ -79,4 +80,15 @@
         return FebsUtil.view("modules/otc/otcAppealInfo");
     }
 
+    /**
+     * 商户回款
+     */
+    @GetMapping("otcHuiKuan/{id}")
+    @RequiresPermissions("otcHuiKuan:update")
+    public String otcHuiKuan(@PathVariable long id, Model model) {
+        OtcMarketBussinessEntity data = otcService.otcHuiKuan(id);
+        model.addAttribute("member", data);
+        return FebsUtil.view("modules/otc/otcHuiKuan");
+    }
+
 }
diff --git a/src/main/java/com/xcong/excoin/modules/otc/entity/OtcMarketBussinessEntity.java b/src/main/java/com/xcong/excoin/modules/otc/entity/OtcMarketBussinessEntity.java
index 0937dac..ef2d9ff 100644
--- a/src/main/java/com/xcong/excoin/modules/otc/entity/OtcMarketBussinessEntity.java
+++ b/src/main/java/com/xcong/excoin/modules/otc/entity/OtcMarketBussinessEntity.java
@@ -36,6 +36,12 @@
     //完成率
     private BigDecimal finishRatio;
 
+    //待回款
+    private BigDecimal waitBackMoney;
+
+    //已回款
+    private BigDecimal hasBackMoney;
+
     //平均付款时间
     private Integer avgPayTime;
 
@@ -53,6 +59,11 @@
 
     @TableField(exist = false)
     private String realName;
+    /**
+     * 本次回款
+     */
+    @TableField(exist = false)
+    private BigDecimal coinAmount;
 
 
 }
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 599e0d9..24077e8 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
@@ -33,4 +33,8 @@
     OtcOrderEntity otcOrderInfo(long id);
 
     FebsResponse updateOrderInfo(OtcOrderEntity otcOrderEntity);
+
+    OtcMarketBussinessEntity otcHuiKuan(long id);
+
+    FebsResponse otcHuiKuan(OtcMarketBussinessEntity otcMarketBussinessEntity);
 }
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 c240dcc..1d76709 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
@@ -227,4 +227,41 @@
         return new FebsResponse().success();
     }
 
+    @Override
+    public OtcMarketBussinessEntity otcHuiKuan(long id) {
+        return otcMarketBussinessMapper.selectById(id);
+    }
+
+    @Override
+    @Transactional
+    public FebsResponse otcHuiKuan(OtcMarketBussinessEntity otcMarketBussinessEntity) {
+        Long id = otcMarketBussinessEntity.getId();
+        OtcMarketBussinessEntity otcMarketBussiness = otcMarketBussinessMapper.selectById(id);
+        if(ObjectUtil.isNotEmpty(otcMarketBussiness)){
+            return new FebsResponse().fail().message("连接超时,请刷新页面重试");
+        }
+        BigDecimal coinAmount = otcMarketBussinessEntity.getCoinAmount();
+        if(coinAmount.compareTo(BigDecimal.ZERO) <= 0){
+            return new FebsResponse().fail().message("请输入正确的回款金额");
+        }
+        BigDecimal waitBackMoney = otcMarketBussiness.getWaitBackMoney();
+        if(coinAmount.compareTo(waitBackMoney) > 0){
+            return new FebsResponse().fail().message("请输入正确的回款金额");
+        }
+        /**
+         * 增加已回款金额
+         * 减少待回款金额
+         * 增加汇款记录
+         */
+        BigDecimal hasBackMoney = otcMarketBussiness.getHasBackMoney();
+        BigDecimal add = hasBackMoney.add(coinAmount);
+        otcMarketBussiness.setHasBackMoney(add);
+
+        BigDecimal subtract = waitBackMoney.subtract(coinAmount);
+        otcMarketBussiness.setWaitBackMoney(subtract);
+        otcMarketBussinessMapper.updateById(otcMarketBussiness);
+
+        return new FebsResponse().success();
+    }
+
 }
diff --git a/src/main/resources/templates/febs/views/modules/member/allData/allDataInfo.html b/src/main/resources/templates/febs/views/modules/member/allData/allDataInfo.html
index 7b72882..0e346de 100644
--- a/src/main/resources/templates/febs/views/modules/member/allData/allDataInfo.html
+++ b/src/main/resources/templates/febs/views/modules/member/allData/allDataInfo.html
@@ -12,7 +12,7 @@
                                             <input type="text" placeholder="手机号/邮箱/邀请码" name="account" autocomplete="off" class="layui-input">
                                         </div>
                                     </div>
-                                    <div class="layui-inline">
+                                    <!--<div class="layui-inline">
                                         <label class="layui-form-label layui-form-label-sm">账号类型</label>
                                         <div class="layui-input-inline">
                                             <select name="isTest">
@@ -21,7 +21,7 @@
                                                 <option value="2">测试账号</option>
                                             </select>
                                         </div>
-                                    </div>
+                                    </div>-->
                                 </div>
                             </div>
                             <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
@@ -83,12 +83,12 @@
                 totalRow: true,
                 cols: [[
                     {field: 'memberCount', title: '注册用户数', minWidth: 120,align:'center'},
-                    {field: 'notNullNumber', title: '持仓用户数', minWidth: 120,align:'center'},
+                    // {field: 'notNullNumber', title: '持仓用户数', minWidth: 120,align:'center'},
                     {field: 'walletNumber', title: '币币账户有余额个数', minWidth: 200,align:'center'},
                     {field: 'walletNum', title: '币币账户余额', minWidth: 200,align:'center'},
-                    {field: 'walletCoinNumber', title: '合约账户有余额个数', minWidth: 200,align:'center'},
-                    {field: 'walletCoinNum', title: '合约账户余额', minWidth: 200,align:'center'},
-                    {field: 'agentNum', title: '代理账户余额', minWidth: 200,align:'center'},
+                    // {field: 'walletCoinNumber', title: '合约账户有余额个数', minWidth: 200,align:'center'},
+                    // {field: 'walletCoinNum', title: '合约账户余额', minWidth: 200,align:'center'},
+                    // {field: 'agentNum', title: '代理账户余额', minWidth: 200,align:'center'},
                     {field: 'allCoin', title: '平台总资产', minWidth: 200,align:'center'},
                     {field: 'platformProfitAndLoss', title: '平台剩余USDT',
                         templet: function (d) {
@@ -100,18 +100,18 @@
                         }, minWidth: 200,align:'center'},
                     {field: 'chargeCoin', title: '充币', minWidth: 200,align:'center'},
                     {field: 'appealCoin', title: '提币', minWidth: 200,align:'center'},
-                    {field: 'fee', title: '佣金', minWidth: 200,align:'center'},
-                    {field: 'closingPrice', title: '开仓手续费', minWidth: 200,align:'center'},
-                    {field: 'sellClosingPrice', title: '平仓手续费', minWidth: 200,align:'center'},
-                    {field: 'doingPrice', title: '持仓手续费', minWidth: 200,align:'center'},
-                    {field: 'yingkui', title: '订单盈亏',
-                        templet: function (d) {
-                            if (d.yingkui > '0') {
-                                return '<span style="color:green;">'+d.yingkui+'</span>'
-                            } else {
-                                return '<span style="color:red;">'+d.yingkui+'</span>'
-                            }
-                        }, minWidth: 200,align:'center'},
+                    // {field: 'fee', title: '佣金', minWidth: 200,align:'center'},
+                    // {field: 'closingPrice', title: '开仓手续费', minWidth: 200,align:'center'},
+                    // {field: 'sellClosingPrice', title: '平仓手续费', minWidth: 200,align:'center'},
+                    // {field: 'doingPrice', title: '持仓手续费', minWidth: 200,align:'center'},
+                    // {field: 'yingkui', title: '订单盈亏',
+                    //     templet: function (d) {
+                    //         if (d.yingkui > '0') {
+                    //             return '<span style="color:green;">'+d.yingkui+'</span>'
+                    //         } else {
+                    //             return '<span style="color:red;">'+d.yingkui+'</span>'
+                    //         }
+                    //     }, minWidth: 200,align:'center'},
                     {field: 'chargeUsdt', title: 'usdt充值', minWidth: 200,align:'center'},
                     {field: 'appealUsdt', title: 'usdt提现', minWidth: 200,align:'center'},
                 ]]
@@ -122,7 +122,7 @@
         function getQueryParams() {
             return {
                 account: $searchForm.find('input[name="account"]').val().trim(),
-                isTest: $searchForm.find("select[name='isTest']").val(),
+                // isTest: $searchForm.find("select[name='isTest']").val(),
             };
         }
 
diff --git a/src/main/resources/templates/febs/views/modules/otc/otcHuiKuan.html b/src/main/resources/templates/febs/views/modules/otc/otcHuiKuan.html
new file mode 100644
index 0000000..6268fc5
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/otc/otcHuiKuan.html
@@ -0,0 +1,93 @@
+<style>
+    #user-update {
+        padding: 20px 25px 25px 0;
+    }
+
+    #user-update .layui-treeSelect .ztree li a, .ztree li span {
+        margin: 0 0 2px 3px !important;
+    }
+    #user-update #data-permission-tree-block {
+        border: 1px solid #eee;
+        border-radius: 2px;
+        padding: 3px 0;
+    }
+    #user-add .layui-treeSelect .ztree li span.button.switch {
+        top: 1px;
+        left: 3px;
+    }
+
+</style>
+<div class="layui-fluid" id="user-update">
+    <form class="layui-form" action="" lay-filter="user-update-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" data-th-value="${member.id}">
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label febs-form-item-require">待回款:</label>
+            <div class="layui-input-block">
+                <input type="number" name="waitBackMoney"data-th-id="${member.waitBackMoney}"
+                       autocomplete="off" class="layui-input" readonly>
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label febs-form-item-require">已回款:</label>
+            <div class="layui-input-block">
+                <input type="number" name="hasBackMoney"data-th-id="${member.hasBackMoney}"
+                       autocomplete="off" class="layui-input" readonly>
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label febs-form-item-require">交易数量:</label>
+            <div class="layui-input-block">
+                <input type="number" name="coinAmount"data-th-id="${member.coinAmount}"
+                       autocomplete="off" class="layui-input" readonly>
+            </div>
+        </div>
+        <div class="layui-form-item febs-hide">
+            <button class="layui-btn" lay-submit="" lay-filter="user-update-form-submit" id="submit"></button>
+        </div>
+    </form>
+</div>
+
+<script data-th-inline="javascript">
+    layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree'], function () {
+        var $ = layui.$,
+            febs = layui.febs,
+            layer = layui.layer,
+            formSelects = layui.formSelects,
+            treeSelect = layui.treeSelect,
+            form = layui.form,
+            eleTree = layui.eleTree,
+            member = [[${member}]],
+            $view = $('#user-update'),
+            validate = layui.validate,
+            _deptTree;
+
+        form.render();
+
+        initUserValue();
+
+        formSelects.render();
+
+        function initUserValue() {
+            form.val("user-update-form", {
+                "id": member.id,
+                "waitBackMoney": member.waitBackMoney,
+                "hasBackMoney": member.hasBackMoney,
+                "coinAmount": member.coinAmount
+            });
+        }
+
+        form.on('submit(user-update-form-submit)', function (data) {
+            febs.post(ctx + 'otc/otcHuiKuan', data.field, function () {
+                layer.closeAll();
+                febs.alert.success('成功');
+                $('#febs-user-shop').find('#reset').click();
+            });
+            return false;
+        });
+    });
+</script>
\ 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
index 127fa27..bd0fda3 100644
--- a/src/main/resources/templates/febs/views/modules/otc/otcOrderList.html
+++ b/src/main/resources/templates/febs/views/modules/otc/otcOrderList.html
@@ -13,7 +13,7 @@
                                         </div>
                                     </div>
                                     <div class="layui-inline">
-                                        <label class="layui-form-label layui-form-label-sm">类型</label>
+                                        <label class="layui-form-label layui-form-label-sm">订单状态</label>
                                         <div class="layui-input-inline">
                                             <select name="status">
                                                 <option value="">请选择</option>
@@ -141,7 +141,7 @@
                     {field: 'payTime', title: '付款时间',minWidth: 150,align:'center'},
                     {field: 'finishTime', title: '完成时间',minWidth: 150,align:'center'},
                     {title: '操作',templet: function (d) {
-                            //return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="dealIng" shiro:hasPermission="user:update">付款</button>'
+                            // return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="dealIng" shiro:hasPermission="user:update">付款</button>'
                             if(d.status === 1){
                                 return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="dealIng" shiro:hasPermission="user:update">付款</button>'
                             }else{
diff --git a/src/main/resources/templates/febs/views/modules/otc/otcShopList.html b/src/main/resources/templates/febs/views/modules/otc/otcShopList.html
index 9a67fdb..502aeb9 100644
--- a/src/main/resources/templates/febs/views/modules/otc/otcShopList.html
+++ b/src/main/resources/templates/febs/views/modules/otc/otcShopList.html
@@ -1,4 +1,4 @@
-<div class="layui-fluid layui-anim febs-anim" id="febs-user" lay-title="OTC商户">
+<div class="layui-fluid layui-anim febs-anim" id="febs-user-shop" lay-title="OTC商户">
     <div class="layui-row febs-container">
         <div class="layui-col-md12">
             <div class="layui-card">
@@ -57,7 +57,7 @@
             febs = layui.febs,
             form = layui.form,
             table = layui.table,
-            $view = $('#febs-user'),
+            $view = $('#febs-user-shop'),
             $query = $view.find('#query'),
             $reset = $view.find('#reset'),
             $searchForm = $view.find('form'),
@@ -81,6 +81,17 @@
             if (layEvent === 'disagreeShop') {
                 febs.modal.confirm('拒绝', '确认拒绝该商户的审核?', function () {
                     disagreeShop(data.id);
+                });
+            }
+            if (layEvent === 'huikuan') {
+                febs.modal.open('回款', 'modules/otc/huikuan/' + data.id, {
+                    btn: ['提交', '取消'],
+                    yes: function (index, layero) {
+                        $('#user-update').find('#submit').trigger('click');
+                    },
+                    btn2: function () {
+                        layer.closeAll();
+                    }
                 });
             }
         });
@@ -121,32 +132,35 @@
                     {field: 'realName', title: '姓名', minWidth: 100,align:'left'},
                     {field: 'inviteId', title: '邀请码', minWidth: 80,align:'center'},
                     {field: 'nikename', title: '昵称', minWidth: 80,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 if (d.status === 3) {
-                                return '<span>拒绝</span>'
-                            }else{
-                                return ''
-                            }
-                        }, minWidth: 80,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 if (d.status === 3) {
+                    //             return '<span>拒绝</span>'
+                    //         }else{
+                    //             return ''
+                    //         }
+                    //     }, minWidth: 80,align:'center'},
+                    // {field: 'waitBackMoney', title: '待回款',minWidth: 100,align:'center'},
+                    // {field: 'hasBackMoney', title: '已回款',minWidth: 100,align:'center'},
                     {field: 'buyCnt', title: '服务人数',minWidth: 100,align:'center'},
                     {field: 'totalOrderCnt', title: '总单数',minWidth: 100,align:'center'},
                     {field: 'finishRatio', title: '完成率',minWidth: 100,align:'center'},
                     {field: 'avgPayTime', title: '平均付款时间',minWidth: 100,align:'center'},
                     {field: 'avgCoinTime', title: '平均放币时间',minWidth: 100,align:'center'},
                     {field: 'createTime', title: '注册时间', minWidth: 180,align:'center'},
-                    {title: '操作',templet: function (d) {
-                            if(d.status === 1){
-                                return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="agreeShop" shiro:hasPermission="user:update">同意</button>'
-                                        +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="disagreeShop" shiro:hasPermission="user:update">拒绝</button>'
-                            }else{
-                                return ''
-                            }
-                        },minWidth: 200,align:'center'}
+                    // {title: '操作',templet: function (d) {
+                    //         return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="huikuan" shiro:hasPermission="user:update">回款</button>'
+                    //         // if(d.status === 1){
+                    //         //     return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="agreeShop" shiro:hasPermission="user:update">同意</button>'
+                    //         //             +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="disagreeShop" shiro:hasPermission="user:update">拒绝</button>'
+                    //         // }else{
+                    //         //     return ''
+                    //         // }
+                    //     },minWidth: 200,align:'center'}
                 ]]
             });
         }

--
Gitblit v1.9.1