From 5ed10e400440b46f3427613984a84c978a1ecd89 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 06 Apr 2023 17:41:55 +0800 Subject: [PATCH] 测试环境 --- src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java | 22 ++-- src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java | 41 ++++++++ src/main/java/cc/mrbird/febs/mall/vo/AdminPerkSetVo.java | 34 ++++++ src/main/resources/templates/febs/views/modules/system/hlmVoucherButton.html | 121 ++++++++++++++++++++++++ src/main/resources/templates/febs/views/modules/system/perkSet.html | 62 +++++++++--- 5 files changed, 255 insertions(+), 25 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java index aa09f98..fac74ac 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewSystemController.java @@ -4,6 +4,7 @@ import cc.mrbird.febs.common.enumerates.AgentLevelEnum; import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; import cc.mrbird.febs.common.enumerates.OrderPayMethodEnum; +import cc.mrbird.febs.common.enumerates.PerkEnum; import cc.mrbird.febs.common.service.ValidateCodeService; import cc.mrbird.febs.common.utils.FebsUtil; import cc.mrbird.febs.common.utils.RedisUtils; @@ -13,6 +14,7 @@ import cc.mrbird.febs.mall.entity.DataDictionaryCustom; import cc.mrbird.febs.mall.entity.MallMember; import cc.mrbird.febs.mall.mapper.*; +import cc.mrbird.febs.mall.vo.AdminPerkSetVo; import cc.mrbird.febs.monitor.service.ILoginLogService; import cc.mrbird.febs.system.service.IUserService; import cn.hutool.core.date.DateUtil; @@ -120,4 +122,43 @@ model.addAttribute("indexData", data); return FebsUtil.view("modules/system/indexData"); } + + @GetMapping("perkSet") + @RequiresPermissions("perkSet:view") + public String perkSet(Model model) { + AdminPerkSetVo adminPerkSetVo = new AdminPerkSetVo(); + DataDictionaryCustom buySetMealPerkPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( + PerkEnum.BUY_SET_MEAL_PERK_PERCENT.getType(), + PerkEnum.BUY_SET_MEAL_PERK_PERCENT.getCode()); + if (buySetMealPerkPercentDic != null) { + adminPerkSetVo.setBuySetMealPerkPercent(buySetMealPerkPercentDic.getValue()); + } + DataDictionaryCustom directCashPerkPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( + PerkEnum.DIRECT_CASH_PERK_PERCENT.getType(), + PerkEnum.DIRECT_CASH_PERK_PERCENT.getCode()); + if (directCashPerkPercentDic != null) { + adminPerkSetVo.setDirectCashPerkPercent(directCashPerkPercentDic.getValue()); + } + DataDictionaryCustom directScorePerkPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( + PerkEnum.DIRECT_SCORE_PERK_PERCENT.getType(), + PerkEnum.DIRECT_SCORE_PERK_PERCENT.getCode()); + if (directScorePerkPercentDic != null) { + adminPerkSetVo.setDirectScorePerkPercent(directScorePerkPercentDic.getValue()); + } + DataDictionaryCustom directorCashPerkPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( + PerkEnum.DIRECTOR_CASH_PERK_PERCENT.getType(), + PerkEnum.DIRECTOR_CASH_PERK_PERCENT.getCode()); + if (directorCashPerkPercentDic != null) { + adminPerkSetVo.setDirectorCashPerkPercent(directorCashPerkPercentDic.getValue()); + } + DataDictionaryCustom partnerCashPerkPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( + PerkEnum.PARTNER_CASH_PERK_PERCENT.getType(), + PerkEnum.PARTNER_CASH_PERK_PERCENT.getCode()); + if (partnerCashPerkPercentDic != null) { + adminPerkSetVo.setPartnerCashPerkPercent(partnerCashPerkPercentDic.getValue()); + } + + model.addAttribute("adminPerkSet", adminPerkSetVo); + return FebsUtil.view("modules/system/perkSet"); + } } diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java index 7d568b7..0256d1d 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java @@ -272,16 +272,18 @@ BigDecimal perkEnumDicPercent = new BigDecimal(perkEnumDic.getValue() == null ? "0" : perkEnumDic.getValue()); //获得数量 BigDecimal perkEnumDicPercentPerk = perkEnumDicPercent.multiply(AppContants.PERCENTAGE).multiply(amountTC).setScale(2, BigDecimal.ROUND_DOWN); - //增加 - iApiMallMemberWalletService.add(perkEnumDicPercentPerk,memberId,walletField); - //增加一个流水记录 - mallMoneyFlowService.addMoneyFlow( - memberId, - perkEnumDicPercentPerk, - type, - orderNo, - flowType, - AppContants.IS_RETURN_YES); + if(perkEnumDicPercentPerk.compareTo(BigDecimal.ZERO) > 0){ + //增加 + iApiMallMemberWalletService.add(perkEnumDicPercentPerk,memberId,walletField); + //增加一个流水记录 + mallMoneyFlowService.addMoneyFlow( + memberId, + perkEnumDicPercentPerk, + type, + orderNo, + flowType, + AppContants.IS_RETURN_YES); + } } } diff --git a/src/main/java/cc/mrbird/febs/mall/vo/AdminPerkSetVo.java b/src/main/java/cc/mrbird/febs/mall/vo/AdminPerkSetVo.java new file mode 100644 index 0000000..a2064e1 --- /dev/null +++ b/src/main/java/cc/mrbird/febs/mall/vo/AdminPerkSetVo.java @@ -0,0 +1,34 @@ +package cc.mrbird.febs.mall.vo; + +import lombok.Data; + +@Data +public class AdminPerkSetVo { + + /** + * 购买套餐,给购买人固定比例的积分 + * BUY_SET_MEAL_PERK_PERCENT + */ + private String buySetMealPerkPercent; + /** + * 直推固定比例 现金比例 + * DIRECT_CASH_PERK_PERCENT + */ + private String directCashPerkPercent; + /** + * 直推固定比例 积分比例 + * DIRECT_SCORE_PERK_PERCENT + */ + private String directScorePerkPercent; + /** + * 合伙人享全公司入单分红5%加权(现金) + * PARTNER_CASH_PERK_PERCENT + */ + private String partnerCashPerkPercent; + /** + * 董事享受全公司入单分红2%加权(现金) + * DIRECTOR_CASH_PERK_PERCENT + */ + private String directorCashPerkPercent; + +} diff --git a/src/main/resources/templates/febs/views/modules/system/hlmVoucherButton.html b/src/main/resources/templates/febs/views/modules/system/hlmVoucherButton.html new file mode 100644 index 0000000..bb73368 --- /dev/null +++ b/src/main/resources/templates/febs/views/modules/system/hlmVoucherButton.html @@ -0,0 +1,121 @@ +<div class="layui-fluid layui-anim febs-anim" id="hlm-voucher-button" lay-title="一键卖出"> + <div class="layui-row layui-col-space8 febs-container"> + <form class="layui-form" action="" lay-filter="hlm-voucher-button-form"> + <div class="layui-card"> + <div class="layui-card-body"> + <blockquote class="layui-elem-quote blue-border">绿色积分凭证</blockquote> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label febs-form-item-require">价格:</label> + <div class="layui-form-mid layui-word-aux">当前价格:</div> + <div class="layui-input-inline"> + <input type="text" name="scorePrice" lay-verify="required" placeholder="请输入数字" autocomplete="off" class="layui-input"> + </div> + </div> + </div> + <blockquote class="layui-elem-quote blue-border">提现设置,提现时,是否需要凭证</blockquote> + <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="是" 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"> + <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="hlm-voucher-button-submit" id="submit">保存</button> + <div class="layui-btn layui-btn-warm table-action" id="voucherButton"> + 确认一键卖出 + </div> + </div> + <div class="layui-card-footer"> + </div> + </div> + </div> + </form> + </div> +</div> +<style> + .layui-form-label { + width: 120px; + } + + .layui-form-item .layui-input-block { + margin-left: 150px; + } + + .layui-table-form .layui-form-item { + margin-bottom: 20px !important; + } +</style> + +<script data-th-inline="javascript" type="text/javascript"> + layui.use(['dropdown', 'jquery', 'febs', 'form', 'eleTree'], function () { + var $ = layui.jquery, + febs = layui.febs, + form = layui.form, + $view = $('#hlm-voucher-button'), + hlmVoucherButton = [[${hlmVoucherButtonDto}]], + $voucherButton = $view.find('#voucherButton'), + $view = $('#hlm-voucher-button'); + + form.verify({ + integer: [ + /^[1-9]\d*$/ + , '只能输入正整数' + ] + }); + + initHlmVoucherButtonValue(); + + $voucherButton.on('click', function () { + febs.modal.confirm('确认一键卖出', '点击【确定】,即强制卖出所有账户的一半积分凭证?', function () { + selaHalfVoucher(); + }); + }); + + + function selaHalfVoucher() { + febs.post(ctx + 'admin/system/selaHalfVoucher', null, function (res) { + febs.alert.success('设置成功'); + return ; + }); + } + + 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) { + febs.post(ctx + 'admin/system/hlmVoucherButton', data.field, function (res) { + febs.alert.success('设置成功'); + return ; + }); + return false; + }); + }); +</script> \ No newline at end of file diff --git a/src/main/resources/templates/febs/views/modules/system/perkSet.html b/src/main/resources/templates/febs/views/modules/system/perkSet.html index a5a8f86..939e89d 100644 --- a/src/main/resources/templates/febs/views/modules/system/perkSet.html +++ b/src/main/resources/templates/febs/views/modules/system/perkSet.html @@ -3,21 +3,50 @@ <form class="layui-form" action="" lay-filter="perk-set-form"> <div class="layui-card"> <div class="layui-card-body"> + <blockquote class="layui-elem-quote blue-border">补贴比例设置(比例为百分比,例如:20,即获得订单中对应金额*20%的积分。)</blockquote> <div class="layui-form-item"> - <label class="layui-form-label ">增加到积分池比例:</label> - <div class="layui-input-block"> - <input type="text" name="everydayRatio" data-th-id="${scorePoor.everydayRatio}" - lay-verify="number" autocomplete="off" class="layui-input" > + <div class="layui-inline"> + <label class="layui-form-label febs-form-item-require">购买人:</label> + <div class="layui-form-mid layui-word-aux">获得【积分】比例:</div> + <div class="layui-input-inline"> + <input type="text" name="buySetMealPerkPercent" lay-verify="required" placeholder="请输入数字" autocomplete="off" class="layui-input"> + </div> + <div class="layui-form-mid layui-word-aux">%。</div> </div> - <div class="layui-word-aux" style="margin-left: 150px;">【填写整数】每日订单金额的百分之几,增加到积分池:直接输入百分比,例如25%,直接输入25</div> </div> <div class="layui-form-item"> - <label class="layui-form-label ">每日平分百分比:</label> - <div class="layui-input-block"> - <input type="text" name="dividEquallyRatio" data-th-id="${scorePoor.dividEquallyRatio}" - lay-verify="number" autocomplete="off" class="layui-input" > + <div class="layui-inline"> + <label class="layui-form-label febs-form-item-require">直推:</label> + <div class="layui-form-mid layui-word-aux">获得【现金】比例:</div> + <div class="layui-input-inline"> + <input type="text" name="directCashPerkPercent" lay-verify="required" placeholder="请输入数字" autocomplete="off" class="layui-input"> + </div> + <div class="layui-form-mid layui-word-aux">%,获得【积分】比例:</div> + <div class="layui-input-inline"> + <input type="text" name="directScorePerkPercent" lay-verify="required" placeholder="请输入数字" autocomplete="off" class="layui-input"> + </div> + <div class="layui-form-mid layui-word-aux">%。</div> </div> - <div class="layui-word-aux" style="margin-left: 150px;">【填写整数】积分池每日平分百分比:直接输入百分比,例如25%,直接输入25</div> + </div> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label febs-form-item-require">合伙人:</label> + <div class="layui-form-mid layui-word-aux">获得【现金】比例:</div> + <div class="layui-input-inline"> + <input type="text" name="partnerCashPerkPercent" lay-verify="required" placeholder="请输入数字" autocomplete="off" class="layui-input"> + </div> + <div class="layui-form-mid layui-word-aux">%。</div> + </div> + </div> + <div class="layui-form-item"> + <div class="layui-inline"> + <label class="layui-form-label febs-form-item-require">董事:</label> + <div class="layui-form-mid layui-word-aux">获得【现金】比例:</div> + <div class="layui-input-inline"> + <input type="text" name="directorCashPerkPercent" lay-verify="required" placeholder="请输入数字" autocomplete="off" class="layui-input"> + </div> + <div class="layui-form-mid layui-word-aux">%。</div> + </div> </div> </div> @@ -46,20 +75,23 @@ var $ = layui.jquery, febs = layui.febs, form = layui.form, - scorePoor = [[${scorePoor}]], + adminPerkSet = [[${adminPerkSet}]], validate = layui.validate, $view = $('#perk-set'); form.verify(validate); - initCashoutValue(); + initPerkSetValue(); form.render(); - function initCashoutValue() { + function initPerkSetValue() { form.val("perk-set-form", { - "everydayRatio": scorePoor.everydayRatio, - "dividEquallyRatio": scorePoor.dividEquallyRatio + "buySetMealPerkPercent": adminPerkSet.buySetMealPerkPercent, + "directCashPerkPercent": adminPerkSet.directCashPerkPercent, + "directScorePerkPercent": adminPerkSet.directScorePerkPercent, + "partnerCashPerkPercent": adminPerkSet.partnerCashPerkPercent, + "directorCashPerkPercent": adminPerkSet.directorCashPerkPercent }); } -- Gitblit v1.9.1