xiaoyong931011
2021-05-20 fb5549475c11fa264f4a4630638c136c99250d1e
20210520 订单更新付款人,订单状态,支付时间
10 files modified
1 files added
286 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/otc/controller/OtcController.java 17 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/controller/ViewController.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/entity/OtcEntrustOrderEntity.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderEntity.java 12 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java 54 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/OtcEntrustOrderMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/OtcOrderAppealMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/OtcOrderMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/otc/otcOrderInfo.html 109 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/otc/otcOrderList.html 73 ●●●● patch | view | raw | blame | history
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.member.entity.MemberEntity;
import com.xcong.excoin.modules.otc.entity.OtcEntrustOrderEntity;
import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity;
import com.xcong.excoin.modules.otc.entity.OtcOrderAppealEntity;
@@ -12,11 +13,9 @@
import com.xcong.excoin.modules.otc.service.OtcService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Map;
@@ -104,4 +103,14 @@
        return new FebsResponse().success().data(data);
    }
    /**
     *订单列表---付款人
     * @return
     */
    @PostMapping("updateOrderInfo")
    @ControllerEndpoint(operation = "订单列表---付款人", exceptionMessage = "失败")
    public FebsResponse updateOrderInfo(@Valid OtcOrderEntity otcOrderEntity) {
        return otcService.updateOrderInfo(otcOrderEntity);
    }
}
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.OtcOrderEntity;
import com.xcong.excoin.modules.otc.service.OtcService;
import com.xcong.excoin.modules.otc.vo.OtcAppealInfoVo;
import lombok.RequiredArgsConstructor;
@@ -48,6 +49,17 @@
    }
    /**
     * 获取订单列表--详情
     */
    @GetMapping("otcOrderInfo/{id}")
    @RequiresPermissions("otcOrderInfo:update")
    public String otcOrderInfo(@PathVariable long id, Model model) {
        OtcOrderEntity data = otcService.otcOrderInfo(id);
        model.addAttribute("member", data);
        return FebsUtil.view("modules/otc/otcOrderInfo");
    }
    /**
     * 获取申诉列表
     */
    @GetMapping("otcAppealList")
src/main/java/com/xcong/excoin/modules/otc/entity/OtcEntrustOrderEntity.java
@@ -65,6 +65,6 @@
    private String realName;
    @TableField(exist = false)
    private String nickname;
    private String nikename;
}
src/main/java/com/xcong/excoin/modules/otc/entity/OtcOrderEntity.java
@@ -35,6 +35,11 @@
    public static final Integer STATUS_THREE = 3;
    public static final Integer STATUS_FOUR = 4;
    //委托单类型 B-买S-卖
    private String orderType;
    public static final String ORDERTYPE_B = "B";
    public static final String ORDERTYPE_S = "S";
    //付款时间
    private Date payTime;
@@ -45,10 +50,13 @@
    private long entrustOrderId;
    //市商ID
    private long mdId;
    private long mbId;
    //支付市商ID
    private long payMdId;
    private long payMbId;
    //付款人姓名
    private String payName;
    @TableField(exist = false)
    private String account;
src/main/java/com/xcong/excoin/modules/otc/service/OtcService.java
@@ -29,4 +29,8 @@
    IPage<OtcOrderEntity> otcOrderList(OtcOrderEntity otcOrderEntity, QueryRequest request);
    OtcAppealInfoVo otcAppealInfo(long id);
    OtcOrderEntity otcOrderInfo(long id);
    FebsResponse updateOrderInfo(OtcOrderEntity otcOrderEntity);
}
src/main/java/com/xcong/excoin/modules/otc/service/impl/OtcServiceImpl.java
@@ -1,6 +1,10 @@
package com.xcong.excoin.modules.otc.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -8,7 +12,9 @@
import com.xcong.excoin.common.entity.QueryRequest;
import com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity;
import com.xcong.excoin.modules.member.entity.MemberEntity;
import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
import com.xcong.excoin.modules.member.mapper.MemberMapper;
import com.xcong.excoin.modules.member.mapper.MemberWalletCoinMapper;
import com.xcong.excoin.modules.otc.entity.OtcEntrustOrderEntity;
import com.xcong.excoin.modules.otc.entity.OtcMarketBussinessEntity;
import com.xcong.excoin.modules.otc.entity.OtcOrderAppealEntity;
@@ -26,6 +32,7 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Service
@RequiredArgsConstructor
@@ -39,6 +46,8 @@
    private OtcEntrustOrderMapper otcEntrustOrderMapper;
    @Resource
    private OtcOrderMapper otcOrderMapper;
    @Resource
    private MemberWalletCoinMapper memberWalletCoinMapper;
    @Resource
    private MemberMapper memberMapper;
@@ -166,7 +175,7 @@
            otcAppealInfoVo.setFinishTime(finishTime);
        }
        //获取对应的商户信息
        long payMdId = otcOrderEntity.getPayMdId();
        long payMdId = otcOrderEntity.getPayMbId();
        OtcMarketBussinessEntity otcMarketBussinessEntity = otcMarketBussinessMapper.selectById(payMdId);
        if(ObjectUtil.isNotEmpty(otcMarketBussinessEntity)){
            String nikename = otcMarketBussinessEntity.getNikename();
@@ -175,4 +184,47 @@
        return otcAppealInfoVo;
    }
    @Override
    public OtcOrderEntity otcOrderInfo(long id) {
        OtcOrderEntity otcOrderEntity = otcOrderMapper.selectById(id);
        return otcOrderEntity;
    }
    @Override
    @Transactional
    public FebsResponse updateOrderInfo(OtcOrderEntity otcOrderEntity) {
        Long id = otcOrderEntity.getId();
        OtcOrderEntity otcOrder = otcOrderMapper.selectById(id);
        if(ObjectUtil.isEmpty(otcOrder)){
            return new FebsResponse().fail().message("连接超时,请刷新页面重试");
        }
        Integer status = otcOrder.getStatus();
        if(OtcOrderEntity.STATUS_ONE != status){
            return new FebsResponse().fail().message("当前订单不是待付款状态");
        }
        String payName = otcOrderEntity.getPayName();
        if(StrUtil.isEmpty(payName)){
            return new FebsResponse().fail().message("请输入付款人");
        }
        BigDecimal coinAmount = otcOrderEntity.getCoinAmount();
        /**
         * 获取订单信息--订单编号
         *      获取买单和买单
         *      更新payName字段
         *      更新订单状态
         */
        QueryWrapper<OtcOrderEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("order_no",otcOrder.getOrderNo());
        List<OtcOrderEntity> list = otcOrderMapper.selectList(queryWrapper);
        if(CollUtil.isNotEmpty(list)){
            for(OtcOrderEntity order : list){
                order.setStatus(OtcOrderEntity.STATUS_TWO);
                order.setPayName(payName);
                order.setPayTime(DateUtil.date());
                otcOrderMapper.updateById(order);
            }
        }
        return new FebsResponse().success();
    }
}
src/main/resources/mapper/modules/OtcEntrustOrderMapper.xml
@@ -10,7 +10,6 @@
        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!=''">
src/main/resources/mapper/modules/OtcOrderAppealMapper.xml
@@ -10,7 +10,6 @@
        otc_order_appeal 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.member_id = a.member_id
        <where>
            <if test="record != null" >
                <if test="record.account!=null and record.account!=''">
src/main/resources/mapper/modules/OtcOrderMapper.xml
@@ -10,7 +10,6 @@
        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!=''">
src/main/resources/templates/febs/views/modules/otc/otcOrderInfo.html
New file
@@ -0,0 +1,109 @@
<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="text" name="orderNo"data-th-id="${member.orderNo}"
                       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="unitPrice"data-th-id="${member.unitPrice}"
                       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">
            <label class="layui-form-label febs-form-item-require">交易总额:</label>
            <div class="layui-input-block">
                <input type="number" name="totalAmount"data-th-id="${member.totalAmount}"
                       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="text" name="payName"data-th-id="${member.payName}"
                       autocomplete="off" class="layui-input">
            </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,
                "orderNo": member.orderNo,
                "unitPrice": member.unitPrice,
                "coinAmount": member.coinAmount,
                "totalAmount": member.totalAmount,
                "payName": member.payName
            });
        }
        form.on('submit(user-update-form-submit)', function (data) {
            febs.post(ctx + 'otc/updateOrderInfo', data.field, function () {
                layer.closeAll();
                febs.alert.success('成功');
                $('#febs-user-order').find('#reset').click();
            });
            return false;
        });
    });
</script>
src/main/resources/templates/febs/views/modules/otc/otcOrderList.html
@@ -1,4 +1,4 @@
<div class="layui-fluid layui-anim febs-anim" id="febs-user" lay-title="订单">
<div class="layui-fluid layui-anim febs-anim" id="febs-user-order" lay-title="订单">
    <div class="layui-row febs-container">
        <div class="layui-col-md12">
            <div class="layui-card">
@@ -58,7 +58,7 @@
            febs = layui.febs,
            form = layui.form,
            table = layui.table,
            $view = $('#febs-user'),
            $view = $('#febs-user-order'),
            $query = $view.find('#query'),
            $reset = $view.find('#reset'),
            $searchForm = $view.find('form'),
@@ -75,29 +75,17 @@
            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);
                febs.modal.open('付款', 'modules/otc/otcOrderInfo/' + data.id, {
                    btn: ['提交', '取消'],
                    yes: function (index, layero) {
                        $('#user-update').find('#submit').trigger('click');
                    },
                    btn2: function () {
                        layer.closeAll();
                    }
                });
            }
        });
        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 () {
@@ -118,13 +106,23 @@
                id: 'userTable',
                url: ctx + 'otc/otcOrderList',
                cols: [[
                    {field: 'phone', title: '手机号', minWidth: 150,align:'left'},
                    {field: 'phone', title: '手机号', minWidth: 100,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: 'orderNo', title: '订单编号', minWidth: 150,align:'center'},
                    {field: 'unitPrice', title: '单价',minWidth: 80,align:'center'},
                    {field: 'coinAmount', title: '数量',minWidth: 80,align:'center'},
                    {field: 'totalAmount', title: '委托总金额',minWidth: 100,align:'center'},
                    {field: 'orderType', title: '类型',
                        templet: function (d) {
                            if (d.orderType === 'B') {
                                return '<span style="color:green;">买入</span>'
                            } else if (d.orderType === 'S') {
                                return '<span style="color:blue;">卖出</span>'
                            } else{
                                return ''
                            }
                        }, minWidth: 80,align:'center'},
                    {field: 'status', title: '订单状态',
                        templet: function (d) {
                            if (d.status === 1) {
@@ -139,18 +137,17 @@
                                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'}
                    {field: 'payName', title: '付款人姓名',minWidth: 100,align:'center'},
                    {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>'
                            if(d.status === 1){
                                return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="dealIng" shiro:hasPermission="user:update">付款</button>'
                            }else{
                                return ''
                            }
                        },minWidth: 100,align:'center'}
                ]]
            });
        }