|
|
|
@ -3,19 +3,24 @@ package cn.teammodel.controller.admin.service.impl;
|
|
|
|
|
import cn.teammodel.common.ErrorCode;
|
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
|
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.entity.school.School;
|
|
|
|
|
import cn.teammodel.repository.SchoolRepository;
|
|
|
|
|
import cn.teammodel.utils.GroupUtil;
|
|
|
|
|
import com.azure.cosmos.models.PartitionKey;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
public class ExamServiceImpl implements ExamService {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private SchoolRepository schoolRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private Environment env;
|
|
|
|
|
@Override
|
|
|
|
@ -26,11 +31,17 @@ public class ExamServiceImpl implements ExamService {
|
|
|
|
|
String url = env.getProperty("ies.server-url-overview");
|
|
|
|
|
String url_exam = env.getProperty("ies.server-url-exam-rate");
|
|
|
|
|
try {
|
|
|
|
|
Optional<School> school = schoolRepository.findById(overViewDto.getSchool(), new PartitionKey("Base"));
|
|
|
|
|
overView = GroupUtil.getGroupId(overViewDto,new GroupUtil(env), request,url);
|
|
|
|
|
examRate = GroupUtil.getGroupId(overViewDto,new GroupUtil(env), request,url_exam);
|
|
|
|
|
//SnowflakeIdGenerator generator = new SnowflakeIdGenerator(1);
|
|
|
|
|
//overView.put("reportId",generator.nextId());
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|