luolinsong 3 недель назад
Родитель
Сommit
8d20a51f6a

+ 1 - 0
fs-common/src/main/java/com/fs/common/constant/Constants.java

@@ -116,6 +116,7 @@ public class Constants
      * 参数管理 cache key
      * 参数管理 cache key
      */
      */
     public static final String SYS_CONFIG_KEY = "sys_config:";
     public static final String SYS_CONFIG_KEY = "sys_config:";
+    public static final String SYS_CONFIG_KEY_HY = "sys_config_hy:";
 
 
     /**
     /**
      * 字典管理 cache key
      * 字典管理 cache key

+ 2 - 0
fs-service-system/src/main/java/com/fs/live/mapper/LiveLotteryRegistrationMapper.java

@@ -73,4 +73,6 @@ public interface LiveLotteryRegistrationMapper {
     int selectRecord(@Param("userId") Long userId,@Param("lotteryId") Long lotteryId);
     int selectRecord(@Param("userId") Long userId,@Param("lotteryId") Long lotteryId);
 
 
     int updateLiveLotteryRegistrationNoId(LiveLotteryRegistration liveLotteryRegistration);
     int updateLiveLotteryRegistrationNoId(LiveLotteryRegistration liveLotteryRegistration);
+
+    Integer selectToDayLiveLotteryRegistration(@Param("userId") Long userId);
 }
 }

+ 1 - 0
fs-service-system/src/main/java/com/fs/live/service/ILiveLotteryRegistrationService.java

@@ -20,6 +20,7 @@ public interface ILiveLotteryRegistrationService {
      */
      */
     LiveLotteryRegistration selectLiveLotteryRegistrationByRegistrationId(Long registrationId);
     LiveLotteryRegistration selectLiveLotteryRegistrationByRegistrationId(Long registrationId);
 
 
+    Integer selectToDayLiveLotteryRegistration(Long userId);
     /**
     /**
      * 查询直播抽奖登记列表
      * 查询直播抽奖登记列表
      *
      *

+ 5 - 0
fs-service-system/src/main/java/com/fs/live/service/impl/LiveLotteryRegistrationServiceImpl.java

@@ -32,6 +32,11 @@ public class LiveLotteryRegistrationServiceImpl implements ILiveLotteryRegistrat
         return baseMapper.selectLiveLotteryRegistrationByRegistrationId(registrationId);
         return baseMapper.selectLiveLotteryRegistrationByRegistrationId(registrationId);
     }
     }
 
 
+    @Override
+    public Integer selectToDayLiveLotteryRegistration(Long userId) {
+        return baseMapper.selectToDayLiveLotteryRegistration(userId);
+    }
+
     /**
     /**
      * 查询直播抽奖登记列表
      * 查询直播抽奖登记列表
      *
      *

+ 151 - 0
fs-service-system/src/main/java/com/fs/store/config/IntegralConfig.java

@@ -0,0 +1,151 @@
+package com.fs.store.config;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class IntegralConfig implements Serializable {
+    private Integer integralNewTask;
+    private Integer integralRatio; //消费购买比例
+    private Integer integralShare;//分享获取积分
+    private Integer integralFollow;//随访获取积分
+    private Integer integralCourse;//观看课程获取积分
+    private Integer integralProduct;//浏览商品获得积分
+    private Integer integralFirstVideo;//短视频首次获得积分
+    private Integer integralFinishVideo;//短视频最低获得积分
+    private Integer integralByOneDay;//单日可获取最高积分
+    private List<Integer> integralTypeByOneDay;//单日可获取积分类型
+
+    private Integer integralInvite;//邀请新用户获得积分
+
+    private Integer integralInvited;//填写邀请码获得积分
+    private Integer integralTalentVideo;//达人发布短视频获取积分
+    private BigDecimal integralUserRatio;// 广告联盟 用户分润比例
+    private BigDecimal integralCompanyRatio;// 广告联盟 公司分润比例
+    private BigDecimal integralHuYiRatio;// 广告联盟 互医分润比例
+    private BigDecimal integralYunLianRatio;// 广告联盟 云联分润比例
+    private Integer minimumIntegral; // 广告联盟 用户保底收益
+
+    //被邀请人奖励配置id
+    private Long rewardId;
+    //邀请人奖励配置id
+    private Long inviterRewardId;
+    //积分提现商户配置
+    private Integer isNew;//0:老商户 商家转账到零钱 1:新商户 商家转账
+
+    /**
+     * 商户号.
+     */
+    private String mchId;
+    /**
+     * 商户密钥.
+     */
+    private String mchKey;
+
+    /**
+     * p12证书文件的绝对路径或者以classpath:开头的类路径.
+     */
+    private String keyPath;
+
+    /**
+     * apiclient_key.pem证书文件的绝对路径或者以classpath:开头的类路径.
+     */
+    private String privateKeyPath;
+
+    /**
+     * apiclient_cert.pem证书文件的绝对路径或者以classpath:开头的类路径.
+     */
+    private String privateCertPath;
+
+    /**
+     * apiV3 秘钥值.
+     */
+    private String apiV3Key;
+    /**
+     * 公钥ID
+     */
+    private String publicKeyId;
+
+    /**
+     * pub_key.pem证书文件的绝对路径或者以classpath:开头的类路径.
+     */
+    private String publicKeyPath;
+
+    private String notifyUrl;
+
+    //一次允许提现最大金额(元)
+    private BigDecimal maxApplicationAmount;
+
+    //一天允提现次数
+    private Integer withdrawNum;
+
+    //连续提现几天封控
+    private Integer limitDayNum;
+
+    //连续提现几天封控
+    private BigDecimal limitAmount;
+    private Long defaultGrandGift; // 签到大礼品配置
+
+
+    //消费获得芳华币限制数量 2
+    private Integer RestrictionsConsumption;
+
+    //签到获得芳华币限制数量 1
+    private Integer SignFangHuaCoinRestriction;
+
+    //签到大礼品抽奖限制次数
+    private Integer SignBigGiftRestrictions;
+
+    //分享获得芳华币奖限制数量 3
+    private Integer ShareFangHuaRestrictions;
+
+    //完成随访获得芳华币奖限制数量 6
+    private Integer CompleteFollowFangHuaRestriction;
+
+    //观看团队科普选择大礼品抽奖限制次数
+    private Integer WatchTeamPopularizationRestrictions;
+
+    //观看团队科普选择直接获得芳华币限制数量 33
+    private Integer WatchTeamPopularizationFangHuaRestrictions;
+
+    //完成就诊人信息获得芳华币限制数量 11
+    private Integer CompletePatientFangHuaRestriction;
+
+    //填写收货地址获得芳华币限制数量 12
+    private Integer EnterShippingAddressRestrictions;
+
+    //浏览商品获得芳华币限制数量 13
+    private Integer BrowseProductsRestriction;
+
+    //浏览短视频获得芳华币限制数量 14
+    private Integer BrowseVideosFangHuaRestriction;
+
+    //公开课获得芳华币限制数量 10
+    private Integer RestrictionsFangHuaRestriction;
+
+    //首次下单疗法获得芳华币限制数量 15
+    private Integer FirstOrderingRestriction;
+
+    //邀请新用户大礼品抽奖限制次数
+    private Integer InviteNewUsersRestrictions;
+
+    //填写邀请码大礼品抽奖限制次数
+    private Integer FillInvitationCodeRestrictions;
+
+    //发布视频获得芳华币限制数量 21
+    private Integer ReleaseVideosFangHuaRestrictions;
+
+    //直播间奖励芳华币限制数量 28
+    private Integer LiveRoomRewardsRestrictions;
+
+    //直播间大礼品抽奖限制次数
+    private Integer LiveRoomBigGiftRestrictions;
+
+    //看广告获得芳华币限制数量 31
+    private Integer WatchAdsFangHuaRestrictions;
+
+
+}

+ 7 - 0
fs-service-system/src/main/java/com/fs/system/mapper/SysConfigMapper.java

@@ -1,6 +1,9 @@
 package com.fs.system.mapper;
 package com.fs.system.mapper;
 
 
 import java.util.List;
 import java.util.List;
+
+import com.fs.common.annotation.DataSource;
+import com.fs.common.enums.DataSourceType;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.domain.SysConfig;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
 
 
@@ -19,6 +22,10 @@ public interface SysConfigMapper
      */
      */
     public SysConfig selectConfig(SysConfig config);
     public SysConfig selectConfig(SysConfig config);
 
 
+    //查询互医的配置文件
+    @DataSource(DataSourceType.HUYI)
+    public SysConfig selectConfigByHy(SysConfig config);
+
     /**
     /**
      * 查询参数配置列表
      * 查询参数配置列表
      * 
      * 

+ 3 - 0
fs-service-system/src/main/java/com/fs/system/service/ISysConfigService.java

@@ -26,6 +26,9 @@ public interface ISysConfigService
      */
      */
     public String selectConfigByKey(String configKey);
     public String selectConfigByKey(String configKey);
 
 
+
+    public String selectConfigKeyByHY(String configKey);
+
     /**
     /**
      * 查询参数配置列表
      * 查询参数配置列表
      * 
      * 

+ 23 - 0
fs-service-system/src/main/java/com/fs/system/service/impl/SysConfigServiceImpl.java

@@ -85,6 +85,24 @@ public class SysConfigServiceImpl implements ISysConfigService
         return StringUtils.EMPTY;
         return StringUtils.EMPTY;
     }
     }
 
 
+    @Override
+    public String selectConfigKeyByHY(String configKey) {
+        String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKeyHy(configKey)));
+        if (StringUtils.isNotEmpty(configValue))
+        {
+            return configValue;
+        }
+        SysConfig config = new SysConfig();
+        config.setConfigKey(configKey);
+        SysConfig retConfig = configMapper.selectConfigByHy(config);
+        if (StringUtils.isNotNull(retConfig))
+        {
+            redisCache.setCacheObject(getCacheKeyHy(configKey), retConfig.getConfigValue());
+            return retConfig.getConfigValue();
+        }
+        return StringUtils.EMPTY;
+    }
+
     /**
     /**
      * 查询参数配置列表
      * 查询参数配置列表
      *
      *
@@ -203,4 +221,9 @@ public class SysConfigServiceImpl implements ISysConfigService
     {
     {
         return Constants.SYS_CONFIG_KEY + configKey;
         return Constants.SYS_CONFIG_KEY + configKey;
     }
     }
+
+    private String getCacheKeyHy(String configKey)
+    {
+        return Constants.SYS_CONFIG_KEY_HY + configKey;
+    }
 }
 }

+ 8 - 0
fs-service-system/src/main/resources/mapper/live/LiveLotteryRegistrationMapper.xml

@@ -32,6 +32,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where registration_id = #{registrationId}
         where registration_id = #{registrationId}
     </select>
     </select>
 
 
+    <select id="selectToDayLiveLotteryRegistration" resultType="java.lang.Integer">
+        SELECT COALESCE(SUM(live_id), 0) AS todayTotalRegistration FROM live_lottery_registration
+        AND user_id=#{userId}
+        and is_win = 1
+        AND create_time <![CDATA[>=]]> CURDATE()
+        AND create_time <![CDATA[<]]> DATE_ADD(CURDATE(), INTERVAL 1 DAY)
+    </select>
+
     <insert id="insertLiveLotteryRegistration" parameterType="LiveLotteryRegistration" useGeneratedKeys="true" keyProperty="registrationId">
     <insert id="insertLiveLotteryRegistration" parameterType="LiveLotteryRegistration" useGeneratedKeys="true" keyProperty="registrationId">
         insert into live_lottery_registration
         insert into live_lottery_registration
         <trim prefix="(" suffix=")" suffixOverrides=",">
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 8 - 2
fs-service-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -32,12 +32,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			</if>
 			</if>
 		</where>
 		</where>
 	</sql>
 	</sql>
-    
+
     <select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
     <select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
         <include refid="selectConfigVo"/>
         <include refid="selectConfigVo"/>
         <include refid="sqlwhereSearch"/>
         <include refid="sqlwhereSearch"/>
     </select>
     </select>
-    
+
+    <select id="selectConfigByHy" parameterType="SysConfig" resultMap="SysConfigResult">
+        <include refid="selectConfigVo"/>
+        <include refid="sqlwhereSearch"/>
+    </select>
+
+
     <select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
     <select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
         <include refid="selectConfigVo"/>
         <include refid="selectConfigVo"/>
         <where>
         <where>

+ 18 - 2
fs-user-app/src/main/java/com/fs/app/controller/LiveLotteryController.java

@@ -1,14 +1,19 @@
 package com.fs.app.controller;
 package com.fs.app.controller;
 
 
+import cn.hutool.json.JSONUtil;
 import com.fs.app.annotation.Login;
 import com.fs.app.annotation.Login;
 import com.fs.app.facade.LiveFacadeService;
 import com.fs.app.facade.LiveFacadeService;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.R;
+import com.fs.common.exception.CustomException;
 import com.fs.common.param.BaseQueryParam;
 import com.fs.common.param.BaseQueryParam;
 import com.fs.live.param.LotteryPO;
 import com.fs.live.param.LotteryPO;
 import com.fs.live.service.ILiveLotteryConfService;
 import com.fs.live.service.ILiveLotteryConfService;
+import com.fs.live.service.ILiveLotteryRegistrationService;
 import com.fs.live.vo.LiveUserLotteryRecordVo;
 import com.fs.live.vo.LiveUserLotteryRecordVo;
+import com.fs.store.config.IntegralConfig;
 import com.fs.store.param.FsMyStoreOrderQueryParam;
 import com.fs.store.param.FsMyStoreOrderQueryParam;
 import com.fs.store.vo.FsMyStoreOrderListQueryVO;
 import com.fs.store.vo.FsMyStoreOrderListQueryVO;
+import com.fs.system.service.ISysConfigService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,8 +29,10 @@ public class LiveLotteryController extends AppBaseController{
     private ILiveLotteryConfService liveLotteryConfService;
     private ILiveLotteryConfService liveLotteryConfService;
     @Autowired
     @Autowired
     private LiveFacadeService liveFacadeService;
     private LiveFacadeService liveFacadeService;
-
-
+    @Autowired
+    private ISysConfigService configService;
+    @Autowired
+    private ILiveLotteryRegistrationService liveLotteryRegistrationService;
 /*    *//**
 /*    *//**
      * 参与抽奖
      * 参与抽奖
      * *//*
      * *//*
@@ -43,6 +50,15 @@ public class LiveLotteryController extends AppBaseController{
 /*        lottery.setUserId(Long.parseLong(getUserId()));
 /*        lottery.setUserId(Long.parseLong(getUserId()));
         return liveLotteryConfService.claimLotteryPacket(lottery);*/
         return liveLotteryConfService.claimLotteryPacket(lottery);*/
         lottery.setUserId(Long.parseLong(getUserId()));
         lottery.setUserId(Long.parseLong(getUserId()));
+
+        String ssss = configService.selectConfigKeyByHY("his.integral");
+        IntegralConfig integralConfig = JSONUtil.toBean(ssss, IntegralConfig.class);
+        if (integralConfig.getLiveRoomBigGiftRestrictions() != null) {
+            Integer todayTotalIntegral =  liveLotteryRegistrationService.selectToDayLiveLotteryRegistration(lottery.getUserId());
+            if (todayTotalIntegral >= integralConfig.getLiveRoomBigGiftRestrictions()) {
+                throw new CustomException("您真棒!今天的直播间大礼品抽奖已达到上限,明天再来吧");
+            }
+        }
         return liveFacadeService.drawClaim(lottery);
         return liveFacadeService.drawClaim(lottery);
     }
     }
 
 

+ 11 - 1
fs-user-app/src/main/java/com/fs/core/config/DruidConfig.java

@@ -54,9 +54,19 @@ public class DruidConfig
         Map<Object, Object> targetDataSources = new HashMap<>();
         Map<Object, Object> targetDataSources = new HashMap<>();
         targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
         targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
         setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
         setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
+        setDataSource(targetDataSources, DataSourceType.HUYI.name(), "huyiDataSource");
         return new DynamicDataSource(masterDataSource, targetDataSources);
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }
     }
-    
+
+    @Bean
+    @ConfigurationProperties("spring.datasource.druid.huyi")
+    @ConditionalOnProperty(prefix = "spring.datasource.druid.huyi", name = "enabled", havingValue = "true", matchIfMissing = true)
+    public DataSource huyiDataSource(DruidProperties druidProperties)
+    {
+        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+        return druidProperties.dataSource(dataSource);
+    }
+
     /**
     /**
      * 设置数据源
      * 设置数据源
      * 
      * 

+ 13 - 0
fs-user-app/src/main/resources/application-dev.yml

@@ -55,6 +55,19 @@ spring:
                 maxActive: 400
                 maxActive: 400
                 # 配置获取连接等待超时的时间
                 # 配置获取连接等待超时的时间
                 maxWait: 60000
                 maxWait: 60000
+            # huyi 数据源
+            huyi:
+                url: jdbc:mysql://1.14.207.209:8008/fs_his?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                username: root
+                password: X7k#9mPq$2LvR&5n
+                # 初始连接数
+                initialSize: 15
+                # 最小连接池数量
+                minIdle: 15
+                # 最大连接池数量
+                maxActive: 100
+                # 配置获取连接等待超时的时间
+                maxWait: 60000
             # 初始连接数
             # 初始连接数
             initialSize: 500
             initialSize: 500
             # 最小连接池数量
             # 最小连接池数量