| | |
| | | @Getter |
| | | public enum MallMoneyFlowTypeEnum { |
| | | |
| | | WITHDRAW("提现",9), |
| | | RETURN_MARKET_STAR("星级保证金返还",8), |
| | | BUY_MARKET_STAR("购买星级",7), |
| | | TEAM_REWARD("团队管理补贴",6), |
| | |
| | | |
| | | import cc.mrbird.febs.mall.entity.MallMemberWithdraw; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface MallMemberWithdrawMapper extends BaseMapper<MallMemberWithdraw> { |
| | | |
| | | void updateStatusById(@Param("status")int i, @Param("id")Long id); |
| | | |
| | | } |
| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.AgentLevelEnum; |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MemberAgentLevelEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.*; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | |
| | | |
| | | Long wtihdrawTypeId = mallMemberWithdraw.getWtihdrawTypeId(); |
| | | MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(wtihdrawTypeId); |
| | | /** |
| | | * 调用汇聚代付 |
| | | */ |
| | | SinglePayDto singlePayDto = new SinglePayDto(); |
| | | singlePayDto.setMerchantOrderNo(mallMemberWithdraw.getWithdrawNo()); |
| | | singlePayDto.setReceiverAccountNoEncBankNo(mallMemberBank.getBankNo()); |
| | | singlePayDto.setReceiverAccountNoEncName(mallMemberBank.getName()); |
| | | singlePayDto.setReceiverAccountType("201"); |
| | | BigDecimal paidAmount = mallMemberWithdraw.getAmount().subtract(mallMemberWithdraw.getAmountFee()).setScale(2, BigDecimal.ROUND_DOWN); |
| | | singlePayDto.setPaidAmount(paidAmount); |
| | | singlePayDto.setCurrency("201"); |
| | | singlePayDto.setIsChecked("202"); |
| | | singlePayDto.setPaidDesc("用户提现"); |
| | | singlePayDto.setPaidUse("202"); |
| | | String singlePayRep = unipayService.singlePay(singlePayDto); |
| | | if(!mallMemberWithdraw.getWithdrawNo().equals(singlePayRep)){ |
| | | return new FebsResponse().fail().message("提现失败,请稍后查看错误信息一览"); |
| | | if(ObjectUtil.isEmpty(mallMemberBank)){ |
| | | return new FebsResponse().fail().message("提现地址不存在"); |
| | | } |
| | | |
| | | //更新提现记录状态为成功 |
| | | mallMemberWithdrawMapper.updateStatusById(2,mallMemberWithdraw.getId()); |
| | | //更新提现流水记录为成功 |
| | | String withdrawNo = mallMemberWithdraw.getWithdrawNo(); |
| | | MallMoneyFlow withdrawMoneyFlow = mallMoneyFlowMapper.selectOneByMemberIdAndOrderNoAndTypeAndStatusAndIsReturn( |
| | | mallMemberWithdraw.getMemberId(), |
| | | withdrawNo, |
| | | MallMoneyFlowTypeEnum.WITHDRAW.getCode(), |
| | | MallMoneyFlow.STATUS_ING, |
| | | MallMoneyFlow.IS_RETURN_Y |
| | | ); |
| | | withdrawMoneyFlow.setStatus(MallMoneyFlow.STATUS_SUCCESS); |
| | | mallMoneyFlowMapper.updateById(withdrawMoneyFlow); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | |
| | | if(1 != mallMemberWithdraw.getStatus()){ |
| | | return new FebsResponse().fail().message("当前状态不是提现中"); |
| | | } |
| | | //更新提现记录状态为失败 |
| | | mallMemberWithdrawMapper.updateStatusById(3,mallMemberWithdraw.getId()); |
| | | //更新提现流水记录为成功 |
| | | String withdrawNo = mallMemberWithdraw.getWithdrawNo(); |
| | | MallMoneyFlow withdrawMoneyFlow = mallMoneyFlowMapper.selectOneByMemberIdAndOrderNoAndTypeAndStatusAndIsReturn( |
| | | mallMemberWithdraw.getMemberId(), |
| | | withdrawNo, |
| | | MallMoneyFlowTypeEnum.WITHDRAW.getCode(), |
| | | MallMoneyFlow.STATUS_ING, |
| | | MallMoneyFlow.IS_RETURN_Y |
| | | ); |
| | | withdrawMoneyFlow.setStatus(MallMoneyFlow.STATUS_FAIL); |
| | | mallMoneyFlowMapper.updateById(withdrawMoneyFlow); |
| | | |
| | | mallMemberWithdraw.setStatus(3); |
| | | mallMemberWithdrawMapper.updateById(mallMemberWithdraw); |
| | | |
| | | QueryWrapper<MallMoneyFlow> objectQueryWrapper = new QueryWrapper<>(); |
| | | objectQueryWrapper.eq("order_no",mallMemberWithdraw.getWithdrawNo()); |
| | | objectQueryWrapper.eq("type",MoneyFlowTypeEnum.WITHDRAWAL.getValue()); |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOne(objectQueryWrapper); |
| | | mallMoneyFlow.setStatus(3); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | |
| | | //用户佣金增加对应的余额 |
| | | iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"commission"); |
| | | //用户余额增加对应的余额 |
| | | iApiMallMemberWalletService.addBalance(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId()); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | |
| | | |
| | | import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MallMoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | |
| | | import cc.mrbird.febs.mall.dto.WithdrawalDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberService; |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.IMallMemberWithdrawService; |
| | | import cc.mrbird.febs.mall.service.MallMemberService; |
| | | import cc.mrbird.febs.mall.service.*; |
| | | import cc.mrbird.febs.mall.vo.CashOutSettingVo; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | |
| | | private final IApiMallMemberService mallMemberService; |
| | | private final MallMoneyFlowMapper mallMoneyFlowMapper; |
| | | private final MallMemberWalletMapper mallMemberWalletMapper; |
| | | private final IApiMallMemberWalletService walletService; |
| | | private final IApiMallMemberWalletService memberWalletService; |
| | | private final MallMemberPaymentMapper mallMemberPaymentMapper; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private final MallMemberBankMapper mallMemberBankMapper; |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(withdrawalDto.getBankId()); |
| | | if(ObjectUtil.isEmpty(mallMemberBank)){ |
| | | throw new FebsException("未找到银行卡信息"); |
| | | } |
| | | |
| | | BigDecimal profit = mallMoneyFlowMapper.selectProfitByDateAndMemberId(memberId); |
| | | MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); |
| | | if (profit != null) { |
| | | // 可提现 |
| | | BigDecimal canMoney = wallet.getCommission().subtract(profit); |
| | | |
| | | if(withdrawalDto.getAmount().compareTo(canMoney) > 0) { |
| | | throw new FebsException("提现金额不足"); |
| | | } |
| | | throw new FebsException("未找到地址信息"); |
| | | } |
| | | |
| | | BigDecimal serviceFee = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01)); |
| | | walletService.reduce(withdrawalDto.getAmount(), memberId, "commission"); |
| | | String orderNo = MallUtils.getOrderNum("W"); |
| | | |
| | | //减少用户余额 |
| | | memberWalletService.reduce(withdrawalDto.getAmount(), memberId, "balance"); |
| | | //生成提现记录 |
| | | MallMemberWithdraw withdraw = new MallMemberWithdraw(); |
| | | withdraw.setWithdrawNo(orderNo); |
| | | withdraw.setMemberId(memberId); |
| | |
| | | withdraw.setAmountFee(serviceFee.multiply(withdrawalDto.getAmount())); |
| | | withdraw.setWtihdrawTypeId(mallMemberBank.getId()); |
| | | this.baseMapper.insert(withdraw); |
| | | |
| | | mallMemberService.addMoneyFlow(memberId, withdrawalDto.getAmount().negate(), MoneyFlowTypeEnum.WITHDRAWAL.getValue(), orderNo, null, null, null, 1, FlowTypeEnum.COMMISSION.getValue()); |
| | | //生成提现流水记录 |
| | | Long subsidyAmountFlowId = mallMoneyFlowService.addMoneyFlow( |
| | | memberId, |
| | | orderNo, |
| | | withdrawalDto.getAmount(), |
| | | MallMoneyFlowTypeEnum.WITHDRAW.getCode(), |
| | | MallMoneyFlow.STATUS_ING, |
| | | MallMoneyFlow.IS_RETURN_Y, |
| | | mallMember.getId(), |
| | | FlowTypeEnum.BALANCE.getValue(), |
| | | MallMoneyFlowTypeEnum.WITHDRAW.getName() |
| | | ); |
| | | } |
| | | } |
| | |
| | | |
| | | <select id="getAgentChildInPage" resultType="cc.mrbird.febs.mall.vo.AdminAgentMemberVo"> |
| | | select m.*,a.description levelName from mall_member m |
| | | left join data_dictionary_custom a on a.code = m.level |
| | | left join data_dictionary_custom a on a.description = m.level |
| | | where find_in_set(#{record.inviteId}, m.referrer_ids) |
| | | GROUP BY m.id |
| | | ORDER BY |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.MallMemberWithdrawMapper"> |
| | | |
| | | <update id="updateStatusById"> |
| | | update mall_member_withdraw |
| | | set status = #{status} |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | {field: 'name', title: '名称', minWidth: 100,align:'left'}, |
| | | {field: 'inviteId', title: '邀请码', minWidth: 100,align:'left'}, |
| | | {field: 'balance', title: '余额', minWidth: 100,align:'left'}, |
| | | {field: 'score', title: '赠送积分', minWidth: 100,align:'left'}, |
| | | {field: 'prizeScore', title: '竞猜积分', minWidth: 100,align:'left'}, |
| | | {field: 'commission', title: '佣金', minWidth: 100,align:'left'}, |
| | | // {field: 'score', title: '赠送积分', minWidth: 100,align:'left'}, |
| | | // {field: 'prizeScore', title: '竞猜积分', minWidth: 100,align:'left'}, |
| | | // {field: 'commission', title: '佣金', minWidth: 100,align:'left'}, |
| | | {field: 'referrerName', title: '推荐人', minWidth: 100,align:'left'}, |
| | | {field: 'levelName', title: '会员类型', minWidth: 100,align:'left'}, |
| | | {field: 'storeMaster', title: '店长', templet:'#switchStoreMaster', minWidth: 100}, |
| | | {field: 'director', title: '总监', templet:'#switchDirector', minWidth: 100}, |
| | | {field: 'accountType', title: '账号类型', |
| | | templet: function (d) { |
| | | if (d.accountType === 2) { |
| | | return '<span style="color:red;">测试账号</span>' |
| | | } else if (d.accountType === 1) { |
| | | return '<span style="color:green;">正常账号</span>' |
| | | }else{ |
| | | return '' |
| | | } |
| | | }, minWidth: 100,align:'center'}, |
| | | {field: 'level', title: '代理级别', minWidth: 100,align:'left'}, |
| | | {field: 'accountLevel', title: '会员类型', minWidth: 100,align:'left'}, |
| | | // {field: 'storeMaster', title: '店长', templet:'#switchStoreMaster', minWidth: 100}, |
| | | // {field: 'director', title: '总监', templet:'#switchDirector', minWidth: 100}, |
| | | // {field: 'accountType', title: '账号类型', |
| | | // templet: function (d) { |
| | | // if (d.accountType === 2) { |
| | | // return '<span style="color:red;">测试账号</span>' |
| | | // } else if (d.accountType === 1) { |
| | | // return '<span style="color:green;">正常账号</span>' |
| | | // }else{ |
| | | // return '' |
| | | // } |
| | | // }, minWidth: 100,align:'center'}, |
| | | {field: 'accountStatus', title: '账号状态', templet: '#switchStatus', minWidth: 100,align:'center'}, |
| | | {field: 'createdTime', title: '注册时间', minWidth: 180,align:'center'}, |
| | | {title: '操作', |
| | |
| | | {field: 'type', title: '流水类型', |
| | | templet: function (d) { |
| | | if (d.type === 1) { |
| | | return '<span>静态收益</span>' |
| | | return '<span>市场补贴</span>' |
| | | } else if (d.type === 2) { |
| | | return '<span>直推奖</span>' |
| | | return '<span>直推奖励</span>' |
| | | } else if (d.type === 3) { |
| | | return '<span>代理收益</span>' |
| | | return '<span>第一代分享奖励</span>' |
| | | } else if (d.type === 4) { |
| | | return '<span>排名收益</span>' |
| | | return '<span>第二代分享奖励</span>' |
| | | }else if (d.type === 5) { |
| | | return '<span>总监收益</span>' |
| | | }else if (d.type === 6) { |
| | | return '<span>社区店补</span>' |
| | | }else if (d.type === 7) { |
| | | return '<span>一代收益</span>' |
| | | }else if (d.type === 8) { |
| | | return '<span>提现</span>' |
| | | }else if (d.type === 9) { |
| | | return '<span>转账</span>' |
| | | }else if (d.type === 10) { |
| | | return '<span>支付</span>' |
| | | }else if (d.type === 11) { |
| | | return '<span>退款</span>' |
| | | }else if (d.type === 12) { |
| | | return '<span>佣金转竞猜积分</span>' |
| | | }else if (d.type === 13) { |
| | | return '<span>佣金转余额</span>' |
| | | }else if (d.type === 14) { |
| | | return '<span>竞猜积分签到</span>' |
| | | }else if (d.type === 15) { |
| | | return '<span>感恩奖</span>' |
| | | }else if (d.type === 16) { |
| | | return '<span>系统拨付</span>' |
| | | }else if (d.type === 17) { |
| | | return '<span>抽奖</span>' |
| | | }else if (d.type === 6) { |
| | | return '<span>团队管理补贴</span>' |
| | | }else if (d.type === 7) { |
| | | return '<span>购买星级</span>' |
| | | }else if (d.type === 8) { |
| | | return '<span>星级保证金返还</span>' |
| | | }else{ |
| | | return '' |
| | | } |
| | |
| | | templet: function (d) { |
| | | if (d.flowType === 1) { |
| | | return '余额'; |
| | | } else if(d.flowType === 2) { |
| | | return '赠送积分' |
| | | } else if(d.flowType === 3) { |
| | | return '竞猜积分' |
| | | } else if(d.flowType === 4) { |
| | | return '佣金' |
| | | } else { |
| | | return '-'; |
| | | } |
| | | }, minWidth: 80,align:'center'}, |
| | | {field: 'orderNo', title: '订单编号', minWidth: 150,align:'center'}, |
| | | {field: 'orderNo', title: '编号', minWidth: 150,align:'center'}, |
| | | {field: 'createdTime', title: '时间', minWidth: 150,align:'left'} |
| | | ]] |
| | | }); |
| | |
| | | <div class="layui-input-inline"> |
| | | <select name="type"> |
| | | <option value="">请选择</option> |
| | | <option value="1">静态收益</option> |
| | | <option value="2">直推奖</option> |
| | | <option value="3">代理收益</option> |
| | | <option value="4">排名收益</option> |
| | | <option value="5">总监收益</option> |
| | | <option value="6">社区店补</option> |
| | | <option value="7">一代收益</option> |
| | | <option value="8">提现</option> |
| | | <option value="9">转账</option> |
| | | <option value="10">支付</option> |
| | | <option value="11">退款</option> |
| | | <option value="12">佣金转竞猜积分</option> |
| | | <option value="13">佣金转余额</option> |
| | | <option value="14">竞猜积分签到</option> |
| | | <option value="15">感恩奖</option> |
| | | <option value="16">系统拨付</option> |
| | | <option value="17">抽奖</option> |
| | | <option value="18">积分池收益</option> |
| | | <option value="1">市场补贴</option> |
| | | <option value="2">直推奖励</option> |
| | | <option value="3">第一代分享奖励</option> |
| | | <option value="4">第二代分享奖励</option> |
| | | <option value="5">支付</option> |
| | | <option value="6">团队管理补贴</option> |
| | | <option value="7">购买星级</option> |
| | | <option value="8">星级保证金返还</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label layui-form-label-sm">资金类型</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="flowType"> |
| | | <option value="">请选择</option> |
| | | <option value="1">余额</option> |
| | | <option value="2">赠送积分</option> |
| | | <option value="3">竞猜积分</option> |
| | | <option value="4">佣金</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-inline">--> |
| | | <!-- <label class="layui-form-label layui-form-label-sm">资金类型</label>--> |
| | | <!-- <div class="layui-input-inline">--> |
| | | <!-- <select name="flowType">--> |
| | | <!-- <option value="">请选择</option>--> |
| | | <!-- <option value="1">余额</option>--> |
| | | <!-- <option value="2">赠送积分</option>--> |
| | | <!-- <option value="3">竞猜积分</option>--> |
| | | <!-- <option value="4">佣金</option>--> |
| | | <!-- </select>--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | |
| | | {field: 'type', title: '流水类型', |
| | | templet: function (d) { |
| | | if (d.type === 1) { |
| | | return '<span>静态收益</span>' |
| | | return '<span>市场补贴</span>' |
| | | } else if (d.type === 2) { |
| | | return '<span>直推奖</span>' |
| | | return '<span>直推奖励</span>' |
| | | } else if (d.type === 3) { |
| | | return '<span>代理收益</span>' |
| | | return '<span>第一代分享奖励</span>' |
| | | } else if (d.type === 4) { |
| | | return '<span>排名收益</span>' |
| | | return '<span>第二代分享奖励</span>' |
| | | }else if (d.type === 5) { |
| | | return '<span>总监收益</span>' |
| | | }else if (d.type === 6) { |
| | | return '<span>社区店补</span>' |
| | | }else if (d.type === 7) { |
| | | return '<span>一代收益</span>' |
| | | }else if (d.type === 8) { |
| | | return '<span>提现</span>' |
| | | }else if (d.type === 9) { |
| | | return '<span>转账</span>' |
| | | }else if (d.type === 10) { |
| | | return '<span>支付</span>' |
| | | }else if (d.type === 11) { |
| | | return '<span>退款</span>' |
| | | }else if (d.type === 12) { |
| | | return '<span>佣金转竞猜积分</span>' |
| | | }else if (d.type === 13) { |
| | | return '<span>佣金转余额</span>' |
| | | }else if (d.type === 14) { |
| | | return '<span>竞猜积分签到</span>' |
| | | }else if (d.type === 15) { |
| | | return '<span>感恩奖</span>' |
| | | }else if (d.type === 16) { |
| | | return '<span>系统拨付</span>' |
| | | }else if (d.type === 17) { |
| | | return '<span>抽奖</span>' |
| | | }else if (d.type === 18) { |
| | | return '<span>积分池收益</span>' |
| | | }else if (d.type === 6) { |
| | | return '<span>团队管理补贴</span>' |
| | | }else if (d.type === 7) { |
| | | return '<span>购买星级</span>' |
| | | }else if (d.type === 8) { |
| | | return '<span>星级保证金返还</span>' |
| | | }else{ |
| | | return '' |
| | | } |
| | |
| | | templet: function (d) { |
| | | if (d.flowType === 1) { |
| | | return '余额'; |
| | | } else if(d.flowType === 2) { |
| | | return '赠送积分' |
| | | } else if(d.flowType === 3) { |
| | | return '竞猜积分' |
| | | } else if(d.flowType === 4) { |
| | | return '佣金' |
| | | } else { |
| | | return '-'; |
| | | } |
| | | }, minWidth: 80,align:'center'}, |
| | | {field: 'orderNo', title: '订单编号', minWidth: 150,align:'left'}, |
| | | {field: 'orderNo', title: '编号', minWidth: 150,align:'left'}, |
| | | {field: 'createdTime', title: '创建时间', minWidth: 180,align:'center'} |
| | | ]] |
| | | }); |
| | |
| | | name: $searchForm.find('input[name="name"]').val().trim(), |
| | | phone: $searchForm.find('input[name="phone"]').val().trim(), |
| | | type: $searchForm.find("select[name='type']").val(), |
| | | flowType: $searchForm.find("select[name='flowType']").val(), |
| | | // flowType: $searchForm.find("select[name='flowType']").val(), |
| | | }; |
| | | } |
| | | |