69 lines
2.5 KiB
C#
69 lines
2.5 KiB
C#
using System;
|
|
using System.Text;
|
|
using System.Web;
|
|
using WX.CRM.BLL.Base;
|
|
using WX.CRM.BLL.Res;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.DataSynFactory.Templates;
|
|
using WX.CRM.Model.Entity;
|
|
|
|
namespace WX.CRM.DataSynFactory.Cmd
|
|
{
|
|
public class Client_ActiveAllDept_IMP : Interfaces.IDataImportSvr<Client_ActiveAllDept>
|
|
{
|
|
private RES_CUSTOMER_BL _customer = new RES_CUSTOMER_BL();
|
|
private RES_APPLY_UNKNOWN_BL _res = new RES_APPLY_UNKNOWN_BL();
|
|
private SecurityHelper sHelper = new SecurityHelper();
|
|
public bool GenerateBusinessOne(Client_ActiveAllDept t)
|
|
{
|
|
try
|
|
{
|
|
var res = new RES_APPLY_UNKNOWN()
|
|
{
|
|
PKID = new SEQUENCES_BL().Seq_base_get(),
|
|
CONTENT = HttpUtility.UrlEncode(t.content),
|
|
CLIENTID = t.clientid,
|
|
SIGN = HttpUtility.UrlEncode(t.sign),
|
|
RESID = t.resid,
|
|
RESOURCETAG = t.resourcetag,
|
|
CTIME = DateTime.Now
|
|
};
|
|
var customer = _customer.getResCustomerByResId(t.resid);
|
|
//如果能找到记录,就按正常流程进入资源,否则不处理
|
|
if (customer != null)
|
|
{
|
|
var url = string.Format("http://localhost:806/ResourceService.svc/Join?content={0}&clientid={1}&sign={2}", HttpUtility.UrlEncode(t.content), t.clientid, HttpUtility.UrlEncode(t.sign));
|
|
//LogHelper.Info("url:" + url);
|
|
var rep = Utility.PostData(url, Encoding.UTF8);
|
|
//LogHelper.Info("rep:" + rep);
|
|
var decyptRep = sHelper.decyptData("UPWEBSITE", HttpUtility.UrlDecode(Utility.JSONToObject<string>(rep)));
|
|
var obj = Utility.JSONToObject<retObj>(decyptRep);
|
|
if (obj.result)
|
|
{
|
|
res.ISEXISTS = 1;
|
|
_res.Add(res);
|
|
}
|
|
return obj.result;
|
|
}
|
|
else
|
|
{
|
|
res.ISEXISTS = 0;
|
|
_res.Add(res);
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error("Client_ActiveAllDept,营业部入库失败:" + ex);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
private class retObj
|
|
{
|
|
public bool result { get; set; }
|
|
}
|
|
}
|
|
}
|