|
|
@@ -28,10 +28,12 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
|
|
|
@Override
|
|
|
public UserVO register(UserVO userVO) {
|
|
|
-
|
|
|
+ if (userService.findByEmail(userVO.getEmail()) != null) {
|
|
|
+ userService.deleteUser(userVO.getEmail());
|
|
|
+ }
|
|
|
User user = userVOWrapper.unwrap(userVO);
|
|
|
user.setPassword(EncryptionUtil.encryptMD5(userVO.getPassword()));
|
|
|
- user.setCreateTime(new Timestamp(userVO.getCreateTime()));
|
|
|
+ user.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
|
|
|
|
|
return userVOWrapper.wrap(userService.register(user));
|
|
|
}
|
|
|
@@ -43,21 +45,21 @@ public class UserLogicImpl extends BaseLogic implements UserLogic {
|
|
|
|
|
|
@Override
|
|
|
public UserVO updateUser(UserVO userVO) {
|
|
|
- User user=userService.findByUserId(userVO.getId());
|
|
|
- String password=user.getPassword();
|
|
|
- Timestamp createTime=user.getCreateTime();
|
|
|
- Converter.copy(user,userVO);
|
|
|
+ User user = userService.findByUserId(userVO.getId());
|
|
|
+ String password = user.getPassword();
|
|
|
+ Timestamp createTime = user.getCreateTime();
|
|
|
+ Converter.copy(user, userVO);
|
|
|
user.setPassword(password);
|
|
|
user.setCreateTime(createTime);
|
|
|
- return Converter.copy(userVO,userService.updateUser(user));
|
|
|
+ return Converter.copy(userVO, userService.updateUser(user));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public UserVO updateUserPassword(UserVO userVO) {
|
|
|
- User user=userService.findByUserId(userVO.getId());
|
|
|
- String password=EncryptionUtil.encryptMD5(userVO.getPassword());
|
|
|
+ User user = userService.findByUserId(userVO.getId());
|
|
|
+ String password = EncryptionUtil.encryptMD5(userVO.getPassword());
|
|
|
user.setPassword(password);
|
|
|
- return Converter.copy(userVO,userService.updateUser(user));
|
|
|
+ return Converter.copy(userVO, userService.updateUser(user));
|
|
|
}
|
|
|
|
|
|
|