|
@@ -1,11 +1,14 @@
|
|
|
package com.qmth.teachcloud.mark.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
+import com.qmth.teachcloud.common.enums.mark.MarkArbitrateStatus;
|
|
|
import com.qmth.teachcloud.common.service.SysUserService;
|
|
|
import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
@@ -19,6 +22,7 @@ import com.qmth.teachcloud.mark.lock.LockService;
|
|
|
import com.qmth.teachcloud.mark.mapper.MarkArbitrateHistoryMapper;
|
|
|
import com.qmth.teachcloud.mark.params.MarkResult;
|
|
|
import com.qmth.teachcloud.mark.service.*;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -115,9 +119,17 @@ public class MarkArbitrateHistoryServiceImpl extends ServiceImpl<MarkArbitrateHi
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public MarkArbitrateSettingDto getArbitrateSetting(Long arbitrateId) {
|
|
|
+ public MarkArbitrateSettingDto getArbitrateSetting(Long arbitrateId, Long examId, String paperNumber, Integer groupNumber) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- MarkArbitrateHistory markArbitrateHistory = this.getById(arbitrateId);
|
|
|
+ MarkArbitrateHistory markArbitrateHistory;
|
|
|
+ if (arbitrateId != null) {
|
|
|
+ markArbitrateHistory = this.getById(arbitrateId);
|
|
|
+ } else {
|
|
|
+ if (examId == null || StringUtils.isBlank(paperNumber) || groupNumber == null) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("参数有误");
|
|
|
+ }
|
|
|
+ markArbitrateHistory = this.baseMapper.getArbitrateWaitingOne(examId, paperNumber, groupNumber);
|
|
|
+ }
|
|
|
if (markArbitrateHistory == null) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("仲裁数据异常");
|
|
|
}
|
|
@@ -141,8 +153,19 @@ public class MarkArbitrateHistoryServiceImpl extends ServiceImpl<MarkArbitrateHi
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Task getArbitrateTask(Long arbitrateId) {
|
|
|
- MarkArbitrateHistory markArbitrateHistory = this.getById(arbitrateId);
|
|
|
+ public Task getArbitrateTask(Long arbitrateId, Long examId, String paperNumber, Integer groupNumber) {
|
|
|
+ MarkArbitrateHistory markArbitrateHistory;
|
|
|
+ if (arbitrateId != null) {
|
|
|
+ markArbitrateHistory = this.getById(arbitrateId);
|
|
|
+ } else {
|
|
|
+ if (examId == null || StringUtils.isBlank(paperNumber) || groupNumber == null) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("参数有误");
|
|
|
+ }
|
|
|
+ markArbitrateHistory = this.baseMapper.getArbitrateWaitingOne(examId, paperNumber, groupNumber);
|
|
|
+ }
|
|
|
+ if (markArbitrateHistory == null) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("仲裁数据异常");
|
|
|
+ }
|
|
|
MarkGroup markGroup = markGroupService.getByExamIdAndPaperNumberAndGroupNumber(markArbitrateHistory.getExamId(), markArbitrateHistory.getPaperNumber(), markArbitrateHistory.getGroupNumber());
|
|
|
return taskService.build(markArbitrateHistory, markGroup);
|
|
|
}
|
|
@@ -184,6 +207,29 @@ public class MarkArbitrateHistoryServiceImpl extends ServiceImpl<MarkArbitrateHi
|
|
|
this.remove(updateWrapper);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public JSONObject getArbitrateStatus(Long examId, String paperNumber, Integer groupNumber) {
|
|
|
+ Long userId = ServletUtil.getRequestUserId();
|
|
|
+ QueryWrapper<MarkArbitrateHistory> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(MarkArbitrateHistory::getExamId, examId)
|
|
|
+ .eq(MarkArbitrateHistory::getPaperNumber, paperNumber)
|
|
|
+ .eq(MarkArbitrateHistory::getGroupNumber, groupNumber);
|
|
|
+ List<MarkArbitrateHistory> markArbitrateHistoryList = this.list(queryWrapper);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ if (CollectionUtils.isEmpty(markArbitrateHistoryList)) {
|
|
|
+ jsonObject.put("valid", false);
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
+
|
|
|
+ long totalCount = markArbitrateHistoryList.stream().filter(m -> MarkArbitrateStatus.WAITING.equals(m.getStatus())).count();
|
|
|
+ long markedCount = markArbitrateHistoryList.stream().filter(m -> MarkArbitrateStatus.MARKED.equals(m.getStatus()) && userId.equals(m.getUpdateUserId())).count();
|
|
|
+
|
|
|
+ jsonObject.put("totalCount", totalCount);
|
|
|
+ jsonObject.put("markedCount", markedCount);
|
|
|
+ jsonObject.put("valid", (totalCount + markedCount) > 0);
|
|
|
+ return jsonObject;
|
|
|
+ }
|
|
|
+
|
|
|
private void releaseTask(Long taskId) {
|
|
|
synchronized (currentTaskMap) {
|
|
|
currentTaskMap.remove(taskId);
|