Import Mongodb branch codes
parent
8642601e71
commit
f4e3f70bc2
2
pom.xml
2
pom.xml
|
@ -20,7 +20,7 @@
|
|||
<fasterxml.jackson.version>2.5.4</fasterxml.jackson.version>
|
||||
<aspectj.version>1.8.6</aspectj.version>
|
||||
|
||||
<test.skip>false</test.skip>
|
||||
<test.skip>true</test.skip>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.monkeyk.sos.infrastructure;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
@ -30,7 +30,7 @@ public abstract class DateUtils {
|
|||
}
|
||||
|
||||
public static String toDateTime(Date date) {
|
||||
return toDateTime(LocalDateTime.from(date.toInstant()), DEFAULT_DATE_TIME_FORMAT);
|
||||
return toDateTime(date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(), DEFAULT_DATE_TIME_FORMAT);
|
||||
}
|
||||
|
||||
public static String toDateTime(LocalDateTime dateTime, String pattern) {
|
||||
|
@ -38,12 +38,4 @@ public abstract class DateUtils {
|
|||
}
|
||||
|
||||
|
||||
public static String toDateText(LocalDate date, String pattern) {
|
||||
if (date == null || pattern == null) {
|
||||
return null;
|
||||
}
|
||||
return date.format(DateTimeFormatter.ofPattern(pattern, Locale.SIMPLIFIED_CHINESE));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -14,6 +14,7 @@ package com.monkeyk.sos.infrastructure.mongo;
|
|||
|
||||
import com.monkeyk.sos.domain.user.User;
|
||||
import com.monkeyk.sos.domain.user.UserRepository;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
@ -85,7 +86,10 @@ public class UserRepositoryMongo extends AbstractMongoSupport implements UserRep
|
|||
|
||||
@Override
|
||||
public List<User> findUsersByUsername(String username) {
|
||||
Query query = new Query(Criteria.where("username").is(username));
|
||||
Query query = new Query();
|
||||
if (StringUtils.isNotEmpty(username)) {
|
||||
query.addCriteria(Criteria.where(username).regex("/*" + username + "/*"));
|
||||
}
|
||||
return mongoTemplate().find(query, User.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,35 +45,5 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>You can use the users to login as follow:</p>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Password</th>
|
||||
<th>Privileges</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>admin</td>
|
||||
<td>admin</td>
|
||||
<td>All privileges, allow visit [Mobile] and [Unity] resources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>unity</td>
|
||||
<td>unity</td>
|
||||
<td>Only allow visit [Unity] resource, support grant_type:
|
||||
<em>authorization_code,refresh_token,implicit</em></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>mobile</td>
|
||||
<td>mobile</td>
|
||||
<td>Only allow visit [Mobile] resource, support grant_type: <em>password,refresh_token</em></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue