Commit 6bf2ca8f authored by 喻春霖's avatar 喻春霖

fixed

parent e8588db7
......@@ -2,10 +2,12 @@ package com.chineseall.eden.authcenter.agent.controller;
import cn.sh.chineseall.framework.api.MapMessage;
import cn.sh.chineseall.framework.core.util.CollectionUtils;
import cn.sh.chineseall.framework.lang.calendar.DateUtils;
import com.chineseall.eden.authcenter.agent.client.ClientItem;
import com.chineseall.eden.authcenter.agent.client.OauthClient;
import com.chineseall.eden.authcenter.agent.oauth.OauthConfig;
import com.chineseall.eden.authcenter.agent.vo.StatItem;
import com.chineseall.eden.authcenter.log.model.AuthLog;
import com.chineseall.eden.authcenter.log.service.AuthLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -357,5 +359,43 @@ public class LogStatisticsController {
return MapMessage.successMessage().add("data", result);
}
/**
* 认证接入的APP
*
* @return
*/
@RequestMapping("sourcedata")
@ResponseBody
public MapMessage sourcedata() {
int i = 1;
for (;;){
List<AuthLog> authLogs = authLogService.listLogWithPage(i, 100);
if (CollectionUtils.isEmpty(authLogs)){
break;
}
authLogs.forEach(item -> {
Date createTime = item.getCreateTime();
if (null == item.getYearMonthDay()){
item.setYearMonthDay(DateUtils.format(createTime,"yyyy-MM-dd"));
}
if (null == item.getYearMonth()) {
item.setYearMonth(DateUtils.format(createTime, "yyyy-MM"));
}
if (null == item.getYear()) {
item.setYear(DateUtils.format(createTime, "yyyy"));
}
if (null == item.getClientId()){
if (item.getReturnUrl()!= null && item.getReturnUrl().contains("readinglab.etextbook.cn")){
item.setClientId("readingroomClientId");
}else {
item.setClientId("testClentId");
}
}
authLogService.replace(item);
});
i++;
}
return MapMessage.successMessage();
}
}
\ No newline at end of file
......@@ -51,7 +51,7 @@ oauth:
logoutSuccessUrl: https://ds-test.etextbook.cn/authcenter/auth/logoutsuccess
oauthclient:
clients:
- clientName: 上海运营中心
- clientName: 数字教材
clientId: testClentId
clientSecret: testClientSecret
# - clientName: 接入样例
......
......@@ -49,7 +49,7 @@ oauth:
logoutSuccessUrl: https://ds.etextbook.cn/authcenter/auth/logoutsuccess
oauthclient:
clients:
- clientName: 上海运营中心
- clientName: 数字教材
clientId: testClentId
clientSecret: testClientSecret
# - clientName: 接入样例
......
package com.chineseall.eden.authcenter.log.dao;
import cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.PageRequest;
import cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Pageable;
import cn.sh.chineseall.framework.core.repackaged.org.springframework.data.domain.Sort;
import cn.sh.chineseall.framework.dao.core.hql.Criteria;
import cn.sh.chineseall.framework.dao.core.hql.Query;
import cn.sh.chineseall.framework.dao.mongo.dao.StaticCacheDimensionDocumentMongoDao;
import com.chineseall.eden.authcenter.log.model.AuthLog;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -68,4 +70,12 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
Query query = Query.query(criteria);
return count(query);
}
public List<AuthLog> listLogWithPage(int pageNo, int pageSize) {
Criteria criteria = new Criteria();
Query query = new Query(criteria);
Sort sort = new Sort(Sort.Direction.ASC, "createTime");
Pageable pageable = new PageRequest(pageNo-1, pageSize, sort);
return query(query.with(pageable));
}
}
......@@ -18,4 +18,8 @@ public interface AuthLogService {
List<String> distinct(String key, Map<String, Object> prams);
long count(Map<String,Object> prams);
void replace(AuthLog authLog);
public List<AuthLog> listLogWithPage(int pageNo, int pageSize);
}
......@@ -53,4 +53,14 @@ public class AuthLogServiceImpl implements AuthLogService {
public long count(Map<String, Object> prams) {
return authLogDao.count(prams);
}
@Override
public void replace(AuthLog authLog) {
authLogDao.replace(authLog);
}
@Override
public List<AuthLog> listLogWithPage(int pageNo, int pageSize) {
return authLogDao.listLogWithPage(pageNo,pageSize);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment