|
@@ -30,7 +30,6 @@ import com.qmth.themis.common.util.ResultUtil;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -495,7 +494,6 @@ public class TIeInvigilateController {
|
|
@ApiOperation(value = "违纪处理接口")
|
|
@ApiOperation(value = "违纪处理接口")
|
|
@RequestMapping(value = "/breach", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/breach", method = RequestMethod.POST)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
- @Transactional
|
|
|
|
public Result breach(@ApiJsonObject(name = "invigilateBreach", value = {
|
|
public Result breach(@ApiJsonObject(name = "invigilateBreach", value = {
|
|
@ApiJsonProperty(key = "examRecordId", type = "long", example = "1", description = "考试记录id", required = true),
|
|
@ApiJsonProperty(key = "examRecordId", type = "long", example = "1", description = "考试记录id", required = true),
|
|
@ApiJsonProperty(key = "type", description = "违规类型", required = true),
|
|
@ApiJsonProperty(key = "type", description = "违规类型", required = true),
|
|
@@ -506,107 +504,17 @@ public class TIeInvigilateController {
|
|
if (Objects.isNull(mapParameter.get(SystemConstant.EXAM_RECORD_ID)) || Objects.equals(mapParameter.get(SystemConstant.EXAM_RECORD_ID), "")) {
|
|
if (Objects.isNull(mapParameter.get(SystemConstant.EXAM_RECORD_ID)) || Objects.equals(mapParameter.get(SystemConstant.EXAM_RECORD_ID), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
|
|
}
|
|
}
|
|
- List<String> recordIdList = (List<String>) mapParameter.get(SystemConstant.EXAM_RECORD_ID);
|
|
|
|
if (Objects.isNull(mapParameter.get(SystemConstant.TYPE)) || Objects.equals(mapParameter.get(SystemConstant.TYPE), "")) {
|
|
if (Objects.isNull(mapParameter.get(SystemConstant.TYPE)) || Objects.equals(mapParameter.get(SystemConstant.TYPE), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.BREACH_TYPE_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.BREACH_TYPE_IS_NULL);
|
|
}
|
|
}
|
|
if (Objects.isNull(mapParameter.get("description")) || Objects.equals(mapParameter.get("description"), "")) {
|
|
if (Objects.isNull(mapParameter.get("description")) || Objects.equals(mapParameter.get("description"), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.BREACH_DESC_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.BREACH_DESC_IS_NULL);
|
|
}
|
|
}
|
|
- String description = String.valueOf(mapParameter.get("description"));
|
|
|
|
if (Objects.isNull(mapParameter.get(SystemConstant.STATUS)) || Objects.equals(mapParameter.get(SystemConstant.STATUS), "")) {
|
|
if (Objects.isNull(mapParameter.get(SystemConstant.STATUS)) || Objects.equals(mapParameter.get(SystemConstant.STATUS), "")) {
|
|
throw new BusinessException(ExceptionResultEnum.BREACH_STATUS_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.BREACH_STATUS_IS_NULL);
|
|
}
|
|
}
|
|
- List<TOeExamRecord> tOeExamRecordList = new ArrayList<>();
|
|
|
|
- if (recordIdList.size() > 0) {
|
|
|
|
- Integer status = Integer.parseInt(String.valueOf(mapParameter.get(SystemConstant.STATUS)));
|
|
|
|
- TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
|
- List<TEExamBreachLog> teExamBreachLogList = new ArrayList<>();
|
|
|
|
- if (status.intValue() == 0) {//新建违纪
|
|
|
|
- BreachTypeEnum type = BreachTypeEnum.valueOf(String.valueOf(mapParameter.get(SystemConstant.TYPE)));
|
|
|
|
- List<TEExamBreachLog> finalTeExamBreachLogList = teExamBreachLogList;
|
|
|
|
- for (int i = 0; i < recordIdList.size(); i++) {
|
|
|
|
- Long l = Long.parseLong(String.valueOf(recordIdList.get(i)));
|
|
|
|
- Long examId = null, examStudentId = null, examActivityId = null;
|
|
|
|
- TOeExamRecord tOeExamRecord = null;
|
|
|
|
- if (Objects.isNull(ExamRecordCacheUtil.getId(l))) {
|
|
|
|
- tOeExamRecord = tOeExamRecordService.getById(l);
|
|
|
|
- examId = tOeExamRecord.getExamId();
|
|
|
|
- examStudentId = tOeExamRecord.getExamStudentId();
|
|
|
|
- examActivityId = tOeExamRecord.getExamActivityId();
|
|
|
|
- } else {
|
|
|
|
- examId = ExamRecordCacheUtil.getExamId(l);
|
|
|
|
- examStudentId = ExamRecordCacheUtil.getExamStudentId(l);
|
|
|
|
- examActivityId = ExamRecordCacheUtil.getExamActivityId(l);
|
|
|
|
- }
|
|
|
|
- TEExamBreachLog teExamBreachLog = new TEExamBreachLog(examId, examActivityId, l, examStudentId, type.name(), description, status);
|
|
|
|
- teExamBreachLog.setCreateId(tbUser.getId());
|
|
|
|
- finalTeExamBreachLogList.add(teExamBreachLog);
|
|
|
|
- if (Objects.nonNull(ExamRecordCacheUtil.getId(l))) {
|
|
|
|
- Integer breachStatus = Objects.nonNull(ExamRecordCacheUtil.getBreachStatus(l)) ? ExamRecordCacheUtil.getBreachStatus(l) : 1;
|
|
|
|
- if (breachStatus.intValue() == 1) {
|
|
|
|
- Long timestamp = System.currentTimeMillis();
|
|
|
|
- ExamRecordCacheUtil.setBreachStatus(l, status, timestamp);
|
|
|
|
- tOeExamRecordService.sendExamRecordDataSaveMq(l, timestamp);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- Integer breachStatus = Objects.nonNull(tOeExamRecord.getBreachStatus()) ? tOeExamRecord.getBreachStatus() : 1;
|
|
|
|
- if (breachStatus.intValue() == 1) {
|
|
|
|
- tOeExamRecord.setBreachStatus(status);
|
|
|
|
- tOeExamRecordList.add(tOeExamRecord);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {//撤销违纪
|
|
|
|
- Long breachLogId = (Long) mapParameter.get("breachLogId");
|
|
|
|
- BreachCancelTypeEnum type = BreachCancelTypeEnum.valueOf(String.valueOf(mapParameter.get(SystemConstant.TYPE)));
|
|
|
|
- TEExamBreachLog teExamBreachLog = teExamBreachLogService.getById(breachLogId);
|
|
|
|
- Optional.ofNullable(teExamBreachLog).orElseThrow(() -> new BusinessException("未找到违纪记录"));
|
|
|
|
-
|
|
|
|
- if (Objects.nonNull(teExamBreachLog.getStatus()) && teExamBreachLog.getStatus().intValue() == 1) {
|
|
|
|
- throw new BusinessException("该条违纪信息已处理");
|
|
|
|
- }
|
|
|
|
- teExamBreachLog.setType(type.name());
|
|
|
|
- teExamBreachLog.setDescription(description);
|
|
|
|
- teExamBreachLog.setStatus(status);
|
|
|
|
- teExamBreachLog.setUpdateId(tbUser.getId());
|
|
|
|
- teExamBreachLogList.add(teExamBreachLog);
|
|
|
|
- for (int i = 0; i < recordIdList.size(); i++) {
|
|
|
|
- Long l = Long.parseLong(String.valueOf(recordIdList.get(i)));
|
|
|
|
- QueryWrapper<TEExamBreachLog> teExamBreachLogQueryWrapper = new QueryWrapper<>();
|
|
|
|
- teExamBreachLogQueryWrapper.lambda().eq(TEExamBreachLog::getExamRecordId, l)
|
|
|
|
- .eq(TEExamBreachLog::getStatus, 0);
|
|
|
|
- int count = teExamBreachLogService.count(teExamBreachLogQueryWrapper);
|
|
|
|
- if (count == 1) {//撤销违纪都处理完了这个考生的考试记录里的违纪才算取消
|
|
|
|
- TOeExamRecord tOeExamRecord = null;
|
|
|
|
- if (Objects.isNull(ExamRecordCacheUtil.getId(teExamBreachLog.getExamRecordId()))) {
|
|
|
|
- tOeExamRecord = tOeExamRecordService.getById(teExamBreachLog.getExamRecordId());
|
|
|
|
- tOeExamRecord.setBreachStatus(status);
|
|
|
|
- tOeExamRecordList.add(tOeExamRecord);
|
|
|
|
- } else {
|
|
|
|
- Long timestamp = System.currentTimeMillis();
|
|
|
|
- ExamRecordCacheUtil.setBreachStatus(teExamBreachLog.getExamRecordId(), status, timestamp);
|
|
|
|
- tOeExamRecordService.sendExamRecordDataSaveMq(teExamBreachLog.getExamRecordId(), timestamp);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (Objects.nonNull(tOeExamRecordList) && tOeExamRecordList.size() > 0) {
|
|
|
|
- tOeExamRecordService.saveOrUpdateBatch(tOeExamRecordList);
|
|
|
|
- }
|
|
|
|
- for (TEExamBreachLog eb : teExamBreachLogList) {
|
|
|
|
- Map<String, Object> properties = new HashMap<>();
|
|
|
|
- properties.put(SystemConstant.TYPE, eb.getDescription());
|
|
|
|
- properties.put(SystemConstant.REMARK, eb.getType());
|
|
|
|
- properties.put(SystemConstant.EXAM_STUDENT_ID, eb.getExamStudentId());
|
|
|
|
- properties.put(SystemConstant.EXAM_RECORD_ID, eb.getExamRecordId());
|
|
|
|
- properties.put("objId", eb.getId());
|
|
|
|
- ExamStudentCacheBean examStudentCacheBean = teExamStudentService.getExamStudentCacheBean(eb.getExamStudentId());
|
|
|
|
- MqDto mqDto = new MqDto(mqUtil.getTopic(), MqTagEnum.STUDENT.name(), eb.getStatus() == 0 ? SystemOperationEnum.BREACH_HANDLE : SystemOperationEnum.BREACH_REVOKE, MqTagEnum.STUDENT, String.valueOf(examStudentCacheBean.getStudentId()), properties, examStudentCacheBean.getIdentity());
|
|
|
|
- mqDtoService.assembleSendOneWayMsg(mqDto);
|
|
|
|
- }
|
|
|
|
- teExamBreachLogService.saveOrUpdateBatch(teExamBreachLogList);
|
|
|
|
- }
|
|
|
|
|
|
+ teExamBreachLogService.breachLogic(mapParameter);
|
|
|
|
+ teExamBreachLogService.updateBreachStatus(mapParameter);
|
|
return ResultUtil.ok(true);
|
|
return ResultUtil.ok(true);
|
|
}
|
|
}
|
|
|
|
|