Browse Source

三力测试

小么熊🐻 2 years ago
parent
commit
df67dcaf9c

+ 3 - 1
nbjk-admin/src/main/java/com/miaxis/app/controller/question/QuestionInfoController.java

@@ -147,7 +147,6 @@ public class QuestionInfoController extends BaseController {
 
 
 
-
     /**
      * 查询秘密卷
      */
@@ -159,5 +158,8 @@ public class QuestionInfoController extends BaseController {
     }
 
 
+
+
+
 }
 

+ 0 - 1
nbjk-admin/src/main/java/com/miaxis/app/controller/question/QuestionWrongController.java

@@ -5,7 +5,6 @@ import com.miaxis.common.constant.Constants;
 import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.utils.SecurityUtils;
-import com.miaxis.question.domain.QuestionInfo;
 import com.miaxis.question.domain.QuestionWrong;
 import com.miaxis.question.dto.*;
 import com.miaxis.question.service.IQuestionWrongService;

+ 68 - 0
nbjk-admin/src/main/java/com/miaxis/app/controller/question/ThreeForceController.java

@@ -0,0 +1,68 @@
+package com.miaxis.app.controller.question;
+
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.question.domain.QuestionInfo;
+import com.miaxis.three.domain.ThreeForce;
+import com.miaxis.three.service.IThreeForceService;
+import io.swagger.annotations.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 【三力测试】Controller
+ *
+ * @author miaxis
+ * @date 2023-04-03
+ */
+@RestController
+@RequestMapping(Constants.STUDENT_PREFIX +"/three/force")
+@Api(tags={"【app-三力测试】"})
+public class ThreeForceController extends BaseController{
+    @Autowired
+    private IThreeForceService threeForceService;
+
+    /**
+     * 查询三力测试列表
+     */
+    @GetMapping("/list")
+    @ApiOperation("查询三力测试列表")
+        @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<ThreeForce> list(@ModelAttribute ThreeForce threeForce){
+        startPage();
+        List<ThreeForce> list = threeForceService.selectThreeForceList(threeForce);
+        return toResponsePageInfo(list);
+    }
+    
+
+    /**
+     * 获取三力测试详细信息
+     */
+    @GetMapping(value = "/{id}")
+    @ApiOperation("获取三力测试详细信息")
+    public Response<ThreeForce> getInfo(
+            @ApiParam(name = "id", value = "三力测试参数", required = true)
+            @PathVariable("id") Long id
+    ){
+        return Response.success(threeForceService.getById(id));
+    }
+
+    /**
+     * 获取三力测试模拟考题
+     */
+    @GetMapping("/selectTestQuestionInfoList")
+    @ApiOperation("获取三力测试模拟考题")
+    public ResponsePageInfo<ThreeForce> selectTestQuestionInfoList(){
+        List<ThreeForce> list = threeForceService.selectTestQuestionInfoList();
+        return toResponsePageInfo(list);
+    }
+
+
+}

+ 0 - 2
nbjk-admin/src/main/java/com/miaxis/app/controller/user/UserInfoController.java

@@ -25,8 +25,6 @@ import java.security.PrivateKey;
 import java.security.Signature;
 import java.security.spec.PKCS8EncodedKeySpec;
 import java.util.Base64;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * 【用户】Controller

+ 1 - 3
nbjk-framework/src/main/java/com/miaxis/framework/web/service/UserDetailsServiceImpl.java

@@ -121,7 +121,7 @@ public class UserDetailsServiceImpl implements UserDetailsService
                 if (userInfoGetByUnionId == null ) {
                     UserInfo userInfo = new UserInfo();
                     userInfo.setHeadImage((String) ServletUtils.getRequest().getAttribute("headImage"));
-                    userInfo.setNickName((String) ServletUtils.getRequest().getAttribute("nickName"));
+                    userInfo.setNickName(RandomNameUtils.generateName());
                     userInfo.setXcxOpenid(openid);
                     userInfo.setUnionId(identification);
                     userInfo.setIsVip(0);
@@ -129,8 +129,6 @@ public class UserDetailsServiceImpl implements UserDetailsService
                     return createLoginUser(userService.getStudentByUnionId(identification));
                 }else {
                     UserInfo userInfo = userInfoGetByUnionId ;
-                    //userInfo.setHeadImage((String) ServletUtils.getRequest().getAttribute("headImage"));
-                    //userInfo.setNickName((String) ServletUtils.getRequest().getAttribute("nickName"));
                     userInfo.setXcxOpenid(openid);
                     userService.updateStudent(userInfo);
                     return createLoginUser(userService.getStudentByUnionId(identification));

+ 4 - 8
nbjk-service/src/main/java/com/miaxis/exam/domain/ExamInfo.java

@@ -1,16 +1,12 @@
 package com.miaxis.exam.domain;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.miaxis.common.annotation.Excel;
-import com.miaxis.common.core.domain.BaseEntity;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
+import com.miaxis.common.annotation.Excel;
 import com.miaxis.common.core.domain.BaseBusinessEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 /**
  * 考场信息对象 exam_info

+ 149 - 0
nbjk-service/src/main/java/com/miaxis/three/domain/ThreeForce.java

@@ -0,0 +1,149 @@
+package com.miaxis.three.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+/**
+ * 三力测试对象 three_force
+ *
+ * @author miaxis
+ * @date 2023-04-03
+ */
+@Data
+@TableName("three_force")
+@ApiModel(value = "ThreeForce", description = "三力测试对象 three_force")
+public class ThreeForce {
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    @TableField("Type")
+    @ApiModelProperty(value = "类型 1选择 2判断 3多选")
+    private Long type;
+
+    @TableField("intNumber")
+    @ApiModelProperty(value = "章节_int")
+    private String intnumber;
+
+    @TableField("strTppe")
+    @ApiModelProperty(value = "大章节ID")
+    private String strtppe;
+
+    @TableField("strType_l")
+    @ApiModelProperty(value = "小章节ID")
+    private String strtypeL;
+
+    @TableField("LicenseType")
+    @ApiModelProperty(value = "许可证类型-车型")
+    private String licensetype;
+
+    @TableField("Question")
+    @ApiModelProperty(value = "题目")
+    private String question;
+
+    @TableField("An1")
+    @ApiModelProperty(value = "答案1")
+    private String an1;
+
+    @TableField("An2")
+    @ApiModelProperty(value = "答案2")
+    private String an2;
+
+    @TableField("An3")
+    @ApiModelProperty(value = "答案3")
+    private String an3;
+
+    @TableField("An4")
+    @ApiModelProperty(value = "答案4")
+    private String an4;
+
+    @TableField("An5")
+    @ApiModelProperty(value = "答案5")
+    private String an5;
+
+    @TableField("An6")
+    @ApiModelProperty(value = "答案6")
+    private String an6;
+
+    @TableField("An7")
+    @ApiModelProperty(value = "答案7")
+    private String an7;
+
+    @TableField("AnswerTrue")
+    @ApiModelProperty(value = "正确答案")
+    private String answertrue;
+
+    @TableField("explain")
+    @ApiModelProperty(value = "解释")
+    private String explain;
+
+    @TableField("BestAnswerId")
+    @ApiModelProperty(value = "答案ID")
+    private String bestanswerid;
+
+    @TableField("kemu")
+    @ApiModelProperty(value = "科目")
+    private Long kemu;
+
+    @TableField("jieshi_from")
+    @ApiModelProperty(value = "解释from")
+    private String jieshiFrom;
+
+    @TableField("moretypes")
+    @ApiModelProperty(value = "更多类型")
+    private String moretypes;
+
+    @TableField("chapterid")
+    @ApiModelProperty(value = "章节ID")
+    private Long chapterid;
+
+    @TableField("sinaimg")
+    @ApiModelProperty(value = "图片名称")
+    private String sinaimg;
+
+    @TableField("video_url")
+    @ApiModelProperty(value = "视频URL")
+    private String videoUrl;
+
+    @TableField("diff_degree")
+    @ApiModelProperty(value = "难度")
+    private Long diffDegree;
+
+    @TableField("cityid")
+    @ApiModelProperty(value = "城市ID")
+    private Long cityid;
+
+    @TableField("gs")
+    @ApiModelProperty(value = "车型")
+    private String gs;
+
+    @TableField("keyword")
+    @ApiModelProperty(value = "关键词")
+    private String keyword;
+
+    @TableField("error_rate")
+    @ApiModelProperty(value = "错误率")
+    private Long errorRate;
+
+    @TableField("media_url")
+    @ApiModelProperty(value = "媒体URL(图片)")
+    private String mediaUrl;
+
+    @TableField("show_option_type")
+    @ApiModelProperty(value = "未知")
+    private Long showOptionType;
+
+    @TableField("question_source")
+    @ApiModelProperty(value = "问题源")
+    private Long questionSource;
+
+    @TableField("best_explain_new")
+    @ApiModelProperty(value = "格式化后解释(HTML代码)")
+    private String bestExplainNew;
+
+}

+ 24 - 0
nbjk-service/src/main/java/com/miaxis/three/mapper/ThreeForceMapper.java

@@ -0,0 +1,24 @@
+package com.miaxis.three.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.question.domain.QuestionInfo;
+import com.miaxis.three.domain.ThreeForce;
+
+/**
+ * 三力测试Mapper接口
+ *
+ * @author miaxis
+ * @date 2023-04-03
+ */
+public interface ThreeForceMapper extends BaseMapper<ThreeForce> {
+    /**
+     * 查询三力测试列表
+     *
+     * @param threeForce 三力测试
+     * @return 三力测试集合
+     */
+    public List<ThreeForce> selectThreeForceList(ThreeForce threeForce);
+
+    List<ThreeForce> selectTestQuestionInfoList(String sql);
+}

+ 25 - 0
nbjk-service/src/main/java/com/miaxis/three/service/IThreeForceService.java

@@ -0,0 +1,25 @@
+package com.miaxis.three.service;
+
+import java.util.List;
+
+import com.miaxis.question.domain.QuestionInfo;
+import com.miaxis.three.domain.ThreeForce;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 三力测试Service接口
+ *
+ * @author miaxis
+ * @date 2023-04-03
+ */
+public interface IThreeForceService extends IService<ThreeForce>{
+    /**
+     * 查询三力测试列表
+     *
+     * @param threeForce 三力测试
+     * @return 三力测试集合
+     */
+    public List<ThreeForce> selectThreeForceList(ThreeForce threeForce);
+
+    List<ThreeForce> selectTestQuestionInfoList();
+}

+ 76 - 0
nbjk-service/src/main/java/com/miaxis/three/service/impl/ThreeForceServiceImpl.java

@@ -0,0 +1,76 @@
+package com.miaxis.three.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.question.domain.QuestionInfo;
+import com.miaxis.question.domain.TAppExamRule;
+import com.miaxis.question.service.ITAppExamRuleService;
+import com.miaxis.three.domain.ThreeForce;
+import com.miaxis.three.mapper.ThreeForceMapper;
+import com.miaxis.three.service.IThreeForceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * 三力测试Service业务层处理
+ *
+ * @author miaxis
+ * @date 2023-04-03
+ */
+@Service
+public class ThreeForceServiceImpl extends ServiceImpl<ThreeForceMapper, ThreeForce> implements IThreeForceService {
+    @Autowired
+    private ThreeForceMapper threeForceMapper;
+
+    @Autowired
+    private ITAppExamRuleService appExamRuleService;
+
+    /**
+     * 查询三力测试列表
+     *
+     * @param threeForce 三力测试
+     * @return 三力测试
+     */
+    @Override
+    public List<ThreeForce> selectThreeForceList(ThreeForce threeForce) {
+        return threeForceMapper.selectThreeForceList(threeForce);
+    }
+
+    @Override
+    public List<ThreeForce> selectTestQuestionInfoList() {
+
+        List<ThreeForce> allList = new ArrayList<ThreeForce>();
+        TAppExamRule tAppExamRule = new TAppExamRule();
+        tAppExamRule.setGs("test");
+        tAppExamRule.setAreacode(0);
+
+        List<TAppExamRule> list = appExamRuleService.selectTAppExamRuleList(tAppExamRule);
+        if (list.size() == 0) {
+            return allList;
+        }
+        StringBuffer sql = new StringBuffer();
+        sql.append("SELECT * FROM (");
+        TAppExamRule er = list.get(0);
+        int easyJudge = er.getJudgeCount(); //判断
+        int easyChoice = er.getChoiceCount(); //选择
+        int total = +easyJudge + easyChoice; //总题数
+        //判断题
+        sql.append(" (SELECT * FROM three_force WHERE Type=1  ORDER BY RAND() LIMIT " + easyJudge + ") ");
+        sql.append(" union ");
+        //选择题
+        sql.append(" (SELECT * FROM three_force WHERE Type=2 ORDER BY RAND() LIMIT " + easyChoice + ") ");
+        sql.append(" ) as db");
+        System.out.println(sql.toString());
+        allList = threeForceMapper.selectTestQuestionInfoList(sql.toString());
+        if (allList.size() == total) {
+            return allList;
+        } else {
+            new CustomException("模拟考试取题出错,请重试。");
+            return null;
+        }
+    }
+}

+ 88 - 0
nbjk-service/src/main/resources/mapper/three/ThreeForceMapper.xml

@@ -0,0 +1,88 @@
+<?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.miaxis.three.mapper.ThreeForceMapper">
+
+    <resultMap type="ThreeForce" id="ThreeForceResult">
+        <result property="id"    column="ID"    />
+        <result property="type"    column="Type"    />
+        <result property="intnumber"    column="intNumber"    />
+        <result property="strtppe"    column="strTppe"    />
+        <result property="strtypeL"    column="strType_l"    />
+        <result property="licensetype"    column="LicenseType"    />
+        <result property="question"    column="Question"    />
+        <result property="an1"    column="An1"    />
+        <result property="an2"    column="An2"    />
+        <result property="an3"    column="An3"    />
+        <result property="an4"    column="An4"    />
+        <result property="an5"    column="An5"    />
+        <result property="an6"    column="An6"    />
+        <result property="an7"    column="An7"    />
+        <result property="answertrue"    column="AnswerTrue"    />
+        <result property="explain"    column="explain"    />
+        <result property="bestanswerid"    column="BestAnswerId"    />
+        <result property="kemu"    column="kemu"    />
+        <result property="jieshiFrom"    column="jieshi_from"    />
+        <result property="moretypes"    column="moretypes"    />
+        <result property="chapterid"    column="chapterid"    />
+        <result property="sinaimg"    column="sinaimg"    />
+        <result property="videoUrl"    column="video_url"    />
+        <result property="diffDegree"    column="diff_degree"    />
+        <result property="cityid"    column="cityid"    />
+        <result property="gs"    column="gs"    />
+        <result property="keyword"    column="keyword"    />
+        <result property="errorRate"    column="error_rate"    />
+        <result property="mediaUrl"    column="media_url"    />
+        <result property="showOptionType"    column="show_option_type"    />
+        <result property="questionSource"    column="question_source"    />
+        <result property="bestExplainNew"    column="best_explain_new"    />
+    </resultMap>
+
+    <sql id="selectThreeForceVo">
+        select * from three_force
+    </sql>
+
+    <select id="selectThreeForceList" parameterType="ThreeForce" resultMap="ThreeForceResult">
+        <include refid="selectThreeForceVo"/>
+        <where>
+            <if test="id != null "> and ID = #{id}</if>
+            <if test="type != null "> and Type = #{type}</if>
+            <if test="intnumber != null  and intnumber != ''"> and intNumber = #{intnumber}</if>
+            <if test="strtppe != null  and strtppe != ''"> and strTppe = #{strtppe}</if>
+            <if test="strtypeL != null  and strtypeL != ''"> and strType_l = #{strtypeL}</if>
+            <if test="licensetype != null  and licensetype != ''"> and LicenseType = #{licensetype}</if>
+            <if test="question != null  and question != ''"> and Question = #{question}</if>
+            <if test="an1 != null  and an1 != ''"> and An1 = #{an1}</if>
+            <if test="an2 != null  and an2 != ''"> and An2 = #{an2}</if>
+            <if test="an3 != null  and an3 != ''"> and An3 = #{an3}</if>
+            <if test="an4 != null  and an4 != ''"> and An4 = #{an4}</if>
+            <if test="an5 != null  and an5 != ''"> and An5 = #{an5}</if>
+            <if test="an6 != null  and an6 != ''"> and An6 = #{an6}</if>
+            <if test="an7 != null  and an7 != ''"> and An7 = #{an7}</if>
+            <if test="answertrue != null  and answertrue != ''"> and AnswerTrue = #{answertrue}</if>
+            <if test="explain != null  and explain != ''"> and explain = #{explain}</if>
+            <if test="bestanswerid != null  and bestanswerid != ''"> and BestAnswerId = #{bestanswerid}</if>
+            <if test="kemu != null "> and kemu = #{kemu}</if>
+            <if test="jieshiFrom != null  and jieshiFrom != ''"> and jieshi_from = #{jieshiFrom}</if>
+            <if test="moretypes != null  and moretypes != ''"> and moretypes = #{moretypes}</if>
+            <if test="chapterid != null "> and chapterid = #{chapterid}</if>
+            <if test="sinaimg != null  and sinaimg != ''"> and sinaimg = #{sinaimg}</if>
+            <if test="videoUrl != null  and videoUrl != ''"> and video_url = #{videoUrl}</if>
+            <if test="diffDegree != null "> and diff_degree = #{diffDegree}</if>
+            <if test="cityid != null "> and cityid = #{cityid}</if>
+            <if test="gs != null  and gs != ''"> and gs = #{gs}</if>
+            <if test="keyword != null  and keyword != ''"> and keyword = #{keyword}</if>
+            <if test="errorRate != null "> and error_rate = #{errorRate}</if>
+            <if test="mediaUrl != null  and mediaUrl != ''"> and media_url = #{mediaUrl}</if>
+            <if test="showOptionType != null "> and show_option_type = #{showOptionType}</if>
+            <if test="questionSource != null "> and question_source = #{questionSource}</if>
+            <if test="bestExplainNew != null  and bestExplainNew != ''"> and best_explain_new = #{bestExplainNew}</if>
+        </where>
+    </select>
+
+    <select id="selectTestQuestionInfoList" resultType="com.miaxis.three.domain.ThreeForce">
+        ${sql}
+    </select>
+
+</mapper>