73 lines
2.8 KiB
C#
73 lines
2.8 KiB
C#
using CRM.Core.BLL.Base;
|
|
using CRM.Core.BLL.EventBus.Events;
|
|
using CRM.Core.BLL.Wx;
|
|
using CRM.Core.Common.EventBus;
|
|
using CRM.Core.DTO;
|
|
using System;
|
|
using System.Text;
|
|
using WX.CRM.Common;
|
|
|
|
namespace CRM.Core.BLL.EventBus.EventHandlers
|
|
{
|
|
public class OpenOrderEventHandler : IEventHandler<OpenOrderEvent>
|
|
{
|
|
private readonly Bas_ActLog_BL _actLog = new Bas_ActLog_BL();
|
|
private readonly WX_SZZYORDER_BL _order = new WX_SZZYORDER_BL();
|
|
public void Handle(OpenOrderEvent @event)
|
|
{
|
|
try
|
|
{
|
|
LogHelper.Info("开通订单事件执行" + @event.ToJson());
|
|
|
|
//try
|
|
//{
|
|
// //http://post.hc.dn8188.com/Rights/orderback.html
|
|
// var noticeUrl = Utility.GetSettingByKey("noticeUrl");
|
|
// if (!string.IsNullOrEmpty(noticeUrl))
|
|
// {
|
|
// Utility.GetData(noticeUrl, "orderid=" + @event.OrderId.ToString() + "&type=1&values=" + @event.OrderStatus, Encoding.UTF8);
|
|
// }
|
|
//}
|
|
//catch (Exception exx)
|
|
//{
|
|
// LogHelper.Error("通知前端错误:" + exx.ToString());
|
|
//}
|
|
|
|
|
|
var host = Utility.GetSettingOrNullByKey("DataSyncApiUrl");
|
|
var url = host + "/api/DataSync";
|
|
|
|
//var para = new SYNC_PUSH_DTO()
|
|
//{
|
|
// bidatatype = "Client_OpenOrder",
|
|
// deptcode = @event.DeptCode,
|
|
// jsontext = new { @event.OrderId, @event.OrderStatus, @event.OrderStatusName, @event.OTime, @event.EndTime, @event.ActiveProductCode, @event.ActiveProductExt, @event.CName, @event.ResId }.ToJson()
|
|
//};
|
|
var order = _order.Get(p => p.ORDERID == @event.OrderId);
|
|
var para = new SYNC_PUSH_DTO()
|
|
{
|
|
bidatatype = "Client_Order",
|
|
deptcode = order.companycode,
|
|
jsontext = order.ToJson()
|
|
};
|
|
|
|
var rep = Utility.PostAjaxData(url, para.ToJson(), Encoding.UTF8);
|
|
var ret = Utility.JSONToObject<retMsg>(rep);
|
|
if (!ret.result)
|
|
LogHelper.Error("接口 OpenOrderEventHandler 写入失败!");
|
|
|
|
if (@event.Operator.HasValue)
|
|
{
|
|
_actLog.Add(new Model.Entity.Bas_ActLog() { ActType = 1, ActTypeName = "开通订单", Operaor = @event.Operator.Value, OperatorName = @event.OperatorName, Status = 1, OperationTime = DateTime.Now, Remark = "开通订单", OrderId = @event.OrderId });
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex.ToString());
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|