|
|
@@ -4,7 +4,11 @@ import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
+import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
+import com.xjrsoft.common.page.ConventPage;
|
|
|
+import com.xjrsoft.common.page.PageOutput;
|
|
|
import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.mapper.BaseClassMapper;
|
|
|
import com.xjrsoft.module.internship.dto.AddInternshipPlanManageParticipantDto;
|
|
|
@@ -12,12 +16,16 @@ import com.xjrsoft.module.internship.dto.InternshipPlanManageParticipantPageDto;
|
|
|
import com.xjrsoft.module.internship.entity.InternshipPlanClass;
|
|
|
import com.xjrsoft.module.internship.entity.InternshipPlanManage;
|
|
|
import com.xjrsoft.module.internship.entity.InternshipPlanManageParticipant;
|
|
|
+import com.xjrsoft.module.internship.entity.InternshipPlanTeacher;
|
|
|
import com.xjrsoft.module.internship.mapper.InternshipPlanClassMapper;
|
|
|
import com.xjrsoft.module.internship.mapper.InternshipPlanManageMapper;
|
|
|
import com.xjrsoft.module.internship.mapper.InternshipPlanManageParticipantMapper;
|
|
|
+import com.xjrsoft.module.internship.mapper.InternshipPlanTeacherMapper;
|
|
|
import com.xjrsoft.module.internship.service.IInternshipPlanManageParticipantService;
|
|
|
+import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantPageVo;
|
|
|
import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
|
|
|
import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
|
|
|
+import com.xjrsoft.module.student.mapper.BaseStudentSchoolRollMapper;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentService;
|
|
|
import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
|
|
|
@@ -29,6 +37,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -42,39 +51,44 @@ import java.util.stream.Collectors;
|
|
|
public class InternshipPlanManageParticipantServiceImpl extends MPJBaseServiceImpl<InternshipPlanManageParticipantMapper, InternshipPlanManageParticipant> implements IInternshipPlanManageParticipantService {
|
|
|
private final InternshipPlanManageMapper internshipPlanManageMapper;
|
|
|
private final InternshipPlanClassMapper internshipPlanClassMapper;
|
|
|
-
|
|
|
+ private final InternshipPlanTeacherMapper internshipPlanTeacherMapper;
|
|
|
private final IBaseStudentSchoolRollService baseStudentSchoolRollService;
|
|
|
private final IBaseStudentService baseStudentService;
|
|
|
- private final BaseClassMapper classMapper;
|
|
|
+ private final BaseStudentSchoolRollMapper baseStudentSchoolRollMapper;
|
|
|
+ private final BaseClassMapper baseClassMapper;
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean add(AddInternshipPlanManageParticipantDto dto) {
|
|
|
InternshipPlanManage planManage = internshipPlanManageMapper.selectById(dto.getInternshipPlanManageId());
|
|
|
- InternshipPlanClass planClass = internshipPlanClassMapper.selectOne(
|
|
|
- new QueryWrapper<InternshipPlanClass>().lambda()
|
|
|
- .eq(InternshipPlanClass::getInternshipPlanManageId, dto.getInternshipPlanManageId())
|
|
|
- .eq(InternshipPlanClass::getClassId, dto.getClassId())
|
|
|
- );
|
|
|
-
|
|
|
- BaseClass baseClass = classMapper.selectById(planClass.getClassId());
|
|
|
|
|
|
List<InternshipPlanManageParticipant> insertList = new ArrayList<>();
|
|
|
|
|
|
List<BaseStudentUserPageVo> studentList = baseStudentService.getStudentList(new BaseStudentUserPageDto() {{
|
|
|
setUserIds(dto.getStudentUserIds());
|
|
|
}});
|
|
|
+ List<Long> classIds = studentList.stream().map(BaseStudentUserPageVo::getClassId).collect(Collectors.toList());
|
|
|
|
|
|
+ List<InternshipPlanClass> planClassList = internshipPlanClassMapper.selectList(
|
|
|
+ new QueryWrapper<InternshipPlanClass>().lambda()
|
|
|
+ .eq(InternshipPlanClass::getInternshipPlanManageId, dto.getInternshipPlanManageId())
|
|
|
+ .in(InternshipPlanClass::getClassId, classIds)
|
|
|
+ );
|
|
|
+
|
|
|
+ Map<Long, Long> classTeacherIdMaps = planClassList.stream().collect(Collectors.toMap(InternshipPlanClass::getClassId, InternshipPlanClass::getInternshipPlanTeacherId));
|
|
|
+ List<Long> internshipPlanTeacherIds = planClassList.stream().map(InternshipPlanClass::getInternshipPlanTeacherId).collect(Collectors.toList());
|
|
|
+ List<InternshipPlanTeacher> internshipPlanTeachers = internshipPlanTeacherMapper.selectBatchIds(internshipPlanTeacherIds);
|
|
|
+ Map<Long, Long> teacherMap = internshipPlanTeachers.stream().collect(Collectors.toMap(InternshipPlanTeacher::getId, InternshipPlanTeacher::getUserId));
|
|
|
for (BaseStudentUserPageVo student : studentList) {
|
|
|
insertList.add(new InternshipPlanManageParticipant(){{
|
|
|
- setClassId(dto.getClassId());
|
|
|
+ setClassId(student.getClassId());
|
|
|
setParticipantUserId(Long.parseLong(student.getId()));
|
|
|
setInternshipPlanManageId(planManage.getId());
|
|
|
- setTeacherId(planClass.getInternshipPlanTeacherId());
|
|
|
+ setTeacherId(teacherMap.get(classTeacherIdMaps.get(student.getClassId())));
|
|
|
setParticipantUserStudentId(student.getStudentId());
|
|
|
setParticipantUserName(student.getName());
|
|
|
setBaseMajorName(student.getMajorSetName());
|
|
|
setBaseMajorId(student.getMajorSetId());
|
|
|
- setClassName(baseClass.getName());
|
|
|
+ setClassName(student.getClassName());
|
|
|
}});
|
|
|
}
|
|
|
if(!insertList.isEmpty()){
|
|
|
@@ -95,7 +109,7 @@ public class InternshipPlanManageParticipantServiceImpl extends MPJBaseServiceIm
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Page<BaseStudentInfoPageVo> getChooseStudentPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto) {
|
|
|
+ public PageOutput<InternshipPlanManageParticipantPageVo> getChooseStudentPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto) {
|
|
|
//查询自主实习和特异体质的学生
|
|
|
String sql = "SELECT t1.* FROM student_internship_alone_apply t1" +
|
|
|
" INNER JOIN xjr_workflow_form_relation t2 ON t1.id = CAST(t2.form_key_value AS SIGNED)" +
|
|
|
@@ -116,7 +130,47 @@ public class InternshipPlanManageParticipantServiceImpl extends MPJBaseServiceIm
|
|
|
|
|
|
BaseStudentInfoPageDto studentInfoPageDto = new BaseStudentInfoPageDto();
|
|
|
studentInfoPageDto.setNotInIds(notInIds);
|
|
|
- return baseStudentSchoolRollService.getMobilePage(page, studentInfoPageDto);
|
|
|
+
|
|
|
+ List<String> roleList = StpUtil.getRoleList();
|
|
|
+
|
|
|
+ long teacherId = StpUtil.getLoginIdAsLong();
|
|
|
+ List<BaseClass> classList = baseClassMapper.selectList(
|
|
|
+ new MPJLambdaWrapper<BaseClass>()
|
|
|
+ .select(BaseClass::getId)
|
|
|
+ .innerJoin(InternshipPlanClass.class, InternshipPlanClass::getClassId, BaseClass::getId)
|
|
|
+ .eq(BaseClass::getTeacherId, teacherId)
|
|
|
+ .eq(InternshipPlanClass::getInternshipPlanManageId, dto.getInternshipPlanManageId())
|
|
|
+ .eq(BaseClass::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ );
|
|
|
+ if(classList.isEmpty()){
|
|
|
+ return new PageOutput<>();
|
|
|
+ }
|
|
|
+ if (roleList.size() == 2 && roleList.contains("CLASSTE")) {
|
|
|
+ studentInfoPageDto.setTeacherId(teacherId);
|
|
|
+ } else {
|
|
|
+ if (studentInfoPageDto.getClassId() == null) {
|
|
|
+ studentInfoPageDto.setClassId(classList.get(0).getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ studentInfoPageDto.setKeyWord(dto.getKeyword());
|
|
|
+ Page<BaseStudentInfoPageVo> mobilePage = baseStudentSchoolRollMapper.getMobilePage(page, studentInfoPageDto);
|
|
|
+
|
|
|
+ List<InternshipPlanManageParticipant> participantList = this.list(
|
|
|
+ new QueryWrapper<InternshipPlanManageParticipant>().lambda()
|
|
|
+ .eq(InternshipPlanManageParticipant::getInternshipPlanManageId, dto.getInternshipPlanManageId())
|
|
|
+ .eq(InternshipPlanManageParticipant::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ );
|
|
|
+ Map<Long, String> collect = participantList.stream().filter(x -> x.getResult() != null).collect(Collectors.toMap(InternshipPlanManageParticipant::getParticipantUserId, InternshipPlanManageParticipant::getResult));
|
|
|
+ PageOutput<InternshipPlanManageParticipantPageVo> pageOutput = ConventPage.getPageOutput(mobilePage, InternshipPlanManageParticipantPageVo.class);
|
|
|
+ for (InternshipPlanManageParticipantPageVo vo : pageOutput.getList()) {
|
|
|
+ if(collect.containsKey(vo.getId())){
|
|
|
+ vo.setIsSelected(1);
|
|
|
+ }else{
|
|
|
+ vo.setIsSelected(0);
|
|
|
+ }
|
|
|
+ vo.setEvaluateResult(collect.get(vo.getId()));
|
|
|
+ }
|
|
|
+ return pageOutput;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -126,7 +180,7 @@ public class InternshipPlanManageParticipantServiceImpl extends MPJBaseServiceIm
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Page<BaseStudentInfoPageVo> getTeamStudentPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto) {
|
|
|
+ public PageOutput<InternshipPlanManageParticipantPageVo> getTeamStudentPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto) {
|
|
|
long teacherId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
List<InternshipPlanManageParticipant> list = this.list(
|
|
|
@@ -134,8 +188,18 @@ public class InternshipPlanManageParticipantServiceImpl extends MPJBaseServiceIm
|
|
|
.eq(InternshipPlanManageParticipant::getInternshipPlanManageId, dto.getInternshipPlanManageId())
|
|
|
.eq(InternshipPlanManageParticipant::getTeacherId, teacherId)
|
|
|
);
|
|
|
+
|
|
|
+ Map<Long, String> collect = list.stream().collect(Collectors.toMap(InternshipPlanManageParticipant::getParticipantUserId, InternshipPlanManageParticipant::getResult));
|
|
|
+
|
|
|
BaseStudentInfoPageDto studentInfoPageDto = new BaseStudentInfoPageDto();
|
|
|
studentInfoPageDto.setInIds(list.stream().map(InternshipPlanManageParticipant::getParticipantUserId).collect(Collectors.toList()));
|
|
|
- return baseStudentSchoolRollService.getMobilePage(page, studentInfoPageDto);
|
|
|
+ studentInfoPageDto.setKeyWord(dto.getKeyword());
|
|
|
+
|
|
|
+ Page<BaseStudentInfoPageVo> mobilePage = baseStudentSchoolRollService.getMobilePage(page, studentInfoPageDto);
|
|
|
+ PageOutput<InternshipPlanManageParticipantPageVo> pageOutput = ConventPage.getPageOutput(mobilePage, InternshipPlanManageParticipantPageVo.class);
|
|
|
+ for (InternshipPlanManageParticipantPageVo vo : pageOutput.getList()) {
|
|
|
+ vo.setEvaluateResult(collect.get(vo.getId()));
|
|
|
+ }
|
|
|
+ return pageOutput;
|
|
|
}
|
|
|
}
|