| | |
| | | package com.qxueyou.scc.teach.student.service.impl; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | |
| | | import com.qxueyou.scc.user.model.QUser; |
| | | import com.qxueyou.scc.user.model.User; |
| | | import com.qxueyou.scc.user.service.IUserService; |
| | | import org.springframework.util.DigestUtils; |
| | | |
| | | @Service |
| | | public class StudentService extends CommonAppService implements IStudentService { |
| | |
| | | public Result updateStudent(String studentId, String name,String password, String studentNo, boolean sex, String phoneNo) { |
| | | //根据学学员ID,获取用户信息 |
| | | StuStudent stu = this.read(StuStudent.class, studentId); |
| | | |
| | | if (!stu.getStudentNo().equals(studentNo) && dao.exists(studentNo,ClientUtils.getOrgId())) { |
| | | return new Result(false, "学号已存在"); |
| | | if(stu.getStudentNo() != null){ |
| | | if (!stu.getStudentNo().equals(studentNo) && dao.exists(studentNo,ClientUtils.getOrgId())) { |
| | | return new Result(false, "学号已存在"); |
| | | } |
| | | } |
| | | |
| | | stu.setName(name); |
| | | stu.setSex(sex); |
| | | stu.setStudentNo(studentNo); |
| | |
| | | user.setAccount(studentNo); |
| | | user.setSex(sex); |
| | | user.setMobilePhone(phoneNo); |
| | | if(!StringUtils.isEmpty(password)){ |
| | | user.setPassword(password); |
| | | //随机字符串 |
| | | String salt= UUID.randomUUID().toString(); |
| | | //盐值 |
| | | user.setSalt(salt); |
| | | //对密码进行加密处理 |
| | | String newPassword= DigestUtils.md5DigestAsHex((salt+password).getBytes()); |
| | | if(!StringUtils.isEmpty(newPassword)){ |
| | | user.setPassword(newPassword); |
| | | } |
| | | user.setName(name); |
| | | save(user); |