From 047774fc1cf296f992da5bdefc093d09702ea4e4 Mon Sep 17 00:00:00 2001
From: Hentua <wangdoubleone@gmail.com>
Date: Thu, 25 Jan 2024 22:52:23 +0800
Subject: [PATCH] fix
---
src/main/java/cc/mrbird/febs/vip/controller/AdminMallVipConfigController.java | 11 +++
src/main/java/cc/mrbird/febs/vip/vo/VipSettingVo.java | 9 +++
src/main/java/cc/mrbird/febs/mall/service/ICommonService.java | 2
src/main/resources/templates/febs/views/modules/vip/vip-setting.html | 93 +++++++++++++++++++++++++++++++
src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java | 14 ++++
src/main/java/cc/mrbird/febs/vip/controller/ViewVipConfigController.java | 15 +++++
6 files changed, 142 insertions(+), 2 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/service/ICommonService.java b/src/main/java/cc/mrbird/febs/mall/service/ICommonService.java
index 74df42d..afd64f4 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/ICommonService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/ICommonService.java
@@ -19,4 +19,6 @@
void addDataDic(String type, String key, Object value, String description);
+ void addDataDic(String type, String key, Object value, String description, boolean isJson);
+
}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java b/src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java
index 6f2fe47..4f4cd2f 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/CommonService.java
@@ -57,9 +57,19 @@
@Override
public void addDataDic(String type, String code, Object value, String description) {
- DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(type, code);
+ addDataDic(type, code, value, description, true);
+ }
- String data = JSONObject.toJSONString(value);
+ @Override
+ public void addDataDic(String type, String code, Object value, String description, boolean isJson) {
+ DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(type, code);
+ String data = null;
+ if (isJson) {
+ data = JSONObject.toJSONString(value);
+ } else {
+ data = (String) value;
+ }
+
if (dic != null) {
dic.setValue(data);
dataDictionaryCustomMapper.updateById(dic);
diff --git a/src/main/java/cc/mrbird/febs/vip/controller/AdminMallVipConfigController.java b/src/main/java/cc/mrbird/febs/vip/controller/AdminMallVipConfigController.java
index 8906308..d2e334d 100644
--- a/src/main/java/cc/mrbird/febs/vip/controller/AdminMallVipConfigController.java
+++ b/src/main/java/cc/mrbird/febs/vip/controller/AdminMallVipConfigController.java
@@ -3,8 +3,11 @@
import cc.mrbird.febs.common.controller.BaseController;
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
+import cc.mrbird.febs.mall.service.impl.CommonService;
import cc.mrbird.febs.vip.entity.MallVipConfig;
import cc.mrbird.febs.vip.service.IMallVipConfigService;
+import cc.mrbird.febs.vip.vo.VipSettingVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
@@ -21,6 +24,7 @@
public class AdminMallVipConfigController extends BaseController {
private final IMallVipConfigService mallVipConfigService;
+ private final CommonService commonService;
@GetMapping(value = "/list")
public FebsResponse list(QueryRequest request) {
@@ -50,4 +54,11 @@
mallVipConfigService.delVipConfig(id);
return new FebsResponse().success().message("操作成功");
}
+
+ @PostMapping(value = "/vipSetting")
+ public FebsResponse vipSetting(VipSettingVo vipSettingVo) {
+ commonService.addDataDic(DataDictionaryEnum.VIP_DATE.getType(), DataDictionaryEnum.VIP_DATE.getCode(), vipSettingVo.getVipDate(), null, false);
+
+ return new FebsResponse().success();
+ }
}
diff --git a/src/main/java/cc/mrbird/febs/vip/controller/ViewVipConfigController.java b/src/main/java/cc/mrbird/febs/vip/controller/ViewVipConfigController.java
index ac63ffa..5018e70 100644
--- a/src/main/java/cc/mrbird/febs/vip/controller/ViewVipConfigController.java
+++ b/src/main/java/cc/mrbird/febs/vip/controller/ViewVipConfigController.java
@@ -1,9 +1,12 @@
package cc.mrbird.febs.vip.controller;
import cc.mrbird.febs.common.entity.FebsConstant;
+import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
import cc.mrbird.febs.common.utils.FebsUtil;
+import cc.mrbird.febs.mall.entity.DataDictionaryCustom;
import cc.mrbird.febs.mall.entity.MallGoods;
import cc.mrbird.febs.mall.entity.MallGoodsCoupon;
+import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.mall.mapper.MallGoodsCouponMapper;
import cc.mrbird.febs.mall.service.IApiMallGoodsService;
import cc.mrbird.febs.vip.entity.MallVipBenefits;
@@ -12,6 +15,7 @@
import cc.mrbird.febs.vip.service.IMallVipBenefitsService;
import cc.mrbird.febs.vip.service.IMallVipConfigBenefitsService;
import cc.mrbird.febs.vip.service.IMallVipConfigService;
+import cc.mrbird.febs.vip.vo.VipSettingVo;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
@@ -36,6 +40,7 @@
private final MallGoodsCouponMapper mallGoodsCouponMapper;
private final IMallVipConfigService mallVipConfigService;
private final IMallVipConfigBenefitsService mallVipConfigBenefitsService;
+ private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
@GetMapping(value = "/benefitsList")
public String benefitsList() {
@@ -146,4 +151,14 @@
model.addAttribute("configData", vipConfig);
return FebsUtil.view("modules/vip/vipConfig-edit");
}
+
+ @GetMapping(value = "/vipSetting")
+ public String vipSetting(Model model) {
+ DataDictionaryCustom data = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.VIP_DATE.getType(), DataDictionaryEnum.VIP_DATE.getCode());
+ VipSettingVo setting = new VipSettingVo();
+ setting.setVipDate(data.getValue());
+
+ model.addAttribute("vipSetting", setting);
+ return FebsUtil.view("modules/vip/vip-setting");
+ }
}
diff --git a/src/main/java/cc/mrbird/febs/vip/vo/VipSettingVo.java b/src/main/java/cc/mrbird/febs/vip/vo/VipSettingVo.java
new file mode 100644
index 0000000..9689b51
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/vip/vo/VipSettingVo.java
@@ -0,0 +1,9 @@
+package cc.mrbird.febs.vip.vo;
+
+import lombok.Data;
+
+@Data
+public class VipSettingVo {
+
+ private String vipDate;
+}
diff --git a/src/main/resources/templates/febs/views/modules/vip/vip-setting.html b/src/main/resources/templates/febs/views/modules/vip/vip-setting.html
new file mode 100644
index 0000000..05e35e4
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/vip/vip-setting.html
@@ -0,0 +1,93 @@
+<div class="layui-fluid layui-anim febs-anim" id="vip-setting" lay-title="会员设置">
+ <div class="layui-row layui-col-space8 febs-container">
+ <form class="layui-form" action="" lay-filter="vip-setting-form">
+ <div class="layui-card">
+ <div class="layui-card-body">
+ <div class="layui-form-item">
+ <label class="layui-form-label ">会员日:</label>
+ <div class="layui-input-block">
+ <input type="text" name="vipDate" id="vipDate" autocomplete="off" class="layui-input" >
+ </div>
+ </div>
+<!-- <div class="layui-form-item">-->
+<!-- <label class="layui-form-label ">每日提现上限:</label>-->
+<!-- <div class="layui-input-block">-->
+<!-- <input type="text" name="allCashOut" data-th-id="${cashout.allCashOut}"-->
+<!-- lay-verify="number" autocomplete="off" class="layui-input" >-->
+<!-- </div>-->
+<!-- </div>-->
+<!-- <div class="layui-form-item">-->
+<!-- <label class="layui-form-label ">提现手续费:</label>-->
+<!-- <div class="layui-input-block">-->
+<!-- <input type="text" name="serviceFee" data-th-id="${cashout.serviceFee}"-->
+<!-- lay-verify="text" autocomplete="off" class="layui-input" >-->
+<!-- </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="radio" name="workingDays" value="1" title="工作日">-->
+<!-- <input type="radio" name="workingDays" value="2" title="每一天">-->
+<!-- </div>-->
+<!-- </div>-->
+ </div>
+
+ <div class="layui-card-footer">
+ <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="vip-setting-form-submit" id="submit">保存</button>
+ </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', 'validate', 'febs', 'form', 'eleTree', 'laydate'], function () {
+ var $ = layui.jquery,
+ febs = layui.febs,
+ form = layui.form,
+ laydate = layui.laydate,
+ vipSetting = [[${vipSetting}]],
+ validate = layui.validate,
+ $view = $('#vip-setting');
+
+ form.verify(validate);
+
+ initVipSettingValue();
+
+ form.render();
+
+ laydate.render({
+ elem: '#vipDate'
+ ,format: 'MM-dd'
+ });
+
+ function initVipSettingValue() {
+ form.val("vip-setting-form", {
+ "vipDate": vipSetting.vipDate,
+ });
+ }
+
+ form.on('submit(vip-setting-form-submit)', function (data) {
+ console.log(data);
+ febs.post(ctx + 'admin/vip/config/vipSetting', data.field, function (res) {
+ febs.alert.success('设置成功');
+ });
+ window.location.reload();
+ return false;
+ });
+ });
+</script>
\ No newline at end of file
--
Gitblit v1.9.1