添加校验,只有学生账户才能参加测评
This commit is contained in:
parent
3f0a9bd46c
commit
73d7dfc36b
|
@ -34,4 +34,8 @@ public enum UserType {
|
|||
}
|
||||
throw new RuntimeException("'UserType' not found By " + str);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.userType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.enums.UserType;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.scale.constant.ScaleDimensionEnum;
|
||||
|
@ -77,6 +78,10 @@ public class WebServiceImpl implements IWebService {
|
|||
LoginUser loginUser = getLoginUser();
|
||||
Long userId = loginUser.getUserId();
|
||||
Long deptId = loginUser.getDeptId();
|
||||
String userType = loginUser.getUserType();
|
||||
if (!UserType.STUDENT.getName().equals(userType)) {
|
||||
throw new ServiceException("只有学生账户才能测评");
|
||||
}
|
||||
SysScalePublishVo sysScalePublishVo = null;
|
||||
if (deptId != null) {
|
||||
//先查询直接用户组的发布
|
||||
|
@ -130,6 +135,11 @@ public class WebServiceImpl implements IWebService {
|
|||
|
||||
@Override
|
||||
public Boolean newRecord(Long recordId) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userType = loginUser.getUserType();
|
||||
if (!UserType.STUDENT.getName().equals(userType)) {
|
||||
throw new ServiceException("只有学生账户才能测评");
|
||||
}
|
||||
//LoginUser loginUser = getLoginUser();
|
||||
SysEvaluationRecord evaluationRecord = recordMapper.selectById(recordId);
|
||||
if (evaluationRecord == null) {
|
||||
|
@ -148,6 +158,11 @@ public class WebServiceImpl implements IWebService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Map<String, Object> submitAnswer(SubmitAnswerBo bo) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
String userType = loginUser.getUserType();
|
||||
if (!UserType.STUDENT.getName().equals(userType)) {
|
||||
throw new ServiceException("只有学生账户才能测评");
|
||||
}
|
||||
boolean allowQueryResult = true;
|
||||
Long scaleId = bo.getScaleId();
|
||||
Map<String, List<SysScaleAnswerVo>> answerMapByQuestion = scaleAnswerService.getScaleAnswerMap(scaleId);
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.scale.mapper.SysEvaluationRecordMapper">
|
||||
|
||||
<select id="selectSclaeRecordListByUserAndBatch" resultType="org.dromara.scale.domain.vo.SysEvaluationRecordVo">
|
||||
select *
|
||||
from sys_evaluation_record
|
||||
|
@ -12,7 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="selectPublishByUseRecord" resultType="org.dromara.scale.domain.vo.SysScalePublishVo">
|
||||
select sp.batch_no ,allow_query_result
|
||||
select sp.batch_no, sp.allow_query_result
|
||||
from sys_evaluation_record er
|
||||
left join sys_scale_publish sp on er.batch_no = sp.batch_no
|
||||
where er.record_id = #{recordId}
|
||||
|
|
Loading…
Reference in New Issue