Commit 9ae588e0 authored by 喻春霖's avatar 喻春霖

fixed

parents 4fb78f37 99507600
......@@ -50,7 +50,10 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
criteria.and("logUserInfo.userType").is(params.get("userType").toString());
}
if(params.get("beginTime")!=null){
criteria.and("createTime").gte((Date) params.get("beginTime"));
List<String> days = getDayList((Date) params.get("beginTime"));
if(CollectionUtils.isNotEmpty(days)){
criteria.and("yearMonthDay").in(days);
}
}
if(params.get("endTime")!=null){
criteria.lte((Date) params.get("endTime"));
......@@ -88,11 +91,29 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
}
if(beginTime!=null){
criteria.and("createTime").gte(beginTime);
List<String> days = getDayList(beginTime);
if(CollectionUtils.isNotEmpty(days)){
criteria.and("yearMonthDay").in(days);
}
}
return super.distinct(key,new Query(criteria),String.class);
}
private List<String> getDayList(Date beginTime){
Calendar nextDay = Calendar.getInstance();
nextDay.add(Calendar.DATE, 1);
Calendar calendar = Calendar.getInstance();
calendar.setTime(beginTime);
Set<String> days = new HashSet<>();
while (calendar.before(nextDay)){
days.add(DateUtils.dateToString(calendar.getTime(), "yyyy-MM-dd"));
}
return new ArrayList<>(days);
}
public long count(Map<String, Object> params){
Criteria criteria = new Criteria();
if (null != params && params.size() > 0){
......@@ -112,7 +133,10 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
});
}
if(beginTime!=null){
criteria.and("createTime").gte(beginTime);
List<String> days = getDayList(beginTime);
if(CollectionUtils.isNotEmpty(days)){
criteria.and("yearMonthDay").in(days);
}
}
Query query = Query.query(criteria);
return count(query);
......@@ -130,7 +154,10 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
}
if(beginTime!=null){
criteria.and("createTime").gte(beginTime);
List<String> days = getDayList(beginTime);
if(CollectionUtils.isNotEmpty(days)){
criteria.and("yearMonthDay").in(days);
}
}
Query query = Query.query(criteria);
return count(query);
......@@ -163,7 +190,10 @@ public class AuthLogDao extends StaticCacheDimensionDocumentMongoDao<AuthLog, St
});
}
if(beginTime!=null){
criteria.and("createTime").gte(beginTime);
List<String> days = getDayList(beginTime);
if(CollectionUtils.isNotEmpty(days)){
criteria.and("yearMonthDay").in(days);
}
}
List<Bson> aggregateList = new ArrayList<>();
......
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