|
|
@ -3,19 +3,24 @@ package cn.teammodel.controller.admin.service.impl;
|
|
|
|
import cn.teammodel.common.ErrorCode;
|
|
|
|
import cn.teammodel.common.ErrorCode;
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
import cn.teammodel.controller.admin.service.ExamService;
|
|
|
|
import cn.teammodel.controller.admin.service.ExamService;
|
|
|
|
import cn.teammodel.model.dto.admin.exam.BlobSasDto;
|
|
|
|
|
|
|
|
import cn.teammodel.model.dto.admin.exam.OverViewDto;
|
|
|
|
import cn.teammodel.model.dto.admin.exam.OverViewDto;
|
|
|
|
|
|
|
|
import cn.teammodel.model.entity.school.School;
|
|
|
|
|
|
|
|
import cn.teammodel.repository.SchoolRepository;
|
|
|
|
import cn.teammodel.utils.GroupUtil;
|
|
|
|
import cn.teammodel.utils.GroupUtil;
|
|
|
|
|
|
|
|
import com.azure.cosmos.models.PartitionKey;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class ExamServiceImpl implements ExamService {
|
|
|
|
public class ExamServiceImpl implements ExamService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private SchoolRepository schoolRepository;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private Environment env;
|
|
|
|
private Environment env;
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -26,11 +31,17 @@ public class ExamServiceImpl implements ExamService {
|
|
|
|
String url = env.getProperty("ies.server-url-overview");
|
|
|
|
String url = env.getProperty("ies.server-url-overview");
|
|
|
|
String url_exam = env.getProperty("ies.server-url-exam-rate");
|
|
|
|
String url_exam = env.getProperty("ies.server-url-exam-rate");
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
Optional<School> school = schoolRepository.findById(overViewDto.getSchool(), new PartitionKey("Base"));
|
|
|
|
overView = GroupUtil.getGroupId(overViewDto,new GroupUtil(env), request,url);
|
|
|
|
overView = GroupUtil.getGroupId(overViewDto,new GroupUtil(env), request,url);
|
|
|
|
examRate = GroupUtil.getGroupId(overViewDto,new GroupUtil(env), request,url_exam);
|
|
|
|
examRate = GroupUtil.getGroupId(overViewDto,new GroupUtil(env), request,url_exam);
|
|
|
|
//SnowflakeIdGenerator generator = new SnowflakeIdGenerator(1);
|
|
|
|
//SnowflakeIdGenerator generator = new SnowflakeIdGenerator(1);
|
|
|
|
//overView.put("reportId",generator.nextId());
|
|
|
|
//overView.put("reportId",generator.nextId());
|
|
|
|
overView.putAll(examRate);
|
|
|
|
overView.putAll(examRate);
|
|
|
|
|
|
|
|
school.ifPresent(value -> overView.put("schoolName", value.getName()));
|
|
|
|
|
|
|
|
school.flatMap(value -> value.getPeriod().stream().filter(period ->
|
|
|
|
|
|
|
|
period.getId().equals(overViewDto.getPeriodId())).findFirst()).ifPresent(value1 ->
|
|
|
|
|
|
|
|
overView.put("semesters", value1.getSemesters()));
|
|
|
|
|
|
|
|
|
|
|
|
//获取所有考试数据
|
|
|
|
//获取所有考试数据
|
|
|
|
//List<Exam> exams = examRepository.findExamByClassId("Exam-"+overViewDto.getSchool(),overViewDto.getClassId(),overViewDto.getPeriodId());
|
|
|
|
//List<Exam> exams = examRepository.findExamByClassId("Exam-"+overViewDto.getSchool(),overViewDto.getClassId(),overViewDto.getPeriodId());
|
|
|
|
|
|
|
|
|
|
|
|