定时器测试2
parent
2ffeb09176
commit
1fef9d675d
|
@ -1,10 +1,9 @@
|
|||
package com.ruoyi.mybasic.timer;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.redis.service.RedisService;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.mybasic.common.domain.response.PurseResponse;
|
||||
import com.ruoyi.mybasic.controller.PurseControllerTwo;
|
||||
import com.ruoyi.mybasic.service.PurseServiceTwo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -17,7 +16,7 @@ import org.springframework.stereotype.Component;
|
|||
public class SysUserPurse {
|
||||
|
||||
@Autowired
|
||||
private PurseControllerTwo purseControllerTwo;
|
||||
private PurseServiceTwo purseServiceTwo;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
|
@ -35,13 +34,13 @@ public class SysUserPurse {
|
|||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
//根据用户编号查询用户钱包
|
||||
R<PurseResponse> purseResponseR = purseControllerTwo.purseObject();
|
||||
PurseResponse data = purseResponseR.getData();
|
||||
if (null == data){
|
||||
PurseResponse purseResponse = purseServiceTwo.purseObject(userId);
|
||||
|
||||
if (null == purseResponse){
|
||||
throw new RuntimeException("查无此用户!");
|
||||
}
|
||||
//钱包余额
|
||||
Integer balanceFee = data.getBalanceFee();
|
||||
Integer balanceFee = purseResponse.getBalanceFee();
|
||||
//将余额存入redis
|
||||
redisService.setCacheObject(userId + PURSE_NAME,balanceFee);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue