From d47ce28eb552612887f9b75c0ffe0d7471d0ab86 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Wed, 04 Jun 2025 15:58:52 +0800
Subject: [PATCH] feat(mall): 新增会员标识下拉框功能

---
 src/main/resources/templates/febs/views/modules/levelView/labelAdd.html                       |   35 +++++++++++
 src/main/resources/templates/febs/views/modules/levelView/labelInfo.html                      |   38 ++++++++++++
 src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelUpdateDto.java              |    4 +
 src/main/java/cc/mrbird/febs/mall/entity/HappyMemberLabel.java                                |    3 +
 src/main/java/cc/mrbird/febs/mall/service/AdminMemberLevelService.java                        |    2 
 src/main/java/cc/mrbird/febs/mall/vo/memberLevel/ApiMemberLabelVo.java                        |    6 ++
 src/main/java/cc/mrbird/febs/mall/controller/memberLevel/AdminHappyMemberLevelController.java |   11 +++
 src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java                          |    2 
 src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelAddDto.java                 |    2 
 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMemberLevelServiceImpl.java               |   31 +++++++++
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java                  |    4 +
 11 files changed, 135 insertions(+), 3 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/memberLevel/AdminHappyMemberLevelController.java b/src/main/java/cc/mrbird/febs/mall/controller/memberLevel/AdminHappyMemberLevelController.java
index 9be99a7..42dbd66 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/memberLevel/AdminHappyMemberLevelController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/memberLevel/AdminHappyMemberLevelController.java
@@ -67,6 +67,17 @@
 
 
     /**
+     * 会员标识-获取
+     * @return
+     */
+    @GetMapping(value = "/parentAll")
+    public FebsResponse parentAll() {
+
+        return adminMemberLevelService.parentAll();
+    }
+
+
+    /**
      * 会员标识-更新
      */
     @PostMapping("labelUpdate")
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelAddDto.java b/src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelAddDto.java
index 988b490..37ee626 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelAddDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelAddDto.java
@@ -21,4 +21,6 @@
     private String iconPng;
 
     private String headerPng;
+
+    private Long parentId;
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelUpdateDto.java b/src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelUpdateDto.java
index 4134d65..6a290cf 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelUpdateDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/memberLevel/AdminMemberLabelUpdateDto.java
@@ -10,6 +10,8 @@
 
     private String name;
 
+    private Integer code;
+
     private Integer upgradeScore;
 
     private BigDecimal minePercent;
@@ -21,4 +23,6 @@
     private String iconPng;
 
     private String headerPng;
+
+    private Long parentId;
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/HappyMemberLabel.java b/src/main/java/cc/mrbird/febs/mall/entity/HappyMemberLabel.java
index 345f994..57accf3 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/HappyMemberLabel.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/HappyMemberLabel.java
@@ -19,6 +19,7 @@
      `content` text COMMENT '宣传内容',
      `icon_png` varchar(200) DEFAULT NULL COMMENT '会员图标',
      `header_png` varchar(200) DEFAULT NULL COMMENT '宣传海报',
+     `parent_id` bigint(20) DEFAULT '0' COMMENT '上级会员标识ID,如果为0,则表示是一级标识',
      */
 
     private String name;
@@ -29,4 +30,6 @@
     private String content;
     private String iconPng;
     private String headerPng;
+    private Long parentId;
+
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/AdminMemberLevelService.java b/src/main/java/cc/mrbird/febs/mall/service/AdminMemberLevelService.java
index 9d21361..4d1359f 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/AdminMemberLevelService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/AdminMemberLevelService.java
@@ -20,6 +20,8 @@
 
     FebsResponse labelAdd(AdminMemberLabelAddDto dto);
 
+    FebsResponse parentAll();
+
     FebsResponse levelUpdate(AdminMemberLevelUpdateDto dto);
 
     FebsResponse labelUpdate(AdminMemberLabelUpdateDto dto);
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMemberLevelServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMemberLevelServiceImpl.java
index 88ee5a0..39d383b 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMemberLevelServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMemberLevelServiceImpl.java
@@ -17,6 +17,7 @@
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
@@ -30,8 +31,7 @@
 @Service
 @RequiredArgsConstructor
 @Transactional
-public class
-AdminMemberLevelServiceImpl extends ServiceImpl<HappyMemberLevelMapper, HappyMemberLevel> implements AdminMemberLevelService {
+public class AdminMemberLevelServiceImpl extends ServiceImpl<HappyMemberLevelMapper, HappyMemberLevel> implements AdminMemberLevelService {
 
     private final HappyMemberLevelMapper happyMemberLevelMapper;
     private final HappySaleLevelMapper happySaleLevelMapper;
@@ -69,8 +69,25 @@
     public FebsResponse labelAdd(AdminMemberLabelAddDto dto) {
         HappyMemberLabel happyMemberLabel = new HappyMemberLabel();
         BeanUtil.copyProperties(dto, happyMemberLabel);
+        Integer code = 0;
+        if(ObjectUtil.isEmpty(dto.getParentId())){
+            code = dto.getCode();
+        }
+        happyMemberLabel.setCode(code);
         happyMemberLabelMapper.insert(happyMemberLabel);
         return new FebsResponse().success().message("操作成功");
+    }
+
+    @Override
+    public FebsResponse parentAll() {
+
+        List<HappyMemberLabel> happyMemberLabels = happyMemberLabelMapper.selectList(
+                Wrappers.lambdaQuery(HappyMemberLabel.class)
+                        .select(HappyMemberLabel::getId, HappyMemberLabel::getName)
+                        .eq(HappyMemberLabel::getParentId, 0)
+                .eq(HappyMemberLabel::getCode,1)
+        );
+        return new FebsResponse().success().data(happyMemberLabels);
     }
 
     @Override
@@ -88,6 +105,16 @@
         HappyMemberLabel happyMemberLabel = happyMemberLabelMapper.selectById(dto.getId());
         if (ObjectUtil.isNotNull(happyMemberLabel)) {
             BeanUtil.copyProperties(dto, happyMemberLabel);
+
+            Integer code = 0;
+            Long parentId = 0L;
+            if(ObjectUtil.isEmpty(dto.getParentId())){
+                code = dto.getCode();
+            }else{
+                parentId = dto.getParentId();
+            }
+            happyMemberLabel.setCode(code);
+            happyMemberLabel.setParentId(parentId);
             happyMemberLabelMapper.updateById(happyMemberLabel);
         }
         return new FebsResponse().success().message("操作成功");
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
index b5027d5..b3c59e8 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -1735,12 +1735,14 @@
             Set<Long> collect = happyMemberLabelRecords.stream().map(HappyMemberLabelRecord::getLabelId).collect(Collectors.toSet());
             List<HappyMemberLabel> happyMemberLabels = happyMemberLabelMapper.selectList(
                     new LambdaQueryWrapper<HappyMemberLabel>()
-                            .select(HappyMemberLabel::getIconPng, HappyMemberLabel::getName, HappyMemberLabel::getContent, HappyMemberLabel::getHeaderPng)
+                            .select( HappyMemberLabel::getId, HappyMemberLabel::getCode,HappyMemberLabel::getIconPng, HappyMemberLabel::getName, HappyMemberLabel::getContent, HappyMemberLabel::getHeaderPng)
                             .in(HappyMemberLabel::getId, collect)
             );
             if(CollUtil.isNotEmpty(happyMemberLabels)){
                 for (HappyMemberLabel happyMemberLabel : happyMemberLabels) {
                     ApiMemberLabelVo apiMemberLabelVo = new ApiMemberLabelVo();
+                    apiMemberLabelVo.setId(happyMemberLabel.getId());
+                    apiMemberLabelVo.setCode(happyMemberLabel.getCode());
                     apiMemberLabelVo.setName(happyMemberLabel.getName());
                     apiMemberLabelVo.setContent(happyMemberLabel.getContent());
                     apiMemberLabelVo.setHeaderPng(happyMemberLabel.getHeaderPng());
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/memberLevel/ApiMemberLabelVo.java b/src/main/java/cc/mrbird/febs/mall/vo/memberLevel/ApiMemberLabelVo.java
index 1633723..c4a2191 100644
--- a/src/main/java/cc/mrbird/febs/mall/vo/memberLevel/ApiMemberLabelVo.java
+++ b/src/main/java/cc/mrbird/febs/mall/vo/memberLevel/ApiMemberLabelVo.java
@@ -8,9 +8,15 @@
 @ApiModel(value = "ApiMemberLabelVo", description = "商城用户信息返回类")
 public class ApiMemberLabelVo {
 
+    @ApiModelProperty(value = "ID")
+    private Long id;
+
     @ApiModelProperty(value = "名称")
     private String name;
 
+    @ApiModelProperty(value = "是否显示我的团 0-不显示 1-显示")
+    private Integer code;
+
     @ApiModelProperty(value = "说明")
     private String content;
 
diff --git a/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java b/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java
index 6a4705b..eabf307 100644
--- a/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java
@@ -439,8 +439,10 @@
      * @return
      */
     //图片上传路径
+            // todo 上线修改图片上传路径
     public  static  final String IMG_UPLOAD_PATH="/home/javaweb/webresource/upload/wxcode";
     public  String generateAcode(String scene,String path,String imgName,String width, Integer type){
+            // todo 上线修改图片上传路径
         String urlPrefix="https://hcres.csxuncong.com/wxcode";
         String imgPath=IMG_UPLOAD_PATH+imgName;
         if(!FileUtil.exist(imgPath)){
diff --git a/src/main/resources/templates/febs/views/modules/levelView/labelAdd.html b/src/main/resources/templates/febs/views/modules/levelView/labelAdd.html
index 05e2415..de92044 100644
--- a/src/main/resources/templates/febs/views/modules/levelView/labelAdd.html
+++ b/src/main/resources/templates/febs/views/modules/levelView/labelAdd.html
@@ -18,6 +18,28 @@
                                         </div>
                                     </div>
                                 </div>
+
+                                <div class="layui-row layui-col-space10 layui-form-item">
+                                    <div class="layui-col-lg6">
+                                        <label class="layui-form-label febs-form-item-require">新增权限:</label>
+                                        <div class="layui-input-block">
+                                            <input type="radio" name="code" value="1" title="是">
+                                            <input type="radio" name="code" value="0" title="否" checked="">
+                                        </div>
+                                        <div class="layui-form-mid layui-word-aux">是否允许添加团员,只允许没有父级标识的标签可选择是。</div>
+                                    </div>
+                                </div>
+
+                                <div class="layui-row layui-col-space10 layui-form-item">
+                                    <div class="layui-col-lg6">
+                                        <label class="layui-form-label">父级标识:</label>
+                                        <div class="layui-input-block">
+                                            <select name="parentId" class="parentId-type">
+                                                <option value="">请选择</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
                                 <div class="layui-row layui-col-space10 layui-form-item">
                                     <div class="layui-col-lg6">
                                         <label class="layui-form-label febs-form-item-require">会员标识:</label>
@@ -141,6 +163,19 @@
 
         form.render();
 
+        //(下拉框)
+        $.get(ctx + 'admin/level/parentAll', function (res) {
+            var data = res.data;
+            for (let k in data)
+            {
+                $(".parentId-type").append("<option value='" + data[k].id + "'>" + data[k].name + "</option>");
+            }
+            layui.use('form', function () {
+                var form = layui.form;
+                form.render();
+            });
+        });
+
         const E = window.wangEditor;
         const editor = new E('#memberLevel-toolbar-container', '#memberLevel-text-container'); // 传入两个元素
         editor.config.showLinkImg = false;
diff --git a/src/main/resources/templates/febs/views/modules/levelView/labelInfo.html b/src/main/resources/templates/febs/views/modules/levelView/labelInfo.html
index d2980af..f35aadb 100644
--- a/src/main/resources/templates/febs/views/modules/levelView/labelInfo.html
+++ b/src/main/resources/templates/febs/views/modules/levelView/labelInfo.html
@@ -20,6 +20,28 @@
                                         </div>
                                     </div>
                                 </div>
+
+                                <div class="layui-row layui-col-space10 layui-form-item">
+                                    <div class="layui-col-lg6">
+                                        <label class="layui-form-label febs-form-item-require">新增权限:</label>
+                                        <div class="layui-input-block">
+                                            <input type="radio" name="code" value="1" title="是">
+                                            <input type="radio" name="code" value="0" title="否" checked="">
+                                        </div>
+                                        <div class="layui-form-mid layui-word-aux">是否允许添加团员,只允许没有父级标识的标签可选择是。</div>
+                                    </div>
+                                </div>
+
+                                <div class="layui-row layui-col-space10 layui-form-item">
+                                    <div class="layui-col-lg6">
+                                        <label class="layui-form-label">父级标识:</label>
+                                        <div class="layui-input-block">
+                                            <select name="parentId" class="parentId-type"  id="parentId">
+                                                <option value="">请选择</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
                                 <div class="layui-row layui-col-space10 layui-form-item">
                                     <div class="layui-col-lg6">
                                         <label class="layui-form-label febs-form-item-require">会员标识:</label>
@@ -202,6 +224,20 @@
         });
 
         form.render();
+
+        //(下拉框)
+        $.get(ctx + 'admin/level/parentAll', function (res) {
+            var data = res.data;
+            for (let k in data)
+            {
+                $(".parentId-type").append("<option value='" + data[k].id + "'>" + data[k].name + "</option>");
+            }
+            layui.use('form', function () {
+                var form = layui.form;
+                $("#parentId").val(happyMemberLabel.parentId)
+                form.render();
+            });
+        });
         inithappyMemberLabel();
 
         formSelects.render();
@@ -214,6 +250,8 @@
                 "upgradeScore": happyMemberLabel.upgradeScore,
                 "minePercent": happyMemberLabel.minePercent,
                 "otherPercent": happyMemberLabel.otherPercent,
+                "parentId": happyMemberLabel.parentId,
+                "code": happyMemberLabel.code,
             });
 
 

--
Gitblit v1.9.1