新增活动分析查询相关接口

develop
hhb@hotmail.com 3 months ago
parent 3fcc218292
commit 82f67e1afe

@ -20,6 +20,11 @@ import javax.validation.Valid;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* @author zzzzz
* @since 2024-01-09 17:59
*/
@RestController @RestController
@RequestMapping("admin/art") @RequestMapping("admin/art")
@Api(tags = "管理员端-艺术评测") @Api(tags = "管理员端-艺术评测")

@ -43,7 +43,7 @@ public class CommonController {
return R.success(res); return R.success(res);
} }
@PostMapping("find") @PostMapping("find")
@ApiOperation("根据ID查询评语评语") @ApiOperation("根据ID查询评语")
public R<List<Comment>> findComment(@Valid @RequestBody Comment comment) { public R<List<Comment>> findComment(@Valid @RequestBody Comment comment) {
List<Comment> res = commonService.getCommentById(comment); List<Comment> res = commonService.getCommentById(comment);
return R.success(res); return R.success(res);

@ -3,9 +3,7 @@ package cn.teammodel.controller.admin.controller;
import cn.teammodel.common.R; import cn.teammodel.common.R;
import cn.teammodel.controller.admin.service.ExamService; import cn.teammodel.controller.admin.service.ExamService;
import cn.teammodel.model.dto.admin.art.ArtFindDto; import cn.teammodel.model.dto.admin.art.ArtFindDto;
import cn.teammodel.model.dto.admin.exam.AnalysisDto; import cn.teammodel.model.dto.admin.exam.*;
import cn.teammodel.model.dto.admin.exam.BlobSasDto;
import cn.teammodel.model.dto.admin.exam.OverViewDto;
import cn.teammodel.model.vo.admin.ArtElementsVo; import cn.teammodel.model.vo.admin.ArtElementsVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -38,5 +36,17 @@ public class ExamController {
Map<String, Object> res = examService.getExamList(analysisDto,request); Map<String, Object> res = examService.getExamList(analysisDto,request);
return R.success(res); return R.success(res);
} }
@PostMapping("getExamRecord")
@ApiOperation("获取该活动的作答记录")
public R<Map<String, Object>> getExamRecord(@Valid @RequestBody ExamRecordDto examRecordDto, HttpServletRequest request) {
Map<String, Object> res = examService.getExamRecord(examRecordDto,request);
return R.success(res);
}
@PostMapping("getExamSummary")
@ApiOperation("获取该活动详细信息和部分分析结果")
public R<Map<String, Object>> getExamSummary(@Valid @RequestBody FindExamDto findExamDto, HttpServletRequest request) {
Map<String, Object> res = examService.getExamSimpleAnalysis(findExamDto,request);
return R.success(res);
}
} }

@ -1,8 +1,6 @@
package cn.teammodel.controller.admin.service; package cn.teammodel.controller.admin.service;
import cn.teammodel.model.dto.admin.exam.AnalysisDto; import cn.teammodel.model.dto.admin.exam.*;
import cn.teammodel.model.dto.admin.exam.BlobSasDto;
import cn.teammodel.model.dto.admin.exam.OverViewDto;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Map; import java.util.Map;
@ -10,4 +8,6 @@ import java.util.Map;
public interface ExamService { public interface ExamService {
Map<String,Object> getAnalysis(OverViewDto overViewDto, HttpServletRequest request); Map<String,Object> getAnalysis(OverViewDto overViewDto, HttpServletRequest request);
Map<String,Object> getExamList(AnalysisDto analysisDto, HttpServletRequest request); Map<String,Object> getExamList(AnalysisDto analysisDto, HttpServletRequest request);
Map<String,Object> getExamSimpleAnalysis(FindExamDto findExamDto, HttpServletRequest request);
Map<String,Object> getExamRecord(ExamRecordDto examRecordDto, HttpServletRequest request);
} }

@ -4,8 +4,12 @@ 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.AnalysisDto; import cn.teammodel.model.dto.admin.exam.AnalysisDto;
import cn.teammodel.model.dto.admin.exam.ExamRecordDto;
import cn.teammodel.model.dto.admin.exam.FindExamDto;
import cn.teammodel.model.dto.admin.exam.OverViewDto; import cn.teammodel.model.dto.admin.exam.OverViewDto;
import cn.teammodel.model.entity.common.Exam;
import cn.teammodel.model.entity.school.School; import cn.teammodel.model.entity.school.School;
import cn.teammodel.repository.ExamRepository;
import cn.teammodel.repository.SchoolRepository; import cn.teammodel.repository.SchoolRepository;
import cn.teammodel.utils.GroupUtil; import cn.teammodel.utils.GroupUtil;
import com.azure.cosmos.models.PartitionKey; import com.azure.cosmos.models.PartitionKey;
@ -20,6 +24,8 @@ import java.util.*;
@Service @Service
public class ExamServiceImpl implements ExamService { public class ExamServiceImpl implements ExamService {
@Resource
private ExamRepository examRepository;
@Resource @Resource
private SchoolRepository schoolRepository; private SchoolRepository schoolRepository;
@Autowired @Autowired
@ -61,4 +67,32 @@ public class ExamServiceImpl implements ExamService {
} }
return overView; return overView;
} }
@Override
public Map<String, Object> getExamSimpleAnalysis(FindExamDto findExamDto, HttpServletRequest request) {
Map<String, Object> simpleView;
String url_simple = env.getProperty("ies.server-url-analysis-simple");
try {
List<Exam> examList = examRepository.findExamById("Exam-"+findExamDto.getCode(), findExamDto.getId());
simpleView = GroupUtil.getGroupId(findExamDto,new GroupUtil(env), request,url_simple);
simpleView.put("examList",examList);
}catch (Exception e) {
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
}
return simpleView;
}
@Override
public Map<String, Object> getExamRecord(ExamRecordDto examRecordDto, HttpServletRequest request) {
Map<String, Object> record;
String url = env.getProperty("ies.server-url-exam-find-record");
try {
record = GroupUtil.getGroupId(examRecordDto,new GroupUtil(env), request,url);
}catch (Exception e) {
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
}
return record;
}
} }

@ -5,7 +5,7 @@ import javax.validation.constraints.NotNull;
/** /**
* @author winter * @author winter
* @create 2023-12-06 19:03 * @since 2023-12-06 19:03
*/ */
@Data @Data
public class TimeRangeDto { public class TimeRangeDto {
@ -13,6 +13,7 @@ public class TimeRangeDto {
private Long endTime; private Long endTime;
@NotNull @NotNull
private String periodId; private String periodId;
@NotNull
// todo: 似乎不需要(有时间范围就不需要这个字段来划分时间,如果不传时间那就需要) // todo: 似乎不需要(有时间范围就不需要这个字段来划分时间,如果不传时间那就需要)
private String academicYearId; private String academicYearId;
} }

@ -0,0 +1,19 @@
package cn.teammodel.model.dto.admin.exam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ExamRecordDto {
@ApiModelProperty("班级ID")
private String classId;
@ApiModelProperty("学校编码")
private String code;
@ApiModelProperty("该活动唯一ID")
private String id;
@ApiModelProperty("科目ID")
private String subjectId;
@ApiModelProperty("该活动开始时间")
private long startTime;
}

@ -0,0 +1,12 @@
package cn.teammodel.model.dto.admin.exam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class FindExamDto {
@ApiModelProperty("该活动唯一ID")
private String id;
@ApiModelProperty("学校编码")
private String code;
}

@ -14,4 +14,6 @@ public interface ExamRepository extends CosmosRepository<Exam, String> {
@Query("select * from Exam as s where s.code = @code and array_contains(s.classes,@classId) and s.period.id = @periodId and s.progress = 'finish' order by s.createTime ") @Query("select * from Exam as s where s.code = @code and array_contains(s.classes,@classId) and s.period.id = @periodId and s.progress = 'finish' order by s.createTime ")
List<Exam> findExamByClassId(@Param("code")String code, @Param("classId")String classId, @Param("periodId")String periodId); List<Exam> findExamByClassId(@Param("code")String code, @Param("classId")String classId, @Param("periodId")String periodId);
@Query("select * from Exam as s where s.code = @code and s.id = @id")
List<Exam> findExamById(@Param("code")String code, @Param("id")String id);
} }

@ -79,3 +79,5 @@ ies:
server-url-art-analysis: /analysis/art/statistics server-url-art-analysis: /analysis/art/statistics
server-url-blob-sas-rcwld: /blob/sas-rcwld server-url-blob-sas-rcwld: /blob/sas-rcwld
server-url-exam-analysis-list: /common/exam/find-by-analysis server-url-exam-analysis-list: /common/exam/find-by-analysis
server-url-exam-find-record: /common/exam/find-summary-record
server-url-analysis-simple: /analysis/simple
Loading…
Cancel
Save