ComplianceServer/oldcode/WX.CRM.DataSynFactory/Cmd/Client_OrderAndPayInfo_IMP.cs

138 lines
6.1 KiB
C#

using System;
using WX.CRM.BLL.Base;
using WX.CRM.BLL.Res;
using WX.CRM.BLL.Wx;
using WX.CRM.Common;
using WX.CRM.DataSynFactory.Templates;
using WX.CRM.Model.Entity;
namespace WX.CRM.DataSynFactory.Cmd
{
public class Client_OrderAndPayInfo_IMP : Interfaces.IDataImportSvr<Client_OrderAndPayInfo>
{
private WX_SZZYORDER_BL _order = new WX_SZZYORDER_BL();
private WX_SZZYORDERDEPOSIT_BL _orderDeposit = new WX_SZZYORDERDEPOSIT_BL();
private WX_SZZYORDERPAY_BL _orderPay = new WX_SZZYORDERPAY_BL();
private WX_ORDEREXT_BL _orderExtend = new WX_ORDEREXT_BL();
RES_CUSTOMER_BL res_Customer_BL = new RES_CUSTOMER_BL();
private BAS_INNERUSER_BL _user = new BAS_INNERUSER_BL();
private WX_SZZYSUBPRODUCT_BL _subProduct = new WX_SZZYSUBPRODUCT_BL();
public bool GenerateBusinessOne(Client_OrderAndPayInfo t)
{
try
{
///订单信息同步
if (t.orderList != null && t.orderList.Count > 0)
{
foreach (var item in t.orderList)
{
var order = _order.Get(m => m.ORDERID == item.OrderId);
if (order == null)
continue;
order.ORDERSTATUS = item.OrderStatus;
order.ORDERSTATUSNAME = item.OrderStatusName;
order.ARRIVALPAY = item.Arrivalpay;
order.ARRIVALTIME = item.Arrivaltime;
order.CNAME = item.CName;
order.FINALPAY = item.FinalPay;
_order.Update(order);///订单信息修改
}
}
///订金流水信息同步
if (t.depositList != null && t.depositList.Count > 0)
{
foreach (var item in t.depositList)
{
var deposit = _orderDeposit.Get(m => m.ID == item.Id);
if (deposit == null)
continue;
deposit.PAYTYPE = item.PayType;
deposit.PAYTYPENAME = item.PayTypeName;
deposit.AUDITSTATUS = item.AuditStatus;//审核状态
deposit.ISDELETE = item.IsDelete;
deposit.AUDITOR = item.Auditor;
deposit.AUDITORNAME = item.AuditorName;
deposit.AUDITTIME = item.AuditTime;
deposit.LASTPRICE = item.LastPrice;
deposit.USEPRICE = item.UsePrice;
deposit.FROZENPRICE = item.FrozenPrice;
_orderDeposit.Update(deposit);///订单信息修改
}
}
///支付使用情况
if (t.payList != null && t.payList.Count > 0)
{
foreach (var item in t.payList)
{
var pay = _orderPay.Get(m => m.SID == item.id);//座席端存了一份pay的id
if (pay != null)
{
pay.AUDITOR = item.auditor;
pay.AUDITORNAME = item.auditorname;
pay.AUDITSTATUS = item.auditstatus;
pay.AUDITTIME = item.audittime;
pay.CREATOR = item.creator;
pay.CREATORNAME = item.creatorname;
pay.DEPOSITID = item.depositid;
pay.ISDELETE = item.isdelete;
pay.NEEDPAY = item.needpay;
pay.ORDERID = item.orderid;
pay.PAYDATE = item.paydate;
pay.PAYNAME = item.payname;
pay.PAYNO = item.payno;
pay.PAYPRICE = item.payprice;
pay.PAYTYPE = item.paytype;
pay.PAYTYPENAME = item.paytypename;
pay.REJECTREMARK = item.rejectremark;
pay.REMARK = item.remark;
pay.TRADENO = item.tradeno;
_orderPay.Update(pay);//修改数据
}
else
{
var info = new WX_SZZYORDERPAY()
{
ID = new SEQUENCES_BL().Seq_base_get(),
AUDITOR = item.auditor,
AUDITORNAME = item.auditorname,
AUDITSTATUS = item.auditstatus,
AUDITTIME = item.audittime,
CREATOR = item.creator,
CREATORNAME = item.creatorname,
CTIME = DateTime.Now,
DEPOSITID = item.depositid,
ISDELETE = item.isdelete,
NEEDPAY = item.needpay,
ORDERID = item.orderid,
PAYDATE = item.paydate,
PAYNAME = item.payname,
PAYNO = item.payno,
PAYPRICE = item.payprice,
PAYTYPE = item.paytype,
PAYTYPENAME = item.paytypename,
REJECTREMARK = item.rejectremark,
REMARK = item.remark,
TRADENO = item.tradeno,
SID = item.id
};
_orderPay.Add(info);///订单信息修改
}
}
}
return true;
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
LogHelper.Error("错误的json:" + t.ToJson());
return false;
}
}
}
}