49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using CRM.Core.BLL.EventBus.Events;
|
|
using CRM.Core.BLL.Util;
|
|
using CRM.Core.Common.EventBus;
|
|
using CRM.Core.DTO;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using WX.CRM.Common;
|
|
|
|
namespace CRM.Core.BLL.EventBus.EventHandlers
|
|
{
|
|
public class SetPayNameEventHandler : IEventHandler<SetPayNameEvent>
|
|
{
|
|
private CACHE_BL _cache = new CACHE_BL();
|
|
public void Handle(SetPayNameEvent @event)
|
|
{
|
|
try
|
|
{
|
|
LogHelper.Info("重置支付姓名事件:" + @event.ToJson());
|
|
|
|
//根据渠道号获取部门编码
|
|
var ch = @event.Channel;
|
|
var companyCode = _cache.GetCompanyCode();
|
|
var company = companyCode.FirstOrDefault(p => p.Min <= ch && p.Max >= ch);
|
|
|
|
var host = Utility.GetSettingOrNullByKey("DataSyncApiUrl");
|
|
var url = host + "/api/DataSync";
|
|
|
|
var para = new SYNC_PUSH_DTO()
|
|
{
|
|
bidatatype = "Client_SetPayName",
|
|
deptcode = company.CompanyCode,
|
|
jsontext = @event.ToJson()
|
|
};
|
|
|
|
var rep = Utility.PostAjaxData(url, para.ToJson(), Encoding.UTF8);
|
|
var ret = Utility.JSONToObject<retMsg>(rep);
|
|
if (!ret.result)
|
|
LogHelper.Error("接口 SetPayNameEventHandler 写入失败!");
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex.ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|