Browse Source

Change to wdcy

0.2
lishengzhao 11 years ago
parent
commit
e1aa19638c
  1. 43
      src/main/java/cc/wdcy/domain/dto/AbstractDto.java
  2. 94
      src/main/java/cc/wdcy/domain/dto/user/UserDto.java
  3. 73
      src/main/java/cc/wdcy/domain/dto/user/UserFormDto.java
  4. 4
      src/main/resources/mybatis.xml
  5. 0
      src/main/resources/spring-oauth-server.properties
  6. 2
      src/main/resources/spring/context.xml
  7. 14
      src/main/webapp/index.jsp

43
src/main/java/cc/wdcy/domain/dto/AbstractDto.java

@ -1,43 +0,0 @@
/*
* Copyright (c) 2013 Honyee Industry Group Co., Ltd
* www.honyee.biz
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Honyee Industry Group Co., Ltd ("Confidential Information").
* You shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement you
* entered into with Honyee Industry Group Co., Ltd.
*/
package cc.wdcy.domain.dto;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable;
/**
* @author Shengzhao Li
*/
public abstract class AbstractDto implements Serializable {
protected String guid;
protected AbstractDto() {
}
protected AbstractDto(String guid) {
this.guid = guid;
}
public boolean isNewly() {
return StringUtils.isEmpty(guid);
}
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
}

94
src/main/java/cc/wdcy/domain/dto/user/UserDto.java

@ -1,94 +0,0 @@
/*
* Copyright (c) 2013 Honyee Industry Group Co., Ltd
* www.honyee.biz
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Honyee Industry Group Co., Ltd ("Confidential Information").
* You shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement you
* entered into with Honyee Industry Group Co., Ltd.
*/
package cc.wdcy.domain.dto.user;
import cc.wdcy.domain.dto.AbstractDto;
import cc.wdcy.domain.user.User;
import cc.wdcy.infrastructure.DateUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @author Shengzhao Li
*/
public class UserDto extends AbstractDto {
protected String username;
protected String createDate;
protected String phone;
protected String email;
protected boolean defaultUser;
public UserDto() {
}
public UserDto(User user) {
super(user.guid());
this.username = user.username();
this.createDate = DateUtils.toDateText(user.createTime());
this.phone = user.phone();
this.email = user.email();
this.defaultUser = user.defaultUser();
}
public boolean isDefaultUser() {
return defaultUser;
}
public void setDefaultUser(boolean defaultUser) {
this.defaultUser = defaultUser;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public static List<UserDto> toDtos(List<User> users) {
List<UserDto> dtoList = new ArrayList<>(users.size());
for (User user : users) {
dtoList.add(new UserDto(user));
}
return dtoList;
}
}

73
src/main/java/cc/wdcy/domain/dto/user/UserFormDto.java

@ -1,73 +0,0 @@
/*
* Copyright (c) 2013 Honyee Industry Group Co., Ltd
* www.honyee.biz
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Honyee Industry Group Co., Ltd ("Confidential Information").
* You shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement you
* entered into with Honyee Industry Group Co., Ltd.
*/
package cc.wdcy.domain.dto.user;
import cc.wdcy.domain.user.User;
import cc.wdcy.infrastructure.PasswordHandler;
/**
* @author Shengzhao Li
*/
public class UserFormDto extends UserDto {
private String password;
private String rePassword;
private String existUsername;
public UserFormDto() {
}
public UserFormDto(User user) {
super(user);
this.existUsername = user.username();
}
public UserFormDto(String guid) {
this.guid = guid;
}
@Override
public boolean isNewly() {
return super.isNewly() || "create".equalsIgnoreCase(guid);
}
public User toDomain() {
String encryptPass = PasswordHandler.encryptPassword(password);
return new User(username, encryptPass, phone, email);
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRePassword() {
return rePassword;
}
public void setRePassword(String rePassword) {
this.rePassword = rePassword;
}
public String getExistUsername() {
return existUsername;
}
public void setExistUsername(String existUsername) {
this.existUsername = existUsername;
}
}

4
src/main/resources/mybatis.xml

@ -15,8 +15,8 @@
</typeAliases>
<mappers>
<mapper resource="cc/honyee/infrastructure/mybatis/UserMapper.xml"/>
<mapper resource="cc/honyee/infrastructure/mybatis/OauthMapper.xml"/>
<mapper resource="cc/wdcy/infrastructure/mybatis/UserMapper.xml"/>
<mapper resource="cc/wdcy/infrastructure/mybatis/OauthMapper.xml"/>
</mappers>

0
src/main/resources/database.properties → src/main/resources/spring-oauth-server.properties

2
src/main/resources/spring/context.xml

@ -16,7 +16,7 @@
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:database.properties</value>
<value>classpath:spring-oauth-server.properties</value>
</list>
</property>
</bean>

14
src/main/webapp/index.jsp

@ -23,6 +23,20 @@
<body>
<h3>spring-oauth is work!</h3>
<a href="${contextPath}/logout.do">Logout</a>
<div>
操作说明:
<ol>
<li>
菜单 User 是不需要Oauth 验证即可访问的, <br/>
但菜单 Unity 与 Mobile 需要Oauth 验证后才能访问.
</li>
<li>
在项目的 others目录里有 oauth_test.txt文件, 里面有测试的URL地址(包括浏览器与客户端的),
若想访问 Unity 与 Mobile, 则先用基于浏览器的测试URL 访问,等验证通过后即可访问.
</li>
</ol>
</div>
<ul>
<li>
<a href="${contextPath}/user/overview.htm">User</a>

Loading…
Cancel
Save