Merge pull request '【修改】完善wps代码' (#3) from hyc into master
Reviewed-on: #3
This commit is contained in:
@@ -90,4 +90,8 @@ public class MonitorDO extends BaseDO {
|
||||
*/
|
||||
private String interactiveTime;
|
||||
|
||||
/**
|
||||
* 使用次数
|
||||
*/
|
||||
private String counts;
|
||||
}
|
||||
|
@@ -72,4 +72,5 @@ public interface MonitorMapper extends BaseMapperX<MonitorDO> {
|
||||
|
||||
void deleteByTaskId(String taskId);
|
||||
|
||||
Integer selectCountByUserIdAndTaskId(@Param("stuId")Long stuId, @Param("taskId")String taskId);
|
||||
}
|
@@ -240,14 +240,20 @@ public class MonitorServiceImpl implements MonitorService {
|
||||
if (StringUtils.isNotBlank(stuMonitorPaperVo.getPaperId())) {
|
||||
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(stuMonitorPaperVo.getPaperId());
|
||||
String counts = educationPaper.getCounts();
|
||||
String countsStu = info.getCounts();
|
||||
int count = 0;
|
||||
int countStu = 0;
|
||||
try {
|
||||
count = Integer.parseInt(counts);
|
||||
countStu = Integer.parseInt(countsStu);
|
||||
} catch (NumberFormatException | NullPointerException e) {
|
||||
count = 0; // 默认从 0 开始
|
||||
countStu = 0;
|
||||
}
|
||||
count += 1;
|
||||
countStu += 1;
|
||||
educationPaper.setCounts(String.valueOf(count));
|
||||
info.setCounts(String.valueOf(countStu));
|
||||
educationPaperMapper.updateById(educationPaper);
|
||||
info.setPaperNum(educationPaper.getNum());
|
||||
}
|
||||
|
@@ -223,6 +223,7 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
|
||||
info.setTaskName(name);
|
||||
info.setTaskType(educationPaperTask.getTaskType());
|
||||
info.setInteractiveTime(null);
|
||||
info.setCounts("0");
|
||||
stringRedisTemplate.opsForValue().set(key, JsonUtils.toJsonString(info));
|
||||
monitorMapper.insert(info);
|
||||
educationPaperPerson.setPersonId(studentId);
|
||||
|
@@ -2,6 +2,7 @@ package pc.exam.pp.module.exam.service.paper;
|
||||
|
||||
|
||||
import cn.afterturn.easypoi.word.WordExportUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.poi.util.Units;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
@@ -27,6 +28,7 @@ import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.SchemeInfo;
|
||||
import pc.exam.pp.module.exam.controller.admin.paper.vo.StuInfoPaper;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.*;
|
||||
import pc.exam.pp.module.exam.dal.mysql.monitor.MonitorMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.paper.*;
|
||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
|
||||
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionFileMapper;
|
||||
@@ -73,6 +75,8 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
private ExamQuestionMapper examQuestionMapper;
|
||||
@Autowired
|
||||
private ExamQuestionFileMapper sysFileMapper;
|
||||
@Resource
|
||||
private MonitorMapper monitorMapper;
|
||||
/**
|
||||
* 查询试卷
|
||||
*
|
||||
@@ -339,10 +343,11 @@ public class EducationPaperServiceImpl implements IEducationPaperService
|
||||
EducationPaperStuDto educationPaperStuDto=new EducationPaperStuDto();
|
||||
|
||||
// EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(educationPaper.getTaskId());
|
||||
// Integer counts= monitorMapper.selectCountByUserIdAndTaskId(loginUserId,educationPaper.getTaskId());
|
||||
educationPaperStuDto.setPaperId(educationPaper.getPaperId());
|
||||
educationPaperStuDto.setNum(educationPaper.getNum());
|
||||
educationPaperStuDto.setTaskId(educationPaper.getTaskId());
|
||||
educationPaperStuDto.setCounts(educationPaper.getCounts());
|
||||
// educationPaperStuDto.setCounts(counts);
|
||||
educationPaperStuDto.setRollUp(educationPaper.getRollUp());
|
||||
educationPaperStuDto.setIsAb(educationPaper.getIsAb());
|
||||
// educationPaperStuDto.setEducationPaperParam(educationPaperParam);
|
||||
|
@@ -629,21 +629,22 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
if ("0".equals(taskType)) {
|
||||
for (EducationPaperTask paperTask : list) {
|
||||
String taskId = paperTask.getTaskId();
|
||||
int count = 0;
|
||||
List<EducationPaper> educationPapers = educationPaperMapper.selectPaperListByTaskId(paperTask.getTaskId());
|
||||
if (educationPapers != null && educationPapers.size() > 0) {
|
||||
for (EducationPaper educationPaper : educationPapers) {
|
||||
try {
|
||||
count += Integer.parseInt(educationPaper.getCounts());
|
||||
} catch (NumberFormatException e) {
|
||||
// 可选:记录异常或忽略非法数字
|
||||
System.err.println("无效的 counts 值: " + educationPaper.getCounts());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
paperTask.setCount(String.valueOf(count));
|
||||
|
||||
// int count = 0;
|
||||
// List<EducationPaper> educationPapers = educationPaperMapper.selectPaperListByTaskId(paperTask.getTaskId());
|
||||
// if (educationPapers != null && educationPapers.size() > 0) {
|
||||
//// for (EducationPaper educationPaper : educationPapers) {
|
||||
//// try {
|
||||
//// count += Integer.parseInt(educationPaper.getCounts());
|
||||
//// } catch (NumberFormatException e) {
|
||||
//// // 可选:记录异常或忽略非法数字
|
||||
//// System.err.println("无效的 counts 值: " + educationPaper.getCounts());
|
||||
//// }
|
||||
////
|
||||
//// }
|
||||
//
|
||||
// }
|
||||
Integer counts= monitorMapper.selectCountByUserIdAndTaskId(stuId,taskId);
|
||||
paperTask.setCount(counts.toString());
|
||||
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(taskId);
|
||||
//最高成绩
|
||||
|
||||
@@ -653,14 +654,14 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
|
||||
if (StringUtils.isNotBlank(score)) {
|
||||
paperTask.setScore(score);
|
||||
} else {
|
||||
paperTask.setScore("0.0");
|
||||
paperTask.setScore("0");
|
||||
}
|
||||
} else {
|
||||
String score = monitorMapper.selectByStuIdAndTaskIdNew(stuId, taskId);
|
||||
if (StringUtils.isNotBlank(score)) {
|
||||
paperTask.setScore(score);
|
||||
} else {
|
||||
paperTask.setScore("0.0");
|
||||
paperTask.setScore("0");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -29,6 +29,8 @@
|
||||
from exam_monitor
|
||||
where stu_id = #{stuId}
|
||||
and task_id = #{taskId}
|
||||
and deleted = '0'
|
||||
and exam_status = '0'
|
||||
ORDER BY score DESC LIMIT 1
|
||||
</select>
|
||||
<select id="selectByStuIdAndTaskIdNew" resultType="java.lang.String">
|
||||
@@ -36,6 +38,8 @@
|
||||
from exam_monitor
|
||||
where stu_id = #{stuId}
|
||||
and task_id = #{taskId}
|
||||
and deleted = '0'
|
||||
and exam_status = '0'
|
||||
ORDER BY create_time DESC LIMIT 1
|
||||
</select>
|
||||
<select id="selectByStuIdAndTaskId" resultType="java.lang.String">
|
||||
@@ -63,6 +67,14 @@
|
||||
WHERE ets.tenant_id = #{loginTenantId}
|
||||
|
||||
</select>
|
||||
<select id="selectCountByUserIdAndTaskId" resultType="java.lang.Integer">
|
||||
select sum(counts)
|
||||
from exam_monitor
|
||||
where stu_id =#{stuId}
|
||||
and task_id = #{taskId}
|
||||
and deleted = '0'
|
||||
and exam_status = '0'
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user