app安全教育完成
This commit is contained in:
@ -8,15 +8,16 @@ import com.ruoyi.common.domain.Annex;
|
||||
import com.ruoyi.common.service.IAnnexService;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppGetTestPaperRes;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppSubmitATestPaperRes;
|
||||
import com.ruoyi.wgz.bo.rests.WgzAppGetTestPaperThree;
|
||||
import com.ruoyi.wgz.bo.rests.WgzAppGetTestPaperTwo;
|
||||
import com.ruoyi.wgz.bo.rests.WgzAutonymAnnex;
|
||||
import com.ruoyi.wgz.bo.req.*;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppAttachmentAcquisitionRes;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppPersonalBasicInformationRes;
|
||||
import com.ruoyi.wgz.domain.WgzQuestionBank;
|
||||
import com.ruoyi.wgz.domain.WgzQuestionsConfiguration;
|
||||
import com.ruoyi.wgz.service.IWgzQuestionBankService;
|
||||
import com.ruoyi.wgz.service.IWgzQuestionSaveService;
|
||||
import com.ruoyi.wgz.service.IWgzQuestionsConfigurationService;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -54,6 +55,12 @@ public class WgzAppController {
|
||||
@Autowired
|
||||
private IWgzQuestionBankService iWgzQuestionBankService;
|
||||
|
||||
@Autowired
|
||||
private IWgzQuestionsConfigurationService iWgzQuestionsConfigurationService;
|
||||
|
||||
@Autowired
|
||||
private IWgzQuestionSaveService iWgzQuestionSaveService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -141,13 +148,19 @@ public class WgzAppController {
|
||||
@ApiOperation("APP务工者-实名认证")
|
||||
@PreAuthorize("@ss.hasPermi('wgzApp:user:userRealNameAuthentication')")
|
||||
@PutMapping("/wgzUserRealNameAuthentication")
|
||||
public AjaxResult<Boolean> userRealNameAuthentication(@Validated @RequestBody WgzRealNameAuthenticationReq req) {
|
||||
public AjaxResult<Boolean> userRealNameAuthentication(@Validated @RequestBody WgzAppRealNameAuthenticationReq req) {
|
||||
return AjaxResult.success(iWgzUserService.userRealNameAuthentication(req));
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private IWgzQuestionsConfigurationService iWgzQuestionsConfigurationService;
|
||||
/**
|
||||
* 【我的】【签协议】协议列表(无任何实际操作目前只是查看)
|
||||
*/
|
||||
@ApiOperation("APP务工者-签协议·协议列表")
|
||||
@PreAuthorize("@ss.hasPermi('wgzApp:user:userSignAnAgreement')")
|
||||
@GetMapping("/WgzUserSignAnAgreement")
|
||||
public AjaxResult<WgzAppSubmitATestPaperRes> userSignAnAgreement(@Validated WgzAppSubmitATestPaperReq req) {
|
||||
return AjaxResult.success(iWgzQuestionSaveService.userSubmitATestPaper(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 【我的】【岗前培训】获取安全教育考试试卷(随机获取)
|
||||
@ -157,16 +170,14 @@ public class WgzAppController {
|
||||
@GetMapping("/WgzUserGetTestPaper")
|
||||
public AjaxResult<WgzAppGetTestPaperRes> userGetTestPaper() {
|
||||
//1、获取配置信息
|
||||
WgzQuestionsConfiguration configuration = iWgzQuestionsConfigurationService.appQueryById(2L);
|
||||
WgzQuestionsConfiguration configuration = iWgzQuestionsConfigurationService.appQueryLimitOne();
|
||||
if (configuration == null) {
|
||||
throw new RuntimeException("未查询到配置信息");
|
||||
}
|
||||
|
||||
//2、随机获取数据,返回id和score
|
||||
Integer s = configuration.getSingleChoice();
|
||||
Integer m = configuration.getMultipleChoice();
|
||||
Integer e = configuration.getEstimate();
|
||||
|
||||
List<WgzAppGetTestPaperThree> sEntity = iWgzQuestionBankService.appQueryList(1, s);
|
||||
List<WgzAppGetTestPaperThree> mEntity = iWgzQuestionBankService.appQueryList(2, m);
|
||||
List<WgzAppGetTestPaperThree> eEntity = iWgzQuestionBankService.appQueryList(3, e);
|
||||
@ -175,34 +186,21 @@ public class WgzAppController {
|
||||
res.setSingleList(createQuestionSection("一、单选题", sEntity, configuration.getSingleScore(), s));
|
||||
res.setMultipleList(createQuestionSection("二、多选题", mEntity, configuration.getMultipleScore(), m));
|
||||
res.setEstimateList(createQuestionSection("三、判断题", eEntity, configuration.getEstimateScore(), e));
|
||||
// WgzAppGetTestPaperTwo one = new WgzAppGetTestPaperTwo();
|
||||
// one.setTopic("一、单选题,共" + s + "道题,每小题" + configuration.getSingleScore() + "分,共计" + s * configuration.getSingleScore() + "分");
|
||||
// sEntity.forEach(item -> {
|
||||
// item.setScore(configuration.getSingleScore());
|
||||
// });
|
||||
// one.setList(sEntity);
|
||||
// res.setSingleList(one);
|
||||
//
|
||||
// WgzAppGetTestPaperTwo two = new WgzAppGetTestPaperTwo();
|
||||
// two.setTopic("二、多选题,共" + m + "道题,每小题" + configuration.getMultipleScore() + "分,共计" + m * configuration.getMultipleScore() + "分");
|
||||
// mEntity.forEach(item -> {
|
||||
// item.setScore(configuration.getMultipleScore());
|
||||
// });
|
||||
// two.setList(mEntity);
|
||||
// res.setMultipleList(two);
|
||||
//
|
||||
// WgzAppGetTestPaperTwo three = new WgzAppGetTestPaperTwo();
|
||||
// three.setTopic("三、判断题,共" + e + "道题,每小题" + configuration.getEstimateScore() + "分,共计" + e * configuration.getEstimateScore() + "分");
|
||||
// eEntity.forEach(item -> {
|
||||
// item.setScore(configuration.getEstimateScore());
|
||||
// });
|
||||
// three.setList(eEntity);
|
||||
// res.setMultipleList(three);
|
||||
//4、设置最大考试时间
|
||||
res.setMaximum(configuration.getAnswerTime());
|
||||
return AjaxResult.success(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 【我的】【岗前培训】提交用户的试卷(只保存最高分的试卷信息)
|
||||
*/
|
||||
@ApiOperation("APP务工者-岗前培训·提交试卷")
|
||||
@PreAuthorize("@ss.hasPermi('wgzApp:user:userSubmitATestPaper')")
|
||||
@PostMapping("/WgzUserSubmitATestPaper")
|
||||
public AjaxResult<WgzAppSubmitATestPaperRes> userSubmitATestPaper(@Validated @RequestBody WgzAppSubmitATestPaperReq req) {
|
||||
return AjaxResult.success(iWgzQuestionSaveService.userSubmitATestPaper(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制层业务
|
||||
* =================================================================================================================
|
||||
|
@ -74,7 +74,7 @@ public class ${ClassName} implements Serializable {
|
||||
@TableField($TableField)
|
||||
#end
|
||||
#if($column.javaField=='delFlag')
|
||||
@TableLogic
|
||||
## @TableLogic 罗成直接只注释掉,需要使用逻辑删除需自己手动添加
|
||||
#end
|
||||
#if($column.javaField=='version')
|
||||
@Version
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.common.domain.Annex;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -10,7 +9,6 @@ import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@ -18,7 +16,7 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP-实名认证对象")
|
||||
public class WgzRealNameAuthenticationReq implements Serializable {
|
||||
public class WgzAppRealNameAuthenticationReq implements Serializable {
|
||||
@ApiModelProperty("唯一标识")
|
||||
@NotNull(message = "唯一标识不能为空")
|
||||
private Long userId;
|
@ -0,0 +1,26 @@
|
||||
package com.ruoyi.wgz.bo.req;
|
||||
|
||||
import com.ruoyi.wgz.bo.rests.WgzAppSubmitATestPaperTwo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP-提交考试信息请求对象")
|
||||
public class WgzAppSubmitATestPaperReq implements Serializable {
|
||||
@ApiModelProperty("务工者唯一标识")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("用时时间(时间戳/秒)")
|
||||
private Long takeTime;
|
||||
|
||||
@ApiModelProperty("list")
|
||||
private List<WgzAppSubmitATestPaperTwo> list;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.ruoyi.wgz.bo.res;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@ApiModel("务工者APP-提交考试信息返回对象")
|
||||
public class WgzAppSubmitATestPaperRes implements Serializable {
|
||||
@ApiModelProperty("总考试时间(分钟)")
|
||||
private Integer answerTime;
|
||||
|
||||
@ApiModelProperty("用时时间(时间戳/秒)")
|
||||
private Long takeTime;
|
||||
|
||||
@ApiModelProperty("满分")
|
||||
private Double fullMark;
|
||||
|
||||
@ApiModelProperty("及格分")
|
||||
private Double passingScore;
|
||||
|
||||
@ApiModelProperty("当前分")
|
||||
private Double score;
|
||||
|
||||
@ApiModelProperty("答对题数")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty("试卷")
|
||||
private String pdfStr;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ruoyi.wgz.bo.rests;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class WgzAppSubmitATestPaperTwo implements Serializable {
|
||||
@ApiModelProperty("题库ID")
|
||||
private long bankId;
|
||||
|
||||
@ApiModelProperty("答案")
|
||||
private String answer;
|
||||
|
||||
@ApiModelProperty("当前题分数")
|
||||
private double score;
|
||||
}
|
@ -59,7 +59,7 @@ public class WgzQuestionSave implements Serializable {
|
||||
/** 得分(当前题) */
|
||||
@Excel(name = "得分" , readConverterExp = "当=前题")
|
||||
@ApiModelProperty("得分(当前题)")
|
||||
private Long score;
|
||||
private Double score;
|
||||
|
||||
/** 签名路径 */
|
||||
@Excel(name = "签名路径")
|
||||
@ -74,7 +74,7 @@ public class WgzQuestionSave implements Serializable {
|
||||
/** 最大超时时间(单位/分钟) */
|
||||
@Excel(name = "最大超时时间" , readConverterExp = "单=位/分钟")
|
||||
@ApiModelProperty("最大超时时间(单位/分钟)")
|
||||
private Long timeOut;
|
||||
private Integer timeOut;
|
||||
|
||||
/** 及格线/总分(格式:60,100) */
|
||||
@Excel(name = "及格线/总分" , readConverterExp = "格=式:60,100")
|
||||
@ -84,7 +84,7 @@ public class WgzQuestionSave implements Serializable {
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
@Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除")
|
||||
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
|
||||
@TableLogic
|
||||
// @TableLogic
|
||||
private String delFlag;
|
||||
|
||||
/** 创建者 */
|
||||
|
@ -69,12 +69,12 @@ public class WgzQuestionsConfiguration implements Serializable {
|
||||
/** 满分 */
|
||||
@Excel(name = "满分")
|
||||
@ApiModelProperty("满分")
|
||||
private Long fullMark;
|
||||
private Double fullMark;
|
||||
|
||||
/** 及格线 */
|
||||
@Excel(name = "及格线")
|
||||
@ApiModelProperty("及格线")
|
||||
private Long passingScore;
|
||||
private Double passingScore;
|
||||
|
||||
/** 答题最大时间(单位/分钟) */
|
||||
@Excel(name = "答题最大时间" , readConverterExp = "单=位/分钟")
|
||||
|
@ -4,6 +4,10 @@ import com.ruoyi.wgz.domain.WgzQuestionSave;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户试卷存储Mapper接口
|
||||
@ -15,4 +19,11 @@ import org.apache.ibatis.annotations.CacheNamespace;
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface WgzQuestionSaveMapper extends BaseMapperPlus<WgzQuestionSave> {
|
||||
|
||||
@Select("SELECT SUM(score) AS sumScore, " +
|
||||
"(SELECT pass FROM bus_question_save WHERE user_id = #{userId} AND del_flag = '0' ORDER BY id ASC LIMIT 1) AS pass, " +
|
||||
"(SELECT sign FROM bus_question_save WHERE user_id = #{userId} AND del_flag = '0' ORDER BY id ASC LIMIT 1) AS sign " +
|
||||
"FROM wgz_question_save " +
|
||||
"WHERE correct = 1 AND user_id = #{userId}")
|
||||
Map<String, Object> getSumScoreAndPassAndSign(@Param("userId") Long userId);
|
||||
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ public interface IWgzQuestionBankService extends IServicePlus<WgzQuestionBank> {
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* 随机获取指定个数类型的题
|
||||
* @param type 类型
|
||||
@ -70,4 +71,9 @@ public interface IWgzQuestionBankService extends IServicePlus<WgzQuestionBank> {
|
||||
* @param num 数量
|
||||
*/
|
||||
List<WgzAppGetTestPaperThree> appQueryList(int type, int num);
|
||||
|
||||
/**
|
||||
* 根据id查询得到具体题库的信息
|
||||
*/
|
||||
WgzQuestionBank selectById(Long id);
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package com.ruoyi.wgz.service;
|
||||
|
||||
import com.ruoyi.wgz.bo.req.WgzAppSubmitATestPaperReq;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppSubmitATestPaperRes;
|
||||
import com.ruoyi.wgz.domain.WgzQuestionSave;
|
||||
import com.ruoyi.wgz.bo.WgzQuestionSaveQueryBo;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -52,4 +56,16 @@ public interface IWgzQuestionSaveService extends IServicePlus<WgzQuestionSave> {
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* 安全教育试卷提交保存
|
||||
*/
|
||||
WgzAppSubmitATestPaperRes userSubmitATestPaper(@Validated @RequestBody WgzAppSubmitATestPaperReq req);
|
||||
}
|
||||
|
@ -64,5 +64,5 @@ public interface IWgzQuestionsConfigurationService extends IServicePlus<WgzQuest
|
||||
/**
|
||||
* 根据id查询到具体信息
|
||||
*/
|
||||
WgzQuestionsConfiguration appQueryById(Long id);
|
||||
WgzQuestionsConfiguration appQueryLimitOne();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.ruoyi.wgz.bo.WgzUserQueryBo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppModifyingUserProfilePictureReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppPersonalBasicInformationReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserRegisterReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzRealNameAuthenticationReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppRealNameAuthenticationReq;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppPersonalBasicInformationRes;
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -91,5 +91,5 @@ public interface IWgzUserService extends IServicePlus<WgzUser> {
|
||||
/**
|
||||
* 务工者APP实名认证
|
||||
*/
|
||||
Boolean userRealNameAuthentication(@Validated @RequestBody WgzRealNameAuthenticationReq req);
|
||||
Boolean userRealNameAuthentication(@Validated @RequestBody WgzAppRealNameAuthenticationReq req);
|
||||
}
|
||||
|
@ -100,4 +100,9 @@ public class WgzQuestionBankServiceImpl extends ServicePlusImpl<WgzQuestionBankM
|
||||
BeanUtils.copyProperties(wgzQuestionBanks, wgzAppGetTestPaperThrees);
|
||||
return wgzAppGetTestPaperThrees;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WgzQuestionBank selectById(Long id) {
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,16 @@
|
||||
package com.ruoyi.wgz.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppSubmitATestPaperReq;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppSubmitATestPaperRes;
|
||||
import com.ruoyi.wgz.domain.WgzQuestionBank;
|
||||
import com.ruoyi.wgz.domain.WgzQuestionsConfiguration;
|
||||
import com.ruoyi.wgz.service.IWgzQuestionBankService;
|
||||
import com.ruoyi.wgz.service.IWgzQuestionsConfigurationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -14,10 +19,12 @@ import com.ruoyi.wgz.bo.WgzQuestionSaveQueryBo;
|
||||
import com.ruoyi.wgz.domain.WgzQuestionSave;
|
||||
import com.ruoyi.wgz.mapper.WgzQuestionSaveMapper;
|
||||
import com.ruoyi.wgz.service.IWgzQuestionSaveService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* 用户试卷存储Service业务层处理
|
||||
@ -28,6 +35,12 @@ import java.util.Collection;
|
||||
@Service
|
||||
public class WgzQuestionSaveServiceImpl extends ServicePlusImpl<WgzQuestionSaveMapper, WgzQuestionSave> implements IWgzQuestionSaveService {
|
||||
|
||||
@Autowired
|
||||
private IWgzQuestionsConfigurationService iWgzQuestionsConfigurationService;
|
||||
|
||||
@Autowired
|
||||
private IWgzQuestionBankService iWgzQuestionBankService;
|
||||
|
||||
@Override
|
||||
public WgzQuestionSave queryById(Long id){
|
||||
return getById(id);
|
||||
@ -81,4 +94,94 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl<WgzQuestionSaveM
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public WgzAppSubmitATestPaperRes userSubmitATestPaper(WgzAppSubmitATestPaperReq req) {
|
||||
// 初始化第一次分数和当前考试的分数
|
||||
double scoreOne = 0.00;
|
||||
double scoreTwo = 0.00;
|
||||
//1、获取上次考试的分数
|
||||
Map<String, Object> spMap = baseMapper.getSumScoreAndPassAndSign(req.getUserId());
|
||||
if (spMap != null) {
|
||||
String pass = (String) spMap.get("pass");
|
||||
if (pass != null && !pass.isEmpty()) {
|
||||
String[] split = pass.split(",");
|
||||
double float1 = Double.parseDouble(split[1]);
|
||||
double sumScore = (double) spMap.get("sumScore");
|
||||
scoreOne = 100.00 / float1 * sumScore;
|
||||
}
|
||||
}
|
||||
//2、获取配置信息
|
||||
WgzQuestionsConfiguration configuration = iWgzQuestionsConfigurationService.appQueryLimitOne();
|
||||
//3、计算这次用户提交的试卷信息所得到的分数
|
||||
List<WgzQuestionSave> bqs = new ArrayList<>();
|
||||
AtomicReference<Double> fenshu = new AtomicReference<>(0.0);
|
||||
AtomicInteger number = new AtomicInteger(0);
|
||||
AtomicInteger index = new AtomicInteger(0);
|
||||
req.getList().forEach(data -> {
|
||||
String correct = "";
|
||||
String pass = "";
|
||||
// 获取题库的正确答案,然后和用户的答案作对比
|
||||
WgzQuestionBank bqb = iWgzQuestionBankService.selectById(data.getBankId());
|
||||
if (bqb == null) {
|
||||
throw new RuntimeException("您的试卷被外星人卷走了!");
|
||||
} else {
|
||||
if (StringUtils.isEmpty(data.getAnswer())) {
|
||||
throw new RuntimeException("您还有题未答完!");
|
||||
}
|
||||
if (bqb.getCorrectAnswer().toLowerCase().contains(data.getAnswer().toLowerCase())) {
|
||||
correct = "1";
|
||||
fenshu.updateAndGet(v -> v + data.getScore());
|
||||
number.incrementAndGet();
|
||||
} else {
|
||||
correct = "2";
|
||||
}
|
||||
}
|
||||
// 记录这次的及格线和总分
|
||||
pass = configuration.getPassingScore().toString() + "," + configuration.getFullMark().toString();
|
||||
WgzQuestionSave bqsTwo = new WgzQuestionSave();
|
||||
bqsTwo.setUserId(req.getUserId());
|
||||
bqsTwo.setBankId(data.getBankId());
|
||||
bqsTwo.setAnswer(data.getAnswer());
|
||||
bqsTwo.setCorrect(correct);
|
||||
bqsTwo.setScore(data.getScore());
|
||||
//这几条数据只在每张试卷的第一条数据中存储(重复的没必要每条都存储)
|
||||
if (index.get() == 0) {
|
||||
bqsTwo.setTakeTime(req.getTakeTime());
|
||||
bqsTwo.setTimeOut(configuration.getAnswerTime());
|
||||
bqsTwo.setPass(pass);
|
||||
}
|
||||
bqs.add(bqsTwo);
|
||||
index.incrementAndGet();
|
||||
});
|
||||
Double fullMark = configuration.getFullMark();
|
||||
scoreTwo = 100.00 / fullMark * fenshu.get();
|
||||
WgzAppSubmitATestPaperRes res = new WgzAppSubmitATestPaperRes();
|
||||
res.setAnswerTime(configuration.getAnswerTime());
|
||||
res.setTakeTime(req.getTakeTime());
|
||||
res.setFullMark(fullMark);
|
||||
res.setPassingScore(configuration.getPassingScore());
|
||||
res.setScore(fenshu.get());
|
||||
res.setNumber(number.get());
|
||||
//4、两次卷子的分数对比,第一次的分数比第二次大那么第二次只返回结果;第二次的分数比第一次大那么删除第一次的数据再重新插入
|
||||
if (scoreOne > scoreTwo) {
|
||||
return res;
|
||||
} else {
|
||||
// 先查询当前用户是否有答题,有就把之前的删除(真删)
|
||||
int deleteResult = baseMapper.delete(new LambdaQueryWrapper<WgzQuestionSave>().eq(WgzQuestionSave::getUserId, req.getUserId()));
|
||||
if (deleteResult >0){
|
||||
// 插入新数据
|
||||
super.saveBatch(bqs);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.ruoyi.wgz.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
@ -89,7 +90,13 @@ public class WgzQuestionsConfigurationServiceImpl extends ServicePlusImpl<WgzQue
|
||||
*/
|
||||
|
||||
@Override
|
||||
public WgzQuestionsConfiguration appQueryById(Long id) {
|
||||
return baseMapper.selectById(id);
|
||||
public WgzQuestionsConfiguration appQueryLimitOne() {
|
||||
QueryWrapper<WgzQuestionsConfiguration> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.last("LIMIT 1");
|
||||
WgzQuestionsConfiguration wgzQuestionsConfiguration = baseMapper.selectOne(queryWrapper);
|
||||
if(wgzQuestionsConfiguration==null){
|
||||
throw new RuntimeException("题库配置为空");
|
||||
}
|
||||
return wgzQuestionsConfiguration;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import com.ruoyi.wgz.bo.WgzUserQueryBo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppModifyingUserProfilePictureReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppPersonalBasicInformationReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserRegisterReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzRealNameAuthenticationReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppRealNameAuthenticationReq;
|
||||
import com.ruoyi.wgz.bo.res.WgzAppPersonalBasicInformationRes;
|
||||
import com.ruoyi.wgz.common.SnowflakeIdUtil;
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
@ -168,7 +168,7 @@ public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser>
|
||||
//实名认证
|
||||
@Override
|
||||
@Transactional()
|
||||
public Boolean userRealNameAuthentication(WgzRealNameAuthenticationReq req) {
|
||||
public Boolean userRealNameAuthentication(WgzAppRealNameAuthenticationReq req) {
|
||||
//1、对指定用户进行实名认证
|
||||
WgzUser user = new WgzUser();
|
||||
BeanUtils.copyProperties(req, user);
|
||||
|
@ -0,0 +1,24 @@
|
||||
<?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">
|
||||
<mapper namespace="com.ruoyi.wgz.mapper.WgzQuestionBankMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.wgz.domain.WgzQuestionBank" id="WgzQuestionBankResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="categoryId" column="category_id"/>
|
||||
<result property="questionType" column="question_type"/>
|
||||
<result property="questionText" column="question_text"/>
|
||||
<result property="options" column="options"/>
|
||||
<result property="correctAnswer" column="correct_answer"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,13 @@
|
||||
<?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">
|
||||
<mapper namespace="com.ruoyi.wgz.mapper.WgzQuestionCategoryMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.wgz.domain.WgzQuestionCategory" id="WgzQuestionCategoryResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="categoryName" column="category_name"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,27 @@
|
||||
<?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">
|
||||
<mapper namespace="com.ruoyi.wgz.mapper.WgzQuestionSaveMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.wgz.domain.WgzQuestionSave" id="WgzQuestionSaveResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="bankId" column="bank_id"/>
|
||||
<result property="answer" column="answer"/>
|
||||
<result property="correct" column="correct"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="sign" column="sign"/>
|
||||
<result property="takeTime" column="take_time"/>
|
||||
<result property="timeOut" column="time_out"/>
|
||||
<result property="pass" column="pass"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,21 @@
|
||||
<?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">
|
||||
<mapper namespace="com.ruoyi.wgz.mapper.WgzQuestionsConfigurationMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.wgz.domain.WgzQuestionsConfiguration" id="WgzQuestionsConfigurationResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="singleChoice" column="single_choice"/>
|
||||
<result property="singleScore" column="single_score"/>
|
||||
<result property="multipleChoice" column="multiple_choice"/>
|
||||
<result property="multipleScore" column="multiple_score"/>
|
||||
<result property="estimate" column="estimate"/>
|
||||
<result property="estimateScore" column="estimate_score"/>
|
||||
<result property="fullMark" column="full_mark"/>
|
||||
<result property="passingScore" column="passing_score"/>
|
||||
<result property="answerTime" column="answer_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
@ -1,22 +0,0 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库', '${parentMenuId}', '1', 'bank', 'wgz/bank/index', 1, 0, 'C', '0', '0', 'wgz:bank:list', '#', 'admin', sysdate(), '', null, '题库菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'wgz:bank:query', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'wgz:bank:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'wgz:bank:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'wgz:bank:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'wgz:bank:export', '#', 'admin', sysdate(), '', null, '');
|
@ -1,22 +0,0 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库_题库类别', '3', '1', 'category', 'wgz/category/index', 1, 0, 'C', '0', '0', 'wgz:category:list', '#', 'admin', sysdate(), '', null, '题库_题库类别菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库_题库类别查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'wgz:category:query', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库_题库类别新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'wgz:category:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库_题库类别修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'wgz:category:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库_题库类别删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'wgz:category:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库_题库类别导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'wgz:category:export', '#', 'admin', sysdate(), '', null, '');
|
@ -1,22 +0,0 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库配置', '${parentMenuId}', '1', 'configuration', 'wgz/configuration/index', 1, 0, 'C', '0', '0', 'wgz:configuration:list', '#', 'admin', sysdate(), '', null, '题库配置菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库配置查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'wgz:configuration:query', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库配置新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'wgz:configuration:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库配置修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'wgz:configuration:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库配置删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'wgz:configuration:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('题库配置导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'wgz:configuration:export', '#', 'admin', sysdate(), '', null, '');
|
@ -1,22 +0,0 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户试卷存储', '${parentMenuId}', '1', 'save', 'wgz/save/index', 1, 0, 'C', '0', '0', 'wgz:save:list', '#', 'admin', sysdate(), '', null, '用户试卷存储菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户试卷存储查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'wgz:save:query', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户试卷存储新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'wgz:save:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户试卷存储修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'wgz:save:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户试卷存储删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'wgz:save:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户试卷存储导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'wgz:save:export', '#', 'admin', sysdate(), '', null, '');
|
Reference in New Issue
Block a user