2 次代碼提交 3891946cc1 ... cf040bd09e

作者 SHA1 備註 提交日期
  dzx cf040bd09e 实习管理 5 月之前
  dzx 819fb8c240 实习管理 5 月之前

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

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xjrsoft.common.annotation.XjrLog;
 import com.xjrsoft.common.annotation.XjrLog;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.model.result.RT;
-import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.module.internship.dto.AddInternshipPlanManageParticipantDto;
 import com.xjrsoft.module.internship.dto.AddInternshipPlanManageParticipantDto;
 import com.xjrsoft.module.internship.dto.EvaluateInternshipPlanManageParticipantDto;
 import com.xjrsoft.module.internship.dto.EvaluateInternshipPlanManageParticipantDto;
@@ -16,7 +15,6 @@ import com.xjrsoft.module.internship.entity.InternshipPlanManageParticipant;
 import com.xjrsoft.module.internship.service.IInternshipPlanManageParticipantService;
 import com.xjrsoft.module.internship.service.IInternshipPlanManageParticipantService;
 import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantPageVo;
 import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantPageVo;
 import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantVo;
 import com.xjrsoft.module.internship.vo.InternshipPlanManageParticipantVo;
-import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
@@ -47,11 +45,20 @@ public class InternshipPlanManageParticipantController {
 
 
     private final IInternshipPlanManageParticipantService internshipPlanManageParticipantService;
     private final IInternshipPlanManageParticipantService internshipPlanManageParticipantService;
 
 
+    @GetMapping(value = "/page")
+    @ApiOperation(value="所有参与人(分页)")
+    @SaCheckPermission("internshipplanmanageparticipant:detail")
+    @XjrLog(value = "所有参与人(分页)")
+    public RT<PageOutput<InternshipPlanManageParticipantPageVo>> page(@Valid InternshipPlanManageParticipantPageDto dto){
+        PageOutput<InternshipPlanManageParticipantPageVo> pageOutput = internshipPlanManageParticipantService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        return RT.ok(pageOutput);
+    }
+
     @GetMapping(value = "/team-student-page")
     @GetMapping(value = "/team-student-page")
     @ApiOperation(value="实习计划参与人表列表(分页)")
     @ApiOperation(value="实习计划参与人表列表(分页)")
     @SaCheckPermission("internshipplanmanageparticipant:detail")
     @SaCheckPermission("internshipplanmanageparticipant:detail")
     @XjrLog(value = "实习计划参与人表列表(分页)")
     @XjrLog(value = "实习计划参与人表列表(分页)")
-    public RT<PageOutput<InternshipPlanManageParticipantPageVo>> page(@Valid InternshipPlanManageParticipantPageDto dto){
+    public RT<PageOutput<InternshipPlanManageParticipantPageVo>> teamStudentPage(@Valid InternshipPlanManageParticipantPageDto dto){
         PageOutput<InternshipPlanManageParticipantPageVo> pageOutput = internshipPlanManageParticipantService.getTeamStudentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         PageOutput<InternshipPlanManageParticipantPageVo> pageOutput = internshipPlanManageParticipantService.getTeamStudentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         return RT.ok(pageOutput);
         return RT.ok(pageOutput);
     }
     }

+ 2 - 0
src/main/java/com/xjrsoft/module/internship/service/IInternshipPlanManageParticipantService.java

@@ -25,4 +25,6 @@ public interface IInternshipPlanManageParticipantService extends MPJBaseService<
     PageOutput<InternshipPlanManageParticipantPageVo> getChooseStudentPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto);
     PageOutput<InternshipPlanManageParticipantPageVo> getChooseStudentPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto);
 
 
     PageOutput<InternshipPlanManageParticipantPageVo> getTeamStudentPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto);
     PageOutput<InternshipPlanManageParticipantPageVo> getTeamStudentPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto);
+
+    PageOutput<InternshipPlanManageParticipantPageVo> getPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto);
 }
 }

+ 19 - 1
src/main/java/com/xjrsoft/module/internship/service/impl/InternshipPlanManageParticipantServiceImpl.java

@@ -189,7 +189,25 @@ public class InternshipPlanManageParticipantServiceImpl extends MPJBaseServiceIm
                         .eq(InternshipPlanManageParticipant::getTeacherId, teacherId)
                         .eq(InternshipPlanManageParticipant::getTeacherId, teacherId)
         );
         );
 
 
-        Map<Long, String> collect = list.stream().collect(Collectors.toMap(InternshipPlanManageParticipant::getParticipantUserId, InternshipPlanManageParticipant::getResult));
+        Map<Long, String> collect = list.stream().filter(x -> x.getResult() != null).collect(Collectors.toMap(InternshipPlanManageParticipant::getParticipantUserId, InternshipPlanManageParticipant::getResult));
+
+        BaseStudentInfoPageDto studentInfoPageDto = new BaseStudentInfoPageDto();
+        studentInfoPageDto.setInIds(list.stream().map(InternshipPlanManageParticipant::getParticipantUserId).collect(Collectors.toList()));
+        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;
+    }
+
+    @Override
+    public PageOutput<InternshipPlanManageParticipantPageVo> getPage(Page<BaseStudentInfoPageVo> page, InternshipPlanManageParticipantPageDto dto) {
+        List<InternshipPlanManageParticipant> list = this.list();
+
+        Map<Long, String> collect = list.stream().filter(x -> x.getResult() != null).collect(Collectors.toMap(InternshipPlanManageParticipant::getParticipantUserId, InternshipPlanManageParticipant::getResult));
 
 
         BaseStudentInfoPageDto studentInfoPageDto = new BaseStudentInfoPageDto();
         BaseStudentInfoPageDto studentInfoPageDto = new BaseStudentInfoPageDto();
         studentInfoPageDto.setInIds(list.stream().map(InternshipPlanManageParticipant::getParticipantUserId).collect(Collectors.toList()));
         studentInfoPageDto.setInIds(list.stream().map(InternshipPlanManageParticipant::getParticipantUserId).collect(Collectors.toList()));

+ 85 - 0
src/main/java/com/xjrsoft/module/job/InternshipTask.java

@@ -0,0 +1,85 @@
+package com.xjrsoft.module.job;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xjrsoft.common.enums.DeleteMark;
+import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
+import com.xjrsoft.common.utils.DateUtils;
+import com.xjrsoft.common.utils.LocalDateUtil;
+import com.xjrsoft.common.utils.SqlRunnerAdapterUtil;
+import com.xjrsoft.module.evaluate.entity.EvaluateManage;
+import com.xjrsoft.module.internship.entity.InternshipPlanManage;
+import com.xjrsoft.module.internship.entity.InternshipTeacherCollect;
+import com.xjrsoft.module.internship.service.IInternshipPlanManageService;
+import com.xjrsoft.module.internship.service.IInternshipTeacherCollectService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 实习相关数据处理
+ */
+@Component
+@Slf4j
+public class InternshipTask {
+
+    @Autowired
+    private IInternshipPlanManageService internshipPlanManageService;
+
+    @Autowired
+    private IInternshipTeacherCollectService internshipTeacherCollectService;
+
+    @Async
+    @Scheduled(cron = "0 0 0 * * ?")
+    public void addSubmitRecord() {
+        //查询实习计划,根据开始时间和结束时间来判断并修改状态
+        List<InternshipPlanManage> list = internshipPlanManageService.list(
+                new QueryWrapper<InternshipPlanManage>().lambda()
+                        .eq(InternshipPlanManage::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+        LocalDate now = LocalDate.now();
+        List<InternshipPlanManage> updateList = new ArrayList<>();
+        for (InternshipPlanManage planManage : list) {
+            if(LocalDateUtil.isDateInRange(now, planManage.getStartTime(), planManage.getEndTime())){
+                planManage.setStatus(1);
+                updateList.add(planManage);
+            }else if(now.isAfter(planManage.getEndTime())){
+                planManage.setStatus(2);
+                updateList.add(planManage);
+            }
+        }
+
+        if(!updateList.isEmpty()){
+            internshipPlanManageService.updateBatchById(updateList);
+        }
+
+
+        //查询实习计划,根据开始时间和结束时间来判断并修改状态
+        List<InternshipTeacherCollect> collectList = internshipTeacherCollectService.list(
+                new QueryWrapper<InternshipTeacherCollect>().lambda()
+                        .eq(InternshipTeacherCollect::getDeleteMark, DeleteMark.NODELETE.getCode())
+        );
+
+        List<InternshipTeacherCollect> collectUpdateList = new ArrayList<>();
+        for (InternshipTeacherCollect collect : collectList) {
+            if(LocalDateUtil.isDateInRange(now, collect.getStartDate(), collect.getEndDate())){
+                collect.setStatus(1);
+                collectUpdateList.add(collect);
+            }else if(now.isAfter(collect.getEndDate())){
+                collect.setStatus(2);
+                collectUpdateList.add(collect);
+            }
+        }
+
+        if(!collectUpdateList.isEmpty()){
+            internshipTeacherCollectService.updateBatchById(collectUpdateList);
+        }
+    }
+}