Commit 2105746b authored by 刘帅's avatar 刘帅

1.用户协议、隐私政策

2.查询考试列表优化
parent a8ceef2c
package com.ruoyi.hezhi.api.kaoshi;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.hezhi.mapper.TbConfigMapper;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 参数配置 信息操作处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/api/config")
public class ApiConfigController
{
@Autowired
private TbConfigMapper configService;
/**
* 根据参数键名查询参数值
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey)
{
return AjaxResult.success(configService.selectTbConfigByIdentifying(configKey));
}
}
......@@ -350,6 +350,7 @@ public class ApiMemberUserController extends BaseController {
* @param pageSize 每页数据量
* @param params memberUserId 用户ID
* examStatus(1-已报名,2-待开考,3-开考中,4-已结束,5-领取证书)
* passStatus 通过状态(0-无,1-通过,2-未通过)
* @return success
*/
@GetMapping("/getMemberExamList")
......@@ -401,6 +402,7 @@ public class ApiMemberUserController extends BaseController {
numFour = examRegistrationService.getMemberExamList(hashMap).size();
hashMap.put("examStatus", 5);
hashMap.put("passStatus", 1);
numFive = examRegistrationService.getMemberExamList(hashMap).size();
}
......
......@@ -30,6 +30,10 @@ public class TbExamSimulateInfo extends BaseEntity
@Excel(name = "考台编号")
private String examPlatformNumber;
/** 考试批次序号 */
@Excel(name = "考试批次序号")
private Integer examBatchIndex;
/** 用户ID */
@Excel(name = "用户ID")
private Long memberUserId;
......
......@@ -385,6 +385,8 @@ public class TbExamSimulateInfoServiceImpl implements ITbExamSimulateInfoService
public Map<String, Object> getFormalSubjectAllInfo(Map<String, Object> params) {
long memberUserId = Long.parseLong(params.get("memberUserId").toString());
long examId = Long.parseLong(params.get("examId").toString());
int examBatchIndex = Integer.parseInt(params.get("examBatchIndex").toString());
Map<String, Object> formalSubjectAllInfo = tbExamSimulateInfoMapper.getFormalSubjectAllInfo(params);
......@@ -393,6 +395,7 @@ public class TbExamSimulateInfoServiceImpl implements ITbExamSimulateInfoService
TbExamSimulateInfo examSimulateInfo = new TbExamSimulateInfo();
Integer platformNumber = tbExamSimulateInfoMapper.selectMaxExamPlatformNumber(examId);
examSimulateInfo.setExamPlatformNumber(String.valueOf(platformNumber + 1));
examSimulateInfo.setExamBatchIndex(examBatchIndex);
examSimulateInfo.setMemberUserId(memberUserId);
examSimulateInfo.setExamId(examId);
examSimulateInfo.setExamType(1);
......@@ -442,10 +445,10 @@ public class TbExamSimulateInfoServiceImpl implements ITbExamSimulateInfoService
}
TbExam tbExam = examMapper.selectTbExamByExamId(examId);
TbExamRegistration tbExamRegistration = tbExamRegistrationMapper.selectTbExamRegistrationByUserIdExamId(memberUserId, examId);
if (tbExam != null) {
Integer isAgain = MapUtils.getInteger(formalSubjectAllInfo, "isAgain");
if (isAgain == 0){
TbExamRegistration tbExamRegistration = tbExamRegistrationMapper.selectTbExamRegistrationByUserIdExamId(memberUserId, examId);
List<TbExamBatch> enableByExamId = tbExamBatchMapper.getEnableByExamId(examId, tbExam.getExamBatchEarly());
if (!enableByExamId.isEmpty()){
List<TbExamBatch> collect = enableByExamId.stream().filter(item -> item.getBatchIndex() > tbExamRegistration.getExamBatchIndex()).collect(Collectors.toList());
......@@ -477,6 +480,7 @@ public class TbExamSimulateInfoServiceImpl implements ITbExamSimulateInfoService
TbExamSimulateInfo examSimulateInfo = new TbExamSimulateInfo();
Integer platformNumber = tbExamSimulateInfoMapper.selectMaxExamPlatformNumber(examId);
examSimulateInfo.setExamPlatformNumber(String.valueOf(platformNumber + 1));
examSimulateInfo.setExamBatchIndex(tbExamRegistration.getExamBatchIndex());
examSimulateInfo.setMemberUserId(memberUserId);
examSimulateInfo.setExamId(examId);
examSimulateInfo.setExamType(1);
......
......@@ -366,9 +366,7 @@ public class TbMemberExamSimulateAllServiceImpl implements ITbMemberExamSimulate
e.printStackTrace();
}
HashMap<String, Object> params = new HashMap<>();
params.put("memberUserId", memberUserId);
params.put("examSubjectId", examSubjectId);
// 正确答案
String answer = tbExamSubject.getAnswer();
......@@ -393,6 +391,16 @@ public class TbMemberExamSimulateAllServiceImpl implements ITbMemberExamSimulate
score = exam.getDiscussScore();
}
/* 根据考试、人员、题目ID查询该题是否存在 */
TbMemberExamSimulateAll examSimulateAll = new TbMemberExamSimulateAll();
examSimulateAll.setExamSimulateInfoId(examSimulateInfoId);
examSimulateAll.setExamSubjectId(examSubjectId);
examSimulateAll.setMemberUserId(memberUserId);
List<TbMemberExamSimulateAll> examSimulateAllList = tbMemberExamSimulateAllMapper.selectTbMemberExamSimulateAllList(examSimulateAll);
if (!examSimulateAllList.isEmpty()) {
}
TbMemberExamSimulateAll memberExamSimulateAll = new TbMemberExamSimulateAll();
memberExamSimulateAll.setExamSimulateInfoId(examSimulateInfoId);
memberExamSimulateAll.setExamSubjectId(examSubjectId);
......@@ -422,9 +430,12 @@ public class TbMemberExamSimulateAllServiceImpl implements ITbMemberExamSimulate
memberExamSimulateAll.setStatus(3);
}
HashMap<String, Object> params = new HashMap<>();
params.put("memberUserId", memberUserId);
params.put("examSubjectId", examSubjectId);
params.put("examSimulateInfoId", examSimulateInfoId);
params.put("examType", 1);
params.put("location", location);
// params.put("location", location);
TbMemberExamSimulateAll simulateAll = tbMemberExamSimulateAllMapper.queryMemberExamSimulateAllByParam(params);
if (ObjectUtils.isEmpty(simulateAll)) {
tbMemberExamSimulateAllMapper.insertTbMemberExamSimulateAll(memberExamSimulateAll);
......
......@@ -248,40 +248,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
1 ELSE 0
END isJoin,
CASE
WHEN #{memberUserId} = 0
THEN
- 1
WHEN #{memberUserId} = 0 THEN - 1
WHEN #{memberUserId} != 0
AND (
SELECT
tesn.pass_status
FROM
tb_exam_simulate_info tesn
WHERE
tesn.member_user_id = #{memberUserId}
AND tesn.exam_id = te.exam_id
AND tesn.exam_type = 1
ORDER BY
tesn.create_time DESC
LIMIT 1
) IS NULL THEN
0
AND (SELECT tesn.pass_status FROM tb_exam_simulate_info tesn WHERE tesn.member_user_id = #{memberUserId} AND tesn.exam_id = te.exam_id AND tesn.exam_type = 1
ORDER BY tesn.create_time DESC LIMIT 1 ) IS NULL
THEN 0
WHEN #{memberUserId} != 0
THEN
(
SELECT
tesn.pass_status
FROM
tb_exam_simulate_info tesn
WHERE
tesn.member_user_id = #{memberUserId}
AND tesn.exam_id = te.exam_id
AND tesn.exam_type = 1
ORDER BY
tesn.create_time DESC
LIMIT 1
) ELSE 0
THEN (SELECT tesn.pass_status FROM tb_exam_simulate_info tesn WHERE tesn.member_user_id = #{memberUserId} AND tesn.exam_id = te.exam_id AND tesn.exam_type = 1
ORDER BY tesn.create_time DESC LIMIT 1) ELSE 0
END passStatus,
(SELECT tesn.is_again FROM tb_exam_simulate_info tesn WHERE tesn.member_user_id = #{memberUserId} AND tesn.exam_id = te.exam_id AND tesn.exam_type = 1 ORDER BY tesn.create_time DESC LIMIT 1) is_again,
CASE
......
......@@ -914,6 +914,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ten.exam_notice_id examNoticeId,
ter.course_id courseId,
tc.course_name courseName,
tesi.pass_status AS passStatus,
(SELECT COUNT(*)
FROM tb_member_subject_collect tsc
WHERE tsc.member_user_id = ter.member_user_id
......@@ -938,6 +939,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join tb_exam te on ter.exam_id = te.exam_id
left join tb_exam_notice ten on ten.exam_id = ter.exam_id
left join tb_exam_batch teb on teb.exam_id = ter.exam_id and teb.batch_index = ter.exam_batch_index
LEFT JOIN tb_exam_simulate_info tesi ON ter.exam_id = tesi.exam_id AND ter.member_user_id = tesi.member_user_id AND ter.exam_batch_index = tesi.exam_batch_index
<where>
<if test="memberUserId == null or memberUserId == ''"> and ter.member_user_id = 0</if>
<if test="memberUserId != null and memberUserId != ''"> and ter.member_user_id = #{memberUserId}</if>
......@@ -974,6 +976,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isPay != null and isPay != ''">
and ter.is_pay = #{isPay}
</if>
<if test="passStatus != null">
and tesi.pass_status = #{passStatus}
</if>
</where>
<choose>
<when test="isExam != 1">
......
......@@ -91,6 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="examPlatformNumber != null">exam_platform_number,</if>
<if test="memberUserId != null">member_user_id,</if>
<if test="examId != null">exam_id,</if>
<if test="examBatchIndex != null">exam_batch_index,</if>
<if test="subjectWarehouseClassId != null">subject_warehouse_class_id,</if>
<if test="examType != null">exam_type,</if>
<if test="examMinute != null">exam_minute,</if>
......@@ -128,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="examPlatformNumber != null">#{examPlatformNumber},</if>
<if test="memberUserId != null">#{memberUserId},</if>
<if test="examId != null">#{examId},</if>
<if test="examBatchIndex != null">#{examBatchIndex},</if>
<if test="subjectWarehouseClassId != null">#{subjectWarehouseClassId},</if>
<if test="examType != null">#{examType},</if>
<if test="examMinute != null">#{examMinute},</if>
......@@ -320,7 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="examSimulateInfoId != null and examSimulateInfoId != ''"> and tesi.exam_simulate_info_id = #{examSimulateInfoId}</if>
<if test="memberUserId != null and memberUserId != ''"> and tesi.member_user_id = #{memberUserId}</if>
<if test="examId != null and examId != '' "> and tesi.exam_id = #{examId}</if>
<if test="examBatchIndex != null and examBatchIndex != '' "> and tesi.exam_platform_number = #{examBatchIndex}</if>
<if test="examBatchIndex != null and examBatchIndex != '' "> and tesi.exam_batch_index = #{examBatchIndex}</if>
and tesi.status = 0
and tesi.del_flag = 0
and tesi.exam_type = 1
......
......@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysConfigMapper">
<resultMap type="SysConfig" id="SysConfigResult">
<id property="configId" column="config_id" />
<result property="configName" column="config_name" />
......@@ -15,12 +15,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectConfigVo">
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from sys_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
......@@ -32,12 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
</sql>
<select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<where>
......@@ -58,17 +58,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
</select>
<select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_id = #{configId}
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1
</select>
<insert id="insertConfig" parameterType="SysConfig">
insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if>
......@@ -88,9 +88,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate()
)
</insert>
<update id="updateConfig" parameterType="SysConfig">
update sys_config
update sys_config
<set>
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
......@@ -102,16 +102,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set>
where config_id = #{configId}
</update>
<delete id="deleteConfigById" parameterType="Long">
delete from sys_config where config_id = #{configId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment