|
@@ -20,40 +20,42 @@ import cn.com.qmth.examcloud.web.support.SpringContextHolder;
|
|
|
* @author lideyin 20190620
|
|
|
*/
|
|
|
public class FacePPCompareWorker implements Worker<ExamCaptureQueueEntity> {
|
|
|
- private final Log captureLog = LogFactory.getLog("PROCESS_EXAM_CAPTURE_TASK_LOGGER");
|
|
|
+ private final Log captureLog = LogFactory.getLog("PROCESS_EXAM_CAPTURE_TASK_LOGGER");
|
|
|
|
|
|
- @Override
|
|
|
- public void process(WorkerController controller, ExamCaptureQueueEntity element) {
|
|
|
- // 图片处理数量+1
|
|
|
- ExamCaptureProcessStatisticController.increaseFaceCompareCount();
|
|
|
- if (captureLog.isDebugEnabled()) {
|
|
|
- captureLog.debug("[FACEPP_COMPARE_WORKER.] 图片处理数量+1,count= "
|
|
|
- + ExamCaptureProcessStatisticController.getFaceCompareCount());
|
|
|
- }
|
|
|
- ExamCaptureService examCaptureService = SpringContextHolder
|
|
|
- .getBean(ExamCaptureService.class);
|
|
|
- try {
|
|
|
- examCaptureService.disposeFaceCompare(element);
|
|
|
- } catch (StatusException e) {
|
|
|
- // 异常处理
|
|
|
- element.setErrorMsg(e.getDesc());
|
|
|
- examCaptureService.disposeFaceCompareFaild(element);
|
|
|
- if ((e.getCode().equals(Constants.FACE_COMPARE_CONCURRENCY_LIMIT_EXCEEDED))) {
|
|
|
- // 如果超过并发次数,则添加异常次数
|
|
|
- controller.addConcurrencyWarn();
|
|
|
- } else {
|
|
|
- ExamCaptureProcessStatisticController.increaseFaceCompareFailedCount();
|
|
|
- captureLog.error("[FACEPP_COMPARE_WORKER.] 自定义异常 " + e.getDesc(), e);
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public void process(WorkerController controller, ExamCaptureQueueEntity element) {
|
|
|
+ // 图片处理数量+1
|
|
|
+ ExamCaptureProcessStatisticController.increaseFaceCompareCount();
|
|
|
+ if (captureLog.isDebugEnabled()) {
|
|
|
+ captureLog.debug("[FACEPP_COMPARE_WORKER.] 图片处理数量+1,count= "
|
|
|
+ + ExamCaptureProcessStatisticController.getFaceCompareCount());
|
|
|
+ }
|
|
|
+ ExamCaptureService examCaptureService = SpringContextHolder
|
|
|
+ .getBean(ExamCaptureService.class);
|
|
|
+ try {
|
|
|
+ examCaptureService.disposeFaceCompare(element);
|
|
|
+ } catch (StatusException e) {
|
|
|
+ // 异常处理
|
|
|
+ element.setErrorMsg(e.getDesc());
|
|
|
+ examCaptureService.disposeFaceCompareFaild(element);
|
|
|
+ if ((e.getCode().equals(Constants.FACE_COMPARE_CONCURRENCY_LIMIT_EXCEEDED))) {
|
|
|
+ // 如果超过并发次数,则添加异常次数
|
|
|
+ controller.addConcurrencyWarn();
|
|
|
+ } else {
|
|
|
+ ExamCaptureProcessStatisticController.increaseFaceCompareFailedCount();
|
|
|
+ captureLog.error("[FACEPP_COMPARE_WORKER.] 自定义异常 " + e.getDesc() +
|
|
|
+ ",failedCount=" + ExamCaptureProcessStatisticController.getFaceCompareFailedCount(), e);
|
|
|
+ }
|
|
|
|
|
|
- Util.sleep(TimeUnit.MICROSECONDS, 50);
|
|
|
- } catch (Exception e) {
|
|
|
- ExamCaptureProcessStatisticController.increaseFaceCompareFailedCount();
|
|
|
- // 异常处理
|
|
|
- element.setErrorMsg(e.getMessage());
|
|
|
- examCaptureService.disposeFaceCompareFaild(element);
|
|
|
- captureLog.error("[FACEPP_COMPARE_WORKER.] 系统异常 " + e.getMessage(), e);
|
|
|
- Util.sleep(TimeUnit.MICROSECONDS, 50);
|
|
|
- }
|
|
|
- }
|
|
|
+ Util.sleep(TimeUnit.MICROSECONDS, 50);
|
|
|
+ } catch (Exception e) {
|
|
|
+ ExamCaptureProcessStatisticController.increaseFaceCompareFailedCount();
|
|
|
+ // 异常处理
|
|
|
+ element.setErrorMsg(e.getMessage());
|
|
|
+ examCaptureService.disposeFaceCompareFaild(element);
|
|
|
+ captureLog.error("[FACEPP_COMPARE_WORKER.] 系统异常 " + e.getMessage() +
|
|
|
+ ",failedCount=" + ExamCaptureProcessStatisticController.getFaceCompareFailedCount(), e);
|
|
|
+ Util.sleep(TimeUnit.MICROSECONDS, 50);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|