定时器测试1
parent
6860cd013b
commit
2ffeb09176
|
@ -1,9 +1,10 @@
|
|||
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.service.PurseServiceTwo;
|
||||
import com.ruoyi.mybasic.controller.PurseControllerTwo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -16,7 +17,7 @@ import org.springframework.stereotype.Component;
|
|||
public class SysUserPurse {
|
||||
|
||||
@Autowired
|
||||
private PurseServiceTwo purseServiceTwo;
|
||||
private PurseControllerTwo purseControllerTwo;
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
|
@ -32,14 +33,15 @@ public class SysUserPurse {
|
|||
System.out.println("~~~~~~定时器开始扫描钱包余额~~~~~~");
|
||||
//获取用户的编号
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
userId = (long)110;
|
||||
|
||||
//根据用户编号查询用户钱包
|
||||
PurseResponse purseResponse = purseServiceTwo.purseObject(userId);
|
||||
if (null == purseResponse){
|
||||
R<PurseResponse> purseResponseR = purseControllerTwo.purseObject();
|
||||
PurseResponse data = purseResponseR.getData();
|
||||
if (null == data){
|
||||
throw new RuntimeException("查无此用户!");
|
||||
}
|
||||
//钱包余额
|
||||
Integer balanceFee = purseResponse.getBalanceFee();
|
||||
Integer balanceFee = data.getBalanceFee();
|
||||
//将余额存入redis
|
||||
redisService.setCacheObject(userId + PURSE_NAME,balanceFee);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue