From df8cb45fe80d17e1df8b789250a30a429fee2626 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Sun, 26 Sep 2021 20:26:21 +0800
Subject: [PATCH] 20210926

---
 src/main/java/cc/mrbird/febs/mall/vo/AdminAgentLevelVo.java                      |   12 +
 src/main/java/cc/mrbird/febs/mall/vo/AdminAgentLevelUpdateInfoVo.java            |   44 ++++
 src/test/java/cc/mrbird/febs/AgentTest.java                                      |   27 +++
 src/main/java/cc/mrbird/febs/mall/mapper/MallMemberMapper.java                   |    4 
 src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java      |   31 ++
 src/main/resources/mapper/modules/MallMemberMapper.xml                           |   12 +
 src/main/java/cc/mrbird/febs/mall/dto/AgentDto.java                              |    2 
 src/main/java/cc/mrbird/febs/mall/dto/AgentLevelDto.java                         |    9 +
 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java   |   50 +++++
 src/main/resources/templates/febs/views/modules/mallMember/agentLevelList.html   |  107 +++++++++++
 src/main/java/cc/mrbird/febs/mall/dto/AgentLevelUpdateDto.java                   |   44 ++++
 src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java       |   23 ++
 src/main/resources/templates/febs/views/modules/mallMember/agentLevelUpdate.html |  114 ++++++++++++
 src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java           |   10 
 14 files changed, 475 insertions(+), 14 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
index e907f35..c7b13bf 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
@@ -4,20 +4,16 @@
 import cc.mrbird.febs.common.controller.BaseController;
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
-import cc.mrbird.febs.mall.dto.AgentDto;
-import cc.mrbird.febs.mall.dto.MoneyChargeListDto;
-import cc.mrbird.febs.mall.dto.MoneyFlowListDto;
+import cc.mrbird.febs.mall.dto.*;
 import cc.mrbird.febs.mall.entity.MallMember;
 import cc.mrbird.febs.mall.entity.MallOrderRefund;
 import cc.mrbird.febs.mall.service.IAdminMallMemberService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 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;
 
@@ -135,6 +131,27 @@
         return new FebsResponse().success().data(data);
     }
 
+    /**
+     * 代理级别-列表
+     * @param agentLevelDto
+     * @param request
+     * @return
+     */
+    @GetMapping("getAgentLevelList")
+    public FebsResponse getAgentLevelList(AgentLevelDto agentLevelDto, QueryRequest request) {
+        Map<String, Object> data = getDataTable(mallMemberService.getAgentLevelList(agentLevelDto, request));
+        return new FebsResponse().success().data(data);
+    }
+
+    /**
+     * 代理级别-更新
+     */
+    @PostMapping("agentLevelUpdate")
+    @ControllerEndpoint(operation = "商家支付方式-更新", exceptionMessage = "操作失败")
+    public FebsResponse agentLevelUpdate(@Valid AgentLevelUpdateDto agentLevelUpdateDto) {
+        return mallMemberService.agentLevelUpdate(agentLevelUpdateDto);
+    }
+
 
 
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java
index cab9dc3..2b3ed41 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java
@@ -5,6 +5,7 @@
 import cc.mrbird.febs.common.utils.FebsUtil;
 import cc.mrbird.febs.mall.entity.MallMember;
 import cc.mrbird.febs.mall.service.IAdminMallMemberService;
+import cc.mrbird.febs.mall.vo.AdminAgentLevelUpdateInfoVo;
 import cc.mrbird.febs.mall.vo.AdminMallMemberPaymentVo;
 import cc.mrbird.febs.mall.vo.MallMemberVo;
 import lombok.RequiredArgsConstructor;
@@ -104,7 +105,29 @@
         return FebsUtil.view("modules/mallMember/agentList");
     }
 
+    /**
+     * 代理级别-列表
+     * @return
+     */
+    @GetMapping("agentLevelList")
+    @RequiresPermissions("agentLevelList:view")
+    public String agentLevelList() {
+        return FebsUtil.view("modules/mallMember/agentLevelList");
+    }
 
+    /**
+     * 代理级别-详情
+     * @param id
+     * @param model
+     * @return
+     */
+    @GetMapping("agentLevelUpdate/{id}")
+    @RequiresPermissions("agentLevelUpdate:update")
+    public String agentLevelUpdate(@PathVariable long id, Model model) {
+        AdminAgentLevelUpdateInfoVo data = mallMemberService.getAgentLevelUpdateInfoById(id);
+        model.addAttribute("agentLevelUpdateInfo", data);
+        return FebsUtil.view("modules/mallMember/agentLevelUpdate");
+    }
 
 
 
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/AgentDto.java b/src/main/java/cc/mrbird/febs/mall/dto/AgentDto.java
index 32124df..8bc8028 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/AgentDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/AgentDto.java
@@ -4,7 +4,7 @@
 import lombok.Data;
 
 @Data
-@ApiModel(value = "AgentDto", description = "地址接收参数类")
+@ApiModel(value = "AgentDto", description = "接收参数类")
 public class AgentDto {
 
     private String name;
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/AgentLevelDto.java b/src/main/java/cc/mrbird/febs/mall/dto/AgentLevelDto.java
new file mode 100644
index 0000000..66d1678
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/AgentLevelDto.java
@@ -0,0 +1,9 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AgentLevelDto", description = "接收参数类")
+public class AgentLevelDto {
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/AgentLevelUpdateDto.java b/src/main/java/cc/mrbird/febs/mall/dto/AgentLevelUpdateDto.java
new file mode 100644
index 0000000..8029766
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/AgentLevelUpdateDto.java
@@ -0,0 +1,44 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel(value = "AgentLevelUpdateDto", description = "接收参数类")
+public class AgentLevelUpdateDto {
+    private Long id;
+
+    /**
+     * 下单数量要求 1-直推 2-团队
+     */
+    private Integer orderType;
+    public static final Integer ORDER_TYPE_DIRECT = 1;
+    public static final Integer ORDER_TYPE_TEAM = 2;
+
+    /**
+     * 下单数量
+     */
+    private Integer orderCnt;
+
+    /**
+     * 需要上一级的数量
+     */
+    private Integer lastCnt;
+
+    /**
+     * 直推收益
+     */
+    private BigDecimal directIncome;
+
+    /**
+     * 团队收益
+     */
+    private BigDecimal teamIncome;
+
+    /**
+     * 团队收益 1-指定金额 2-比例
+     */
+    private Integer teamIncomeType;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberMapper.java
index 5c82afd..4382875 100644
--- a/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberMapper.java
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallMemberMapper.java
@@ -1,7 +1,9 @@
 package cc.mrbird.febs.mall.mapper;
 
 import cc.mrbird.febs.mall.dto.AgentDto;
+import cc.mrbird.febs.mall.dto.AgentLevelDto;
 import cc.mrbird.febs.mall.entity.MallMember;
+import cc.mrbird.febs.mall.vo.AdminAgentLevelVo;
 import cc.mrbird.febs.mall.vo.AdminAgentVo;
 import cc.mrbird.febs.mall.vo.MallMemberVo;
 import cc.mrbird.febs.mall.vo.TeamListVo;
@@ -48,4 +50,6 @@
     List<MallMember> selectChildAgentListByInviteId(@Param("inviteId")String inviteId);
 
     List<MallMember> selectAllChildAgentListByInviteId(@Param("inviteId")String inviteId);
+
+    IPage<AdminAgentLevelVo> getAgentLevelListInPage(Page<AdminAgentLevelVo> page, @Param("record")AgentLevelDto agentLevelDto);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java b/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
index 79cfe9f..90c0b33 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
@@ -2,9 +2,7 @@
 
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
-import cc.mrbird.febs.mall.dto.AgentDto;
-import cc.mrbird.febs.mall.dto.MoneyChargeListDto;
-import cc.mrbird.febs.mall.dto.MoneyFlowListDto;
+import cc.mrbird.febs.mall.dto.*;
 import cc.mrbird.febs.mall.entity.MallMember;
 import cc.mrbird.febs.mall.vo.*;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -35,4 +33,10 @@
     AdminMallMemberPaymentVo getMallMemberPaymentInfoByFlowId(long id);
 
     IPage<AdminAgentVo> getAgentList(AgentDto agentDto, QueryRequest request);
+
+    IPage<AdminAgentLevelVo> getAgentLevelList(AgentLevelDto agentLevelDto, QueryRequest request);
+
+    AdminAgentLevelUpdateInfoVo getAgentLevelUpdateInfoById(long id);
+
+    FebsResponse agentLevelUpdate(AgentLevelUpdateDto agentLevelUpdateDto);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
index c3cc822..f2fba76 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -2,11 +2,11 @@
 
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
-import cc.mrbird.febs.mall.dto.AgentDto;
-import cc.mrbird.febs.mall.dto.MoneyChargeListDto;
-import cc.mrbird.febs.mall.dto.MoneyFlowListDto;
+import cc.mrbird.febs.mall.dto.*;
+import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
 import cc.mrbird.febs.mall.entity.MallMember;
 import cc.mrbird.febs.mall.entity.MallMoneyFlow;
+import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
 import cc.mrbird.febs.mall.mapper.MallMemberMapper;
 import cc.mrbird.febs.mall.mapper.MallMemberPaymentMapper;
 import cc.mrbird.febs.mall.mapper.MallMoneyFlowMapper;
@@ -15,6 +15,7 @@
 import cc.mrbird.febs.mall.vo.*;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -23,6 +24,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -39,6 +41,8 @@
     private final MallMoneyFlowMapper mallMoneyFlowMapper;
 
     private final MallMemberPaymentMapper mallMemberPaymentMapper;
+
+    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
 
     private final IApiMallMemberWalletService iApiMallMemberWalletService;
 
@@ -164,4 +168,44 @@
         return adminAgentVos;
     }
 
+    @Override
+    public IPage<AdminAgentLevelVo> getAgentLevelList(AgentLevelDto agentLevelDto, QueryRequest request) {
+        Page<AdminAgentLevelVo> page = new Page<>(request.getPageNum(), request.getPageSize());
+        IPage<AdminAgentLevelVo> adminAgentVos = this.baseMapper.getAgentLevelListInPage(page, agentLevelDto);
+        return adminAgentVos;
+    }
+
+    @Override
+    public AdminAgentLevelUpdateInfoVo getAgentLevelUpdateInfoById(long id) {
+        AdminAgentLevelUpdateInfoVo adminAgentLevelUpdateInfoVo = new AdminAgentLevelUpdateInfoVo();
+        DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectById(id);
+        String value = dataDictionaryCustom.getValue();
+        //{"directIncome":36,"lastCnt":3,"orderCnt":500,"orderType":2,"teamIncome":6,"teamIncomeType":2}
+        JSONObject jsonObject = JSONObject.parseObject(value);
+        adminAgentLevelUpdateInfoVo.setDirectIncome(new BigDecimal((jsonObject.get("directIncome")==null?0:jsonObject.get("directIncome")).toString()));
+        adminAgentLevelUpdateInfoVo.setLastCnt(Integer.parseInt((jsonObject.get("lastCnt")==null?0:jsonObject.get("lastCnt")).toString()));
+        adminAgentLevelUpdateInfoVo.setOrderCnt(Integer.parseInt((jsonObject.get("orderCnt")==null?0:jsonObject.get("orderCnt")).toString()));
+        adminAgentLevelUpdateInfoVo.setOrderType(Integer.parseInt(jsonObject.get("orderType").toString()));
+        adminAgentLevelUpdateInfoVo.setTeamIncome(new BigDecimal((jsonObject.get("teamIncome")==null?0:jsonObject.get("teamIncome")).toString()));
+        adminAgentLevelUpdateInfoVo.setTeamIncomeType(Integer.parseInt(jsonObject.get("orderType").toString()));
+        adminAgentLevelUpdateInfoVo.setId(id);
+        return adminAgentLevelUpdateInfoVo;
+    }
+
+    @Override
+    public FebsResponse agentLevelUpdate(AgentLevelUpdateDto agentLevelUpdateDto) {
+        DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectById(agentLevelUpdateDto.getId());
+        AgentLevelUpdateDto agentLevelUpdateDtoJson = new AgentLevelUpdateDto();
+        agentLevelUpdateDtoJson.setDirectIncome(agentLevelUpdateDto.getDirectIncome());
+        agentLevelUpdateDtoJson.setLastCnt(agentLevelUpdateDto.getLastCnt());
+        agentLevelUpdateDtoJson.setOrderCnt(agentLevelUpdateDto.getOrderCnt());
+        agentLevelUpdateDtoJson.setTeamIncome(agentLevelUpdateDto.getTeamIncome());
+        agentLevelUpdateDtoJson.setOrderType(agentLevelUpdateDto.getOrderType());
+        agentLevelUpdateDtoJson.setTeamIncomeType(agentLevelUpdateDto.getTeamIncomeType());
+        JSONObject jsonObject = (JSONObject)JSONObject.toJSON(agentLevelUpdateDtoJson);
+        dataDictionaryCustom.setValue(jsonObject.toString());
+        dataDictionaryCustomMapper.updateById(dataDictionaryCustom);
+        return new FebsResponse().success();
+    }
+
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminAgentLevelUpdateInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminAgentLevelUpdateInfoVo.java
new file mode 100644
index 0000000..3181d8f
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminAgentLevelUpdateInfoVo.java
@@ -0,0 +1,44 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel(value = "AdminAgentLevelUpdateInfoVo", description = "信息返回类")
+public class AdminAgentLevelUpdateInfoVo {
+    private Long id;
+
+    /**
+     * 下单数量要求 1-直推 2-团队
+     */
+    private Integer orderType;
+    public static final Integer ORDER_TYPE_DIRECT = 1;
+    public static final Integer ORDER_TYPE_TEAM = 2;
+
+    /**
+     * 下单数量
+     */
+    private Integer orderCnt;
+
+    /**
+     * 需要上一级的数量
+     */
+    private Integer lastCnt;
+
+    /**
+     * 直推收益
+     */
+    private BigDecimal directIncome;
+
+    /**
+     * 团队收益
+     */
+    private BigDecimal teamIncome;
+
+    /**
+     * 团队收益 1-指定金额 2-比例
+     */
+    private Integer teamIncomeType;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminAgentLevelVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminAgentLevelVo.java
new file mode 100644
index 0000000..7ead6d9
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminAgentLevelVo.java
@@ -0,0 +1,12 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+@Data
+@ApiModel(value = "AdminAgentLevelVo", description = "信息返回类")
+public class AdminAgentLevelVo {
+    private Long id;
+
+    private String name;
+}
diff --git a/src/main/resources/mapper/modules/MallMemberMapper.xml b/src/main/resources/mapper/modules/MallMemberMapper.xml
index 56d3ef5..6c12b3b 100644
--- a/src/main/resources/mapper/modules/MallMemberMapper.xml
+++ b/src/main/resources/mapper/modules/MallMemberMapper.xml
@@ -139,4 +139,16 @@
     <select id="selectAllChildAgentListByInviteId" resultType="cc.mrbird.febs.mall.entity.MallMember">
         select * from mall_member where  find_in_set(#{inviteId}, referrer_ids)
     </select>
+
+    <select id="getAgentLevelListInPage" resultType="cc.mrbird.febs.mall.vo.AdminAgentLevelVo">
+        SELECT
+            a.id,b.description name
+        FROM
+            data_dictionary_custom a
+                left JOIN data_dictionary_custom b on a.code = b.code
+        where a.type = 'AGENT_LEVEL_REQUIRE'
+        GROUP BY a.id
+        ORDER BY
+            a.CREATED_TIME DESC
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/templates/febs/views/modules/mallMember/agentLevelList.html b/src/main/resources/templates/febs/views/modules/mallMember/agentLevelList.html
new file mode 100644
index 0000000..0790133
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/mallMember/agentLevelList.html
@@ -0,0 +1,107 @@
+<div class="layui-fluid layui-anim febs-anim" id="febs-user-agent-level" 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>
+                            </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="userAgentLevelTable" lay-data="{id: 'userAgentLevelTable'}"></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-agent-level'),
+            $query = $view.find('#query'),
+            $reset = $view.find('#reset'),
+            $searchForm = $view.find('form'),
+            sortObject = {field: 'phone', type: null},
+            tableIns;
+
+        form.render();
+
+        // 表格初始化
+        initTable();
+
+        // 初始化表格操作栏各个按钮功能
+        table.on('tool(userAgentLevelTable)', function (obj) {
+            var data = obj.data,
+                layEvent = obj.event;
+            if (layEvent === 'agentLevelUpdate') {
+                febs.modal.open('编辑', 'modules/mallMember/agentLevelUpdate/' + data.id, {
+                    btn: ['确认', '取消'],
+                    yes: function (index, layero) {
+                        $('#agent-level-edit').find('#submit').trigger('click');
+                    },
+                    btn2: function () {
+                        layer.closeAll();
+                    }
+                });
+            }
+        });
+
+        // 查询按钮
+        $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: 'userAgentLevelTable',
+                url: ctx + 'admin/mallMember/getAgentLevelList',
+                cols: [[
+                    {field: 'name', title: '名称', minWidth: 100,align:'left'},
+                    {title: '操作',
+                        templet: function (d) {
+                                return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="agentLevelUpdate" shiro:hasPermission="user:update">编辑</button>'
+                        },minWidth: 300,align:'center'}
+                ]]
+            });
+        }
+
+        // 获取查询参数
+        function getQueryParams() {
+            return {};
+        }
+
+    })
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/febs/views/modules/mallMember/agentLevelUpdate.html b/src/main/resources/templates/febs/views/modules/mallMember/agentLevelUpdate.html
new file mode 100644
index 0000000..20c3382
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/mallMember/agentLevelUpdate.html
@@ -0,0 +1,114 @@
+<style>
+    #agent-level-edit {
+        padding: 20px 25px 25px 0;
+    }
+
+    #agent-level-edit .layui-treeSelect .ztree li a, .ztree li span {
+        margin: 0 0 2px 3px !important;
+    }
+    #agent-level-edit #data-permission-tree-block {
+        border: 1px solid #eee;
+        border-radius: 2px;
+        padding: 3px 0;
+    }
+    #agent-level-edit .layui-treeSelect .ztree li span.button.switch {
+        top: 1px;
+        left: 3px;
+    }
+    #agent-level-edit img{
+        max-width:200px
+    }
+
+</style>
+<div class="layui-fluid" id="agent-level-edit">
+    <form class="layui-form" action="" lay-filter="agent-level-edit-form">
+        <div class="layui-form-item febs-hide">
+            <label class="layui-form-label">id:</label>
+            <div class="layui-input-block">
+                <input type="text" name="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="radio" name="orderType" value="1" title="直推" >
+                <input type="radio" name="orderType" value="2" title="团队">
+            </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="orderCnt" class="layui-input">
+            </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="lastCnt" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item">
+            <label class="layui-form-label febs-form-item-require">团队收益类型:</label>
+            <div class="layui-input-block">
+                <input type="radio" name="teamIncomeType" value="1" title="指定金额" >
+                <input type="radio" name="teamIncomeType" value="2" title="比例">
+            </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="teamIncome" class="layui-input">
+            </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="directIncome" class="layui-input">
+            </div>
+        </div>
+        <div class="layui-form-item febs-hide">
+            <button class="layui-btn" lay-submit="" lay-filter="agent-level-edit-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,
+            agentLevelUpdateInfo = [[${agentLevelUpdateInfo}]],
+            $view = $('#agent-level-edit'),
+            validate = layui.validate,
+            _deptTree;
+        form.render();
+
+        initUserValue();
+
+        function initUserValue() {
+            $('#imageUrls').attr('src', agentLevelUpdateInfo.value);
+            form.val("agent-level-edit-form", {
+                "id": agentLevelUpdateInfo.id,
+                "orderType": agentLevelUpdateInfo.orderType,
+                "orderCnt": agentLevelUpdateInfo.orderCnt,
+                "directIncome": agentLevelUpdateInfo.directIncome,
+                "teamIncome": agentLevelUpdateInfo.teamIncome,
+                "teamIncomeType": agentLevelUpdateInfo.teamIncomeType,
+                "lastCnt": agentLevelUpdateInfo.lastCnt
+            });
+        }
+
+        form.on('submit(agent-level-edit-submit)', function (data) {
+            febs.post(ctx + 'admin/mallMember/agentLevelUpdate', data.field, function () {
+                layer.closeAll();
+                febs.alert.success('操作成功');
+                $('#febs-user-agent-level').find('#reset').click();
+            });
+            return false;
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/src/test/java/cc/mrbird/febs/AgentTest.java b/src/test/java/cc/mrbird/febs/AgentTest.java
index 1ba4792..d3144e4 100644
--- a/src/test/java/cc/mrbird/febs/AgentTest.java
+++ b/src/test/java/cc/mrbird/febs/AgentTest.java
@@ -1,6 +1,7 @@
 package cc.mrbird.febs;
 
 import cc.mrbird.febs.common.enumerates.AgentLevelEnum;
+import cc.mrbird.febs.mall.dto.AgentLevelUpdateDto;
 import cc.mrbird.febs.mall.entity.AgentInfo;
 import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
 import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
@@ -68,6 +69,32 @@
 
     }
 
+    public static void main(String[] args) {
+        getJson();
+    }
+
+    public static void getJson(){
+        AgentLevelUpdateDto adminAgentLevelUpdateInfoVo = new AgentLevelUpdateDto();
+        String jsonStr = "{\"directIncome\":50,\"lastCnt\":3,\"orderCnt\":2000,\"orderType\":2,\"teamIncome\":15,\"teamIncomeType\":2}";
+        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
+        adminAgentLevelUpdateInfoVo.setDirectIncome(new BigDecimal((jsonObject.get("directIncome")==null?0:jsonObject.get("directIncome")).toString()));
+        adminAgentLevelUpdateInfoVo.setLastCnt(Integer.parseInt((jsonObject.get("lastCnt")==null?0:jsonObject.get("lastCnt")).toString()));
+        adminAgentLevelUpdateInfoVo.setOrderCnt(Integer.parseInt((jsonObject.get("orderCnt")==null?0:jsonObject.get("orderCnt")).toString()));
+        adminAgentLevelUpdateInfoVo.setOrderType(Integer.parseInt(jsonObject.get("orderType").toString()));
+        adminAgentLevelUpdateInfoVo.setTeamIncome(new BigDecimal((jsonObject.get("teamIncome")==null?0:jsonObject.get("teamIncome")).toString()));
+        adminAgentLevelUpdateInfoVo.setTeamIncomeType(Integer.parseInt(jsonObject.get("orderType").toString()));
+        adminAgentLevelUpdateInfoVo.setId(14L);
+        AgentLevelUpdateDto agentLevelUpdateDtoJson = new AgentLevelUpdateDto();
+        agentLevelUpdateDtoJson.setDirectIncome(adminAgentLevelUpdateInfoVo.getDirectIncome());
+        agentLevelUpdateDtoJson.setLastCnt(adminAgentLevelUpdateInfoVo.getLastCnt());
+        agentLevelUpdateDtoJson.setOrderCnt(adminAgentLevelUpdateInfoVo.getOrderCnt());
+        agentLevelUpdateDtoJson.setTeamIncome(adminAgentLevelUpdateInfoVo.getTeamIncome());
+        agentLevelUpdateDtoJson.setOrderType(adminAgentLevelUpdateInfoVo.getOrderType());
+        agentLevelUpdateDtoJson.setTeamIncomeType(adminAgentLevelUpdateInfoVo.getTeamIncomeType());
+        JSONObject jsonObjectA = (JSONObject)JSONObject.toJSON(agentLevelUpdateDtoJson);
+        System.out.println(jsonObjectA.toJSONString());
+    }
+
     @Test
     public void autoLevelUp() {
         // agentService.autoUpAgentLevel(3L);

--
Gitblit v1.9.1