ソースを参照

Merge branch 'master' of http://192.168.1.222:3000/zhoufan/SQ12345_Api

zhengbingbing 5 年 前
コミット
a8f9955df4

File diff suppressed because it is too large
+ 19 - 5
CallCenterApi/CallCenterApi.DAL/T_Bus_WorkOrder.cs


+ 1 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Login/LoginController.cs

@@ -222,7 +222,7 @@ namespace CallCenterApi.Interface.Controllers
222 222
                         string rid = dt.Rows[0]["F_RoleID"].ToString();
223 223
                         var role = new BLL.T_Sys_RoleInfo().GetModel(Int32.Parse(rid));
224 224
                         if (role.F_RoleCode == "EJWLDW" || role.F_RoleCode == "WLDW" || role.F_RoleCode=="DBZY"
225
-                            || role.F_RoleCode == "ZXLD" || role.F_RoleCode == "ZXLDGLY" || role.F_RoleCode == "GLY" || role.F_RoleCode== "DDZG")
225
+                            || role.F_RoleCode == "ZXLD" || role.F_RoleCode == "ZXLDGLY" || role.F_RoleCode == "GLY" || role.F_RoleCode== "DDZG" || role.F_RoleCode == "DFZF")
226 226
                         {
227 227
                             Dictionary<string, string> Dic = new Dictionary<string, string>();
228 228
                             Dic.Add("F_UserID", dt.Rows[0]["F_UserId"].ToString());

+ 105 - 8
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/SMSController.cs

@@ -2,19 +2,110 @@
2 2
 using CallCenterApi.Common;
3 3
 using CallCenterApi.DB;
4 4
 using CallCenterApi.Interface.Controllers.Base;
5
+using Newtonsoft.Json;
6
+using Newtonsoft.Json.Linq;
5 7
 using System;
6 8
 using System.Collections.Generic;
9
+using System.Collections.Specialized;
7 10
 using System.Data;
11
+using System.IO;
8 12
 using System.Linq;
13
+using System.Net;
14
+using System.Security.Cryptography;
15
+using System.Text;
9 16
 using System.Web;
10 17
 using System.Web.Mvc;
11 18
 
19
+
12 20
 namespace CallCenterApi.Interface.Controllers
13 21
 {
14 22
     public class SMSController : BaseController
15 23
     {
16
-        #region 接收短信
24
+      
25
+        private static string Smsurl = "http://rcsapi.wo.cn:8000/umcinterface/sendtempletmsg";
26
+        static string cpcode = "AAAOFV";
27
+        static string key = "2e12579ba6a6576f8980b628b8008247";
28
+        /// <summary>
29
+        /// MD5加密
30
+        /// </summary>
31
+        /// <param name="txt"></param>
32
+        /// <returns></returns>
33
+        public static string Md5(string txt)
34
+        {
35
+            byte[] sor = Encoding.UTF8.GetBytes(txt);
36
+            MD5 md5 = MD5.Create();
37
+            byte[] result = md5.ComputeHash(sor);
38
+            StringBuilder strbul = new StringBuilder(40);
39
+            for (int i = 0; i < result.Length; i++)
40
+            {
41
+                //加密结果"x2"结果为32位,"x3"结果为48位,"x4"结果为64位
42
+                strbul.Append(result[i].ToString("x2"));
43
+            }
44
+            return strbul.ToString().ToLower (); ;
45
+        }
46
+        public static  string   SendSms(string  msg,string mobiles,string templetid,string excode = "")
47
+        {
48
+            bool n=false ;
49
+            string sign = Md5(cpcode + msg + mobiles + excode + templetid + key);
50
+            var dic = new SortedDictionary<string, string>
51
+            {
52
+                {"cpcode", cpcode},
53
+                {"msg", msg},
54
+                {"mobiles", mobiles},
55
+                {"excode", excode},
56
+                {"templetid",templetid},
57
+                {"sign", sign},
58
+            };
59
+            //序列化参数
60
+            var jsonParam = JsonConvert.SerializeObject(dic);
61
+            //发送请求
62
+            var request = (HttpWebRequest)WebRequest.Create(Smsurl);
63
+            request.Method = "POST";
64
+            request.ContentType = "application/json;charset=UTF-8";
65
+            var byteData = Encoding.UTF8.GetBytes(jsonParam);
66
+            var length = byteData.Length;
67
+            request.ContentLength = length;
68
+            var writer = request.GetRequestStream();
69
+            writer.Write(byteData, 0, length);
70
+            writer.Close();
71
+            //接收数据
72
+            var response = (HttpWebResponse)request.GetResponse();
73
+            var responseString = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")).ReadToEnd();
74
+            JObject jo = (JObject)JsonConvert.DeserializeObject(responseString );
75
+            string access_token = jo["resultcode"].ToString();
76
+            return access_token;
77
+        }
78
+        public static bool   AddSmS(int userId,string count ,string msg, string mobiles, string templetid)
79
+        {
80
+            bool res = false ;
81
+            string  n = SendSms(msg, mobiles, templetid);
82
+            Model.T_SMS_RecvSMS dModel = new Model.T_SMS_RecvSMS();
83
+            dModel.CallerNum = mobiles.Trim();
84
+            dModel.Content = count.Trim();
85
+            dModel.RecvModemIMEI = n;
86
+            dModel.State = 0;
87
+            dModel.F_UserID = userId;
88
+            dModel.RecvTime = DateTime.Now;
89
+            int b = new BLL.T_SMS_RecvSMS().Add(dModel);
90
+            if (n == "0")
91
+                res = true;
92
+            if (res)
93
+            {
94
+                if (b > 0)
95
+                {
96
+                    return true;
97
+                }
98
+                else
99
+                {
100
+                    return false;
101
+                }
102
+            }
103
+            else
104
+                return res;
105
+
17 106
 
107
+        }
108
+        #region 接收短信
18 109
         [Authority]
19 110
         /// <summary>
20 111
         /// 获取接收短信列表
@@ -46,7 +137,7 @@ namespace CallCenterApi.Interface.Controllers
46 137
             {
47 138
                 sql += " and RecvTime <= '" + Convert.ToDateTime(strendtime.Trim()) + "' ";
48 139
             }
49
-
140
+            sql += "and F_UserID is not null";
50 141
             if (strpageindex.Trim() != "")
51 142
             {
52 143
                 pageindex = Convert.ToInt32(strpageindex);
@@ -67,19 +158,24 @@ namespace CallCenterApi.Interface.Controllers
67 158
                 pageindex,
68 159
                 true,
69 160
                 out recordCount);
70
-
161
+            List<Model.T_SMS_RecvSMS> modelList = new BLL.T_SMS_RecvSMS().DataTableToList(dt);
71 162
             var obj = new
72 163
             {
73
-                state = "success",
74
-                message = "成功",
75
-                rows = dt,
164
+                rows = modelList.Select(x => new
165
+                {
166
+                    x.CallerNum,
167
+                    x.Content,
168
+                    x.F_Name,
169
+                    usercode = new BLL.T_Sys_UserAccount().GetModel((int)x.F_UserID) != null ? new BLL.T_Sys_UserAccount().GetModel((int)x.F_UserID).F_UserCode : "系统发送",
170
+                    x.RecvTime
171
+                }),
76 172
                 total = recordCount
77 173
             };
174
+        
78 175
 
79 176
             return Content(obj.ToJson());
80 177
 
81 178
         }
82
-
83 179
         [Authority]
84 180
         /// <summary>
85 181
         /// 新增接收短信
@@ -88,7 +184,6 @@ namespace CallCenterApi.Interface.Controllers
88 184
         public ActionResult AddRecv(string tel, string cont)
89 185
         {
90 186
             Model.T_SMS_RecvSMS dModel = new Model.T_SMS_RecvSMS();
91
-
92 187
             dModel.CallerNum = tel.Trim();
93 188
             dModel.Content = cont.Trim();
94 189
             dModel.State = 0;
@@ -638,6 +733,8 @@ namespace CallCenterApi.Interface.Controllers
638 733
             }
639 734
             return msg;
640 735
         }
736
+
737
+      
641 738
         #endregion
642 739
     }
643 740
 }

+ 2 - 2
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/DeptAssessmentController.cs

@@ -442,8 +442,8 @@ namespace CallCenterApi.Interface.Controllers.report
442 442
             #region 不满意度评价100205
443 443
             var assignedList = assignedInfoBLL.DataTableToList(assignedInfoBLL.GetList($" F_MainDeptId = '{int.Parse(deptid)}' and F_IsDelete=0 and F_IsSure in (0,1,2) and  F_State in (0,1)   and  datediff(s,'{start}',F_CreateTime)>0 and datediff(s,'{end}',F_CreateTime)<0  ").Tables[0]).DistinctBy(y => y.F_WorkOrderId);
444 444
             //F_IsSatisfie 1不满意     F_IsReload 0不重办,>0重办次数
445
-            var assignedListsS = assignedList.Where(y => y.F_IsSatisfie == 1 && (y.F_IsReload == 0 || y.F_IsReload == null)).ToList();   //每件扣1分 F_IsReload == 0没有重办
446
-            var assignedListsR = assignedList.Where(y => y.F_IsSatisfie == 1 && y.F_IsReload > 0).ToList();    //每件扣2分 F_IsReload > 0重办次数
445
+            var assignedListsS = assignedList.Where(y => y.F_IsSatisfie == 0 && (y.F_IsReload == 0 || y.F_IsReload == null)).ToList();   //每件扣1分 F_IsReload == 0没有重办
446
+            var assignedListsR = assignedList.Where(y => y.F_IsSatisfie == 0 && y.F_IsReload > 0).ToList();    //每件扣2分 F_IsReload > 0重办次数
447 447
             int assignedCountS = assignedListsS.Count();
448 448
             int satisfieCountR = assignedListsR.Count() * 2;
449 449
             double nosatisfieCount = -(double)(assignedCountS + satisfieCountR);

+ 134 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -5263,6 +5263,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
5263 5263
                         else if (fod != "" && fod.Split(',').Contains(userModel.F_DeptId.ToString()))
5264 5264
                         {
5265 5265
                             iszbdw = "2";
5266
+
5267
+
5268
+                            
5266 5269
                         }
5267 5270
                         if (!(userModel.F_RoleCode == "WLDW" && iszbdw == "0"))
5268 5271
                         {
@@ -5273,6 +5276,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
5273 5276
                     {
5274 5277
                         btns = ButtonGroup.GetButtons(dt.Rows[0]["F_WorkState"].ToString(), userModel.F_RoleCode.ToUpper(), dt.Rows[0]["F_IsResult"].ToString(), "0");
5275 5278
                     }
5279
+                   
5280
+                    
5276 5281
                     #region 判断是否存在待督办
5277 5282
                     var recount = remindBLL.GetModelList("F_State=0 and F_IsDelete=0 and F_Type=1 and F_WorkOrderId ='" + strworkorderid + "'").ToList().Count();
5278 5283
                     var butt = btns.Find(c => c.key == ButtonGroup.turnsee().key);
@@ -5286,6 +5291,15 @@ namespace CallCenterApi.Interface.Controllers.workorder
5286 5291
                             btns.Add(ButtonGroup.turnnosee());
5287 5292
                         }
5288 5293
                     }
5294
+                    if (btns == null)
5295
+                    {
5296
+                        btns.Add(ButtonGroup.query());
5297
+                    }
5298
+                    else
5299
+                    {
5300
+                        if (btns.Count == 0)
5301
+                            btns.Add(ButtonGroup.query());
5302
+                    } 
5289 5303
                     #endregion
5290 5304
                     #endregion
5291 5305
 
@@ -7391,6 +7405,126 @@ namespace CallCenterApi.Interface.Controllers.workorder
7391 7405
                 return Error("权限不足");
7392 7406
             }
7393 7407
         }
7408
+        /// <summary>
7409
+        /// 工单提醒
7410
+        /// </summary>
7411
+        /// <param name="workordercode"></param>
7412
+        /// <param name="deptid"></param>
7413
+        /// <param name="type"></param>
7414
+        /// <returns></returns>
7415
+        [HttpPost]
7416
+        public ActionResult SendSms(string workordercode,int deptid,int type=0)
7417
+        {
7418
+            if (deptid <= 0)
7419
+                return Error("请选择部门");
7420
+            int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
7421
+            string msg = "";
7422
+            var user = new BLL.T_Sys_UserAccount().GetModelList(" F_DeptId=" + deptid + "and F_DeleteFlag=0");
7423
+            if (user !=null )
7424
+            {
7425
+                foreach (var it  in user)
7426
+                {
7427
+                    if (!string .IsNullOrEmpty (it .F_Mobile))
7428
+                    {
7429
+                        string count = "";
7430
+                        string templetid = "";
7431
+                        if (type ==0)
7432
+                        {
7433
+                            templetid = "26157";
7434
+                            count = "您有新的工单,请及时查收处理,工单编号" + workordercode;
7435
+                        }
7436
+                        else   if (type == 1)
7437
+                        {
7438
+                            templetid = "26155";
7439
+                            count = "您有工单正在被督办,请及时处理,工单编号" + workordercode;
7440
+                        }
7441
+                        else if (type == 2)
7442
+                        {
7443
+                            templetid = "26154";
7444
+                            count = "您有紧急工单,请及时处理,工单编号" + workordercode;
7445
+                        }
7446
+                        else
7447
+                        {
7448
+                            templetid = "29265";
7449
+                            count = "您有工单已经超时,请尽快处理,工单编号" + workordercode;
7450
+                        }
7451
+
7452
+                        bool n = SMSController.AddSmS(userId, count, workordercode, it.F_Mobile, templetid);
7453
+                        if (n == false)
7454
+                            msg += it.F_UserName + "发送短信失败。";
7455
+                    }
7456
+                }
7457
+                if (msg != "")
7458
+                    return Error(msg);
7459
+                else
7460
+                    return Success("发送成功");
7461
+            }
7462
+            else
7463
+            {
7464
+                return Error("暂无人员");
7465
+            }
7466
+        }
7467
+        /// <summary>
7468
+        /// 办理结果通知
7469
+        /// </summary>
7470
+        /// <param name="msg1"></param>
7471
+        /// <param name="msg2"></param>
7472
+        /// <param name="msg3"></param>
7473
+        /// <param name="msg4"></param>
7474
+        /// <param name="mobile"></param>
7475
+        /// <returns></returns>
7476
+
7477
+        public ActionResult SmsHand(string msg1 , string msg2 , string msg3,string msg4,string mobile)
7478
+        {
7479
+            
7480
+            int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
7481
+            string msg = msg1+","+ msg2 + "," + msg3 + "," + msg4;
7482
+
7483
+            string count = "尊敬的市民,您于" + msg1 + "反映的" + msg2 + "问题,工单号:" + msg3 + ",处理结果如下:" + msg4 + "。如有异议,请您再次致电12345,感谢您的支持。";
7484
+
7485
+
7486
+            bool n = SMSController.AddSmS(userId, count, msg, mobile, "26213");
7487
+            if (n)
7488
+                return Success("发送成功");
7489
+            else
7490
+                return Error ("发送失败");
7491
+        }
7492
+     
7493
+       public ActionResult SmsOverTime()
7494
+         {
7495
+          
7496
+           var workorder = new BLL.T_Bus_WorkOrder().GetModelList("F_IsDelete=0 and  F_WorkState in (2,4) and (F_IsSms!=1 or  F_IsSms is null)");
7497
+            if (workorder != null)
7498
+            {
7499
+                foreach (var it in workorder)
7500
+                {
7501
+                    System.TimeSpan time = DateTime.Parse(it.F_LimitTime.ToString()) - DateTime.Now ;
7502
+                    if (time.TotalHours <=6)
7503
+                    {
7504
+                       
7505
+                        var user = new BLL.T_Sys_UserAccount().GetModelList(" F_DeptId=" + it.F_MainDeptId  + "and F_DeleteFlag=0");
7506
+                        if (user != null)
7507
+                        {
7508
+                            foreach (var iv  in user)
7509
+                            {
7510
+                                if (!string.IsNullOrEmpty(iv.F_Mobile))
7511
+                                {
7512
+                                    string count = " 您有工单6小时后超期,请及时处理,工单号" + it.F_WorkOrderId;
7513
+                                    bool n = SMSController.AddSmS(0, count, it.F_WorkOrderId, iv.F_Mobile, "26147");
7514
+                                      if (n )
7515
+                                    {
7516
+                                        it.F_IsSms = 1;
7517
+                                        bool t = new BLL.T_Bus_WorkOrder().Update(it);
7518
+                                    }
7519
+                                }
7520
+                            }
7521
+                        }
7522
+                    }
7523
+                }
7524
+            }
7525
+            return Success("发送成功");
7526
+        }
7527
+       
7394 7528
 
7395 7529
         /// <summary>
7396 7530
         /// 收回工单

+ 9 - 0
CallCenterApi/CallCenterApi.Model/T_Bus_WorkOrder.cs

@@ -74,6 +74,7 @@ namespace CallCenterApi.Model
74 74
         private int?  _f_noticeid;
75 75
         private int? _f_isstandard;
76 76
         private string _f_standardids;
77
+        private int? _f_issms;
77 78
 
78 79
         /// <summary>
79 80
         /// 
@@ -589,6 +590,14 @@ namespace CallCenterApi.Model
589 590
             set { _f_isstandard = value; }
590 591
             get { return _f_isstandard; }
591 592
         }
593
+        /// <summary>
594
+        /// 是否发送短信0否1是
595
+        /// </summary>
596
+        public int? F_IsSms
597
+        {
598
+            set { _f_issms = value; }
599
+            get { return _f_issms; }
600
+        }
592 601
         #endregion Model
593 602
 
594 603
     }

+ 55 - 0
Push/Program.cs

@@ -0,0 +1,55 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.IO;
4
+using System.Linq;
5
+using System.Net;
6
+using System.Text;
7
+using System.Threading;
8
+using System.Threading.Tasks;
9
+using Newtonsoft.Json;
10
+
11
+namespace Push
12
+{
13
+    class Program
14
+    {
15
+        public class PushTime
16
+        {
17
+            public DateTime time;
18
+            public int morning;
19
+            public int Afternoon;
20
+        }
21
+        private PushTime time = new PushTime();
22
+        static void Main(string[] args)
23
+        {
24
+            Console.OutputEncoding = System.Text.Encoding.UTF8;
25
+            Environment.SetEnvironmentVariable("needDetails", "true");
26
+            Console.OutputEncoding = System.Text.Encoding.UTF8;
27
+            Environment.SetEnvironmentVariable("needDetails", "true");
28
+            System.Console.WriteLine("Hello Push!");
29
+            Thread t = new Thread(new ThreadStart(SetCensusURL));
30
+            t.Start();
31
+        }
32
+        private static void SetCensusURL()
33
+        {
34
+            int n = 0;
35
+            while (true)
36
+            {
37
+                Thread.Sleep(60 * 1000);
38
+                n += 1;
39
+                WebClient web = new WebClient();
40
+                web.Encoding = Encoding.UTF8;
41
+
42
+                try
43
+                {
44
+                    string seturl = "http://12345.shangqiu.gov.cn:8819/WorkOrder/SmsOverTime";
45
+                    string Dataurl = web.DownloadString(seturl);//这一句话就能请求到数据了
46
+               //     System.Console.WriteLine(Dataurl);
47
+                }
48
+                catch
49
+                {
50
+                }
51
+            }
52
+        }
53
+    }
54
+}
55
+

+ 36 - 0
Push/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的一般信息由以下
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("Push")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("Push")]
13
+[assembly: AssemblyCopyright("Copyright ©  2020")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// 将 ComVisible 设置为 false 会使此程序集中的类型
18
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19
+//请将此类型的 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23
+[assembly: Guid("060a2d9e-66ab-4794-9bfc-035bf68cf0c3")]
24
+
25
+// 程序集的版本信息由下列四个值组成: 
26
+//
27
+//      主版本
28
+//      次版本
29
+//      生成号
30
+//      修订号
31
+//
32
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
33
+// 方法是按如下所示使用“*”: :
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 8 - 0
PushMessage.cs

@@ -0,0 +1,8 @@
1
+using System;
2
+
3
+public class Class1
4
+{
5
+	public Class1()
6
+	{
7
+	}
8
+}