Prechádzať zdrojové kódy

Merge branch 'dev' of http://git.qmth.com.cn/themis/backend-service into dev
c

wangliang 4 rokov pred
rodič
commit
9c59e75f4d

+ 2 - 0
themis-business/src/main/java/com/qmth/themis/business/annotation/ApiJsonProperty.java

@@ -23,4 +23,6 @@ public @interface ApiJsonProperty {
     String type() default "string";
 
     String description() default "";
+
+    boolean required() default false;
 }

+ 3 - 1
themis-business/src/main/java/com/qmth/themis/business/config/MapApiReader.java

@@ -8,6 +8,7 @@ import org.apache.ibatis.javassist.*;
 import org.apache.ibatis.javassist.bytecode.AnnotationsAttribute;
 import org.apache.ibatis.javassist.bytecode.ConstPool;
 import org.apache.ibatis.javassist.bytecode.annotation.Annotation;
+import org.apache.ibatis.javassist.bytecode.annotation.BooleanMemberValue;
 import org.apache.ibatis.javassist.bytecode.annotation.StringMemberValue;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.annotation.Order;
@@ -79,7 +80,8 @@ public class MapApiReader implements ParameterBuilderPlugin {
         ConstPool constPool = ctClass.getClassFile().getConstPool();
         AnnotationsAttribute attr = new AnnotationsAttribute(constPool, AnnotationsAttribute.visibleTag);
         Annotation ann = new Annotation("io.swagger.annotations.ApiModelProperty", constPool);
-        ann.addMemberValue("example", new StringMemberValue(property.example(), constPool));
+        ann.addMemberValue("value", new StringMemberValue(property.description(), constPool));
+        ann.addMemberValue("required", new BooleanMemberValue(property.required(), constPool));
         attr.addAnnotation(ann);
         ctField.getFieldInfo().addAttribute(attr);
         return ctField;

+ 63 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/response/TBOrgDto.java

@@ -15,11 +15,74 @@ public class TBOrgDto implements Serializable {
     private Long id;//机构id
     private String name;//机构名称
     private String code;//机构代码
+    private String logo;//logo
+    private Integer enableSimulate;//是否开启模考
     private Integer enable;//是否启用
     private String contactName;//联系人
     private String contactPhone;//联系电话
     private String updateName;//更新人
     private Date updateTime;//更新时间
+    private Long simulatePaperId;//模考试卷id
+    private Integer enableMonitorRecord;//是否允许监控转录
+    private Integer enableLiveness;//是否允许使用活体
+    private String accessKey;//外部访问凭证
+    private String accessSecret;//外部访问密钥
+
+    public String getLogo() {
+        return logo;
+    }
+
+    public void setLogo(String logo) {
+        this.logo = logo;
+    }
+
+    public Integer getEnableSimulate() {
+        return enableSimulate;
+    }
+
+    public void setEnableSimulate(Integer enableSimulate) {
+        this.enableSimulate = enableSimulate;
+    }
+
+    public Long getSimulatePaperId() {
+        return simulatePaperId;
+    }
+
+    public void setSimulatePaperId(Long simulatePaperId) {
+        this.simulatePaperId = simulatePaperId;
+    }
+
+    public Integer getEnableMonitorRecord() {
+        return enableMonitorRecord;
+    }
+
+    public void setEnableMonitorRecord(Integer enableMonitorRecord) {
+        this.enableMonitorRecord = enableMonitorRecord;
+    }
+
+    public Integer getEnableLiveness() {
+        return enableLiveness;
+    }
+
+    public void setEnableLiveness(Integer enableLiveness) {
+        this.enableLiveness = enableLiveness;
+    }
+
+    public String getAccessKey() {
+        return accessKey;
+    }
+
+    public void setAccessKey(String accessKey) {
+        this.accessKey = accessKey;
+    }
+
+    public String getAccessSecret() {
+        return accessSecret;
+    }
+
+    public void setAccessSecret(String accessSecret) {
+        this.accessSecret = accessSecret;
+    }
 
     public Long getId() {
         return id;

+ 12 - 12
themis-business/src/main/java/com/qmth/themis/business/entity/TBOrg.java

@@ -32,8 +32,8 @@ public class TBOrg extends BaseEntity {
     private Integer enable;
 
     @ApiModelProperty(value = "是否开启模考")
-    @TableField(value = "id")
-    private Integer enable_simulate;
+    @TableField(value = "enable_simulate")
+    private Integer enableSimulate;
 
     @ApiModelProperty(value = "模考试卷id")
     @TableField(value = "simulate_paper_id")
@@ -57,11 +57,11 @@ public class TBOrg extends BaseEntity {
 
     @ApiModelProperty(value = "是否允许使用活体")
     @TableField(value = "enable_liveness")
-    private String enableLiveness;
+    private Integer enableLiveness;
 
     @ApiModelProperty(value = "是否允许监控转录")
     @TableField(value = "enable_monitor_record")
-    private String enableMonitorRecord;
+    private Integer enableMonitorRecord;
 
     public String getContactName() {
         return contactName;
@@ -79,19 +79,19 @@ public class TBOrg extends BaseEntity {
         this.contactPhone = contactPhone;
     }
 
-    public String getEnableLiveness() {
+    public Integer getEnableLiveness() {
         return enableLiveness;
     }
 
-    public void setEnableLiveness(String enableLiveness) {
+    public void setEnableLiveness(Integer enableLiveness) {
         this.enableLiveness = enableLiveness;
     }
 
-    public String getEnableMonitorRecord() {
+    public Integer getEnableMonitorRecord() {
         return enableMonitorRecord;
     }
 
-    public void setEnableMonitorRecord(String enableMonitorRecord) {
+    public void setEnableMonitorRecord(Integer enableMonitorRecord) {
         this.enableMonitorRecord = enableMonitorRecord;
     }
 
@@ -127,12 +127,12 @@ public class TBOrg extends BaseEntity {
         this.enable = enable;
     }
 
-    public Integer getEnable_simulate() {
-        return enable_simulate;
+    public Integer getEnableSimulate() {
+        return enableSimulate;
     }
 
-    public void setEnable_simulate(Integer enable_simulate) {
-        this.enable_simulate = enable_simulate;
+    public void setEnableSimulate(Integer enableSimulate) {
+        this.enableSimulate = enableSimulate;
     }
 
     public Long getSimulatePaperId() {

+ 5 - 1
themis-business/src/main/java/com/qmth/themis/business/enums/WebsocketTypeEnum.java

@@ -23,7 +23,11 @@ public enum WebsocketTypeEnum {
 
     invigilate_notice_ack( "监考消息确认","invigilateNoticeAck"),
 
-    invigilate_stop_exam( "监考强制收卷","invigilateStopExam");
+    invigilate_stop_exam( "监考强制收卷","invigilateStopExam"),
+
+    breach_stop_exam( "预警强制收卷","breachStopExam"),
+
+    hand_stop_exam( "手动收卷","handStopExam");
 
     private String code;
     private String desc;

+ 11 - 1
themis-business/src/main/resources/mapper/TBOrgMapper.xml

@@ -5,6 +5,13 @@
     <select id="queryByPage" resultType="com.qmth.themis.business.dto.response.TBOrgDto">
         select
             t.id,
+            t.logo,
+            t.enableSimulate,
+            t.simulatePaperId,
+            t.enableMonitorRecord,
+            t.enableLiveness,
+            t.accessKey,
+            t.accessSecret,
             t.name,
             t.code,
             t.enable,
@@ -15,7 +22,10 @@
             from
             (
             select
-                tbo.id, tbo.name, tbo.code, tbo.enable, tbo.contact_name as contactName, tbo.contact_phone as contactPhone, (
+                tbo.id, tbo.logo, tbo.enable_simulate as enableSimulate, tbo.simulate_paper_id as simulatePaperId,
+                tbo.enable_monitor_record as enableMonitorRecord,tbo.enable_liveness as enableLiveness,
+                tbo.access_key as accessKey,tbo.access_secret as accessSecret,
+                tbo.name, tbo.code, tbo.enable, tbo.contact_name as contactName, tbo.contact_phone as contactPhone, (
                 select
                     tbu.name
                 from

+ 5 - 2
themis-business/src/main/resources/mapper/TBUserMapper.xml

@@ -55,9 +55,12 @@
                 <if test="enable != null and enable != '' or enable == 0">
                     and tbu.enable = #{enable}
                 </if>
+            </where> group by tbu.id,tbu.mobile_number,tbu.login_name,tbu.name,tbu.enable) t
+            <where>
                 <if test="role != null and role != ''">
-                    and tbr.role_code = #{role}
+                    and t.roleCodeStr like concat('%', #{role}, '%')
                 </if>
-            </where> group by tbu.id,tbu.mobile_number,tbu.login_name,tbu.name,tbu.enable) t order by t.name
+            </where>
+             order by t.name
     </select>
 </mapper>

+ 15 - 5
themis-exam/src/main/java/com/qmth/themis/exam/api/SysController.java

@@ -5,15 +5,18 @@ import com.qmth.themis.business.bean.exam.OrgInfoBean;
 import com.qmth.themis.business.bean.exam.VersionBean;
 import com.qmth.themis.business.entity.TBOrg;
 import com.qmth.themis.business.service.TBOrgService;
+import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
 import io.swagger.annotations.*;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.Map;
+import java.util.Objects;
 
 @Api(tags = "系统信息Controller")
 @RestController
@@ -23,14 +26,21 @@ public class SysController {
     @Resource
     private TBOrgService orgService;
 
+    @Resource
+    RedisUtil redisUtil;
+
     @ApiOperation(value = "获取环境接口")
     @RequestMapping(value = "/env", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "环境信息", response = Result.class)})
-    public Result env(@ApiParam(value = "机构id", required = false) @RequestParam(required = false) Long orgId) {
+    public Result env(@ApiParam(value = "机构id", required = false) @RequestBody Map<String, Object> mapParameter) {
         EnvBean env = new EnvBean();
-        if (orgId != null) {
-            TBOrg org = orgService.getById(orgId);
-            if (org != null) {
+        if (Objects.nonNull(mapParameter.get("orgId"))) {
+            Long orgId = Long.parseLong(String.valueOf(mapParameter.get("orgId")));
+            TBOrg org = (TBOrg) redisUtil.getOrg(orgId);
+            if (Objects.isNull(org)) {
+                org = orgService.getById(orgId);
+            }
+            if (Objects.nonNull(org)) {
                 OrgInfoBean orgInfo = new OrgInfoBean();
                 orgInfo.setLogo(org.getLogo());
                 orgInfo.setName(org.getName());

+ 0 - 5
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -77,9 +77,6 @@ public class TEStudentController {
     @Resource
     TEExamService teExamService;
 
-    @Resource
-    TOeExamRecordService tOeExamRecordService;
-
     @ApiOperation(value = "学生登录接口")
     @RequestMapping(value = "/login", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "学生信息", response = TEExamResultDto.class)})
@@ -223,8 +220,6 @@ public class TEStudentController {
             finalMap.put("activity", objectMap);
             map.put("unFinished", finalMap);
         }
-//        Map unFinishExam = tOeExamRecordService.getUnFinishExam(teStudent.getId(), examId, orgId);
-//        map.put("unFinished", unFinishExam);
         //获取全局考试配置
         TEConfig teConfig = teConfigService.getGlobalConfig();
 //        map.put(SystemConstant.ACCESS_TOKEN, token);

+ 3 - 3
themis-exam/src/main/java/com/qmth/themis/exam/listener/service/impl/MqOeLogicServiceImpl.java

@@ -117,7 +117,7 @@ public class MqOeLogicServiceImpl implements MqOeLogicService {
                         Map map = new HashMap<>();
                         map.put(SystemConstant.RECORD_ID, recordId);
                         map.put(SystemConstant.MESSAGE, FinishTypeEnum.valueOf(String.valueOf(mqDto.getProperties().get("type"))).getCode());
-                        WebsocketDto websocketDto = new WebsocketDto(WebsocketTypeEnum.invigilate_stop_exam.name(), map);
+                        WebsocketDto websocketDto = new WebsocketDto(WebsocketTypeEnum.hand_stop_exam.name(), map);
                         webSocketOeServer.sendMessage(websocketDto);
                     }
                 });
@@ -129,8 +129,8 @@ public class MqOeLogicServiceImpl implements MqOeLogicService {
                         WebSocketOeServer webSocketOeServer = webSocketMap.get(recordId);
                         Map map = new HashMap<>();
                         map.put(SystemConstant.RECORD_ID, recordId);
-                        map.put(SystemConstant.BREACH_STATUS, recordId);
-                        WebsocketDto websocketDto = new WebsocketDto(WebsocketTypeEnum.invigilate_stop_exam.name(), map);
+                        map.put(SystemConstant.BREACH_STATUS, FinishTypeEnum.valueOf(String.valueOf(mqDto.getProperties().get("type"))).getCode());
+                        WebsocketDto websocketDto = new WebsocketDto(WebsocketTypeEnum.breach_stop_exam.name(), map);
                         webSocketOeServer.sendMessage(websocketDto);
                     }
                 });