zhengbingbing лет назад: 5
Родитель
Сommit
bc7bb699fc

+ 151 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Docking/DockingController.cs

@@ -4,6 +4,7 @@ using Newtonsoft.Json;
4 4
 using Newtonsoft.Json.Linq;
5 5
 using System;
6 6
 using System.Collections.Generic;
7
+using System.Data;
7 8
 using System.Linq;
8 9
 using System.Web;
9 10
 using System.Web.Mvc;
@@ -12,21 +13,165 @@ namespace CallCenterApi.Interface.Controllers.Docking
12 13
 {
13 14
     public class DockingController : BaseController
14 15
     {
15
-        // GET: Docking
16
-        public ActionResult GetDocument(string mobile)
16
+        #region 获取第三方数据
17
+        /// <summary>
18
+        /// 获取企业列表信息
19
+        /// </summary>
20
+        /// <returns></returns>
21
+        public ActionResult SendGetCompanylist(string name,int pageno=1,int pagesize=100)
17 22
         {
18
-            string strURL = "http://222.143.48.99:82/api/acase-main/send/documentSendList";
19
-            if (!string.IsNullOrWhiteSpace(mobile))
20
-                strURL += "?mobile=" + mobile;
23
+            string strURL = "http://222.143.48.99:82/api/acase-main/company/page?";
24
+            strURL += "&current="+ pageno;
25
+            strURL += "&size="+ pagesize;
26
+            if (!string.IsNullOrWhiteSpace(name))
27
+                strURL += "&name=" + name;
21 28
 
22 29
             string strHTML = HttpMethods.HttpGet(strURL);
23 30
             JObject jo1 = (JObject)JsonConvert.DeserializeObject(strHTML);
24
-            if (jo1 != null && jo1["success"].ToString().ToLower()== "true")
31
+            if (jo1 != null && jo1["success"].ToString().ToLower() == "true")
25 32
             {
26 33
                 return Success("成功", jo1["data"]);
27 34
             }
28 35
             else
29 36
                 return Error("失败");
30 37
         }
38
+        /// <summary>
39
+        /// 企业信息添加
40
+        /// </summary>
41
+        /// <returns></returns>
42
+        public ActionResult SendAddCompany(string name)
43
+        {
44
+            string strURL = "http://222.143.48.99:82/api/acase-main/company/save";
45
+            var m = new {
46
+                id=0,//"id":"唯一标识",
47
+                linkman="",//"linkman":"联系人",
48
+                mobile = "",//"mobile":"联系电话",
49
+                name = name,//"name":"企业名称",
50
+                creditCore = "",//"creditCore":"统一社会信用代码",
51
+                type = "",//"type":"类型",
52
+                legalRepresentative = "",//"legalRepresentative":"法定代表人",
53
+                registeredCapital = "",//"registeredCapital":"注册资本",
54
+                currency = "",//"currency":"币种",
55
+                foundingTime = "",//"foundingTime":"成立日期",
56
+                businessTimeBegin = "",//"businessTimeBegin":"营业期限开始",
57
+                businessTimeEnd = "",//"businessTimeEnd":"营业期限结束",
58
+                auditTime = "",//"auditTime":"核准日期",
59
+                regDepartmentId = "",//"regDepartmentId":"登记机关",
60
+                address = "",//"address":"登记地址",
61
+                tradeAddres = "",//"tradeAddres":"经营地址",
62
+                agentName = "",//"agentName":"代理人名字",
63
+                agentIdcard = "",//"agentIdcard":"代理人身份证",
64
+                tradeArea = "",//"tradeArea":"经营范围",
65
+                isLocal = "",//"isLocal":"是否本地注册(1:本地,2:非本地)",
66
+                unitType = "",//"unitType":"企业状态1.存续、2.在业、3.吊销、4.注销、5.迁入、6.迁出、7.停业、8.清算"
67
+            };
68
+            string json1 = JsonConvert.SerializeObject(m);
69
+            string strHTML = HttpMethods.HttpPost(strURL, json1, "application/json");
70
+            JObject jo1 = (JObject)JsonConvert.DeserializeObject(strHTML);
71
+            if (jo1 != null && jo1["success"].ToString().ToLower() == "true")
72
+            {
73
+                return Success("成功", jo1["data"]);
74
+            }
75
+            else
76
+                return Error("失败");
77
+        }
78
+        #endregion
79
+
80
+        #region 第三方使用接口
81
+        /// <summary>
82
+        /// 对接方获取通话记录
83
+        /// </summary>
84
+        /// <returns></returns>
85
+        public ActionResult ReceiveCallRecords(string CallNumber, int pageindex = 1, int pagesize = 10)
86
+        {
87
+            var sql = "";
88
+            if (!string.IsNullOrEmpty(CallNumber))
89
+            {
90
+                sql += " and CallNumber like '%" + CallNumber + "%'";
91
+            }
92
+            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";
93
+
94
+            var recordCount = 0;
95
+            DataTable dt = BLL.PagerBLL.GetListPager(
96
+                "T_Call_CallRecords WITH(NOLOCK) left join T_Sys_UserAccount on UserCode=F_UserCode  ",
97
+                "CallRecordsId",
98
+                cols,
99
+                sql,
100
+                "ORDER BY BeginTime desc",
101
+                pagesize,
102
+                pageindex,
103
+                true,
104
+                out recordCount);
105
+            var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
106
+
107
+            foreach (DataRow dr in dt.Rows)
108
+            {
109
+                string path = dr["FilePath"] != null ? dr["FilePath"].ToString() : "";
110
+                if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
111
+                {
112
+                    var ym = config.F_ParamValue;
113
+                    if (ym.Substring(ym.Length - 1) == "/")
114
+                    {
115
+                        ym = ym.Substring(0, ym.Length - 1);
116
+                    }
117
+                    dr["FilePath"] = ym + path.Substring(path.IndexOf(':') + 1).Replace('\\', '/');
118
+                }
119
+            }
120
+
121
+            var obj = new
122
+            {
123
+                rows = dt,
124
+                total = recordCount
125
+            };
126
+
127
+            return Success("通话记录获取成功", obj);
128
+        }
129
+
130
+        /// <summary>
131
+        /// 对接方获取登记记录
132
+        /// </summary>
133
+        /// <param name="phone"></param>
134
+        /// <param name="key"></param>
135
+        /// <param name="pageindex"></param>
136
+        /// <param name="pagesize"></param>
137
+        /// <returns></returns>
138
+        public ActionResult ReceiveRegRecords(string phone,string key, int pageindex = 1, int pagesize = 10)
139
+        {
140
+            string sql = "";
141
+
142
+            if (!string.IsNullOrWhiteSpace(key))
143
+            {
144
+                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() + "%')";
145
+            }
146
+            if (!string.IsNullOrWhiteSpace(phone))
147
+            {
148
+                sql += " and F_Tel like '%" + phone.Trim() + "%' ";
149
+            }
150
+
151
+            DataTable dt = new DataTable();
152
+            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 ";
153
+            //登记编号,姓名,联系电话,登记类型,被投诉单位,登记内容,备注,创建人,创建时间
154
+
155
+            var recordCount = 0;
156
+            dt = BLL.PagerBLL.GetListPager(
157
+                "T_Rec_RegRecords",
158
+                "F_ID",
159
+                cols,
160
+                sql,
161
+                "ORDER BY F_CreateOn desc",
162
+                pagesize,
163
+                pageindex,
164
+                true,
165
+                out recordCount);
166
+
167
+            var obj = new
168
+            {
169
+                rows = dt,
170
+                total = recordCount
171
+            };
172
+
173
+            return Success("登记记录获取成功", obj);
174
+        }
175
+        #endregion
31 176
     }
32 177
 }