浏览代码

协议功能提交,查看权限提交

yjwang 1 周之前
父节点
当前提交
0f62391f40

+ 107 - 3
fs-admin/src/main/java/com/fs/course/controller/FsCoursePlaySourceConfigController.java

@@ -1,16 +1,14 @@
 package com.fs.course.controller;
 
 import cn.hutool.json.JSONUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
-import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.model.LoginUser;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.core.redis.RedisCache;
@@ -21,7 +19,9 @@ import com.fs.course.config.CourseConfig;
 import com.fs.course.domain.FsCoursePlaySourceConfig;
 import com.fs.course.param.FsCoursePlaySourceConfigCreateParam;
 import com.fs.course.param.FsCoursePlaySourceConfigEditParam;
+import com.fs.course.param.FsCoursePlaySourceConfigProtocolParam;
 import com.fs.course.service.IFsCoursePlaySourceConfigService;
+import com.fs.course.vo.FsCoursePlaySourceConfigProtocolVO;
 import com.fs.course.vo.FsCoursePlaySourceConfigVO;
 import com.fs.framework.web.service.TokenService;
 import com.fs.system.service.ISysConfigService;
@@ -29,6 +29,7 @@ import com.github.pagehelper.PageHelper;
 import lombok.AllArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -175,4 +176,107 @@ public class FsCoursePlaySourceConfigController extends BaseController {
     public void addRedis(String appId,Integer viewPermissions){
         redisCache.setCacheObject("viewPermissions:"+appId, viewPermissions);
     }
+
+    /**
+     * 获取隐私协议
+     * **/
+    @PostMapping("/getProtocol")
+    public R getProtocol(@RequestBody FsCoursePlaySourceConfigCreateParam param){
+        FsCoursePlaySourceConfig config = fsCoursePlaySourceConfigService.getById(param.getId());
+        if (config == null) {
+            return R.error("配置信息不存在");
+        }
+        FsCoursePlaySourceConfigProtocolVO protocolVO = new FsCoursePlaySourceConfigProtocolVO();
+        BeanUtils.copyProperties(config, protocolVO);
+        return R.ok(protocolVO);
+    }
+
+
+    /**
+     * 更新协议配置
+     */
+    @PostMapping("/updateProtocol")
+    public R updateProtocol(@Valid @RequestBody FsCoursePlaySourceConfigProtocolParam param) {
+        if (param.getId() == null || param.getId() == 0) {
+            return R.error("配置ID不能为空");
+        }
+
+        //检查配置是否存在
+        FsCoursePlaySourceConfig config = fsCoursePlaySourceConfigService.getById(param.getId());
+        if (config == null) {
+            return R.error("配置信息不存在");
+        }
+
+        //判断协议填写程度
+        int protocolType = calculateProtocolType(param);
+
+        //更新数据
+        FsCoursePlaySourceConfig updateConfig = new FsCoursePlaySourceConfig();
+        updateConfig.setId(param.getId());
+
+        // 设置协议字段
+        updateConfig.setDoctorRegister(param.getDoctorRegister());
+        updateConfig.setDoctorFiling(param.getDoctorFiling());
+        updateConfig.setPharmacistRegister(param.getPharmacistRegister());
+        updateConfig.setPharmacistFiling(param.getPharmacistFiling());
+        updateConfig.setUserRegister(param.getUserRegister());
+        updateConfig.setUserPrivacy(param.getUserPrivacy());
+        updateConfig.setUserHealth(param.getUserHealth());
+        updateConfig.setVipService(param.getVipService());
+        updateConfig.setVipAutomaticService(param.getVipAutomaticService());
+        updateConfig.setUserRemoveService(param.getUserRemoveService());
+        updateConfig.setStoreRules(param.getStoreRules());
+        updateConfig.setResidencyAgreement(param.getResidencyAgreement());
+        updateConfig.setSettingsProtocolType(protocolType);
+        boolean success = fsCoursePlaySourceConfigService.updateById(updateConfig);
+        if (success) {
+            //更新缓存
+            addProtocolRedis(config.getAppid(), JSON.toJSONString(updateConfig));
+        }
+        return success ? R.ok("更新成功") : R.error("更新失败");
+    }
+
+    //加入协议缓存
+    public void addProtocolRedis(String appId,String value){
+        redisCache.setCacheObject("ProtocolConfig:"+appId, value);
+    }
+
+    /**
+     * 计算协议填写程度
+     * 0-未设置 1-部分设置 2-已设置
+     */
+    private int calculateProtocolType(FsCoursePlaySourceConfigProtocolParam param) {
+        // 所有需要检查的协议字段
+        String[] protocolFields = {
+                param.getDoctorRegister(),
+                param.getDoctorFiling(),
+                param.getPharmacistRegister(),
+                param.getPharmacistFiling(),
+                param.getUserRegister(),
+                param.getUserPrivacy(),
+                param.getUserHealth(),
+                param.getVipService(),
+                param.getVipAutomaticService(),
+                param.getUserRemoveService(),
+                param.getStoreRules(),
+                param.getResidencyAgreement()
+        };
+
+        int filledCount = 0;
+        int totalFields = protocolFields.length;
+
+        for (String field : protocolFields) {
+            if (StringUtils.hasText(field) && !field.equals("<p><br></p>")) {
+                filledCount++;
+            }
+        }
+
+        if (filledCount == 0) {
+            return 0; // 未设置
+        } else if (filledCount < totalFields) {
+            return 1; // 部分设置
+        } else {
+            return 2; // 已设置
+        }
+    }
 }

+ 53 - 0
fs-service/src/main/java/com/fs/course/domain/FsCoursePlaySourceConfig.java

@@ -105,4 +105,57 @@ public class FsCoursePlaySourceConfig {
      * 查看数据权限
      * **/
     private Integer viewPermissions;
+
+    /**
+     * 医生注册协议
+     * **/
+    private  String doctorRegister;
+    /**
+     * 医生多机构备案协议
+     * **/
+    private  String doctorFiling;
+    /**
+     * 药师注册协议
+     * **/
+    private  String pharmacistRegister;
+    /**
+     * 药师多机构备案协议
+     * **/
+    private  String pharmacistFiling;
+    /**
+     * 用户协议
+     * **/
+    private  String userRegister;
+    /**
+     * 隐私协议
+     * **/
+    private  String userPrivacy;
+    /**
+     * 健康客服协议
+     * **/
+    private  String userHealth;
+    /**
+     * 会员服务协议
+     * **/
+    private  String vipService;
+    /**
+     * 会员自动续费协议
+     * **/
+    private  String vipAutomaticService;
+    /**
+     * 用户注销协议
+     * **/
+    private  String userRemoveService;
+    /**
+     * 商家规则
+     * **/
+    private  String storeRules;
+    /**
+     * 入驻协议
+     * **/
+    private  String residencyAgreement;
+    /**
+     *0未设置1部分设置2已设置
+     * **/
+    private Integer settingsProtocolType;
 }

+ 2 - 0
fs-service/src/main/java/com/fs/course/param/FsCoursePlaySourceConfigCreateParam.java

@@ -8,6 +8,8 @@ import javax.validation.constraints.NotNull;
 
 @Data
 public class FsCoursePlaySourceConfigCreateParam {
+    @ApiModelProperty("配置id")
+    private Long id;
 
     @NotBlank(message = "名称不能为空")
     @ApiModelProperty("小程序/公众号名称")

+ 64 - 0
fs-service/src/main/java/com/fs/course/param/FsCoursePlaySourceConfigProtocolParam.java

@@ -0,0 +1,64 @@
+package com.fs.course.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class FsCoursePlaySourceConfigProtocolParam {
+    @ApiModelProperty("配置id")
+    private Long id;
+
+    @ApiModelProperty("小程序/公众号名称")
+    private String name;
+
+    @ApiModelProperty("小程序/公众号appid")
+    private String appid;
+    /**
+     * 医生注册协议
+     * **/
+    private  String doctorRegister;
+    /**
+     * 医生多机构备案协议
+     * **/
+    private  String doctorFiling;
+    /**
+     * 药师注册协议
+     * **/
+    private  String pharmacistRegister;
+    /**
+     * 药师多机构备案协议
+     * **/
+    private  String pharmacistFiling;
+    /**
+     * 用户协议
+     * **/
+    private  String userRegister;
+    /**
+     * 隐私协议
+     * **/
+    private  String userPrivacy;
+    /**
+     * 健康客服协议
+     * **/
+    private  String userHealth;
+    /**
+     * 会员服务协议
+     * **/
+    private  String vipService;
+    /**
+     * 会员自动续费协议
+     * **/
+    private  String vipAutomaticService;
+    /**
+     * 用户注销协议
+     * **/
+    private  String userRemoveService;
+    /**
+     * 商家规则
+     * **/
+    private  String storeRules;
+    /**
+     * 入驻协议
+     * **/
+    private  String residencyAgreement;
+}

+ 7 - 0
fs-service/src/main/java/com/fs/course/service/IFsCoursePlaySourceConfigService.java

@@ -15,4 +15,11 @@ public interface IFsCoursePlaySourceConfigService extends IService<FsCoursePlayS
     List<FsCoursePlaySourceConfigVO> selectCoursePlaySourceConfigVOListByMap(Map<String, Object> params);
 
     List<FsCoursePlaySourceConfig> selectByAppIds(List<String> miniAppList);
+
+    /**
+     * 获取小程序配置信息
+     * @param appId 小程序ID
+     * @param key 缓存KEY
+     * **/
+    FsCoursePlaySourceConfig selectConfigByAppId(String appId,String key);
 }

+ 48 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsCoursePlaySourceConfigServiceImpl.java

@@ -1,23 +1,36 @@
 package com.fs.course.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.constant.Constants;
+import com.fs.common.core.redis.RedisCache;
+import com.fs.common.core.text.Convert;
+import com.fs.common.utils.StringUtils;
 import com.fs.course.domain.FsCoursePlaySourceConfig;
 import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
 import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.course.vo.FsCoursePlaySourceConfigVO;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 @Service
 @Slf4j
 public class FsCoursePlaySourceConfigServiceImpl extends ServiceImpl<FsCoursePlaySourceConfigMapper, FsCoursePlaySourceConfig>
         implements IFsCoursePlaySourceConfigService {
 
+    @Autowired
+    private RedisCache redisCache;
+
+    private static final ConcurrentHashMap<String, Object> KEY_LOCKS = new ConcurrentHashMap<>();
+
     /**
      * 查询点播配置列表
      */
@@ -30,4 +43,39 @@ public class FsCoursePlaySourceConfigServiceImpl extends ServiceImpl<FsCoursePla
     public List<FsCoursePlaySourceConfig> selectByAppIds(List<String> miniAppList) {
         return baseMapper.selectList(new QueryWrapper<FsCoursePlaySourceConfig>().in("appid", miniAppList));
     }
+
+    @Override
+    public FsCoursePlaySourceConfig selectConfigByAppId(String appId, String key) {
+        String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(key)));
+        if (StringUtils.isNotEmpty(configValue)) {
+            return converter(configValue);
+        }
+        Object keyLock = KEY_LOCKS.computeIfAbsent(key, k -> new Object());
+        synchronized (keyLock){
+            FsCoursePlaySourceConfig config = baseMapper.selectOne(new LambdaQueryWrapper<FsCoursePlaySourceConfig>().eq(FsCoursePlaySourceConfig::getAppid,appId).ne(FsCoursePlaySourceConfig::getSettingsProtocolType,0));
+           if(config != null){
+               redisCache.setCacheObject(key, JSON.toJSONString(config));
+               return config;
+           }
+        }
+        return null;
+    }
+
+    /**
+     * 设置cache key
+     *
+     * @param configKey 参数键
+     * @return 缓存键key
+     */
+    private String getCacheKey(String configKey)
+    {
+        return Constants.SYS_CONFIG_KEY + configKey;
+    }
+
+    private FsCoursePlaySourceConfig  converter(String value){
+        if(StringUtils.isNotEmpty(value)){
+            return JSON.parseObject(value,FsCoursePlaySourceConfig.class);
+        }
+        return null;
+    }
 }

+ 64 - 0
fs-service/src/main/java/com/fs/course/vo/FsCoursePlaySourceConfigProtocolVO.java

@@ -0,0 +1,64 @@
+package com.fs.course.vo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class FsCoursePlaySourceConfigProtocolVO {
+
+    @ApiModelProperty("主键ID")
+    private Long id;
+
+    @ApiModelProperty("小程序/公众号名称")
+    private String name;
+
+    @ApiModelProperty("小程序/公众号appid")
+    private String appid;
+    /**
+     * 医生注册协议
+     * **/
+    private  String doctorRegister;
+    /**
+     * 医生多机构备案协议
+     * **/
+    private  String doctorFiling;
+    /**
+     * 药师注册协议
+     * **/
+    private  String pharmacistRegister;
+    /**
+     * 药师多机构备案协议
+     * **/
+    private  String pharmacistFiling;
+    /**
+     * 用户协议
+     * **/
+    private  String userRegister;
+    /**
+     * 隐私协议
+     * **/
+    private  String userPrivacy;
+    /**
+     * 健康客服协议
+     * **/
+    private  String userHealth;
+    /**
+     * 会员服务协议
+     * **/
+    private  String vipService;
+    /**
+     * 会员自动续费协议
+     * **/
+    private  String vipAutomaticService;
+    /**
+     * 用户注销协议
+     * **/
+    private  String userRemoveService;
+    /**
+     * 商家规则
+     * **/
+    private  String storeRules;
+    /**
+     * 入驻协议
+     * **/
+    private  String residencyAgreement;
+}

+ 4 - 0
fs-service/src/main/java/com/fs/course/vo/FsCoursePlaySourceConfigVO.java

@@ -58,4 +58,8 @@ public class FsCoursePlaySourceConfigVO {
 
     @ApiModelProperty("小程序状态:0正常,1半封禁,2封禁")
     private Integer status;
+    /**
+     *0未设置1部分设置2已设置
+     * **/
+    private Integer settingsProtocolType;
 }

+ 2 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsUserAddressServiceImpl.java

@@ -85,7 +85,8 @@ public class FsUserAddressServiceImpl implements IFsUserAddressService
     {
         fsUserAddress.setUpdateTime(DateUtils.getNowDate());
         if (fsUserAddress.getPhone()!=null&&fsUserAddress.getPhone().length()==11&&fsUserAddress.getPhone().matches("\\d+")){
-            fsUserAddress.setPhone(encryptPhone(fsUserAddress.getPhone()));
+            //            fsUserAddress.setPhone(encryptPhone(fsUserAddress.getPhone()));
+            fsUserAddress.setPhone(fsUserAddress.getPhone());
         }else {
             fsUserAddress.setPhone(null);
         }

+ 4 - 4
fs-service/src/main/java/com/fs/hisStore/param/FsStoreScrmInfoParam.java

@@ -21,8 +21,8 @@ public class FsStoreScrmInfoParam extends BaseEntity
     /** ID */
     private Long storeId;
 
-//    /** 所属城市ids */
-//    private String cityIds;
+    /** 所属城市ids */
+    private String cityIds;
 //
 //    /** 店铺名称 */
 //    private String storeName;
@@ -33,8 +33,8 @@ public class FsStoreScrmInfoParam extends BaseEntity
     /** 店铺LOGO */
     private String logoUrl;
 
-//    /** 地址 */
-//    private String address;
+    /** 地址 */
+    private String address;
 //
 //    /** 经度 */
 //    private String lng;

+ 15 - 2
fs-user-app/src/main/java/com/fs/app/controller/CommonController.java

@@ -30,6 +30,8 @@ import com.fs.common.utils.http.HttpUtils;
 import com.fs.common.utils.sign.Md5Utils;
 import com.fs.core.utils.OrderCodeUtils;
 import com.fs.course.config.CourseConfig;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.course.service.IHuaweiVodService;
 import com.fs.event.TemplateBean;
 import com.fs.event.TemplateEvent;
@@ -132,6 +134,9 @@ public class CommonController {
 	@Autowired
 	private IQwAppContactWayService qwAppContactWayService;
 
+	@Autowired
+	private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
+
 //	@Autowired
 //	private RocketMQTemplate rocketMQTemplate;
 //
@@ -309,11 +314,19 @@ public class CommonController {
 
 	@GetMapping(value = "/getConfigByKey")
 	@ApiOperation("获取配置")
-	public R getConfigByKey(@RequestParam(value = "key", required = false) String key)
+	public R getConfigByKey(@RequestParam(value = "key", required = false) String key,@RequestParam(value = "appId",required = false) String appId)
 	{
+		 if(StringUtils.isNotEmpty(appId) && "his.agreementConfig".equals("key")){
+			//获取APPID信息
+			key = "ProtocolConfig:"+appId;
+			//获取小程序配置数据
+			FsCoursePlaySourceConfig config = fsCoursePlaySourceConfigService.selectConfigByAppId(appId , key);
+			if(config != null){
+				return R.ok().put("data",config);
+			}
+		}
 		String config=configService.selectConfigByKey(key);
 		return  R.ok().put("data",config);
-
 	}