单点登陆
parent
e3158205b0
commit
30fd69726c
|
@ -2,6 +2,7 @@ package com.jwl.driver.server.controller;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.jwl.driver.server.dto.QuestionAddDto;
|
||||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||||
import com.jwl.driver.server.exception.BusinessException;
|
import com.jwl.driver.server.exception.BusinessException;
|
||||||
import com.jwl.driver.server.response.BaseResponse;
|
import com.jwl.driver.server.response.BaseResponse;
|
||||||
|
@ -13,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -110,6 +112,16 @@ public class TdQuestionController {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增题库")
|
||||||
|
@PostMapping("/insert")
|
||||||
|
public Map insertQuestion(@RequestBody @Valid QuestionAddDto addDto) {
|
||||||
|
log.info("新增题库======>QuestionAddDto:{}", addDto);
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("code", 200);
|
||||||
|
result.put("data", tdQuestionService.insertQuestion(addDto));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("查询各专项分类题目数量")
|
@ApiOperation("查询各专项分类题目数量")
|
||||||
@PostMapping("/querySpecialNum")
|
@PostMapping("/querySpecialNum")
|
||||||
public BaseResponse querySpecialNum(@RequestBody QuestionQueryDto queryDto) {
|
public BaseResponse querySpecialNum(@RequestBody QuestionQueryDto queryDto) {
|
||||||
|
|
|
@ -0,0 +1,192 @@
|
||||||
|
package com.jwl.driver.server.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 曹林
|
||||||
|
* @description 驾考新增入参
|
||||||
|
* @create 2023/8/13 17:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel("驾考题目出参")
|
||||||
|
public class QuestionAddDto {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题目内容
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "题目内容",required = true)
|
||||||
|
private String question;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项A
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("选项A")
|
||||||
|
private String chooseA;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项B
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("选项B")
|
||||||
|
private String chooseB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项C
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("选项C")
|
||||||
|
private String chooseC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项D
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("选项D")
|
||||||
|
private String chooseD;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项E
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("选项E")
|
||||||
|
private String chooseE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项F
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("选项F")
|
||||||
|
private String chooseF;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选项G
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("选项G")
|
||||||
|
private String chooseG;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正确答案
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("正确答案")
|
||||||
|
private String trueAnswer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未知
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("未知")
|
||||||
|
private String cids;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题型分类
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("题型分类")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题目图片url
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("题目图片url")
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未知
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("未知")
|
||||||
|
private String sohuImg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最佳回答
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("最佳回答")
|
||||||
|
private String bestAnswer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 章节标识
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("章节标识")
|
||||||
|
private String chapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属科目,1:科目1,2:科目4
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("所属科目,1:科目1,2:科目4")
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("选择")
|
||||||
|
private String options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题目类型,1:选择题 2:判断题,3:多选题
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("题目类型,1:选择题 2:判断题,3:多选题")
|
||||||
|
@NotBlank
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示序号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("显示序号")
|
||||||
|
private int showOrder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("车型")
|
||||||
|
@NotNull
|
||||||
|
private Integer carTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否生效
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("是否生效")
|
||||||
|
private String isActive;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否vip题型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("是否VIP")
|
||||||
|
@NotNull
|
||||||
|
private Integer isVip;
|
||||||
|
/**
|
||||||
|
* 是否易错
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("是否易错")
|
||||||
|
private Integer isError;
|
||||||
|
/**
|
||||||
|
* 是否v新规
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("是否新规")
|
||||||
|
private Integer isNew;
|
||||||
|
/**
|
||||||
|
* 考点
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("考点")
|
||||||
|
private String examKeys;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否精讯600题
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("精讯600题")
|
||||||
|
private Integer isVip2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否密卷1
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("是否密卷1")
|
||||||
|
private Integer isExam1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否密卷2
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("是否密卷2")
|
||||||
|
private Integer isExam2;
|
||||||
|
}
|
|
@ -56,5 +56,10 @@ public interface TdQuestionMapper extends BaseMapper<TdQuestion> {
|
||||||
*/
|
*/
|
||||||
Map<String, Integer> querySpecialNum(@Param("queryDto") QuestionQueryDto queryDto);
|
Map<String, Integer> querySpecialNum(@Param("queryDto") QuestionQueryDto queryDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车型最大排序
|
||||||
|
* @param carTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer queryMaxSort(@Param("carTypeId") int carTypeId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.jwl.driver.server.service;
|
package com.jwl.driver.server.service;
|
||||||
|
|
||||||
|
import com.jwl.driver.server.dto.QuestionAddDto;
|
||||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||||
import com.jwl.driver.server.entity.TdQuestion;
|
import com.jwl.driver.server.entity.TdQuestion;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
@ -76,6 +77,14 @@ public interface ITdQuestionService extends IService<TdQuestion> {
|
||||||
*/
|
*/
|
||||||
int updateQuestion(QuestionVo questionVo);
|
int updateQuestion(QuestionVo questionVo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增题库
|
||||||
|
* @param addDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean insertQuestion(QuestionAddDto addDto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取专项分类里题目数量
|
* 获取专项分类里题目数量
|
||||||
* @param queryDto
|
* @param queryDto
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.generator.config.IFileCreate;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.jwl.driver.server.constant.Constants;
|
import com.jwl.driver.server.constant.Constants;
|
||||||
import com.jwl.driver.server.constant.ErrorCode;
|
import com.jwl.driver.server.constant.ErrorCode;
|
||||||
|
import com.jwl.driver.server.dto.QuestionAddDto;
|
||||||
import com.jwl.driver.server.dto.QuestionQueryDto;
|
import com.jwl.driver.server.dto.QuestionQueryDto;
|
||||||
import com.jwl.driver.server.dto.TestQuestionTypeDto;
|
import com.jwl.driver.server.dto.TestQuestionTypeDto;
|
||||||
import com.jwl.driver.server.entity.TdQuestion;
|
import com.jwl.driver.server.entity.TdQuestion;
|
||||||
|
@ -26,6 +27,7 @@ import com.jwl.driver.server.service.ITdSysConfigService;
|
||||||
import com.jwl.driver.server.vo.QuestionVo;
|
import com.jwl.driver.server.vo.QuestionVo;
|
||||||
import com.jwl.driver.server.vo.QusetionCategoryVo;
|
import com.jwl.driver.server.vo.QusetionCategoryVo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -259,6 +261,25 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
||||||
return this.getBaseMapper().updateQuestion(questionVo);
|
return this.getBaseMapper().updateQuestion(questionVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean insertQuestion(QuestionAddDto addDto) {
|
||||||
|
|
||||||
|
TdQuestion question = new TdQuestion();
|
||||||
|
BeanUtils.copyProperties(addDto,question);
|
||||||
|
//获取该车型最大的排序
|
||||||
|
if (Objects.isNull(question.getShowOrder())){
|
||||||
|
Integer sort = this.getBaseMapper().queryMaxSort(question.getCarTypeId());
|
||||||
|
if (Objects.isNull(sort)){
|
||||||
|
sort = 1;
|
||||||
|
}else {
|
||||||
|
sort = sort + 1;
|
||||||
|
}
|
||||||
|
question.setShowOrder(sort);
|
||||||
|
}
|
||||||
|
question.setIsActive(Constants.IS_ACTIVE_TRUE);
|
||||||
|
return this.save(question);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Integer> querySpecialNum(QuestionQueryDto queryDto) {
|
public Map<String, Integer> querySpecialNum(QuestionQueryDto queryDto) {
|
||||||
//校验题库版本是否一致
|
//校验题库版本是否一致
|
||||||
|
@ -284,6 +305,8 @@ public class TdQuestionServiceImpl extends ServiceImpl<TdQuestionMapper, TdQuest
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 问题选项规整
|
* 问题选项规整
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -283,4 +283,11 @@
|
||||||
order by rand() limit ${queryDto.num};
|
order by rand() limit ${queryDto.num};
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryMaxSort" resultType="java.lang.Integer">
|
||||||
|
select
|
||||||
|
MAX(tq.SHOW_ORDER)
|
||||||
|
from td_question tq
|
||||||
|
where tq.CAR_TYPE_ID = #{carTypeId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue