| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- using CallCenter.Utility;
- using CallCenterApi.Interface.Controllers.Base;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.Docking
- {
- public class DockingController : BaseController
- {
- #region 获取第三方数据
- /// <summary>
- /// 获取企业列表信息
- /// </summary>
- /// <returns></returns>
- public ActionResult SendGetCompanylist(string name,int pageno=1,int pagesize=100)
- {
- string strURL = "http://222.143.48.99:82/api/acase-main/company/page?";
- strURL += "¤t="+ pageno;
- strURL += "&size="+ pagesize;
- if (!string.IsNullOrWhiteSpace(name))
- strURL += "&name=" + name;
- string strHTML = HttpMethods.HttpGet(strURL);
- JObject jo1 = (JObject)JsonConvert.DeserializeObject(strHTML);
- if (jo1 != null && jo1["success"].ToString().ToLower() == "true")
- {
- return Success("成功", jo1["data"]);
- }
- else
- return Error("失败");
- }
- /// <summary>
- /// 企业信息添加
- /// </summary>
- /// <returns></returns>
- public ActionResult SendAddCompany(string name)
- {
- string strURL = "http://222.143.48.99:82/api/acase-main/company/save";
- var m = new {
- id=0,//"id":"唯一标识",
- linkman="",//"linkman":"联系人",
- mobile = "",//"mobile":"联系电话",
- name = name,//"name":"企业名称",
- creditCore = "",//"creditCore":"统一社会信用代码",
- type = "",//"type":"类型",
- legalRepresentative = "",//"legalRepresentative":"法定代表人",
- registeredCapital = "",//"registeredCapital":"注册资本",
- currency = "",//"currency":"币种",
- foundingTime = "",//"foundingTime":"成立日期",
- businessTimeBegin = "",//"businessTimeBegin":"营业期限开始",
- businessTimeEnd = "",//"businessTimeEnd":"营业期限结束",
- auditTime = "",//"auditTime":"核准日期",
- regDepartmentId = "",//"regDepartmentId":"登记机关",
- address = "",//"address":"登记地址",
- tradeAddres = "",//"tradeAddres":"经营地址",
- agentName = "",//"agentName":"代理人名字",
- agentIdcard = "",//"agentIdcard":"代理人身份证",
- tradeArea = "",//"tradeArea":"经营范围",
- isLocal = "",//"isLocal":"是否本地注册(1:本地,2:非本地)",
- unitType = "",//"unitType":"企业状态1.存续、2.在业、3.吊销、4.注销、5.迁入、6.迁出、7.停业、8.清算"
- };
- string json1 = JsonConvert.SerializeObject(m);
- string strHTML = HttpMethods.HttpPost(strURL, json1, "application/json");
- JObject jo1 = (JObject)JsonConvert.DeserializeObject(strHTML);
- if (jo1 != null && jo1["success"].ToString().ToLower() == "true")
- {
- return Success("成功", jo1["data"]);
- }
- else
- return Error("失败");
- }
- #endregion
- #region 第三方使用接口
- /// <summary>
- /// 对接方获取通话记录
- /// </summary>
- /// <returns></returns>
- public ActionResult ReceiveCallRecords(string CallNumber, int pageindex = 1, int pagesize = 10)
- {
- var sql = "";
- if (!string.IsNullOrEmpty(CallNumber))
- {
- sql += " and CallNumber like '%" + CallNumber + "%'";
- }
- string cols = "CallRecordsId,CallNumber,CallType,CallState,DealType,BeginTime,TalkStartTime,TalkEndTime,TalkLongTime,UserCode,T_Sys_UserAccount.F_UserName as UserName,(select d.f_deptName from T_Sys_UserAccount u,[dbo].[T_Sys_Department] d where u.F_DeptId=d.F_DeptId and u.F_UserCode= UserCode) AS CusDepName,(select COUNT(1) from dbo.T_Rec_RegRecords where F_CallId = T_Call_CallRecords.CallId) as IsWorkeorder,FilePath";
- var recordCount = 0;
- DataTable dt = BLL.PagerBLL.GetListPager(
- "T_Call_CallRecords WITH(NOLOCK) left join T_Sys_UserAccount on UserCode=F_UserCode ",
- "CallRecordsId",
- cols,
- sql,
- "ORDER BY BeginTime desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
- foreach (DataRow dr in dt.Rows)
- {
- string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
- if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
- {
- var ym = config.F_ParamValue;
- if (ym.Substring(ym.Length - 1) == "/")
- {
- ym = ym.Substring(0, ym.Length - 1);
- }
- dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
- }
- }
- var obj = new
- {
- rows = dt,
- total = recordCount
- };
- return Success("通话记录获取成功", obj);
- }
- /// <summary>
- /// 对接方获取登记记录
- /// </summary>
- /// <param name="phone"></param>
- /// <param name="key"></param>
- /// <param name="pageindex"></param>
- /// <param name="pagesize"></param>
- /// <returns></returns>
- public ActionResult ReceiveRegRecords(string phone,string key, int pageindex = 1, int pagesize = 10)
- {
- string sql = "";
- if (!string.IsNullOrWhiteSpace(key))
- {
- sql += " and (F_RecCode like '%" + key.Trim() + "%' or F_Complained like '%" + key.Trim() + "%' or F_Content like '%" + key.Trim() + "%' or F_Remark like '%" + key.Trim() + "%')";
- }
- if (!string.IsNullOrWhiteSpace(phone))
- {
- sql += " and F_Tel like '%" + phone.Trim() + "%' ";
- }
- DataTable dt = new DataTable();
- string cols = "F_RecCode,(select F_Name from T_Cus_Customer where F_Id=F_CusID) CusName,(select F_Phone from T_Cus_Customer where F_Id=F_CusID) CusPhone,F_Type,F_Complained,F_Content,F_Remark,dbo.GetUserName(F_CreateBy) CreateByName,F_CreateOn ";
- //登记编号,姓名,联系电话,登记类型,被投诉单位,登记内容,备注,创建人,创建时间
- var recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Rec_RegRecords",
- "F_ID",
- cols,
- sql,
- "ORDER BY F_CreateOn desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- rows = dt,
- total = recordCount
- };
- return Success("登记记录获取成功", obj);
- }
- #endregion
- }
- }
|