| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.jxkg.domain.entity.UserEventLog; |
| | | import com.ycl.jxkg.enums.RoleEnum; |
| | | import com.ycl.jxkg.enums.UserStatusEnum; |
| | | import com.ycl.jxkg.domain.form.RegisterForm; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.vo.StudentVO; |
| | | import com.ycl.jxkg.event.UserEvent; |
| | | import com.ycl.jxkg.exception.BusinessException; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.domain.entity.User; |
| | | import com.ycl.jxkg.event.OnRegistrationCompleteEvent; |
| | | import com.ycl.jxkg.mapper.UserMapper; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.vo.admin.user.UserPageRequestVO; |
| | | import com.ycl.jxkg.domain.vo.admin.user.UserPageRequestVO; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | |
| | | @Service |
| | |
| | | |
| | | public User getUserByUserName(String username) { |
| | | return userMapper.getUserByUserName(username); |
| | | } |
| | | |
| | | public int insertByFilter(User record) { |
| | | return baseMapper.insert(record); |
| | | } |
| | | |
| | | public int updateByIdFilter(User record) { |
| | | return baseMapper.updateById(record); |
| | | } |
| | | |
| | | @Override |
| | |
| | | changePictureUser.setImagePath(imagePath); |
| | | userMapper.updateById(changePictureUser); |
| | | } |
| | | |
| | | @Override |
| | | public void teacherRegister(RegisterForm form) { |
| | | User teacher = new User(); |
| | | BeanUtils.copyProperties(form, teacher); |
| | | teacher.setRole(RoleEnum.ADMIN.getCode()); |
| | | teacher.setUserUuid(UUID.randomUUID().toString()); |
| | | teacher.setLastActiveTime(new Date()); |
| | | teacher.setStatus(UserStatusEnum.Enable.getCode()); |
| | | teacher.setDeleted(0); |
| | | this.insertUser(teacher); |
| | | // 发布注册事件,保存注册日志 |
| | | UserEventLog userEventLog = new UserEventLog(teacher.getId(), teacher.getUserName(), teacher.getRealName(), new Date()); |
| | | userEventLog.setContent("欢迎 " + teacher.getUserName() + " 注册来到江西空管音视频培训系统"); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | } |
| | | |
| | | @Override |
| | | public void studentRegister(RegisterForm form) { |
| | | User student = new User(); |
| | | BeanUtils.copyProperties(form, student); |
| | | student.setRole(RoleEnum.ADMIN.getCode()); |
| | | student.setUserUuid(UUID.randomUUID().toString()); |
| | | student.setLastActiveTime(new Date()); |
| | | student.setStatus(UserStatusEnum.Enable.getCode()); |
| | | student.setDeleted(0); |
| | | this.insertUser(student); |
| | | // 发布注册事件,保存注册日志 |
| | | UserEventLog userEventLog = new UserEventLog(student.getId(), student.getUserName(), student.getRealName(), new Date()); |
| | | userEventLog.setContent("欢迎 " + student.getUserName() + " 注册来到江西空管音视频培训系统"); |
| | | eventPublisher.publishEvent(new UserEvent(userEventLog)); |
| | | } |
| | | |
| | | @Override |
| | | public List<StudentVO> classesStudent(Integer classesId) { |
| | | return userMapper.classesStudent(classesId); |
| | | } |
| | | } |