瀏覽代碼

代码修改

LAPTOP-KB9HII50\70708 3 年之前
父節點
當前提交
9183def44e

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/gateway/GcTokenController.java

@ -59,7 +59,7 @@ public class GcTokenController {
            ip = IpUtil.getIpAddress(request);
            //查询appId 的token是否过期
            GcToken gcToken = new GcToken();
            List<GcToken> gcTokenList = gcTokenService.findByAppId(appid);
            List<GcToken> gcTokenList = gcTokenService.findByAppId(appid,new Date());
            if(gcTokenList == null || gcTokenList.size() == 0){
                //得到用户
                GcClientDetails clientDetails = clientDetailsService.findByAppId(appid);

+ 3 - 2
svr/svr-iot/src/main/java/com/yihu/iot/dao/gateway/GcTokenDao.java

@ -6,6 +6,7 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
/**
@ -20,6 +21,6 @@ public interface GcTokenDao extends PagingAndSortingRepository<GcToken, Long>, J
    @Query("from GcToken where accesstoken=?1")
    GcToken findByToken(String token);
    @Query("from GcToken where appid=?1 and outTime >= now()")
    List<GcToken> findByAppId(String token);
    @Query("from GcToken where appid=?1 and outTime >= ?2 and del=1 ")
    List<GcToken> findByAppId(String token, Date now);
}

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/gateway/GcTokenService.java

@ -95,7 +95,7 @@ public class GcTokenService {
        return tokenDao.findByToken(token);
    }
    public List<GcToken> findByAppId(String appid){
        return tokenDao.findByAppId(appid);
    public List<GcToken> findByAppId(String appid, Date now){
        return tokenDao.findByAppId(appid,now);
    }
}