|
@@ -1,6 +1,5 @@
|
|
package cn.com.qmth.stmms.ms.log.aop;
|
|
package cn.com.qmth.stmms.ms.log.aop;
|
|
|
|
|
|
-import cn.com.qmth.stmms.ms.commons.config.LevelConfig;
|
|
|
|
import cn.com.qmth.stmms.ms.commons.constant.ArbitrateCallback;
|
|
import cn.com.qmth.stmms.ms.commons.constant.ArbitrateCallback;
|
|
import cn.com.qmth.stmms.ms.commons.constant.ArbitrateResult;
|
|
import cn.com.qmth.stmms.ms.commons.constant.ArbitrateResult;
|
|
import cn.com.qmth.stmms.ms.commons.utils.EncrypAES;
|
|
import cn.com.qmth.stmms.ms.commons.utils.EncrypAES;
|
|
@@ -15,6 +14,8 @@ import cn.com.qmth.stmms.ms.core.domain.user.Role;
|
|
import cn.com.qmth.stmms.ms.core.repository.*;
|
|
import cn.com.qmth.stmms.ms.core.repository.*;
|
|
import cn.com.qmth.stmms.ms.marking.config.MarkingConfig;
|
|
import cn.com.qmth.stmms.ms.marking.config.MarkingConfig;
|
|
import cn.com.qmth.stmms.ms.marking.dto.MarkTaskDTO;
|
|
import cn.com.qmth.stmms.ms.marking.dto.MarkTaskDTO;
|
|
|
|
+import cn.com.qmth.stmms.ms.marking.service.DetermineRoughLevelService;
|
|
|
|
+import cn.com.qmth.stmms.ms.marking.service.MarkingRoughLevelService;
|
|
import cn.com.qmth.stmms.ms.marking.service.MarkingService;
|
|
import cn.com.qmth.stmms.ms.marking.service.MarkingService;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -33,7 +34,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
-import javax.servlet.http.HttpSession;
|
|
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -78,9 +78,6 @@ public class MarkLogAop {
|
|
@Autowired
|
|
@Autowired
|
|
SqlUtil sqlUtil;
|
|
SqlUtil sqlUtil;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- LevelConfig levelConfig;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
MarkTaskRoughLevelRepo markTaskRoughLevelRepo;
|
|
MarkTaskRoughLevelRepo markTaskRoughLevelRepo;
|
|
|
|
|
|
@@ -297,7 +294,6 @@ public class MarkLogAop {
|
|
//20191107wangliang加入仲裁自动打回算法 start
|
|
//20191107wangliang加入仲裁自动打回算法 start
|
|
if (markStage.ordinal() == 1 && paper.isArbitrated()) {
|
|
if (markStage.ordinal() == 1 && paper.isArbitrated()) {
|
|
if (ParamCache.levelConfigMap.get(String.valueOf(work.getId())).getAutoCallback() == 1) {//为true则自动打回
|
|
if (ParamCache.levelConfigMap.get(String.valueOf(work.getId())).getAutoCallback() == 1) {//为true则自动打回
|
|
- List<MarkTaskLevel> markTasks = markTaskLevelRepo.findByPaperIdAndStage(paper.getId(), markStage);
|
|
|
|
JSONObject js = new JSONObject();
|
|
JSONObject js = new JSONObject();
|
|
js.put("paperId", paper.getId());
|
|
js.put("paperId", paper.getId());
|
|
js.put("type", "autoCallback");
|
|
js.put("type", "autoCallback");
|
|
@@ -305,7 +301,13 @@ public class MarkLogAop {
|
|
js.put("deviation", deviation);
|
|
js.put("deviation", deviation);
|
|
MarkTaskJob markTaskJob = new MarkTaskJob(js.toJSONString(), false, paper.getWorkId());
|
|
MarkTaskJob markTaskJob = new MarkTaskJob(js.toJSONString(), false, paper.getWorkId());
|
|
markTaskJobRepo.save(markTaskJob);
|
|
markTaskJobRepo.save(markTaskJob);
|
|
- autoCallback(markTasks, deviation, paper, markTaskJob, work.getName(), daterMineResult);
|
|
|
|
|
|
+ if (markStage.equals(MarkStage.ROUGH_LEVEL)) {
|
|
|
|
+ List<MarkTaskRoughLevel> markTasks = markTaskRoughLevelRepo.findByPaperIdAndStage(paper.getId(), markStage);
|
|
|
|
+ autoCallbackRoughLevel(markTasks, deviation, paper, markTaskJob, work.getName(), daterMineResult);
|
|
|
|
+ } else if (markStage.equals(MarkStage.LEVEL)) {
|
|
|
|
+ List<MarkTaskLevel> markTasks = markTaskLevelRepo.findByPaperIdAndStage(paper.getId(), markStage);
|
|
|
|
+ autoCallback(markTasks, deviation, paper, markTaskJob, work.getName(), daterMineResult);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//20191107wangliang加入仲裁自动打回算法 end
|
|
//20191107wangliang加入仲裁自动打回算法 end
|
|
@@ -319,6 +321,7 @@ public class MarkLogAop {
|
|
* @param paper
|
|
* @param paper
|
|
* @param markTaskJob
|
|
* @param markTaskJob
|
|
* @param workName
|
|
* @param workName
|
|
|
|
+ * @param daterMineResult
|
|
*/
|
|
*/
|
|
public void autoCallback(List<MarkTaskLevel> markTasks, int deviation, Paper paper, MarkTaskJob markTaskJob, String workName, String daterMineResult) {
|
|
public void autoCallback(List<MarkTaskLevel> markTasks, int deviation, Paper paper, MarkTaskJob markTaskJob, String workName, String daterMineResult) {
|
|
List<MarkTaskLevel> result = markTasks.stream().filter(x -> Objects.isNull(x.getResult())).collect(Collectors.toList());
|
|
List<MarkTaskLevel> result = markTasks.stream().filter(x -> Objects.isNull(x.getResult())).collect(Collectors.toList());
|
|
@@ -374,6 +377,71 @@ public class MarkLogAop {
|
|
LOGGER.info("this:{} markLogAop异步回调结束了", this);
|
|
LOGGER.info("this:{} markLogAop异步回调结束了", this);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 粗分档自动打回异步回调
|
|
|
|
+ *
|
|
|
|
+ * @param markTasks
|
|
|
|
+ * @param deviation
|
|
|
|
+ * @param paper
|
|
|
|
+ * @param markTaskJob
|
|
|
|
+ * @param workName
|
|
|
|
+ * @param daterMineResult
|
|
|
|
+ */
|
|
|
|
+ public void autoCallbackRoughLevel(List<MarkTaskRoughLevel> markTasks, int deviation, Paper paper, MarkTaskJob markTaskJob, String workName, String daterMineResult) {
|
|
|
|
+ List<MarkTaskRoughLevel> result = markTasks.stream().filter(x -> Objects.isNull(x.getResult())).collect(Collectors.toList());
|
|
|
|
+ if (Objects.nonNull(result) && !result.isEmpty()) {
|
|
|
|
+ LOGGER.info("数据有误,未完成评卷任务");
|
|
|
|
+ markTaskJobRepo.updateMarkTaskJobByVersion(markTaskJob.getId(), markTaskJob.getVersion());
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Level> levels = levelRepo.findByWorkId(paper.getWorkId());
|
|
|
|
+ List<RoughLevel> roughLevels = DetermineRoughLevelService.parseRoughLevels(levels);
|
|
|
|
+ Map<String, Integer> levelMap = roughLevels.stream().collect(Collectors.toMap(RoughLevel::getRoughCode, n -> Integer.parseInt(n.getRoughCode())));
|
|
|
|
+
|
|
|
|
+ Map<Long, String> levelsMap = markTasks.stream().collect(Collectors.toMap(MarkTaskRoughLevel::getMarkerId, o -> o.getResult().toUpperCase()));
|
|
|
|
+ LOGGER.info("this:{} markLogAop异步回调进来了", this);
|
|
|
|
+ arbitrateCallback.judge(levelsMap, deviation, new ArbitrateResult() {
|
|
|
|
+ @Override
|
|
|
|
+ public void callback(List<ArbitrateCallback.Distance> list) {
|
|
|
|
+ LOGGER.info("this:{} callback markLogAop异步回调进来了", this);
|
|
|
|
+ String operResult = DEFAULT_RESULT;
|
|
|
|
+ //全部打回则不触发自动仲裁
|
|
|
|
+ if (Objects.nonNull(list) && !list.isEmpty() && markTasks.size() != list.size()) {
|
|
|
|
+ paper.reject(null);
|
|
|
|
+ List<MarkLog> markLogList = new ArrayList<>();
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ for (ArbitrateCallback.Distance d : list) {
|
|
|
|
+ for (MarkTaskRoughLevel m : markTasks) {
|
|
|
|
+ if (Objects.equals(String.valueOf(d.getC()), m.getResult()) && d.getMarkId().longValue() == m.getMarkerId().longValue()) {
|
|
|
|
+ m.setDeviationDirection(MarkingRoughLevelService.calcDeviationDirection(levelMap, m.getResult(), daterMineResult));
|
|
|
|
+ m.setRejected(true);
|
|
|
|
+ m.setOriginLevel(m.getResult());
|
|
|
|
+ m.setResult(null);
|
|
|
|
+ m.setLevel(null);
|
|
|
|
+ MarkLog markLogPrev = markLogRepo.findTopByCreateUserIdAndOperTypeAndSubjectAndExamNumberOrderByCreateTimeDesc(m.getMarkerId(), MarkLogOperType.SYSTEM_CALLBACK_LEVEl.getId(), m.getSubject().toString(), paper.getExamNumber());
|
|
|
|
+ if (Objects.nonNull(markLogPrev)) {
|
|
|
|
+ operResult = Optional.ofNullable(markLogPrev.getOperDataAfter()).orElse("-");
|
|
|
|
+ }
|
|
|
|
+ //加入打回日志
|
|
|
|
+ MarkLog markLog = new MarkLog(m.getMarkerId(), m.getMarkerName(), Role.MARKER, m.getSubject(), paper.getExamNumber(), paper.getStudentName(), MarkLogOperType.SYSTEM_CALLBACK_LEVEl.getId(), paper.getWorkId(), paper.getId(), m.getStage(), operResult, String.valueOf(d.getC()), MarkLogOperType.SYSTEM_CALLBACK_LEVEl.getName(), workName, date);
|
|
|
|
+ markLogList.add(markLog);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ int count = markTaskJobRepo.updateMarkTaskJobByVersion(markTaskJob.getId(), markTaskJob.getVersion());
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ markTaskRoughLevelRepo.save(markTasks);
|
|
|
|
+ paperRepo.save(paper);
|
|
|
|
+ markLogRepo.save(markLogList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ LOGGER.info("this:{} callback markLogAop异步回调结束了", this);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ LOGGER.info("this:{} markLogAop异步回调结束了", this);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询处于哪个档位公用
|
|
* 查询处于哪个档位公用
|