2026-01-30 17:44:07 +08:00
|
|
|
package com.gunshi.project.ss.service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.gunshi.project.ss.entity.vo.ScreenPositionTrainingVo;
|
|
|
|
|
import com.gunshi.project.ss.model.PersonnelPlan;
|
|
|
|
|
import com.gunshi.project.ss.model.PersonnelPlanLog;
|
|
|
|
|
import com.gunshi.project.ss.model.ResPerson;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
public class ScreenResponsibilityService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PersonnelPlanService personnelPlanService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PersonnelPlanLogService personnelPlanLogService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResPersonService resPersonService;
|
|
|
|
|
|
|
|
|
|
public ScreenPositionTrainingVo getTraining() {
|
|
|
|
|
ScreenPositionTrainingVo vo = new ScreenPositionTrainingVo();
|
|
|
|
|
List<PersonnelPlan> list = personnelPlanService.lambdaQuery().orderByDesc(PersonnelPlan::getCreateTime).list();
|
2026-02-08 14:38:22 +08:00
|
|
|
vo.setTrainingCount(list.size());
|
2026-01-30 17:44:07 +08:00
|
|
|
|
2026-02-08 14:38:22 +08:00
|
|
|
List<Long> ids = list.stream().map(PersonnelPlan::getId).toList();
|
|
|
|
|
|
|
|
|
|
List<PersonnelPlanLog> logs = personnelPlanLogService.lambdaQuery().orderByDesc(PersonnelPlanLog::getCreateTime).list();
|
|
|
|
|
if(logs.isEmpty()){
|
|
|
|
|
vo.setTotalTraining(0);
|
|
|
|
|
vo.setHasTraining(0L);
|
|
|
|
|
vo.setHasNoTraining(0L);
|
|
|
|
|
return vo;
|
2026-01-30 17:44:07 +08:00
|
|
|
}
|
2026-02-08 14:38:22 +08:00
|
|
|
vo.setLatestPersonnelLog(logs.getFirst());
|
|
|
|
|
vo.setTotalTraining(logs.stream().mapToInt(PersonnelPlanLog::getNumPeople).sum());
|
|
|
|
|
|
|
|
|
|
//已开展数量
|
|
|
|
|
Long hasTraining = logs.stream().map(PersonnelPlanLog::getPlanId).filter(planId ->ids.contains(planId)).distinct().count();
|
2026-01-30 17:44:07 +08:00
|
|
|
vo.setHasTraining(hasTraining);
|
2026-02-08 14:38:22 +08:00
|
|
|
vo.setHasNoTraining(vo.getTrainingCount() - hasTraining);
|
2026-01-30 17:44:07 +08:00
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<ResPerson> getPerson() {
|
2026-02-08 13:56:19 +08:00
|
|
|
List<ResPerson> list = resPersonService.lambdaQuery().in(ResPerson::getType, Arrays.asList(1, 2, 3))
|
2026-01-30 17:44:07 +08:00
|
|
|
.orderByDesc(ResPerson::getCreateTime)
|
|
|
|
|
.list();
|
|
|
|
|
return list;
|
|
|
|
|
}
|
2026-02-03 14:54:54 +08:00
|
|
|
|
|
|
|
|
public List<ResPerson> getFxPerson() {
|
2026-02-08 13:56:19 +08:00
|
|
|
List<ResPerson> list = resPersonService.lambdaQuery().in(ResPerson::getType, Arrays.asList(1, 4, 5))
|
2026-02-03 14:54:54 +08:00
|
|
|
.orderByDesc(ResPerson::getCreateTime)
|
|
|
|
|
.list();
|
|
|
|
|
return list;
|
|
|
|
|
}
|
2026-01-30 17:44:07 +08:00
|
|
|
}
|