Browse Source

考试科目修改

wangliang 4 years ago
parent
commit
8eba3dc823

+ 2 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamCourseController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.themis.business.base.BasePage;
 import com.qmth.themis.business.base.BasePage;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dto.response.TEExamCourseDto;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.enums.FieldUniqueEnum;
 import com.qmth.themis.business.enums.FieldUniqueEnum;
 import com.qmth.themis.business.service.TEExamCourseService;
 import com.qmth.themis.business.service.TEExamCourseService;
@@ -74,7 +75,7 @@ public class TEExamCourseController {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
         }
-        IPage<TEExamCourse> examCourseIPage = teExamCourseService.examCourseQuery(new Page<>(pageNumber, pageSize), examId, courseCode, courseName, hasPaper);
+        IPage<TEExamCourseDto> examCourseIPage = teExamCourseService.examCourseQuery(new Page<>(pageNumber, pageSize), examId, courseCode, courseName, hasPaper);
         BasePage basePage = new BasePage(examCourseIPage.getRecords(), examCourseIPage.getCurrent(), examCourseIPage.getSize(), examCourseIPage.getTotal());
         BasePage basePage = new BasePage(examCourseIPage.getRecords(), examCourseIPage.getCurrent(), examCourseIPage.getSize(), examCourseIPage.getTotal());
         Map map = new HashMap<>();
         Map map = new HashMap<>();
         map.put(SystemConstant.RECORDS, basePage);
         map.put(SystemConstant.RECORDS, basePage);

+ 2 - 1
themis-backend/src/main/java/com/qmth/themis/backend/websocket/WebSocketAdminServer.java

@@ -107,7 +107,8 @@ public class WebSocketAdminServer implements Concurrently {
                     log.info("用户连接:" + this.sessionId + ",当前在线人数为:" + getOnlineCount());
                     log.info("用户连接:" + this.sessionId + ",当前在线人数为:" + getOnlineCount());
                     InetSocketAddress addr = (InetSocketAddress) WebsocketUtil.getFieldInstance(this.session.getAsyncRemote(), "base#socketWrapper#socket#sc#remoteAddress");
                     InetSocketAddress addr = (InetSocketAddress) WebsocketUtil.getFieldInstance(this.session.getAsyncRemote(), "base#socketWrapper#socket#sc#remoteAddress");
                     this.ip = addr.toString().replace("/", "").split(":")[0];
                     this.ip = addr.toString().replace("/", "").split(":")[0];
-                    this.sendMessage("ip[" + this.ip + "]连接成功");
+//                    this.sendMessage("ip[" + this.ip + "]连接成功");
+                    log.info("ip[:{}]连接成功", this.ip);
                     tranMap = new HashMap<>();
                     tranMap = new HashMap<>();
                     tranMap.put("deviceId", this.deviceId);
                     tranMap.put("deviceId", this.deviceId);
                     tranMap.put("ip", this.ip);
                     tranMap.put("ip", this.ip);

+ 2 - 1
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamCourseMapper.java

@@ -2,6 +2,7 @@ package com.qmth.themis.business.dao;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.themis.business.dto.response.TEExamCourseDto;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.entity.TEExamCourse;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
@@ -28,7 +29,7 @@ public interface TEExamCourseMapper extends BaseMapper<TEExamCourse> {
      * @param hasPaper
      * @param hasPaper
      * @return
      * @return
      */
      */
-    public IPage<TEExamCourse> examCourseQuery(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("courseName") String courseName, @Param("hasPaper") Integer hasPaper);
+    public IPage<TEExamCourseDto> examCourseQuery(IPage<Map> iPage, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("courseName") String courseName, @Param("hasPaper") Integer hasPaper);
 
 
     public TEExamCourse findByExamIdAndCourseCode(@Param("examId") Long examId,@Param("courseCode") String courseCode);
     public TEExamCourse findByExamIdAndCourseCode(@Param("examId") Long examId,@Param("courseCode") String courseCode);
 }
 }

+ 104 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/response/TEExamCourseDto.java

@@ -0,0 +1,104 @@
+package com.qmth.themis.business.dto.response;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 科目dto
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2020/8/19
+ */
+public class TEExamCourseDto implements Serializable {
+
+    private Long id;//id
+    private String courseCode;//科目代码
+    private String courseName;//科目名称
+    private Integer objectiveShuffle;//是否开启客观题乱序,0:不开启,1:开启
+    private Integer optionShuffle;//是否选项乱序,针对一个科目进行设置,0:不开启,1:开启
+    private Integer paperCount;//已绑定试卷数量
+    private Integer hasAnswer;//是否已补齐标答,0:否,1:是
+    private Integer audioPlayCount;//音频播放次数
+    private Integer hasAudio;//题干包含音频,0:不包含,1:包含
+    private Integer hasPaper;//是否绑定试卷,0:没绑定,1:绑定
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCourseCode() {
+        return courseCode;
+    }
+
+    public void setCourseCode(String courseCode) {
+        this.courseCode = courseCode;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public Integer getObjectiveShuffle() {
+        return objectiveShuffle;
+    }
+
+    public void setObjectiveShuffle(Integer objectiveShuffle) {
+        this.objectiveShuffle = objectiveShuffle;
+    }
+
+    public Integer getOptionShuffle() {
+        return optionShuffle;
+    }
+
+    public void setOptionShuffle(Integer optionShuffle) {
+        this.optionShuffle = optionShuffle;
+    }
+
+    public Integer getPaperCount() {
+        return paperCount;
+    }
+
+    public void setPaperCount(Integer paperCount) {
+        this.paperCount = paperCount;
+    }
+
+    public Integer getHasAnswer() {
+        return hasAnswer;
+    }
+
+    public void setHasAnswer(Integer hasAnswer) {
+        this.hasAnswer = hasAnswer;
+    }
+
+    public Integer getAudioPlayCount() {
+        return audioPlayCount;
+    }
+
+    public void setAudioPlayCount(Integer audioPlayCount) {
+        this.audioPlayCount = audioPlayCount;
+    }
+
+    public Integer getHasAudio() {
+        return hasAudio;
+    }
+
+    public void setHasAudio(Integer hasAudio) {
+        this.hasAudio = hasAudio;
+    }
+
+    public Integer getHasPaper() {
+        return hasPaper;
+    }
+
+    public void setHasPaper(Integer hasPaper) {
+        this.hasPaper = hasPaper;
+    }
+}

+ 2 - 1
themis-business/src/main/java/com/qmth/themis/business/service/TEExamCourseService.java

@@ -3,6 +3,7 @@ package com.qmth.themis.business.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
+import com.qmth.themis.business.dto.response.TEExamCourseDto;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.entity.TEExamCourse;
 
 
 import java.util.Map;
 import java.util.Map;
@@ -26,7 +27,7 @@ public interface TEExamCourseService extends IService<TEExamCourse> {
      * @param hasPaper
      * @param hasPaper
      * @return
      * @return
      */
      */
-    public IPage<TEExamCourse> examCourseQuery(IPage<Map> iPage, Long examId, String courseCode, String courseName, Integer hasPaper);
+    public IPage<TEExamCourseDto> examCourseQuery(IPage<Map> iPage, Long examId, String courseCode, String courseName, Integer hasPaper);
 
 
 
 
     ExamCourseCacheBean getExamCourseCacheBean(Long examId, String courseCode);
     ExamCourseCacheBean getExamCourseCacheBean(Long examId, String courseCode);

+ 3 - 2
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamCourseServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
 import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
 import com.qmth.themis.business.dao.TEExamCourseMapper;
 import com.qmth.themis.business.dao.TEExamCourseMapper;
 import com.qmth.themis.business.dao.TEExamPaperMapper;
 import com.qmth.themis.business.dao.TEExamPaperMapper;
+import com.qmth.themis.business.dto.response.TEExamCourseDto;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.entity.TEExamCourse;
 import com.qmth.themis.business.entity.TEExamPaper;
 import com.qmth.themis.business.entity.TEExamPaper;
 import com.qmth.themis.business.service.TEExamCourseService;
 import com.qmth.themis.business.service.TEExamCourseService;
@@ -48,8 +49,8 @@ public class TEExamCourseServiceImpl extends ServiceImpl<TEExamCourseMapper, TEE
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public IPage<TEExamCourse> examCourseQuery(IPage<Map> iPage, Long examId, String courseCode, String courseName,
-                                               Integer hasPaper) {
+    public IPage<TEExamCourseDto> examCourseQuery(IPage<Map> iPage, Long examId, String courseCode, String courseName,
+                                                  Integer hasPaper) {
         return teExamCourseMapper.examCourseQuery(iPage, examId, courseCode, courseName, hasPaper);
         return teExamCourseMapper.examCourseQuery(iPage, examId, courseCode, courseName, hasPaper);
     }
     }
 
 

+ 14 - 5
themis-business/src/main/resources/mapper/TEExamCourseMapper.xml

@@ -3,9 +3,19 @@
 <mapper
 <mapper
 	namespace="com.qmth.themis.business.dao.TEExamCourseMapper">
 	namespace="com.qmth.themis.business.dao.TEExamCourseMapper">
 
 
-	<select id="examCourseQuery"
-		resultType="com.qmth.themis.business.entity.TEExamCourse">
-		select * from t_e_exam_course teec
+	<select id="examCourseQuery" resultType="com.qmth.themis.business.dto.response.TEExamCourseDto">
+		select
+			teec.course_code as courseCode,
+			teec.course_name as courseName,
+			teec.paper_count as paperCount,
+			if(teec.paper_count > 0,1,0) as hasPaper,
+			teec.objective_shuffle as objectiveShuffle,
+			teec.option_shuffle as optionShuffle,
+			teec.audio_play_count as audioPlayCount,
+			teec.has_answer as hasAnswer,
+			teec.has_audio as hasAudio
+			from
+			t_e_exam_course teec
 		left join t_e_exam tee on teec.exam_id = tee.id
 		left join t_e_exam tee on teec.exam_id = tee.id
 		<where>
 		<where>
 			<if test="examId != null and examId != ''">
 			<if test="examId != null and examId != ''">
@@ -23,8 +33,7 @@
 						and (teec.paper_count = #{hasPaper} or teec.paper_count is null)
 						and (teec.paper_count = #{hasPaper} or teec.paper_count is null)
 					</when>
 					</when>
 					<otherwise>
 					<otherwise>
-						and teec.paper_count <![CDATA[ > ]]>
-						0
+						and teec.paper_count <![CDATA[ > ]]> 0
 					</otherwise>
 					</otherwise>
 				</choose>
 				</choose>
 			</if>
 			</if>

+ 2 - 1
themis-exam/src/main/java/com/qmth/themis/exam/websocket/WebSocketMobileServer.java

@@ -115,7 +115,8 @@ public class WebSocketMobileServer {
                     log.info("用户连接:" + this.sessionId + ",当前在线人数为:" + getOnlineCount());
                     log.info("用户连接:" + this.sessionId + ",当前在线人数为:" + getOnlineCount());
                     InetSocketAddress addr = (InetSocketAddress) WebsocketUtil.getFieldInstance(this.session.getAsyncRemote(), "base#socketWrapper#socket#sc#remoteAddress");
                     InetSocketAddress addr = (InetSocketAddress) WebsocketUtil.getFieldInstance(this.session.getAsyncRemote(), "base#socketWrapper#socket#sc#remoteAddress");
                     this.ip = addr.toString().replace("/", "").split(":")[0];
                     this.ip = addr.toString().replace("/", "").split(":")[0];
-                    this.sendMessage("ip[" + this.ip + "]连接成功");
+//                    this.sendMessage("ip[" + this.ip + "]连接成功");
+                    log.info("ip[:{}]连接成功", this.ip);
                     tranMap = new HashMap<>();
                     tranMap = new HashMap<>();
                     tranMap.put("recordId", this.recordId);
                     tranMap.put("recordId", this.recordId);
                     tranMap.put("deviceId", this.deviceId);
                     tranMap.put("deviceId", this.deviceId);

+ 6 - 6
themis-exam/src/main/java/com/qmth/themis/exam/websocket/WebSocketOeServer.java

@@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SpringContextHolder;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.constant.SystemConstant;
+import com.qmth.themis.business.dto.MqDto;
 import com.qmth.themis.business.dto.WebsocketDto;
 import com.qmth.themis.business.dto.WebsocketDto;
 import com.qmth.themis.business.entity.TBSession;
 import com.qmth.themis.business.entity.TBSession;
-import com.qmth.themis.business.enums.SystemOperationEnum;
+import com.qmth.themis.business.enums.MqTagEnum;
+import com.qmth.themis.business.enums.MqTopicEnum;
 import com.qmth.themis.business.enums.WebsocketTypeEnum;
 import com.qmth.themis.business.enums.WebsocketTypeEnum;
+import com.qmth.themis.business.service.MqDtoService;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.WebsocketUtil;
 import com.qmth.themis.business.util.WebsocketUtil;
@@ -18,10 +21,6 @@ import com.qmth.themis.common.signature.SignatureInfo;
 import com.qmth.themis.common.signature.SignatureType;
 import com.qmth.themis.common.signature.SignatureType;
 import com.qmth.themis.exam.listener.service.MqOeLogicService;
 import com.qmth.themis.exam.listener.service.MqOeLogicService;
 import com.qmth.themis.exam.websocketTemplete.WebSocketOeMessageTemplete;
 import com.qmth.themis.exam.websocketTemplete.WebSocketOeMessageTemplete;
-import com.qmth.themis.business.dto.MqDto;
-import com.qmth.themis.business.enums.MqTagEnum;
-import com.qmth.themis.business.enums.MqTopicEnum;
-import com.qmth.themis.business.service.MqDtoService;
 import com.qmth.themis.mq.templete.Concurrently;
 import com.qmth.themis.mq.templete.Concurrently;
 import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
 import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
 import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
 import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
@@ -114,7 +113,8 @@ public class WebSocketOeServer implements Concurrently {
                     log.info("用户连接:" + this.sessionId + ",当前在线人数为:" + getOnlineCount());
                     log.info("用户连接:" + this.sessionId + ",当前在线人数为:" + getOnlineCount());
                     InetSocketAddress addr = (InetSocketAddress) WebsocketUtil.getFieldInstance(this.session.getAsyncRemote(), "base#socketWrapper#socket#sc#remoteAddress");
                     InetSocketAddress addr = (InetSocketAddress) WebsocketUtil.getFieldInstance(this.session.getAsyncRemote(), "base#socketWrapper#socket#sc#remoteAddress");
                     this.ip = addr.toString().replace("/", "").split(":")[0];
                     this.ip = addr.toString().replace("/", "").split(":")[0];
-                    this.sendMessage("ip[" + this.ip + "]连接成功");
+//                    this.sendMessage("ip[" + this.ip + "]连接成功");
+                    log.info("ip[:{}]连接成功", this.ip);
                     tranMap = new HashMap<>();
                     tranMap = new HashMap<>();
                     tranMap.put("recordId", this.recordId);
                     tranMap.put("recordId", this.recordId);
                     tranMap.put("deviceId", this.deviceId);
                     tranMap.put("deviceId", this.deviceId);