| | |
| | | package com.ycl.jxkg.controller.admin; |
| | | |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ycl.jxkg.base.BaseApiController; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.form.UpdatePwdForm; |
| | | import com.ycl.jxkg.enums.RoleEnum; |
| | | import com.ycl.jxkg.domain.other.KeyValue; |
| | | import com.ycl.jxkg.domain.User; |
| | | import com.ycl.jxkg.domain.UserEventLog; |
| | | import com.ycl.jxkg.domain.enums.UserStatusEnum; |
| | | import com.ycl.jxkg.domain.entity.User; |
| | | import com.ycl.jxkg.domain.entity.UserEventLog; |
| | | import com.ycl.jxkg.enums.UserStatusEnum; |
| | | import com.ycl.jxkg.domain.vo.StudentVO; |
| | | import com.ycl.jxkg.service.AuthenticationService; |
| | | import com.ycl.jxkg.service.UserEventLogService; |
| | | import com.ycl.jxkg.service.UserService; |
| | | import com.ycl.jxkg.utils.DateTimeUtil; |
| | | import com.ycl.jxkg.vo.admin.user.*; |
| | | import com.ycl.jxkg.domain.vo.admin.user.*; |
| | | import com.ycl.jxkg.utils.PageInfoHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RequiredArgsConstructor |
| | | @RestController("AdminUserController") |
| | |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/student/list", method = RequestMethod.GET) |
| | | public Result<com.ycl.jxkg.domain.vo.student.user.UserResponseVO> studentList() { |
| | | List<User> studentList = new LambdaQueryChainWrapper<>(userService.getBaseMapper()) |
| | | .eq(User::getRole, RoleEnum.STUDENT.getCode()) |
| | | .orderByDesc(User::getCreateTime) |
| | | .list(); |
| | | List<StudentVO> studentVOS = studentList.stream().map(item -> { |
| | | StudentVO student = new StudentVO(); |
| | | BeanUtils.copyProperties(item, student); |
| | | return student; |
| | | }).collect(Collectors.toList()); |
| | | return Result.ok().data(studentVOS); |
| | | } |
| | | |
| | | @RequestMapping(value = "/classes/students", method = RequestMethod.GET) |
| | | public Result<com.ycl.jxkg.domain.vo.student.user.UserResponseVO> classesStudent(@RequestParam Integer classesId) { |
| | | List<StudentVO> studentList = userService.classesStudent(classesId); |
| | | return Result.ok().data(studentList); |
| | | } |
| | | |
| | | @RequestMapping(value = "/event/page/list", method = RequestMethod.POST) |
| | | public Result<PageInfo<UserEventLogVO>> eventPageList(@RequestBody UserEventPageRequestVO model) { |
| | |
| | | user.setUserUuid(UUID.randomUUID().toString()); |
| | | user.setCreateTime(new Date()); |
| | | user.setLastActiveTime(new Date()); |
| | | user.setDeleted(false); |
| | | userService.insertUser(user); |
| | | } else { |
| | | if (!StringUtils.isBlank(model.getPassword())) { |
| | |
| | | @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) |
| | | public Result delete(@PathVariable Integer id) { |
| | | User user = userService.getUserById(id); |
| | | user.setDeleted(true); |
| | | userService.updateById(user); |
| | | return Result.ok(); |
| | | } |
| | |
| | | return Result.ok(keyValues); |
| | | } |
| | | |
| | | @PostMapping("/update/password") |
| | | public Result<Object> updatePassword(@RequestBody @Validated UpdatePwdForm form) { |
| | | userService.updatePassword(form); |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | | |
| | | } |