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 { /// /// 业务处理 扫描完成发送给网页端 /// public class biz_scanFinish { /// /// 主业务 /// /// /// public static void Work(tb_file_info entity, ResponseEntity 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()); } } /// /// 构造返回值,成功时 /// /// /// /// private static cmd_scanFinish get_cmd(tb_file_info entity, ResponseEntity 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; } /// /// 构造返回值,异常时 /// /// /// private static cmd_scanFinish get_cmd(ResponseEntity 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; } } } }