Commit ac6a971b by Wangmin

Merge remote-tracking branch 'origin/master'

parents fb4b534d 3210cd5c
......@@ -54,7 +54,7 @@ public class SysLoginController {
Map<String, Object> ajax = new HashMap<>();
SysUser sysUser = userService.selectUserByUserName(loginBody.getUsername());
if(null!=sysUser && sysUser.getSex().equals("0")){
throw new SecurityException("请填写正确老师账号");
throw new SecurityException("账户密码有误");
}
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
......
......@@ -16,6 +16,7 @@ import com.ruoyi.common.core.domain.model.XcxLoginUser;
import com.ruoyi.common.enums.DeviceType;
import com.ruoyi.common.enums.LoginType;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.CaptchaExpireException;
import com.ruoyi.common.exception.user.UserException;
......@@ -176,11 +177,11 @@ public class SysLoginService {
RedisUtils.deleteObject(verifyKey);
if (captcha == null) {
recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"));
throw new CaptchaExpireException();
throw new ServiceException("验证码无效");
}
if (!code.equalsIgnoreCase(captcha)) {
recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"));
throw new CaptchaException();
throw new ServiceException("验证码无效");
}
}
......@@ -190,10 +191,10 @@ public class SysLoginService {
.eq(SysUser::getUserName, username));
if (ObjectUtil.isNull(user)) {
log.info("登录用户:{} 不存在.", username);
throw new UserException("user.not.exists", username);
throw new UserException("登录用户:{} 不存在.", username);
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
log.info("登录用户:{} 已被停用.", username);
throw new UserException("user.blocked", username);
throw new UserException("登录用户:{} 已被停用.", username);
}
return userMapper.selectUserByUserName(username);
}
......
......@@ -40,8 +40,12 @@ public class DbBanner extends BaseEntity {
*/
private String remark;
/**
* 状态:0正常,1删除
* 状态:0正常,1停用
*/
private Integer status;
/**
* 删除状态:0正常,1删除
*/
private Integer delFlag;
}
......@@ -46,10 +46,15 @@ public class DbBannerBo extends BaseEntity {
private String remark;
/**
* 状态:0正常,1删除
* 状态:0正常,1停用
*/
// @NotNull(message = "状态:0正常,1删除不能为空", groups = { AddGroup.class, EditGroup.class })
private Integer status;
/**
* 删除状态:0正常,1删除
*/
private Integer delFlag;
}
......@@ -46,10 +46,15 @@ public class DbBannerVo {
private String remark;
/**
* 状态:0正常,1删除
* 状态:0正常,1停用
*/
@ExcelProperty(value = "状态:0正常,1删除")
@ExcelProperty(value = "状态:0正常,1停用")
private Integer status;
/**
* 删除状态:0正常,1删除
*/
@ExcelProperty(value = "删除状态:0正常,1删除")
private Integer delFlag;
}
......@@ -28,6 +28,10 @@ public class MyErrorTopicListVo implements Serializable {
private String topic;
/**
* 题目分数
*/
private String topicScore;
/**
* 我的答案
*/
private String answer;
......
package com.ruoyi.school.paper.service.impl
.paper.service.impl;
package com.ruoyi.school.paper.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.domain.PageQuery;
......@@ -15,10 +14,6 @@ import com.ruoyi.school.paper.domain.vo.DbBannerVo;
import com.ruoyi.school.paper.mapper.DbBannerMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import com.ruoyi.school.paper.domain.bo.DbBannerBo;
import com.ruoyi.school.paper.domain.vo.DbBannerVo;
import com.ruoyi.school.paper.domain.DbBanner;
import com.ruoyi.school.paper.mapper.DbBannerMapper;
import com.ruoyi.school.paper.service.IDbBannerService;
import java.util.List;
......@@ -50,6 +45,7 @@ public class DbBannerServiceImpl implements IDbBannerService {
*/
@Override
public TableDataInfo<DbBannerVo> queryPageList(DbBannerBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<DbBanner> lqw = buildQueryWrapper(bo);
Page<DbBannerVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
......@@ -70,6 +66,8 @@ public class DbBannerServiceImpl implements IDbBannerService {
lqw.eq(StringUtils.isNotBlank(bo.getBannerTitle()), DbBanner::getBannerTitle, bo.getBannerTitle());
lqw.eq(StringUtils.isNotBlank(bo.getUrl()), DbBanner::getUrl, bo.getUrl());
lqw.eq(bo.getStatus() != null, DbBanner::getStatus, bo.getStatus());
lqw.eq(DbBanner::getDelFlag, 0);
lqw.orderByDesc(BaseEntity::getCreateTime);
return lqw;
}
......
......@@ -2,6 +2,7 @@ package com.ruoyi.school.paper.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.dynamic.datasource.annotation.Slave;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......@@ -10,6 +11,7 @@ import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.common.utils.JsonUtils;
import com.ruoyi.common.utils.StringUtils;
......@@ -169,6 +171,9 @@ public class DbTestPaperServiceImpl implements IDbTestPaperService {
&& bank.getPhaseId().equals(bo.getPhaseId())
&& bo.getIntensitys().contains(bank.getIntensity())
).collect(Collectors.groupingBy(DbQuestionBank::getSpecies));
if (CollectionUtil.isEmpty(collect)) {
throw new ServiceException("符合条件的题目数量不足");
}
// 根据习题种类分组
// 选择题
List<DbQuestionBank> select = collect.get(2);
......@@ -180,6 +185,15 @@ public class DbTestPaperServiceImpl implements IDbTestPaperService {
List<DbQuestionBankTestPaper> papers = new ArrayList<>();
List<DbQuestionBankTestPaper> selectList = null;
if (bo.getTotalPoints().equals(100)) {
if (CollectionUtil.isEmpty(select) || select.size() < 4) {
throw new ServiceException("符合条件的题目数量不足");
}
if (CollectionUtil.isEmpty(gapFilling) || gapFilling.size() < 5) {
throw new ServiceException("符合条件的题目数量不足");
}
if (CollectionUtil.isEmpty(resolve) || resolve.size() < 2) {
throw new ServiceException("符合条件的题目数量不足");
}
selectList = generatePaper(select, 4, bo.getTotalPoints(), add.getId());
List<DbQuestionBankTestPaper> gapFillingList = generatePaper(gapFilling, 5, bo.getTotalPoints(), add.getId());
List<DbQuestionBankTestPaper> resolveList = generatePaper(resolve, 2, bo.getTotalPoints(), add.getId());
......@@ -187,6 +201,15 @@ public class DbTestPaperServiceImpl implements IDbTestPaperService {
papers.addAll(gapFillingList);
papers.addAll(resolveList);
} else {
if (CollectionUtil.isEmpty(select) || select.size() < 4) {
throw new ServiceException("符合条件的题目数量不足");
}
if (CollectionUtil.isEmpty(gapFilling) || gapFilling.size() < 12) {
throw new ServiceException("符合条件的题目数量不足");
}
if (CollectionUtil.isEmpty(resolve) || resolve.size() < 5) {
throw new ServiceException("符合条件的题目数量不足");
}
selectList = generatePaper(select, 4, bo.getTotalPoints(), add.getId());
List<DbQuestionBankTestPaper> gapFillingList = generatePaper(gapFilling, 12, bo.getTotalPoints(), add.getId());
List<DbQuestionBankTestPaper> resolveList = generatePaper(resolve, 5, bo.getTotalPoints(), add.getId());
......
......@@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="answer" column="answer"/>
<result property="answerPic" column="answers_pic"/>
<result property="score" column="score"/>
<result property="topicScore" column="topicScore"/>
<result property="correctAnswer" column="correctAnswer"/>
<result property="correctAnswerPic" column="correctAnswerPic"/>
<collection property="options" javaType="java.util.List" column="question_bank_id" select="getOptionList" ofType="com.ruoyi.school.paper.domain.vo.DbQuestionBankAnswerTestPaperVo">
......@@ -47,7 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
dtprd.answer,
dtprd.answers_pic,
dtprd.score,
dqbatp.species
dqbatp.species,
dqbatp.score as topicScore
FROM
db_test_paper_record_detail dtprd
LEFT JOIN db_question_bank_test_paper dqbatp ON dtprd.question_bank_id = dqbatp.id
......
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