소스 검색

学生实习记录

dzx 5 달 전
부모
커밋
f1d84d4dd2

+ 3 - 3
src/main/java/com/xjrsoft/module/internship/controller/StudentInternshipRecordController.java

@@ -9,6 +9,7 @@ import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.internship.dto.AddStudentInternshipAloneApplyDto;
 import com.xjrsoft.module.internship.dto.AddStudentInternshipRecordDto;
 import com.xjrsoft.module.internship.dto.StudentInternshipRecordPageDto;
 import com.xjrsoft.module.internship.dto.UpdateStudentInternshipRecordDto;
@@ -108,9 +109,8 @@ public class StudentInternshipRecordController {
     @ApiOperation(value = "自主实习材料提交")
     @SaCheckPermission("studentinternshiprecord:add")
     @XjrLog(value = "自主实习材料提交")
-    public RT<Boolean> aloneMaterialSubmit(@Valid @RequestBody AddStudentInternshipRecordDto dto){
-        StudentInternshipRecord studentInternshipRecord = BeanUtil.toBean(dto, StudentInternshipRecord.class);
-        boolean isSuccess = studentInternshipRecordService.save(studentInternshipRecord);
+    public RT<Boolean> aloneMaterialSubmit(@Valid @RequestBody AddStudentInternshipAloneApplyDto dto){
+        boolean isSuccess = studentInternshipRecordService.aloneMaterialSubmit(dto);
         return RT.ok(isSuccess);
     }
 

+ 39 - 0
src/main/java/com/xjrsoft/module/internship/dto/AddStudentInternshipAloneApplyDto.java

@@ -0,0 +1,39 @@
+package com.xjrsoft.module.internship.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+* @title: 自主实习材料提交
+* @Author dzx
+* @Date: 2025-06-26
+* @Version 1.0
+*/
+@Data
+public class AddStudentInternshipAloneApplyDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("登记学生(xjr_user)")
+    private Long studentUserId;
+
+    @ApiModelProperty("实习报告内容")
+    private String reportContent;
+
+    @ApiModelProperty("合同附件(xjr_file)")
+    private Long contractFolderId;
+
+    @ApiModelProperty("工资流水附件(xjr_file)")
+    private Long wagesFolderId;
+
+    @ApiModelProperty("总结材料附件(xjr_file)")
+    private Long summarizeFolderId;
+
+    @ApiModelProperty("所属实习计划id(internship_plan_manage)")
+    private Long internshipPlanManageId;
+
+}

+ 17 - 0
src/main/java/com/xjrsoft/module/internship/mapper/StudentInternshipAloneApplyMapper.java

@@ -0,0 +1,17 @@
+package com.xjrsoft.module.internship.mapper;
+
+import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.internship.entity.StudentInternshipAloneApply;
+import com.xjrsoft.module.internship.entity.StudentInternshipRecord;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @title: 学生实习记录表
+* @Author dzx
+* @Date: 2025-07-01
+* @Version 1.0
+*/
+@Mapper
+public interface StudentInternshipAloneApplyMapper extends MPJBaseMapper<StudentInternshipAloneApply> {
+
+}

+ 3 - 0
src/main/java/com/xjrsoft/module/internship/service/IStudentInternshipRecordService.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.internship.service;
 
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.internship.dto.AddStudentInternshipAloneApplyDto;
 import com.xjrsoft.module.internship.entity.StudentInternshipRecord;
 
 /**
@@ -11,4 +12,6 @@ import com.xjrsoft.module.internship.entity.StudentInternshipRecord;
 */
 
 public interface IStudentInternshipRecordService extends MPJBaseService<StudentInternshipRecord> {
+
+    Boolean aloneMaterialSubmit(AddStudentInternshipAloneApplyDto dto);
 }

+ 46 - 9
src/main/java/com/xjrsoft/module/internship/service/impl/InternshipPlanManageParticipantServiceImpl.java

@@ -4,18 +4,25 @@ 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.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.mapper.BaseClassMapper;
 import com.xjrsoft.module.internship.dto.AddInternshipPlanManageParticipantDto;
 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.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;
@@ -40,32 +47,39 @@ 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 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())
-        );
-
 
         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(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());
@@ -112,7 +126,30 @@ 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 Page<>();
+        }
+        if (roleList.size() == 2 && roleList.contains("CLASSTE")) {
+            studentInfoPageDto.setTeacherId(teacherId);
+        } else {
+            if (studentInfoPageDto.getClassId() == null) {
+                studentInfoPageDto.setClassId(classList.get(0).getId());
+            }
+        }
+
+        return baseStudentSchoolRollMapper.getMobilePage(page, studentInfoPageDto);
     }
 
     /**

+ 24 - 0
src/main/java/com/xjrsoft/module/internship/service/impl/StudentInternshipRecordServiceImpl.java

@@ -1,11 +1,16 @@
 package com.xjrsoft.module.internship.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.internship.dto.AddStudentInternshipAloneApplyDto;
+import com.xjrsoft.module.internship.entity.StudentInternshipAloneApply;
 import com.xjrsoft.module.internship.entity.StudentInternshipRecord;
+import com.xjrsoft.module.internship.mapper.StudentInternshipAloneApplyMapper;
 import com.xjrsoft.module.internship.mapper.StudentInternshipRecordMapper;
 import com.xjrsoft.module.internship.service.IStudentInternshipRecordService;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
 * @title: 学生实习记录表
@@ -16,4 +21,23 @@ import org.springframework.stereotype.Service;
 @Service
 @AllArgsConstructor
 public class StudentInternshipRecordServiceImpl extends MPJBaseServiceImpl<StudentInternshipRecordMapper, StudentInternshipRecord> implements IStudentInternshipRecordService {
+
+    private final StudentInternshipAloneApplyMapper studentInternshipAloneApplyMapper;
+
+    @Override
+    @Transactional
+    public Boolean aloneMaterialSubmit(AddStudentInternshipAloneApplyDto dto) {
+
+        StudentInternshipAloneApply studentInternshipAloneApply = studentInternshipAloneApplyMapper.selectOne(
+                new QueryWrapper<StudentInternshipAloneApply>().lambda()
+                        .eq(StudentInternshipAloneApply::getStudentUserId, dto.getStudentUserId())
+                        .eq(StudentInternshipAloneApply::getInternshipPlanManageId, dto.getInternshipPlanManageId())
+        );
+        studentInternshipAloneApply.setContractFolderId(dto.getContractFolderId());
+        studentInternshipAloneApply.setWagesFolderId(dto.getWagesFolderId());
+        studentInternshipAloneApply.setSummarizeFolderId(dto.getSummarizeFolderId());
+        studentInternshipAloneApply.setReportContent(dto.getReportContent());
+        studentInternshipAloneApplyMapper.updateById(studentInternshipAloneApply);
+        return true;
+    }
 }

+ 1 - 1
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentSchoolRollServiceImpl.java

@@ -67,7 +67,7 @@ public class BaseStudentSchoolRollServiceImpl extends MPJBaseServiceImpl<BaseStu
                 new QueryWrapper<BaseClass>().lambda().eq(BaseClass::getTeacherId, teacherId)
                         .eq(BaseClass::getDeleteMark, DeleteMark.NODELETE.getCode())
         );
-        if (roleList.size() == 1 && roleList.contains("CLASSTE")) {
+        if (roleList.size() == 2 && roleList.contains("CLASSTE")) {
             if (classList != null && !classList.isEmpty()) {
                 dto.setTeacherId(teacherId);
             }

+ 6 - 0
src/main/resources/mapper/student/BaseStudentMapper.xml

@@ -159,6 +159,12 @@
                 #{credentialNumber}
             </foreach>
         </if>
+        <if test="dto.userIds != null and dto.userIds.size() > 0">
+            and t1.id in
+            <foreach item="userId" index="index" collection="dto.userIds" open="(" close=")" separator=",">
+                #{userId}
+            </foreach>
+        </if>
     </select>
 
 </mapper>