xiaoyong931011
2021-03-03 3ea894165b42672d0a9d93341e84fbc9f24f5294
20210321  利润率后台修改,推荐上首页后台设置
8 files modified
2 files added
324 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java 51 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/controller/ViewController.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dto/FollowTraderInfoDto.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dto/ModifyProfitRatioDto.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java 55 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/documentary/modifyProfitRatio.html 109 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/documentary/traderDetail.html 7 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/documentary/traderUpdate.html 59 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java
@@ -5,18 +5,20 @@
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
import com.xcong.excoin.modules.trademanage.entity.ContractOrderEntity;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.xcong.excoin.common.annotation.ControllerEndpoint;
import com.xcong.excoin.common.controller.BaseController;
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto;
import com.xcong.excoin.modules.documentary.dto.ModifyProfitRatioDto;
import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity;
import com.xcong.excoin.modules.documentary.service.DocumentaryService;
@@ -93,6 +95,16 @@
    public FebsResponse traderConfirm(@Valid FollowTraderInfoDto followTraderInfoDto) {
        return documentaryService.traderConfirm(followTraderInfoDto);
    }
    /**
     * 交易员收益率修改---确认
     * @return
     */
    @PostMapping("modifyProfitRatio")
    @ControllerEndpoint(operation = "交易员收益率修改---确认", exceptionMessage = "修改失败")
    public FebsResponse modifyProfitRatio(@Valid ModifyProfitRatioDto modifyProfitRatioDto) {
        return documentaryService.modifyProfitRatio(modifyProfitRatioDto);
    }
    
    /**
     * 踢出交易员
@@ -104,6 +116,26 @@
    public FebsResponse traderGetOut(@NotNull(message = "{required}") @PathVariable Long id) {
        return documentaryService.traderGetOut(id);
    }
    /**
     * 设置成首页交易员
     * @param id
     * @return
     */
    @GetMapping("traderGetOn/{id}")
    @ControllerEndpoint(operation = "设置成首页交易员", exceptionMessage = "设置失败")
    public FebsResponse traderGetOn(@NotNull(message = "{required}") @PathVariable Long id) {
        return documentaryService.traderGetOn(id);
    }
    /**
     * 设置成首页交易员---取消
     * @param id
     * @return
     */
    @GetMapping("traderGetOutFrist/{id}")
    @ControllerEndpoint(operation = "设置成首页交易员", exceptionMessage = "设置失败")
    public FebsResponse traderGetOutFrist(@NotNull(message = "{required}") @PathVariable Long id) {
        return documentaryService.traderGetOutFrist(id);
    }
    
    /**
     * 设置成【满员】状态
@@ -116,4 +148,13 @@
        return documentaryService.traderGetFull(id);
    }
    /**
     * 交易员数据---列表
     */
    @GetMapping("traderDataInfo")
    public FebsResponse traderDataInfo(FollowTraderProfitInfoEntity followTraderProfitInfoEntity, QueryRequest request) {
        Map<String, Object> data = getDataTable(documentaryService.findTraderDataInfoInfoInPage(followTraderProfitInfoEntity, request));
        return new FebsResponse().success().data(data);
    }
}
src/main/java/com/xcong/excoin/modules/documentary/controller/ViewController.java
@@ -79,4 +79,16 @@
        return FebsUtil.view("modules/documentary/traderDetail");
    }
    /**
     * 交易员收益率修改
     * @return
     */
    @GetMapping("modifyProfitRatio/{id}")
    @RequiresPermissions("modifyProfitRatio:update")
    public String modifyProfitRatio(@PathVariable long id, Model model) {
        FollowTraderInfoEntity data = documentaryService.selectTraderDetailByid(id);
        model.addAttribute("member", data);
        return FebsUtil.view("modules/documentary/modifyProfitRatio");
    }
}
src/main/java/com/xcong/excoin/modules/documentary/dto/FollowTraderInfoDto.java
@@ -13,4 +13,6 @@
    @NotNull(message = "ID不能为空")
    private String isok;
    private String profitRatio;
}
src/main/java/com/xcong/excoin/modules/documentary/dto/ModifyProfitRatioDto.java
New file
@@ -0,0 +1,14 @@
package com.xcong.excoin.modules.documentary.dto;
import javax.validation.constraints.NotNull;
import lombok.Data;
@Data
public class ModifyProfitRatioDto {
    @NotNull(message = "ID不能为空")
    private Long id;
    private String profitRatio;
}
src/main/java/com/xcong/excoin/modules/documentary/entity/FollowTraderInfoEntity.java
@@ -42,6 +42,12 @@
    public static final Integer IS_ALL_Y = 1;
    public static final Integer IS_ALL_N = 2;
    /**
     * 设置成首页
     */
    private Integer isSetFrist;
    public static final Integer IS_SETFRIST_Y = 1;
    public static final Integer IS_SETFRIST_N = 0;
    /**
     * 利润
     */
    private BigDecimal profitRatio;
src/main/java/com/xcong/excoin/modules/documentary/service/DocumentaryService.java
@@ -8,8 +8,10 @@
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto;
import com.xcong.excoin.modules.documentary.dto.ModifyProfitRatioDto;
import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity;
public interface DocumentaryService extends IService<FollowTraderInfoEntity> {
@@ -31,4 +33,11 @@
    void followLabelSetUpdate(@Valid FollowTraderLabelEntity followTraderLabelEntity);
    IPage<FollowTraderProfitInfoEntity> findTraderDataInfoInfoInPage(FollowTraderProfitInfoEntity followTraderProfitInfoEntity, QueryRequest request);
    FebsResponse modifyProfitRatio(@Valid ModifyProfitRatioDto modifyProfitRatioDto);
    FebsResponse traderGetOn(@NotNull(message = "{required}") Long id);
    FebsResponse traderGetOutFrist(@NotNull(message = "{required}")Long id);
}
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -20,6 +20,7 @@
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
import com.xcong.excoin.modules.documentary.dto.FollowTraderInfoDto;
import com.xcong.excoin.modules.documentary.dto.ModifyProfitRatioDto;
import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity;
import com.xcong.excoin.modules.documentary.entity.FollowTraderLabelEntity;
@@ -36,6 +37,7 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -127,6 +129,11 @@
        if(ObjectUtil.isEmpty(selectById)) {
            return new FebsResponse().fail().message("交易员信息不存在");
        }
        BigDecimal profitRatio = BigDecimal.ZERO;
        String profitRatioStr = followTraderInfoDto.getProfitRatio();
        if(StrUtil.isNotEmpty(profitRatioStr)) {
            profitRatio = new BigDecimal(profitRatioStr);
        }
        String isok = followTraderInfoDto.getIsok();
        if("1".equals(isok)) {
            //更新【会员信息表】数据
@@ -138,6 +145,7 @@
            memberEntity.setIsTrader(1);
            memberMapper.updateById(memberEntity);
            //更新【交易员信息表】数据
            selectById.setProfitRatio(profitRatio);
            selectById.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_Y);
            followTraderInfoMapper.updateById(selectById);
            //新增【交易员收益信息 】数据
@@ -229,4 +237,51 @@
        followTraderLabelMapper.updateById(followTraderLabelEntity);
    }
    @Override
    public IPage<FollowTraderProfitInfoEntity> findTraderDataInfoInfoInPage(FollowTraderProfitInfoEntity followTraderProfitInfoEntity, QueryRequest request) {
        return null;
    }
    @Override
    @Transactional
    public FebsResponse modifyProfitRatio(@Valid ModifyProfitRatioDto modifyProfitRatioDto) {
        Long id = modifyProfitRatioDto.getId();
        FollowTraderInfoEntity selectById = followTraderInfoMapper.selectById(id);
        if(ObjectUtil.isEmpty(selectById)) {
            return new FebsResponse().fail().message("交易员信息不存在");
        }
        BigDecimal profitRatio = BigDecimal.ZERO;
        String profitRatioStr = modifyProfitRatioDto.getProfitRatio();
        if(StrUtil.isNotEmpty(profitRatioStr)) {
            profitRatio = new BigDecimal(profitRatioStr);
        }
        //更新【交易员信息表】数据
        selectById.setProfitRatio(profitRatio);
        selectById.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_Y);
        followTraderInfoMapper.updateById(selectById);
        return new FebsResponse().success();
    }
    @Override
    public FebsResponse traderGetOn(@NotNull(message = "{required}") Long id) {
        FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoMapper.selectById(id);
        if(ObjectUtil.isEmpty(followTraderInfoEntity)) {
            return new FebsResponse().fail().message("交易员信息不存在");
        }
        followTraderInfoEntity.setIsSetFrist(FollowTraderInfoEntity.IS_SETFRIST_Y);
        followTraderInfoMapper.updateById(followTraderInfoEntity);
        return new FebsResponse().success();
    }
    @Override
    public FebsResponse traderGetOutFrist(@NotNull(message = "{required}") Long id) {
        FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoMapper.selectById(id);
        if(ObjectUtil.isEmpty(followTraderInfoEntity)) {
            return new FebsResponse().fail().message("交易员信息不存在");
        }
        followTraderInfoEntity.setIsSetFrist(FollowTraderInfoEntity.IS_SETFRIST_N);
        followTraderInfoMapper.updateById(followTraderInfoEntity);
        return new FebsResponse().success();
    }
}
src/main/resources/templates/febs/views/modules/documentary/modifyProfitRatio.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">
            <div style="text-align: center">
                利润率设置规则  ---  1:代表10%。
            </div>
        </div>
        <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">利润率:</label>
            <div class="layui-input-block">
                <input type="text" name="profitRatio" data-th-id="${member.profitRatio}"
                       lay-verify="range|profitRatio" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">币币账户总余额:</label>
            <div class="layui-input-block">
                <input type="text" name="walletNum" minlength="4" maxlength="10" data-th-id="${member.walletNum}"
                       lay-verify="range|walletNum" autocomplete="off" class="layui-input" readonly>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">合约账户总余额:</label>
            <div class="layui-input-block">
                <input type="text" name="walletCoinNum" minlength="4" maxlength="10" data-th-id="${member.walletCoinNum}"
                       lay-verify="range|walletCoinNum" autocomplete="off" class="layui-input" readonly>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">币币账户总余额:</label>
            <div class="layui-input-block">
                <input type="text" name="agentNum" minlength="4" maxlength="10" data-th-id="${member.agentNum}"
                       lay-verify="range|agentNum" 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,
                "profitRatio": member.profitRatio,
                "realName": member.realName,
                "phone": member.phone,
                "email": member.email,
                "agentNum": member.agentNum,
                "walletCoinNum": member.walletCoinNum,
                "walletNum": member.walletNum
            });
        }
        form.on('submit(user-update-form-submit)', function (data) {
            febs.post(ctx + 'documentary/modifyProfitRatio', data.field, function () {
                layer.closeAll();
                febs.alert.success('认证成功');
                $('#febs-user').find('#query').click();
            });
            return false;
        });
    });
</script>
src/main/resources/templates/febs/views/modules/documentary/traderDetail.html
@@ -19,6 +19,11 @@
</style>
<div class="layui-fluid" id="user-update">
    <form class="layui-form" action="" lay-filter="user-update-form">
        <div class="layui-form-item">
            <div style="text-align: center">
                利润率设置规则  ---  1:代表10%。
            </div>
        </div>
        <div class="layui-form-item febs-hide">
            <label class="layui-form-label febs-form-item-require">用户id:</label>
            <div class="layui-input-block">
@@ -29,7 +34,7 @@
            <label class="layui-form-label">利润率:</label>
            <div class="layui-input-block">
                <input type="text" name="profitRatio" data-th-id="${member.profitRatio}"
                       lay-verify="range|profitRatio" autocomplete="off" class="layui-input" readonly>
                       lay-verify="range|profitRatio" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
src/main/resources/templates/febs/views/modules/documentary/traderUpdate.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="trader-index" lay-title="交易员列表">
    <div class="layui-row febs-container">
        <div class="layui-col-md12">
            <div class="layui-card">
@@ -17,8 +17,9 @@
                                        <div class="layui-input-inline">
                                            <select name="verifyStatus">
                                                <option value="">请选择</option>
                                                <option value="1">待审核</option>
                                                <option value="2">审核通过</option>
                                                <option value="1">审核通过</option>
                                                <option value="2">审核不通过</option>
                                                <option value="3">待审核</option>
                                            </select>
                                        </div>
                                    </div>
@@ -56,7 +57,7 @@
            febs = layui.febs,
            form = layui.form,
            table = layui.table,
            $view = $('#febs-user'),
            $view = $('#trader-index'),
            $query = $view.find('#query'),
            $reset = $view.find('#reset'),
            $searchForm = $view.find('form'),
@@ -84,9 +85,30 @@
                    }
                });
            }
            if (layEvent === 'modifyProfitRatio') {
                febs.modal.open('收益率修改', 'modules/documentary/modifyProfitRatio/' + data.id, {
                    btn: ['确认', '取消'],
                    yes: function (index, layero) {
                        $('#user-update').find('#submit').trigger('click');
                    },
                    btn2: function () {
                        layer.closeAll();
                    }
                });
            }
            if (layEvent === 'getOut') {
                febs.modal.confirm('确认', '您是否要踢出该交易员?', function () {
                    confirmUsers(data.id);
                });
            }
            if (layEvent === 'getOn') {
                febs.modal.confirm('确认', '您是否推荐当前交易员?', function () {
                    confirmUsersGetOn(data.id);
                });
            }
            if (layEvent === 'getOutFrist') {
                febs.modal.confirm('确认', '您是否取消推荐当前交易员?', function () {
                    confirmUsersGetOutFrist(data.id);
                });
            }
            if (layEvent === 'getFull') {
@@ -99,6 +121,18 @@
        function confirmUsers(id) {
            febs.get(ctx + 'documentary/traderGetOut/' + id, null, function () {
                febs.alert.success('踢出成功');
                $query.click();
            });
        }
        function confirmUsersGetOn(id) {
            febs.get(ctx + 'documentary/traderGetOn/' + id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
        function confirmUsersGetOutFrist(id) {
            febs.get(ctx + 'documentary/traderGetOutFrist/' + id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
@@ -159,14 +193,21 @@
                    {title: '操作', 
                        templet: function (d) {
                            if (d.verifyStatus === 3) {
                                return '<a lay-event="edit" shiro:hasPermission="user:update">审核</a>'
                            }else if(d.verifyStatus === 1){
                                return '<a lay-event="getOut" shiro:hasPermission="user:update">踢出</a>'
                                return '<a lay-event="getFull" shiro:hasPermission="user:update">满员</a>'
                                return '<button lay-event="edit" shiro:hasPermission="user:update">审核</button>'
                            }else if(d.verifyStatus === 1 && d.isSetFrist ===1){
                                return '<button lay-event="modifyProfitRatio" shiro:hasPermission="user:update">收益率修改</button>'
                                + '<button lay-event="getOut" shiro:hasPermission="user:update">踢出</button>'
                                + '<button lay-event="getFull" shiro:hasPermission="user:update">满员</button>'
                                + '<button lay-event="getOutFrist" shiro:hasPermission="user:update">取消推荐</button>'
                            }else if(d.verifyStatus === 1 && d.isSetFrist !=1){
                                return '<button lay-event="modifyProfitRatio" shiro:hasPermission="user:update">收益率修改</button>'
                                    + '<button lay-event="getOut" shiro:hasPermission="user:update">踢出</button>'
                                    + '<button lay-event="getFull" shiro:hasPermission="user:update">满员</button>'
                                    + '<button lay-event="getOn" shiro:hasPermission="user:update">推荐首页</button>'
                            }else {
                                return ''
                            }
                        },minWidth: 200,align:'center'}
                        },minWidth: 300,align:'center'}
                ]]
            });
        }