src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java
@@ -60,6 +60,13 @@ return memberService.moneyFlows(moneyFlowDto); } @ApiOperation(value = "充值", notes = "充值") @PostMapping(value = "/charge") public FebsResponse charge(@RequestBody @Validated WithdrawalDto withdrawalDto) { mallMemberWithdrawService.charge(withdrawalDto); return new FebsResponse().success().message("提交成功"); } @ApiOperation(value = "提现", notes = "提现") @PostMapping(value = "/withdrawal") public FebsResponse withdrawal(@RequestBody @Validated WithdrawalDto withdrawalDto) { src/main/java/cc/mrbird/febs/mall/dto/MoneyChargeListDto.java
@@ -13,5 +13,7 @@ private String phone; private String remark; private Integer status; } src/main/java/cc/mrbird/febs/mall/service/IMallMemberWithdrawService.java
@@ -7,4 +7,6 @@ public interface IMallMemberWithdrawService extends IService<MallMemberWithdraw> { void withdrawal(WithdrawalDto withdrawalDto); void charge(WithdrawalDto withdrawalDto); } src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -57,6 +57,7 @@ private final MallMoneyFlowMapper mallMoneyFlowMapper; private final IMallMoneyFlowService mallMemberService; private final IApiMallMemberService iApiMallMemberService; private final IApiMallMemberService apiMallMemberService; private final MallMemberPaymentMapper mallMemberPaymentMapper; @@ -202,10 +203,23 @@ objectQueryWrapper.eq("order_no",mallMemberWithdraw.getWithdrawNo()); objectQueryWrapper.eq("type",MoneyFlowTypeNewEnum.RANK_BONUS.getValue()); MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOne(objectQueryWrapper); if(ObjectUtil.isNotEmpty(mallMoneyFlow)){ mallMoneyFlow.setStatus(3); mallMoneyFlowMapper.updateById(mallMoneyFlow); //用户佣金增加对应的余额 iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"balance"); }else{ iApiMallMemberService.addMoneyFlow( mallMemberWithdraw.getMemberId(), mallMemberWithdraw.getAmount(), MoneyFlowTypeNewEnum.AGENT_BONUS.getValue(), mallMemberWithdraw.getWithdrawNo(), MoneyFlowTypeNewEnum.AGENT_BONUS.getDescription(), null, null, 3, FlowTypeEnum.BALANCE.getValue()); } return new FebsResponse().success(); } @@ -774,7 +788,6 @@ return new FebsResponse().fail().message("提现银行卡已删除"); } String agreeType = mallMemberWithdrawInfo.getAgreeType(); if("1".equals(agreeType)){ mallMemberWithdraw.setStatus(2); mallMemberWithdrawMapper.updateById(mallMemberWithdraw); @@ -785,33 +798,19 @@ if(ObjectUtil.isNotEmpty(mallMoneyFlow)){ mallMoneyFlow.setStatus(2); mallMoneyFlowMapper.updateById(mallMoneyFlow); }else{ iApiMallMemberService.addMoneyFlow( mallMemberWithdraw.getMemberId(), mallMemberWithdraw.getAmount(), MoneyFlowTypeNewEnum.AGENT_BONUS.getValue(), mallMemberWithdraw.getWithdrawNo(), MoneyFlowTypeNewEnum.AGENT_BONUS.getDescription(), null, null, 2, FlowTypeEnum.BALANCE.getValue()); } return new FebsResponse().success(); }else{ String bankName = mallMemberBank.getBankName(); NBYHResponse nbyhResponse = new NBYHResponse(); if("宁波银行".equals(bankName)){ nbyhResponse = nbyhService.tradeSinge(mallMemberWithdraw.getId()); }else{ nbyhResponse = nbyhService.tradeSingeOuterTransfer(mallMemberWithdraw.getId()); } if(nbyhResponse.isFlag()){ mallMemberWithdraw.setStatus(2); mallMemberWithdrawMapper.updateById(mallMemberWithdraw); QueryWrapper<MallMoneyFlow> flowQueryWrapper = new QueryWrapper<>(); flowQueryWrapper.eq("order_no",mallMemberWithdraw.getWithdrawNo()); flowQueryWrapper.eq("type",MoneyFlowTypeEnum.WITHDRAWAL.getValue()); MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectOne(flowQueryWrapper); if(ObjectUtil.isNotEmpty(mallMoneyFlow)){ mallMoneyFlow.setStatus(2); mallMoneyFlowMapper.updateById(mallMoneyFlow); } return new FebsResponse().success().message(nbyhResponse.getMsg()); }else{ return new FebsResponse().fail().message(nbyhResponse.getMsg()); } } } src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -99,6 +99,7 @@ withdraw.setAmount(withdrawalDto.getAmount()); withdraw.setStatus(1); withdraw.setAmountFee(serviceFee); withdraw.setRemark("提现"); withdraw.setWtihdrawTypeId(mallMemberBank.getId()); this.baseMapper.insert(withdraw); @@ -113,4 +114,30 @@ 1, FlowTypeEnum.BALANCE.getValue()); } @Override @Transactional(rollbackFor = Exception.class) public void charge(WithdrawalDto withdrawalDto) { Long memberId = LoginUserUtil.getLoginUser().getId(); MallMember mallMember = mallMemberService.getById(memberId); MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(withdrawalDto.getBankId()); if(ObjectUtil.isEmpty(mallMemberBank)){ throw new FebsException("未找到银行卡信息"); } if(BigDecimal.ZERO.compareTo(withdrawalDto.getAmount()) >= 0) { throw new FebsException("金额需要大于0"); } String orderNo = MallUtils.getOrderNum("C"); MallMemberWithdraw withdraw = new MallMemberWithdraw(); withdraw.setWithdrawNo(orderNo); withdraw.setMemberId(memberId); withdraw.setAmount(withdrawalDto.getAmount()); withdraw.setStatus(1); withdraw.setRemark("充值"); withdraw.setWtihdrawTypeId(mallMemberBank.getId()); this.baseMapper.insert(withdraw); } } src/main/resources/mapper/modules/MallMoneyFlowMapper.xml
@@ -82,6 +82,9 @@ <if test="record.status!=null and record.status!=''"> and a.status = #{record.status} </if> <if test="record.remark!=null and record.remark!=''"> and a.remark = #{record.remark} </if> </if> </where> order by a.created_time desc src/main/resources/templates/febs/views/modules/mallMember/chargeFlowList.html
@@ -14,6 +14,16 @@ </div> </div> <div class="layui-inline"> <label class="layui-form-label">类型:</label> <div class="layui-input-inline"> <select name="remark"> <option value="">请选择</option> <option value="充值">充值</option> <option value="提现">提现</option> </select> </div> </div> <div class="layui-inline"> <label class="layui-form-label">状态:</label> <div class="layui-input-inline"> <select name="status"> @@ -51,6 +61,18 @@ {{# } else { }} <button class="layui-btn layui-btn-normal layui-btn-xs" type="button" shiro:hasPermission="paymentInfo:update" lay-event="paymentInfo">查看收款方式</button> {{# } }} </script> <script type="text/html" id="remarkFormat"> <div> {{# if (d.remark == '充值') { }} <span class="layui-badge febs-tag-blue">充值</span> {{# } else if (d.remark == '提现') { }} <span class="layui-badge febs-tag-green">提现</span> {{# } else { }} <span class="layui-badge febs-tag-green">提现</span> {{# } }} </div> </script> <script type="text/html" id="txStatusFormat"> @@ -142,6 +164,7 @@ totalRow: true ,// 开启合计行 cols: [[ {field: 'withdrawNo', title: '编号', minWidth: 100,align:'left', totalRowText: '合计:'}, {templet:"#remarkFormat", title: '类型', minWidth: 100,align:'left'}, {field: 'phone', title: '账号', minWidth: 150,align:'left'}, {field: 'amount', title: '金额', minWidth: 150,align:'left',totalRow: '{{= parseInt(d.amount) }}'}, {field: 'amountFee', title: '手续费', minWidth: 150,align:'left',totalRow: '{{= parseInt(d.amountFee) }}'}, @@ -157,6 +180,7 @@ return { phone: $searchForm.find('input[name="phone"]').val().trim(), status: $searchForm.find("select[name='status']").val(), remark: $searchForm.find("select[name='remark']").val(), }; }