src/main/java/cc/mrbird/febs/common/enumerates/DataDictionaryEnum.java
@@ -8,6 +8,8 @@ //微信订阅模板ID, // 微信订单通知 // WX_TEMPLATE_ID_ONE("WX_TEMPLATE", "WX_TEMPLATE_ID_ONE"), // 充值金额 CHARGE_AMOUNT("CHARGE_SET", "CHARGE_AMOUNT"), // 赠送金额 GIVE_AMOUNT("CHARGE_SET", "GIVE_AMOUNT"), // 活动公告内容 src/main/java/cc/mrbird/febs/mall/controller/AdminSystemController.java
@@ -76,6 +76,12 @@ return new FebsResponse().fail().message("请刷新页面重试"); } DataDictionaryCustom chargeAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.CHARGE_AMOUNT.getType(), DataDictionaryEnum.CHARGE_AMOUNT.getCode()); if(ObjectUtil.isEmpty(chargeAmountDic)){ return new FebsResponse().fail().message("请刷新页面重试"); } String giveState = adminAgentAmountDto.getGiveState(); if(1 == Integer.parseInt(giveState)){ if(ObjectUtil.isEmpty(adminAgentAmountDto.getActivityBulletin())){ @@ -86,6 +92,12 @@ } if(BigDecimal.ZERO.compareTo(new BigDecimal(adminAgentAmountDto.getGiveAmount())) > 0){ return new FebsResponse().fail().message("请输入正确的赠送金额"); } if(ObjectUtil.isEmpty(adminAgentAmountDto.getChargeAmount())){ return new FebsResponse().fail().message("请输入正确的充值金额"); } if(BigDecimal.ZERO.compareTo(new BigDecimal(adminAgentAmountDto.getChargeAmount())) > 0){ return new FebsResponse().fail().message("请输入正确的充值金额"); } } @@ -101,6 +113,9 @@ giveAmountDic.setValue(adminAgentAmountDto.getGiveAmount()); dataDictionaryCustomMapper.updateById(giveAmountDic); chargeAmountDic.setValue(adminAgentAmountDto.getChargeAmount()); dataDictionaryCustomMapper.updateById(chargeAmountDic); return new FebsResponse().success().message("操作成功"); } src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java
@@ -52,6 +52,8 @@ DataDictionaryEnum.ACTIVITY_BULLETIN.getCode()); DataDictionaryCustom giveAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.GIVE_AMOUNT.getType(), DataDictionaryEnum.GIVE_AMOUNT.getCode()); DataDictionaryCustom chargeAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.CHARGE_AMOUNT.getType(), DataDictionaryEnum.CHARGE_AMOUNT.getCode()); AdminAgentAmountDto adminAgentAmountDto = new AdminAgentAmountDto(); if (dic != null) { adminAgentAmountDto.setAgentAmountValue(dic.getValue()); @@ -65,6 +67,9 @@ if (giveAmountDic != null) { adminAgentAmountDto.setGiveAmount(giveAmountDic.getValue()); } if (chargeAmountDic != null) { adminAgentAmountDto.setChargeAmount(chargeAmountDic.getValue()); } model.addAttribute("agentAmountSet", adminAgentAmountDto); return FebsUtil.view("modules/system/agentAmountSet"); } src/main/java/cc/mrbird/febs/mall/dto/AdminAgentAmountDto.java
@@ -12,4 +12,5 @@ private String giveState; private String activityBulletin; private String giveAmount; private String chargeAmount; } src/main/java/cc/mrbird/febs/pay/controller/XcxPayController.java
@@ -137,6 +137,7 @@ if (ObjectUtil.isNotEmpty(mallMoneyFlow)) { log.debug("检查支付金额payMoney={},mallMoneyFlow.getPayMoney()={}", payMoney, mallMoneyFlow.getAmount()); //合伙人申请的充值,要更新会员状态为FIRST_LEVEL if(2 == type){ mallMemberService.updateMemberAgent(memberId); } @@ -154,23 +155,39 @@ DataDictionaryCustom giveAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.GIVE_AMOUNT.getType(), DataDictionaryEnum.GIVE_AMOUNT.getCode()); if(ObjectUtil.isNotEmpty(giveStateDic) && "1".equals(giveStateDic.getValue()) && ObjectUtil.isNotEmpty(giveAmountDic)){ DataDictionaryCustom chargeAmountDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( DataDictionaryEnum.CHARGE_AMOUNT.getType(), DataDictionaryEnum.CHARGE_AMOUNT.getCode()); /** * 普通充值 * 开启了充值赠送 * 系统设置的赠送金额和充值金额不为空 * 充值金额大于等于系统设置的充值金额 */ if(1 == type && ObjectUtil.isNotEmpty(giveStateDic) && "1".equals(giveStateDic.getValue()) && ObjectUtil.isNotEmpty(giveAmountDic) && ObjectUtil.isNotEmpty(chargeAmountDic)){ BigDecimal giveAmount = ObjectUtil.isEmpty(giveAmountDic.getValue()) ? BigDecimal.ZERO : new BigDecimal(giveAmountDic.getValue()).abs().setScale(2,BigDecimal.ROUND_DOWN); BigDecimal chargeAmount = ObjectUtil.isEmpty(chargeAmountDic.getValue()) ? BigDecimal.ZERO : new BigDecimal(chargeAmountDic.getValue()).abs().setScale(2,BigDecimal.ROUND_DOWN); if(payMoney.compareTo(chargeAmount) >= 0){ mallMoneyFlowService.addMoneyFlow( memberId, giveAmount, MoneyFlowTypeEnum.RECHARGE_SEND.getValue(), rechargeNo+"ZS", FlowTypeEnum.BALANCE.getValue(), "充值赠送金额", 2); mallMoneyFlowService.addMoneyFlow( memberId, giveAmount, MoneyFlowTypeEnum.RECHARGE_SEND.getValue(), rechargeNo+"ZS", FlowTypeEnum.BALANCE.getValue(), "充值赠送金额", 2); memberWalletService.addBalance(giveAmount,memberId); memberWalletService.addBalance(giveAmount,memberId); } } RechargeWalletMessageSendDto rechargeWalletMessageSendDto = new RechargeWalletMessageSendDto(); src/main/resources/templates/febs/views/modules/system/agentAmountSet.html
@@ -4,6 +4,7 @@ <div class="layui-card"> <div class="layui-card-body"> <div class="layui-form-item"> <blockquote class="layui-elem-quote blue-border">合伙人充值设置</blockquote> <label class="layui-form-label ">充值金额:</label> <div class="layui-input-block"> <input type="text" name="agentAmountValue" @@ -13,6 +14,7 @@ </div> <div class="layui-form-item"> <blockquote class="layui-elem-quote blue-border">普通充值赠送金额设置</blockquote> <label class="layui-form-label">充值送金额:</label> <div class="layui-input-block"> <input type="radio" name="giveState" value="1" title="开启" lay-filter="giveStateOpen" /> @@ -27,13 +29,22 @@ </div> </div> <div class="layui-form-item chargeAmount-input febs-hide"> <label class="layui-form-label ">充值金额:</label> <div class="layui-input-block"> <input id="chargeAmount" type="text" name="chargeAmount" lay-verify="" autocomplete="off" class="layui-input" > </div> <div class="layui-word-aux" style="margin-left: 150px;">普通充值的金额大于等于设置的【充值金额】,则额外赠送系统设置的【赠送金额】</div> </div> <div class="layui-form-item giveAmount-input febs-hide"> <label class="layui-form-label ">赠送金额:</label> <div class="layui-input-block"> <input id="giveAmount" type="text" name="giveAmount" lay-verify="" autocomplete="off" class="layui-input" > </div> <div class="layui-word-aux" style="margin-left: 150px;">赠送的金额数目</div> <div class="layui-word-aux" style="margin-left: 150px;">普通充值额外赠送的金额</div> </div> </div> @@ -78,14 +89,17 @@ "giveState": agentAmountSet.giveState, "activityBulletin": agentAmountSet.activityBulletin, "giveAmount": agentAmountSet.giveAmount, "chargeAmount": agentAmountSet.chargeAmount, }); if (agentAmountSet.giveState == 1) { $('.activityBulletin-input').show(); $('.giveAmount-input').show(); $('.chargeAmount-input').show(); } else { $('.activityBulletin-input').hide(); $('.giveAmount-input').hide(); $('.chargeAmount-input').hide(); } } //页面radio切换显示隐藏 @@ -93,11 +107,14 @@ if (data.value == 1) { $('.activityBulletin-input').show(); $('.giveAmount-input').show(); $('.chargeAmount-input').show(); } else { $('.activityBulletin-input').hide(); $('.giveAmount-input').hide(); $('.chargeAmount-input').hide(); document.getElementById('activityBulletin').value = ""; document.getElementById('giveAmount').value = ""; document.getElementById('chargeAmount').value = ""; } });