ComplianceServer/oldcode/WEB/Controllers/Csvr/CustomerUCController.cs

2765 lines
121 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Aop.Api.Domain;
//using CRM.Core.DTO;
//using CRM.Core.DTO.Res;
using Newtonsoft.Json;
using Ninject;
using NPOI.HSSF.Record;
using NPOI.SS.Formula.Functions;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Xml.Serialization;
using WX.CRM.BLL.Soft;
using WX.CRM.BLL.Util;
using WX.CRM.BLL.Wx;
using WX.CRM.Common;
using WX.CRM.IBLL.Base;
using WX.CRM.IBLL.Csvr;
using WX.CRM.IBLL.Ord;
using WX.CRM.IBLL.Quality;
using WX.CRM.IBLL.Res;
using WX.CRM.IBLL.Sms;
using WX.CRM.IBLL.Soft;
using WX.CRM.IBLL.Util;
using WX.CRM.IBLL.WeWork;
using WX.CRM.IBLL.Ww;
using WX.CRM.IBLL.Wx;
using WX.CRM.Model.DTO;
using WX.CRM.Model.Entity;
using WX.CRM.Model.Enum;
using WX.CRM.Model.QueryMap;
using WX.CRM.Model.Ww;
using WX.CRM.WEB.ViewModel.Sale;
using WX.CRM.WebHelper;
using WX.CRM.WebHelper.RedisFactory;
namespace WX.CRM.WEB.Controllers.Csvr
{
public class CustomerUCController : BaseController
{
private IRES_CUSTOMER _customer;
private IORD_SPECIALMEMO_Q specialMemoBiz_Q;
private IORD_SERVICEMEMO_Q serviceMemoBiz_Q;
private IORD_SALEMEMO_Q saleMemoBiz_Q;
private IORD_SPECIALMEMO specialMemoBiz;
private IORD_SERVICEMEMO serviceMemoBiz;
private IORD_SALEMEMO saleMemoBiz;
private ICACHE_Q cacheQ;
private IORD_PURPOSEMEMO_Q purposeMemoBiz_Q;
private IORD_PURPOSEMEMO purposeMemoBiz;
private IRES_CUSTOMERDETAIL_Q customerDetail_Q;
private IRES_CUSTOMER_Q customer_Q;
private IBAS_PROVINCE_Q provinceQ;
private IBAS_CITY_Q cityQ;
private ICSVR_RELATIONCUSTOMER_Q relationcustomer;
private IRES_CUSTOMERUSER_Q customeruser_q;
private readonly IRES_CUSTOMEREXTEND _customerExt;
private readonly IRES_CUSTOMEREXTEND_Q _customerExtQ;
private readonly ISOFT_USER _softUser;
private readonly ISOFT_USER_Q _softUserQ;
private ICSVR_CALLRECORD_Q csvr_callRecordQ;
private IORD_MEMO_Q ord_memo_Q;
private ISMS_BATCHMSG_Q batchMsg_Q;
private readonly IWX_SZZYORDER _wxSzzyorder;
private IWX_RCONTACT wxrcontact;
[Inject]
public ISOFT_REGANDORDERLINK soft_RegAndOrderLink_BL { get; set; }
private GET_REGUSER _regUser = new GET_REGUSER();
private IRES_CUSTOMER res_Customer_BL;
[Ninject.Inject]
public IBAS_PARAMETER_Q _BAS_PARAMETER_Q { get; set; }
[Inject]
public ICSVR_CALLRECORD CSVR_CALLRECORD_BL { get; set; }
[Inject]
public ICSVR_CALLRECORD_Q _CSVR_CALLRECORD_Q { get; set; }
//[Inject]
//public IGJS_CUSTOMERCHECK_Q customerCheck_Q { get; set; }
[Inject]
public IQC_CUSTOMERCOMPLAIN_Q customerComplain_Q { get; set; }
[Inject]
public IRES_CALLOUTCUSTOMER _RES_CALLOUTCUSTOMER { get; set; }
[Inject]
public IWX_SZZYORDER2 _wxSzzyorder2 { get; set; }
[Inject]
public IWX_ORDEREXT wx_OrderExt_BL { get; set; }
[Inject]
public IWX_SZZYSUBPRODUCT wx_szzysubproduct { get; set; }
[Inject]
public IRES_MYALLOCATERES _myallocate { get; set; }
[Inject]
public IRES_DISTRIBUTE _distribute { get; set; }
[Inject]
public IWW_EXTUSER _wwExtUser { get; set; }
[Inject]
public IWW_EXTUSER_RESID _wwExtUserResId { get; set; }
[Inject]
public IWW_HHUSER _wwHhUser { get; set; }
[Inject]
public ISecurityHelper securityHelper { get; set; }
[Inject]
public IRES_CUSTOMER_RFM _rfm { get; set; }
[Inject]
public ICSVR_FAVORITECUSTOMER_Q _favoriteCustomer { get; set; }
[Inject]
public IRES_RESOURCEMOBILE_Q _resource { get; set; }
public RedisFactory redisFactory = new RedisFactory();
private ValidationErrors errors = new ValidationErrors();
public CustomerUCController(
IORD_SPECIALMEMO_Q _specialMemoBiz_Q,
IORD_SERVICEMEMO_Q _serviceMemoBiz_Q,
IORD_SALEMEMO_Q _saleMemoBiz_Q,
IORD_PURPOSEMEMO_Q _purposeMemoBiz_Q,
IRES_CUSTOMERDETAIL_Q _customerDetail_Q,
ICACHE_Q _cacheQ,
IRES_CUSTOMER_Q _customer_Q,
IBAS_PROVINCE_Q _provinceQ,
IBAS_CITY_Q _cityQ,
IRES_CUSTOMERUSER_Q customerUserQ,
ICSVR_RELATIONCUSTOMER_Q _relationcustomer,
IRES_CUSTOMEREXTEND customerExt, IRES_CUSTOMEREXTEND_Q customerExtQ,
ISOFT_USER softUser,
ISOFT_USER_Q softUserQ,
ICSVR_CALLRECORD_Q _csvr_callRecordQ,
IORD_SPECIALMEMO _specialMemoBiz,
IORD_SERVICEMEMO _serviceMemoBiz,
IORD_SALEMEMO _saleMemoBiz,
IORD_PURPOSEMEMO _purposeMemoBiz,
IORD_MEMO_Q _ord_memo_Q,
ISMS_BATCHMSG_Q _batchMsg_Q,
IWX_SZZYORDER wxSzzyorder,
IWX_RCONTACT _wxrcontact,
IRES_CUSTOMER _customer,
IRES_CUSTOMER res_Customer_BL
)
{
this._customer = _customer;
this.specialMemoBiz_Q = _specialMemoBiz_Q;
this.serviceMemoBiz_Q = _serviceMemoBiz_Q;
this.saleMemoBiz_Q = _saleMemoBiz_Q;
this.purposeMemoBiz_Q = _purposeMemoBiz_Q;
this.customerDetail_Q = _customerDetail_Q;
this.cacheQ = _cacheQ;
this.customer_Q = _customer_Q;
this.provinceQ = _provinceQ;
this.cityQ = _cityQ;
this.relationcustomer = _relationcustomer;
this.customeruser_q = customerUserQ;
this._customerExt = customerExt;
this._customerExtQ = customerExtQ;
this._softUser = softUser;
this._softUserQ = softUserQ;
this.csvr_callRecordQ = _csvr_callRecordQ;
this.saleMemoBiz = _saleMemoBiz;
this.specialMemoBiz = _specialMemoBiz;
this.serviceMemoBiz = _serviceMemoBiz;
this.purposeMemoBiz = _purposeMemoBiz;
this.ord_memo_Q = _ord_memo_Q;
this.batchMsg_Q = _batchMsg_Q;
_wxSzzyorder = wxSzzyorder;
this.wxrcontact = _wxrcontact;
this.res_Customer_BL = res_Customer_BL;
}
//
// GET: /CustomerUC/
#region
public ActionResult FastMemo(CustomerInfo info)
{
ViewBag.CustomerInfo = info;
var fastmemo = cacheQ.GetValue_Parameter("fastmemo");
ViewBag.fastmemo = fastmemo;
return View();
}
public ActionResult NewRisk(CustomerInfo info)
{
try
{
var umid = Request.QueryString["resid"];
var para = new { umid };
var url = $"http://hg.soft.dn8188.com/Compliance/GetTranUser";
//LogHelper.Info($"url=>{url}");
var rep = Utility.PostAjaxData(url, para.ToJson(), Encoding.UTF8);
if (!string.IsNullOrEmpty(rep))
{
var result = JsonConvert.DeserializeAnonymousType(rep, new { result = false, data = string.Empty });
if(result.result)
{
// 解析外层 JSON
var userDetail = JsonConvert.DeserializeObject<WxTranUserDetailDto>(result.data);
// 解析 riskinfo 字段
var riskInfo = JsonConvert.DeserializeObject<RiskInfoDto>(userDetail.riskinfo);
//LogHelper.Info($"riskInfo=>{riskInfo.ToJson()}");
ViewBag.Answer = riskInfo.answer;
ViewBag.Level = string.IsNullOrEmpty(userDetail.risklevel) ? string.Empty : "C" + userDetail.risklevel;
}
}
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
}
return View();
}
public ActionResult CustomerBaseInfoUC(CustomerInfo info)
{
//RES_CUSTOMER cData = new RES_CUSTOMER();
ViewBag.CustomerInfo = info;
//try
//{
//var resData = info.ResCustomerList.Where(p => p.RESID == info.CustomerId).FirstOrDefault();
RES_CUSTOMER cData = info.ResCustomerList.Where(p => p.RESID == info.CustomerId).FirstOrDefault();
if (cData == null)
{
RES_CUSTOMER rescustomer = customer_Q.getResCustomerByResId(info.CustomerId);
//RES_CUSTOMER rescustomer = redisFactory.GetInfo_Rescustomer(info.CustomerId);
string nresid = rescustomer == null ? "" : rescustomer.CUSTOMERID;
Response.Redirect(Url.Action("ErrorView", "Error", new { message = string.Format("错误提示:{0},{1}客户信息合并出现问题,请重新申请合并!", info.CustomerId, nresid) }));
}
customer_Q.GetResCustomerOtherInfo(ref cData);//获取多余的字段
if (cData.RES_CUSTOMERDETAIL != null)
{
cData.map_ADDRESS_ALL = cityQ.GetAddressStr(cData.map_PROVINCEID, cData.map_CITY) + cData.map_ADDRESS;//地址获取
RES_CUSTOMERDETAIL model = cData.RES_CUSTOMERDETAIL;
var modelNew = customerDetail_Q.GetModel_RES_CUSTOMERDETAIL(model.RESID);
cData.map_CNAME = modelNew.CNAME;
if (string.IsNullOrEmpty(cData.map_CNAME) && !string.IsNullOrEmpty(info.CustomerName))
{
cData.map_CNAME = info.CustomerName;
}
//if (!string.IsNullOrEmpty(model.CNAME))
//{
// if (model.CNAME.Length > 4)
// cData.map_CNAME = model.CNAME.Substring(0, 4);
// else
// cData.map_CNAME = model.CNAME;
//}
cData.map_PRIMARYNUMBERADDRESS = model.PRIMARYNUMBERADDRESS;
cData.map_ResId = model.RESID;
if (string.IsNullOrWhiteSpace(model.AMOUNTTYPEID))
{
cData.map_AMOUNTTYPEID = "";
}
else
{
var m = cacheQ.GetList_SubComType(ComType.CustomerZJL).FirstOrDefault(p => p.SUBTYPECODE == model.AMOUNTTYPEID);
if (m != null)
{
cData.map_AMOUNTTYPEID = m.map_SUBTYPENAME;
}
}
if (string.IsNullOrWhiteSpace(model.JOBTYPEID))
{
cData.map_JOBTYPEID = "";
}
else
{
var m = cacheQ.GetList_SubComType(ComType.CustomerZY).FirstOrDefault(p => p.SUBTYPECODE == model.JOBTYPEID);
if (m != null)
{
cData.map_JOBTYPEID = m.map_SUBTYPENAME;
}
}
cData.map_GENDER = model.GENDER == "m" ? "男" : "女";
cData.map_ADDRESS = model.ADDRESS;
cData.isBound = model.ISBOUND;//是否绑定客服
var ZJL = cacheQ.GetList_SubComType(ComType.CustomerZJL).Select(item => new SelectListItem() { Text = item.SUBTYPENAME, Value = item.SUBTYPECODE }).ToList();
ViewBag.ZJL = ZJL;
}
//var residArr = info.ResCustomerList.Select(p => p.RESID).ToArray();
//var allocateList = _myallocate.GetList(p => residArr.Contains(p.RESID));
ViewBag.CustomerInfo = info;
ViewBag.companyCode = companyCode;//公司编码
//ViewBag.allocateList = allocateList;
ViewBag.userId = UserId;
//ViewBag.rfm = _rfm.GetResCustomerRfm(residArr);
//var favCustomer = _favoriteCustomer.GetModel_FavoriteCustomer(info.CustomerId, null);
//try
//{
// var cmsgetDept = _BAS_PARAMETER_Q.GetModel_Patameter("Cms_GetResDept");
// if (cmsgetDept != null)
// {
// var url = cmsgetDept.PARAVALUE;
// var param = $"?appid=com.web&appuserid={info.CustomerId}";
// string jsonx = Utility.GetData(url, param, Encoding.UTF8);
// LogHelper.Info("cms获取" + url + param + ", ret:" + jsonx);
// cmsresdeptRet ret = JsonHelper.JsonDivertToObj<cmsresdeptRet>(jsonx);
// if (ret.errcode == 0)
// {
// var ent = ret.data.Where(m => m.deptid != 1).OrderByDescending(m => m.ctime).FirstOrDefault();
// ViewBag.CmsDeptName = ent == null ? "未知" : ent.deptname;
// }
// }
//}
//catch (Exception e)
//{
// LogHelper.Error(e.ToString());
//}
//var comTypeList = DataCacheHelper.GetCache().GetList_SubComType(WX.CRM.Model.Enum.ComType.FavoritesCustType);
//string favoritesCustType = string.Empty;
//if (favCustomer != null)
//{
// var comtypeInfo = comTypeList.FirstOrDefault(P => P.map_SUBTYPECODE == favCustomer.PARAKEY);
// if (comtypeInfo != null)
// {
// favoritesCustType = comtypeInfo.map_SUBTYPENAME;
// }
//}
//ViewBag.FavoritesCustType = favoritesCustType;
//客户内外诉标签
try
{
var webapi = cacheQ.GetValue_Parameter("Hg_Core_WebApi");
//webapi = "https://localhost:7090";
var url = $"{webapi}/api/OutComplaint/ComplaintLabel";
var para = $"resId={info.CustomerId}";
var result = Utility.GetData(url, para, Encoding.UTF8);
var data = result.ToObject<WX.CRM.Common.Employee.ApiResult<ComplaintLabelDto>>();
ViewBag.Complaint = data?.data;
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
}
//客户年龄身份证地址IP信息
//try
//{
// var url = cacheQ.GetValue_Parameter(Parameter.Customer_DetailUrl);
// if (!string.IsNullOrWhiteSpace(url))
// {
// var para = $"appid=&appuserid=&fields=username,age,gender,id_province,id_city,id_area,ip,country,province,city&resid={info.CustomerId}";
// var result = Utility.GetData(url, para, Encoding.UTF8);
// var data = result.ToObject<WX.CRM.Common.Employee.ApiResult<List<CustomerInfoDto>>>();
// if (data.code == 0 && data.data != null)
// {
// var dto = data.data;
// ViewBag.CName = dto.FirstOrDefault(x => x.name == "username")?.val;
// ViewBag.Age = dto.FirstOrDefault(x => x.name == "age")?.val;
// ViewBag.IdCardAddr = $"{dto.FirstOrDefault(x => x.name == "id_province")?.val}{dto.FirstOrDefault(x => x.name == "id_city")?.val}{dto.FirstOrDefault(x => x.name == "id_area")?.val}";
// ViewBag.IpAddr = $"{dto.FirstOrDefault(x => x.name == "province")?.val}{dto.FirstOrDefault(x => x.name == "city")?.val}";
// }
// }
//}
//catch (Exception ex)
//{
// LogHelper.Error(ex.ToString());
//}
try
{
var url = "http://hg.soft.dn8188.com/Compliance/GetTranUser";
var para = new { umid = cData.UMID };
var rep = Utility.PostAjaxData(url, para.ToJson(), Encoding.UTF8);
if (!string.IsNullOrEmpty(rep))
{
var result = JsonConvert.DeserializeAnonymousType(rep, new { result = false, data = string.Empty });
if(result.result)
{
// 解析外层 JSON
var userDetail = JsonConvert.DeserializeObject<WxTranUserDetailDto>(result.data);
// 解析 riskinfo 字段
var riskInfo = JsonConvert.DeserializeObject<RiskInfoDto>(userDetail.riskinfo);
//姓名
cData.map_CNAME = userDetail.cname;
//注册时间
cData.CTIME = string.IsNullOrEmpty(userDetail.regdate) ? cData.CTIME : Convert.ToDateTime(userDetail.regdate);
if (!string.IsNullOrEmpty(userDetail.idcardno))
{
//国籍
ViewBag.Nationality = IdCardHelper.GetNationality(userDetail.idcardno);
//身份证类型
ViewBag.IdCardType = IdCardHelper.GetIdCardType(userDetail.idcardno);
//身份证
ViewBag.IdCard = IdCardHelper.MaskIdCard(userDetail.idcardno);
//出生年月
ViewBag.BirthDay = IdCardHelper.GetBirthDate(userDetail.idcardno).ToString();
//性别
cData.map_GENDER = IdCardHelper.GetGender(userDetail.idcardno);
//年龄
cData.map_BIRTHDAYAREASTR = IdCardHelper.GetAge(userDetail.idcardno).ToString();
}
//承受风险能力
cData.RES_CUSTOMERDETAIL.RISKTOLERANCE = string.IsNullOrEmpty(userDetail.risklevel) ? string.Empty : "C" + userDetail.risklevel;
// 新增答案解析
var answers = riskInfo.answer.Split('|');
//学历
cData.map_JOBTYPEID = answers.Length > 18 ? GetAnswerText(19, answers[18]) : "";
//投资经验
cData.map_OpenrationTypeStr = answers.Length > 7 ? GetAnswerText(6, answers[7]) : "";
//资金量
cData.map_AMOUNTTYPEID = answers.Length > 3 ? GetAnswerText(4, answers[3]) : "";
//债务
ViewBag.ZaiWu = answers.Length > 2 ? GetAnswerText(3, answers[2]) : "";
//投资期限
ViewBag.QiXiang = answers.Length > 10 ? GetAnswerText(11, answers[10]) : "";
//品种
ViewBag.PinZhong = answers.Length > 11 ? GetAnswerText(12, answers[11]) : "";
//期望收益
ViewBag.QiWang = answers.Length > 13 ? GetAnswerText(14, answers[13]) : "";
//可承受的损失
ViewBag.ShunShi = answers.Length > 14 ? GetAnswerText(15, answers[14]) : "";
}
}
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
}
return View(cData);
}
public ActionResult CustomerCheckUC(CustomerInfo info)
{
//List<string> listTradeCode = info.GjsCustomerList.Select(m => m.TRADECODE).ToList();
//string tradeCodes = string.Join(",", listTradeCode);
//List<GJS_CUSTOMERCHECKRUMOR> customerCheckList = customerCheck_Q.GetList_GjsCustomerCheckByTradecodes(listTradeCode);
List<string> listResId = info.ResCustomerList.Select(m => m.RESID).ToList();
List<QC_CUSTOMERCOMPLAIN_Extend> customerComplainList = customerComplain_Q.GetList_CustomerComplainByResIds(listResId);
//QC_CUSTOMERCOMPLAIN_Extend customerComplain = null;
//if (customerComplainList != null)
//{
// customerComplain = customerComplainList.FirstOrDefault();
//}
var isSH = false;
var roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
if ((roleCodes.Contains("[SH]") || roleCodes.Contains("[GLY]")))
{
isSH = true;
}
//ViewBag.customerCheckList = customerCheckList;
ViewBag.customerComplain = customerComplainList;
ViewBag.customerId = info.CustomerId;
ViewBag.isSH = isSH;
return View();
}
public ActionResult CustomerCategoryUC(CustomerInfo info)
{
ViewBag.CustomerInfo = info;
//List<FXH_CUSTOMERCATEGORYTYPE> typeList = customerCategory.GetTypeList(info.CustomerId);
//ViewBag.typeList = typeList;
//string paraValue = "";
//DateTime? lossAmtDate = cacheQ.GetGjs_TradeCustomerTotalList().Where(m => info.GjsCustomerList.Select(p => p.TRADECODE).ToArray().Contains(m.TRADECODE)).Where(m => m.LOSSAMTDATE != null).Select(p => p.LOSSAMTDATE).OrderByDescending(d => d).FirstOrDefault();
//if (lossAmtDate != null)
// paraValue = cacheQ.GetValue_Parameter(Model.Enum.Parameter.Gjs_LossAmt);
//ViewBag.LossAmt = paraValue;
//ViewBag.LossAmtDate = lossAmtDate;
//List<GJS_CustomerCategoryInfoView> model2 = _gjsCustomercategoryQ.GetList_CustomerCategoryInfo(info);
//ViewBag.GJS_CustomerCategoryInfoViewList = model2;
return View();
}
public ActionResult CustomerExtendUC(CustomerInfo info)
{
var list = _customerExtQ.GetList_CustomerExt(info.CustomerId);
var SKtype = cacheQ.GetList_SubComType(ComType.CustomerExtendSK).ToList();
var Item = cacheQ.GetList_SubComType(ComType.CustomerExtendChoseItem).ToList();
//var resData = info.GjsCustomerList.Where(p => p.RESID == info.CustomerId).FirstOrDefault();
SKtype.AddRange(Item);
foreach (var it in list)
{
BAS_SUBCOMTYPE subName = SKtype.Where(p => p.SUBTYPECODE == it.CUSTOMEREXTENDSUBTYPEID).FirstOrDefault();
if (it.CUSTOMEREXTENDTYPEID == "CustomerExtendSK")
{
it.CUSTOMEREXTENDSUBTYPEID = subName == null ? "" : subName.SUBTYPENAME;
}
else
{
it.CUSTOMEREXTENDSUBTYPEID = "看盘时间";
}
}
ViewBag.resid = info.CustomerId;
ViewBag.List = list;
//ViewBag.tradeCode = resData == null ? "" : resData.TRADECODE;
ViewBag.tradeCode = "";
return View();
}
public ActionResult ContactUC(CustomerInfo info)
{
var _CTI_CALLOUT_CUSTOMER = cacheQ.GetValue_Parameter("CTI_CALLOUT_CUSTOMER");
var _sys_Environment_DeptCode = cacheQ.GetValue_Parameter("Sys_Environment_DeptCode");
bool nedCallOutNum = true;
//if (null != _sys_Environment_DeptCode)
// nedCallOutNum = _sys_Environment_DeptCode == Sys_Environment_DeptCode.LVTD01.ToString() ||
// userRoleNames.Contains("VIP热线电话");
if (_CTI_CALLOUT_CUSTOMER != null && _CTI_CALLOUT_CUSTOMER.ToLower() == "true")
_init_CallOutPara(info.RequsetResId, _sys_Environment_DeptCode, nedCallOutNum);
else
_init_CallOutNum(_sys_Environment_DeptCode, nedCallOutNum);
string weixinzhushou = cacheQ.GetValue_Parameter("WeiXin_WebChatAssistant");
bool isShowwxzs = false;
if (!string.IsNullOrEmpty(weixinzhushou) && weixinzhushou == "show")
{
isShowwxzs = true;
}
ViewBag.IsShowWeiXinZhuShou = isShowwxzs;
ViewBag.resid = info.CustomerId;
ViewBag.ResCustList = info.ResCustomerList;
ViewBag.CustomerMoblieList = GetCustomerMoblieByResid(info.CustomerId);
ViewBag.CanShowMoile = cacheQ.GetValue_Parameter(WX.CRM.Model.Enum.Parameter.Sys_CanShowResMobile);
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
//升级客服角色
if (roleCodes.IndexOf("GJSSJKF") >= 0)
{
ViewBag.GJSSJKF = "1";
}
var cti = _CSVR_CALLRECORD_Q.Sys_Environment_CTI_VER();
if (null != cti)
{
ViewBag.CTI_VER = Convert.ToInt32(cti);
}
ViewBag.DeptCode = _sys_Environment_DeptCode.ToUpper();
ViewBag.IsBC = nedCallOutNum.ToString().ToLower();
ViewBag.Eid = Eid;
ViewBag.RoleCodes = roleCodes;
ViewBag.IsFromHg = info.IsFromHg;
return View();
}
[HttpPost]
public JsonResult RefreshCustomerMoblieByResid(string resid)
{
var host = cacheQ.GetValue_Parameter(Parameter.Hg_Internal_WebApi);
var url = host + "/api/Customer/moblies";
var res = Utility.GetData(url, "resid=" + resid, Encoding.UTF8);
var result = JsonHelper.JsonDivertToObj<Common.StockHelper.ApiResult<List<CustomerMoblieDto>>>(res);
if (result.Code == 0)
{
if (!result.Data.Any()) return Json(new { reslust = true, message = "无其他事业部号码可以获取" });
CreateCustomerMoblie(resid, result.Data);
return Json(new { reslust = true, message = "获取成功!" });
}
return Json(new { reslust = false, message = "获取失败" });
}
private List<CustomerMoblieDto> GetCustomerMoblieByResid(string resid)
{
var host = cacheQ.GetValue_Parameter(Parameter.Hg_Internal_WebApi);
var url = host + "/api/Customer/moblies";
var res = Utility.GetData(url, "resid=" + resid, Encoding.UTF8);
var result = JsonHelper.JsonDivertToObj<Common.StockHelper.ApiResult<List<CustomerMoblieDto>>>(res);
if (result.Code == 0)
{
return result.Data;
}
return new List<CustomerMoblieDto>();
}
private void CreateCustomerMoblie(string resid, List<CustomerMoblieDto> customers)
{
if (!customers.Any()) return;
var users = customer_Q.GetListByResId(resid);
foreach (var customer in customers.Where(x => !users.Select(y => y.RESID).Contains(x.Resid)))
{
string clientid = Utility.GetSettingByKey("CRMClientKey");
var mobile = sHelper.decyptData(clientid, customer.Mobile);
res_Customer_BL.ResgisterCustomer(mobile, customer.Resid, "resetmobile");
var newCustomer = customer_Q.getResCustomerByResId(customer.Resid);
newCustomer.CUSTOMERID = customer.CustomerId;
res_Customer_BL.Update(ref errors, newCustomer);
}
}
private void _init_CallOutPara(string resid, string _sys_Environment_DeptCode, bool nedCallOutNum)
{
var CallOutPhoneList = new List<System.Web.UI.WebControls.ListItem>();
var CallOutPhoneDefault = new List<String>();
var calloutPara = cacheQ.GetList_CallOutPara();
if (calloutPara == null || calloutPara.Count == 0)
{
return;
}
foreach (var callout in calloutPara)
{
if (callout.ISSHOW == 0)//网络号码
{
CallOutPhoneList.Add(new System.Web.UI.WebControls.ListItem { Text = callout.CALLOUTNAME, Value = callout.CALLOUTNUM });
}
else
{
var chk = _RES_CALLOUTCUSTOMER.IsCallOut(resid, callout.CALLOUTTYPE);
if (chk)
{
CallOutPhoneList.Add(new System.Web.UI.WebControls.ListItem { Text = callout.CALLOUTNAME, Value = callout.CALLOUTNUM });
}
}
}
ViewBag.CallOutPhoneDefault = CallOutPhoneDefault;
ViewBag.CallOutPhone = CallOutPhoneList;
}
private void _init_CallOutNum(string _sys_Environment_DeptCode, bool nedCallOutNum)
{
var CallOutPhoneList = new List<System.Web.UI.WebControls.ListItem>();
var CallOutPhoneDefault = new List<String>();
#region VIP号码
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);
var calloutpara = "";
//VIP热线坐席
if (roleCodes.IndexOf("VIPCall") > -1)
{
calloutpara = cacheQ.GetValue_Parameter("Sys_Environment_VIPCallOut");
}
else
{
calloutpara = cacheQ.GetValue_Parameter("Sys_Environment_CallOut");
}
/*
* 参数表KEYSys_Environment_CallOut 数据格式7300|1,7333|9
* 含义勾选框7300,7333,选不同参数发送不同号码如选7300调用参数1。
*
* 参数格式变更7300|1,7333|9#7444#1
* 含义7300|1,7333|9VIP号码7444号码池号码1默认号码。
*/
int xx = 0;
if (nedCallOutNum)//VIP号码#号码池号码
{
if (calloutpara != null && !string.IsNullOrEmpty(calloutpara))
{
var vipstr = calloutpara.Split('#');//取VIP号码
if (!string.IsNullOrEmpty(vipstr[0]))
{
foreach (var callout in (vipstr[0]).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))// 7300|1,7333|9
{
xx++;
//if (xx > 1 && roleCodes.IndexOf("[SH]") == -1 && roleCodes.IndexOf("[GJSGJKF]") == -1)//售后和主管才能有权选择
// break;
var valAndText = callout.Split('|');
if (valAndText.Length == 2)
{
//if (roleCodes.IndexOf("[SH]") > -1 && xx==2)
//{
// CallOutPhoneDefault.Add(valAndText[1]);
//}
CallOutPhoneList.Add(new System.Web.UI.WebControls.ListItem { Text = valAndText[0], Value = valAndText[1] });
}
else
{
//if (roleCodes.IndexOf("[SH]") > -1 && xx == 2)
//{
// CallOutPhoneDefault.Add(valAndText[0]);
//}
CallOutPhoneList.Add(new System.Web.UI.WebControls.ListItem { Text = valAndText[0], Value = valAndText[0] });
}
}
//CallOutPhoneDefault.Add(CallOutPhoneList.FirstOrDefault().Value);
}
}
}
#endregion VIP号码
#region
if (calloutpara != null && !string.IsNullOrEmpty(calloutpara))
{
var vipstr = calloutpara.Split('#');//取号码池
if (vipstr.Length >= 2 && !string.IsNullOrEmpty(vipstr[1]))
{
foreach (var callout in (vipstr[1]).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
var valAndText = callout.Split('|');
if (valAndText.Length == 2)
CallOutPhoneList.Add(new System.Web.UI.WebControls.ListItem { Text = valAndText[0], Value = valAndText[1] });
else
CallOutPhoneList.Add(new System.Web.UI.WebControls.ListItem { Text = valAndText[0], Value = valAndText[0] });
}
}
}
#endregion
#region
if (calloutpara != null && !string.IsNullOrEmpty(calloutpara))
{
var vipstr = calloutpara.Split('#');//取VIP号码
if (vipstr.Length == 3)
{
CallOutPhoneDefault.Add(vipstr[2]);
}
}
#endregion
ViewBag.CallOutPhoneDefault = CallOutPhoneDefault;
ViewBag.CallOutPhone = CallOutPhoneList;
}
public ActionResult CustomerUserUC(CustomerInfo info)
{
//OldVersion
List<RES_CUSTOMERUSER> list = customeruser_q.GetListByCustomerId(info.CustomerId);
var softuser = _softUserQ.GetUserList_userName(list.Select(m => m.USERNAME).ToArray());
var ResCustList = info.ResCustomerList;
//redis版本
//var ResCustList = info.ResCustomerList;
//string[] resids = ResCustList.Select(m => m.RESID).ToArray();
//List<RES_CUSTOMERUSER> list = redisFactory.GetList_Rescustomer(info.CustomerId, resids);
//var softuser = redisFactory.GetList_SoftUser(list.Select(m => m.USERNAME).Distinct().ToArray());
Dictionary<string, RES_CUSTOMER> dic = new Dictionary<string, RES_CUSTOMER>();
//foreach (var model in softuser)
//{
// RES_CUSTOMERUSER customeruser = list.FirstOrDefault(p => p.USERNAME == model.USERNAME);
// var rescustomer = ResCustList.FirstOrDefault(m => m.RESID == customeruser.RESID);
// dic.Add(model.USERNAME, rescustomer);
//}
foreach (var model in list)
{
if (!dic.ContainsKey(model.USERNAME))
{
var rescustomer = ResCustList.FirstOrDefault(m => m.RESID == model.RESID);
dic.Add(model.USERNAME, rescustomer);
}
}
ViewBag.SoftUser = softuser;
ViewBag.ResId = info.CustomerId;
ViewBag.UserNameList = string.Join(",", softuser.Select(m => m.USERNAME));
ViewBag.ResDic = dic;
return View();
}
[Inject]
public ISecurityHelper sHelper { get; set; }
[HttpPost]
public JsonResult GetOtherUser(string resid, string softusername)
{
try
{
var url = cacheQ.GetValue_Parameter(Parameter.Core_ZxdService_GetOtherUser);
var theModel = new Soft_User_GetCheckDTO() { companyCode = companyCode, eid = Convert.ToInt32(Eid), resid = resid, softusername = softusername };
string json = Newtonsoft.Json.JsonConvert.SerializeObject(theModel);
json = sHelper.createSignEncodingStr(json, SecurityHelper.OrderClientIdKey);//数据参数加密
string retmsg = Utility.PostData(url + "?" + json, Encoding.UTF8);//实现中心点先入库
retmsg = sHelper.decyptData(SecurityHelper.OrderClientIdKey, retmsg);
retMsgNew<List<Soft_User_GetModelDTO>> result = Newtonsoft.Json.JsonConvert.DeserializeObject<retMsgNew<List<Soft_User_GetModelDTO>>>(retmsg);
if (result.result)
{
foreach (var activeModel in result.data)
{
var _regUser = new GET_REGUSER();
//bl.RegUser(item.mobile,);
_regUser.RegUser(activeModel.mobile, activeModel.regcampainid.ToString(), "", activeModel.username, activeModel.regdate, 0, activeModel.mobile, platform: activeModel.reglatform);
}
return Json(new { reslust = true, message = result.retmsg });
}
else
{
return Json(new { reslust = false, message = result.retmsg });
}
}
catch (Exception e)
{
LogHelper.Error(e.ToString());
return Json(new { reslust = false, message = "系统错误" });
}
}
public ActionResult CustomerAddWxUserUC(CustomerInfo info)
{
ViewBag.WorkwxEid = Eid;
ViewBag.ResId = info.CustomerId;
ViewBag.RcontactList = wxrcontact.GetRcontactByResId(info.CustomerId);
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);//获取员工角色
ViewBag.RoleCodes = roleCodes;
return View();
}
[Inject]
public IWw_huser _iww_hhuser_service { get; set; }
#region
public ActionResult CustomerAddWWUserUC(CustomerInfo info)
{
List<WwExtUserView> view = new List<WwExtUserView>();
try
{
var userlist = _wwExtUserResId.GetList(p => p.RESID == info.CustomerId);
foreach (var user in userlist)
{
if (user != null)
{
Ww_Extuser extuser = _iww_hhuser_service.ExtUserGet(user.USERID);
//var extuser = _wwExtUser.Get(p => p.USERID == user.USERID);
if (extuser != null)
{
var exinfo = extuser.exinfo.ToObject<WwExtUserView>();
exinfo.corpid = extuser.corpid;
foreach (var item in exinfo.follow_user)
{
var hhuser = _iww_hhuser_service.HHuser_Get(item.userid);
WW_HHUSER_EID hheid = _iww_hhuser_service.GetModel(item.userid, exinfo.corpid);
if (hheid != null)
{
item.saleeid = InnerUserHelper.Instance.GetEidAndNameByEid(hheid.EID, true);
}
else
{
item.saleeid = "";
}
//var hhuser = _wwHhUser.Get(p => p.USERID == item.userid);
if (hhuser != null)
item.uname = hhuser.uname;
item.bindtime = user.CTIME.ToString("yyyy-MM-dd HH:mm:ss");
item.remark = Utility.ReplaceMobile(item.remark);
for (int i = 0; i < item.remark_mobiles.Count; i++)
{
item.remark_mobiles[i] = Utility.ReplaceMobile(item.remark_mobiles[i]);
}
}
//extUserInfo = exinfo.ToJson();
view.Add(exinfo);
}
}
}
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
}
ViewBag.extUserInfo = view.ToJson();
ViewBag.ResId = info.CustomerId;
ViewBag.DeptCode = Utility.GetSettingOrNullByKey("DataClientCode");
ViewBag.WwMessage_Url = cacheQ.GetValue_Parameter("WwMessage_Url_Test");
ViewBag.companycode = companyCode;//公司ID
return View();
}
public JsonResult BindWwExtUser(string resId, string userId)
{
if (string.IsNullOrEmpty(userId))
{
return Json(new { result = false, message = "请选择企业微信" }, JsonRequestBehavior.AllowGet);
}
if (string.IsNullOrEmpty(resId))
{
return Json(new { result = false, message = "参数错误" }, JsonRequestBehavior.AllowGet);
}
bool ret = true;
string message = "关联成功!";
try
{
ret = _wxSzzyorder.UpdateResIdByWwUserName(resId, userId);
if (ret)
{
//_wxSzzyorder.UpdateIsBoundByResId(resId);
var host = Utility.GetSettingOrNullByKey("DataSyncApiUrl");
var url = host + "/api/DataSync";
var data = new { resid = resId, userid = userId, deptcode = companyCode };
var para = new SYNC_PUSH_DTO()
{
bidatatype = "Server_WwextUserResid",
deptcode = companyCode,
jsontext = data.ToJson()
};
var rep = Utility.PostAjaxData(url, para.ToJson(), Encoding.UTF8);
var ret2 = Utility.JSONToObject<retMsg>(rep);
if (!ret2.result)
{
LogHelper.Info("同步到中心点异常:" + para.ToJson());
message = "关联成功!同步到总部失败!";
}
}
}
catch (Exception e)
{
ret = false;
LogHelper.Info("异常:" + e.ToString());
message = "出现错误!";
}
return Json(new { result = ret, message = message }, JsonRequestBehavior.AllowGet);
}
#endregion
public ActionResult CustomerLoginInfo(CustomerInfo info)
{
string loginInfoResId = info == null ? "" : info.CustomerId;
return View((object)loginInfoResId);
}
public ActionResult CustomerOtherInfo(CustomerInfo info)
{
RES_CUSTOMER_Extend customer = new RES_CUSTOMER_Extend();
//try
//{
if (info != null && !string.IsNullOrEmpty(info.CustomerId))
{
var getCustomer = customer_Q.GetModel(info.CustomerId.Trim());
var amounttype = cacheQ.GetList_SubComType(ComType.CustomerZJL).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.RES_CUSTOMERDETAIL.AMOUNTTYPEID);
var customertype = cacheQ.GetList_SubComType(ComType.CustomerType).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.RES_CUSTOMERDETAIL.CUSTOMERTYPEID);
var jobtype = cacheQ.GetList_SubComType(ComType.CustomerZY).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.RES_CUSTOMERDETAIL.JOBTYPEID);
var OperationType = cacheQ.GetList_SubComType(ComType.CustomerCZXG).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.RES_CUSTOMERDETAIL.OPERATIONTYPE);
var customerfrom = cacheQ.GetList_SubComType(ComType.CustomerFrom).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.CUSTOMERFROM);
customer.RES_CUSTOMERDETAIL = new RES_CUSTOMERDETAIL();
if (getCustomer != null)
{
var province = provinceQ.GetProvince(getCustomer.map_PROVINCEID == null ? 1 : getCustomer.map_PROVINCEID.Value);
var city = cityQ.GetCity(getCustomer.map_CITY == null ? 1 : getCustomer.map_CITY.Value);
customer.map_ResId = getCustomer.map_ResId;
customer.map_CACCOUNT = getCustomer.RES_CUSTOMERDETAIL.CACCOUNT;
customer.map_CTIME = getCustomer.map_CTIME;
customer.map_CNAME = getCustomer.map_CNAME;
customer.map_GENDER = getCustomer.map_GENDER == "m" ? "男" : "女";
customer.map_EMAIL = getCustomer.map_EMAIL;
customer.map_MSN = getCustomer.map_MSN;
customer.map_FAX = getCustomer.map_FAX;
customer.map_ADDRESS = getCustomer.map_ADDRESS;
customer.map_AMOUNTTYPEID = amounttype == null ? "" : amounttype.SUBTYPENAME;
customer.map_CUSTOMERTYPEID = customertype == null ? "" : customertype.SUBTYPENAME;
customer.map_JOBTYPEID = jobtype == null ? "" : jobtype.SUBTYPENAME;
customer.map_OPERATIONTYPE = OperationType == null ? "" : OperationType.SUBTYPENAME;
customer.map_CUSTOMERFROM = customerfrom == null ? "" : customerfrom.SUBTYPENAME;
customer.map_PROVINCE = province == null ? "" : province.NAME;
customer.map_GETCITY = city == null ? "" : city.NAME;
}
}
//}
//catch (Exception ex)
//{
// LogHelper.Error(ex.Message);
//}
return View(customer);
}
public ActionResult RelationCustomerUC(CustomerInfo info)
{
List<CSVR_RELATIONCUSTOMER> list = new List<CSVR_RELATIONCUSTOMER>();
try
{
if (info != null && !string.IsNullOrEmpty(info.CustomerId))
{
list = relationcustomer.GetRelationByResId(info.CustomerId);
}
}
catch (Exception ex)
{
LogHelper.Error(ex.Message);
}
// ViewBag.List = list;
ViewBag.RelationResId = info.CustomerId;
return View(list);
}
public ActionResult CustomerInfo(CustomerInfo info)
{
try
{
RES_CUSTOMER_Extend customer = new RES_CUSTOMER_Extend();
//try
//{
if (info != null && !string.IsNullOrEmpty(info.CustomerId))
{
var getCustomer = customer_Q.GetModel(info.CustomerId.Trim());
var amounttype = cacheQ.GetList_SubComType(ComType.CustomerZJL).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.RES_CUSTOMERDETAIL.AMOUNTTYPEID);
var customertype = cacheQ.GetList_SubComType(ComType.CustomerType).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.RES_CUSTOMERDETAIL.CUSTOMERTYPEID);
var jobtype = cacheQ.GetList_SubComType(ComType.CustomerZY).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.RES_CUSTOMERDETAIL.JOBTYPEID);
var OperationType = cacheQ.GetList_SubComType(ComType.CustomerCZXG).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.RES_CUSTOMERDETAIL.OPERATIONTYPE);
var customerfrom = cacheQ.GetList_SubComType(ComType.CustomerFrom).FirstOrDefault(p => p.SUBTYPECODE == getCustomer.CUSTOMERFROM);
customer.RES_CUSTOMERDETAIL = new RES_CUSTOMERDETAIL();
if (getCustomer != null)
{
var province = provinceQ.GetProvince(getCustomer.map_PROVINCEID == null ? 1 : getCustomer.map_PROVINCEID.Value);
var city = cityQ.GetCity(getCustomer.map_CITY == null ? 1 : getCustomer.map_CITY.Value);
customer.map_ResId = getCustomer.map_ResId;
customer.map_CACCOUNT = getCustomer.RES_CUSTOMERDETAIL.CACCOUNT;
customer.map_CTIME = getCustomer.map_CTIME;
customer.map_CNAME = getCustomer.RES_CUSTOMERDETAIL.CNAME;
customer.map_GENDER = getCustomer.map_GENDER == "m" ? "男" : "女";
customer.map_EMAIL = getCustomer.RES_CUSTOMERDETAIL.EMAIL;
customer.map_MSN = getCustomer.RES_CUSTOMERDETAIL.MSN;
customer.map_FAX = getCustomer.RES_CUSTOMERDETAIL.FAX;
customer.map_ADDRESS = getCustomer.RES_CUSTOMERDETAIL.ADDRESS;
customer.map_AMOUNTTYPEID = amounttype == null ? "" : amounttype.SUBTYPENAME;
customer.map_CUSTOMERTYPEID = customertype == null ? "" : customertype.SUBTYPENAME;
customer.map_JOBTYPEID = jobtype == null ? "" : jobtype.SUBTYPENAME;
customer.map_OPERATIONTYPE = OperationType == null ? "" : OperationType.SUBTYPENAME;
customer.map_PROVINCE = province == null ? "" : province.NAME;
customer.map_GETCITY = city == null ? "" : city.NAME;
customer.map_CUSTOMERFROM = customer.map_CUSTOMERFROM;
}
}
//}
//catch (Exception ex)
//{
// LogHelper.Error(ex.Message);
//}
return View(customer);
}
catch (Exception ex)
{
LogHelper.Error(ex);
return View();
}
}
#endregion
#region
public ViewResult CustomerAllMemoUC(CustomerInfo info)
{
var deptCode = Utility.GetSettingOrNullByKey("DataClientCode");
ViewBag.DeptCode = deptCode;
return View(info);
}
public JsonResult GetMemoQueryHtml(Pager pager, string ResId, string MemoType, decimal? pageType, string IsValid)
{
string isShowMobileOfContent = cacheQ.GetValue_Parameter(Model.Enum.Parameter.Sys_IsShowMobileOfContent);
List<ORD_MemoQuery> list = new List<ORD_MemoQuery>();
#region
switch (Convert.ToInt32(MemoType))
{
case (int)WX.CRM.Model.Enum.EnumMemoType.:
list = ord_memo_Q.GetMemoListByResId(ref pager, ResId, WX.CRM.Model.Enum.EnumMemoType., IsValid);
break;
case (int)WX.CRM.Model.Enum.EnumMemoType.:
list = ord_memo_Q.GetMemoListByResId(ref pager, ResId, WX.CRM.Model.Enum.EnumMemoType., IsValid);
break;
case (int)WX.CRM.Model.Enum.EnumMemoType.:
list = ord_memo_Q.GetMemoListByResId(ref pager, ResId, WX.CRM.Model.Enum.EnumMemoType., IsValid);
break;
case (int)WX.CRM.Model.Enum.EnumMemoType.:
list = ord_memo_Q.GetMemoListByResId(ref pager, ResId, WX.CRM.Model.Enum.EnumMemoType., IsValid);
break;
case 7:
list = ord_memo_Q.GetAllMemoListByResId(int.MaxValue, ResId, IsValid, "PACK_ORD_MEMO.ord_allmemo_get_new2");//获取所有工单
//list = redisFactory.LoadMemo(ResId, IsValid);
break;
}
#endregion
//获取事业部配置
var deptMapList = customer_Q.GetUserDeptNameByEid(list.Select(n => n.EID).ToList());
Table table = new Table("", true);
table.gridPager = pager;
ICACHE_Q ui = DataCacheHelper.GetCache();
List<ORD_MEMOTYPE> memoTypeList = ui.GetList_MemoType(0);//缓存读取 工单大类数据
List<ORD_MEMOSUBTYPE> memoSubTypeList = ui.GetList_MemoSubType(0);//缓存读取 获取所有工单小类数据
List<ORD_MEMOSTYLE> styleList = DataCacheHelper.GetCache().GetList_MemoStyle();
Dictionary<int, string> Memo_Type = OperationUtil.GetDicFromEnum<WX.CRM.Model.Enum.EnumMemoType>();
var deptCode = Utility.GetSettingOrNullByKey("DataClientCode");
if (deptCode == "QBJZ")
{
Memo_Type = OperationUtil.GetDicFromEnum<WX.CRM.Model.Enum.EnumMemoType_B1>();
}
ORD_MEMOTYPE memotype = null;
ORD_MEMOSUBTYPE memosubType = null;
var userMapping = cacheQ.GetAllCrmUser();
List<string> containList = new List<string>();
foreach (ORD_MemoQuery model in list)
{
var conStr = $"{model.MEMOID}_{model.STRCONTENT}_{model.CTIME.Value}";
if (containList.Contains(conStr))
{
continue;
}
containList.Add(conStr);
table.AddCol(double.Parse(model.MEMOID.ToString()));
var eidMap = deptMapList.FirstOrDefault(n => n.Eid == model.EID);
if (eidMap != null)
{
table.AddCol(eidMap.DeptName);
}
else
{
table.AddCol(model.COMPANYNAME);
}
if (pageType != null)//查看更多工单的,显示全部工单内容
{
if (!string.IsNullOrEmpty(isShowMobileOfContent) && isShowMobileOfContent == "1")
{
table.AddCol(model.STRCONTENT);
}
else
{
table.AddCol(Utility.ReplaceMobile(model.STRCONTENT));
}
}
else
{
if (!string.IsNullOrEmpty(isShowMobileOfContent) && isShowMobileOfContent == "1")
{
table.AddCol(model.STRCONTENT, 20, model.STRCONTENT);
}
else
{
table.AddCol(Utility.ReplaceMobile(model.STRCONTENT), 20, Utility.ReplaceMobile(model.STRCONTENT));
}
}
if (MemoType == "7")
{
table.AddCol(Memo_Type[Convert.ToInt32(model.MEMO_TYPE)]);
table.AddCol(Handler.MethodRsource.GetMemoBusinessName(Convert.ToInt32(model.MEMO_TYPE), Convert.ToInt32(model.BUSINESSID)));
}
memotype = memoTypeList.FirstOrDefault(m => m.TYPEID == model.MEMOTYPEID);
table.AddCol(memotype == null ? "" : memotype.TYPENAME);
memosubType = memoSubTypeList.FirstOrDefault(m => m.SUBTYPEID == model.MEMOSUBTYPEID);
table.AddCol(memosubType == null ? "" : memosubType.TYPENAME);
if (model.ExtMemoId.HasValue)
{
model.STRCONTENT = model.STRCONTENT + string.Format("<a style='padding-left:20px' href='javascript:void(0)' onclick='mmore({0})'>更多</a>", model.ExtMemoId.Value);
}
var userInfo = userMapping.FirstOrDefault(n => n.PKID == model.INNERUSERID);
var userName = "";
if (userInfo != null)
{
userName = userInfo.EID + "-" + userInfo.UNAME;
}
table.AddCol(userName);
//table.AddCol(InnerUserHelper.Instance.EidAndName(model.INNERUSERID));
if (model.CTIME.HasValue)
table.AddCol(model.CTIME.Value.ToString("yyyy-MM-dd") + "<br/>" + model.CTIME.Value.ToString("HH:mm:ss"));
else
table.AddCol("");
table.AddCol(GetTimeSpace(model.CALLTIME, model.CALLTIMEEND));
table.AddCol(model.COMPANYNAME.ToString());
if (model.COMPANYNAME == "合规")
{
table.AddCol(string.Format("<a href='javascript:void(0);' onclick='javascript: ReroldCallTime({0});' >修正</a>", model.MEMOID));
}
else
{
table.AddCol("");
}
table.AddRow(GetStyle(styleList, model.MEMOSTYLEID));
}
var json = new
{
totalPages = pager.totalPages,
totalRows = pager.totalRows,
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
#region
public JsonResult GetMessageHtml(Pager pg, string ResId, int? rn, DateTime? stime, DateTime? etime)
{
Table table = new Table("", true);
table.gridPager = pg;
var ds = batchMsg_Q.GetMessageList(ref pg, ResId, rn, stime, etime);
foreach (System.Data.DataRow item in ds.Tables[0].Rows)
{
table.AddCol(item["RESID"]);
table.AddCol(string.IsNullOrEmpty(item["EID"].ToString()) ? "" : item["EID"].ToString() + " - " + item["UNAME"].ToString());
//table.AddCol(PhoneHelper.FormatPhoneUserNameContent(item["MESSAGE"].ToString()));
if (item["SUBTYPECODE"] == null)
table.AddCol(PhoneHelper.FormatPhoneUserNameContent(item["MESSAGE"].ToString(), ""));
else
table.AddCol(PhoneHelper.FormatPhoneUserNameContent(item["MESSAGE"].ToString(), item["SUBTYPECODE"].ToString()));
table.AddCol(item["SENDTIME"]);
table.AddRow();
}
var json = new
{
totalPages = pg.totalPages,
totalRows = pg.totalRows,
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
#endregion
#region
public JsonResult UpdateNoCallTime(string MemoId)
{
bool result = false;
try
{
decimal memoid = Convert.ToDecimal(MemoId);
CSVR_CALLRECORD_BL.UpdateCallTime(memoid);
result = true;
}
catch (Exception ex)
{
result = false;
}
var json = new
{
result = result
};
return Json(json, JsonRequestBehavior.AllowGet);
}
public bool UpdateNoTime(List<MemoIds> memoIds)
{
try
{
string Strmemoids = "";
if (memoIds.Count > 0)
{
foreach (var item in memoIds)
{
Strmemoids += item.MemoId + ",";
}
}
Strmemoids = Strmemoids.Substring(0, Strmemoids.Length - 1);
CSVR_CALLRECORD_BL.UpdateNoTimeBymemoids(Strmemoids);
return true;
}
catch
{
return false;
}
}
public class MemoIds
{
public Nullable<decimal> MemoId { get; set; }
public Nullable<decimal> UserEid { get; set; }
}
#endregion
private string GetStyle(List<ORD_MEMOSTYLE> styleList, decimal? id)
{
if (id == null)
return "style='color:black;'";
ORD_MEMOSTYLE style = styleList.Where(m => m.STYLEID == id.Value).FirstOrDefault();
if (style == null)
return "style='color:black;'";
else
return string.Format("style='color:{0};'", style.STYLECODE);
}
private string GetTimeSpace(DateTime? time1, DateTime? time2)
{
string timeStr = "";
if (time1 == null)
timeStr += "--:--:--";
else
timeStr += time1.Value.ToString("HH:mm:ss");
timeStr += "~<br/>";
if (time2 == null)
timeStr += "--:--:--";
else
timeStr += time2.Value.ToString("HH:mm:ss");
return timeStr;
}
#endregion
#region
public ViewResult SaleDptAllMemoUC(CustomerInfo info)
{
return View(info);
}
public JsonResult GetSaleDeptMemoQueryHtml(Pager pager, string ResId, string MemoType, decimal? pageType, string IsValid)
{
string isShowMobileOfContent = cacheQ.GetValue_Parameter(Model.Enum.Parameter.Sys_IsShowMobileOfContent);
List<ORD_MemoQuery> list = ord_memo_Q.GetTGAllMemoListByResId(int.MaxValue, ResId, IsValid);//获取所有工单
Table table = new Table("", true);
table.gridPager = pager;
ICACHE_Q ui = DataCacheHelper.GetCache();
//List<ORD_MEMOTYPE> memoTypeList = ui.GetList_MemoType(0);//缓存读取 工单大类数据
//List<ORD_MEMOSUBTYPE> memoSubTypeList = ui.GetList_MemoSubType(0);//缓存读取 获取所有工单小类数据
List<ORD_MEMOSTYLE> styleList = DataCacheHelper.GetCache().GetList_MemoStyle();
Dictionary<int, string> Memo_Type = OperationUtil.GetDicFromEnum<WX.CRM.Model.Enum.EnumMemoType>();
//ORD_MEMOTYPE memotype = null;
//ORD_MEMOSUBTYPE memosubType = null;
foreach (ORD_MemoQuery model in list)
{
table.AddCol(model.MEMOID);
table.AddCol(Memo_Type[Convert.ToInt32(model.MEMO_TYPE)]);
table.AddCol(Handler.MethodRsource.GetMemoBusinessName(Convert.ToInt32(model.MEMO_TYPE), Convert.ToInt32(model.BUSINESSID)));
//memotype = memoTypeList.FirstOrDefault(m => m.TYPEID == model.MEMOTYPEID);
//table.AddCol(memotype == null ? "" : memotype.TYPENAME);
//memosubType = memoSubTypeList.FirstOrDefault(m => m.SUBTYPEID == model.MEMOSUBTYPEID);
//table.AddCol(memosubType == null ? "" : memosubType.TYPENAME);
if (pageType != null)//查看更多工单的,显示全部工单内容
{
if (!string.IsNullOrEmpty(isShowMobileOfContent) && isShowMobileOfContent == "1")
{
table.AddCol(model.STRCONTENT);
}
else
{
table.AddCol(Utility.ReplaceMobile(model.STRCONTENT));
}
}
else
{
if (!string.IsNullOrEmpty(isShowMobileOfContent) && isShowMobileOfContent == "1")
{
table.AddCol(model.STRCONTENT, 20, model.STRCONTENT);
}
else
{
table.AddCol(Utility.ReplaceMobile(model.STRCONTENT), 20, Utility.ReplaceMobile(model.STRCONTENT));
}
}
//table.AddCol(InnerUserHelper.Instance.EidAndName(model.INNERUSERID));
table.AddCol(model.TGsalesName);
if (model.CTIME.HasValue)
table.AddCol(model.CTIME.Value.ToString("yyyy-MM-dd") + "<br/>" + model.CTIME.Value.ToString("HH:mm:ss"));
else
table.AddCol("");
table.AddCol(GetTimeSpace(model.CALLTIME, model.CALLTIMEEND));
table.AddRow(GetStyle(styleList, model.MEMOSTYLEID));
}
var json = new
{
totalPages = pager.totalPages,
totalRows = pager.totalRows,
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
#endregion
#region
public ViewResult CustomerOrderUC(CustomerInfo info)
{
ViewBag.CustomerId = info.CustomerId;
return View();
}
public ViewResult CustomerModuleUC()
{
return View();
}
#endregion
#region
public ViewResult CustomerLevel2OrderUC(CustomerInfo info)
{
ViewBag.CustomerId = info.CustomerId;
return View();
}
#endregion
#region
public ViewResult CustomerActivityUC(CustomerInfo info)
{
ViewBag.CustomerId = info.CustomerId;
return View();
}
#endregion
#region
public ViewResult CustomerWxUserUC(CustomerInfo info)
{
DataTable tab = null;
try
{
ViewBag.WorkwxEid = Eid;
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);//获取员工角色
ViewBag.RoleCodes = roleCodes;
tab = wxrcontact.GetChatUserByResId(info.CustomerId);
}
catch (Exception ex)
{
WX.CRM.Common.LogHelper.Error("【CustomerUCController.CustomerWxUserUC()】" + ex.Message + ex.StackTrace);
}
ViewBag.modelList = tab;
return View();
}
#endregion
#region 线
public ViewResult SalesLeadsUC(CustomerInfo info)
{
ViewBag.resid = info.CustomerId;
return View();
}
public JsonResult GetSalesLead(string resid)
{
var appid = Utility.GetSettingOrNullByKey("appid");
var appSecret = Utility.GetSettingOrNullByKey("appSecret");
var salesleadDto = new List<saledsleadDto>();
List<saleslead> saleslead = new List<saleslead>();
try
{
var userlist = _wwExtUserResId.GetList(p => p.RESID == resid);
foreach (var user in userlist)
{
if (user != null)
{
var extuser = _wwExtUser.Get(p => p.USERID == user.USERID);
if (extuser != null)
{
var exinfo = extuser.EXINFO.ToObject<WwExtUserView>();
exinfo.corpid = extuser.CORPID;
string name = "企业微信";
if (exinfo.external_contact != null)
{
name = exinfo.external_contact.name;
saleslead.Add(new Model.DTO.saleslead() { name = name, appid = exinfo.corpid, appuserid = exinfo.external_contact.external_userid });
}
}
}
}
List<RES_CUSTOMERUSER> list = customeruser_q.GetListByCustomerId(resid);
string deptId = "";
BAS_PARAMETER deptSetting = _BAS_PARAMETER_Q.GetModel_Patameter("SalesLeadsDeptSetting");
if (deptSetting != null && !string.IsNullOrEmpty(deptSetting.PARAVALUE))
{
try
{
var saledeptList = deptSetting.PARAVALUE.ToObject<List<SalesLeadSetting>>();
deptId = saledeptList.FirstOrDefault(n => n.DeptCode == saleDeptCode)?.DeptId;
}
catch (Exception e)
{
LogHelper.Error(e.ToString());
}
}
foreach (var item in list)
{
string name = PhoneHelper.FormatPhoneUserName(item.USERNAME);
saleslead.Add(new Model.DTO.saleslead() { name = name, appid = "com.dongniu", appuserid = item.USERNAME, deptid = deptId, eid = Eid.ToString() });
}
BAS_PARAMETER model = _BAS_PARAMETER_Q.GetModel_Patameter("ISVR_Saleclus_Get");
if (model != null && !string.IsNullOrEmpty(model.PARAVALUE))
{
try
{
string httpurl = model.PARAVALUE;
List<RES_CUSTOMER> customerlist = customer_Q.GetList_CustomerByResid(resid);
IList<string> mm = _resource.GetNumberByResIdList(customerlist.Select(m => m.RESID).ToList());
var objecb = new { mobiles = mm };
string retmss = Utility.PostAjaxData(httpurl, JsonHelper.ObjDivertToJson(objecb), Encoding.UTF8);
var result = JsonHelper.JsonDivertToObj<SaleClusResult>(retmss);
if (result.iRet == 0 && result.list.Count > 0)
{
foreach (var item in result.list)
{
var en = saleslead.FirstOrDefault(m => m.appuserid == item.appuserid && m.appid == item.appid);
if (en != null)
{
continue;
}
string myname = item.appuserid;
if (item.appuserid.Length > 10)
{
myname = item.appuserid.Substring(0, 10) + "*****";
}
saleslead.Add(new Model.DTO.saleslead() { name = myname, appid = item.appid, appuserid = item.appuserid, deptid = deptId, eid = Eid.ToString() });
}
}
}
catch (Exception e)
{
LogHelper.Error(e.ToString());
}
}
// 加密数据进content
WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper();
var content = "";
var j = "";
var ext_flag = DateTimeTool.ConvertDateTimeLong(DateTime.Now);
saleslead.ForEach(s =>
{
//content = "";
//j = "";
//j = JsonConvert.SerializeObject(new saledsleadDesDto { appid = s.appid, appuserid = s.appuserid, deptid = s.deptid, eid = s.eid, ext_flag = ext_flag });
j = JsonConvert.SerializeObject(new { account = appid, password = appSecret, s.appid, s.appuserid, s.eid, time = ext_flag });
content = HttpUtility.UrlEncode(sHelper.encyptData("saleclue", j));
salesleadDto.Add(new saledsleadDto { linkUrl = string.Empty, name = s.name, content = content });
});
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
return Json(new { result = false, message = "错误:" + ex.ToString() }, JsonRequestBehavior.AllowGet);
}
return Json(new { result = true, message = "succed", retmsg = saleslead }, JsonRequestBehavior.AllowGet);
}
#endregion 线
#region
public ViewResult CustomerQwUserUC(CustomerInfo info)
{
DataTable tab = null;
try
{
ViewBag.WorkwxEid = Eid;
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(userRoleId);//获取员工角色
ViewBag.RoleCodes = roleCodes;
tab = wxrcontact.GetChatQwByResId(info.CustomerId);
}
catch (Exception ex)
{
WX.CRM.Common.LogHelper.Error("【CustomerUCController.CustomerQwUserUC()】" + ex.Message + ex.StackTrace);
}
ViewBag.modelList = tab;
return View();
}
#endregion
#region
public ViewResult CustomerZxOrder(CustomerInfo info)
{
ViewBag.CustomerId = info.CustomerId;
ViewBag.UserRoles = userRoleCodes;
return View(info);
}
public JsonResult GetOrderListHtml(string resId, CustomerInfo info)
{
Table table = new Table("", true);
string[] resids = customer_Q.GetAllResidByCustomerId(resId);
List<string> resIds = redisFactory.GetList_Rescustomer(resids, resId).Select(s => s.RESID).ToList();
var list = _wxSzzyorder.GetList(p => resIds.Contains(p.RESID));
//var list2 = _wxSzzyorder2.GetList(p => resIds.Contains(p.RESID));
foreach (WX_SZZYORDER model in list)
{
table.AddCol(model.ORDERID);
table.AddCol(string.Format("<font style='color:red;'>{0}</font>", model.SZZYORDERID.ToString()));
table.AddCol(model.SUBPRODUCTNAME);
table.AddCol(getOrderTypeStr(model.ORDERTYPE));
table.AddCol(getOrderStatusStr(model.ORDERSTATUS));
table.AddCol(model.CTIME);
table.AddCol(model.OTIME);
table.AddCol(model.NEEDPAY);
table.AddCol(model.FINALPAY);
table.AddCol(model.ARRIVALPAY);
table.AddCol(model.ARRIVALTIME);
table.AddCol(model.TEAMSERVE == 1 ? "<font style='color:red;font-weight:700'>分公司</font>" : "<font style='color:red;font-weight:700'>总公司</font>");
var link = string.Format("<a href = 'javascript:GetWxPayInfo({0})'> 银行信息 </a> {1}", model.ORDERID, model.ISOPEN == 1 ? string.Format("<a href = 'javascript:RenewOrder({0})'> 续费 </a>", model.ORDERID) : "");
table.AddCol(link);
table.AddRow("onclick='selectRow(this)'");
}
var json = new
{
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
public JsonResult GetPrepaymentListHtml(string resId, CustomerInfo info)
{
Table table = new Table("", true);
string[] resids = customer_Q.GetAllResidByCustomerId(resId);
List<string> resIds = redisFactory.GetList_Rescustomer(resids, resId).Select(s => s.RESID).ToList();
var list = new List<SzzyPrepaymentResultData>();
if (resIds != null)
{
}
foreach (SzzyPrepaymentResultData model in list)
{
table.AddCol(model.prepayment_id);
table.AddCol(model.realname);
table.AddCol(model.to_bank_name);
table.AddCol(model.remit_time);
table.AddCol(model.amount);
table.AddCol(getPrepaymentStatusStr(model.status));
table.AddCol(model.order_id);
table.AddCol(model.ctime);
table.AddCol(model.expire_days);
table.AddRow();
}
var json = new
{
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
public ViewResult CustomerCallRecord(CustomerInfo info)
{
ViewBag.CustomerId = info.CustomerId;
CACHE_BL cache_BL = new CACHE_BL();
var audioUrl = cache_BL.GetValue_Parameter(Parameter.Core_ZxdService_HgListAudioList);
ViewBag.audioUrl = audioUrl;
return View(info);
}
public JsonResult GetRecordListHtml(string resId, CustomerInfo info)
{
Table table = new Table("", true);
Pager pg = new Pager { page = 1, rows = 150 };
var list = CSVR_CALLRECORD_BL.GetCallRecord(ref pg, new Model.MAP.QueryUserComboDto(null, null, null, null), null, null, null, null, resId, null, -1, -1, "PACK_CSVR.CSVR_CALLRECORDQUERY_DETAIL");
List<AiAudioList> res = new List<AiAudioList>();
if (list != null && list.Tables[0] != null)
{
List<string> containList = new List<string>();
foreach (DataRow item in list.Tables[0].Rows)
{
var strIsTran = "";
AiAudioList model = new AiAudioList
{
RECORDID = item["RECORDID"] == DBNull.Value ? "" : item["RECORDID"].ToString(),
strIsTran = strIsTran,
TIMELENGTH = item["TIMELENGTH"] == DBNull.Value ? "" : item["TIMELENGTH"].ToString(),
UNAME = item["UNAME"] + "" + item["SALESEID"],
Eid = string.IsNullOrWhiteSpace(item["SALESEID"].ToString()) ? 0 : Convert.ToDecimal(item["SALESEID"]),
FileName = item["FileName"] == DBNull.Value ? "" : item["FileName"].ToString(),
ServerID = item["ServerID"] == DBNull.Value ? "" : item["ServerID"].ToString(),
OUTDEPT = item["OUTDEPT"] == DBNull.Value ? "" : item["OUTDEPT"].ToString(),
COID = item["COID"] == DBNull.Value ? "" : item["COID"].ToString()
};
if (item["ISTRAN"].ToString() == "1")
{
strIsTran = "(转接)";
}
if (item["CALLTYPE"].ToString() == "1")//呼出
{
model.strIsTran = "呼出" + strIsTran;
model.SERVICENUMBER = item["SERVICENUMBER"].ToString();
model.TELNUMBERLAST4 = item["TELNUMBERLAST4"].ToString();
}
else
{
model.strIsTran = "呼入" + strIsTran;
model.SERVICENUMBER = item["TELNUMBERLAST4"].ToString();
model.TELNUMBERLAST4 = item["SERVICENUMBER"].ToString();
}
if (item["TIMESTART"] != DBNull.Value)
{
model.TIMESTART = Convert.ToDateTime(item["TIMESTART"]);
}
if (item["TIMEEND"] != DBNull.Value)
{
model.TIMEEND = Convert.ToDateTime(item["TIMEEND"]);
}
if (item["COMPANYNAME"] != DBNull.Value)
{
model.CompanyName = Convert.ToString(item["COMPANYNAME"]);
}
model.isAiCall = false;
var conStr = $"{model.RECORDID}_{model.TIMELENGTH}_{model.SERVICENUMBER}_{model.TELNUMBERLAST4}_{model.TIMESTART.ToString()}";
if (containList.Contains(conStr))
{
continue;
}
containList.Add(conStr);
res.Add(model);
}
}
try
{
CACHE_BL cache_BL = new CACHE_BL();
var url = cache_BL.GetValue_Parameter(Parameter.Core_ZxdService_GetAiAudioRecord);
var para = "page=1&limit=150&resId=" + resId;
var retmsg = Utility.PostData(url + "?" + para, Encoding.UTF8);
var retmessage = WebHelper.JsonHelper.JsonDivertToObj<AiAudioRecordDto>(retmsg);
var aiAudioList = retmessage.retmsg;
foreach (var audio in aiAudioList)
{
res.Add(new AiAudioList
{
RECORDID = audio.Id.ToString(),
strIsTran = "呼出",
SERVICENUMBER = audio.Robot,
TELNUMBERLAST4 = audio.Phone,
TIMELENGTH = audio.SvcTime.ToString(),
TIMESTART = audio.StartTime.HasValue ? audio.StartTime.Value.AddHours(8) : audio.StartTime,
TIMEEND = audio.EndTime.HasValue ? audio.EndTime.Value.AddHours(8) : audio.EndTime,
UNAME = "机器人坐席",
FileName = audio.FileName,
CompanyName = "合规"
});
}
}
catch (Exception ex)
{
LogHelper.Error("获取Ai录音错误" + ex.Message);
}
var t = res.Where(w => res.Where(w2 => w2.COID == w.COID).Count() > 1);
// 拿出同COID下录音id更小的因为更小的是北一的数据
var t2 = t.GroupBy(g => g.COID).Select(s => new AiAudioList { COID = s.Key, RECORDID = s.Min(m => long.Parse(m.RECORDID)).ToString() }).ToList();
res = res.Where(r => t.FirstOrDefault(f => r.COID == f.COID) == null || (t.FirstOrDefault(f => r.COID == f.COID) != null && t.FirstOrDefault(f => r.COID == f.COID).RECORDID == r.RECORDID)).OrderByDescending(n => n.TIMESTART).Take(150).ToList();
//获取事业部配置
var deptMapList = customer_Q.GetUserDeptNameByEid(res.Select(n => n.Eid).ToList());
foreach (var item in res)
{
table.AddCol(item.RECORDID);
if (deptMapList != null)
{
var eidMap = deptMapList.FirstOrDefault(n => n.Eid == item.Eid);
if (eidMap != null)
{
table.AddCol(eidMap.DeptName);
}
else
{
table.AddCol("");
}
}
else
{
table.AddCol("");
}
table.AddCol(item.strIsTran);
table.AddCol(item.SERVICENUMBER);//主叫
table.AddCol(item.TELNUMBERLAST4);//被叫
table.AddCol(item.TIMELENGTH);
table.AddCol(item.TIMESTART);
table.AddCol(item.TIMEEND);
table.AddCol(item.UNAME);
table.AddCol(item.CompanyName);
if (!item.isAiCall)
{
string cti;
string outdept = string.Empty;
if (item.OUTDEPT != "")
{
outdept = item.OUTDEPT;
}
string playurl = "";
string playcrl = "";
if (item.CompanyName == "合规")
{
playurl = _getCallRecordUrl(item.ServerID.ToString(), item.FileName, outdept, out cti);
playcrl = string.Format("<input id=\"BtnPlayer\" type=\"button\" value=\" 播 放 \" onclick=\"PalyRecord('{0}','DivPlayer{1}','{2}',{3})\" />", playurl, item.RECORDID, cti == null ? "" : cti, Convert.ToInt64(item.RECORDID));
}
else
{
playurl = _getOtherCallRecordUrl(item.CompanyName, item.FileName, out cti);
playcrl = string.Format("<input id=\"BtnPlayer\" type=\"button\" value=\" 播 放 \" onclick=\"PalyRecord('{0}','DivPlayer{1}','{2}',{3})\" />", playurl, item.RECORDID, cti == null ? "" : cti, Convert.ToInt64(item.RECORDID));
}
playcrl += string.Format("<div id=\"DivPlayer{0}\"></div><input type=\"hidden\" id=\"hidRecordUrl\" value=\"{1}\" />", item.RECORDID, playurl);
table.AddCol(playcrl);
}
else
{
var playcrl = string.Format("<input id=\"BtnPlayer\" type=\"button\" value=\" 播 放 \" onclick=\"PalyAiRecord('{0}')\" />", item.FileName);
playcrl += string.Format("<input id=\"BtnPlayer\" type=\"button\" value=\" 查 看 \" onclick=\"AiAudioDetail('{0}')\" />", item.RECORDID);
table.AddCol(playcrl);
}
table.AddRow();
}
var json = new
{
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
private string _getCallRecordUrl(string _ServerID, string _FileName, out string cti)
{
var playurl = "";
cti = "";
var _IAD_localhostCallRecord = _BAS_PARAMETER_Q.GetModel_Patameter("ICSR_IAD_localhostCallRecord");
if (null != _IAD_localhostCallRecord)
{
var FuturesRecordServerUrl = _IAD_localhostCallRecord.PARAVALUE;
playurl = FuturesRecordServerUrl + "?serverID=" + _ServerID + "&file=" + _FileName.Replace("\\", "/");
cti = _CSVR_CALLRECORD_Q.Sys_Environment_CTI_VER();
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.).ToString())
{
playurl = FuturesRecordServerUrl + "?file=" + _FileName.Replace("\\", "/");
}
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.).ToString())
{
var shjctiinterface = Utility.GetSettingByKey("shj");
playurl = shjctiinterface + "?action=record_download&filename=/var/spool/asterisk/monitor/" + _FileName.Replace("\\", "/");
}
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.).ToString())
{
playurl = FuturesRecordServerUrl + "?file=" + _FileName;
}
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.).ToString())
{
playurl = FuturesRecordServerUrl + _FileName;
}
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.new).ToString())
{
_IAD_localhostCallRecord = _BAS_PARAMETER_Q.GetModel_Patameter("ICSR_IAD_localhostCallRecord_AX");
var filename = _FileName;
if (null != _IAD_localhostCallRecord)
{
playurl = _IAD_localhostCallRecord.PARAVALUE + (filename.StartsWith("UP") ? "/home/" + filename : filename);
playurl = playurl.Replace("\\", "/");
}
}
}
return playurl;
}
private string _getCallRecordUrl(string _ServerID, string _FileName, string outdept, out string cti)
{
var playurl = "";
cti = "";
var _IAD_localhostCallRecord = _BAS_PARAMETER_Q.GetModel_Patameter("ICSR_IAD_localhostCallRecord");
if (null != _IAD_localhostCallRecord)
{
var FuturesRecordServerUrl = _IAD_localhostCallRecord.PARAVALUE;
playurl = FuturesRecordServerUrl + "?serverID=" + _ServerID + "&file=" + _FileName.Replace("\\", "/");
cti = _CSVR_CALLRECORD_Q.Sys_Environment_CTI_VER();
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.).ToString())
{
playurl = FuturesRecordServerUrl + "?file=" + _FileName.Replace("\\", "/");
}
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.).ToString())
{
var shjctiinterface = Utility.GetSettingByKey("shj");
playurl = shjctiinterface + "?action=record_download&filename=/var/spool/asterisk/monitor/" + _FileName.Replace("\\", "/");
}
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.).ToString())
{
playurl = FuturesRecordServerUrl + "?file=" + _FileName;
}
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.).ToString())
{
playurl = FuturesRecordServerUrl + _FileName;
}
if (cti != null && cti == ((int)WX.CRM.Model.Enum.CTI_VER.new).ToString())
{
_IAD_localhostCallRecord = _BAS_PARAMETER_Q.GetModel_Patameter("ICSR_IAD_localhostCallRecord_AX" + (string.IsNullOrEmpty(outdept) ? "" : ("_" + outdept)));
var filename = _FileName;
if (null != _IAD_localhostCallRecord)
{
playurl = _IAD_localhostCallRecord.PARAVALUE + (filename.StartsWith("UP") ? "/home/" + filename : filename);
playurl = playurl.Replace("\\", "/");
}
}
}
return playurl;
}
private string _getOtherCallRecordUrl(string companyName, string fileName, out string cti)
{
cti = "";
var recordSetting = _BAS_PARAMETER_Q.GetModel_Patameter("RecordSetting");
if (recordSetting != null && !string.IsNullOrWhiteSpace(recordSetting.PARAVALUE))
{
var setting = recordSetting.PARAVALUE.ToObject<List<RecordSetting>>();
var obj = setting.FirstOrDefault(n => n.CompanyName == companyName);
if (obj != null)
{
cti = _CSVR_CALLRECORD_Q.Sys_Environment_CTI_VER();
return $"{obj.Url}{fileName}";
}
}
return "";
}
public ViewResult CustomerTDOrder(CustomerInfo info)
{
ViewBag.CustomerId = info.CustomerId;
return View(info);
}
public ViewResult CustomerJZOrder(CustomerInfo info)
{
ViewBag.CustomerId = info.CustomerId;
ViewBag.AllResIds = string.Join(",", info.ResCustomerList.Select(m => m.RESID).ToArray());
return View(info);
}
public ViewResult CustomerCommonOrder(CustomerInfo info)
{
ViewBag.CustomerId = info.CustomerId;
return View(info);
}
public JsonResult GetTDOrderListHtml(string resId, CustomerInfo info)
{
Table table = new Table("", true);
//string[] resids = customer_Q.GetAllResidByCustomerId(customerId);
//List<string> resIds = redisFactory.GetList_Rescustomer(resids, customerId).Select(s => s.RESID).ToList();
//var list = _wxSzzyorder.GetList(p => p.RESID == resId);
string[] resids = customer_Q.GetAllResidByCustomerId(resId);
List<string> resIds = redisFactory.GetList_Rescustomer(resids, resId).Select(s => s.RESID).ToList();
var list = _wxSzzyorder.GetList(p => resIds.Contains(p.RESID));
foreach (WX_SZZYORDER model in list)
{
table.AddCol(model.ORDERID);
table.AddCol(model.SZZYORDERID);
table.AddCol(model.SUBPRODUCTNAME);
table.AddCol(getOrderTypeStr(model.ORDERTYPE));
table.AddCol(getOrderStatusStr(model.ORDERSTATUS));
table.AddCol(model.CTIME);
table.AddCol(model.OTIME);
table.AddCol(model.NEEDPAY);
table.AddCol(model.FINALPAY);
table.AddCol(model.ARRIVALPAY);
table.AddCol(model.ARRIVALTIME);
table.AddRow("onclick='selectRow(this)'");
}
var json = new
{
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
public class userRet
{
public string orderid { set; get; }
public string softwarename { set; get; }
}
public JsonResult GetJZOrderListHtml(string resId, CustomerInfo info, int type = 0)
{
Table table = new Table("", true);
WX_SZZYORDER_BL bill = new WX_SZZYORDER_BL();
List<string> containOrder = new List<string>();
List<string> filter = new List<string>
{
"已开通","已升级","已退款","已到期"
};
var res = bill.GetOrderListByHgCrm(resId);
var zxdUsernameList = new List<userRet>();
try
{
var orderidList = String.Join(";", res.Select(s => s.ORDERID));
var webapi = cacheQ.GetValue_Parameter("Zxd_CoreApiUrl");
var zxdurl = $"{webapi}Api/Customer/UsernamesByOrderid";
//var zxdurl = $"http://localhost:5244/Api/Customer/UsernamesByOrderid?orderidList={orderidList}";
var result = Utility.GetData(zxdurl, $"orderidList={orderidList}", Encoding.Default);
zxdUsernameList = result.ToObject<WX.CRM.Common.Employee.ApiResult<List<userRet>>>().data;
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
}
List<string> containOrderList = new List<string>();
foreach (var model in res)
{
if (containOrderList.Contains(model.ORDERID.ToString()))
{
continue;
}
containOrderList.Add(model.ORDERID.ToString());
var orderStr = $"{model.ORDERID}_{model.SUBPRODUCTNAME}_{model.CTIME}";
if (containOrder.Contains(orderStr))
{
continue;
}
else
{
containOrder.Add(orderStr);
}
if (type != 1 && !filter.Contains(Convert.ToString(model.ORDERSTATUSNAME)))
{
continue;
}
var zxdUsername = zxdUsernameList.Find(z => z.orderid == model.ORDERID.ToString());
table.AddCol(model.ORDERID);
table.AddCol(model.ChannelName);
table.AddCol(model.SZZYORDERID);
table.AddCol(model.SUBPRODUCTNAME);
table.AddCol(model.PRODUCTCODE);
table.AddCol(model.ORDERTYPE);
table.AddCol(zxdUsername != null ? zxdUsername.softwarename : "");
table.AddCol(model.ORDERSTATUSNAME);
table.AddCol(model.CTIME);
table.AddCol(model.OTIME);
table.AddCol(model.NEEDPAY);
//table.AddCol(model.FINALPAY);
table.AddCol(model.ARRIVALPAY);
table.AddCol(model.OPENDAYS);
table.AddCol(model.giftdays);
table.AddCol(model.giftdays2);
table.AddCol(model.contractctime);
table.AddRow("onclick='selectRow(this)'");
}
var json = new
{
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
public JsonResult GetCommonOrderListHtml(string resId, CustomerInfo info)
{
Table table = new Table("", true);
string[] resids = customer_Q.GetAllResidByCustomerId(resId);
List<string> resIds = redisFactory.GetList_Rescustomer(resids, resId).Select(s => s.RESID).ToList();
var list = _wxSzzyorder.GetList(p => resIds.Contains(p.RESID));
foreach (WX_SZZYORDER model in list)
{
table.AddCol(model.ORDERID);
table.AddCol(model.SUBPRODUCTNAME);
table.AddCol(getOrderTypeStr(model.ORDERTYPE));
table.AddCol(getOrderStatusStr(model.ORDERSTATUS));
table.AddCol(model.CTIME);
table.AddCol(model.OTIME);
table.AddCol(model.NEEDPAY);
table.AddCol(model.FINALPAY);
table.AddCol(model.ARRIVALPAY);
table.AddRow("onclick='selectRow(this)'");
}
var json = new
{
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
public JsonResult GiveUp(string resid)
{
try
{
var response = _distribute.GiveUp(resid, UserId);
return Json(new { result = true, msg = response }, JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
return Json(new { result = false, msg = string.Empty }, JsonRequestBehavior.AllowGet);
}
}
private string getOrderTypeStr(decimal? orderType)
{
if (!orderType.HasValue)
return "";
if (orderType == 1)
{
return "普通订单";
}
else if (orderType == 2)
{
return "续费订单";
}
else if (orderType == 3)
{
return "升级订单";
}
else if (orderType == 4)
{
return "换课订单";
}
else
{
return "";
}
}
private string getPrepaymentStatusStr(decimal? status)
{
if (!status.HasValue)
return "";
if (status == 0)
{
return "初始(未确认)";
}
else if (status == 1)
{
return "已确认";
}
else if (status == 2)
{
return "已支付(已用于订单付款)";
}
else if (status == 3)
{
return "已到期(三十天到期)";
}
else if (status == 4)
{
return "已退款";
}
else if (status == 5)
{
return "无效(汇款记录被拒绝)";
}
else
{
return "";
}
}
private string getOrderStatusStr(string orderStatus)
{
if (orderStatus == "0")
{
return string.Format("<font style=\"color:red\">下单失败</span>");
}
else if (orderStatus == "1")
{
return "未开通";
}
else if (orderStatus == "2")
{
return "部分支付";
}
else if (orderStatus == "3")
{
return "已支付";
}
else if (orderStatus == "4")
{
return "已开通";
}
else if (orderStatus == "5")
{
return "已到期";
}
else if (orderStatus == "6")
{
return "已升级";
}
else if (orderStatus == "7")
{
return "已退款";
}
else if (orderStatus == "8")
{
return "已取消";
}
else if (orderStatus == "9")
{
return "已关闭";
}
else if (orderStatus == "10")
{
return "隐藏";
}
else
{
return "";
}
}
#endregion
#region
[HttpGet]
public ActionResult BindUser(bool isAdd, string resid)
{
ViewBag.isAdd = isAdd;
ViewBag.resid = resid;
return View();
}
public JsonResult BindUserSub(bool isAdd, string resid, string userIdType, string val)
{
try
{
ValidationErrors errors = new ValidationErrors();
string msg = isAdd ? "绑定成功!" : "解绑成功!";
var oldresid = resid;
if (!string.IsNullOrEmpty(val))
{
RES_CUSTOMER oldCustomer = new RES_CUSTOMER();
RES_CUSTOMER newCustomer = new RES_CUSTOMER();
switch (userIdType.ToLower())
{
case "phone"://手机号
#region
if (string.IsNullOrEmpty(val))
return Json(new { s = false, m = "联系号码不能为空" });
val = val.Trim().Replace("-", "");
if (val.StartsWith("1") && !Utility.ChekMobile(val))//如果是以1开头的就必须按照手机号码格式
{
return Json(new { s = false, m = "联系号码不正确" });
}
else if (!Utility.CheckIsNum(val))
{
return Json(new { s = false, m = "联系号码不正确" });
}
var cNumber = val;
var resId = ResUtil.CreateResId(cNumber);
var customerFrom = "HMJ_CRM"; //来源标签,是否改成从配置表中取
if (!ExistsResId(cNumber))
{
if (!isAdd)
{
return Json(new { s = true, m = "联系号码未注册,无法解绑!" });
}
if (companyCode == "SHZZ")
{
customerFrom = "27100";
try
{
var userName = companyCode.ToLower() + cNumber.Substring(3, cNumber.Length - 3);
var password = userName;
var guid = Guid.NewGuid().ToString();
var ch = cacheQ.GetValue_Parameter("QRCodeCH");
if (soft_RegAndOrderLink_BL.HasUserName(userName))
{
userName = companyCode.ToLower() + cNumber.Substring(3, cNumber.Length - 3) + guid.Substring(0, 4);
}
var res = soft_RegAndOrderLink_BL.RegToUP(userName, cNumber, ch, "P", guid, password, Eid);
LogHelper.Info("注册返回结果:" + res.ToJson());
if (res.ret == 0)
{
_regUser.RegUser(cNumber, customerFrom, null, userName, DateTime.Now, 0, cNumber);
}
else
{
if (res.ret == -1108)
{
LogHelper.Info("自动注册软件用户已经存在!");
return Json(new { s = false, m = "注册失败,请重新再试!" });
}
else if (res.ret == -1212)
{
var url = cacheQ.GetValue_Parameter("Core_ZxdService_SoftUserInfo");
if (!string.IsNullOrEmpty(url))
{
var retmsg = Utility.PostData(url + "?ResId=" + resId, Encoding.UTF8);
var retmessage = WebHelper.JsonHelper.JsonDivertToObj<retMsg>(retmsg);
LogHelper.Info("retmessage:" + retmessage.ToJson());
if (retmessage.result)
{
userName = retmessage.retmsg;
_regUser.RegUser(cNumber, customerFrom, null, userName, DateTime.Now, 0, cNumber);
}
else
{
LogHelper.Info("自动注册手机号已经存在!");
return Json(new { s = false, m = "注册失败,请重新再试!" });
}
}
}
}
}
catch (Exception ee)
{
LogHelper.Error(ee.ToString());
}
}
}
else
{
// 解绑
if (!isAdd)
{
newCustomer = customer_Q.getResCustomerByResId(resId);
if (newCustomer.CUSTOMERID != resid)
{
return Json(new { s = false, m = "手机号未绑定当前资源,解绑失败!" });
}
newCustomer.CUSTOMERID = resId;
_customer.Update(ref errors, newCustomer);
return Json(new { s = true, m = "解绑成功!" });
}
else
{
newCustomer = customer_Q.getResCustomerByResId(resId);
newCustomer.CUSTOMERID = resid;
_customer.Update(ref errors, newCustomer);
return Json(new { s = true, m = "绑定成功!" });
}
}
if (string.IsNullOrEmpty(oldresid))//根据旧的ID获取数据
{
if (companyCode == "SHZZ")
{
customerFrom = "27100";
var userName = companyCode.ToLower() + cNumber.Substring(3, cNumber.Length - 3);
var password = userName;
var guid = Guid.NewGuid().ToString();
var ch = cacheQ.GetValue_Parameter("QRCodeCH");
if (soft_RegAndOrderLink_BL.HasUserName(userName))
{
userName = companyCode.ToLower() + cNumber.Substring(3, cNumber.Length - 3) + guid.Substring(0, 4);
}
var res = soft_RegAndOrderLink_BL.RegToUP(userName, cNumber, ch, "P", guid, password, Eid);
LogHelper.Info("注册返回结果:" + res.ToJson());
if (res.ret == 0)
{
_regUser.RegUser(cNumber, customerFrom, null, userName, DateTime.Now, 0, cNumber);
}
else
{
if (res.ret == -1108)
{
LogHelper.Info("自动注册软件用户已经存在!");
return Json(new { s = false, m = "注册失败,请重新再试!" });
}
else if (res.ret == -1212)
{
var url = cacheQ.GetValue_Parameter("Core_ZxdService_SoftUserInfo");
if (!string.IsNullOrEmpty(url))
{
var retmsg = Utility.PostData(url + "?ResId=" + resId, Encoding.UTF8);
var retmessage = WebHelper.JsonHelper.JsonDivertToObj<retMsg>(retmsg);
LogHelper.Info("retmessage:" + retmessage.ToJson());
if (retmessage.result)
{
userName = retmessage.retmsg;
_regUser.RegUser(cNumber, customerFrom, null, userName, DateTime.Now, 0, cNumber);
}
else
{
LogHelper.Info("自动注册手机号已经存在!");
return Json(new { s = false, m = "注册失败,请重新再试!" });
}
}
}
}
}
else
{
_customer.ResgisterCustomer(cNumber, resId, customerFrom);
}
_customer.HandlerSalerAddCustomer(resId, UserId);
}
else
{
var thedata = customerDetail_Q.GetModel_RES_CUSTOMERDETAIL(oldresid);
var customerDetail = new RES_CUSTOMERDETAIL();
customerDetail.RESID = resId;
customerDetail.QQ = thedata.QQ;
customerDetail.ADDRESS = thedata.ADDRESS;
customerDetail.AMOUNTTYPEID = thedata.AMOUNTTYPEID;
customerDetail.CITYID = thedata.CITYID;
customerDetail.CNAME = thedata.CNAME;
customerDetail.CUSTOMERTYPEID = thedata.CUSTOMERTYPEID;
customerDetail.EMAIL = thedata.EMAIL;
customerDetail.FAX = thedata.FAX;
customerDetail.GENDER = thedata.GENDER;
customerDetail.JOBTYPEID = thedata.JOBTYPEID;
customerDetail.MSN = thedata.MSN;
customerDetail.OPERATIONTYPE = thedata.OPERATIONTYPE;
customerDetail.PRIMARYNUMBERADDRESS = thedata.PRIMARYNUMBERADDRESS;
customerDetail.PROVINCEID = thedata.PROVINCEID;
var xmls = new XmlSerializer(typeof(RES_CUSTOMERDETAIL));
var sw = new StringWriter();
xmls.Serialize(sw, customerDetail);
_customer.ResgisterCustomer(cNumber, resId, customerFrom, sw.ToString());
oldCustomer = customer_Q.getResCustomerByResId(oldresid);
newCustomer = customer_Q.getResCustomerByResId(resId);
newCustomer.CUSTOMERID = oldCustomer.CUSTOMERID;
_customer.Update(ref errors, newCustomer);
_customer.HandlerSalerAddCustomer(resId, UserId);
}
#endregion
break;
case "resid"://客户id
#region id绑定与解绑
// 绑定
if (isAdd)
{
newCustomer = customer_Q.getResCustomerByResId(val);
newCustomer.CUSTOMERID = resid;
_customer.Update(ref errors, newCustomer);
return Json(new { s = true, m = "绑定成功!" });
}
var newResId = val;
newCustomer = customer_Q.getResCustomerByResId(newResId);
if (newCustomer == null)
{
return Json(new { s = false, m = "客户id不存在绑定关系" });
}
if (newCustomer.RESID == newCustomer.CUSTOMERID)//自己就是主号码
{
var CustomerList = customer_Q.GetListByResId(newResId);//找到所有号码
var otherList = CustomerList.Where(m => m.RESID != newResId);
var newCustomerId = otherList.OrderByDescending(m => m.CTIME).First();//
foreach (var item in otherList)
{
item.CUSTOMERID = newCustomerId.RESID;
_customer.Update(ref errors, item); //更新新id
}
}
//解绑当前客户id
newCustomer.CUSTOMERID = newCustomer.RESID;
_customer.Update(ref errors, newCustomer);
return Json(new { s = true, m = "解绑成功!" });
#endregion id绑定与解绑
default:
return Json(new { s = false, m = "未知客户信息!" });
}
}
else
{
msg = userIdType == "phone" ? "手机号不能为空!" : "客户id不能为空";
return Json(new { s = false, m = msg });
}
return Json(new { s = true, m = msg });
}
catch (Exception ex)
{
return Json(new { s = false, m = ex.Message });
}
}
/// <summary>
/// 客户ID是否存在存在true不存在false
/// </summary>
/// <param name="mobile">传入手机号码</param>
/// <returns></returns>
private bool ExistsResId(string mobile)
{
var resId = ResUtil.CreateResId(mobile);
var model = customer_Q.getResCustomerByResId(resId);
if (model == null)
return false;
return true;
}
#endregion
public class WwExtUserView
{
public External_Contact external_contact { get; set; }
public List<Follow_User> follow_user { get; set; }
public string corpid { get; set; }
}
public class External_Contact
{
public string external_userid { get; set; }
public string name { get; set; }
//public int type { get; set; }
//public string avatar { get; set; }
}
public class Follow_User
{
public string saleeid { get; set; }
public string userid { get; set; }
public string remark { get; set; }
public string description { get; set; }
public long createtime { get; set; }
public string bindtime { get; set; }
public List<string> remark_mobiles { get; set; }
public string uname { get; set; }
}
/// <summary>
/// 销售组部分配置参数
/// </summary>
public class SalesLeadSetting
{
public string DeptCode { get; set; }
public string DeptId { get; set; }
public string DeptName { get; set; }
}
public class AiAudioList
{
public string RECORDID { get; set; }
public decimal? Eid { get; set; }
public string strIsTran { get; set; }
public string SERVICENUMBER { get; set; }
public string TELNUMBERLAST4 { get; set; }
public string TIMELENGTH { get; set; }
public DateTime? TIMESTART { get; set; }
public DateTime? TIMEEND { get; set; }
public string UNAME { get; set; }
public string ServerID { get; set; }
public string FileName { get; set; }
public string OUTDEPT { get; set; }
public string COID { get; set; }
public bool isAiCall { get; set; } = true;
public string CompanyName { get; set; }
}
public class RecordSetting
{
public string CompanyName { get; set; }
public string Url { get; set; }
}
public class WxTranUserDetailDto
{
public string softusername { get; set; }
public string umid { get; set; }
public string cname { get; set; }
public string idcardno { get; set; }
public string lastnum3 { get; set; }
public string regdate { get; set; }
public string szzyorderid { get; set; }
public string risklevel { get; set; }
public string exptime { get; set; }
public string riskinfo { get; set; }
}
public class RiskInfoDto
{
public int ret { get; set; }
public string name { get; set; }
public string idCard { get; set; }
public string answer { get; set; }
public long createTime { get; set; }
public string key { get; set; }
public string style { get; set; }
public int index { get; set; }
public string version { get; set; }
public string expTime { get; set; }
public RiskTypeDto riskType { get; set; }
public int verifyType { get; set; }
public int auditStatus { get; set; }
public string auditRemark { get; set; }
public string businesstype { get; set; }
public int paperId { get; set; }
}
public class RiskTypeDto
{
public int min { get; set; }
public int max { get; set; }
public string des { get; set; }
public string name { get; set; }
public string level { get; set; }
}
private string GetAnswerText(int questionId, string answerCode)
{
if (constantPaper.uprisk.question.TryGetValue(3, out var questionList)
&& questionId - 1 < questionList.Count)
{
var question = questionList[questionId - 1];
var answer = question.answer.FirstOrDefault(a => a.pos == answerCode);
return answer?.text ?? string.Empty;
}
return string.Empty;
}
private static readonly ConstantPaper constantPaper = RiskPaperConstants.ConstantPaper;
}
public class CustomerMoblieDto
{
public string CustomerId { get; set; }
public string Resid { get; set; }
public string Mobile { get; set; }
public string CompanyName { get; set; }
public string CompanyCode { get; set; }
public bool IsPrimarynum { get; set; }
public string Lastnum3 { get; set; }
}
public class Soft_User_GetCheckDTO
{
public string resid { get; set; }
public string softusername { get; set; }
public string companyCode { get; set; }
public int eid { get; set; }
}
public class Soft_User_GetModelDTO
{
/// <summary>
/// 手机号码
/// </summary>
public string mobile { get; set; }
public string username { get; set; }
public string userpass { get; set; }
public decimal? regcampainid { get; set; }
public string reglatform { get; set; }
public DateTime? activetime { get; set; }
public string activeresid { get; set; }
public DateTime? ctime { get; set; }
public DateTime? regdate { get; set; }
public string resid { get; set; }
public string ip { get; set; }
}
public class retMsgNew<T>
{
public bool result { get; set; }
public int retcode { get; set; }
public T data { get; set; }
public string retmsg { get; set; }
}
public class retMsg
{
public bool result { get; set; }
public int retcode { get; set; }
public string retmsg { get; set; }
}
public class SYNC_PUSH_DTO
{
public string jsontext { get; set; }
public string bidatatype { get; set; }
public string deptcode { get; set; }
public int? isbatch { get; set; }
}
public class AiAudioRecordDto
{
public bool result { get; set; }
public int retcode { get; set; }
public List<AiAudioRecord> retmsg { get; set; }
}
public class AiAudioRecord
{
public decimal Id { get; set; }
public string Robot { get; set; }
public string Phone { get; set; }
public int? SvcTime { get; set; }
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
public string FileName { get; set; }
}
public class ConstantPaper
{
public UPRisk uprisk { get; set; } = new UPRisk();
}
public class UPRisk
{
public Dictionary<int, List<Question>> question { get; set; } = new Dictionary<int, List<Question>>();
}
public class Question
{
public string title { get; set; }
public List<Answer> answer { get; set; }
public Dictionary<string, int> score { get; set; }
public bool special { get; set; }
}
public class Answer
{
public string text { get; set; }
public string pos { get; set; }
}
}