Explorar o código

任务加考试批次字段

xiatian %!s(int64=4) %!d(string=hai) anos
pai
achega
8095072a62

+ 2 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TBExamInvigilateUserController.java

@@ -149,6 +149,7 @@ public class TBExamInvigilateUserController {
             } else {
                 //往任务表里插一条数据
                 tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_INVIGILATE_USER, examId, TaskStatusEnum.INIT, SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(), tbUser.getId(), tbUser.getOrgId());
+                tbTaskHistory.setExamId(examId);
                 taskHistoryService.save(tbTaskHistory);
                 transMap.put("tbTaskHistory", tbTaskHistory);
             }
@@ -187,6 +188,7 @@ public class TBExamInvigilateUserController {
                 TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
                 //往任务表里插一条数据
                 tbTaskHistory = new TBTaskHistory(TaskTypeEnum.EXPORT_INVIGILATE_USER, TaskStatusEnum.INIT, SystemConstant.EXPORT_INIT, 0d, tbUser.getId(), tbUser.getOrgId());
+                tbTaskHistory.setExamId(examId);
                 taskHistoryService.save(tbTaskHistory);
                 transMap.put("tbTaskHistory", tbTaskHistory);
                 transMap.put("createId", tbUser.getId());

+ 16 - 9
themis-backend/src/main/java/com/qmth/themis/backend/api/TBTaskHistoryController.java

@@ -29,14 +29,21 @@ import javax.annotation.Resource;
 @RequestMapping("/${prefix.url.admin}/task")
 public class TBTaskHistoryController {
 
-    @Resource
-    TBTaskHistoryService tbTaskHistoryService;
+	@Resource
+	TBTaskHistoryService tbTaskHistoryService;
 
-    @ApiOperation(value = "任务查询接口")
-    @RequestMapping(value = "/query", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "任务信息", response = TBTaskDto.class)})
-    public Result query(@ApiParam(value = "任务id", required = false) @RequestParam(required = false) Long id, @ApiParam(value = "业务对象id", required = false) @RequestParam(required = false) Long entityId, @ApiParam(value = "任务类型", required = false) @RequestParam(required = false) TaskTypeEnum type, @ApiParam(value = "任务状态", required = false) @RequestParam(required = false) TaskStatusEnum status, @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber, @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
-        TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
-        return ResultUtil.ok(tbTaskHistoryService.taskQuery(new Page<>(pageNumber, pageSize), id, entityId, type, status, tbUser.getOrgId()));
-    }
+	@ApiOperation(value = "任务查询接口")
+	@RequestMapping(value = "/query", method = RequestMethod.POST)
+	@ApiResponses({ @ApiResponse(code = 200, message = "任务信息", response = TBTaskDto.class) })
+	public Result query(@ApiParam(value = "任务id", required = false) @RequestParam(required = false) Long id,
+			@ApiParam(value = "考试批次id", required = false) @RequestParam(required = false) Long examId,
+			@ApiParam(value = "业务对象id", required = false) @RequestParam(required = false) Long entityId,
+			@ApiParam(value = "任务类型", required = false) @RequestParam(required = false) TaskTypeEnum type,
+			@ApiParam(value = "任务状态", required = false) @RequestParam(required = false) TaskStatusEnum status,
+			@ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
+			@ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
+		TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
+		return ResultUtil.ok(tbTaskHistoryService.taskQuery(new Page<>(pageNumber, pageSize), id, entityId, type,
+				status, tbUser.getOrgId(),examId));
+	}
 }

+ 1 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamController.java

@@ -486,6 +486,7 @@ public class TEExamController {
             //往任务表里插一条数据
             tbTaskHistory = new TBTaskHistory(TaskTypeEnum.CALCULATE_EXAM_SCORE, TaskStatusEnum.INIT, "重新算分", 0d, tbUser.getId(), tbUser.getOrgId());
             tbTaskHistory.setEntityId(id);
+            tbTaskHistory.setExamId(id);
             taskHistoryService.save(tbTaskHistory);
             transMap.put("examId", id);
             transMap.put("orgId", tbUser.getOrgId());

+ 1 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamPaperController.java

@@ -136,6 +136,7 @@ public class TEExamPaperController {
             } else {
                 //往任务表里插一条数据
                 tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_EXAM_PAPER, examId, TaskStatusEnum.INIT, SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(), tbUser.getId(), tbUser.getOrgId());
+                tbTaskHistory.setExamId(examId);
                 taskHistoryService.save(tbTaskHistory);
                 transMap.put("tbTaskHistory", tbTaskHistory);
             }

+ 4 - 0
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java

@@ -96,6 +96,7 @@ public class TEExamStudentController {
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         //往任务表里插一条数据
         tbTaskHistory = new TBTaskHistory(TaskTypeEnum.EXPORT_EXAM_STUDENT, TaskStatusEnum.INIT, SystemConstant.EXPORT_INIT, 0d, tbUser.getId(), tbUser.getOrgId());
+        tbTaskHistory.setExamId(examId);
         taskHistoryService.save(tbTaskHistory);
         transMap.put("tbTaskHistory", tbTaskHistory);
         transMap.put("orgId", tbUser.getOrgId());
@@ -284,6 +285,7 @@ public class TEExamStudentController {
                 tbTaskHistory = new TBTaskHistory(TaskTypeEnum.IMPORT_EXAM_STUDENT, examId, TaskStatusEnum.INIT,
                         SystemConstant.IMPORT_INIT, 0d, tbAttachment.getName(), tbAttachment.getRemark(),
                         tbUser.getId(), tbUser.getOrgId());
+                tbTaskHistory.setExamId(examId);
                 taskHistoryService.save(tbTaskHistory);
                 transMap.put("tbTaskHistory", tbTaskHistory);
             }
@@ -375,6 +377,7 @@ public class TEExamStudentController {
             TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
             //往任务表里插一条数据
             tbTaskHistory = new TBTaskHistory(TaskTypeEnum.EXPORT_MARK_RESULT_SIMPLE, TaskStatusEnum.INIT, SystemConstant.EXPORT_INIT, 0d, tbUser.getId(), tbUser.getOrgId());
+            tbTaskHistory.setExamId(examId);
             taskHistoryService.save(tbTaskHistory);
             transMap.put("tbTaskHistory", tbTaskHistory);
             transMap.put("createId", tbUser.getId());
@@ -418,6 +421,7 @@ public class TEExamStudentController {
             TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
             //往任务表里插一条数据
             tbTaskHistory = new TBTaskHistory(TaskTypeEnum.EXPORT_MARK_RESULT_STANDARD, TaskStatusEnum.INIT, SystemConstant.EXPORT_INIT, 0d, tbUser.getId(), tbUser.getOrgId());
+            tbTaskHistory.setExamId(examId);
             taskHistoryService.save(tbTaskHistory);
             transMap.put("tbTaskHistory", tbTaskHistory);
             transMap.put("createId", tbUser.getId());

+ 13 - 12
themis-business/src/main/java/com/qmth/themis/business/dao/TBTaskHistoryMapper.java

@@ -19,16 +19,17 @@ import java.util.Map;
 @Mapper
 public interface TBTaskHistoryMapper extends BaseMapper<TBTaskHistory> {
 
-    /**
-     * 查询任务
-     *
-     * @param iPage
-     * @param taskId
-     * @param entityId
-     * @param type
-     * @param status
-     * @param orgId
-     * @return
-     */
-    public IPage<TBTaskDto> taskQuery(IPage<Map> iPage, @Param("taskId") Long taskId, @Param("entityId") Long entityId, @Param("type") String type, @Param("status") String status, @Param("orgId") Long orgId);
+	/**
+	 * 查询任务
+	 *
+	 * @param iPage
+	 * @param taskId
+	 * @param entityId
+	 * @param type
+	 * @param status
+	 * @param orgId
+	 * @return
+	 */
+	public IPage<TBTaskDto> taskQuery(IPage<Map> iPage, @Param("taskId") Long taskId, @Param("entityId") Long entityId,
+			@Param("type") String type, @Param("status") String status, @Param("orgId") Long orgId,@Param("examId") Long  examId);
 }

+ 16 - 3
themis-business/src/main/java/com/qmth/themis/business/dto/response/TBTaskDto.java

@@ -1,11 +1,11 @@
 package com.qmth.themis.business.dto.response;
 
+import java.io.Serializable;
+
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import io.swagger.annotations.ApiModelProperty;
 
-import java.io.Serializable;
-import java.util.Date;
+import io.swagger.annotations.ApiModelProperty;
 
 /**
  * @Description: task dto
@@ -63,6 +63,9 @@ public class TBTaskDto implements Serializable {
 
     @ApiModelProperty(name = "业务对象名")
     private String entityName;//业务对象名
+    
+    @ApiModelProperty(name = "考试批次名称")
+    private String examName;//考试批次名称
 
     public String getImportFileName() {
         return importFileName;
@@ -183,4 +186,14 @@ public class TBTaskDto implements Serializable {
     public void setCreateName(String createName) {
         this.createName = createName;
     }
+
+	public String getExamName() {
+		return examName;
+	}
+
+	public void setExamName(String examName) {
+		this.examName = examName;
+	}
+    
+    
 }

+ 15 - 0
themis-business/src/main/java/com/qmth/themis/business/entity/TBTaskHistory.java

@@ -37,6 +37,11 @@ public class TBTaskHistory implements Serializable {
     @ApiModelProperty(value = "关联业务对象ID")
     @TableField("entity_id")
     private Long entityId;
+    
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "考试批次ID")
+    @TableField("exam_id")
+    private Long examId;
 
     @ApiModelProperty(value = "任务状态,init:未开始,running:开始执行,finish:执行结束")
     @TableField("status")
@@ -240,4 +245,14 @@ public class TBTaskHistory implements Serializable {
     public void setFinishTime(Long finishTime) {
         this.finishTime = finishTime;
     }
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+    
+    
 }

+ 13 - 12
themis-business/src/main/java/com/qmth/themis/business/service/TBTaskHistoryService.java

@@ -18,16 +18,17 @@ import java.util.Map;
  */
 public interface TBTaskHistoryService extends IService<TBTaskHistory> {
 
-    /**
-     * 查询任务
-     *
-     * @param iPage
-     * @param taskId
-     * @param entityId
-     * @param type
-     * @param status
-     * @param orgId
-     * @return
-     */
-    public IPage<TBTaskDto> taskQuery(IPage<Map> iPage, Long taskId, Long entityId, TaskTypeEnum type, TaskStatusEnum status, Long orgId);
+	/**
+	 * 查询任务
+	 *
+	 * @param iPage
+	 * @param taskId
+	 * @param entityId
+	 * @param type
+	 * @param status
+	 * @param orgId
+	 * @return
+	 */
+	public IPage<TBTaskDto> taskQuery(IPage<Map> iPage, Long taskId, Long entityId, TaskTypeEnum type,
+			TaskStatusEnum status, Long orgId,Long examId);
 }

+ 21 - 18
themis-business/src/main/java/com/qmth/themis/business/service/impl/TBTaskHistoryServiceImpl.java

@@ -22,24 +22,27 @@ import java.util.Objects;
  * @Date: 2020/7/9
  */
 @Service
-public class TBTaskHistoryServiceImpl extends ServiceImpl<TBTaskHistoryMapper, TBTaskHistory> implements TBTaskHistoryService {
+public class TBTaskHistoryServiceImpl extends ServiceImpl<TBTaskHistoryMapper, TBTaskHistory>
+		implements TBTaskHistoryService {
 
-    @Resource
-    TBTaskHistoryMapper tbTaskHistoryMapper;
+	@Resource
+	TBTaskHistoryMapper tbTaskHistoryMapper;
 
-    /**
-     * 查询任务
-     *
-     * @param iPage
-     * @param taskId
-     * @param entityId
-     * @param type
-     * @param status
-     * @param orgId
-     * @return
-     */
-    @Override
-    public IPage<TBTaskDto> taskQuery(IPage<Map> iPage, Long taskId, Long entityId, TaskTypeEnum type, TaskStatusEnum status, Long orgId) {
-        return tbTaskHistoryMapper.taskQuery(iPage, taskId, entityId, Objects.isNull(type) ? null : type.name(), Objects.isNull(status) ? null : status.name(), orgId);
-    }
+	/**
+	 * 查询任务
+	 *
+	 * @param iPage
+	 * @param taskId
+	 * @param entityId
+	 * @param type
+	 * @param status
+	 * @param orgId
+	 * @return
+	 */
+	@Override
+	public IPage<TBTaskDto> taskQuery(IPage<Map> iPage, Long taskId, Long entityId, TaskTypeEnum type,
+			TaskStatusEnum status, Long orgId,Long examId) {
+		return tbTaskHistoryMapper.taskQuery(iPage, taskId, entityId, Objects.isNull(type) ? null : type.name(),
+				Objects.isNull(status) ? null : status.name(), orgId,examId);
+	}
 }

+ 1 - 0
themis-business/src/main/resources/db/init.sql

@@ -795,6 +795,7 @@ CREATE TABLE `t_b_task_history` (
   `create_time` bigint DEFAULT NULL COMMENT '创建时间',
   `start_time` bigint DEFAULT NULL COMMENT '开始时间',
   `finish_time` bigint DEFAULT NULL COMMENT '结束时间',
+  `exam_id` bigint DEFAULT NULL COMMENT '考试批次ID',
   `org_id` bigint DEFAULT NULL COMMENT '机构id',
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='异步任务';

+ 5 - 0
themis-business/src/main/resources/mapper/TBTaskHistoryMapper.xml

@@ -17,6 +17,7 @@
             tbth.finish_time as finishTime,
             tbth.create_id as createId,
             tbth.import_file_name as importFileName,
+            h.name examName,
             (select tee.name from t_e_exam tee where tee.id = tbth.entity_id) as entityName,
             (
             select
@@ -27,7 +28,11 @@
                 tbu.id = tbth.create_id) as createName
         from
             t_b_task_history tbth
+            left join t_e_exam h on tbth.exam_id=h.id
             <where>
+            	<if test="examId != null">
+                    and h.id = #{examId}
+                </if>
                 <if test="taskId != null and taskId != ''">
                     and tbth.id = #{taskId}
                 </if>