| | |
| | | |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private final TokenService tokenService; |
| | | private final TSysAppUserService sysAppUserService; |
| | | private final AIUtil aiUtil; |
| | | private final RedisCache redisCache; |
| | | @Autowired |
| | | public TSysInspectionController(TSysInspectionService sysInspectionService, TokenService tokenService, TSysAppUserService sysAppUserService, AIUtil aiUtil) { |
| | | public TSysInspectionController(TSysInspectionService sysInspectionService, TokenService tokenService, TSysAppUserService sysAppUserService, AIUtil aiUtil, RedisCache redisCache) { |
| | | this.sysInspectionService = sysInspectionService; |
| | | this.tokenService = tokenService; |
| | | this.sysAppUserService = sysAppUserService; |
| | | this.aiUtil = aiUtil; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | /** |
| | |
| | | public R<String> ssoLogin() { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TSysAppUser sysAppUser = sysAppUserService.getById(userId); |
| | | if(StringUtils.isEmpty(sysAppUser.getNickName()) || Objects.isNull(sysAppUser.getSex()) || Objects.isNull(sysAppUser.getBirthTime())){ |
| | | if(StringUtils.isEmpty(sysAppUser.getNickName()) || Objects.isNull(sysAppUser.getSex()) || Objects.isNull(sysAppUser.getBirthTime()) || StringUtils.isEmpty(sysAppUser.getPhone())){ |
| | | return R.fail("请先完善用户信息"); |
| | | } |
| | | int code = aiUtil.ssoLogin().getCode(); |
| | | R<String> ssoLogin = aiUtil.ssoLogin(userId); |
| | | int code = ssoLogin.getCode(); |
| | | if(code != 200){ |
| | | return R.fail("单点登录失败"); |
| | | } |
| | |
| | | if(code != 200){ |
| | | return R.fail("初始化用户失败"); |
| | | } |
| | | return R.ok(); |
| | | // 存储用户当日检测 |
| | | Set<String> userSet = new HashSet<>(); |
| | | userSet.add(sysAppUser.getPhone()); |
| | | redisCache.setCacheSet(Constants.AI_USER_INSPECTION,userSet); |
| | | return R.ok(ssoLogin.getData()); |
| | | } |
| | | |
| | | } |