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