Selaa lähdekoodia

舆情根据文档修改

liyuanyuan 2 vuotta sitten
vanhempi
commit
9fa9dcb64d

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


+ 7 - 0
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Configs/system.config

@@ -91,4 +91,11 @@
91 91
   <add key="thirdUrl" value="http://61.52.211.251:8082/oa/" />
92 92
   <add key="fileExtension" value=".png、.jpg、.gif、.doc、.docx、.xls、.xlsx、.pdf、.mp3、.mp4、.wav" />
93 93
   <add key="PushUrl" value="https://cwgywgh.z.digitalcnzz.com/kong/kong-gateway/product-interface-event/guancheng/pushcase" />
94
+
95
+
96
+
97
+  <add key = "appId" value="zmds12345szrxzx" />
98
+                <add key = "appSecret" value="63846190e8f346cd8e5a75e4ecc0bae4" />
99
+                <add key = "channel" value="4413" />
100
+                <add key = "clientUserName" value="zmdszrxzx" />
94 101
 </appSettings>

+ 161 - 19
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Login/LoginController.cs

@@ -14,12 +14,24 @@ using CallCenterApi.Interface.Models.Input;
14 14
 using CallCenterApi.DB;
15 15
 using System.Web.Caching;
16 16
 using CallCenterApi.Interface.Controllers.Login;
17
+using Newtonsoft.Json.Linq;
17 18
 
18 19
 namespace CallCenterApi.Interface.Controllers
19 20
 {
20 21
     public class LoginController : BaseController
21 22
     {
22 23
         private BLL.T_Sys_RoleFunction roleFunctionBLL = new BLL.T_Sys_RoleFunction();
24
+       private string appId = Configs.GetValue("appId");
25
+        private string appSecret = Configs.GetValue("appSecret");
26
+        private string channel = Configs.GetValue("channel");
27
+        private string clientUserName = Configs.GetValue("clientUserName");
28
+
29
+      
30
+        //appId=[zmds12345szrxzx]
31
+        //appSecret=[63846190e8f346cd8e5a75e4ecc0bae4]
32
+        //systemId=[zmds12345szrxzx] channel=[4413]
33
+
34
+
23 35
         public DateTime ExpiredTime = DateTime.Now.AddDays(1);// Convert.ToDateTime(ReadFile(HttpRuntime.AppDomainAppPath + "tools\\hykj.hy"));
24 36
         [HttpPost]
25 37
         public ActionResult login(LoginModel login)
@@ -40,8 +52,8 @@ namespace CallCenterApi.Interface.Controllers
40 52
                 log.Error(Configs.GetValue("AuthDate"));
41 53
                 log.Error(ex.ToString());
42 54
             }
43
-            if (string.IsNullOrEmpty(login.Code))
44
-                return Error("请输入验证码");
55
+            //if (string.IsNullOrEmpty(login.Code))
56
+            //    return Error("请输入验证码");
45 57
 
46 58
             bool appResult = LoodLoop();
47 59
             if (appResult)
@@ -73,20 +85,20 @@ namespace CallCenterApi.Interface.Controllers
73 85
                     if (dt != null)
74 86
                     {
75 87
                      
76
-                        var code  = new BLL.T_Sys_VerificationCode().GetModelList("F_Timestamp='" + login .Timestamp  + "' " +
77
-                            "and F_Code='" + login .Code  + "'order by F_CreateTime desc");
78
-                        if (code != null && code.Count > 0)
79
-                        {
80
-                            var modelSms = code.First();
81
-                            if ((DateTime.Now - modelSms.F_CreateTime.Value ).Minutes > 10)
82
-                            {
83
-                                return Error("验证码已失效");
84
-                            }
85
-                        }
86
-                        else
87
-                        {
88
-                            return Error("验证码错误");
89
-                        }  
88
+                        //var code  = new BLL.T_Sys_VerificationCode().GetModelList("F_Timestamp='" + login .Timestamp  + "' " +
89
+                        //    "and F_Code='" + login .Code  + "'order by F_CreateTime desc");
90
+                        //if (code != null && code.Count > 0)
91
+                        //{
92
+                        //    var modelSms = code.First();
93
+                        //    if ((DateTime.Now - modelSms.F_CreateTime.Value ).Minutes > 10)
94
+                        //    {
95
+                        //        return Error("验证码已失效");
96
+                        //    }
97
+                        //}
98
+                        //else
99
+                        //{
100
+                        //    return Error("验证码错误");
101
+                        //}  
90 102
 
91 103
 
92 104
 
@@ -509,14 +521,144 @@ namespace CallCenterApi.Interface.Controllers
509 521
             return DESEncrypt.Decrypt(str);
510 522
         }
511 523
 
512
-        [HttpPost]
513
-        public ActionResult AutoLogin(string code)
524
+       
525
+        public ActionResult AutoLogin(string usercode)
514 526
         {
527
+            //只有一个账户免鉴权自动登录,别的账户跳转到舆情登录页面
515 528
 
516
-            return Success("登录成功");
529
+            if (usercode!= clientUserName)
530
+            {
531
+                string url = "http://hnlt.yqt365.com";
532
+                return Success("成功", url);
533
+            }
534
+
535
+            //1  .获取授权码
536
+            string authorizeCode = CallBack();
537
+            if (string.IsNullOrEmpty(authorizeCode))
538
+            {
539
+                return Error("自动登录失败");
540
+            }
541
+            //2 .获取access_token
542
+            string accesstoken=CallBackAccessToken(authorizeCode);
543
+            if (string.IsNullOrEmpty(accesstoken))
544
+            {
545
+                return Error("自动登录失败");
546
+            }
547
+            //3;
548
+            try
549
+            {
550
+                DateTime stime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970,1,1,0,0,0,0));
551
+                long times = (long)(DateTime.Now - stime).TotalMilliseconds;
552
+                string timeStamp = times.ToString();
553
+                 
554
+             
555
+                //获取授权过的Access Token    通过Authorization Code 
556
+                string token_url = "https://api-open.yqt365.com/api/login/v1/ssoLogin?responseType=code&"
557
+                + "systemId=" + appId + "&timeStamp=" + timeStamp + "&clientUserName=" + clientUserName + "&channel=" + channel + "&accessToken=" + accesstoken;
558
+
559
+                return Success("成功", token_url);
560
+
561
+            
562
+
563
+
564
+            }
565
+            catch (Exception ex)
566
+            {
567
+                FileLog.Error("获取舆情登录authorizeCode失败:" + ex.Message + "");
568
+                return Error("跳转登录失败") ;
569
+            }
570
+
571
+
572
+
573
+
574
+           
517 575
           
518 576
         }
577
+        //获取授权码
578
+        public string CallBack()
579
+        {
580
+            string returnauthorizeCode = "";
581
+            if (RedisHelper.StringGet("authorizeCode") != null)
582
+            {
583
+                returnauthorizeCode = RedisHelper.StringGet("authorizeCode").ToString();
584
+                return returnauthorizeCode;
585
+            };
586
+        
587
+            Random random = new Random();
588
+            int randomNumber = random.Next(1000, 9999); // 生成1到100的随机整数
589
+            string state = "state" + randomNumber.ToString();
590
+            try
591
+            {
592
+                //获取授权过的Access Token    通过Authorization Code 
593
+                string token_url = "https://api-open-wx-www.yqt365.com/dataapp/api/oauth2/authorize?responseType=code&"
594
+                + "appId=" + appId + "&state=" + state;
595
+                string response = HttpMethods.HttpPost(token_url);
596
+                //获取用户信息    使用Access Token来获取用户的OpenID
597
+                JObject result = JObject.Parse(response);
598
+                FileLog.Info("获取authorizeCode result的值是" + result);
599
+                if (result["code"].ToString() == "0000" && result["authorizeCode"]["state"].ToString()==state)
600
+                {
601
+                    returnauthorizeCode = result["authorizeCode"]["authorizeCode"].ToString();
602
+                    RedisHelper.StringSet("authorizeCode", returnauthorizeCode, new TimeSpan(0, 8, 0));
603
+
604
+                    return returnauthorizeCode;
605
+                }
606
+                else
607
+                {
608
+                    return "";
609
+                }
610
+
611
+
612
+            }
613
+            catch (Exception ex)
614
+            {
615
+                FileLog.Error("获取舆情登录authorizeCode失败:" + ex.Message + "");
616
+                return "";
617
+            }
618
+        }
619
+
620
+        public string CallBackAccessToken(string authorizeCode)
621
+        {
622
+            string returnaccesstoken = "";
623
+            if (RedisHelper.StringGet("accessToken") != null)
624
+            {
625
+                returnaccesstoken = RedisHelper.StringGet("accessToken").ToString();
626
+                return returnaccesstoken;
627
+            };
628
+ 
629
+ 
630
+            try
631
+            {
632
+                //获取 通过Authorization Code 
633
+                string token_url = "https://api-open-wx-www.yqt365.com/dataapp/api/oauth2/token?grantType=authorization_code&"
634
+                + "appId=" + appId + "&appSecret=" + appSecret+ "&authorizeCode="+ authorizeCode;
635
+                string response = HttpMethods.HttpPost(token_url);
636
+                //   获取 accessToken
637
+                JObject result = JObject.Parse(response);
638
+                FileLog.Info(" 获取accessToken result的值是" + result);
639
+                if (result["code"].ToString() == "0000"  )
640
+                {
641
+                    returnaccesstoken = result["accessToken"]["accessToken"].ToString();
642
+                    RedisHelper.StringSet("accessToken", returnaccesstoken, new TimeSpan(22, 30, 0));
643
+
644
+                    return returnaccesstoken;
645
+                }
646
+                else
647
+                {
648
+                    return "";
649
+                }
519 650
 
520 651
 
652
+            }
653
+            catch (Exception ex)
654
+            {
655
+                FileLog.Error("获取舆情登录accesstoken失败:" + ex.Message + "");
656
+                return "";
657
+            }
658
+        }
659
+        /// <summary>
660
+        /// Log4net 日志
661
+        /// </summary>
662
+
521 663
     }
522 664
 }

File diff suppressed because it is too large
+ 145 - 65
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs


+ 2 - 2
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/thirdController.cs

@@ -1533,7 +1533,7 @@ namespace CallCenterApi.Interface.Controllers
1533 1533
         }
1534 1534
 
1535 1535
         /// <summary>
1536
-        /// 申请退回工单
1536
+        /// 申请退回工单 这个不用了
1537 1537
         /// </summary>
1538 1538
         /// <returns></returns>
1539 1539
         [Authority]
@@ -1682,7 +1682,7 @@ namespace CallCenterApi.Interface.Controllers
1682 1682
                     }
1683 1683
                     else
1684 1684
                     {
1685
-                            modelT_Bus_WorkOrder.F_WorkState = 14;
1685
+                            modelT_Bus_WorkOrder.F_WorkState = (int)EnumWorkState.finish;
1686 1686
                             workorderBLL.Update(modelT_Bus_WorkOrder);
1687 1687
                     }
1688 1688
                     workorderBLL.Update(modelT_Bus_WorkOrder);