zouxuan пре 3 година
родитељ
комит
f2510ef3f1

+ 5 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/service/impl/SysUserServiceImpl.java

@@ -16,6 +16,7 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -118,6 +119,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
         if (StringUtils.equalsIgnoreCase(clientId, "TEACHER")) {
             SysUser sysUser = new SysUser();
             sysUser.setPhone(phone);
+            int phoneStrLen = phone.length();
+            sysUser.setPassword(new BCryptPasswordEncoder().encode("gym" + phone.substring(phoneStrLen - 4, phoneStrLen)));
             sysUser.setUserType("TEACHER");
             sysUser.setTenantId(tenantId);
             sysUserDao.insert(sysUser);
@@ -132,6 +135,8 @@ public class SysUserServiceImpl extends BaseServiceImpl<Integer, SysUser> implem
         } else if (StringUtils.equalsIgnoreCase(clientId, "STUDENT")) {
             SysUser sysUser = new SysUser();
             sysUser.setPhone(phone);
+            int phoneStrLen = phone.length();
+            sysUser.setPassword(new BCryptPasswordEncoder().encode("gym" + phone.substring(phoneStrLen - 4, phoneStrLen)));
             sysUser.setUserType("STUDENT");
             if (StringUtils.isBlank(organId)) {
                 sysUser.setOrganId(lesseeOrganId);

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.http.HttpStatus;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -453,6 +454,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 		for (StudentImportDto si : studentBasicList) {
 			sysUser = new SysUser();
 			sysUser.setPhone(si.getMobileNo());
+			int phoneStrLen = sysUser.getPhone().length();
+			sysUser.setPassword(new BCryptPasswordEncoder().encode("gym" + sysUser.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
 			sysUser.setUsername(si.getName());
 			sysUser.setGender(si.getSex().equals("男") ? 1 : 0);
 			sysUser.setUserType("STUDENT");

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -30,6 +30,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
@@ -979,6 +980,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //新增user
             sysUser = new SysUser();
             sysUser.setPhone(studentRegistration.getParentsPhone());
+            int phoneStrLen = sysUser.getPhone().length();
+            sysUser.setPassword(new BCryptPasswordEncoder().encode("gym" + sysUser.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
 //            sysUser.setRealName(studentRegistration.getParentsName());
             sysUser.setUsername(studentRegistration.getName());
             sysUser.setGender(studentRegistration.getGender());

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -30,6 +30,7 @@ import com.ym.mec.common.page.QueryInfo;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -144,6 +145,8 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
             user.setOrganId(studentPreRegistration.getOrganId());
             user.setRealName(studentPreRegistration.getParentName());
             user.setUsername(studentPreRegistration.getUserName());
+            int phoneStrLen = user.getPhone().length();
+            user.setPassword(new BCryptPasswordEncoder().encode("gym" + user.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
             user.setUserType("STUDENT");
             user.setCreateTime(date);
             user.setUpdateTime(date);
@@ -1293,6 +1296,8 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         if (user == null || user.getId() == null) {
             user = new SysUser();
             BeanUtils.copyProperties(baseStudent,user);
+            int phoneStrLen = user.getPhone().length();
+            user.setPassword(new BCryptPasswordEncoder().encode("gym" + user.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
             user.setUsername(baseStudent.getUserName());
             user.setUserType("STUDENT");
             // 注册账户信息

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantProxyInfoServiceImpl.java

@@ -19,6 +19,7 @@ import com.ym.mec.common.page.PageUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -116,6 +117,8 @@ public class TenantProxyInfoServiceImpl extends ServiceImpl<TenantProxyInfoDao,
         sysUser.setTenantId(-1);
         sysUser.setUsername(dto.getName());
         sysUser.setPhone(dto.getPhone());
+        int phoneStrLen = sysUser.getPhone().length();
+        sysUser.setPassword(new BCryptPasswordEncoder().encode("gym" + sysUser.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
         sysUser.setUserType(userType);
         sysUser.setRealName(dto.getName());
         baseMapper.insertProxySysUser(sysUser);