123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133 |
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Net.Http;
- using System.Net;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Threading;
- using Flyinsono.DBCopy.Tool.Log;
- using Flyinsono.DBCopy.Tool.Service;
- using Flyinsono.DBCopy.Tool.Utilities;
- using WingInterfaceLibrary.Enum;
- using Flyinsono.DBCopy.Tool.RpcService;
- using MongoDB.Bson.IO;
- using Newtonsoft.Json.Linq;
- namespace Flyinsono.DBCopy.Tool
- {
- class MainWindowViewModel : ViewModel
- {
- private string _hostUrl;
- private uint _userCount;
- private string _message;
- private string _dbPath;
- private string _databaseUrl;
- private string _dcServiceUrl;
- private string _wingServiceUrl;
- private DateTime _reportBeginDate;
- private DateTime _reportEndDate;
- private string _fileNameText;
- private string _excludeSelectText;
- private string _terminalRecordCode;
- private ObservableCollection<string> _excludeList = new();
- private ObservableCollection<string> _searchedList = new();
- private MigrateService _migrateService;
- private MigrateService _migrateServiceReal;
- private FilterTestService _filterTestService;
- private static bool _migrateRemoteDisgnosis = false;
- private static bool _migrateLiveConsultation = false;
- private static bool _migrateVideo = false;
- private static bool _migrateCourse = false;
- private static bool _migrateExamPaper = false;
- private static bool _migrateReport = false;
- private static bool _migrateAIData = false;
- private static bool _migrateBasicData = false;
- private static bool _readFeedBackData = false;
- private static bool _bussinessData = false;
- private static bool _migratePrintData = false;
- private static bool _migratePatchData = false;
- private static bool _migratePackageData = false;
- private static bool _migrateVinnoOrgData = false;
- private static bool _validateOrganizationParentData = false;
- private static bool _synUserDeviceOrgData = false;
- private static bool _synIsUserReportInfoData = false;
- private static bool _migrateCourseData = false;
- private static bool _migrateCertifiedInstructorUser = false;
- private static bool _migrateRemedicalRecord = false;
- private static bool _migrateSpecialReport = false;
- private static bool _visitWeb = false;
- private static bool _migrateRemedicalData = false;
- private static bool _migrateAI = false;
- private static bool _migrateCarotid = false;
- private static bool _migrateConsultation = false;
- private static bool _migrateReportResult = false;
- private static bool _migrateUpgrade = false;
- private static bool _migrateUserInfo = false;
- private static bool _migrateDicInfo = false;
- private static bool _synchronizeTerminalRecord = false;
- private static long _visitWebErrorNum = 0;
- private COSClear _cosClear = new COSClear();
- private readonly Action<Action> _runOnMainDispatcher;
- public ButtonCommand ClearRemoteDataCommand { get; set; }
- public ButtonCommand ExitCommand { get; set; }
- public string HostUrl
- {
- get => _hostUrl;
- set
- {
- if (_hostUrl != value)
- {
- _hostUrl = value;
- OnPropertyChanged(() => HostUrl);
- }
- }
- }
- public string DatabaseUrl
- {
- get => _databaseUrl;
- set
- {
- if (_databaseUrl != value)
- {
- _databaseUrl = value;
- OnPropertyChanged(() => DatabaseUrl);
- }
- }
- }
- public uint UserCount
- {
- get => _userCount;
- set
- {
- if (_userCount != value)
- {
- _userCount = value;
- OnPropertyChanged(() => UserCount);
- }
- }
- }
- public string Message
- {
- get => _message;
- set
- {
- if (_message != value)
- {
- _message = value;
- OnPropertyChanged(() => Message);
- }
- }
- }
- public string DbPath
- {
- get => _dbPath;
- set
- {
- if (_dbPath != value)
- {
- _dbPath = value;
- OnPropertyChanged(() => DbPath);
- }
- }
- }
- public string DCServiceUrl
- {
- get => _dcServiceUrl;
- set
- {
- if (_dcServiceUrl != value)
- {
- _dcServiceUrl = value;
- OnPropertyChanged(() => DCServiceUrl);
- }
- }
- }
- public string WingServiceUrl
- {
- get => _wingServiceUrl;
- set
- {
- if (_wingServiceUrl != value)
- {
- _wingServiceUrl = value;
- OnPropertyChanged(() => WingServiceUrl);
- }
- }
- }
- public DateTime ReportBeginDate
- {
- get => _reportBeginDate;
- set
- {
- if (_reportBeginDate != value)
- {
- _reportBeginDate = value;
- OnPropertyChanged(() => _reportBeginDate);
- }
- }
- }
- public DateTime ReportEndDate
- {
- get => _reportEndDate;
- set
- {
- if (_reportEndDate != value)
- {
- _reportEndDate = value;
- OnPropertyChanged(() => _reportEndDate);
- }
- }
- }
- public string FileNameText
- {
- get => _fileNameText;
- set
- {
- if (_fileNameText != value)
- {
- _fileNameText = value;
- OnPropertyChanged(() => _fileNameText);
- }
- }
- }
- public string ExcludeSelectText
- {
- get => _excludeSelectText;
- set
- {
- if (_excludeSelectText != value)
- {
- _excludeSelectText = value;
- OnPropertyChanged(() => _excludeSelectText);
- }
- }
- }
- public ObservableCollection<string> SearchedFiles
- {
- get => _searchedList;
- set
- {
- if (_searchedList != value)
- {
- _searchedList = value;
- OnPropertyChanged(() => _searchedList);
- }
- }
- }
- public ObservableCollection<string> ExcludeList
- {
- get => _excludeList;
- set
- {
- if (_excludeList != value)
- {
- _excludeList = value;
- OnPropertyChanged(() => _excludeList);
- }
- }
- }
- public string TerminalRecordCode
- {
- get => _terminalRecordCode;
- set
- {
- if (_terminalRecordCode != value)
- {
- _terminalRecordCode = value;
- OnPropertyChanged(() => TerminalRecordCode);
- }
- }
- }
- public MigrateService MigrateService
- {
- get
- {
- if (_migrateService != null)
- {
- return _migrateService;
- }
- if (string.IsNullOrWhiteSpace(DCServiceUrl))
- {
- throw new Exception($"DCService Url Is Empty");
- }
- _migrateService = new MigrateService(DCServiceUrl);
- return _migrateService;
- }
- }
- public MigrateService MigrateServiceReal
- {
- get
- {
- if (_migrateServiceReal != null)
- {
- return _migrateServiceReal;
- }
- if (string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- throw new Exception($"WingService Url Is Empty");
- }
- Logger.WriteLineInfo($"WingServiceUrl:{WingServiceUrl}");
- _migrateServiceReal = new MigrateService(WingServiceUrl);
- return _migrateServiceReal;
- }
- }
- public FilterTestService FilterTestService
- {
- get
- {
- if (_filterTestService != null)
- {
- return _filterTestService;
- }
- _filterTestService = new FilterTestService();
- return _filterTestService;
- }
- }
- //private List<SequenceExecutor<int>> _sequenceExecutors = new List<SequenceExecutor<int>>();
- /// <summary>
- /// Request window close
- /// </summary>
- public event EventHandler RequestClosed;
- /// <summary>
- /// Cancel Command
- /// </summary>
- public Command CancelCommand { get; }
- /// <summary>
- /// Finish command
- /// </summary>
- public Command CloseCommand { get; }
- /// <summary>
- /// Open Output Dir Command
- /// </summary>
- public Command OpenOutputDirCommand { get; }
- /// <summary>
- /// Log infoes
- /// </summary>
- public ObservableCollection<LogItem> LogItems { get; }
- public Command ClearLogCommand { get; }
- public ButtonCommand ConnectDbCommand { get; set; }
- public ButtonCommand ConnectDbServerCommand { get; set; }
- public ButtonCommand MigrateRemoteDiagnosisCommand { get; set; }
- public ButtonCommand MigrateLiveConsultationCommand { get; set; }
- public ButtonCommand MigrateVideoCommand { get; set; }
- public ButtonCommand MigrateBasicDataCommand { get; set; }
- public ButtonCommand MigrateIsOldAgentUserDataCommand { get; set; }
- public ButtonCommand DeleteDictionDataCommand { get; set; }
- public ButtonCommand ReadFeedBackExcelDataCommand { get; set; }
- public ButtonCommand UpgradeBussinessDataCommand { get; set; }
- public ButtonCommand MigratePrintDataCommand { get; set; }
- public ButtonCommand MigratePatchDataCommand { get; set; }
- public ButtonCommand MigratePackageDataCommand { get; set; }
- public ButtonCommand MigrateBasicUserDataCommand { get; set; }
- public ButtonCommand DiffOrganizationDataCommand { get; set; }
- public ButtonCommand ClearColdDataCommand { get; set; }
- public ButtonCommand MigrateCourseCommand { get; set; }
- public ButtonCommand MigrateExamPaperCommand { get; set; }
- public ButtonCommand MigrateReportCommand { get; set; }
- public ButtonCommand MigrateAIDataCommand { get; set; }
- public ButtonCommand MigrateStaticCommand { get; set; }
- public ButtonCommand WingMigrateRemoteRecordCommand { get; set; }
- public ButtonCommand MigrateSpecialReportCommand { get; set; }
- public ButtonCommand TryVisitWebCommand{get;set;}
- public ButtonCommand WingMigrateRemoteDataCommand { get; set; }
- public ButtonCommand WingMigrateAICommand { get; set; }
- public ButtonCommand WingMigrateCarotidCommand { get; set; }
- public ButtonCommand WingMigrateConsultationCommand { get; set; }
- public ButtonCommand WingMigrateReportCommand { get; set; }
- public ButtonCommand MigrateCourseVideoCommand { get; set; }
- public ButtonCommand MigrateCertifiedInstructorUserCommand { get; set; }
- public ButtonCommand WingUpgradeMigrateCommand { get; set; }
- public ButtonCommand TransferDiagnosisResultCommand { get; set; }
- public ButtonCommand MigrateCustomLabelsCommand { get; set; }
- public ButtonCommand NewDeployFileClearCommand { get; set; }
- public ButtonCommand OldDeployFileClearCommand { get; set; }
- public ButtonCommand OldClientFileClearCommand { get; set; }
- public ButtonCommand NewClientFileClearCommand { get; set; }
- public ButtonCommand AddExcludeCommand { get; set; }
- public ButtonCommand RemoveExcludeCommand { get; set; }
- public ButtonCommand MigrateVinnoOrgDataCommand { get; set; }
- public ButtonCommand MigrateVinnoDeviceDataCommand { get; set; }
- public ButtonCommand SynUserDeviceOrgDataCommand { get; set; }
- public ButtonCommand SynIsUserReportInfoAsyncCommand { get; set; }
- public ButtonCommand ValidateOrganizationParentDataInfosCommand { get; set; }
- public ButtonCommand SynchronizeTerminalRecordCommand { get; set; }
- public ButtonCommand MigrateAgentCommand { get; set; }
- public ButtonCommand DataDiffCommand { get; set; }
- public MainWindowViewModel(Action<Action> runOnMainDispatcher)
- {
- LogItems = new ObservableCollection<LogItem>();
- Description = "AppName";
- CancelCommand = new ButtonCommand(OnCancelCommand, "Cancel");
- CloseCommand = new ButtonCommand(OnCloseCommand, "Finish");
- ClearLogCommand = new ButtonCommand(OnClearLogCommand, "ClearLog");
- HostUrl = "http://192.168.6.80:8303/";
- //HostUrl = "wss://192.168.6.175:8443/wss/";
- UserCount = 100;
- Message = "PC-1";
- ClearRemoteDataCommand = new ButtonCommand(OnClearRemoteData, "Run");
- ExitCommand = new ButtonCommand(OnExit, "Exit");
- ConnectDbCommand = new ButtonCommand(OnConnectDb, "Connect DB");
- ConnectDbServerCommand = new ButtonCommand(OnConnectDbServer);
- DCServiceUrl = "http://192.168.6.128:8303/";
- MigrateRemoteDiagnosisCommand = new ButtonCommand(OnMigrateRemoteDiagnosis);
- MigrateLiveConsultationCommand = new ButtonCommand(OnMigrateLiveConsultation);
- MigrateVideoCommand = new ButtonCommand(OnMigrateVideo);
- MigrateCourseCommand = new ButtonCommand(OnMigrateCourse);
- MigrateExamPaperCommand = new ButtonCommand(OnMigrateExamPaper);
- MigrateReportCommand = new ButtonCommand(OnMigrateReport);
- MigrateAIDataCommand = new ButtonCommand(OnMigrateTerminalAIData);
- MigrateStaticCommand = new ButtonCommand(OnMigrateStatic);
- MigrateBasicDataCommand = new ButtonCommand(OnMigrateBasicData);
- MigrateIsOldAgentUserDataCommand = new ButtonCommand(OnMigrateIsOldAgentUserInfosData);
- DeleteDictionDataCommand = new ButtonCommand(OnDeleteDictionData);
- ReadFeedBackExcelDataCommand = new ButtonCommand(OnReadFeedBackExcelData);
- UpgradeBussinessDataCommand = new ButtonCommand(OnUpgradeBussinessDataCommand);
- MigratePrintDataCommand = new ButtonCommand(OnMigratePrintData);
- MigratePatchDataCommand = new ButtonCommand(OnMigratePatchData);
- MigratePackageDataCommand = new ButtonCommand(OnMigratePackageData);
- MigrateBasicUserDataCommand = new ButtonCommand(OnMigrateBasicUserData);
- DiffOrganizationDataCommand = new ButtonCommand(OnDiffOrganizationData);
- MigrateCourseVideoCommand = new ButtonCommand(OnMigrateCourseVideo);
- MigrateCertifiedInstructorUserCommand = new ButtonCommand(OnWingCertifiedInstructorUserMigrate);
- WingUpgradeMigrateCommand = new ButtonCommand(OnWingUpgradeMigrate);
- TransferDiagnosisResultCommand = new ButtonCommand(OnTransferDiagnosisResultCommand);
- MigrateAgentCommand = new ButtonCommand(OnMigrateAgentCommand);
- DataDiffCommand = new ButtonCommand(OnDataDiffCommand);
- MigrateCustomLabelsCommand = new ButtonCommand(OnMigrateCustomLabelsCommand);
- ClearColdDataCommand = new ButtonCommand(OnClearColdDataCommand);
- MigrateVinnoOrgDataCommand = new ButtonCommand(OnMigrateVinnoOrgInfos);
- MigrateVinnoDeviceDataCommand = new ButtonCommand(OnMigrateVinnoDeviceInfos);
- ValidateOrganizationParentDataInfosCommand = new ButtonCommand(OnValidateOrganizationParentDataInfos);
- SynUserDeviceOrgDataCommand = new ButtonCommand(OnSynUserDeviceOrgDatas);
- SynIsUserReportInfoAsyncCommand = new ButtonCommand(OnSynIsUserReportInfoAsync);
- WingServiceUrl = CommonConfigManager.DirectServer.Host;
- ReportBeginDate = DateTime.Now.AddDays(-1);
- ReportEndDate = DateTime.Now;
- WingMigrateRemoteRecordCommand = new ButtonCommand(OnMigrateRemoteRecordToWing);
- MigrateSpecialReportCommand = new ButtonCommand(OnMigrateSpecialReport);
- TryVisitWebCommand = new ButtonCommand(OnMTryVisitWeb);
- WingMigrateRemoteDataCommand = new ButtonCommand(OnMigrateRemeteDataToWing);
- WingMigrateAICommand = new ButtonCommand(OnMigrateAIDataToWing);
- WingMigrateCarotidCommand = new ButtonCommand(OnMigrateCarotidToWing);
- WingMigrateConsultationCommand = new ButtonCommand(OnMigrateConsultationToWing);
- WingMigrateReportCommand = new ButtonCommand(OnMigrateReportToWing);
- SynchronizeTerminalRecordCommand = new ButtonCommand(OnSynchronizeTerminalRecord);
- ExcludeList.Add("FlyinsonoDeploymentTool-en.zip");
- ExcludeList.Add("FlyinsonoDeploymentTool-zh.zip");
- ExcludeList.Add("DeployServer.zip");
- ExcludeList.Add("42E4E397C0954D61B216FBE480FB1012.zip");
- ExcludeList.Add("Flyinsono_SonoPost_1.2.0.0.exe");
- ExcludeList.Add("1.7.63.27096");
- ExcludeList.Add("1.7.62.27018");
- ExcludeList.Add("2.0.1.1471");
- ExcludeList.Add("_Public.zip");
- ExcludeList.Add("_LoalNetwork.zip");
- ExcludeList.Add("_local.zip");
- ExcludeList.Add("_Local_");
- ExcludeList.Add("_last_");
- ExcludeList.Add("FISSDK_2.0.0.293.zip.part1");
- ExcludeList.Add("Flyinsono_SonoPost_1.7.64.27262.apk.part1");
- ExcludeList.Add("Flyinsono_SonoPost_1.7.64.27262.zip");
- ExcludeList.Add("Flyinsono_SonoPost_1.7.64.27262.apk");
- NewDeployFileClearCommand = new ButtonCommand(OnNewDeployFileClearCommand);
- OldDeployFileClearCommand = new ButtonCommand(OnOldDeployFileClearCommand);
- NewClientFileClearCommand = new ButtonCommand(OnNewClientFileClearCommand);
- OldClientFileClearCommand = new ButtonCommand(OnOldClientFileClearCommand);
- AddExcludeCommand = new ButtonCommand(OnAddExcludeCommand);
- RemoveExcludeCommand = new ButtonCommand(OnRemoveExcludeCommand);
- this._runOnMainDispatcher = runOnMainDispatcher;
- }
- private void OnRemoveExcludeCommand(object obj)
- {
- if (!string.IsNullOrWhiteSpace(ExcludeSelectText))
- {
- ExcludeList.Remove(ExcludeSelectText);
- }
- }
- private void OnAddExcludeCommand(object obj)
- {
- string fileName = FileNameText;
- if (!string.IsNullOrWhiteSpace(fileName))
- {
- ExcludeList.Add(fileName);
- }
- FileNameText = string.Empty;
- }
- private void OnOldClientFileClearCommand(object obj)
- {
- try
- {
- Dispatcher.CurrentDispatcher.Invoke(() =>
- {
- //查询前缀
- var searchPrefixList = new List<string>{
- "Flyinsono_Server_1",
- "Flyinsono_Android_1",
- "Flyinsono_Windows_1",
- "Flyinsono_SonoPost_1"
- };
- _cosClear.SearchFiles(searchPrefixList, _excludeList.ToList()).ConfigureAwait(false);
- var confirmDialog = new ConfirmDialog("The operation cannot be rolled back. Are you sure you want to delete it?");
- if (confirmDialog.ShowDialog() == true)
- {
- _cosClear.RunClear(searchPrefixList, _excludeList.ToList()).ConfigureAwait(false);
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnDBBakFileClearCommand err, ex:{ex}");
- }
- }
- private void OnNewClientFileClearCommand(object obj)
- {
- try
- {
- Dispatcher.CurrentDispatcher.Invoke(() =>
- {
- //查询前缀
- var searchPrefixList = new List<string>{
- "Flyinsono_Server_2",
- "Flyinsono_Android_2",
- "Flyinsono_Windows_2",
- "FISSDK_2",
- "Flyinsono_SonoPost_2"
- };
- _cosClear.SearchFiles(searchPrefixList, _excludeList.ToList()).ConfigureAwait(false);
- var confirmDialog = new ConfirmDialog("The operation cannot be rolled back. Are you sure you want to delete it?");
- if (confirmDialog.ShowDialog() == true)
- {
- _cosClear.RunClear(searchPrefixList, _excludeList.ToList()).ConfigureAwait(false);
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnDBBakFileClearCommand err, ex:{ex}");
- }
- }
- private void OnOldDeployFileClearCommand(object obj)
- {
- try
- {
- Dispatcher.CurrentDispatcher.Invoke(() =>
- {
- //查询前缀
- var searchPrefixList = new List<string>{
- "DeploymentTool",
- "Server"
- };
- _cosClear.SearchFiles(searchPrefixList, _excludeList.ToList()).ConfigureAwait(false);
- var confirmDialog = new ConfirmDialog("The operation cannot be rolled back. Are you sure you want to delete it?");
- if (confirmDialog.ShowDialog() == true)
- {
- _cosClear.RunClear(searchPrefixList, _excludeList.ToList()).ConfigureAwait(false);
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnTestFileClearCommand err, ex:{ex}");
- }
- }
- /// <summary>
- /// 清理部署包文件
- /// </summary>
- /// <param name="obj"></param>
- private void OnNewDeployFileClearCommand(object obj)
- {
- try
- {
- Dispatcher.CurrentDispatcher.Invoke(() =>
- {
- //查询前缀
- var searchPrefixList = new List<string>{
- "FlyinsonoDeploymentTool"
- };
- _cosClear.SearchFiles(searchPrefixList, _excludeList.ToList()).ConfigureAwait(false);
- var confirmDialog = new ConfirmDialog("The operation cannot be rolled back. Are you sure you want to delete it?");
- if (confirmDialog.ShowDialog() == true)
- {
- _cosClear.RunClear(searchPrefixList, _excludeList.ToList()).ConfigureAwait(false);
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnDeployFileClearCommand err, ex:{ex}");
- }
- }
- private void OnExit(object obj)
- {
- }
- private async void OnClearRemoteData(object obj)
- {
- //var service = AppManager.Instance.GetManager<IClientTestManager>();
- //service.Run();
- try
- {
- Task.Run(async () =>
- {
- try
- {
- await FilterTestService.BeginClearTestData();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BeginClearTestData err, ex:{ex}");
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BeginClearTestData err, ex:{ex}");
- }
- }
- private async void OnDataDiffCommand(object obj)
- {
- try
- {
- Task.Run(async () =>
- {
- try
- {
- //await MigrateServiceReal.DataDiffCommand();
- await MigrateServiceReal.InitDeviceModelAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"DataDiffCommand err, ex:{ex}");
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"DataDiffCommand err, ex:{ex}");
- }
- }
-
- private async void OnMigrateAgentCommand(object obj)
- {
- try
- {
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateAgentInfos();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateAgentCommand err, ex:{ex}");
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateAgentCommand err, ex:{ex}");
- }
- }
- private async void OnMigrateCustomLabelsCommand(object obj)
- {
- try
- {
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateCustomLabels();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BeginMigrateCustomLabels err, ex:{ex}");
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BeginMigrateCustomLabels err, ex:{ex}");
- }
- }
- private async void OnTransferDiagnosisResultCommand(object obj)
- {
- try
- {
- Task.Run(async () =>
- {
- try
- {
- await FilterTestService.TransferDiagnosisResults();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BeginTransferDiagnosisResultData err, ex:{ex}");
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BeginTransferDiagnosisResultData err, ex:{ex}");
- }
- }
- private void OnClearLogCommand(object obj)
- {
- LogItems.Clear();
- }
- private void OnCancelCommand(object obj)
- {
- OnRequestClosed();
- }
- private void OnCloseCommand(object obj)
- {
- OnRequestClosed();
- }
- void OnRequestClosed()
- {
- RequestClosed?.Invoke(this, EventArgs.Empty);
- }
- private void OnConnectDb(object obj) // 新增OnConnectDb方法
- {
- var service = AppManager.Instance.GetManager<IClientTestManager>();
- if (string.IsNullOrEmpty(DbPath))
- {
- DbPath = "F:\\BaiduNetdiskDownload\\Database0708Resume\\Database";
- }
- service.ConnectDb(DbPath);
- }
- private void OnConnectDbServer(object obj)
- {
- CommonConfigManager.IsLocalHost = false;
- MongoDbClientSingle.Instance = new MongoDbClient();
- }
- private void OnMigrateStatic(object obj)
- {
- try
- {
- Task.Run(async () =>
- {
- try
- {
- await MigrateService.WriteMigrateStaticAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"WriteMigrateStaticAsync err, ex:{ex}");
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"WriteMigrateStaticAsync err, ex:{ex}");
- }
- }
- private void OnMigrateRemoteDiagnosis(object obj)
- {
- if (_migrateRemoteDisgnosis)
- {
- Logger.WriteLineWarn($"Migrate Remote Diagnosis Processing");
- return;
- }
- try
- {
- _migrateRemoteDisgnosis = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateService.MigrateRemoteDiagnosisInfosAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateRemoteDiagnisisInfos err, ex:{ex}");
- }
- finally
- {
- _migrateRemoteDisgnosis = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateRemoteDiagnisisInfos err, ex:{ex}");
- }
- }
- private void OnMigrateLiveConsultation(object obj)
- {
- if (_migrateLiveConsultation)
- {
- Logger.WriteLineWarn($"Migrate Live Consultation Processing");
- return;
- }
- try
- {
- _migrateLiveConsultation = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateService.MigrateLiveConsultationInfosAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateLiveConsultationInfosAsync err, ex:{ex}");
- }
- finally
- {
- _migrateLiveConsultation = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateLiveConsultationInfosAsync err, ex:{ex}");
- }
- }
- private void OnMigrateVideo(object obj)
- {
- if (_migrateVideo)
- {
- Logger.WriteLineWarn($"Migrate Video Processing");
- return;
- }
- try
- {
- _migrateVideo = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateService.MigrateOnlineVideoInfosAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineVideoInfosAsync err, ex:{ex}");
- }
- finally
- {
- _migrateVideo = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineVideoInfosAsync err, ex:{ex}");
- }
- }
- private void OnMigrateCourse(object obj)
- {
- if (_migrateCourse)
- {
- Logger.WriteLineWarn($"Migrate Course Processing");
- return;
- }
- try
- {
- _migrateCourse = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateService.MigrateOnlineTrainingInfosAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineTrainingInfosAsync err, ex:{ex}");
- }
- finally
- {
- _migrateCourse = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineTrainingInfosAsync err, ex:{ex}");
- }
- }
- private void OnMigrateExamPaper(object obj)
- {
- if (_migrateExamPaper)
- {
- Logger.WriteLineWarn($"Migrate Exam Paper Processing");
- return;
- }
- try
- {
- _migrateExamPaper = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateService.MigrateExamPaperInfosAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateExamPaperInfosAsync err, ex:{ex}");
- }
- finally
- {
- _migrateExamPaper = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateExamPaperInfosAsync err, ex:{ex}");
- }
- }
- private void OnMigrateReport(object obj)
- {
- if (_migrateReport)
- {
- Logger.WriteLineWarn($"Migrate Report Processing");
- return;
- }
- try
- {
- _migrateReport = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateService.MigrateReportInfosAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateReportInfosAsync err, ex:{ex}");
- }
- finally
- {
- _migrateReport = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateReportInfosAsync err, ex:{ex}");
- }
- }
- private void OnMigrateTerminalAIData(object obj)
- {
- if (_migrateAIData)
- {
- Logger.WriteLineWarn($"Migrate TerminalAIData Processing");
- return;
- }
- try
- {
- _migrateAIData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateService.MigrateTerminalAIDataInfosAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateTerminalAIDataInfosAsync err, ex:{ex}");
- }
- finally
- {
- _migrateAIData = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateTerminalAIDataInfosAsync err, ex:{ex}");
- }
- }
- private void OnSynIsUserReportInfoAsync(object obj)
- {
- if (_synIsUserReportInfoData)
- {
- Logger.WriteLineWarn($"Syn SynIsUserReportInfoAsync Processing");
- return;
- }
- try
- {
- _synIsUserReportInfoData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.SynIsUserReportInfoAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Syn SynIsUserReportInfoAsync err, ex:{ex}");
- }
- finally
- {
- _synIsUserReportInfoData = false;
- }
- });
- }
- catch (Exception ex)
- {
- _synIsUserReportInfoData = false;
- Logger.WriteLineWarn($"Syn SynIsUserReportInfoAsync err, ex:{ex}");
- }
- }
- private void OnSynUserDeviceOrgDatas(object obj)
- {
- if (_synUserDeviceOrgData)
- {
- Logger.WriteLineWarn($"Syn UserDeviceOrgData Processing");
- return;
- }
- try
- {
- _synUserDeviceOrgData = true;
- Task.Run(async () =>
- {
- try
- {
- //await MigrateServiceReal.SynUserDeviceOrganizationData();
- await MigrateServiceReal.ClearReportTemplateData();
- //await MigrateServiceReal.ClearReportTemplateDataJson();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Syn UserDeviceOrgData err, ex:{ex}");
- }
- finally
- {
- _synUserDeviceOrgData = false;
- }
- });
- }
- catch (Exception ex)
- {
- _synUserDeviceOrgData = false;
- Logger.WriteLineWarn($"Syn UserDeviceOrgData err, ex:{ex}");
- }
- }
- private void OnValidateOrganizationParentDataInfos(object obj)
- {
- if (_validateOrganizationParentData)
- {
- Logger.WriteLineWarn($"ValidateOrganizationParentDataInfos Processing");
- return;
- }
- try
- {
- _validateOrganizationParentData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.ValidateOrganizationParentDataInfos();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"ValidateOrganizationParentDataInfos err, ex:{ex}");
- }
- finally
- {
- _validateOrganizationParentData = false;
- }
- });
- }
- catch (Exception ex)
- {
- _validateOrganizationParentData = false;
- Logger.WriteLineWarn($"ValidateOrganizationParentDataInfos err, ex:{ex}");
- }
- }
- private void OnMigrateVinnoOrgInfos(object obj)
- {
- if (_migrateVinnoOrgData)
- {
- Logger.WriteLineWarn($"Migrate VinnoOrgData Processing");
- return;
- }
- try
- {
- _migrateVinnoOrgData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateVinnoOrgInfos();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineVinnoOrgDataDataAsync err, ex:{ex}");
- }
- finally
- {
- _migrateVinnoOrgData = false;
- }
- });
- }
- catch (Exception ex)
- {
- _migrateVinnoOrgData = false;
- Logger.WriteLineWarn($"MigrateOnlineVinnoOrgDataAsync err, ex:{ex}");
- }
- }
- private void OnMigrateVinnoDeviceInfos(object obj)
- {
- if (_migrateVinnoOrgData)
- {
- Logger.WriteLineWarn($"MigrateVinnoOrDataInfosByConfig Processing");
- return;
- }
- try
- {
- _migrateVinnoOrgData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateVinnoOrDataInfosByConfig();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateVinnoOrDataInfosByConfig err, ex:{ex}");
- }
- finally
- {
- _migrateVinnoOrgData = false;
- }
- });
- }
- catch (Exception ex)
- {
- _migrateVinnoOrgData = false;
- Logger.WriteLineWarn($"MigrateVinnoOrDataInfosByConfig err, ex:{ex}");
- }
- }
-
- private void OnMigratePrintData(object obj)
- {
- if (_migratePrintData)
- {
- Logger.WriteLineWarn($"Migrate PrintData Processing");
- return;
- }
- try
- {
- _migratePrintData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigratePrintInfos();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlinePrintDataAsync err, ex:{ex}");
- }
- finally
- {
- _migratePrintData = false;
- }
- });
- }
- catch (Exception ex)
- {
- _migratePrintData = false;
- Logger.WriteLineWarn($"MigrateOnlinePrintDataAsync err, ex:{ex}");
- }
- }
- private void OnMigratePatchData(object obj)
- {
- if (_migratePatchData)
- {
- Logger.WriteLineWarn($"Migrate PatchData Processing");
- return;
- }
- try
- {
- _migratePatchData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigratePatchDataInfos(SyncDBEnum.Migrate);
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlinePatchDataAsync err, ex:{ex}");
- }
- finally
- {
- _migratePatchData = false;
- }
- });
- }
- catch (Exception ex)
- {
- _migratePatchData = false;
- Logger.WriteLineWarn($"MigrateOnlinePatchDataAsync err, ex:{ex}");
- }
- }
- private void OnMigratePackageData(object obj)
- {
- if (_migratePackageData)
- {
- Logger.WriteLineWarn($"Migrate PackageData Processing");
- return;
- }
- try
- {
- _migratePackageData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigratePackageInfos(SyncDBEnum.Migrate);
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigratePackageInfos err, ex:{ex}");
- }
- finally
- {
- _migratePackageData = false;
- }
- });
- }
- catch (Exception ex)
- {
- _migratePackageData = false;
- Logger.WriteLineWarn($"MigratePackageInfos err, ex:{ex}");
- }
- }
- private void OnUpgradeBussinessDataCommand(object obj)
- {
- if (_bussinessData)
- {
- Logger.WriteLineWarn($"Migrate BussinessData Processing");
- return;
- }
- try
- {
- _bussinessData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.ClearBussinessDatas();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BussinessData err, ex:{ex}");
- }
- finally
- {
- _bussinessData = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BussinessData err, ex:{ex}");
- }
- }
- private void OnReadFeedBackExcelData(object obj)
- {
- if (_readFeedBackData)
- {
- Logger.WriteLineWarn($"Migrate ReadFeedBackExcelData Processing");
- return;
- }
- try
- {
- _readFeedBackData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.ReadFeedBackExcelDataAsync();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"ReadFeedBackExcelData err, ex:{ex}");
- }
- finally
- {
- _readFeedBackData = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"ReadFeedBackExcelData err, ex:{ex}");
- }
- }
- private void OnMigrateBasicData(object obj)
- {
- if (_migrateBasicData)
- {
- Logger.WriteLineWarn($"Migrate BasicData Processing");
- return;
- }
- try
- {
- _migrateBasicData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateBasicInfos(SyncDBEnum.Migrate);
- //await MigrateServiceReal.AddOrg();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineBasicDataAsync err, ex:{ex}");
- }
- finally
- {
- _migrateBasicData = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineBasicDataAsync err, ex:{ex}");
- }
- }
- private void OnDeleteDictionData(object obj)
- {
- if (_migrateDicInfo)
- {
- Logger.WriteLineWarn($"Migrate DeleteDictionData Processing");
- return;
- }
- try
- {
- _migrateDicInfo = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.DeleteRepeatDicData();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Migrate DeleteDictionData err, ex:{ex}");
- }
- finally
- {
- _migrateDicInfo = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Migrate DeleteDictionData err, ex:{ex}");
- }
- }
- /// <summary>
- /// 同步老的代理商用户数据
- /// </summary>
- /// <param name="obj"></param>
- private void OnMigrateIsOldAgentUserInfosData(object obj)
- {
- if (_migrateUserInfo)
- {
- Logger.WriteLineWarn($"Migrate IsOldAgent User Infos Processing");
- return;
- }
- try
- {
- _migrateUserInfo = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateIsOldAgentUserInfos(SyncDBEnum.Synchronize);
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Migrate IsOldAgent User Infos err, ex:{ex}");
- }
- finally
- {
- _migrateUserInfo = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Migrate IsOldAgent User Infos err, ex:{ex}");
- }
- }
- private void OnMigrateBasicUserData(object obj)
- {
- if (_migrateUserInfo)
- {
- Logger.WriteLineWarn($"Migrate User Infos Processing");
- return;
- }
- try
- {
- _migrateUserInfo = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateBasicUserInfos(SyncDBEnum.Migrate);
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateBasicUserInfos err, ex:{ex}");
- }
- finally
- {
- _migrateUserInfo = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateBasicUserInfos err, ex:{ex}");
- }
- }
- private void OnDiffOrganizationData(object obj)
- {
- if (_migrateUserInfo)
- {
- Logger.WriteLineWarn($"Migrate User Infos Processing");
- return;
- }
- try
- {
- _migrateUserInfo = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.DiffOrg();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateBasicUserInfos err, ex:{ex}");
- }
- finally
- {
- _migrateUserInfo = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateBasicUserInfos err, ex:{ex}");
- }
- }
- private void OnMigrateCourseVideo(object obj)
- {
- if (_migrateCourseData)
- {
- Logger.WriteLineWarn($"Migrate CourseVideo Processing");
- return;
- }
- try
- {
- _migrateCourseData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateCourseInfos(SyncDBEnum.Migrate);
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineCourseVideoAsync err, ex:{ex}");
- }
- finally
- {
- _migrateCourseData = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"MigrateOnlineCourseVideoAsync err, ex:{ex}");
- }
- }
- private void OnWingCertifiedInstructorUserMigrate(object obj)
- {
- if (_migrateCertifiedInstructorUser)
- {
- Logger.WriteLineWarn($"Migrate CertifiedInstructorUser Processing");
- return;
- }
- try
- {
- _migrateCertifiedInstructorUser = true;
- Task.Run(async () =>
- {
- try
- {
- //List<Dictionary<string, object>> keyValuePairs = new List<Dictionary<string, object>>();
- //Dictionary<string, object> temp = new Dictionary<string, object>();
- //temp.Add("Name", "武松");
- //temp["Age"] = 28;
- //temp["Birthday"] = DateTime.Now;
- //keyValuePairs.Add(temp);
- //Dictionary<string, object> temp1 = new Dictionary<string, object>();
- //temp1.Add("Name", "睿智深");
- //temp1["Age"] = 31;
- //temp1["Birthday"] = DateTime.Now;
- //keyValuePairs.Add(temp1);
- //List<dynamic> dynamicsList = new List<dynamic>();
- //foreach (Dictionary<string, object> keyValues in keyValuePairs)
- //{
- // dynamic obj = new System.Dynamic.ExpandoObject();
- // foreach (KeyValuePair<string, object> keyValuePair in keyValues)
- // {
- // ((IDictionary<string, object>)obj).Add(keyValuePair.Key, keyValuePair.Value);
- // }
- // dynamicsList.Add(obj);
- //}
- //string paramsText = Newtonsoft.Json.JsonConvert.SerializeObject(dynamicsList);
- //await MigrateServiceReal.MigrateCertifiedInstructorUserInfos(SyncDBEnum.Synchronize);
- //await MigrateServiceReal.GetTrainingBrowsedRecordsDatas(SyncDBEnum.Synchronize);
- await MigrateServiceReal.FindUserAccountInfo();
- //await MigrateServiceReal.SignStudentCourse();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Migrate CertifiedInstructorUser Async err, ex:{ex}");
- }
- finally
- {
- _migrateCertifiedInstructorUser = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Migrate CertifiedInstructorUser Async err, ex:{ex}");
- }
- }
- private void OnWingUpgradeMigrate(object obj)
- {
- if (_migrateUpgrade)
- {
- Logger.WriteLineWarn($"Migrate Upgrade Processing");
- return;
- }
- try
- {
- _migrateUpgrade = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateUpgradeInfos();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Migrate Upgrade Async err, ex:{ex}");
- }
- finally
- {
- _migrateUpgrade = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"Migrate Upgrade Async err, ex:{ex}");
- }
- }
- //远程
- private void OnMigrateSpecialReport(object obj)
- {
- if (_migrateSpecialReport)
- {
- Logger.WriteLineWarn($"OnMigrateSpecialReport Processing");
- }
- else if (!string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- try
- {
- if (ReportEndDate < ReportBeginDate)
- {
- Logger.WriteLineError($"BeginDate Not Greater EndDate");
- }
- else
- {
- _migrateSpecialReport = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateSpeicalReportInfoResults(ReportBeginDate, ReportEndDate);
- _migrateSpecialReport = false;
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateSpecialReport err, ex:{ex}");
- }
- finally
- {
- _migrateSpecialReport = false;
- }
- });
- }
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateSpecialReport err, ex:{ex}");
- }
- }
- else
- {
- Logger.WriteLineWarn($"2.0Server Url Is Empty");
- }
- }
- //访问网站获取响应
- private void OnMTryVisitWeb(object obj)
- {
- if (_visitWeb)
- {
- Logger.WriteLineWarn($"OnMTryVisitWeb Processing");
- }
- Task.Run(async () =>
- {
- while (true)
- {
- try
- {
- await TryVisitWeb();
- _visitWebErrorNum = 0;
- }
- catch (Exception ex)
- {
- _visitWebErrorNum++;
- if (_visitWebErrorNum == 2)
- {
- Logger.WriteLineError("TryVisitWeb error");
- await SendNoticeSmail("303579937@qq.com");
- await SendNoticeSmail("15506154416@163.com");
- await SendNoticeSmail("4087016@qq.com");
- }
- }
- finally
- {
- }
- await Task.Delay(1000 * 60);
- }
- });
- }
- public async Task<bool> TryVisitWeb()
- {
- try
- {
- string url = "http://s01.flyinsono.com:9090/";
- HttpClient client = new HttpClient();
- client.Timeout = TimeSpan.FromSeconds(30);
- var response = client.GetAsync(url).Result;
- Console.WriteLine("Response obtained successfully!");
- }
- catch (WebException ex)
- {
- // If there is no response or an error occurs, perform other actions here
- Console.WriteLine("No response obtained. Performing additional tasks...");
- // TODO: Add your custom code here to handle the situation when there is no response
- }
- return true;
- }
- public async Task<bool> SendNoticeSmail(string email)
- {
- try
- {
- var url = "https://bj.flyinsono.com/ILoginService";
- var payload = new
- {
- jsonrpc = "2.0",
- method = "SendEmailVerificationCodeAsync",
- @params = new[]
- {
- new
- {
- LanguageCode = "zh-CN",
- EmailAddress = email
- }
- },
- id = 531560752
- };
- using (var httpClient = new HttpClient())
- {
- var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload);
- var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
- var response = await httpClient.PostAsync(url, content);
- if (response.IsSuccessStatusCode)
- {
- var responseContent = await response.Content.ReadAsStringAsync();
- Console.WriteLine(responseContent);
- }
- else
- {
- Console.WriteLine("An error occurred: " + response.StatusCode);
- }
- }
- }
- catch (Exception ex)
- {
- }
- return true;
- }
- //远程
- private void OnMigrateRemoteRecordToWing(object obj)
- {
- if (_migrateRemedicalRecord)
- {
- Logger.WriteLineWarn($"OnMigrateRemoteRecordToWing Processing");
- }
- else if (!string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- try
- {
- _migrateRemedicalRecord = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateRemedicalRecords(SyncDBEnum.Migrate);
- _migrateRemedicalRecord = false;
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateRemoteRecordToWing err, ex:{ex}");
- }
- finally
- {
- _migrateRemedicalRecord = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateRemoteRecordToWing err, ex:{ex}");
- }
- }
- else
- {
- Logger.WriteLineWarn($"2.0Server Url Is Empty");
- }
- }
- //图像
- private void OnMigrateRemeteDataToWing(object obj)
- {
- if (_migrateRemedicalData)
- {
- Logger.WriteLineWarn($"OnMigrateRemeteDataToWing Processing");
- }
- else if (!string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- try
- {
- _migrateRemedicalData = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateRemedicalDatas(SyncDBEnum.Migrate, 1);
- _migrateRemedicalData = false;
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateRemeteDataToWing err, ex:{ex}");
- }
- finally
- {
- _migrateRemedicalData = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateRemeteDataToWing err, ex:{ex}");
- }
- }
- else
- {
- Logger.WriteLineWarn($"2.0Server Url Is Empty");
- }
- }
- //AI
- private void OnMigrateAIDataToWing(object obj)
- {
- if (_migrateAI)
- {
- Logger.WriteLineWarn($"OnMigrateAIDataToWing Processing");
- }
- else if (!string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- try
- {
- _migrateAI = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateRemedicalAIDatas(SyncDBEnum.Migrate);
- _migrateAI = false;
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateAIDataToWing err, ex:{ex}");
- }
- finally
- {
- _migrateAI = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateAIDataToWing err, ex:{ex}");
- }
- }
- else
- {
- Logger.WriteLineWarn($"2.0Server Url Is Empty");
- }
- }
- //颈动脉AI
- private void OnMigrateCarotidToWing(object obj)
- {
- if (_migrateCarotid)
- {
- Logger.WriteLineWarn($"OnMigrateCarotidToWing Processing");
- }
- else if (!string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- try
- {
- _migrateCarotid = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateRemedicalCarotidDatas(SyncDBEnum.Migrate);
- _migrateCarotid = false;
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateCarotidToWing err, ex:{ex}");
- }
- finally
- {
- _migrateCarotid = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateCarotidToWing err, ex:{ex}");
- }
- }
- else
- {
- Logger.WriteLineWarn($"2.0Server Url Is Empty");
- }
- }
- //会诊
- private void OnMigrateConsultationToWing(object obj)
- {
- if (_migrateConsultation)
- {
- Logger.WriteLineWarn($"OnMigrateConsultationToWing Processing");
- }
- else if (!string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- try
- {
- _migrateConsultation = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateConsultationResults(SyncDBEnum.Migrate);
- _migrateConsultation = false;
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateConsultationToWing err, ex:{ex}");
- }
- finally
- {
- _migrateConsultation = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateConsultationToWing err, ex:{ex}");
- }
- }
- else
- {
- Logger.WriteLineWarn($"2.0Server Url Is Empty");
- }
- }
- private async void OnClearColdDataCommand(object obj)
- {
- try
- {
- Task.Run(async () =>
- {
- try
- {
- await FilterTestService.DeleteColdData();
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BeginClearColdData err, ex:{ex}");
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"BeginClearColdData err, ex:{ex}");
- }
- }
- //报告
- private void OnMigrateReportToWing(object obj)
- {
- if (_migrateReportResult)
- {
- Logger.WriteLineWarn($"OnMigrateReportToWing Processing");
- }
- else if (!string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- try
- {
- _migrateReportResult = true;
- Task.Run(async () =>
- {
- try
- {
- await MigrateServiceReal.MigrateReportInfoResults(SyncDBEnum.Migrate);
- _migrateReportResult = false;
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateReportToWing err, ex:{ex}");
- }
- finally
- {
- _migrateReportResult = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnMigrateReportToWing err, ex:{ex}");
- }
- }
- else
- {
- Logger.WriteLineWarn($"2.0Server Url Is Empty");
- }
- }
- //报告
- private void OnSynchronizeTerminalRecord(object obj)
- {
- if (_synchronizeTerminalRecord)
- {
- Logger.WriteLineWarn($"OnSynchronizeTerminalRecord Processing");
- }
- else if (!string.IsNullOrWhiteSpace(WingServiceUrl))
- {
- try
- {
- _synchronizeTerminalRecord = true;
- Task.Run(async () =>
- {
- try
- {
- if (!string.IsNullOrWhiteSpace(TerminalRecordCode))
- {
- await MigrateServiceReal.SynchronizeByTerminalRecordCode(TerminalRecordCode);
- }
- else
- {
- var startTime = CommonConfigManager.TerminalRecordSync.StartTime;
- var endTime = CommonConfigManager.TerminalRecordSync.EndTime;
- Logger.WriteLineInfo($"OnSynchronizeTerminalRecord startTime:{startTime}");
- Logger.WriteLineInfo($"OnSynchronizeTerminalRecord endTime:{endTime}");
- await MigrateServiceReal.SynchronizeByTimeRange(startTime, endTime);
- }
- _synchronizeTerminalRecord = false;
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnSynchronizeTerminalRecord err, ex:{ex}");
- }
- finally
- {
- _synchronizeTerminalRecord = false;
- }
- });
- }
- catch (Exception ex)
- {
- Logger.WriteLineWarn($"OnSynchronizeTerminalRecord err, ex:{ex}");
- }
- }
- else
- {
- Logger.WriteLineWarn($"2.0Server Url Is Empty");
- }
- }
- }
- }
|