From 1fc05375474ca0393d6c29fd2ab1d182c65a3eaa Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期三, 07 六月 2023 17:20:18 +0800
Subject: [PATCH] 基础配置

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtActivenessVo.java                   |   28 ++
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtShopConfigEditDto.java             |   28 ++
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/AdvertService.java                |    9 
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/ActivenessService.java            |    9 
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java   |   29 ++
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtCustomConfigVo.java                 |   89 ++++++
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/CustomConfigService.java          |   55 +++
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java       |   14 +
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtMemberConfigEditDto.java           |   31 ++
 ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/ConfigEnum.java                     |   24 +
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/pojo/config/Advert.java                   |   18 
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtOtherConfigEditDto.java            |   37 ++
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java |  407 ++++++++++++++++++++++++++++++
 13 files changed, 741 insertions(+), 37 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/ConfigEnum.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/ConfigEnum.java
index 186c7ba..eada09c 100644
--- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/ConfigEnum.java
+++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/ConfigEnum.java
@@ -18,23 +18,25 @@
 @Getter
 public enum ConfigEnum {
 
-    PLATFORM_SERVICE_PHONE("PLATFORM_SERVICE_PHONE", 2,"客服电话"),
-    SHOP_EMERGENCY_DEGREE("SHOP_EMERGENCY_DEGREE", 2,"合作商任务紧急程度"),
-    SHOP_FOLLOW_TYPE("SHOP_FOLLOW_TYPE", 2,"合作商跟进类型"),
-    SHOP_CUSTOM_STATUS("SHOP_CUSTOM_STATUS", 2,"合作商状态"),
-    SHOP_SOURCE_CHANNEL("SHOP_SOURCE_CHANNEL", 2,"来源渠道"),
+    PLATFORM_SERVICE_PHONE("PLATFORM_SERVICE_PHONE", 1,"客服电话"),
+    SHOP_EMERGENCY_DEGREE("SHOP_EMERGENCY_DEGREE", 3,"合作商任务紧急程度"),
+    SHOP_FOLLOW_TYPE("SHOP_FOLLOW_TYPE", 3,"合作商跟进类型"),
+    SHOP_CUSTOM_STATUS("SHOP_CUSTOM_STATUS", 3,"合作商状态"),
+    SHOP_SOURCE_CHANNEL("SHOP_SOURCE_CHANNEL", 3,"来源渠道"),
     SHARE_INTEGRAL("SHARE_INTEGRAL", 2,"分享小程序可获得积分"),
     SUGGEST_PLATFORM_INTEGRAL("SUGGEST_PLATFORM_INTEGRAL", 2,"平台建议可获得积分"),
     SIGN_IN_INTEGRAL("SIGN_IN_INTEGRAL", 2,"每日签到可获得积分"),
     SUGGEST_SHOP_INTEGRAL("SUGGEST_SHOP_INTEGRAL", 2,"门店建议可获得积分"),
     ORDER_AUTO_CANCEL_TIME("ORDER_AUTO_CANCEL_TIME", 2,"C端订单自动取消时间"),
     PAY_MONEY_INTEGRAL("PAY_MONEY_INTEGRAL", 2,"购物满1元可获得积分"),
-    MEMBER_SOURCE_CHANNEL("MEMBER_SOURCE_CHANNEL", 2,"会员来源"),
-    MEMBER_CHARACTER("MEMBER_CHARACTER", 2,"会员性格"),
-    MEMBER_LEVEL("MEMBER_LEVEL", 2,"会员等级"),
-    MEMBER_TYPE("MEMBER_TYPE", 2,"会员类型"),
-    NURSE_PROBLEM("NURSE_PROBLEM", 2,"调理问题"),
-    HOME_SLOGAN("HOME_SLOGAN", 2,"首页广告语");
+    MEMBER_SOURCE_CHANNEL("MEMBER_SOURCE_CHANNEL", 4,"会员来源"),
+    MEMBER_CHARACTER("MEMBER_CHARACTER", 4,"会员性格"),
+    MEMBER_LEVEL("MEMBER_LEVEL", 4,"会员等级"),
+    MEMBER_TYPE("MEMBER_TYPE", 4,"会员类型"),
+    NURSE_PROBLEM("NURSE_PROBLEM", 4,"调理问题"),
+    HOME_STYLE("HOME_STYLE", 2,"首页风格"),
+    HOME_SLOGAN("HOME_SLOGAN", 1,"首页广告语"),
+    HOME_LOGO("HOME_LOGO", 1,"首页logo");
 
 
 
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java
index 7b9db55..2524734 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/management/MgtConfigController.java
@@ -48,6 +48,7 @@
     @Resource
     private QuickEntryService quickEntryService;
 
+
     @RequestMapping(value = "/editCooperation", method = RequestMethod.POST)
     @ApiOperation(value = "修改申请合作")
     public R editCooperation(@RequestBody MgtCooperationEditDto mgtCooperationEditDto) {
@@ -191,4 +192,32 @@
         quickEntryService.deleteMgtQuickEntry(mgtBaseGetDto);
         return R.ok();
     }
+
+    @RequestMapping(value = "/getCustomConfig", method = RequestMethod.POST)
+    @ApiOperation(value = "获取自定义设置")
+    public R<MgtCustomConfigVo> getCustomConfig() {
+        MgtCustomConfigVo mgtCustomConfigVo = customConfigService.getCustomConfig();
+        return R.ok(mgtCustomConfigVo);
+    }
+
+    @RequestMapping(value = "/editOtherConfig", method = RequestMethod.POST)
+    @ApiOperation(value = "修改其它设置")
+    public R editOtherConfig(@RequestBody MgtOtherConfigEditDto mgtOtherConfigEditDto) {
+        customConfigService.editOtherConfig(mgtOtherConfigEditDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/editShopConfig", method = RequestMethod.POST)
+    @ApiOperation(value = "修改合作商配置")
+    public R editShopConfig(@RequestBody MgtShopConfigEditDto mgtShopConfigEditDto) {
+        customConfigService.editShopConfig(mgtShopConfigEditDto);
+        return R.ok();
+    }
+
+    @RequestMapping(value = "/editMemberConfig", method = RequestMethod.POST)
+    @ApiOperation(value = "修改会员配置")
+    public R editMemberConfig(@RequestBody MgtMemberConfigEditDto mgtMemberConfigEditDto) {
+        customConfigService.editMemberConfig(mgtMemberConfigEditDto);
+        return R.ok();
+    }
 }
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtMemberConfigEditDto.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtMemberConfigEditDto.java
new file mode 100644
index 0000000..8603ba6
--- /dev/null
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtMemberConfigEditDto.java
@@ -0,0 +1,31 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.system.api.domain.dto.MgtBaseDto;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName MgtMemberConfigEditDto
+ * @Description TODO
+ * @Author jqs
+ * @Date 2023/6/7 17:15
+ * @Version 1.0
+ */
+@Data
+public class MgtMemberConfigEditDto extends MgtBaseDto {
+
+    @ApiModelProperty(value = "会员来源")
+    private String memberSourceChannel;
+
+    @ApiModelProperty(value = "会员性格")
+    private String memberCharacter;
+
+    @ApiModelProperty(value = "会员等级")
+    private String memberLevel;
+
+    @ApiModelProperty(value = "会员类型")
+    private String memberType;
+
+    @ApiModelProperty(value = "调理问题")
+    private String nurseProblem;
+}
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtOtherConfigEditDto.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtOtherConfigEditDto.java
new file mode 100644
index 0000000..eac770e
--- /dev/null
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtOtherConfigEditDto.java
@@ -0,0 +1,37 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.system.api.domain.dto.MgtBaseDto;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName MgtOtherConfigEditDto
+ * @Description TODO
+ * @Author jqs
+ * @Date 2023/6/7 16:04
+ * @Version 1.0
+ */
+@Data
+public class MgtOtherConfigEditDto extends MgtBaseDto {
+
+    @ApiModelProperty(value = "分享小程序可获得积分")
+    private Integer shareIntegral;
+
+    @ApiModelProperty(value = "平台建议可获得积分")
+    private Integer suggestPlatformIntegral;
+
+    @ApiModelProperty(value = "每日签到可获得积分")
+    private Integer signInIntegral;
+
+    @ApiModelProperty(value = "门店建议可获得积分")
+    private Integer suggestShopIntegral;
+
+    @ApiModelProperty(value = "购物满1元可获得积分")
+    private Integer payMoneyIntegral;
+
+    @ApiModelProperty(value = "C端订单自动取消时间")
+    private Integer orderAutoCancelTime;
+
+    @ApiModelProperty(value = "首页风格1.鸿瑞堂2.古引坊")
+    private Integer homeStyle;
+}
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtShopConfigEditDto.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtShopConfigEditDto.java
new file mode 100644
index 0000000..0364205
--- /dev/null
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtShopConfigEditDto.java
@@ -0,0 +1,28 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.system.api.domain.dto.MgtBaseDto;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName MgtOtherConfigEditDto
+ * @Description TODO
+ * @Author jqs
+ * @Date 2023/6/7 16:04
+ * @Version 1.0
+ */
+@Data
+public class MgtShopConfigEditDto extends MgtBaseDto {
+
+    @ApiModelProperty(value = "合作商任务紧急程度")
+    private String shopEmergencyDegree;
+
+    @ApiModelProperty(value = "合作商跟进类型")
+    private String shopFollowType;
+
+    @ApiModelProperty(value = "合作商状态")
+    private String shopCustomStatus;
+
+    @ApiModelProperty(value = "来源渠道")
+    private String shopSourceChannel;
+}
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/pojo/config/Advert.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/pojo/config/Advert.java
index a0d448e..d3fe4ff 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/pojo/config/Advert.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/pojo/config/Advert.java
@@ -1,16 +1,16 @@
 package com.ruoyi.system.domain.pojo.config;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import java.util.Date;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
 
 /**
  * <p>
@@ -58,6 +58,12 @@
      */
     @TableField("link_url")
     private String linkUrl;
+
+    /**
+     * 跳转类型1.门店详情2.秒杀活动3领券中心4.商城列表5.关于洪瑞堂
+     */
+    @TableField("jump_type")
+    private Integer jumpType;
     /**
      * 跳转活动id
      */
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtActivenessVo.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtActivenessVo.java
new file mode 100644
index 0000000..032e711
--- /dev/null
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtActivenessVo.java
@@ -0,0 +1,28 @@
+package com.ruoyi.system.domain.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @ClassName MgtActivenessVo
+ * @Description TODO
+ * @Author jqs
+ * @Date 2023/6/7 14:59
+ * @Version 1.0
+ */
+@Data
+public class MgtActivenessVo {
+
+
+    @ApiModelProperty(value = "活跃度id")
+    private Long activenessId;
+
+    @ApiModelProperty(value = "活跃度名称")
+    private String activenessName;
+
+    @ApiModelProperty(value = "开始天数")
+    private Integer startDay;
+
+    @ApiModelProperty(value = "结束天数")
+    private Integer endDay;
+}
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtCustomConfigVo.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtCustomConfigVo.java
new file mode 100644
index 0000000..4bcdcb6
--- /dev/null
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtCustomConfigVo.java
@@ -0,0 +1,89 @@
+package com.ruoyi.system.domain.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @ClassName MgtOtherConfigVo
+ * @Description TODO
+ * @Author jqs
+ * @Date 2023/6/7 13:58
+ * @Version 1.0
+ */
+@Data
+public class MgtCustomConfigVo {
+
+    @ApiModelProperty(value = "分享小程序可获得积分")
+    private Integer shareIntegral;
+
+    @ApiModelProperty(value = "平台建议可获得积分")
+    private Integer suggestPlatformIntegral;
+
+    @ApiModelProperty(value = "每日签到可获得积分")
+    private Integer signInIntegral;
+
+    @ApiModelProperty(value = "门店建议可获得积分")
+    private Integer suggestShopIntegral;
+
+    @ApiModelProperty(value = "购物满1元可获得积分")
+    private Integer payMoneyIntegral;
+
+    @ApiModelProperty(value = "C端订单自动取消时间")
+    private Integer orderAutoCancelTime;
+
+    @ApiModelProperty(value = "首页风格1.鸿瑞堂2.古引坊")
+    private Integer homeStyle;
+
+    @ApiModelProperty(value = "合作商任务紧急程度")
+    private String shopEmergencyDegree;
+
+    @ApiModelProperty(value = "合作商跟进类型")
+    private String shopFollowType;
+
+    @ApiModelProperty(value = "合作商状态")
+    private String shopCustomStatus;
+
+    @ApiModelProperty(value = "来源渠道")
+    private String shopSourceChannel;
+
+    @ApiModelProperty(value = "会员来源")
+    private String memberSourceChannel;
+
+    @ApiModelProperty(value = "会员性格")
+    private String memberCharacter;
+
+    @ApiModelProperty(value = "会员等级")
+    private String memberLevel;
+
+    @ApiModelProperty(value = "会员类型")
+    private String memberType;
+
+    @ApiModelProperty(value = "调理问题")
+    private String nurseProblem;
+
+    @ApiModelProperty(value = "首页广告语")
+    private String homeSlogan;
+
+    @ApiModelProperty(value = "首页logo")
+    private String homeLogo;
+
+    @ApiModelProperty(value = "广告图片")
+    private String adUrl;
+
+    @ApiModelProperty(value = "链接类型1.外部2.内部3.无")
+    private Integer targetType;
+
+    @ApiModelProperty(value = "链接地址")
+    private String linkUrl;
+
+    @ApiModelProperty(value = "跳转类型1.门店详情2.秒杀活动3领券中心4.商城列表5.关于洪瑞堂")
+    private Integer jumpType;
+
+    @ApiModelProperty(value = "跳转id")
+    private String jumpId;
+
+    @ApiModelProperty(value = "活跃度list")
+    private List<MgtActivenessVo> mgtActivenessVoList;
+}
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/ActivenessService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/ActivenessService.java
index 1ff81a9..5b29db4 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/ActivenessService.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/ActivenessService.java
@@ -2,6 +2,7 @@
 
 import com.ruoyi.system.api.domain.poji.config.Activeness;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.system.domain.vo.MgtActivenessVo;
 
 import java.util.List;
 
@@ -21,4 +22,12 @@
      */
     List<Activeness> listActiveness();
 
+    /**
+     * @description  
+     * @author  jqs
+     * @date    2023/6/7 16:04
+     * @param 
+     * @return  List<MgtActivenessVo>
+     */
+    List<MgtActivenessVo> listVo();
 }
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/AdvertService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/AdvertService.java
index f2c0085..9eab98f 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/AdvertService.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/AdvertService.java
@@ -19,4 +19,13 @@
      * @return
      */
     AppAdvertVo getAdvertVo();
+
+    /**
+     * @description  获取广告配置
+     * @author  jqs
+     * @date    2023/6/7 15:43
+     * @param
+     * @return  Advert
+     */
+    Advert getAdvert();
 }
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/CustomConfigService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/CustomConfigService.java
index 295a8de..d87f9a1 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/CustomConfigService.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/config/CustomConfigService.java
@@ -1,16 +1,19 @@
 package com.ruoyi.system.service.config;
 
-import com.ruoyi.system.domain.dto.MgtServiceMobileEditDto;
-import com.ruoyi.system.domain.pojo.config.CustomConfig;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.system.domain.dto.MgtMemberConfigEditDto;
+import com.ruoyi.system.domain.dto.MgtOtherConfigEditDto;
+import com.ruoyi.system.domain.dto.MgtServiceMobileEditDto;
+import com.ruoyi.system.domain.dto.MgtShopConfigEditDto;
+import com.ruoyi.system.domain.pojo.config.CustomConfig;
+import com.ruoyi.system.domain.vo.MgtCustomConfigVo;
 
 /**
- * <p>
- * 系统配置 服务类
- * </p>
- *
- * @author jqs
- * @since 2023-04-25
+ * @ClassName CustomConfigService
+ * @Description TODO
+ * @Author jqs
+ * @Date 2023/6/7 16:32
+ * @Version 1.0
  */
 public interface CustomConfigService extends IService<CustomConfig> {
 
@@ -24,7 +27,7 @@
     CustomConfig getByKey(String key);
 
 
-    /**
+     /**
      * @description  修改客服号码
      * @author  jqs
      * @date    2023/6/6 11:53
@@ -33,5 +36,39 @@
      */
     void editServiceMobile( MgtServiceMobileEditDto mgtServiceMobileEditDto);
 
+    /**
+     * @description  平台获取自定义配置
+     * @author  jqs
+     * @date    2023/6/7 15:02
+     * @param
+     * @return  MgtCustomConfigVo
+     */
+    MgtCustomConfigVo getCustomConfig();
 
+    /**
+     * @description  修改其他设置
+     * @author  jqs
+     * @date    2023/6/7 16:07
+     * @param mgtOtherConfigEditDto
+     * @return  void
+     */
+    void editOtherConfig(MgtOtherConfigEditDto mgtOtherConfigEditDto);
+
+    /**
+     * @description  修改合作商配置
+     * @author  jqs
+     * @date    2023/6/7 16:41
+     * @param mgtShopConfigEditDto
+     * @return  void
+     */
+    void editShopConfig(MgtShopConfigEditDto mgtShopConfigEditDto);
+
+    /**
+     * @description  修改会员配置
+     * @author  jqs
+     * @date    2023/6/7 17:16
+     * @param mgtMemberConfigEditDto
+     * @return  void
+     */
+    void editMemberConfig(MgtMemberConfigEditDto mgtMemberConfigEditDto);
 }
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java
index 311a5a8..a4b8ae0 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/AdvertServiceImpl.java
@@ -1,5 +1,6 @@
 package com.ruoyi.system.service.impl.config;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.system.domain.pojo.config.Advert;
 import com.ruoyi.system.domain.vo.AppAdvertVo;
 import com.ruoyi.system.mapper.config.AdvertMapper;
@@ -31,4 +32,17 @@
     public AppAdvertVo getAdvertVo(){
         return advertMapper.getAdvertVo();
     }
+
+    /**
+     * @description  获取广告配置
+     * @author  jqs
+     * @date    2023/6/7 15:43
+     * @param
+     * @return  Advert
+     */
+    @Override
+    public Advert getAdvert(){
+        Advert advert = this.getOne(new LambdaQueryWrapper<Advert>().eq(Advert::getDelFlag,0),false);
+        return advert;
+    }
 }
diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java
index 4c4c2f8..30c6560 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/config/CustomConfigServiceImpl.java
@@ -1,15 +1,27 @@
 package com.ruoyi.system.service.impl.config;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.system.api.constant.ConfigEnum;
+import com.ruoyi.system.api.domain.poji.config.Activeness;
+import com.ruoyi.system.domain.dto.MgtMemberConfigEditDto;
+import com.ruoyi.system.domain.dto.MgtOtherConfigEditDto;
 import com.ruoyi.system.domain.dto.MgtServiceMobileEditDto;
+import com.ruoyi.system.domain.dto.MgtShopConfigEditDto;
+import com.ruoyi.system.domain.pojo.config.Advert;
 import com.ruoyi.system.domain.pojo.config.CustomConfig;
+import com.ruoyi.system.domain.vo.MgtActivenessVo;
+import com.ruoyi.system.domain.vo.MgtCustomConfigVo;
 import com.ruoyi.system.mapper.config.CustomConfigMapper;
+import com.ruoyi.system.service.config.ActivenessService;
+import com.ruoyi.system.service.config.AdvertService;
 import com.ruoyi.system.service.config.CustomConfigService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.Date;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -25,25 +37,31 @@
     @Resource
     private CustomConfigMapper customConfigMapper;
 
+    @Resource
+    private AdvertService advertService;
+
+    @Resource
+    private ActivenessService activenessService;
+
+
     /**
-     * @description  通过key获取系统自定义配置
-     * @author  jqs
-     * @date    2023/6/6 11:55
      * @param key
-     * @return  CustomConfig
+     * @return CustomConfig
+     * @description 通过key获取系统自定义配置
+     * @author jqs
+     * @date 2023/6/6 11:55
      */
     @Override
-    public CustomConfig getByKey(String key){
+    public CustomConfig getByKey(String key) {
         return customConfigMapper.getByKey(key);
     }
 
-
     /**
-     * @description  修改客服号码
-     * @author  jqs
-     * @date    2023/6/6 11:53
      * @param mgtServiceMobileEditDto
-     * @return  void
+     * @return void
+     * @description 修改客服号码
+     * @author jqs
+     * @date 2023/6/6 11:53
      */
     @Override
     public void editServiceMobile(MgtServiceMobileEditDto mgtServiceMobileEditDto) {
@@ -63,4 +81,371 @@
         // 保存或更新配置
         this.saveOrUpdate(customConfig);
     }
+
+    /**
+     * @param
+     * @return MgtCustomConfigVo
+     * @description 平台获取自定义配置
+     * @author jqs
+     * @date 2023/6/7 15:02
+     */
+    @Override
+    public MgtCustomConfigVo getCustomConfig() {
+        MgtCustomConfigVo mgtCustomConfigVo = new MgtCustomConfigVo();
+        //获取自定义配置
+        List<CustomConfig> customConfigList = customConfigMapper.selectList(new LambdaQueryWrapper<CustomConfig>().eq(CustomConfig::getDelFlag, 0));
+        Optional.ofNullable(customConfigList).ifPresent(list -> {
+            Map<String, CustomConfig> configMap = list.stream().collect(Collectors.toMap(CustomConfig::getKey, Function.identity()));
+            // 遍历配置映射,设置相应的属性值
+            configMap.forEach((key, value) -> {
+                switch (key) {
+                    case "SHARE_INTEGRAL":
+                        mgtCustomConfigVo.setShareIntegral(Integer.valueOf(value.getValue()));
+                        break;
+                    case "SUGGEST_PLATFORM_INTEGRAL":
+                        mgtCustomConfigVo.setSuggestPlatformIntegral(Integer.valueOf(value.getValue()));
+                        break;
+                    case "SIGN_IN_INTEGRAL":
+                        mgtCustomConfigVo.setSignInIntegral(Integer.valueOf(value.getValue()));
+                        break;
+                    case "SUGGEST_SHOP_INTEGRAL":
+                        mgtCustomConfigVo.setSuggestShopIntegral(Integer.valueOf(value.getValue()));
+                        break;
+                    case "PAY_MONEY_INTEGRAL":
+                        mgtCustomConfigVo.setPayMoneyIntegral(Integer.valueOf(value.getValue()));
+                        break;
+                    case "ORDER_AUTO_CANCEL_TIME":
+                        mgtCustomConfigVo.setOrderAutoCancelTime(Integer.valueOf(value.getValue()));
+                        break;
+                    case "HOME_STYLE":
+                        mgtCustomConfigVo.setHomeStyle(Integer.valueOf(value.getValue()));
+                        break;
+                    case "SHOP_EMERGENCY_DEGREE":
+                        mgtCustomConfigVo.setShopEmergencyDegree(value.getValue());
+                        break;
+                    case "SHOP_FOLLOW_TYPE":
+                        mgtCustomConfigVo.setShopFollowType(value.getValue());
+                        break;
+                    case "SHOP_CUSTOM_STATUS":
+                        mgtCustomConfigVo.setShopCustomStatus(value.getValue());
+                        break;
+                    case "SHOP_SOURCE_CHANNEL":
+                        mgtCustomConfigVo.setShopSourceChannel(value.getValue());
+                        break;
+                    case "MEMBER_SOURCE_CHANNEL":
+                        mgtCustomConfigVo.setMemberSourceChannel(value.getValue());
+                        break;
+                    case "MEMBER_CHARACTER":
+                        mgtCustomConfigVo.setMemberCharacter(value.getValue());
+                        break;
+                    case "MEMBER_LEVEL":
+                        mgtCustomConfigVo.setMemberLevel(value.getValue());
+                        break;
+                    case "MEMBER_TYPE":
+                        mgtCustomConfigVo.setMemberType(value.getValue());
+                        break;
+                    case "NURSE_PROBLEM":
+                        mgtCustomConfigVo.setNurseProblem(value.getValue());
+                        break;
+                    default:
+                        break;
+                }
+            });
+        });
+        //获取广告配置
+        Advert advert = advertService.getAdvert();
+        if (advert != null) {
+            mgtCustomConfigVo.setHomeSlogan(advert.getAdContent());
+            mgtCustomConfigVo.setHomeLogo(advert.getLogoUrl());
+            mgtCustomConfigVo.setAdUrl(advert.getAdUrl());
+            mgtCustomConfigVo.setTargetType(advert.getTargetType());
+            mgtCustomConfigVo.setLinkUrl(advert.getLinkUrl());
+            mgtCustomConfigVo.setJumpType(advert.getJumpType());
+            mgtCustomConfigVo.setJumpId(advert.getJumpId());
+        }
+        //获取活跃度配置
+        List<Activeness> activenessList = activenessService.listActiveness();
+        if (activenessList != null && !activenessList.isEmpty()) {
+            List<MgtActivenessVo> mgtActivenessVoList = activenessList.stream()
+                    .map(activeness -> {
+                        MgtActivenessVo mgtActivenessVo = new MgtActivenessVo();
+                        mgtActivenessVo.setActivenessId(activeness.getActivenessId());
+                        mgtActivenessVo.setActivenessName(activeness.getActivenessName());
+                        mgtActivenessVo.setStartDay(activeness.getStartDay());
+                        mgtActivenessVo.setEndDay(activeness.getEndDay());
+                        return mgtActivenessVo;
+                    })
+                    .collect(Collectors.toList());
+            mgtCustomConfigVo.setMgtActivenessVoList(mgtActivenessVoList);
+        }
+        return mgtCustomConfigVo;
+    }
+
+
+    /**
+     * @param mgtOtherConfigEditDto
+     * @return void
+     * @description 修改其他设置
+     * @author jqs
+     * @date 2023/6/7 16:07
+     */
+    @Override
+    public void editOtherConfig(MgtOtherConfigEditDto mgtOtherConfigEditDto) {
+        // 获取当前时间
+        Date updateTime = new Date();
+        // 删除历史配置
+        deletePastConfig(updateTime);
+        // 新建配置
+        createNewConfig(mgtOtherConfigEditDto, updateTime);
+    }
+
+    /**
+     * @param updateTime
+     * @return void
+     * @description 删除历史配置
+     * @author jqs
+     * @date 2023/6/7 16:37
+     */
+    private void deletePastConfig(Date updateTime) {
+        List<CustomConfig> customConfigList = customConfigMapper.selectList(new LambdaQueryWrapper<CustomConfig>()
+                .eq(CustomConfig::getDelFlag, 0)
+                .eq(CustomConfig::getType, 2));
+        for (CustomConfig customConfig : customConfigList) {
+            customConfig.setDelFlag(1);
+            customConfig.setUpdateTime(updateTime);
+        }
+        this.saveOrUpdateBatch(customConfigList);
+    }
+
+    /**
+     * @param mgtOtherConfigEditDto
+     * @param updateTime
+     * @return void
+     * @description 新建配置
+     * @author jqs
+     * @date 2023/6/7 16:37
+     */
+    private void createNewConfig(MgtOtherConfigEditDto mgtOtherConfigEditDto, Date updateTime) {
+        for (ConfigEnum configEnum : ConfigEnum.values()) {
+            CustomConfig customConfig = new CustomConfig();
+            customConfig.setDelFlag(0);
+            customConfig.setType(configEnum.getKeyType());
+            customConfig.setKey(configEnum.getKey());
+            customConfig.setName(configEnum.getKeyName());
+            customConfig.setValue(getConfigValue(configEnum, mgtOtherConfigEditDto));
+            customConfig.setCreateTime(updateTime);
+            customConfig.setUpdateTime(updateTime);
+            this.saveOrUpdate(customConfig);
+        }
+    }
+
+    /**
+     * @param configEnum
+     * @param mgtOtherConfigEditDto
+     * @return String
+     * @description 获取配置参数
+     * @author jqs
+     * @date 2023/6/7 16:37
+     */
+    private String getConfigValue(ConfigEnum configEnum, MgtOtherConfigEditDto mgtOtherConfigEditDto) {
+        switch (configEnum) {
+            case SHARE_INTEGRAL:
+                return mgtOtherConfigEditDto.getShareIntegral().toString();
+            case SUGGEST_PLATFORM_INTEGRAL:
+                return mgtOtherConfigEditDto.getSuggestPlatformIntegral().toString();
+            case SIGN_IN_INTEGRAL:
+                return mgtOtherConfigEditDto.getSignInIntegral().toString();
+            case SUGGEST_SHOP_INTEGRAL:
+                return mgtOtherConfigEditDto.getSuggestShopIntegral().toString();
+            case ORDER_AUTO_CANCEL_TIME:
+                return mgtOtherConfigEditDto.getOrderAutoCancelTime().toString();
+            case PAY_MONEY_INTEGRAL:
+                return mgtOtherConfigEditDto.getPayMoneyIntegral().toString();
+            case HOME_STYLE:
+                return mgtOtherConfigEditDto.getHomeStyle().toString();
+            default:
+                throw new IllegalArgumentException("Invalid ConfigEnum");
+        }
+    }
+
+    /**
+     * @param mgtShopConfigEditDto
+     * @return void
+     * @description 修改合作商配置
+     * @author jqs
+     * @date 2023/6/7 16:41
+     */
+    @Override
+    public void editShopConfig(MgtShopConfigEditDto mgtShopConfigEditDto) {
+        // 获取当前时间
+        Date updateTime = new Date();
+        // 查询所有未删除、类型为3的自定义配置
+        List<CustomConfig> customConfigList = customConfigMapper.selectList(
+                new LambdaQueryWrapper<CustomConfig>()
+                        .eq(CustomConfig::getDelFlag, 0)
+                        .eq(CustomConfig::getType, 3)
+        );
+        if (customConfigList != null && !customConfigList.isEmpty()) {
+            String key;
+            String oldValue;
+            String newValue = null;
+            List<CustomConfig> updatedCustomConfigs = new ArrayList<>();
+            // 遍历配置列表,根据 key 更新配置值
+            for (CustomConfig customConfig : customConfigList) {
+                key = customConfig.getKey();
+                oldValue = customConfig.getValue();
+                switch (key) {
+                    case "SHOP_EMERGENCY_DEGREE":
+                        newValue = mgtShopConfigEditDto.getShopEmergencyDegree();
+                        break;
+                    case "SHOP_FOLLOW_TYPE":
+                        newValue = mgtShopConfigEditDto.getShopFollowType();
+                        break;
+                    case "SHOP_CUSTOM_STATUS":
+                        newValue = mgtShopConfigEditDto.getShopCustomStatus();
+                        break;
+                    case "SHOP_SOURCE_CHANNEL":
+                        newValue = mgtShopConfigEditDto.getShopSourceChannel();
+                        break;
+                    default:
+                        break;
+                }
+                customConfig.setValue(newValue);
+                customConfig.setUpdateTime(updateTime);
+                handleChangeConfig(oldValue, newValue, key);
+                updatedCustomConfigs.add(customConfig);
+            }
+            this.saveOrUpdateBatch(updatedCustomConfigs);
+        } else {
+            // 如果没有配置,则创建新配置
+            createNewConfig(ConfigEnum.SHOP_EMERGENCY_DEGREE, mgtShopConfigEditDto.getShopEmergencyDegree(), updateTime);
+            createNewConfig(ConfigEnum.SHOP_FOLLOW_TYPE, mgtShopConfigEditDto.getShopFollowType(), updateTime);
+            createNewConfig(ConfigEnum.SHOP_CUSTOM_STATUS, mgtShopConfigEditDto.getShopCustomStatus(), updateTime);
+            createNewConfig(ConfigEnum.SHOP_SOURCE_CHANNEL, mgtShopConfigEditDto.getShopSourceChannel(), updateTime);
+        }
+    }
+
+    /**
+     * @description  修改会员配置
+     * @author  jqs
+     * @date    2023/6/7 17:16
+     * @param mgtMemberConfigEditDto
+     * @return  void
+     */
+    @Override
+    public void editMemberConfig(MgtMemberConfigEditDto mgtMemberConfigEditDto){
+        // 获取当前时间
+        Date updateTime = new Date();
+        // 查询所有未删除、类型为3的自定义配置
+        List<CustomConfig> customConfigList = customConfigMapper.selectList(
+                new LambdaQueryWrapper<CustomConfig>()
+                        .eq(CustomConfig::getDelFlag, 0)
+                        .eq(CustomConfig::getType, 4)
+        );
+        if (customConfigList != null && !customConfigList.isEmpty()) {
+            String key;
+            String oldValue;
+            String newValue = null;
+            List<CustomConfig> updatedCustomConfigs = new ArrayList<>();
+            // 遍历配置列表,根据 key 更新配置值
+            for (CustomConfig customConfig : customConfigList) {
+                key = customConfig.getKey();
+                oldValue = customConfig.getValue();
+                switch (key) {
+                    case "MEMBER_SOURCE_CHANNEL":
+                        newValue = mgtMemberConfigEditDto.getMemberSourceChannel();
+                        break;
+                    case "MEMBER_CHARACTER":
+                        newValue = mgtMemberConfigEditDto.getMemberCharacter();
+                        break;
+                    case "MEMBER_LEVEL":
+                        newValue = mgtMemberConfigEditDto.getMemberLevel();
+                        break;
+                    case "MEMBER_TYPE":
+                        newValue = mgtMemberConfigEditDto.getMemberType();
+                        break;
+                    case "NURSE_PROBLEM":
+                        newValue = mgtMemberConfigEditDto.getNurseProblem();
+                        break;
+                    default:
+                        break;
+                }
+                customConfig.setValue(newValue);
+                customConfig.setUpdateTime(updateTime);
+                handleChangeConfig(oldValue, newValue, key);
+                updatedCustomConfigs.add(customConfig);
+            }
+            this.saveOrUpdateBatch(updatedCustomConfigs);
+        } else {
+            // 如果没有配置,则创建新配置
+            createNewConfig(ConfigEnum.MEMBER_SOURCE_CHANNEL, mgtMemberConfigEditDto.getMemberSourceChannel(), updateTime);
+            createNewConfig(ConfigEnum.MEMBER_CHARACTER, mgtMemberConfigEditDto.getMemberCharacter(), updateTime);
+            createNewConfig(ConfigEnum.MEMBER_LEVEL, mgtMemberConfigEditDto.getMemberLevel(), updateTime);
+            createNewConfig(ConfigEnum.MEMBER_TYPE, mgtMemberConfigEditDto.getMemberType(), updateTime);
+            createNewConfig(ConfigEnum.NURSE_PROBLEM, mgtMemberConfigEditDto.getNurseProblem(), updateTime);
+        }
+    }
+
+    /**
+     * @description  新建配置
+     * @author  jqs
+     * @date    2023/6/7 17:06
+     * @param configEnum
+     * @param value
+     * @param updateTime
+     * @return  void
+     */
+    private void createNewConfig(ConfigEnum configEnum, String value, Date updateTime) {
+        CustomConfig customConfig = new CustomConfig();
+        customConfig.setDelFlag(0);
+        customConfig.setType(configEnum.getKeyType());
+        customConfig.setKey(configEnum.getKey());
+        customConfig.setName(configEnum.getKeyName());
+        customConfig.setValue(value);
+        customConfig.setCreateTime(updateTime);
+        customConfig.setUpdateTime(updateTime);
+        this.saveOrUpdate(customConfig);
+    }
+
+    /**
+     * @description  处理变动
+     * @author  jqs
+     * @date    2023/6/7 17:06
+     * @param oldValue
+     * @param newValue
+     * @param key
+     * @return  void
+     */
+    private void handleChangeConfig(String oldValue, String newValue, String key) {
+        Set<String> oldSet = new HashSet<>(Arrays.asList(oldValue.split(",")));
+        Set<String> newSet = new HashSet<>(Arrays.asList(newValue.split(",")));
+        List<String> changeList = new ArrayList<>(oldSet);
+        changeList.removeAll(newSet);
+        if(changeList!=null&&!changeList.isEmpty()){
+            switch(key){
+                case "SHOP_EMERGENCY_DEGREE":
+                    break;
+                case "SHOP_FOLLOW_TYPE":
+                    break;
+                case "SHOP_CUSTOM_STATUS":
+                    break;
+                case "SHOP_SOURCE_CHANNEL":
+                    break;
+                case "MEMBER_SOURCE_CHANNEL":
+                    break;
+                case "MEMBER_CHARACTER":
+                    break;
+                case "MEMBER_LEVEL":
+                    break;
+                case "MEMBER_TYPE":
+                    break;
+                case "NURSE_PROBLEM":
+                    break;
+                default:
+                    break;
+            }
+        }
+    }
+
+
 }

--
Gitblit v1.7.1