| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- using System.Threading;
- using System.Collections.Concurrent;
- using SqlSugar;
- using Newtonsoft.Json;
- using HXX.Scanner.Database;
- using HXX.Scanner.Common;
- using HXX.Scanner.Biz.Socket;
- using HXX.Scanner.Socket;
- namespace HXX.Scanner.Biz.Socket
- {
- /// <summary>
- /// 业务处理 扫描完成发送给网页端
- /// </summary>
- public class biz_scanFinish
- {
- /// <summary>
- /// 主业务
- /// </summary>
- /// <param name="entity"></param>
- /// <param name="http_result"></param>
- public static void Work(tb_file_info entity, ResponseEntity<response_http_uploadImg2> http_result)
- {
- cmd_scanFinish cmd = new cmd_scanFinish();
- try
- {
- if (entity != null)
- {
- cmd = get_cmd(entity, http_result);
- }
- else
- {
- cmd = get_cmd(http_result);
- }
- }
- catch (Exception ee)
- {
- LogManager.WriteLog(ee);
- }
- if (cmd != null)
- {
- //SocketServerManager.Send_Family(config_environment.current_invoker, cmd.ToJson());
- SocketServerManager.Send_Single(config_environment.current_invoker, cmd.ToJson());
- }
- }
- /// <summary>
- /// 构造返回值,成功时
- /// </summary>
- /// <param name="entity"></param>
- /// <param name="http_result"></param>
- /// <returns></returns>
- private static cmd_scanFinish get_cmd(tb_file_info entity, ResponseEntity<response_http_uploadImg2> http_result)
- {
- cmd_scanFinish result = new cmd_scanFinish();
- result.action = "scanFinish";
- result.param = new subCmd_scanFinish();
- result.param.isTest = entity.fi_isTest;
- result.param.examId = entity.fi_examId;
- result.param.examPaperId = entity.fi_examPaperId;
- result.param.accountId = entity.fi_accountId.ToString();
- result.param.zipId = entity.fi_zipId;
- if (http_result.Status == 1)
- {
- result.code = 200;
- result.msg = "上传成功";
- //result.param.uniquePageMarker = http_result.Data.data.uniquePageMarker;
- }
- else if (http_result.Status == -2)
- {
- result.code = 400;
- result.msg = "上传超时";
- }
- else
- {
- result.code = 509;
- result.msg = http_result.Message;
- }
- return result;
- }
- /// <summary>
- /// 构造返回值,异常时
- /// </summary>
- /// <param name="http_result"></param>
- /// <returns></returns>
- private static cmd_scanFinish get_cmd(ResponseEntity<response_http_uploadImg2> http_result)
- {
- if (config_environment.scan_type != ScanType.Test_Panel_1_Side && config_environment.scan_type != ScanType.Test_Panel_2_Sides)
- {
- cmd_scanFinish result = new cmd_scanFinish();
- result.action = "scanFinish";
- result.param = new subCmd_scanFinish();
- result.param.isTest = config_environment.web_parameter.isTest;
- result.param.examId = config_environment.web_parameter.examId;
- result.param.examPaperId = config_environment.web_parameter.examPaperId;
- result.param.accountId = config_environment.web_parameter.accountId.ToString();
- result.param.zipId = config_environment.web_parameter.zipId;
- result.code = 509;
- result.msg = http_result.Message;
- return result;
- }
- else
- {
- return null;
- }
- }
- }
- }
|