考试安排除check外结束

main
sunhonglei 5 months ago
parent eec3f49b79
commit d22d0afebd
  1. 6
      ccic-entity/src/main/java/com/ccic/safeliab/entity/ExamSchedule.java
  2. 2
      ccic-exam/src/main/java/com/ccic/safeliab/dao/ExamScheduleMapper.java
  3. 2
      ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleService.java
  4. 6
      ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleServiceImpl.java
  5. 61
      ccic-exam/src/main/java/com/ccic/safeliab/web/ExamScheduleController.java
  6. 64
      ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml

@ -22,13 +22,17 @@ public class ExamSchedule extends BaseEntity{
/**
* 主键ID
*/
@TableId(value = "exam_id", type = IdType.ID_WORKER)
@TableId(value = "id", type = IdType.ID_WORKER)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
@TableField(exist = false)
private Long examId;
private String examName;
private Integer paperId;
@TableField(exist = false)
private String paperName;
private String industryId;
@TableField(exist = false)
private String regulatedIndustry;
private String examRegion;
@DateTimeFormat(

@ -14,4 +14,6 @@ public interface ExamScheduleMapper extends BaseMapper<ExamSchedule> {
List<ExamSchedule> selectExamSchedule(Map<String, Object> param);
List<Map<String,Object>> getIndustry();
List<Map<String,Object>> getPaper();
List<Map<String,Object>> getExamParticipation(String examId);
List<Map<String,Object>> getExamAnswerDetails(String examId);
}

@ -17,4 +17,6 @@ public interface ExamScheduleService extends BaseService<ExamSchedule> {
public int doPublish(List<String> ids);
public int doDelete(List<String> ids);
public int doCancel(List<String> ids);
public List<Map<String,Object>> getExamParticipation(String examId);
public List<Map<String,Object>> getExamAnswerDetails(String examId);
}

@ -54,5 +54,11 @@ public class ExamScheduleServiceImpl extends BaseServiceImpl<ExamScheduleMapper,
boolean result = updateBatchById(ExamSchedules);
return result?ExamSchedules.size():0;
}
public List<Map<String,Object>> getExamParticipation(String examId){
return baseMapper.getExamParticipation(examId);
}
public List<Map<String,Object>> getExamAnswerDetails(String examId){
return baseMapper.getExamAnswerDetails(examId);
}
}

@ -9,10 +9,7 @@ import com.ccic.safeliab.vo.InsDemoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@RestController
@RequestMapping("/ex/exam-schedule")
@ -23,9 +20,8 @@ public class ExamScheduleController {
public R select( @RequestParam(required = false) String examName,
@RequestParam(required = false) String paperName,
@RequestParam(required = false) String regulatedIndustry,
@RequestParam(required = false) String validDate,
@RequestParam(defaultValue = "1") int page,
@RequestParam(defaultValue = "10") int pageSize) {
@RequestParam(required = false) String validDate
) {
// 模拟数据库查询
List<ExamSchedule> examList = new ArrayList<>();
ExamScheduleVO insDemoVO = new ExamScheduleVO();
@ -42,26 +38,20 @@ public class ExamScheduleController {
result.put("total", examList.size());
return R.ok().data(result);
}
@GetMapping("/cancel")
public R cancel(@RequestParam(required = false) String[] ids) {
ExamScheduleVO insDemoVO = new ExamScheduleVO();
return R.ok().data(service.list(Condition.getQueryWrapper(insDemoVO)));
}
@GetMapping("/publish")
public R publish(@RequestParam(required = false) String[] ids) {
ExamScheduleVO insDemoVO = new ExamScheduleVO();
return R.ok().data(service.list(Condition.getQueryWrapper(insDemoVO)));
@PostMapping("/cancel")
public R cancel(@RequestBody List<String> ids) {
int result = service.doCancel(ids);
return R.ok().data(result);
}
@GetMapping("/delete")
public R delete(@RequestParam(required = false) String[] ids) {
ExamScheduleVO insDemoVO = new ExamScheduleVO();
return R.ok().data(service.list(Condition.getQueryWrapper(insDemoVO)));
@PostMapping("/publish")
public R publish(@RequestBody List<String> ids) {
int result = service.doPublish(ids);
return R.ok().data(result);
}
@PostMapping("/update")
public R update(@RequestBody ExamScheduleVO examSchedule) {
examSchedule.setPublishStatus(0);
boolean result = service.saveOrUpdate(examSchedule);
return R.ok().data("success.");
@PostMapping("/delete")
public R delete(@RequestBody List<String> ids) {
int result = service.doDelete(ids);
return R.ok().data(result);
}
@PostMapping("/insert")
@ -70,22 +60,39 @@ public class ExamScheduleController {
boolean result = service.saveOrUpdate(examSchedule);
return R.ok().data("success.");
}
@GetMapping("/getIndustry")
public R getIndustry(){
return R.ok().data(service.getIndustry());
}
@GetMapping("/getExamDataById")
public R getExamDataById(@RequestParam(required = false) String id){
return R.ok().data(service.getExamDataById(id));
}
@GetMapping("/getPaper")
public R getPaper(){
return R.ok().data(service.getPaper());
}
@GetMapping("/show")
public R show() {
@GetMapping("/paperStatusCheck")
public R paperStatusCheck() {
return R.ok().data("success.");
}
@GetMapping("/paperDeleteCheck")
public R paperDeleteCheck() {
return R.ok().data("success.");
}
@GetMapping("/getDetailById")
public R getAnswerStatus(@RequestParam(required = false) String id) {
Map<String, Object> param = new HashMap<>();
param.put("examParticipation",service.getExamParticipation(id));
param.put("examAnswer",service.getExamAnswerDetails(id));
return R.ok().data(param);
}
}

@ -3,7 +3,7 @@
<mapper namespace="com.ccic.safeliab.dao.ExamScheduleMapper">
<select id="selectExamSchedule" parameterType="java.util.Map" resultType="com.ccic.safeliab.entity.ExamSchedule">
SELECT
info.exam_id,
info.id as examId,
info.exam_name,
paper.paper_name,
ind.industry_name AS regulated_industry,
@ -21,10 +21,11 @@
LEFT JOIN ex_exam_papers paper
ON info.paper_id = paper.id
LEFT JOIN tbl_industry ind
ON ind.industry_id = info.regulated_industry
ON ind.industry_id = info.industry_id
AND ind.status = 1
WHERE
info.is_deleted = 0
and paper.is_deleted = 0
<if test="examName != null and examName != ''">
AND info.exam_name LIKE '%' + #{examName} + '%'
</if>
@ -37,7 +38,7 @@
<if test="date != null and date != ''">
AND #{date} BETWEEN info.valid_from AND info.valid_to
</if>
order by info.exam_id
order by info.created_at
</select>
<select id="getIndustry" resultType="java.util.Map">
select
@ -55,5 +56,62 @@
industry_id as regulatory_industry
from ex_exam_papers
where is_deleted = 0
and status = 1
</select>
<select id="getExamParticipation" resultType="java.util.Map">
SELECT
openuser.id as key,
openuser.nickname as name,
openuser.phone_number as phoneNumber ,
sc.total_score as score,
STRING_AGG ( questions.question_number, '、' ORDER BY TO_NUMBER(questions.question_number) ASC) as wrongQuestionIds
FROM
ex_exam_info info
LEFT JOIN ex_exam_scores sc ON info.paper_id = sc.paper_id
AND info.ID = sc.exam_id
LEFT JOIN ex_answers ans ON info.paper_id = ans.paper_id
AND sc.user_id = ans.user_id
AND ans.exam_id = info.ID
AND ans.is_correct = 0
LEFT JOIN ex_open_user openuser ON openuser.ID = sc.user_id
LEFT JOIN ex_paper_questions questions ON questions.question_id = ans.question_id
AND info.paper_id = ans.paper_id
WHERE
info.is_deleted = 0
AND info.ID = #{exam_id}
GROUP BY
openuser.id,
openuser.nickname,
openuser.phone_number,
sc.total_score
ORDER BY
openuser.nickname,
openuser.phone_number
</select>
<select id="getExamAnswerDetails" resultType="java.util.Map">
SELECT
questions.question_number as key,
questions.question_number as questionNumber,
SUM ( CASE WHEN ans.is_correct = 0 THEN 1 ELSE 0 END ) AS wrongPeopleCount,
STRING (
ROUND( SUM ( CASE WHEN ans.is_correct = 0 THEN 1 ELSE 0 END ) / COUNT ( 0 ) * 100, 0 )
) AS wrongPeopleRatio
FROM
ex_exam_info info
LEFT JOIN ex_exam_scores sc ON info.paper_id = sc.paper_id
AND info.ID = sc.exam_id
LEFT JOIN ex_answers ans ON info.paper_id = ans.paper_id
AND sc.user_id = ans.user_id
AND info.ID = ans.exam_id
LEFT JOIN ex_open_user openuser ON openuser.ID = ans.user_id
LEFT JOIN ex_paper_questions questions ON questions.question_id = ans.question_id
AND info.paper_id = ans.paper_id
WHERE
info.is_deleted = 0
AND info.ID = #{exam_id}
GROUP BY
questions.question_number
ORDER BY
questions.question_number
</select>
</mapper>
Loading…
Cancel
Save