KKSU
2024-09-10 f52cfc92db48d9a215d7f728ce4000de1cdd6ae2
src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
@@ -4,6 +4,10 @@
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.common.enumerates.FlowTypeNewEnum;
import cc.mrbird.febs.common.enumerates.MoneyFlowTypeNewEnum;
import cc.mrbird.febs.common.enumerates.ProductEnum;
import cc.mrbird.febs.common.utils.MallUtils;
import cc.mrbird.febs.common.utils.ShareCodeUtil;
import cc.mrbird.febs.common.utils.excl.ExcelSheetPO;
import cc.mrbird.febs.common.utils.excl.ExcelUtil;
@@ -11,10 +15,10 @@
import cc.mrbird.febs.common.utils.excl.ResponseHeadUtil;
import cc.mrbird.febs.mall.dto.*;
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.MallMemberMapper;
import cc.mrbird.febs.mall.mapper.MallMemberWalletMapper;
import cc.mrbird.febs.mall.mapper.*;
import cc.mrbird.febs.mall.service.IAdminMallMemberService;
import cc.mrbird.febs.mall.service.IApiMallMemberService;
import cc.mrbird.febs.mall.service.IMallMoneyFlowService;
import cc.mrbird.febs.mall.vo.AdminAgentLevelOptionTreeVo;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
@@ -48,8 +52,131 @@
    private final IAdminMallMemberService mallMemberService;
    private final MallMemberWalletMapper mallMemberWalletMapper;
    private final MallMemberAmountMapper mallMemberAmountMapper;
    private final MallMemberMapper mallMemberMapper;
    private final IApiMallMemberService apiMallMemberService;
    private final MallMemberChargeMapper mallMemberChargeMapper;
    private final IMallMoneyFlowService mallMoneyFlowService;
    private final MallMemberWithdrawMapper mallMemberWithdrawMapper;
    @GetMapping("confirmOrder")
    @ControllerEndpoint(operation = "批量充值", exceptionMessage = "操作失败")
    public FebsResponse confirmOrder(MemberChargrDto memberChargrDto){
        String orderIds = memberChargrDto.getOrderIds();
        List<String> ids = StrUtil.splitTrim(orderIds, ",");
        for(String id : ids){
            long orderId = Long.parseLong(id);
            MallMemberCharge mallMemberCharge = mallMemberChargeMapper.selectById(orderId);
            if(1 != mallMemberCharge.getState()){
                continue;
            }
            MallMemberAmount mallMemberAmount = mallMemberAmountMapper.selectByMemberId(mallMemberCharge.getMemberId());
            mallMemberAmount.setFcmCntAva(mallMemberAmount.getFcmCntAva().add(mallMemberCharge.getAmount()));
            mallMemberAmountMapper.updateFcmCntAvaById(mallMemberAmount);
            mallMemberCharge.setState(2);
            mallMemberChargeMapper.updateById(mallMemberCharge);
            String orderNo = MallUtils.getOrderNum("BF");
            mallMoneyFlowService.addMoneyFlow(
                    mallMemberCharge.getMemberId(),
                    mallMemberCharge.getAmount(),
                    MoneyFlowTypeNewEnum.FCM_INSIDE_IN.getValue(),
                    orderNo,
                    mallMemberCharge.getMemberId(),
                    FlowTypeNewEnum.FCM_COIN.getValue(),
                    MoneyFlowTypeNewEnum.FCM_INSIDE_IN.getDescrition());
        }
        return new FebsResponse().success();
    }
    @GetMapping("confirmCancel")
    @ControllerEndpoint(operation = "批量取消", exceptionMessage = "操作失败")
    public FebsResponse confirmCancel(MemberChargrDto memberChargrDto){
        String orderIds = memberChargrDto.getOrderIds();
        List<String> ids = StrUtil.splitTrim(orderIds, ",");
        for(String id : ids){
            long orderId = Long.parseLong(id);
            MallMemberCharge mallMemberCharge = mallMemberChargeMapper.selectById(orderId);
            if(1 != mallMemberCharge.getState()){
                continue;
            }
            mallMemberCharge.setState(3);
            mallMemberChargeMapper.updateById(mallMemberCharge);
        }
        return new FebsResponse().success();
    }
    @GetMapping("confirmCancelWithdraw")
    @ControllerEndpoint(operation = "批量提现取消", exceptionMessage = "操作失败")
    public FebsResponse confirmCancelWithdraw(MemberChargrDto memberChargrDto){
        String orderIds = memberChargrDto.getOrderIds();
        List<String> ids = StrUtil.splitTrim(orderIds, ",");
        for(String id : ids){
            long orderId = Long.parseLong(id);
            MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(orderId);
            if(1 != mallMemberWithdraw.getStatus()){
                continue;
            }
            mallMemberWithdraw.setStatus(3);
            mallMemberWithdrawMapper.updateById(mallMemberWithdraw);
            MallMemberAmount mallMemberAmount = mallMemberAmountMapper.selectByMemberId(mallMemberWithdraw.getMemberId());
            mallMemberAmount.setFcmCntAva(mallMemberAmount.getFcmCntAva().subtract(mallMemberWithdraw.getAmount()));
            mallMemberAmountMapper.updateFcmCntAvaById(mallMemberAmount);
        }
        return new FebsResponse().success();
    }
    @GetMapping("confirmWithdraw")
    @ControllerEndpoint(operation = "批量同意", exceptionMessage = "操作失败")
    public FebsResponse confirmWithdraw(MemberChargrDto memberChargrDto){
        String orderIds = memberChargrDto.getOrderIds();
        List<String> ids = StrUtil.splitTrim(orderIds, ",");
        for(String id : ids){
            long orderId = Long.parseLong(id);
            MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(orderId);
            if(1 != mallMemberWithdraw.getStatus()){
                continue;
            }
            mallMemberWithdraw.setStatus(2);
            mallMemberWithdrawMapper.updateById(mallMemberWithdraw);
            String orderNo = MallUtils.getOrderNum("BF");
            mallMoneyFlowService.addMoneyFlow(
                    mallMemberWithdraw.getMemberId(),
                    mallMemberWithdraw.getAmount(),
                    MoneyFlowTypeNewEnum.FCM_INSIDE_OUT.getValue(),
                    orderNo,
                    mallMemberWithdraw.getId(),
                    FlowTypeNewEnum.FCM_COIN.getValue(),
                    MoneyFlowTypeNewEnum.FCM_INSIDE_OUT.getDescrition());
        }
        return new FebsResponse().success();
    }
    /**
     * 充值列表
     */
    @GetMapping("memberChargeList")
    public FebsResponse memberChargeList(MoneyChargeListDto moneyChargeListDto, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallMemberService.memberChargeList(moneyChargeListDto, request));
        return new FebsResponse().success().data(data);
    }
    /**
     * 提现列表
     */
    @GetMapping("memberWithDrawList")
    public FebsResponse memberWithDrawList(MoneyChargeListDto moneyChargeListDto, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallMemberService.memberWithDrawList(moneyChargeListDto, request));
        return new FebsResponse().success().data(data);
    }
    /**
     * 平台账单
@@ -77,6 +204,12 @@
        return new FebsResponse().success().data(data);
    }
    @GetMapping("getFcmMallMemberList")
    public FebsResponse getFcmMallMemberList(MallMember mallMember, QueryRequest request) {
        Map<String, Object> data = getDataTable(mallMemberService.getFcmMallMemberList(mallMember, request));
        return new FebsResponse().success().data(data);
    }
    /**
     * 会员列表---禁止
     *
@@ -99,6 +232,30 @@
    @ControllerEndpoint(operation = "会员列表---开启", exceptionMessage = "开启失败")
    public FebsResponse openAccount(@NotNull(message = "{required}") @PathVariable Long id) {
        return mallMemberService.openAccount(id);
    }
    /**
     * 会员列表---冻结
     *
     * @param id
     * @return
     */
    @GetMapping("frozenWithYes/{id}")
    @ControllerEndpoint(operation = "冻结", exceptionMessage = "禁止失败")
    public FebsResponse frozenWithYes(@NotNull(message = "{required}") @PathVariable Long id) {
        return mallMemberService.frozenWith(id, ProductEnum.MEMBER_FROZEN.getValue());
    }
    /**
     * 会员列表---解冻
     *
     * @param id
     * @return
     */
    @GetMapping("frozenWithNo/{id}")
    @ControllerEndpoint(operation = "解冻", exceptionMessage = "开启失败")
    public FebsResponse frozenWithNo(@NotNull(message = "{required}") @PathVariable Long id) {
        return mallMemberService.frozenWith(id,ProductEnum.MEMBER_UNFROZEN.getValue());
    }
    /**
@@ -182,6 +339,15 @@
    @ControllerEndpoint(operation = "会员列表-系统拨付", exceptionMessage = "操作失败")
    public FebsResponse updateSystemPay(@Valid MallSystemPayDto mallSystemPayDto) {
        return mallMemberService.updateSystemPay(mallSystemPayDto);
    }
    /**
     * 会员列表-系统拨付
     */
    @PostMapping("updateSystemPayInfo")
    @ControllerEndpoint(operation = "会员列表-系统拨付", exceptionMessage = "操作失败")
    public FebsResponse updateSystemPayInfo(@Valid MallSystemPayDto mallSystemPayDto) {
        return mallMemberService.updateSystemPayInfo(mallSystemPayDto);
    }
    /**
@@ -478,7 +644,7 @@
        RegisterDto registerDto = new RegisterDto();
        Integer selectCount = mallMemberMapper.selectCount(null);
        String account = new StringBuilder().append("bbsz").append(ShareCodeUtil.toSerialNumberCode(selectCount)).toString();
        String key = ShareCodeUtil.toSerialCode(selectCount);
        String key = ShareCodeUtil.toSerialNumberCode(selectCount);
        registerDto.setAccountLogin(account);
        registerDto.setUserKey(key);
        registerDto.setPassword("a123456");