|  | @@ -490,17 +490,20 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
 | 
	
		
			
				|  |  |              int msgRowNo = rowIndex + 1;
 | 
	
		
			
				|  |  |              student.checkValid().forEach(err -> errMsg.add(String.format("第%s行%s", msgRowNo, err)));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if (phoneMap.containsKey(student.getPhone().trim())) {
 | 
	
		
			
				|  |  | -                errMsg.add(String.format("第%s行手机号重复", msgRowNo));
 | 
	
		
			
				|  |  | -            } else {
 | 
	
		
			
				|  |  | -                phoneMap.put(student.getPhone().trim(), msgRowNo);
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotEmpty(student.getPhone())) {
 | 
	
		
			
				|  |  | +                if (phoneMap.containsKey(student.getPhone())) {
 | 
	
		
			
				|  |  | +                    errMsg.add(String.format("第%s行手机号重复", msgRowNo));
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    phoneMap.put(student.getPhone(), msgRowNo);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if (!subjectNames.contains(student.getSubjectName())) {
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotEmpty(student.getSubjectName()) && !subjectNames.contains(student.getSubjectName())) {
 | 
	
		
			
				|  |  |                  errMsg.add(String.format("第%s行声部不支持", msgRowNo));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if (StringUtils.isNotEmpty(student.getTenantGroupName()) && !groupNameIdMap.containsKey(student.getTenantGroupName())) {
 | 
	
		
			
				|  |  | +            if (StringUtils.isNotEmpty(student.getTenantGroupName()) &&
 | 
	
		
			
				|  |  | +                    !groupNameIdMap.containsKey(student.getTenantGroupName())) {
 | 
	
		
			
				|  |  |                  errMsg.add(String.format("第%s行小组不存在", msgRowNo));
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -689,7 +692,8 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
 | 
	
		
			
				|  |  |          boolean updatePhone = false;
 | 
	
		
			
				|  |  |          if (!student.getPhone().equals(studentInfo.getPhone())) {
 | 
	
		
			
				|  |  |              updatePhone = true;
 | 
	
		
			
				|  |  | -            com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = getOrCreateAccount(studentInfo);
 | 
	
		
			
				|  |  | +            SysUser oldSysUser = sysUserMapper.getByUserId(studentInfo.getId());
 | 
	
		
			
				|  |  | +            com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = getOrCreateAccount(studentInfo, oldSysUser.getPassword());
 | 
	
		
			
				|  |  |              this.lambdaUpdate().set(Student::getSubjectId, studentInfo.getSubjectId())
 | 
	
		
			
				|  |  |                      .set(Student::getTenantId, studentInfo.getTenantId())
 | 
	
		
			
				|  |  |                      .set(Student::getUserId, sysUser.getId())
 | 
	
	
		
			
				|  | @@ -809,7 +813,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
 | 
	
		
			
				|  |  |              avatar = sysConfigService.findConfigValue(SysConfigConstant.STUDENT_AVATAR);
 | 
	
		
			
				|  |  |              studentInfo.setAvatar(avatar);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = getOrCreateAccount(studentInfo);
 | 
	
		
			
				|  |  | +        com.yonge.cooleshow.biz.dal.entity.SysUser sysUser = getOrCreateAccount(studentInfo, null);
 | 
	
		
			
				|  |  |          Student student = new Student();
 | 
	
		
			
				|  |  |          student.setUserId(sysUser.getId());
 | 
	
		
			
				|  |  |          student.setTenantId(studentInfo.getTenantId());
 | 
	
	
		
			
				|  | @@ -858,7 +862,8 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
 | 
	
		
			
				|  |  |          return true;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private com.yonge.cooleshow.biz.dal.entity.SysUser getOrCreateAccount(StudentWrapper.Student studentInfo) {
 | 
	
		
			
				|  |  | +    private com.yonge.cooleshow.biz.dal.entity.SysUser getOrCreateAccount(StudentWrapper.Student studentInfo,
 | 
	
		
			
				|  |  | +                                                                          String password) {
 | 
	
		
			
				|  |  |          QueryWrapper<com.yonge.cooleshow.biz.dal.entity.SysUser> sysUserQueryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  |          sysUserQueryWrapper.lambda().eq(com.yonge.cooleshow.biz.dal.entity.SysUser::getPhone, studentInfo.getPhone());
 | 
	
		
			
				|  |  |          List<com.yonge.cooleshow.biz.dal.entity.SysUser> sysUsers = sysUserMapper.selectList(sysUserQueryWrapper);
 | 
	
	
		
			
				|  | @@ -894,10 +899,13 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
 | 
	
		
			
				|  |  |              sysUser.setUserType("STUDENT");
 | 
	
		
			
				|  |  |              sysUser.setBirthdate(studentInfo.getBirthdate());
 | 
	
		
			
				|  |  |              sysUser.setUsername(studentInfo.getName());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            String newPassword = MessageFormat.format("klx{0}", studentInfo.getPhone().substring(7));
 | 
	
		
			
				|  |  | -            String password = new BCryptPasswordEncoder().encode(newPassword);
 | 
	
		
			
				|  |  |              sysUser.setPassword(password);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (StringUtils.isEmpty(password)) {
 | 
	
		
			
				|  |  | +                String newPassword = MessageFormat.format("klx{0}", studentInfo.getPhone().substring(7));
 | 
	
		
			
				|  |  | +                sysUser.setPassword(new BCryptPasswordEncoder().encode(newPassword));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              sysUserMapper.insert(sysUser);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return sysUser;
 |