From 61cc9037a887812963ea0f99b020e296a6268184 Mon Sep 17 00:00:00 2001 From: Administrator <15274802129@163.com> Date: Sun, 27 Apr 2025 13:41:11 +0800 Subject: [PATCH] feat(mall): 增加活动热度排序功能并更新相关配置 --- src/main/resources/mapper/modules/HappyActivityOptionMapper.xml | 8 +++++++- src/main/java/cc/mrbird/febs/mall/service/impl/HappyActivityServiceImpl.java | 7 ++++--- src/main/resources/application-prod.yml | 31 ++++++++++++++++--------------- src/main/java/cc/mrbird/febs/mall/vo/ApiActivityInfoVo.java | 3 +++ src/main/resources/application-test.yml | 6 +++--- 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/HappyActivityServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/HappyActivityServiceImpl.java index e958db3..2181d6d 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/HappyActivityServiceImpl.java +++ b/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)); } diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ApiActivityInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ApiActivityInfoVo.java index f19dae5..ebd3008 100644 --- a/src/main/java/cc/mrbird/febs/mall/vo/ApiActivityInfoVo.java +++ b/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; diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index a610917..89c35c1 100644 --- a/src/main/resources/application-prod.yml +++ b/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 diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 5fe31ed..d28f458 100644 --- a/src/main/resources/application-test.yml +++ b/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 diff --git a/src/main/resources/mapper/modules/HappyActivityOptionMapper.xml b/src/main/resources/mapper/modules/HappyActivityOptionMapper.xml index 699c95e..a4f9cf7 100644 --- a/src/main/resources/mapper/modules/HappyActivityOptionMapper.xml +++ b/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"> -- Gitblit v1.9.1