zouxuan 2 năm trước cách đây
mục cha
commit
54e5cb4653

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java

@@ -131,7 +131,7 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee> impl
                 throw new BizException("员工已存在");
             }
         }
-        if (StringUtils.isBlank(employee.getPassword())) {
+        if (StringUtils.isEmpty(employee.getPassword())) {
             int phoneStrLen = employee.getPhone().length();
             employee.setPassword(new BCryptPasswordEncoder().encode("gym" + employee.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
         }

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

@@ -23,6 +23,7 @@ import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.web.WebFeignService;
 import org.apache.commons.lang3.StringUtils;
 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;
@@ -698,6 +699,8 @@ public class StudentManageServiceImpl implements StudentManageService {
             student.setUpdateTime(date);
             student.setCreateTime(date);
             student.setUserType("STUDENT");
+            int phoneStrLen = student.getPhone().length();
+            student.setPassword(new BCryptPasswordEncoder().encode("gym" + student.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
             teacherDao.addSysUser(student);
 //            HttpResponseResult<Integer> result = sysUserFeignService.addUser(student);
 //            student.setId(result.getData());

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

@@ -23,6 +23,7 @@ import com.ym.mec.common.page.PageUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -155,6 +156,8 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher> implem
         }
         teacher.setUserType("TEACHER");
         teacher.setUsername(teacher.getRealName());
+        int phoneStrLen = teacher.getPhone().length();
+        teacher.setPassword(new BCryptPasswordEncoder().encode("gym" + teacher.getPhone().substring(phoneStrLen - 4, phoneStrLen)));
         teacherDao.addSysUser(teacher);
         //添加用户现金账户
         sysUserCashAccountDao.insert(new SysUserCashAccount(teacher.getId(), "CNY"));