Administrator
5 days ago 61cc9037a887812963ea0f99b020e296a6268184
feat(mall): 增加活动热度排序功能并更新相关配置

- 在 ApiActivityInfoVo 中添加 hotCnt 字段用于表示活动热度
- 修改 HappyActivityOptionMapper.xml 中的 SQL 查询,支持按热度排序
- 更新 application-prod.yml 和 application-test.yml 中的数据库、Redis 和微信支付相关配置
- 优化 HappyActivityServiceImpl 中的代码,处理空值情况
5 files modified
55 ■■■■■ changed files
src/main/java/cc/mrbird/febs/mall/service/impl/HappyActivityServiceImpl.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/vo/ApiActivityInfoVo.java 3 ●●●●● patch | view | raw | blame | history
src/main/resources/application-prod.yml 31 ●●●● patch | view | raw | blame | history
src/main/resources/application-test.yml 6 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/HappyActivityOptionMapper.xml 8 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/HappyActivityServiceImpl.java
@@ -149,9 +149,10 @@
                //  使用Stream流操作happyFollows,按照type分类,返回每一个不同type的总数量,并返回一个Map
                Map<Integer, Long> typeCountMap = happyFollows.stream()
                        .collect(Collectors.groupingBy(HappyFollow::getType, Collectors.counting()));
                apiActivityVo.setZanCnt(Math.toIntExact(typeCountMap.get(StateUpDownEnum.LIKE.getCode())));
                apiActivityVo.setSendCnt(Math.toIntExact(typeCountMap.get(StateUpDownEnum.SHARE.getCode())));
                Long zanCnt = ObjectUtil.defaultIfNull(typeCountMap.get(StateUpDownEnum.LIKE.getCode()), 0L);
                apiActivityVo.setZanCnt(Math.toIntExact(zanCnt));
                Long sendCnt = ObjectUtil.defaultIfNull(typeCountMap.get(StateUpDownEnum.SHARE.getCode()), 0L);
                apiActivityVo.setSendCnt(Math.toIntExact(sendCnt));
            }
src/main/java/cc/mrbird/febs/mall/vo/ApiActivityInfoVo.java
@@ -44,6 +44,9 @@
    @ApiModelProperty(value = "参与人数")
    private Integer joinCnt;
    @ApiModelProperty(value = "热度")
    private Integer hotCnt;
    @ApiModelProperty(value = "参与头像")
    private List<String> memberAvatars;
src/main/resources/application-prod.yml
@@ -15,20 +15,20 @@
      datasource:
        # 数据源-1,名称为 base
        base:
          username: blnka
          password: blnka!@#123
          username: happy_community_365
          password: happy_community_365!@#
          driver-class-name: com.mysql.cj.jdbc.Driver
          url: jdbc:mysql://127.0.0.1:3306/db_blnka?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
          url: jdbc:mysql://127.0.0.1:3306/happy_community_365?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
  redis:
    # Redis数据库索引(默认为 0)
    database: 1
    database: 2
    # Redis服务器地址
    host: 127.0.0.1
    # Redis服务器连接端口
    port: 6279
    # Redis 密码
    password: blnka!@#123
    password: 1234!@#$!QAZ
    lettuce:
      pool:
        # 连接池中的最小空闲连接
@@ -44,8 +44,8 @@
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: blnka
    password: blnka123
    username: xc_rabbit
    password: xuncong123
    publisher-confirm-type: correlated
pay:
@@ -61,15 +61,16 @@
xcx:
  wechar_login_url: https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code
  xcx_appid: wxad2fdb2fcad10fb2
  xcx_secret: 9bb58d655bff419feec3a6d948ca8b8d
  xcx_appid: wxe8454293f5c4c143
  xcx_secret: 33c3ad513344cf6c16904e5d528b70ea
  debug: false
  wecharPaynotifyUrl: http://api.blnka.cn/api/xcxPay/wxpayCallback
  wecharRechargePaynotifyUrl: http://api.blnka.cn/api/xcxPay/rechargeCallBack
  certLocalPath: /home/blnkaCert/apiclient_cert.p12
  wecharpayMchid: 1658958205
  wecharpaySecret: daL341aN5orDt13puXadsAf2rpuXdq4r
  wecharpaySecretV3: daL341aN5orDt13puXadsAf2rpuX12v3
  wecharPaynotifyUrl: http://happy.csxuncong.com/api/xcxPay/wxpayCallback
  wecharActivityPaynotifyUrl: http://happy.csxuncong.com/api/xcxPay/activityOrderCallback
  wecharRechargePaynotifyUrl: http://happy.csxuncong.com/api/xcxPay/rechargeCallBack
  certLocalPath: /home/cert/apiclient_cert.p12
  wecharpayMchid: 1714199495
  wecharpaySecret: kKUSYkP73JiCAzDGu2ZfecJNfhvh3sSc
  wecharpaySecretV3: 1234567hnggcmyxgs731907666310878
  gaodeKey: 95ede7157929f5f6b6c758971be924b1
  serviceName: yiyuanshucai
src/main/resources/application-test.yml
@@ -73,9 +73,9 @@
  xcx_appid: wxe8454293f5c4c143
  xcx_secret: 33c3ad513344cf6c16904e5d528b70ea
  debug: true
  wecharPaynotifyUrl: http://blnka.csxuncong.com/api/xcxPay/wxpayCallback
  wecharActivityPaynotifyUrl: http://blnka.csxuncong.com/api/xcxPay/activityOrderCallback
  wecharRechargePaynotifyUrl: http://blnka.csxuncong.com/api/xcxPay/rechargeCallBack
  wecharPaynotifyUrl: http://happy.csxuncong.com/api/xcxPay/wxpayCallback
  wecharActivityPaynotifyUrl: http://happy.csxuncong.com/api/xcxPay/activityOrderCallback
  wecharRechargePaynotifyUrl: http://happy.csxuncong.com/api/xcxPay/rechargeCallBack
  certLocalPath: /home/cert/apiclient_cert.p12
  wecharpayMchid: 1714199495
  wecharpaySecret: kKUSYkP73JiCAzDGu2ZfecJNfhvh3sSc
src/main/resources/mapper/modules/HappyActivityOptionMapper.xml
@@ -30,7 +30,13 @@
                </if>
            </if>
        </where>
        order by a.order_cnt asc, a.id desc
        <if test="record.hotState != null">
            order by (select count(id) from happy_follow where source_id = a.id and type in (2,3)) desc,a.order_cnt asc
        </if>
        <if test="record.hotState == null">
            order by a.order_cnt asc,a.id desc
        </if>
    </select>
    <select id="getVoteRecordInPage" resultType="cc.mrbird.febs.mall.vo.ApiVoteRecordInPageVo">