|
|
@@ -1,7 +1,5 @@
|
|
|
package com.uas.platform.b2c.common.account.service.impl;
|
|
|
|
|
|
-import com.uas.account.entity.UserDetail;
|
|
|
-import com.uas.account.util.AccountUtils;
|
|
|
import com.uas.message.mail.service.MailService;
|
|
|
import com.uas.platform.b2c.common.account.dao.UserCacheEnterpriseDao;
|
|
|
import com.uas.platform.b2c.common.account.dao.UserDao;
|
|
|
@@ -31,6 +29,8 @@ import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+import com.uas.sso.util.AccountUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
@@ -267,29 +267,30 @@ public class UserServiceImpl implements UserService {
|
|
|
|
|
|
@Override
|
|
|
public User updatePassword(User user, String password, String newPassword) {
|
|
|
- boolean result = user.getUserPwd().equals(Md5Utils.encode(password, user.getUserUU()));
|
|
|
- if (result) {
|
|
|
- User user1 = userDao.findOne(user.getUserUU());
|
|
|
- user1.setUserPwd(Md5Utils.encode(newPassword, user1.getUserUU()));
|
|
|
- user1.setPwdSecLevel(user.getPwdSecLevel());
|
|
|
- if (user1.getEnterprise() == null)
|
|
|
- user1.setCurrentEnterprise();// 随便绑定一个用户所属企业
|
|
|
- Enterprise enterprise = user1.getEnterprise();
|
|
|
- try {
|
|
|
- //判断是否为个人账户
|
|
|
- if (enterprise == null){
|
|
|
- AccountUtils.resetPassword(user1.getUserUU(), null, newPassword);
|
|
|
- }else {
|
|
|
- AccountUtils.resetPassword(user1.getUserUU(), enterprise.getUu(), newPassword);
|
|
|
- }
|
|
|
- user1 = userDao.save(user1);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new SystemException(e.getMessage());
|
|
|
- }
|
|
|
- return user1;
|
|
|
- } else {
|
|
|
- throw new IllegalOperatorException("原密码验证错误");
|
|
|
- }
|
|
|
+// boolean result = user.getUserPwd().equals(Md5Utils.encode(password, user.getUserUU()));
|
|
|
+// if (result) {
|
|
|
+// User user1 = userDao.findOne(user.getUserUU());
|
|
|
+// user1.setUserPwd(Md5Utils.encode(newPassword, user1.getUserUU()));
|
|
|
+// user1.setPwdSecLevel(user.getPwdSecLevel());
|
|
|
+// if (user1.getEnterprise() == null)
|
|
|
+// user1.setCurrentEnterprise();// 随便绑定一个用户所属企业
|
|
|
+// Enterprise enterprise = user1.getEnterprise();
|
|
|
+// try {
|
|
|
+// //判断是否为个人账户
|
|
|
+// if (enterprise == null){
|
|
|
+// //AccountUtils.resetPassword(user1.getUserUU(), null, newPassword);
|
|
|
+// }else {
|
|
|
+// //AccountUtils.resetPassword(user1.getUserUU(), enterprise.getUu(), newPassword);
|
|
|
+// }
|
|
|
+// user1 = userDao.save(user1);
|
|
|
+// } catch (Exception e) {
|
|
|
+// throw new SystemException(e.getMessage());
|
|
|
+// }
|
|
|
+// return user1;
|
|
|
+// } else {
|
|
|
+// throw new IllegalOperatorException("原密码验证错误");
|
|
|
+// }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -338,53 +339,34 @@ public class UserServiceImpl implements UserService {
|
|
|
|
|
|
//添加未注册
|
|
|
public void postToAccountCenter(User user, String password) throws Exception {
|
|
|
- UserDetail detail = new UserDetail();
|
|
|
+ /*UserDetail detail = new UserDetail();
|
|
|
detail.setEmail(user.getUserEmail());
|
|
|
detail.setIdCode(user.getUserIdcode());
|
|
|
detail.setMobile(user.getUserTel());
|
|
|
detail.setName(user.getUserName());
|
|
|
detail.setSex(user.getUserSex());
|
|
|
AccountUtils.addUser(user.getUserUU(), SystemSession.getUser().getEnterprise().getUu(), detail, password);
|
|
|
- //.uas.sso.util.AccountUtils.addUser();
|
|
|
+ //.uas.sso.util.AccountUtils.addUser();*/
|
|
|
}
|
|
|
public void postToAccountCenter(User user) throws Exception {
|
|
|
- UserDetail detail = new UserDetail();
|
|
|
- detail.setEmail(user.getUserEmail());
|
|
|
- detail.setIdCode(user.getUserIdcode());
|
|
|
- detail.setMobile(user.getUserTel());
|
|
|
- detail.setName(user.getUserName());
|
|
|
- detail.setSex(user.getUserSex());
|
|
|
//判断是否个人用户
|
|
|
if(SystemSession.getUser().getEnterprise()==null){
|
|
|
- AccountUtils.saveUser(user.getUserUU(), null, detail);
|
|
|
+ AccountUtils.addUser(user.getUserUU(),null);
|
|
|
}else{
|
|
|
- AccountUtils.saveUser(user.getUserUU(), SystemSession.getUser().getEnterprise().getUu(), detail);
|
|
|
+ AccountUtils.addUser(user.getUserUU(),SystemSession.getUser().getEnterprise().getUu());
|
|
|
}
|
|
|
}
|
|
|
@Override
|
|
|
public void removeUser(Long uu) {
|
|
|
User user = userDao.findOne(uu);
|
|
|
- com.uas.account.entity.User userInfo = new com.uas.account.entity.User();
|
|
|
- userInfo.setAppId("b2b");
|
|
|
- userInfo.setName(user.getUserName());
|
|
|
- userInfo.setSalt(String.valueOf(uu));
|
|
|
- userInfo.setSpaceUID(SystemSession.getUser().getEnterprise().getEnBussinessCode());
|
|
|
- userInfo.setUid(user.getUserTel());
|
|
|
- userInfo.setSecondUID(user.getUserEmail());
|
|
|
- userInfo.setDialectUID(String.valueOf(uu));
|
|
|
if (user.getEnterprises().contains(SystemSession.getUser().getEnterprise())) {
|
|
|
- user.removeEnterprise(SystemSession.getUser().getEnterprise());
|
|
|
- if (user.getEnterprises().size() == 0)
|
|
|
- user.setEnable((short) Status.DISABLED.value());
|
|
|
- userDao.save(user);
|
|
|
- if (user.getEnterprises().size() == 0) {
|
|
|
- //userDao.delete(user);
|
|
|
- }
|
|
|
+// user.removeEnterprise(SystemSession.getUser().getEnterprise());
|
|
|
+// if (user.getEnterprises().size() == 0)
|
|
|
+// user.setEnable((short) Status.DISABLED.value());
|
|
|
+// userDao.save(user);
|
|
|
try {
|
|
|
com.uas.sso.util.AccountUtils.removeUser(uu,SystemSession.getUser().getEnterprise().getUu());
|
|
|
- //AccountUtils.unbindUser(userInfo);// 同步数据到账户中心
|
|
|
} catch (Exception e) {
|
|
|
- // 尝试删除,存在关联的单据则不删
|
|
|
}
|
|
|
} else {
|
|
|
throw new IllegalArgumentException();
|
|
|
@@ -461,7 +443,7 @@ public class UserServiceImpl implements UserService {
|
|
|
|
|
|
@Override
|
|
|
public User updateUserTel(String oldTel, String newTel,Long uu) {
|
|
|
- // 旧手机号是否正确
|
|
|
+ /*// 旧手机号是否正确
|
|
|
User user = userDao.findOne(uu);
|
|
|
if(!user.getUserTel().equals(oldTel)){
|
|
|
throw new IllegalOperatorException("旧手机号错误");
|
|
|
@@ -478,13 +460,13 @@ public class UserServiceImpl implements UserService {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- }
|
|
|
+ }*/
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public User updateUserEmail(String tel, String newEmail, Long uu) {
|
|
|
-
|
|
|
+/*
|
|
|
try {
|
|
|
if(!StringUtils.isEmpty(tel) && !StringUtils.isEmpty(newEmail)) {
|
|
|
User user = userDao.findOne(uu);
|
|
|
@@ -499,7 +481,7 @@ public class UserServiceImpl implements UserService {
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- }
|
|
|
+ }*/
|
|
|
throw new IllegalOperatorException("数据更新失败...");
|
|
|
}
|
|
|
}
|