235 lines
7.5 KiB
C#
235 lines
7.5 KiB
C#
using CRM.Core.BLL.Util;
|
|
using CRM.Core.BLL.Wx;
|
|
using CRM.Core.Common.WebHelper;
|
|
using CRM.Core.Model.Entity;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.Common.BlowFish;
|
|
|
|
namespace Core.Web.Controllers
|
|
{
|
|
public class ComplianceController : Controller
|
|
{
|
|
private readonly WX_SZZYORDER_BL _order;
|
|
|
|
private readonly WX_ComplianceConfirm_BL _confirm;
|
|
|
|
private readonly CACHE_BL _cache;
|
|
|
|
private readonly SecurityHelper sHelper;
|
|
private readonly Wx_Tran_User_BL _wxTranUser;
|
|
|
|
public ComplianceController()
|
|
{
|
|
_order = new WX_SZZYORDER_BL();
|
|
_confirm = new WX_ComplianceConfirm_BL();
|
|
_cache = new CACHE_BL();
|
|
sHelper = new SecurityHelper();
|
|
_wxTranUser = new Wx_Tran_User_BL();
|
|
}
|
|
|
|
|
|
// GET: Compliance
|
|
//[AuthorizeRedirect(RightsConfig.CONST_订单列表, ToolBarConfig.CONST_Other5, false)]
|
|
public ActionResult Index(int orderId)
|
|
{
|
|
var url = _cache.GetValue_Parameter("ComplianceAudit");
|
|
var model = _order.GetModel(orderId);
|
|
if (model != null)
|
|
{
|
|
if (string.IsNullOrEmpty(url))
|
|
{
|
|
url = string.Format("{2}/Compliance/Audit?orderId={0}&sId={1}", model.ORDERID, Utility.UserMd5(model.SZZYORDERID.Value.ToString()), "https://qm.dn8188.com:4033");
|
|
}
|
|
else
|
|
{
|
|
url = string.Format("{2}/Compliance/Audit?orderId={0}&sId={1}", model.ORDERID, Utility.UserMd5(model.SZZYORDERID.Value.ToString()), url);
|
|
}
|
|
}
|
|
ViewBag.url = url;
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Audit(int orderId, string sId)
|
|
{
|
|
var model = _order.Get(p => p.ORDERID == orderId);
|
|
|
|
ViewBag.code = null;
|
|
|
|
if (model == null)
|
|
{
|
|
return View(model);
|
|
}
|
|
try
|
|
{
|
|
var md5 = Utility.UserMd5(model.SZZYORDERID.Value.ToString());
|
|
|
|
if (sId != md5)
|
|
{
|
|
model = null;
|
|
return View(model);
|
|
}
|
|
|
|
var companyList = _cache.GetList_innerCompany();
|
|
var company = companyList.FirstOrDefault(p => p.MINCHANNELCODE <= model.CHANNEL && p.MAXCHANNELCODE >= model.CHANNEL);
|
|
if (company != null)
|
|
{
|
|
ViewBag.code = company.SYSTEMCODE;
|
|
}
|
|
else
|
|
{
|
|
model = null;
|
|
return View(model);
|
|
}
|
|
|
|
var confirmModel = _confirm.Get(p => p.SzzyOrderId == model.SZZYORDERID.Value);
|
|
if (confirmModel == null)
|
|
{
|
|
ViewBag.isConfirm = false;
|
|
ViewBag.confirmTime = null;
|
|
}
|
|
else
|
|
{
|
|
ViewBag.isConfirm = true;
|
|
ViewBag.confirmTime = confirmModel.ConfirmTime;
|
|
}
|
|
|
|
//if (model.RETURNNEEDPAY.HasValue && model.PRODUCTID == 1008)
|
|
//{
|
|
// model.NEEDPAY = model.RETURNNEEDPAY;
|
|
//}
|
|
|
|
var riskinfoUrl = _cache.GetValue_Parameter("riskinfo");
|
|
|
|
if (string.IsNullOrEmpty(riskinfoUrl))
|
|
{
|
|
riskinfoUrl = "https://r2.soft.dn8188.com/contract_sign_crm/get_riskinfo";
|
|
}
|
|
|
|
var bf = "{\"uid\": \"" + model.SOFTUSERNAME + "\",\"htid\":\"DN" + model.SZZYORDERID.Value.ToString() + "\"}";
|
|
var hqr = BlowFish.encode(bf);
|
|
var para = new { hqr };
|
|
var res = Utility.PostAjaxData(riskinfoUrl, para.ToJson(), Encoding.UTF8);
|
|
var ret = JsonHelper.JsonDivertToObj<RiskInfoDto>(res);
|
|
LogHelper.Info(ret.ToJson());
|
|
if (ret.ret == 0)
|
|
{
|
|
model.idcard = ret.idCard;
|
|
model.CNAME = ret.name;
|
|
|
|
ViewBag.businesstype = ret.businesstype;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex.ToString());
|
|
}
|
|
|
|
return View(model);
|
|
}
|
|
|
|
[HttpPost]
|
|
public JsonResult Save(long orderId)
|
|
{
|
|
var ip = Utility.GetIp();
|
|
LogHelper.Info("orderId:" + orderId + "--IP:" + ip);
|
|
|
|
var order = _order.Get(p => p.SZZYORDERID == orderId);
|
|
if (order != null)
|
|
{
|
|
//如果已经通过,重签就不处理
|
|
if (order.RISKCTRLSTATUS != 2)
|
|
{
|
|
if (order.RISKCTRLSTATUS == -1)
|
|
{
|
|
order.RISKCTRLSTATUS = 0;
|
|
_order.Update(order);
|
|
}
|
|
}
|
|
}
|
|
|
|
var isExists = _confirm.Exists(p => p.SzzyOrderId == orderId);
|
|
if (isExists)
|
|
{
|
|
return Json(new { result = true, code = 100, message = "exists" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
try
|
|
{
|
|
var info = new WX_ComplianceConfirm()
|
|
{
|
|
SzzyOrderId = orderId,
|
|
ConfirmTime = DateTime.Now,
|
|
OutOrderNo = string.Empty,
|
|
Ip = ip
|
|
};
|
|
_confirm.Add(info);
|
|
|
|
return Json(new { result = true, code = 200, message = "success" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex.ToString());
|
|
return Json(new { result = false, code = 500, message = "error" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
|
|
[HttpGet]
|
|
public ActionResult NewRisk(string content, string sign, string clientid,bool decode = true)
|
|
{
|
|
if (decode)
|
|
{
|
|
content = HttpUtility.UrlDecode(content);
|
|
sign = HttpUtility.UrlDecode(sign);
|
|
}
|
|
|
|
//验证是否非法请求
|
|
if (!sHelper.CheckClientValid(clientid, content, sign))
|
|
{
|
|
return Content("非法请求");
|
|
}
|
|
|
|
var newcontent = sHelper.decyptData(clientid, content); //解密操作
|
|
|
|
var result = Utility.JSONToObject<RiskInfoDto>(newcontent);
|
|
return View(result);
|
|
}
|
|
|
|
[HttpPost]
|
|
public JsonResult GetTranUser(string umid)
|
|
{
|
|
try
|
|
{
|
|
var model = _wxTranUser.Get(p => p.umid == umid);
|
|
if (model != null)
|
|
{
|
|
return Json(new { result = true, data = model.ToJson() }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex);
|
|
}
|
|
return Json(null, JsonRequestBehavior.AllowGet);
|
|
}
|
|
}
|
|
|
|
public class RiskInfoDto
|
|
{
|
|
public int ret { get; set; }
|
|
public string answer { get; set; }
|
|
public Int64 createTime { get; set; }
|
|
public string idCard { get; set; }
|
|
public string name { get; set; }
|
|
public string key { get; set; }
|
|
public string style { get; set; }
|
|
public int index { get; set; }
|
|
public string businesstype { get; set; }
|
|
public int paperId { get; set; }
|
|
|
|
}
|
|
} |