From 6ff2e616cd1c1e986735c5a8c1f991ab9dfe5ec4 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期日, 04 一月 2026 14:32:59 +0800
Subject: [PATCH] bugfix:token失效时间延长、佣金计算问题等。
---
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java | 2 +-
ruoyi-applet/src/main/resources/application-prod.yml | 8 ++++----
ruoyi-system/src/main/resources/mapper/system/AppletOrderMapper.xml | 4 +++-
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 4 ++--
ruoyi-system/src/main/java/com/ruoyi/system/vo/AppletOrderListVO.java | 3 +++
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ICBCNotifyServiceImpl.java | 30 ++++++++++++++++++++++++------
ruoyi-applet/src/main/resources/application-test.yml | 6 +++---
7 files changed, 40 insertions(+), 17 deletions(-)
diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
index c64f2b3..0a9d81a 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/IndexController.java
@@ -58,7 +58,7 @@
supervisorUserVO.setId(sysUser.getUserId().intValue());
supervisorUserVO.setPhone((String) PhoneUtil.hideBetween(sysUser.getPhonenumber()));
supervisorUserVO.setNickName(sysUser.getNickName());
- supervisorUserVO.setAvatar(""); //todo 设置默认头像
+ supervisorUserVO.setAvatar(sysUser.getAvatar());
}
} else {
tAppUserService.lambdaQuery().eq(TAppUser::getCode, spreadCode).ne(TAppUser::getStatus, 3).last("LIMIT 1").oneOpt()
diff --git a/ruoyi-applet/src/main/resources/application-prod.yml b/ruoyi-applet/src/main/resources/application-prod.yml
index bb28d30..6fc8e7a 100644
--- a/ruoyi-applet/src/main/resources/application-prod.yml
+++ b/ruoyi-applet/src/main/resources/application-prod.yml
@@ -162,8 +162,8 @@
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
- # 令牌有效期(默认30分钟)
- expireTime: 120
+ # 令牌有效期(默认30分钟)一周过期
+ expireTime: 10080
mybatis-plus:
# 此处在多数据源中生效
@@ -282,6 +282,6 @@
# 微信公众号的APP编号,供公众号支付使用
wx-gzh-app-id: ""
- # 订单超时时间,单位为分钟
- expire-time: "60"
+ # 订单超时时间,单位为秒
+ expire-time: "3600"
diff --git a/ruoyi-applet/src/main/resources/application-test.yml b/ruoyi-applet/src/main/resources/application-test.yml
index f97d2be..3ba7cb7 100644
--- a/ruoyi-applet/src/main/resources/application-test.yml
+++ b/ruoyi-applet/src/main/resources/application-test.yml
@@ -154,8 +154,8 @@
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
- # 令牌有效期(默认30分钟)
- expireTime: 120
+ # 令牌有效期(默认30分钟)一周过期
+ expireTime: 10080
mybatis-plus:
# 此处在多数据源中生效
@@ -282,7 +282,7 @@
wx-gzh-app-id: ""
# 订单超时时间,单位为分钟
- expire-time: "60"
+ expire-time: "3600"
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ICBCNotifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ICBCNotifyServiceImpl.java
index 9a030f0..0e9609d 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ICBCNotifyServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ICBCNotifyServiceImpl.java
@@ -12,6 +12,7 @@
import com.ruoyi.system.enums.BigGiftPackageOrderStatusEnum;
import com.ruoyi.system.enums.PhysicalGoodsOrderStatusEnum;
import com.ruoyi.system.model.TAppUser;
+import com.ruoyi.system.model.TBigGiftPackage;
import com.ruoyi.system.model.TBigGiftPackageOrder;
import com.ruoyi.system.model.TPhysicalGoodsOrder;
import com.ruoyi.system.service.*;
@@ -42,6 +43,8 @@
public class ICBCNotifyServiceImpl implements ICBCNotifyService {
private final ICBCConfig icbcConfig;
+
+ private final TBigGiftPackageService bigGiftPackageService;
private final TBigGiftPackageOrderService bigGiftPackageOrderService;
@@ -157,14 +160,22 @@
bigGiftPackageOrderService.updateById(order);
log.info("订单{}状态更新为完成支付", order.getCode());
- // 尾款支付完成后,必须计算分佣
+ // 查询最新大礼包商品配置,获取积分结算价用于佣金计算
+ TBigGiftPackage bigGiftPackage = bigGiftPackageService.getById(order.getBigGiftPackageId());
+ if (bigGiftPackage == null || bigGiftPackage.getPointsSettlementPrice() == null) {
+ log.error("订单{}对应的大礼包商品配置不存在或积分结算价为空,无法计算佣金", order.getCode());
+ sendResponse(response, signResult, msgId);
+ return;
+ }
+
+ // 尾款支付完成后,使用大礼包商品配置的积分结算价计算分佣
commissionTransactionFlowService.calculateAndSaveCommission(
order.getId(),
1, // 订单类型:1=大礼包
- order.getOrderPrice(),
+ bigGiftPackage.getPointsSettlementPrice(),
order.getAppUserId()
);
- log.info("订单{}分佣计算完成", order.getCode());
+ log.info("订单{}分佣计算完成,使用积分结算价:{}", order.getCode(), bigGiftPackage.getPointsSettlementPrice());
// 处理用户推荐状态和公司关联
processUserReferrerAndCompany(order.getAppUserId());
@@ -268,14 +279,20 @@
// 判断是否启用生效日
Boolean effectDayFlag = order.getEffectDayFlag();
if (effectDayFlag == null || !effectDayFlag) {
- // 未启用生效日,立即计算分佣
+ // 查询最新大礼包商品配置,获取积分结算价用于佣金计算
+ TBigGiftPackage bigGiftPackage = bigGiftPackageService.getById(order.getBigGiftPackageId());
+ if (bigGiftPackage == null || bigGiftPackage.getPointsSettlementPrice() == null) {
+ log.error("订单{}对应的大礼包商品配置不存在或积分结算价为空,无法计算佣金", order.getCode());
+ return;
+ }
+ // 未启用生效日,使用大礼包商品配置的积分结算价立即计算分佣
commissionTransactionFlowService.calculateAndSaveCommission(
order.getId(),
1, // 订单类型:1=大礼包
- order.getOrderPrice(),
+ bigGiftPackage.getPointsSettlementPrice(),
order.getAppUserId()
);
- log.info("订单{}未启用生效日,立即计算分佣", order.getCode());
+ log.info("订单{}未启用生效日,立即计算分佣,使用积分结算价:{}", order.getCode(), bigGiftPackage.getPointsSettlementPrice());
} else {
// 启用生效日,不计算分佣(由定时任务处理)
log.info("订单{}启用生效日,延迟计算分佣", order.getCode());
@@ -377,6 +394,7 @@
* @param appUserId 下单用户ID
*/
private void processUserReferrerAndCompany(Integer appUserId) {
+ log.info("开始处理用户{}推荐状态和公司关联", appUserId);
if (appUserId == null) {
return;
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/AppletOrderListVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/AppletOrderListVO.java
index 17c273d..0b0d179 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/AppletOrderListVO.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/AppletOrderListVO.java
@@ -23,6 +23,9 @@
@ApiModelProperty(value = "订单编号")
private String code;
+ @ApiModelProperty(value = "商品ID")
+ private Integer goodsId;
+
@ApiModelProperty(value = "商品名称")
private String goodsName;
diff --git a/ruoyi-system/src/main/resources/mapper/system/AppletOrderMapper.xml b/ruoyi-system/src/main/resources/mapper/system/AppletOrderMapper.xml
index 56c4ecb..9ba74a3 100644
--- a/ruoyi-system/src/main/resources/mapper/system/AppletOrderMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/AppletOrderMapper.xml
@@ -3,11 +3,12 @@
<mapper namespace="com.ruoyi.system.mapper.AppletOrderMapper">
<select id="selectOrderList" resultType="com.ruoyi.system.vo.AppletOrderListVO">
- SELECT t.id, t.code, t.goodsName, t.goodsIntro, t.goodsCover, t.goodsPrice, t.createTime, t.orderType, t.status
+ SELECT t.id, t.code, t.goodsName, t.goodsIntro, t.goodsCover, t.goodsPrice, t.createTime, t.orderType, t.status,t.goodsId
FROM (
SELECT
o.id,
o.code,
+ JSON_UNQUOTE(JSON_EXTRACT(o.big_gift_package, '$.id')) AS goodsId,
JSON_UNQUOTE(JSON_EXTRACT(o.big_gift_package, '$.name')) AS goodsName,
JSON_UNQUOTE(JSON_EXTRACT(o.big_gift_package, '$.introduction')) AS goodsIntro,
JSON_UNQUOTE(JSON_EXTRACT(o.big_gift_package, '$.coverImage')) AS goodsCover,
@@ -25,6 +26,7 @@
SELECT
o.id,
o.code,
+ JSON_UNQUOTE(JSON_EXTRACT(o.physical_goods, '$.id')) AS goodsId,
JSON_UNQUOTE(JSON_EXTRACT(o.physical_goods, '$.name')) AS goodsName,
JSON_UNQUOTE(JSON_EXTRACT(o.physical_goods, '$.introduction')) AS goodsIntro,
JSON_UNQUOTE(JSON_EXTRACT(o.physical_goods, '$.coverImage')) AS goodsCover,
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 972f7d3..0eea863 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -133,7 +133,7 @@
select u.user_id AS userId, u.dept_id AS deptId, u.user_name AS userName, u.nick_name AS nickName, u.email AS email, u.avatar AS avatar,
u.phonenumber AS phonenumber, u.sex AS sex, u.status AS status, u.del_flag AS delFlag, u.login_ip AS loginIp,
u.login_date AS loginDate, u.create_by AS createBy, u.create_time AS createTime, u.remark AS remark,u.code,
- ur.role_id AS roleId,sr.role_name AS roleName
+ ur.role_id AS roleId,sr.role_name AS roleName, u.company_id
from sys_user u
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role sr on ur.role_id = sr.role_id
@@ -295,7 +295,7 @@
<select id="selectByCode" resultType="com.ruoyi.common.core.domain.entity.SysUser">
select * from sys_user
<where>
- role_type = 3 and del_flag = 0 and code = #{spreadCode}
+ role_type != 1 and del_flag = 0 and code = #{spreadCode}
</where>
</select>
<select id="getUserByCompanyId" resultType="com.ruoyi.common.core.domain.entity.SysUser"
--
Gitblit v1.7.1