src/main/java/cc/mrbird/febs/common/enumerates/GreenScoreEnum.java
@@ -8,6 +8,10 @@ @Getter public enum GreenScoreEnum { /** * 余额提现需要绿色凭证比例 */ VOUCHER_PERCENT("GREEN_SCORE", "VOUCHER_PERCENT"), /** * 绿色凭证提现开关 1:开启 2:关闭 */ VOUCHER_ON_OFF("GREEN_SCORE", "VOUCHER_ON_OFF"), src/main/java/cc/mrbird/febs/common/utils/AppContants.java
@@ -67,5 +67,7 @@ public static final String AGENT_LEVEL = "AGENT_LEVEL"; public static final String AGENT_LEVEL_REQUIRE = "AGENT_LEVEL_REQUIRE"; public static final String MEMBER_WITHDRAW_NORMAL = "普通提现"; public static final String MEMBER_WITHDRAW_VOUCHER = "凭证提现"; } src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java
@@ -164,6 +164,10 @@ if(scorePrice.compareTo(BigDecimal.ZERO) <= 0){ return new FebsResponse().fail().message("请输入合理的价格"); } BigDecimal voucherPercent = new BigDecimal(hlmVoucherButtonDto.getVoucherPercent()); if(voucherPercent.compareTo(BigDecimal.ZERO) <= 0){ return new FebsResponse().fail().message("请输入合理的价格"); } commonService.updateDataDic( GreenScoreEnum.SCORE_PRICE.getType(), @@ -174,6 +178,11 @@ GreenScoreEnum.VOUCHER_ON_OFF.getType(), GreenScoreEnum.VOUCHER_ON_OFF.getCode(), hlmVoucherButtonDto.getVoucherOnOff()); commonService.updateDataDic( GreenScoreEnum.VOUCHER_PERCENT.getType(), GreenScoreEnum.VOUCHER_PERCENT.getCode(), hlmVoucherButtonDto.getVoucherPercent()); return new FebsResponse().success(); } src/main/java/cc/mrbird/febs/mall/controller/ApiScoreController.java
@@ -64,8 +64,8 @@ @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiScoreVoucherInfoVo.class) }) @GetMapping(value = "/memberScoreVoucher") public FebsResponse memberScoreVoucher() { @GetMapping(value = "/memberScoreVoucherInfo") public FebsResponse memberScoreVoucherInfo() { return new FebsResponse().success().data(scoreService.memberScoreVoucher()); } @@ -73,20 +73,20 @@ @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiScoreVoucherRecordVo.class) }) @PostMapping(value = "/memberScoreVoucher") public FebsResponse memberScoreVoucher(@RequestBody ApiScoreVoucherRecordDto apiScoreVoucherRecordDto) { @PostMapping(value = "/memberScoreVoucherList") public FebsResponse memberScoreVoucherList(@RequestBody ApiScoreVoucherRecordDto apiScoreVoucherRecordDto) { return new FebsResponse().success().data(scoreService.findMallScoreVoucherList(apiScoreVoucherRecordDto)); } @ApiOperation(value = "绿色积分个人信息-买入", notes = "绿色积分个人信息-买入") @PostMapping(value = "/voucherBusinessBuy") public FebsResponse voucherBusinessBuy(@Valid @RequestBody ApiVoucherBusinessDto apiVoucherBusinessDto) { public FebsResponse voucherBusinessBuy( @RequestBody @Validated ApiVoucherBusinessDto apiVoucherBusinessDto) { return scoreService.voucherBusinessBuy(apiVoucherBusinessDto); } @ApiOperation(value = "绿色积分个人信息-卖出", notes = "绿色积分个人信息-卖出") @PostMapping(value = "/voucherBusinessSale") public FebsResponse voucherBusinessSale(@Valid @RequestBody ApiVoucherBusinessDto apiVoucherBusinessDto) { public FebsResponse voucherBusinessSale( @RequestBody @Validated ApiVoucherBusinessDto apiVoucherBusinessDto) { return scoreService.voucherBusinessSale(apiVoucherBusinessDto); } src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java
@@ -325,6 +325,13 @@ String voucherOnOff = ObjectUtil.isEmpty(voucherOnOffDic.getValue()) ? "0" : voucherOnOffDic.getValue(); hlmVoucherButtonDto.setVoucherOnOff(voucherOnOff); } DataDictionaryCustom voucherPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( GreenScoreEnum.VOUCHER_PERCENT.getType(), GreenScoreEnum.VOUCHER_PERCENT.getCode()); if (voucherPercentDic != null) { String voucherPercent = ObjectUtil.isEmpty(voucherPercentDic.getValue()) ? "0" : voucherPercentDic.getValue(); hlmVoucherButtonDto.setVoucherPercent(voucherPercent); } model.addAttribute("hlmVoucherButtonDto", hlmVoucherButtonDto); return FebsUtil.view("modules/system/hlmVoucherButton"); } src/main/java/cc/mrbird/febs/mall/dto/AddMemberBankDto.java
@@ -26,5 +26,8 @@ // 手机号 @ApiModelProperty(value = "手机号") private String phone; // 开户行 @ApiModelProperty(value = "开户行") private String bankName; } src/main/java/cc/mrbird/febs/mall/dto/HlmVoucherButtonDto.java
@@ -14,4 +14,9 @@ * 绿色凭证提现开关 1:开启 2:关闭 */ private String voucherOnOff; /** * 余额提现需要绿色凭证比例 */ private String voucherPercent; } src/main/java/cc/mrbird/febs/mall/dto/UpdateMemberBankDto.java
@@ -28,4 +28,7 @@ // 银行卡号 @ApiModelProperty(value = "数字账号") private String digitalNo; // 开户行 @ApiModelProperty(value = "开户行") private String bankName; } src/main/java/cc/mrbird/febs/mall/dto/WithdrawalDto.java
@@ -22,6 +22,9 @@ @ApiModelProperty(value = "金额") private BigDecimal amount; @ApiModelProperty(value = "绿色积分数量") private BigDecimal voucherCnt; @NotBlank(message = "参数不能为空") @ApiModelProperty(value = "交易密码") private String tradePwd; src/main/java/cc/mrbird/febs/mall/entity/MallMemberBank.java
@@ -16,7 +16,10 @@ private String idCardNum; // 银行卡号 private String bankNo; private String bankName; private String digitalNo; // 手机号 private String phone; private String digitalNo; } src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -7,6 +7,7 @@ import cc.mrbird.febs.common.enumerates.GreenScoreEnum; import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.common.utils.AppContants; import cc.mrbird.febs.common.utils.LoginUserUtil; import cc.mrbird.febs.common.utils.MallUtils; import cc.mrbird.febs.mall.dto.*; @@ -175,24 +176,36 @@ } Long wtihdrawTypeId = mallMemberWithdraw.getWtihdrawTypeId(); MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(wtihdrawTypeId); // 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("提现失败,请稍后查看错误信息一览"); // 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("提现失败,请稍后查看错误信息一览"); // } 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(); @@ -221,6 +234,9 @@ //用户佣金增加对应的余额 iApiMallMemberWalletService.add(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId(),"balance"); if(AppContants.MEMBER_WITHDRAW_VOUCHER.equals(mallMemberWithdraw.getRemark())){ iApiMallMemberWalletService.add(mallMemberWithdraw.getAmountFee(),mallMemberWithdraw.getMemberId(),"voucher_cnt"); } return new FebsResponse().success(); } @@ -632,6 +648,8 @@ if(ObjectUtil.isNotEmpty(mallMemberBank)){ adminMallMemberPaymentVo.setBankNo(mallMemberBank.getBankNo()); adminMallMemberPaymentVo.setBankName(mallMemberBank.getName()); adminMallMemberPaymentVo.setDigitalNo(mallMemberBank.getDigitalNo()); adminMallMemberPaymentVo.setBank(mallMemberBank.getBankName()); } return adminMallMemberPaymentVo; } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -614,6 +614,7 @@ mallMemberBank.setBankNo(updateMemberBankDto.getBankNo()); mallMemberBank.setPhone(updateMemberBankDto.getPhone()); mallMemberBank.setDigitalNo(updateMemberBankDto.getDigitalNo()); mallMemberBank.setBankName(updateMemberBankDto.getBankName()); mallMemberBankMapper.updateById(mallMemberBank); return new FebsResponse().success(); } src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -2,8 +2,10 @@ import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; import cc.mrbird.febs.common.enumerates.FlowTypeEnum; import cc.mrbird.febs.common.enumerates.GreenScoreEnum; import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.common.utils.AppContants; import cc.mrbird.febs.common.utils.LoginUserUtil; import cc.mrbird.febs.common.utils.MallUtils; import cc.mrbird.febs.mall.dto.WithdrawalDto; @@ -71,18 +73,6 @@ 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("提现金额不足"); // } // } // BigDecimal profit = mallMoneyFlowMapper.selectProfitByDateAndMemberId(memberId); MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); // 可提现 BigDecimal canMoney = wallet.getBalance(); @@ -91,7 +81,46 @@ throw new FebsException("提现金额不足"); } BigDecimal serviceFee = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01)); BigDecimal serviceFeePercent = cashOutSettingVo.getServiceFee().multiply(BigDecimal.valueOf(0.01)); BigDecimal serviceFee = serviceFeePercent.multiply(withdrawalDto.getAmount()); String remark = AppContants.MEMBER_WITHDRAW_NORMAL; DataDictionaryCustom voucherOnOffDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( GreenScoreEnum.VOUCHER_ON_OFF.getType(), GreenScoreEnum.VOUCHER_ON_OFF.getCode() ); if(ObjectUtil.isNotEmpty(voucherOnOffDic)){ String voucherOnOff = voucherOnOffDic.getValue(); /** * 绿色凭证提现开关 1:开启 2:关闭 * 验证账户凭证数量 * 不需要手续费 * 减少用户的凭证数量 */ if("1".equals(voucherOnOff)){ BigDecimal voucherCntDto = withdrawalDto.getVoucherCnt(); if(voucherCntDto.compareTo(BigDecimal.ZERO) <= 0){ throw new FebsException("绿色积分不足"); } //提现需要的凭证数量 = 提现金额 * 余额提现需要绿色凭证比例 DataDictionaryCustom voucherPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( GreenScoreEnum.VOUCHER_PERCENT.getType(), GreenScoreEnum.VOUCHER_PERCENT.getCode() ); BigDecimal voucherPercent = new BigDecimal(voucherPercentDic.getValue() == null ? "0" : voucherPercentDic.getValue()); BigDecimal voucherPercentNeed = withdrawalDto.getAmount().multiply(voucherPercent).setScale(2,BigDecimal.ROUND_DOWN); BigDecimal voucherCnt = wallet.getVoucherCnt(); if(voucherCnt.compareTo(voucherPercentNeed) < 0){ throw new FebsException("绿色积分不足"); } walletService.reduce(voucherCntDto, memberId, "voucher_cnt"); serviceFee = voucherCntDto; remark = AppContants.MEMBER_WITHDRAW_VOUCHER; } } walletService.reduce(withdrawalDto.getAmount(), memberId, "balance"); String orderNo = MallUtils.getOrderNum("W"); @@ -100,7 +129,8 @@ withdraw.setMemberId(memberId); withdraw.setAmount(withdrawalDto.getAmount()); withdraw.setStatus(1); withdraw.setAmountFee(serviceFee.multiply(withdrawalDto.getAmount())); withdraw.setAmountFee(serviceFee); withdraw.setRemark(remark); withdraw.setWtihdrawTypeId(mallMemberBank.getId()); this.baseMapper.insert(withdraw); src/main/java/cc/mrbird/febs/mall/vo/AdminMallMemberPaymentVo.java
@@ -37,4 +37,9 @@ * 开户行 */ private String bank; /** * 数字账号 */ private String digitalNo; } src/main/java/cc/mrbird/febs/mall/vo/MemberBankListVo.java
@@ -26,4 +26,7 @@ // 银行卡号 @ApiModelProperty(value = "数字账号") private String digitalNo; // 开户行 @ApiModelProperty(value = "开户行") private String bankName; } src/main/resources/templates/febs/views/modules/mallMember/chargeFlowList.html
@@ -140,7 +140,7 @@ {field: 'bindPhone', 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) }}'}, {field: 'remark', title: '错误信息', minWidth: 150,align:'left'}, {field: 'remark', title: '类型', minWidth: 150,align:'left'}, {field: 'status', title: '状态', templet: function (d) { if (d.status === 1) { src/main/resources/templates/febs/views/modules/mallMember/paymentInfo.html
@@ -66,17 +66,23 @@ <input type="text" name="bankName" class="layui-input" readonly> </div> </div> <!-- <div class="layui-col-lg6">--> <!-- <label class="layui-form-label">开户行:</label>--> <!-- <div class="layui-input-block">--> <!-- <input type="text" name="bank" class="layui-input" readonly>--> <!-- </div>--> <!-- </div>--> <div class="layui-col-lg6"> <label class="layui-form-label">开户行:</label> <div class="layui-input-block"> <input type="text" name="bank" class="layui-input" readonly> </div> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">银行卡号:</label> <div class="layui-input-block"> <input type="text" name="bankNo" class="layui-input" readonly> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">数字账号:</label> <div class="layui-input-block"> <input type="text" name="digitalNo" class="layui-input" readonly> </div> </div> </form> @@ -110,7 +116,8 @@ // "aliQrcode": paymentInfo.aliQrcode, "bankName": paymentInfo.bankName, "bankNo": paymentInfo.bankNo, // "bank": paymentInfo.bank "digitalNo": paymentInfo.digitalNo, "bank": paymentInfo.bank }); } }); src/main/resources/templates/febs/views/modules/system/hlmVoucherButton.html
@@ -17,8 +17,15 @@ <div class="layui-col-lg6"> <label class="layui-form-label febs-form-item-require">需要凭证:</label> <div class="layui-input-block"> <input type="radio" name="voucherOnOff" value="1" title="是" /> <input type="radio" name="voucherOnOff" value="2" title="否" checked /> <input type="radio" name="voucherOnOff" value="1" title="是" lay-filter="hasVoucher"/> <input type="radio" name="voucherOnOff" value="2" title="否" lay-filter="hasVoucher" checked /> </div> </div> <div class="layui-form-item voucher-percent-input febs-hide"> <label class="layui-form-label">凭证比例:</label> <div class="layui-input-block"> <input type="text" name="voucherPercent" placeholder="" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-card-footer"> @@ -81,13 +88,26 @@ }); } form.on('radio(hasVoucher)', function(data){ if (data.value == 2) { $('.voucher-percent-input').hide(); } else { $('.voucher-percent-input').show(); } }); form.render(); function initHlmVoucherButtonValue() { form.val("hlm-voucher-button-form", { "scorePrice": hlmVoucherButton.scorePrice, "voucherOnOff": hlmVoucherButton.voucherOnOff, "voucherPercent": hlmVoucherButton.voucherPercent, }); if (hlmVoucherButton.voucherOnOff == 1) { $(".voucher-percent-input").show(); } } form.on('submit(hlm-voucher-button-submit)', function (data) {