lishengzhao
11 years ago
7 changed files with 17 additions and 213 deletions
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
@ -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; |
||||
} |
||||
} |
Loading…
Reference in new issue