81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using Quartz;
|
|
using System;
|
|
using System.Data;
|
|
using System.Web;
|
|
using WX.CRM.BLL.Base;
|
|
using WX.CRM.BLL.Res;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
|
|
namespace WX.CRM.CRMServices.Res
|
|
{
|
|
/// <summary>
|
|
/// 将RES_AUTODIAL_POOL表的数据转移到CTI的Mysql自动外呼表中去
|
|
/// </summary>
|
|
public class AutoDialJob : IJob
|
|
{
|
|
static bool _isNotice = false;
|
|
public void Execute(JobExecutionContext context)
|
|
{
|
|
if (_isNotice)
|
|
return;
|
|
_isNotice = true;
|
|
try
|
|
{
|
|
new AutoDial().start();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
WX.CRM.Common.LogHelper.Error("WX.CRM.CRMServices.Res.AutoDialJob().Execute:" + e.ToString());
|
|
}
|
|
finally
|
|
{
|
|
_isNotice = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public class AutoDial
|
|
{
|
|
/// <summary>
|
|
/// 启动数同步
|
|
/// </summary>
|
|
public void start()
|
|
{
|
|
var _num_encypt = new BAS_PARAMETER_BL().GetModel_Patameter("SYS_CALLOUT_NUM_ENCYPTDES");
|
|
var _bol_encypt = false;
|
|
if (_num_encypt != null && _num_encypt.PARAVALUE.ToLower() == "true")
|
|
{
|
|
_bol_encypt = true;
|
|
}
|
|
string clientid = Utility.GetSettingByKey("CRMClientKey");
|
|
AutoDial_BL bl = new AutoDial_BL();
|
|
DataTable tab = bl.GetAutoDialPool();
|
|
SecurityHelper sHelper = new SecurityHelper();
|
|
foreach (DataRow item in tab.Rows)
|
|
{
|
|
//LogHelper.Error("oracle号码:" + item["mobile"].ToString());
|
|
string mobile = sHelper.decyptData(clientid, item["mobile"].ToString());
|
|
//LogHelper.Error("解密号码:"+mobile);
|
|
string resid = item["resid"].ToString();
|
|
try
|
|
{
|
|
if (_bol_encypt)//DES加密
|
|
{
|
|
mobile = sHelper.encyptCtiNumStr(mobile.Trim());
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex);
|
|
}
|
|
mobile = HttpUtility.UrlEncode(mobile);
|
|
//LogHelper.Error("CTI号码:" + mobile);
|
|
bl.InsertDataToMySql(mobile, resid);//号码插入
|
|
}
|
|
if (tab.Rows.Count > 0)
|
|
bl.ClearAutoDialPool();//数据清理
|
|
}
|
|
|
|
}
|
|
} |