瀏覽代碼

添加 sim_real_exam 相关。

tom 5 月之前
父節點
當前提交
49c900b3ba

+ 98 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/RealExamController.java

@@ -0,0 +1,98 @@
+package com.ruoyi.sim.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.sim.domain.RealExam;
+import com.ruoyi.sim.service.IRealExamService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 考试Controller
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+@RestController
+@RequestMapping("/sim/real-exam")
+public class RealExamController extends BaseController {
+    @Autowired
+    private IRealExamService realExamService;
+
+    /**
+     * 查询考试列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(RealExam realExam) {
+        startPage();
+        List<RealExam> list = realExamService.selectRealExamList(realExam);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出考试列表
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam:export')")
+    @Log(title = "考试", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, RealExam realExam) {
+        List<RealExam> list = realExamService.selectRealExamList(realExam);
+        ExcelUtil<RealExam> util = new ExcelUtil<RealExam>(RealExam.class);
+        util.exportExcel(response, list, "考试数据");
+    }
+
+    /**
+     * 获取考试详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam:query')")
+    @GetMapping(value = "/{examId}")
+    public AjaxResult getInfo(@PathVariable("examId") Long examId) {
+        return success(realExamService.selectRealExamByExamId(examId));
+    }
+
+    /**
+     * 新增考试
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam:add')")
+    @Log(title = "考试", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody RealExam realExam) {
+        return toAjax(realExamService.insertRealExam(realExam));
+    }
+
+    /**
+     * 修改考试
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam:edit')")
+    @Log(title = "考试", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody RealExam realExam) {
+        return toAjax(realExamService.updateRealExam(realExam));
+    }
+
+    /**
+     * 删除考试
+     */
+    @PreAuthorize("@ss.hasPermi('sim:real-exam:remove')")
+    @Log(title = "考试", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{examIds}")
+    public AjaxResult remove(@PathVariable Long[] examIds) {
+        return toAjax(realExamService.deleteRealExamByExamIds(examIds));
+    }
+}

+ 222 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/RealExam.java

@@ -0,0 +1,222 @@
+package com.ruoyi.sim.domain;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 考试对象 sim_real_exam
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+public class RealExam extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 考试ID
+     */
+    private Long examId;
+
+    /**
+     * 考试集合ID
+     */
+    @Excel(name = "考试集合ID")
+    private Long examCollectionId;
+
+    /**
+     * 学员ID/用户ID
+     */
+    @Excel(name = "学员ID/用户ID")
+    private Long userId;
+
+    /**
+     * 座ID
+     */
+    @Excel(name = "座ID")
+    private Long seatId;
+
+    /**
+     * 模拟器ID
+     */
+    @Excel(name = "模拟器ID")
+    private Long simId;
+
+    /**
+     * 考试状态
+     * 0:未登录
+     * 1:已登录
+     * 2:模拟器检查并下发ok
+     * 3:答题中
+     * 4:已交卷
+     * 5:获取模拟成绩分析
+     * 80:教师标记缺考
+     * 81:登录未开始答题
+     * 90:模拟器异常结束
+     */
+    @Excel(name = "考试状态")
+    private String examStatus;
+
+    /**
+     * 总分:累加扣分和计算出总分
+     */
+    @Excel(name = "总分:累加扣分和计算出总分")
+    private Integer totalScore;
+
+    /**
+     * 扣分总计,不计超时扣分
+     */
+    @Excel(name = "扣分总计,不计超时扣分")
+    private Integer deductionTotalScore;
+
+    /**
+     * 考试实际开始时间(毫秒)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "考试实际开始时间(毫秒)", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date startTime;
+
+    /**
+     * 考试实际结束时间(毫秒)
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "考试实际结束时间(毫秒)", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date endTime;
+
+    /**
+     * 登录时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "登录时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date loginTime;
+
+    /**
+     * 登出时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "登出时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date logoutTime;
+
+    public void setExamId(Long examId) {
+        this.examId = examId;
+    }
+
+    public Long getExamId() {
+        return examId;
+    }
+
+    public void setExamCollectionId(Long examCollectionId) {
+        this.examCollectionId = examCollectionId;
+    }
+
+    public Long getExamCollectionId() {
+        return examCollectionId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setSeatId(Long seatId) {
+        this.seatId = seatId;
+    }
+
+    public Long getSeatId() {
+        return seatId;
+    }
+
+    public void setSimId(Long simId) {
+        this.simId = simId;
+    }
+
+    public Long getSimId() {
+        return simId;
+    }
+
+    public void setExamStatus(String examStatus) {
+        this.examStatus = examStatus;
+    }
+
+    public String getExamStatus() {
+        return examStatus;
+    }
+
+    public void setTotalScore(Integer totalScore) {
+        this.totalScore = totalScore;
+    }
+
+    public Integer getTotalScore() {
+        return totalScore;
+    }
+
+    public void setDeductionTotalScore(Integer deductionTotalScore) {
+        this.deductionTotalScore = deductionTotalScore;
+    }
+
+    public Integer getDeductionTotalScore() {
+        return deductionTotalScore;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setLoginTime(Date loginTime) {
+        this.loginTime = loginTime;
+    }
+
+    public Date getLoginTime() {
+        return loginTime;
+    }
+
+    public void setLogoutTime(Date logoutTime) {
+        this.logoutTime = logoutTime;
+    }
+
+    public Date getLogoutTime() {
+        return logoutTime;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("examId", getExamId())
+                .append("examCollectionId", getExamCollectionId())
+                .append("userId", getUserId())
+                .append("seatId", getSeatId())
+                .append("simId", getSimId())
+                .append("examStatus", getExamStatus())
+                .append("totalScore", getTotalScore())
+                .append("deductionTotalScore", getDeductionTotalScore())
+                .append("startTime", getStartTime())
+                .append("endTime", getEndTime())
+                .append("loginTime", getLoginTime())
+                .append("logoutTime", getLogoutTime())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .toString();
+    }
+}

+ 61 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/mapper/RealExamMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.mapper;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.RealExam;
+
+/**
+ * 考试Mapper接口
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+public interface RealExamMapper {
+    /**
+     * 查询考试
+     *
+     * @param examId 考试主键
+     * @return 考试
+     */
+    public RealExam selectRealExamByExamId(Long examId);
+
+    /**
+     * 查询考试列表
+     *
+     * @param realExam 考试
+     * @return 考试集合
+     */
+    public List<RealExam> selectRealExamList(RealExam realExam);
+
+    /**
+     * 新增考试
+     *
+     * @param realExam 考试
+     * @return 结果
+     */
+    public int insertRealExam(RealExam realExam);
+
+    /**
+     * 修改考试
+     *
+     * @param realExam 考试
+     * @return 结果
+     */
+    public int updateRealExam(RealExam realExam);
+
+    /**
+     * 删除考试
+     *
+     * @param examId 考试主键
+     * @return 结果
+     */
+    public int deleteRealExamByExamId(Long examId);
+
+    /**
+     * 批量删除考试
+     *
+     * @param examIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteRealExamByExamIds(Long[] examIds);
+}

+ 61 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/IRealExamService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.sim.service;
+
+import java.util.List;
+
+import com.ruoyi.sim.domain.RealExam;
+
+/**
+ * 考试Service接口
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+public interface IRealExamService {
+    /**
+     * 查询考试
+     *
+     * @param examId 考试主键
+     * @return 考试
+     */
+    public RealExam selectRealExamByExamId(Long examId);
+
+    /**
+     * 查询考试列表
+     *
+     * @param realExam 考试
+     * @return 考试集合
+     */
+    public List<RealExam> selectRealExamList(RealExam realExam);
+
+    /**
+     * 新增考试
+     *
+     * @param realExam 考试
+     * @return 结果
+     */
+    public int insertRealExam(RealExam realExam);
+
+    /**
+     * 修改考试
+     *
+     * @param realExam 考试
+     * @return 结果
+     */
+    public int updateRealExam(RealExam realExam);
+
+    /**
+     * 批量删除考试
+     *
+     * @param examIds 需要删除的考试主键集合
+     * @return 结果
+     */
+    public int deleteRealExamByExamIds(Long[] examIds);
+
+    /**
+     * 删除考试信息
+     *
+     * @param examId 考试主键
+     * @return 结果
+     */
+    public int deleteRealExamByExamId(Long examId);
+}

+ 90 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/RealExamServiceImpl.java

@@ -0,0 +1,90 @@
+package com.ruoyi.sim.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.sim.mapper.RealExamMapper;
+import com.ruoyi.sim.domain.RealExam;
+import com.ruoyi.sim.service.IRealExamService;
+
+/**
+ * 考试Service业务层处理
+ *
+ * @author tom
+ * @date 2024-12-15
+ */
+@Service
+public class RealExamServiceImpl implements IRealExamService {
+    @Autowired
+    private RealExamMapper realExamMapper;
+
+    /**
+     * 查询考试
+     *
+     * @param examId 考试主键
+     * @return 考试
+     */
+    @Override
+    public RealExam selectRealExamByExamId(Long examId) {
+        return realExamMapper.selectRealExamByExamId(examId);
+    }
+
+    /**
+     * 查询考试列表
+     *
+     * @param realExam 考试
+     * @return 考试
+     */
+    @Override
+    public List<RealExam> selectRealExamList(RealExam realExam) {
+        return realExamMapper.selectRealExamList(realExam);
+    }
+
+    /**
+     * 新增考试
+     *
+     * @param realExam 考试
+     * @return 结果
+     */
+    @Override
+    public int insertRealExam(RealExam realExam) {
+        realExam.setCreateTime(DateUtils.getNowDate());
+        return realExamMapper.insertRealExam(realExam);
+    }
+
+    /**
+     * 修改考试
+     *
+     * @param realExam 考试
+     * @return 结果
+     */
+    @Override
+    public int updateRealExam(RealExam realExam) {
+        realExam.setUpdateTime(DateUtils.getNowDate());
+        return realExamMapper.updateRealExam(realExam);
+    }
+
+    /**
+     * 批量删除考试
+     *
+     * @param examIds 需要删除的考试主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRealExamByExamIds(Long[] examIds) {
+        return realExamMapper.deleteRealExamByExamIds(examIds);
+    }
+
+    /**
+     * 删除考试信息
+     *
+     * @param examId 考试主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRealExamByExamId(Long examId) {
+        return realExamMapper.deleteRealExamByExamId(examId);
+    }
+}

+ 147 - 0
ruoyi-sim/src/main/resources/mapper/sim/RealExamMapper.xml

@@ -0,0 +1,147 @@
+<?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.sim.mapper.RealExamMapper">
+
+    <resultMap type="RealExam" id="RealExamResult">
+        <result property="examId" column="exam_id"/>
+        <result property="examCollectionId" column="exam_collection_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="seatId" column="seat_id"/>
+        <result property="simId" column="sim_id"/>
+        <result property="examStatus" column="exam_status"/>
+        <result property="totalScore" column="total_score"/>
+        <result property="deductionTotalScore" column="deduction_total_score"/>
+        <result property="startTime" column="start_time"/>
+        <result property="endTime" column="end_time"/>
+        <result property="loginTime" column="login_time"/>
+        <result property="logoutTime" column="logout_time"/>
+        <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>
+
+    <sql id="selectRealExamVo">
+        select exam_id,
+               exam_collection_id,
+               user_id,
+               seat_id,
+               sim_id,
+               exam_status,
+               total_score,
+               deduction_total_score,
+               start_time,
+               end_time,
+               login_time,
+               logout_time,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
+        from sim_real_exam
+    </sql>
+
+    <select id="selectRealExamList" parameterType="RealExam" resultMap="RealExamResult">
+        <include refid="selectRealExamVo"/>
+        <where>
+            <if test="examCollectionId != null ">and exam_collection_id = #{examCollectionId}</if>
+            <if test="userId != null ">and user_id = #{userId}</if>
+            <if test="seatId != null ">and seat_id = #{seatId}</if>
+            <if test="simId != null ">and sim_id = #{simId}</if>
+            <if test="examStatus != null  and examStatus != ''">and exam_status = #{examStatus}</if>
+            <if test="totalScore != null ">and total_score = #{totalScore}</if>
+            <if test="deductionTotalScore != null ">and deduction_total_score = #{deductionTotalScore}</if>
+            <if test="startTime != null ">and start_time = #{startTime}</if>
+            <if test="endTime != null ">and end_time = #{endTime}</if>
+            <if test="loginTime != null ">and login_time = #{loginTime}</if>
+            <if test="logoutTime != null ">and logout_time = #{logoutTime}</if>
+        </where>
+    </select>
+
+    <select id="selectRealExamByExamId" parameterType="Long" resultMap="RealExamResult">
+        <include refid="selectRealExamVo"/>
+        where exam_id = #{examId}
+    </select>
+
+    <insert id="insertRealExam" parameterType="RealExam">
+        insert into sim_real_exam
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="examId != null">exam_id,</if>
+            <if test="examCollectionId != null">exam_collection_id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="seatId != null">seat_id,</if>
+            <if test="simId != null">sim_id,</if>
+            <if test="examStatus != null">exam_status,</if>
+            <if test="totalScore != null">total_score,</if>
+            <if test="deductionTotalScore != null">deduction_total_score,</if>
+            <if test="startTime != null">start_time,</if>
+            <if test="endTime != null">end_time,</if>
+            <if test="loginTime != null">login_time,</if>
+            <if test="logoutTime != null">logout_time,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="examId != null">#{examId},</if>
+            <if test="examCollectionId != null">#{examCollectionId},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="seatId != null">#{seatId},</if>
+            <if test="simId != null">#{simId},</if>
+            <if test="examStatus != null">#{examStatus},</if>
+            <if test="totalScore != null">#{totalScore},</if>
+            <if test="deductionTotalScore != null">#{deductionTotalScore},</if>
+            <if test="startTime != null">#{startTime},</if>
+            <if test="endTime != null">#{endTime},</if>
+            <if test="loginTime != null">#{loginTime},</if>
+            <if test="logoutTime != null">#{logoutTime},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+        </trim>
+    </insert>
+
+    <update id="updateRealExam" parameterType="RealExam">
+        update sim_real_exam
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="examCollectionId != null">exam_collection_id = #{examCollectionId},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="seatId != null">seat_id = #{seatId},</if>
+            <if test="simId != null">sim_id = #{simId},</if>
+            <if test="examStatus != null">exam_status = #{examStatus},</if>
+            <if test="totalScore != null">total_score = #{totalScore},</if>
+            <if test="deductionTotalScore != null">deduction_total_score = #{deductionTotalScore},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="endTime != null">end_time = #{endTime},</if>
+            <if test="loginTime != null">login_time = #{loginTime},</if>
+            <if test="logoutTime != null">logout_time = #{logoutTime},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where exam_id = #{examId}
+    </update>
+
+    <delete id="deleteRealExamByExamId" parameterType="Long">
+        delete
+        from sim_real_exam
+        where exam_id = #{examId}
+    </delete>
+
+    <delete id="deleteRealExamByExamIds" parameterType="String">
+        delete from sim_real_exam where exam_id in
+        <foreach item="examId" collection="array" open="(" separator="," close=")">
+            #{examId}
+        </foreach>
+    </delete>
+</mapper>