审核公示名单

Former-commit-id: 67a0ff289fbe8b06c1791564802e10b3a69ebc75
This commit is contained in:
xiaoxiaoqiong 2022-06-23 13:59:20 +08:00
parent 6e8768037b
commit e64a3340f6
6 changed files with 99 additions and 20 deletions

View File

@ -2,6 +2,7 @@ package com.xjy.ai.api.controller.glcc;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xjy.ai.api.annotion.GuestAccess;
import com.xjy.ai.common.constant.Constants;
import com.xjy.ai.common.response.DataPacketUtil;
import com.xjy.ai.common.response.ResponseData;
@ -30,10 +31,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@ -121,10 +119,10 @@ public class StudentApplyController {
@ApiOperation("查看学生报名信息")
@GetMapping("/{id}")
public ResponseEntity<ResponseData> get(@PathVariable int id) {
GlccRegistrationStudent registrationStudent = studentApplyService.getById(id);
GlccRegistrationStudent registrationStudent = studentApplyService.getById(id);
StudentRegistrationVo vo = BeanCopyUtils.beanPropertiesCopy(registrationStudent, StudentRegistrationVo.class);
List<StudentRegistrationTaskVo> list = Optional.ofNullable(studentApplyTaskService.getRegistrationStudentTaskList(registrationStudent.getId())).orElse(Collections.emptyList())
.stream().map(studentTask ->{
.stream().map(studentTask -> {
StudentRegistrationTaskVo studentRegistrationTaskVo = BeanCopyUtils.beanPropertiesCopy(studentTask, StudentRegistrationTaskVo.class);
GlccRegistrationTask task = applyTaskService.getById(studentTask.getTaskId());
studentRegistrationTaskVo.setTaskName(task == null ? "" : task.getTaskName());
@ -149,9 +147,9 @@ public class StudentApplyController {
List<Integer> studentIds = Optional.ofNullable(studentList).orElse(Collections.emptyList()).stream()
.map(GlccRegistrationStudent::getId).collect(Collectors.toList());
Page<GlccRegistrationStudentTask> page = null;
if (studentIds.isEmpty()){
page = new Page<>(curPage,pageSize);
}else{
if (studentIds.isEmpty()) {
page = new Page<>(curPage, pageSize);
} else {
page = studentApplyTaskService.pageList(curPage, pageSize, studentIds, taskId);
}
List<StudentRegistrationListVo> voList = Optional.ofNullable(page.getRecords()).orElse(Collections.emptyList()).stream().map((item) -> {
@ -171,7 +169,39 @@ public class StudentApplyController {
vo.setTaskName(task == null ? "" : task.getTaskName());
vo.setMemoAttachment(busiAttachmentsService.selectByPrimaryKey(item.getMemoAttachmentId()));
vo.setProveAttachment(busiAttachmentsService.selectByPrimaryKey(student.getProveAttachmentId()));
vo.setProjectName(registrationInformation == null ? "" : registrationInformation.getProjectName());
vo.setProjectName(registrationInformation == null ? "" : registrationInformation.getProjectName());
vo.setTutorName(task == null ? "" : task.getTutorName());
vo.setTutorMail(task == null ? "" : task.getTutorMail());
vo.setTutorPhone(task == null ? "" : task.getTutorPhone());
return vo;
}).collect(Collectors.toList());
return DataPacketUtil.ok(page.getTotal(), voList);
}
@ApiOperation("公示报名列表")
@GetMapping("/passList")
@GuestAccess
public ResponseEntity<ResponseData> passList(int curPage, int pageSize, String keyword) {
Page<GlccRegistrationStudentTask> page = studentApplyTaskService.passPageList(curPage, pageSize, keyword);
List<StudentRegistrationListVo> voList = Optional.ofNullable(page.getRecords()).orElse(Collections.emptyList()).stream().map((item) -> {
StudentRegistrationListVo vo = BeanCopyUtils.beanPropertiesCopy(item, StudentRegistrationListVo.class);
GlccRegistrationStudent student = studentApplyService.getById(item.getStudentRegId());
vo.setUserId(student.getUserId());
vo.setStudentName(student.getStudentName());
vo.setSchool(student.getSchool());
vo.setProfession(student.getProfession());
vo.setGrade(student.getGrade());
vo.setLocation(student.getLocation());
vo.setPhone(student.getPhone());
vo.setMail(student.getMail());
vo.setProveAttachmentId(student.getProveAttachmentId());
GlccRegistrationTask task = applyTaskService.getById(item.getTaskId());
GlccRegistrationInformation registrationInformation = applyService.getById(task.getRegId());
vo.setTaskName(task == null ? "" : task.getTaskName());
vo.setMemoAttachment(busiAttachmentsService.selectByPrimaryKey(item.getMemoAttachmentId()));
vo.setProveAttachment(busiAttachmentsService.selectByPrimaryKey(student.getProveAttachmentId()));
vo.setProjectName(registrationInformation == null ? "" : registrationInformation.getProjectName());
vo.setTutorName(task == null ? "" : task.getTutorName());
vo.setTutorMail(task == null ? "" : task.getTutorMail());
vo.setTutorPhone(task == null ? "" : task.getTutorPhone());
@ -183,12 +213,12 @@ public class StudentApplyController {
@ApiOperation("获取当前用户学生报名信息")
@GetMapping("/getUserApplyInfo")
public ResponseEntity<ResponseData> getUserApplyInfo(Integer userId) {
GlccRegistrationStudent registrationStudent = studentApplyService.getRegistrationStudentByUserId(userId);
GlccRegistrationStudent registrationStudent = studentApplyService.getRegistrationStudentByUserId(userId);
StudentRegistrationVo vo = null;
if(registrationStudent !=null){
if (registrationStudent != null) {
vo = BeanCopyUtils.beanPropertiesCopy(registrationStudent, StudentRegistrationVo.class);
List<StudentRegistrationTaskVo> list = Optional.ofNullable(studentApplyTaskService.getRegistrationStudentTaskList(registrationStudent.getId())).orElse(Collections.emptyList())
.stream().map(studentTask ->{
.stream().map(studentTask -> {
StudentRegistrationTaskVo studentRegistrationTaskVo = BeanCopyUtils.beanPropertiesCopy(studentTask, StudentRegistrationTaskVo.class);
GlccRegistrationTask task = applyTaskService.getById(studentTask.getTaskId());
studentRegistrationTaskVo.setTaskName(task == null ? "" : task.getTaskName());
@ -210,8 +240,8 @@ public class StudentApplyController {
return DataPacketUtil.badRequest(errors);
}
UserVo user = userService.getCurrentUser(request);
if (!deleteVo.getIds().isEmpty()){
deleteVo.getIds().forEach(id ->{
if (!deleteVo.getIds().isEmpty()) {
deleteVo.getIds().forEach(id -> {
GlccRegistrationStudentTask studentTask = studentApplyTaskService.getById(id);
GlccRegistrationStudent model = studentApplyService.getById(studentTask.getStudentRegId());
// 自己取消的记录次数管理员删除不记数

View File

@ -2,15 +2,41 @@ package com.xjy.ai.model.dao.glcc.mapper;
import com.xjy.ai.model.dao.glcc.entity.GlccRegistrationStudentTask;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* <p>
* 开源夏令营学生报名课题表 Mapper 接口
* </p>
*
* @author
* @author
* @since 2022-05-11
*/
public interface GlccRegistrationStudentTaskMapper extends BaseMapper<GlccRegistrationStudentTask> {
@Select("SELECT glcc_registration_student_task.* FROM glcc_registration_student_task " +
" LEFT JOIN glcc_registration_student ON glcc_registration_student_task.student_reg_id=glcc_registration_student.id " +
" LEFT JOIN glcc_registration_task ON glcc_registration_student_task.task_id=glcc_registration_task.id JOIN ( " +
" SELECT student_reg_id,max(enroll_first) AS enroll_first FROM glcc_registration_student_task GROUP BY student_reg_id) b ON glcc_registration_student_task.student_reg_id=b.student_reg_id AND glcc_registration_student_task.enroll_first=b.enroll_first " +
" WHERE (glcc_registration_task.task_name LIKE #{keyword} OR glcc_registration_student.student_name LIKE #{keyword}) " +
" and glcc_registration_student_task.pass_status=1 LIMIT #{offset}, #{pageSize}")
List<GlccRegistrationStudentTask> selectPassAuditStudentTaskList(@Param("offset") Integer offset, @Param("pageSize") Integer pageSize, @Param("keyword") String keyword);
@Select("SELECT count(1) FROM glcc_registration_student_task " +
" LEFT JOIN glcc_registration_student ON glcc_registration_student_task.student_reg_id=glcc_registration_student.id " +
" LEFT JOIN glcc_registration_task ON glcc_registration_student_task.task_id=glcc_registration_task.id JOIN ( " +
" SELECT student_reg_id,max(enroll_first) AS enroll_first FROM glcc_registration_student_task GROUP BY student_reg_id) b ON glcc_registration_student_task.student_reg_id=b.student_reg_id AND glcc_registration_student_task.enroll_first=b.enroll_first " +
" WHERE (glcc_registration_task.task_name LIKE #{keyword} OR glcc_registration_student.student_name LIKE #{keyword}) " +
" and glcc_registration_student_task.pass_status=1 ")
long selectPassAuditStudentTaskCount(@Param("keyword") String keyword);
// @Select("SELECT * FROM glcc_registration_student_task " +
// " LEFT join glcc_registration_student ON glcc_registration_student_task.student_reg_id = glcc_registration_student.id " +
// " left join glcc_registration_task on glcc_registration_student_task.task_id = glcc_registration_task.id " +
// " where glcc_registration_task.task_name like #{keyword} or glcc_registration_student.student_name like #{keyword} ")
// List<GlccRegistrationStudentTask> selectStudentTaskListByKeyword(@Param("keyword") String keyword);
}

View File

@ -52,7 +52,7 @@ public class ApplyTaskServiceImpl extends ServiceImpl<GlccRegistrationTaskMapper
public Page<GlccRegistrationTask> pageList(int curPage, int pageSize, String keyword, List<Integer> taskIds, List<Integer> regIds) {
Page<GlccRegistrationTask> page = new Page<>(curPage,pageSize);
QueryWrapper<GlccRegistrationTask> wrapper = new QueryWrapper<>();
if (keyword != null) {
if (keyword != null && taskIds.isEmpty()) {
wrapper.lambda().like(GlccRegistrationTask::getTaskName, keyword).orderByDesc(GlccRegistrationTask::getSortNo, GlccRegistrationTask::getCreatedOn);
} else {
wrapper.lambda().orderByDesc(GlccRegistrationTask::getSortNo, GlccRegistrationTask::getCreatedOn);

View File

@ -1,15 +1,12 @@
package com.xjy.ai.model.service.glcc.Impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjy.ai.model.dao.glcc.entity.GlccRegistrationInformation;
import com.xjy.ai.model.dao.glcc.entity.GlccRegistrationStudentTask;
import com.xjy.ai.model.dao.glcc.entity.GlccRegistrationTask;
import com.xjy.ai.model.dao.glcc.mapper.GlccRegistrationStudentTaskMapper;
import com.xjy.ai.model.service.glcc.StudentApplyTaskService;
import com.xjy.ai.model.service.glcc.vo.UpdateRegTaskVo;
@ -79,6 +76,19 @@ public class StudentApplyTaskServiceImpl extends ServiceImpl<GlccRegistrationStu
}
@Override
public Page<GlccRegistrationStudentTask> passPageList(int curPage, int pageSize, String keyword) {
String likeStr = keyword == null ? "%%" : "%" + keyword + "%";
int offset = (curPage - 1) * pageSize;
List<GlccRegistrationStudentTask> list = baseMapper.selectPassAuditStudentTaskList(offset, pageSize, likeStr);
Page<GlccRegistrationStudentTask> page = new Page<>();
page.setRecords(list);
page.setTotal(baseMapper.selectPassAuditStudentTaskCount(likeStr));
page.setPages(curPage);
page.setSize(pageSize);
return page;
}
@Override
public boolean auditRegTask(UpdateRegTaskVo updateVo) {
UpdateWrapper<GlccRegistrationStudentTask> updateWrapper = new UpdateWrapper<>();

View File

@ -23,6 +23,8 @@ public interface StudentApplyTaskService extends IService<GlccRegistrationStuden
Page<GlccRegistrationStudentTask> pageList(int curPage, int pageSize, List<Integer> studentIds, Integer taskId);
Page<GlccRegistrationStudentTask> passPageList(int curPage, int pageSize, String keyword);
public List<GlccRegistrationStudentTask> getListByRegIds(List<Integer> regIds);
public boolean auditRegTask(UpdateRegTaskVo updateVo);

View File

@ -3,6 +3,7 @@ package com.xjy.ai.model.service.glcc.vo;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
import java.util.List;
public class RegistrationTaskVo {
@ -36,6 +37,8 @@ public class RegistrationTaskVo {
private Integer sortNo;
private List<StudentRegistrationListVo> passList;
public Integer getId() {
@ -149,4 +152,12 @@ public class RegistrationTaskVo {
public void setProjectType(String projectType) {
this.projectType = projectType;
}
public List<StudentRegistrationListVo> getPassList() {
return passList;
}
public void setPassList(List<StudentRegistrationListVo> passList) {
this.passList = passList;
}
}