feat(exam): 增加试卷结果分页查询接口及前端显示功能
- 新增ExamWordsResultReqVO和ExamWordsResultRspVO用于请求与响应封装 - ExamWordsController新增getExamWordsResult方法支持分页查询试卷结果 - ExamWordsJudgeService接口及实现中添加分页获取试卷结果方法及统计总数 - Mapper层添加分页查询和统计的SQL语句支持 - Vue前端uploadpng页面优化为两列布局,新增结果集表格与分页控件 - 上传功能改用自定义http-request,上传后自动刷新结果列表 - Class页面调整布局增加额外展示内容 - 删除未使用接口ExamWordsJudge接口及相关引用 - 重命名ExamWordsJudge相关类和测试类以统一命名规范
This commit is contained in:
@@ -5,11 +5,17 @@ import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
import com.yinlihupo.enlish.service.domain.dataobject.ExamWordsDO;
|
||||
import com.yinlihupo.enlish.service.domain.dataobject.ExamWordsJudgeResultDO;
|
||||
import com.yinlihupo.enlish.service.domain.dataobject.VocabularyBankDO;
|
||||
import com.yinlihupo.enlish.service.model.bo.Word;
|
||||
import com.yinlihupo.enlish.service.model.vo.exam.ExamWordsResultReqVO;
|
||||
import com.yinlihupo.enlish.service.model.vo.exam.ExamWordsResultRspVO;
|
||||
import com.yinlihupo.enlish.service.model.vo.exam.GenerateExamWordsReqVO;
|
||||
import com.yinlihupo.enlish.service.service.ExamWordsJudgeService;
|
||||
import com.yinlihupo.enlish.service.service.ExamWordsService;
|
||||
import com.yinlihupo.enlish.service.service.VocabularyService;
|
||||
import com.yinlihupo.framework.biz.operationlog.aspect.ApiOperationLog;
|
||||
import com.yinlihupo.framework.common.response.PageResponse;
|
||||
import com.yinlihupo.framework.common.response.Response;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -38,6 +44,8 @@ public class ExamWordsController {
|
||||
private VocabularyService vocabularyService;
|
||||
@Value("${templates.word}")
|
||||
private String templateWordPath;
|
||||
@Resource
|
||||
private ExamWordsJudgeService examWordsJudgeService;
|
||||
|
||||
@PostMapping("genexam")
|
||||
public void generateFeltExamWords(@RequestBody GenerateExamWordsReqVO generateExamWordsReqVO, HttpServletResponse response) {
|
||||
@@ -112,4 +120,26 @@ public class ExamWordsController {
|
||||
return Response.fail("保存失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("get")
|
||||
@ApiOperationLog(description = "获取试卷结果集合")
|
||||
PageResponse<ExamWordsResultRspVO> getExamWordsResult(@RequestBody ExamWordsResultReqVO examWordsResultReqVO) {
|
||||
Integer page = examWordsResultReqVO.getPage();
|
||||
Integer size = examWordsResultReqVO.getSize();
|
||||
Integer total = examWordsJudgeService.getExamWordsJudgeResultCount();
|
||||
List<ExamWordsJudgeResultDO> examWordsJudgeResult = examWordsJudgeService.getExamWordsJudgeResult(page, size);
|
||||
List<ExamWordsResultRspVO> list = examWordsJudgeResult.stream().map(examWordsJudgeResultDO -> ExamWordsResultRspVO
|
||||
.builder()
|
||||
.id(examWordsJudgeResultDO.getId())
|
||||
.studentId(examWordsJudgeResultDO.getStudentId())
|
||||
.examWordsId(examWordsJudgeResultDO.getExamWordsId())
|
||||
.startDate(examWordsJudgeResultDO.getStartDate())
|
||||
.correctWordCount(examWordsJudgeResultDO.getCorrectWordCount())
|
||||
.wrongWordCount(examWordsJudgeResultDO.getWrongWordCount())
|
||||
.isFinished(examWordsJudgeResultDO.getIsFinished())
|
||||
.errorMsg(examWordsJudgeResultDO.getErrorMsg())
|
||||
.build()
|
||||
).toList();
|
||||
return PageResponse.success(list, page, total, size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,8 @@ public interface ExamWordsJudgeResultDOMapper {
|
||||
int updateErrorMsg(@Param("id") Integer id, @Param("errorMsg") String errorMsg);
|
||||
|
||||
int updateExamWordsJudgeResultDO(@Param("examWordsJudgeResultDO") ExamWordsJudgeResultDO examWordsJudgeResultDO);
|
||||
|
||||
List<ExamWordsJudgeResultDO> selectByPage(@Param("startIndex") Integer startIndex, @Param("pageSize") Integer pageSize);
|
||||
|
||||
Integer selectCount();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.yinlihupo.enlish.service.model.vo.exam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Builder
|
||||
public class ExamWordsResultReqVO {
|
||||
|
||||
private Integer page;
|
||||
private Integer size;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.yinlihupo.enlish.service.model.vo.exam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Builder
|
||||
public class ExamWordsResultRspVO {
|
||||
private Integer id;
|
||||
|
||||
private String ansSheetPath;
|
||||
|
||||
private Integer studentId;
|
||||
|
||||
private Integer examWordsId;
|
||||
|
||||
private Integer correctWordCount;
|
||||
|
||||
private Integer wrongWordCount;
|
||||
|
||||
private Integer isFinished;
|
||||
|
||||
private LocalDateTime startDate;
|
||||
|
||||
private String errorMsg;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.yinlihupo.enlish.service.service;
|
||||
|
||||
public interface ExamWordsJudge {
|
||||
|
||||
void judgeExamWords(int count);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.yinlihupo.enlish.service.service;
|
||||
|
||||
import com.yinlihupo.enlish.service.domain.dataobject.ExamWordsJudgeResultDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExamWordsJudgeService {
|
||||
|
||||
void judgeExamWords(int count);
|
||||
|
||||
List<ExamWordsJudgeResultDO> getExamWordsJudgeResult(Integer page, Integer pageSize);
|
||||
|
||||
Integer getExamWordsJudgeResultCount();
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import com.yinlihupo.enlish.service.domain.mapper.StudentExamWordsDOMapper;
|
||||
import com.yinlihupo.enlish.service.domain.mapper.WordMasteryLogDOMapper;
|
||||
import com.yinlihupo.enlish.service.model.bo.CoordinatesXY;
|
||||
import com.yinlihupo.enlish.service.model.bo.StudentExamId;
|
||||
import com.yinlihupo.enlish.service.service.ExamWordsJudge;
|
||||
import com.yinlihupo.enlish.service.service.ExamWordsJudgeService;
|
||||
import com.yinlihupo.enlish.service.utils.PngUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ExamWordsJudgeImpl implements ExamWordsJudge {
|
||||
public class ExamWordsJudgeServiceImpl implements ExamWordsJudgeService {
|
||||
|
||||
|
||||
@Resource
|
||||
@@ -129,4 +129,14 @@ public class ExamWordsJudgeImpl implements ExamWordsJudge {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamWordsJudgeResultDO> getExamWordsJudgeResult(Integer page, Integer pageSize) {
|
||||
return examWordsJudgeResultDOMapper.selectByPage((page - 1) * pageSize, pageSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getExamWordsJudgeResultCount() {
|
||||
return examWordsJudgeResultDOMapper.selectCount();
|
||||
}
|
||||
}
|
||||
@@ -50,5 +50,16 @@
|
||||
where id = #{examWordsJudgeResultDO.id}
|
||||
</update>
|
||||
|
||||
<select id="selectByPage" resultMap="BaseResultMap">
|
||||
select *
|
||||
from exam_words_judge_result
|
||||
order by start_date
|
||||
limit #{startIndex}, #{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="selectCount" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from exam_words_judge_result
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yinlihupo.enlish.service.service.exam;
|
||||
|
||||
import com.yinlihupo.enlish.service.domain.dataobject.ExamWordsJudgeResultDO;
|
||||
import com.yinlihupo.enlish.service.service.ExamWordsJudgeService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
@Slf4j
|
||||
public class ExamWordsJudgeServiceTest {
|
||||
|
||||
|
||||
@Resource
|
||||
private ExamWordsJudgeService examWordsJudgeService;
|
||||
|
||||
@Test
|
||||
public void judgeExamWords() {
|
||||
examWordsJudgeService.judgeExamWords(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectExamWordsJudgeResult() {
|
||||
List<ExamWordsJudgeResultDO> examWordsJudgeResult = examWordsJudgeService.getExamWordsJudgeResult(1, 10);
|
||||
log.info("examWordsJudgeResult:{}", examWordsJudgeResult);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.yinlihupo.enlish.service.service.exam;
|
||||
|
||||
import com.yinlihupo.enlish.service.service.ExamWordsJudge;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
public class ExamWordsJudgeTest {
|
||||
|
||||
|
||||
@Resource
|
||||
private ExamWordsJudge examWordsJudge;
|
||||
|
||||
@Test
|
||||
public void judgeExamWords() {
|
||||
examWordsJudge.judgeExamWords(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user