xiaoyong931011
2023-10-26 72c766b90d5a7140c4947efa4c9828ae0ed0e9c9
版本管理
4 files modified
114 ■■■■■ changed files
src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java 9 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserPerkVo.java 12 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/ChatUserMapper.xml 36 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/chat/userPerkList.html 57 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/AdminChatServiceImpl.java
@@ -48,17 +48,24 @@
    @Override
    public IPage<AdminChatUserPerkVo> getUserPerkList(ChatUser chatUser, QueryRequest request) {
        Page<AdminChatUserPerkVo> page = new Page<>(request.getPageNum(), request.getPageSize());
        log.info(String.valueOf(chatUser.getIsRobot()));
        IPage<AdminChatUserPerkVo> chatUserPerkVoIPage = this.baseMapper.selectUserPerkListInPage(page, chatUser);
        List<AdminChatUserPerkVo> records = chatUserPerkVoIPage.getRecords();
        if(CollUtil.isNotEmpty(records)){
            for(AdminChatUserPerkVo adminChatUserPerkVo : records){
                Long userId = adminChatUserPerkVo.getUserId();
                List<AdminChatRedBagVo> group = this.baseMapper.selectListByMsgType(userId,"GROUP", null);
                adminChatUserPerkVo.setGroupRedBagNum(CollUtil.isEmpty(group) ? 0 : group.size());
//                adminChatUserPerkVo.setGroupRedBagNum(CollUtil.isEmpty(group) ? 0 : group.size());
                BigDecimal redBagTotalAmount = group.stream().map(AdminChatRedBagVo::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
                adminChatUserPerkVo.setRedBagTotalAmount(redBagTotalAmount);
                BigDecimal redBagAvaAmount = group.stream().map(AdminChatRedBagVo::getAmountAva).reduce(BigDecimal.ZERO, BigDecimal::add);
                adminChatUserPerkVo.setRedBagAvaAmount(redBagAvaAmount);
                BigDecimal getRedbagAmount = this.baseMapper.selectTotalType(9, null, null);
                adminChatUserPerkVo.setGetRedbagAmount(getRedbagAmount);
                BigDecimal boomToAmount = this.baseMapper.selectTotalType(10, null, null);
                adminChatUserPerkVo.setBoomToAmount(boomToAmount);
                BigDecimal teamPerkAmount = this.baseMapper.selectTotalType(7, null, null);
                adminChatUserPerkVo.setTeamPerkAmount(teamPerkAmount);
            }
        }
        return chatUserPerkVoIPage;
src/main/java/cc/mrbird/febs/mall/vo/AdminChatUserPerkVo.java
@@ -60,4 +60,16 @@
     * 剩余未领取的总额
     */
    private BigDecimal redBagAvaAmount;
    /**
     * 领取红包金额
     */
    private BigDecimal getRedbagAmount;
    /**
     * 用户中雷
     */
    private BigDecimal boomToAmount;
    /**
     * 等级收益
     */
    private BigDecimal teamPerkAmount;
}
src/main/resources/mapper/modules/ChatUserMapper.xml
@@ -49,27 +49,33 @@
        a.is_robot isRobot,
        date_format(a.create_time, '%Y-%m-%d %H:%m:%s') createTime,
        IFNULL(sum(b.total_amount), 0) totalAmount,
        IFNULL(sum(b.ava_amount), 0) avaAmount
        IFNULL(sum(b.ava_amount), 0) avaAmount,
        (
            SELECT
                COUNT(c.id)
            FROM chat_red_bag c
            where c.from_user_id = a.user_id
                AND c.msg_type = 'GROUP'
        ) groupRedBagNum
        from chat_user a
        left join chat_wallet b on b.user_id = a.user_id and type = 'USDT'
        <where>
            <if test="record != null">
                <if test="record.phone != null and record.phone != ''">
                    and a.phone like CONCAT('%', CONCAT(#{record.phone}, '%'))
                </if>
                <if test="record.nickName != null and record.nickName != ''">
                    and a.nick_name like CONCAT('%', CONCAT(#{record.nickName}, '%'))
                </if>
                <if test="record.inviteId != null and record.inviteId != ''">
                    and a.invite_id = #{record.inviteId}
                </if>
                <if test="record.status != null and record.status != ''">
                    and a.status = #{record.status}
                </if>
            <if test="record.phone != null and record.phone != ''">
                and a.phone like CONCAT('%', CONCAT(#{record.phone}, '%'))
            </if>
            <if test="record.nickName != null and record.nickName != ''">
                and a.nick_name like CONCAT('%', CONCAT(#{record.nickName}, '%'))
            </if>
            <if test="record.inviteId != null and record.inviteId != ''">
                and (find_in_set(#{record.inviteId}, referrer_ids) or invite_id = #{record.inviteId})
            </if>
            <if test="record.isRobot != null">
                and a.is_robot = #{record.isRobot}
            </if>
        </where>
        group by a.user_id
        order by a.create_time desc
        order by
        a.user_id asc ,a.create_time asc
    </select>
    <select id="selectByUserId" resultType="cc.mrbird.febs.mall.entity.ChatUser">
src/main/resources/templates/febs/views/modules/chat/userPerkList.html
@@ -13,25 +13,25 @@
                                            <input type="text" placeholder="电话号码" name="phone" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">昵称:</label>
                                        <div class="layui-input-inline">
                                            <input type="text" placeholder="昵称" name="nickName" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
<!--                                    <div class="layui-inline">-->
<!--                                        <label class="layui-form-label">昵称:</label>-->
<!--                                        <div class="layui-input-inline">-->
<!--                                            <input type="text" placeholder="昵称" name="nickName" autocomplete="off" class="layui-input">-->
<!--                                        </div>-->
<!--                                    </div>-->
                                    <div class="layui-inline">
                                        <label class="layui-form-label">邀请码:</label>
                                        <div class="layui-input-inline">
                                            <input type="text" placeholder="邀请码" name="inviteId" autocomplete="off" class="layui-input">
                                            <input type="text" placeholder="邀请码(获取团队下的所有成员)" name="inviteId" autocomplete="off" class="layui-input">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">账号状态:</label>
                                        <label class="layui-form-label">用户类型:</label>
                                        <div class="layui-input-inline">
                                            <select name="status">
                                            <select name="isRobot">
                                                <option value="">请选择</option>
                                                <option value="Y">正常</option>
                                                <option value="N">禁用</option>
                                                <option value="0">用户</option>
                                                <option value="1">机器人</option>
                                            </select>
                                        </div>
                                    </div>
@@ -66,6 +66,13 @@
    <input type="checkbox" value={{d.userId}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchGetBoom">
    {{# } else { }}
    <input type="checkbox" value={{d.userId}} lay-text="是|否" lay-skin="switch" lay-filter="switchGetBoom">
    {{# } }}
</script>
<script type="text/html" id="isRobot-type">
    {{# if(d.isRobot == 1) { }}
    <span class="layui-badge febs-bg-green">机器人</span>
    {{# } else { }}
    <span class="layui-badge febs-bg-blue">用户</span>
    {{# } }}
</script>
<style>
@@ -119,9 +126,9 @@
        function getQueryParams() {
            return {
                phone: $searchForm.find('input[name="phone"]').val().trim(),
                nickName: $searchForm.find('input[name="nickName"]').val().trim(),
                // nickName: $searchForm.find('input[name="nickName"]').val().trim(),
                inviteId: $searchForm.find('input[name="inviteId"]').val().trim(),
                status: $searchForm.find("select[name='status']").val()
                isRobot: $searchForm.find("select[name='isRobot']").val()
            };
        }
@@ -135,18 +142,20 @@
                totalRow: true ,// 开启合计行
                cols: [[
                    {type: 'checkbox'},
                    {field: 'userId', title: '标识', minWidth: 150,align:'left'},
                    {field: 'phone', title: '电话号码', minWidth: 100,align:'left', totalRowText: '合计:',align:'center'},
                    {field: 'nickName', title: '昵称', minWidth: 100,align:'left',},
                    {field: 'inviteId', title: '邀请码', minWidth: 100,align:'left',align:'center'},
                    {field: 'phone', title: '注册号码', minWidth: 150,align:'left',align:'center'},
                    {field: 'totalAmount', title: '账户总额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.totalAmount) }}',align:'center'},
                    {field: 'avaAmount', title: '账户余额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.avaAmount) }}',align:'center'},
                    {field: 'groupRedBagNum', title: '群红包数', minWidth: 80,align:'left'},
                    {field: 'redBagTotalAmount', title: '红包总额', minWidth: 80,align:'left'},
                    {field: 'redBagAvaAmount', title: '未领取', minWidth: 80,align:'left'},
                    {field: 'userId', title: '标识', minWidth: 40,align:'center'},
                    {field: 'phone', title: '电话号码', minWidth: 120,align:'center', totalRowText: '合计:'},
                    {field: 'inviteId', title: '邀请码', minWidth: 100,align:'center',},
                    {title: '用户类型', minWidth: 100,templet: '#isRobot-type',align:'center'},
                    {field: 'totalAmount', title: '账户总额', minWidth: 80,align:'center',totalRow: '{{= parseInt(d.totalAmount) }}'},
                    {field: 'avaAmount', title: '账户余额', minWidth: 80,align:'center',totalRow: '{{= parseInt(d.avaAmount) }}'},
                    {field: 'groupRedBagNum', title: '群红包数', minWidth: 80,align:'center'},
                    {field: 'redBagTotalAmount', title: '发红包总额', minWidth: 100,align:'center'},
                    {field: 'redBagAvaAmount', title: '未领取总额', minWidth: 100,align:'center'},
                    {field: 'getRedbagAmount', title: '领红包金额', minWidth: 100,align:'center'},
                    {field: 'boomToAmount', title: '中雷返回金额', minWidth: 120,align:'center'},
                    {field: 'teamPerkAmount', title: '等级收益金额', minWidth: 120,align:'center'},
                    {field: 'getBoom', title: '中雷', templet: '#switchGetBoom', minWidth: 80,align:'center'},
                    {field: 'createTime', title: '注册时间', minWidth: 180,align:'center'},
                    {field: 'createTime', title: '注册时间', minWidth: 160,align:'center'},
                ]]
            });
        }