|
@ -9,13 +9,12 @@ import com.yihu.jw.gateway.dao.GcTokenLogDao;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* Created by chenweida on 2017/8/17.
|
|
@ -26,6 +25,8 @@ public class GcTokenService {
|
|
|
private GcTokenLogDao tokenLogDao;
|
|
|
@Autowired
|
|
|
private GcTokenDao tokenDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
|
|
|
/**
|
|
@ -95,7 +96,24 @@ public class GcTokenService {
|
|
|
return tokenDao.findByToken(token);
|
|
|
}
|
|
|
|
|
|
public List<GcToken> findByAppId(String appid){
|
|
|
return tokenDao.findByAppId(appid);
|
|
|
public List<GcToken> findByAppId(String appid,String wxId){
|
|
|
if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
|
|
|
String sql = "select ID AS \"id\",APPID as \"appId\",ACCESSTOKEN as \"accessToken\",CREATE_TIME as \"createTime\",to_char(OUT_TIME,'yyyy-MM-dd hh24:mi:ss') as \"outTime\" from GC_TOKEN where APPID = '"+appid+"' and OUT_TIME >= to_date('"+DateUtil.getStringDate()+"','YYYY-MM-DD HH24:MI:SS')";
|
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
|
List<GcToken> gcTokens = new ArrayList<>();
|
|
|
for (Map<String,Object> map:mapList){
|
|
|
GcToken gcToken = new GcToken();
|
|
|
gcToken.setId(Integer.parseInt(map.get("id").toString()));
|
|
|
gcToken.setAccesstoken(map.get("accessToken").toString());
|
|
|
gcToken.setAppid(map.get("appId").toString());
|
|
|
gcToken.setOutTime(DateUtil.strToDate(map.get("outTime").toString()));
|
|
|
gcTokens.add(gcToken);
|
|
|
System.out.print("gcToken"+gcToken.getOutTime());
|
|
|
}
|
|
|
return gcTokens;
|
|
|
}else {
|
|
|
return tokenDao.findByAppId(appid);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|