You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
184 lines
6.1 KiB
184 lines
6.1 KiB
using CK.SCP.Controller.WebReference;
|
|
using CK.SCP.Models.UniApiEntity;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CK.SCP.Controller
|
|
{
|
|
public class ExchangeCenterFactoryController
|
|
{
|
|
public IExchangeCenterService CreateExchangeCenterService(string doMain)
|
|
{
|
|
switch (doMain.ToUpper())
|
|
{
|
|
case "BJBMPT": //北京
|
|
return new BJExchangeCenterService();
|
|
case "CQBMPT": //重庆
|
|
return new CQExchangeCenterService();
|
|
case "HFBMPT": //合肥
|
|
return new HFExchangeCenterService();
|
|
case "CDBMPT": //成都
|
|
return new CDExchangeCenterService();
|
|
case "ZZBMPT": //株洲
|
|
return new ZZExchangeCenterService();
|
|
default:
|
|
throw new ArgumentException("Invalid Domain is empty!");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public interface IExchangeCenterService
|
|
{
|
|
string GetSessionId();
|
|
string UpdateTaskState(string sessionId, string taskID, int taskState, int failedCount, string failedInfo);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 北京
|
|
/// http://10.60.101.3:8009/ExchangeCenterService.asmx
|
|
/// </summary>
|
|
public class BJExchangeCenterService : IExchangeCenterService
|
|
{
|
|
private BJ.ExchangeCenterService service;
|
|
|
|
public BJExchangeCenterService()
|
|
{
|
|
service = new BJ.ExchangeCenterService();
|
|
}
|
|
|
|
public string GetSessionId()
|
|
{
|
|
var jsonResult = service.GetSessionId("SCP", "5C2DE907DB859810", "");
|
|
var serviceResultEntityList = JsonConvert.DeserializeObject<List<ServiceResult>>(jsonResult);
|
|
string sessionId = serviceResultEntityList.First().Data;
|
|
return sessionId;
|
|
}
|
|
|
|
public string UpdateTaskState(string sessionId, string taskID, int taskState, int failedCount, string failedInfo)
|
|
{
|
|
string result = service.UpdateTaskState(sessionId, taskID, taskState, failedCount, failedInfo);
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 重庆
|
|
/// http://10.60.101.85:8010/ExchangeCenterService.asmx
|
|
/// </summary>
|
|
public class CQExchangeCenterService : IExchangeCenterService
|
|
{
|
|
private CQ.ExchangeCenterService service;
|
|
|
|
public CQExchangeCenterService()
|
|
{
|
|
service = new CQ.ExchangeCenterService();
|
|
}
|
|
|
|
public string GetSessionId()
|
|
{
|
|
var jsonResult = service.GetSessionId("SCP", "5C2DE907DB859810", "");
|
|
var serviceResultEntityList = JsonConvert.DeserializeObject<List<ServiceResult>>(jsonResult);
|
|
string sessionId = serviceResultEntityList.First().Data;
|
|
return sessionId;
|
|
}
|
|
|
|
public string UpdateTaskState(string sessionId, string taskID, int taskState, int failedCount, string failedInfo)
|
|
{
|
|
string result = service.UpdateTaskState(sessionId, taskID, taskState, failedCount, failedInfo);
|
|
return result;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 合肥
|
|
/// http://10.60.101.3:8012/ExchangeCenterService.asmx
|
|
/// </summary>
|
|
public class HFExchangeCenterService : IExchangeCenterService
|
|
{
|
|
private HF.ExchangeCenterService service;
|
|
|
|
public HFExchangeCenterService()
|
|
{
|
|
service = new HF.ExchangeCenterService();
|
|
}
|
|
|
|
public string GetSessionId()
|
|
{
|
|
var jsonResult = service.GetSessionId("SCP", "5C2DE907DB859810", "");
|
|
var serviceResultEntityList = JsonConvert.DeserializeObject<List<ServiceResult>>(jsonResult);
|
|
string sessionId = serviceResultEntityList.First().Data;
|
|
return sessionId;
|
|
}
|
|
|
|
public string UpdateTaskState(string sessionId, string taskID, int taskState, int failedCount, string failedInfo)
|
|
{
|
|
string result = service.UpdateTaskState(sessionId, taskID, taskState, failedCount, failedInfo);
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 成都
|
|
/// http://10.60.101.85:8070/ExchangeCenterService.asmx
|
|
/// </summary>
|
|
public class CDExchangeCenterService : IExchangeCenterService
|
|
{
|
|
private CD.ExchangeCenterService service;
|
|
|
|
public CDExchangeCenterService()
|
|
{
|
|
service = new CD.ExchangeCenterService();
|
|
}
|
|
|
|
public string GetSessionId()
|
|
{
|
|
var jsonResult = service.GetSessionId("SCP", "5C2DE907DB859810", "");
|
|
var serviceResultEntityList = JsonConvert.DeserializeObject<List<ServiceResult>>(jsonResult);
|
|
string sessionId = serviceResultEntityList.First().Data;
|
|
return sessionId;
|
|
}
|
|
|
|
public string UpdateTaskState(string sessionId, string taskID, int taskState, int failedCount, string failedInfo)
|
|
{
|
|
string result = service.UpdateTaskState(sessionId, taskID, taskState, failedCount, failedInfo);
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 株洲
|
|
/// http://10.60.101.3:8011/ExchangeCenterService.asmx
|
|
/// </summary>
|
|
public class ZZExchangeCenterService : IExchangeCenterService
|
|
{
|
|
private ZZ.ExchangeCenterService service;
|
|
|
|
public ZZExchangeCenterService()
|
|
{
|
|
service = new ZZ.ExchangeCenterService();
|
|
}
|
|
|
|
public string GetSessionId()
|
|
{
|
|
var jsonResult = service.GetSessionId("SCP", "5C2DE907DB859810", "");
|
|
var serviceResultEntityList = JsonConvert.DeserializeObject<List<ServiceResult>>(jsonResult);
|
|
string sessionId = serviceResultEntityList.First().Data;
|
|
return sessionId;
|
|
}
|
|
|
|
public string UpdateTaskState(string sessionId, string taskID, int taskState, int failedCount, string failedInfo)
|
|
{
|
|
string result = service.UpdateTaskState(sessionId, taskID, taskState, failedCount, failedInfo);
|
|
return result;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|