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

+ 1 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Configs/system.config

@@ -24,7 +24,7 @@
24 24
   <!-- 设置微信appsecret -->
25 25
   <add key="WechatAppsecret" value="3e42313935a4d6dc8b450172b8be2765" />
26 26
   <!-- 微信支付分配的商户号 -->
27
-  <add key="WechatMchid" value=""/>
27
+  <add key="WechatMchid" value="1493808312"/>
28 28
   <add key="WechatKey" value=""/>
29 29
   <!-- 商户证书物理位置 -->
30 30
   <add key="WechatPath" value=""/>

+ 4 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs

@@ -515,6 +515,7 @@ namespace CallCenterApi.Interface.Controllers.tel
515 515
                 //string reamount = RequestString.GetFormString("reamount");//奖励金额
516 516
                 //string retime = RequestString.GetFormString("retime");//奖励时间
517 517
                 int unitid = RequestString.GetInt("unitid", 0);//交办单位
518
+                int isaudit = RequestString.GetInt("isaudit", 0);//0未审核,1无效,2有效
518 519
                 #endregion
519 520
                 #endregion
520 521
 
@@ -557,6 +558,8 @@ namespace CallCenterApi.Interface.Controllers.tel
557 558
                         model.IsTimeOut = 0;
558 559
                         model.IsUserSend = 0;
559 560
                         model.IsAdminSend = 0;
561
+                        model.IsAudit = isaudit;//0未审核,1无效,2有效
562
+
560 563
                         if (source.Trim() == "1")
561 564
                             model.Source = "手工制单";
562 565
                         else if (source.Trim() == "2")
@@ -587,12 +590,7 @@ namespace CallCenterApi.Interface.Controllers.tel
587 590
                             }
588 591
                         }
589 592
                         #endregion
590
-
591
-                        //Model.T_Sys_UserAccount us = new BLL.T_Sys_UserAccount().GetModel(zrid);
592
-                        //if (us != null)
593
-                        //{
594
-                        //    model.ResponUser = us.F_UserCode;
595
-                        //}
593
+                        
596 594
                         #region 工单超时
597 595
                         Model.T_Wo_WorkOrderTimeOut to = new BLL.T_Wo_WorkOrderTimeOut().GetModel(type);
598 596
                         if (to != null)

+ 89 - 59
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -105,7 +105,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
105 105
             string strusercode = HttpUtility.UrlDecode(RequestString.GetQueryString("usercode"));//创建人工号
106 106
             string source = HttpUtility.UrlDecode(RequestString.GetQueryString("source"));//工单来源
107 107
             string infotype = HttpUtility.UrlDecode(RequestString.GetQueryString("infotype"));//信息分类
108
-            
108
+
109 109
 
110 110
             string strpageindex = RequestString.GetQueryString("page");
111 111
             int pageindex = 1;
@@ -145,7 +145,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
145 145
             {
146 146
                 sql += " and InfoTypeID = " + infotype + " ";
147 147
             }
148
-            
148
+
149 149
             if (source.Trim() != "" && source != "undefined")
150 150
             {
151 151
                 sql += " and Source = '" + source + "' ";
@@ -208,36 +208,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
208 208
             string content = RequestString.GetFormString("content");
209 209
             string files = RequestString.GetFormString("files");
210 210
             int type = RequestString.GetInt("type", 3);//默认为3投诉建议
211
-            
211
+
212 212
             string stropenid = HttpUtility.UrlDecode(RequestString.GetFormString("openid"));
213 213
             var wxuser = new BLL.T_Sys_Users().GetModelList(" F_OpenId='" + stropenid.Trim() + "'  and F_Type=1 ").FirstOrDefault();
214
-            string fileids = "";
215
-            #region 上传附件
216
-            //HttpFileCollection files = RequestString.GetFiles();
217
-            //if (files.Count > 0)
218
-            //{
219
-            //    List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
220
-            //    string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy/MM/dd") + "/";
221
-            //    for (int i = 0; i < files.Count; i++)
222
-            //    {
223
-            //        HttpPostedFile file = files[i];
224
-            //        FileUp fu = new FileUp();
225
-
226
-            //        string name = fu.Upload(file, path);
227
-
228
-            //        Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
229
-            //        model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
230
-            //        model_T_Sys_Accessories.F_FileName = name;//附件名称
231
-            //        model_T_Sys_Accessories.F_FileType = System.IO.Path.GetExtension(file.FileName);//附件类型
232
-            //        model_T_Sys_Accessories.F_FileUrl = path + name;//附件地址
233
-            //        model_T_Sys_Accessories.F_Size = file.ContentLength;
234
-            //        int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
235
-            //        model_T_Sys_Accessories.F_FileId = id;
236
-            //        acs.Add(model_T_Sys_Accessories);
237
-            //        fileids += id.ToString() + ",";
238
-            //    }
239
-            //}
240
-            #endregion
241 214
 
242 215
             workorder.WorkOrderController wo = new workorder.WorkOrderController();
243 216
             string workorderid = wo.AddWorkOrders(type, cusname, cusphone, content, files);
@@ -256,6 +229,38 @@ namespace CallCenterApi.Interface.Controllers.weixin
256 229
             }
257 230
 
258 231
         }
232
+
233
+        /// <summary>
234
+        ///  处理工单
235
+        /// </summary>
236
+        /// <returns></returns>
237
+        [WechatActionFilter]
238
+        public ActionResult DealWorkOrder()
239
+        {
240
+            DataTable dt = new DataTable();
241
+            string orderid = RequestString.GetFormString("orderid");
242
+            string clcont = HttpUtility.UrlDecode(RequestString.GetFormString("clcont"));
243
+
244
+            int isaudit = RequestString.GetFormInt("isaudit", 0);
245
+            int infotypeid = RequestString.GetFormInt("infotypeid", 0);
246
+            int unitid = RequestString.GetFormInt("unitid", 0);
247
+
248
+            string stropenid = HttpUtility.UrlDecode(RequestString.GetFormString("openid"));
249
+
250
+            workorder.WorkOrderController wo = new workorder.WorkOrderController();
251
+            bool res = wo.DealWorkOrders(orderid, clcont, stropenid, isaudit, infotypeid, unitid);
252
+
253
+            if (res)
254
+            {
255
+                return Error("操作失败");
256
+            }
257
+            else
258
+            {
259
+                return Success("操作成功");
260
+            }
261
+
262
+        }
263
+
259 264
         /// <summary>
260 265
         ///  获取工单详情
261 266
         /// </summary>
@@ -276,11 +281,10 @@ namespace CallCenterApi.Interface.Controllers.weixin
276 281
                 var dt = DbHelperSQL.Query(sql).Tables[0];
277 282
                 if (dt.Rows.Count > 0)
278 283
                 {
279
-                    var configly = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
280 284
                     var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
281 285
                     var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
282 286
 
283
-                    
287
+
284 288
                     if (configfj != null)
285 289
                     {
286 290
                         dt = BindFileData(dt, configfj.F_ParamValue);
@@ -289,24 +293,15 @@ namespace CallCenterApi.Interface.Controllers.weixin
289 293
                     string gcsql = "select *,dbo.GetUserName(F_CreateUser) as UserName "
290 294
                                         + "from T_Wo_Operation where F_IsDelete=0 and F_WorkOrderId ='" + dt.Rows[0]["WorkOrderId"] + "'";
291 295
                     var gcdt = DbHelperSQL.Query(gcsql).Tables[0];
292
-                    gcdt.Columns.Add("File", typeof(object));
293
-                    gcdt.Columns.Add("FilePath", typeof(string));
294
-                    if (configfj != null || configly != null || config != null)
296
+
297
+                    dt.Columns.Add("FilePath", typeof(string));
298
+                    if (configfj != null || config != null)
295 299
                     {
296
-                        foreach (DataRow bldr in gcdt.Rows)
300
+                        foreach (DataRow bldr in dt.Rows)
297 301
                         {
298
-                            if (bldr["F_File"] != null && bldr["F_File"].ToString() != "" && configfj != null)
299
-                            {
300
-                                bldr["File"] = GetFileData(bldr["F_File"].ToString(), configfj.F_ParamValue);
301
-                            }
302
-
303
-                            if (bldr["F_LeaveRecordId"] != null && configly != null)
304
-                            {
305
-                                bldr["FilePath"] = GetLeavePath(bldr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
306
-                            }
307
-                            else if (bldr["F_CallRecordId"] != null && config != null)
302
+                            if (bldr["CallID"] != null && config != null)
308 303
                             {
309
-                                bldr["FilePath"] = GetCallPath(bldr["F_CallRecordId"].ToString(), config.F_ParamValue);
304
+                                bldr["FilePath"] = GetCallPath(bldr["CallID"].ToString(), config.F_ParamValue);
310 305
                             }
311 306
                         }
312 307
                     }
@@ -329,7 +324,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
329 324
             }
330 325
 
331 326
         }
332
-        
327
+
333 328
         #endregion
334 329
 
335 330
         #region 获取下拉框
@@ -356,7 +351,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
356 351
             var dt = DbHelperSQL.Query(sql).Tables[0];
357 352
             return Success("列表加载成功", dt);
358 353
         }
359
-        
354
+
360 355
         #endregion
361 356
 
362 357
         #region 附件和语音文件
@@ -389,7 +384,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
389 384
         public string GetCallPath(string cid, string prefix)
390 385
         {
391 386
             string path = string.Empty;
392
-            var luyin = new BLL.T_Call_CallRecords().GetModelList(" CallRecordsId='" + cid + "' ").FirstOrDefault();
387
+            var luyin = new BLL.T_Call_CallRecords().GetModelList(" callid='" + cid + "'  ").FirstOrDefault();
393 388
             if (luyin != null)
394 389
             {
395 390
                 if (!string.IsNullOrEmpty(luyin.FilePath))
@@ -431,9 +426,9 @@ namespace CallCenterApi.Interface.Controllers.weixin
431 426
             dt.Columns.Add("File", typeof(object));
432 427
             foreach (DataRow dr in dt.Rows)
433 428
             {
434
-                if (dr["F_File"] != null && dr["F_File"].ToString() != "")
429
+                if (dr["Files"] != null && dr["Files"].ToString() != "")
435 430
                 {
436
-                    dr["File"] = GetFileData(dr["F_File"].ToString(), prefix);
431
+                    dr["File"] = GetFileData(dr["Files"].ToString(), prefix);
437 432
                 }
438 433
             }
439 434
             return dt;
@@ -446,7 +441,12 @@ namespace CallCenterApi.Interface.Controllers.weixin
446 441
         public ActionResult UpdateFile()
447 442
         {
448 443
             //string stropenid = HttpUtility.UrlDecode(RequestString.GetFormString("openid"));
449
-            string fileurl = HttpUtility.UrlDecode(RequestString.GetFormString("fileurl"));
444
+            //byte[] filesss = HttpUtility.UrlDecodeToBytes(RequestString.GetFormString("filesss"));
445
+            string filess = HttpUtility.UrlDecode(RequestString.GetFormString("filesss"));
446
+            Error(filess);
447
+
448
+            byte[] filesss = Convert.FromBase64String(filess.Split(',')[1]);
449
+            //string fileurl = HttpUtility.UrlDecode(RequestString.GetFormString("fileurl"));
450 450
             string filename = HttpUtility.UrlDecode(RequestString.GetFormString("filename"));
451 451
             string filesize = HttpUtility.UrlDecode(RequestString.GetFormString("filesize"));
452 452
             string filetype = HttpUtility.UrlDecode(RequestString.GetFormString("filetype"));
@@ -454,16 +454,18 @@ namespace CallCenterApi.Interface.Controllers.weixin
454 454
             FileUp fu = new FileUp();
455 455
             string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy/MM/dd") + "/";
456 456
             #region
457
-            if (fileurl.Trim() != "" && fileurl != "undefined")
457
+            if (filesss.Length > 0)
458 458
             {
459
-                byte[] by = fu.GetBinaryFile(fileurl);
459
+                //byte[] by = fu.GetBinaryFile(fileurl);
460 460
 
461
-                fu.SaveFile(by, path, filename, filetype);
461
+                string newfilename = DateTime.Now.ToString("yyyyMMddHHmmssmsfff") + "_" + filename;
462
+
463
+                fu.SaveFile(filesss, path, newfilename, filetype);
462 464
                 Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
463 465
                 model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
464
-                model_T_Sys_Accessories.F_FileName = filename;//附件名称
466
+                model_T_Sys_Accessories.F_FileName = newfilename;//附件名称
465 467
                 model_T_Sys_Accessories.F_FileType = filetype;//附件类型
466
-                model_T_Sys_Accessories.F_FileUrl = path + filename;//附件地址
468
+                model_T_Sys_Accessories.F_FileUrl = path + newfilename;//附件地址
467 469
                 model_T_Sys_Accessories.F_Size = long.Parse(filesize);
468 470
                 //model_T_Sys_Accessories.F_UserCode = stropenid;//上传人  
469 471
                 int id = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
@@ -486,7 +488,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
486 488
             //if (files.Count > 0)
487 489
             //{
488 490
             //    List<Model.T_Sys_Accessories> acs = new List<Model.T_Sys_Accessories>();
489
-                
491
+
490 492
             //    for (int i = 0; i < files.Count; i++)
491 493
             //    {
492 494
 
@@ -513,5 +515,33 @@ namespace CallCenterApi.Interface.Controllers.weixin
513 515
             #endregion
514 516
         }
515 517
         #endregion
518
+
519
+        #region
520
+        public ActionResult UpLoadProcess(string id, HttpPostedFileBase file)
521
+        {
522
+            try
523
+            {
524
+                string filePathName = string.Empty;
525
+                string path = "/Upload/Files/" + DateTime.Now.ToString("yyyy/MM/dd") + "/";
526
+                string localPath = Path.Combine(HttpRuntime.AppDomainAppPath, path);
527
+                if (Request.Files.Count == 0)
528
+                {
529
+                    return Json(new { jsonrpc = 2.0, error = new { code = 102, message = "保存失败" }, id = "id" });
530
+                }
531
+                string ex = Path.GetExtension(file.FileName);
532
+                filePathName = DateTime.Now.ToString("yyyyMMddHHmmssmsfff") + "_" + Guid.NewGuid().ToString("N") + ex;
533
+                if (!System.IO.Directory.Exists(localPath))
534
+                {
535
+                    System.IO.Directory.CreateDirectory(localPath);
536
+                }
537
+                file.SaveAs(Path.Combine(localPath, filePathName));
538
+                return Success("上传成功", path + filePathName);
539
+            }
540
+            catch (Exception ex)
541
+            {
542
+                return Error(ex.Message);
543
+            }
544
+        }
545
+        #endregion
516 546
     }
517 547
 }

+ 166 - 23
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -154,7 +154,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
154 154
                         switch (strltype)
155 155
                         {
156 156
                             case "0"://待指派的
157
-                                sql += " and State ='0' and CreateUser= '" + ua.F_UserCode + "' ";
157
+                                //sql += " and State ='0' and CreateUser= '" + ua.F_UserCode + "' ";
158
+                                sql += " and State ='0'  ";
158 159
                                 break;
159 160
                             case "1"://待接单的
160 161
                                 sql += " and State ='1' and WorkOrderID in ( '" + GetDJDWorkOrderID(ua.F_UserCode) + "') ";
@@ -375,7 +376,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
375 376
         {
376 377
             string str = string.Empty;
377 378
 
378
-            var list = new BLL.T_Wo_WorkOrderItem().GetModelList(" IsDel=0 and Type=1 and (state='1' and SureUser='" + user + "')  ").Select(p => p.WorkOrderID).Distinct();
379
+            var list = new BLL.T_Wo_WorkOrderItem().GetModelList(" IsDel=0 and Type=1 and (state='1' and ','+ToUser+',' like '%," + user + ",%')    ").Select(p => p.WorkOrderID).Distinct();
379 380
 
380 381
             foreach (var l in list)
381 382
             {
@@ -436,6 +437,13 @@ namespace CallCenterApi.Interface.Controllers.workorder
436 437
 
437 438
                     var data = DbHelperSQL.Query(sql).Tables[0];
438 439
                     var item = DbHelperSQL.Query(sqlitem).Tables[0];
440
+
441
+                    var configfj = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='FileUrlPath' ").FirstOrDefault();
442
+                    if (configfj != null)
443
+                    {
444
+                        data = BindFileData(data, configfj.F_ParamValue);
445
+                    }
446
+
439 447
                     var obj = new
440 448
                     {
441 449
                         data = data,
@@ -455,6 +463,44 @@ namespace CallCenterApi.Interface.Controllers.workorder
455 463
             }
456 464
             return res;
457 465
         }
466
+        #region 绑定附件信息
467
+        /// <summary>
468
+        /// 获取附件数据
469
+        /// </summary>
470
+        /// <param name="ids">附件id,多个用英文逗号,隔开</param>
471
+        /// <param name="prefix">前缀</param>
472
+        /// <returns></returns>
473
+        public DataTable GetFileData(string ids, string prefix)
474
+        {
475
+            DataTable dt = DbHelperSQL.Query("select * from T_Sys_Accessories where F_FileId in (" + ids + ")").Tables[0];
476
+
477
+            foreach (DataRow dr in dt.Rows)
478
+            {
479
+                dr["F_FileUrl"] = prefix + dr["F_FileUrl"].ToString();
480
+            }
481
+
482
+            return dt;
483
+        }
484
+
485
+        /// <summary>
486
+        /// 绑定附件信息
487
+        /// </summary>
488
+        /// <param name="dt"></param>
489
+        /// <param name="prefix"></param>
490
+        /// <returns></returns>
491
+        public DataTable BindFileData(DataTable dt, string prefix)
492
+        {
493
+            dt.Columns.Add("File", typeof(object));
494
+            foreach (DataRow dr in dt.Rows)
495
+            {
496
+                if (dr["Files"] != null && dr["Files"].ToString() != "")
497
+                {
498
+                    dr["File"] = GetFileData(dr["Files"].ToString(), prefix);
499
+                }
500
+            }
501
+            return dt;
502
+        }
503
+        #endregion
458 504
 
459 505
         /// <summary>
460 506
         /// 添加/修改工单信息
@@ -492,6 +538,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
492 538
                         #region 新增字段
493 539
                         int infotypeid = RequestString.GetInt("infotypeid", 0);//信息分类
494 540
                         int unitid = RequestString.GetInt("unitid", 0);//交办单位
541
+                        int isaudit = RequestString.GetInt("isaudit", 0);//0未审核,1无效,2有效
495 542
                         #endregion
496 543
 
497 544
                         Model.T_Wo_WorkOrder model = new Model.T_Wo_WorkOrder();
@@ -522,7 +569,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
522 569
                         model.IsTimeOut = 0;
523 570
                         model.IsUserSend = 0;
524 571
                         model.IsAdminSend = 0;
525
-                        model.IsAudit = 0;//0未审核,1无效,2有效
572
+                        model.IsAudit = isaudit;//0未审核,1无效,2有效
526 573
 
527 574
                         #region 新增字段
528 575
                         model.InfoTypeID = infotypeid;
@@ -659,6 +706,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
659 706
             return res;
660 707
         }
661 708
 
709
+        //微信添加工单
662 710
         public string AddWorkOrders(int type, string tskh, string tsdh, string cont, string file)
663 711
         {
664 712
             string workorderid = string.Empty;
@@ -714,6 +762,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
714 762
             Model.T_Wo_Operation oper = new Model.T_Wo_Operation();
715 763
             oper.F_WorkOrderId = model.WorkOrderID;
716 764
             oper.F_State = model.State;
765
+            oper.F_CallRecordId = model.CallID != null ? int.Parse(model.CallID) : 0;
766
+            oper.F_File = model.Files;
717 767
 
718 768
             string userinfo = "由 " + model.Source;
719 769
             if (model.State == 0)
@@ -806,8 +856,8 @@ namespace CallCenterApi.Interface.Controllers.workorder
806 856
                         string cont = RequestString.GetFormString("cont");
807 857
                         int clbm = RequestString.GetInt("clbm", 0);
808 858
                         int clid = RequestString.GetInt("clid", 0);
859
+                        int isaudit = RequestString.GetInt("isaudit", 0);//0未审核,1无效,2有效
809 860
                         #region 新增字段
810
-                        int isyx = RequestString.GetInt("isyx", 0);//是否有效
811 861
                         int infotypeid = RequestString.GetInt("infotypeid", 0);//信息分类
812 862
                         int isreward = RequestString.GetInt("isreward", 0);//上报奖励
813 863
                         string reamount = RequestString.GetFormString("reamount");//奖励金额
@@ -819,6 +869,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
819 869
                         Model.T_Wo_WorkOrder model = new BLL.T_Wo_WorkOrder().GetModelList(" WorkOrderID='" + orderid + "'").FirstOrDefault();
820 870
                         if (model != null)
821 871
                         {
872
+                            
822 873
                             #region 获取处理人工号
823 874
                             string struser = string.Empty;
824 875
                             if (clbm != 0)
@@ -852,7 +903,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
852 903
                             #endregion
853 904
 
854 905
                             #region 新增字段
855
-                            model.IsAudit = isyx;//0未审核,1无效,2有效
906
+                            model.IsAudit = isaudit;//0未审核,1无效,2有效
856 907
                             model.InfoTypeID = infotypeid;
857 908
                             if (infotypeid != 0)
858 909
                             {
@@ -882,6 +933,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
882 933
                                 , model.UnitID.Value, model.Unit);
883 934
                             if (n > 0)
884 935
                             {
936
+                                #region 消息通知
885 937
                                 Model.T_Wo_WorkOrderItem item = new BLL.T_Wo_WorkOrderItem().GetModelList(" WorkOrderID='" + orderid + "' and Type=1 ").OrderByDescending(p => p.CreateTime).FirstOrDefault();
886 938
 
887 939
                                 string strmsg = string.Empty;
@@ -893,7 +945,23 @@ namespace CallCenterApi.Interface.Controllers.workorder
893 945
                                 {
894 946
                                     strmsg = ua.F_UserName + "完结了工单,单号:" + model.WorkOrderID;
895 947
                                 }
896
-                                
948
+                                #region 消息表
949
+                                foreach (string ur in item.ToUser.Split(','))
950
+                                {
951
+                                    Model.T_Msg_List msg = new Model.T_Msg_List();
952
+                                    msg.Type = 1;
953
+                                    msg.ToUser = ur;
954
+                                    msg.ToID = Int32.Parse(item.ID.ToString());
955
+                                    msg.Detail = strmsg;
956
+                                    msg.State = 0;
957
+                                    msg.IsDel = 0;
958
+                                    msg.CreateUser = ua.F_UserCode;
959
+                                    msg.CreateDate = DateTime.Now;
960
+
961
+                                    new BLL.T_Msg_List().Add(msg);
962
+                                }
963
+                                #endregion
964
+                                #endregion
897 965
                                 #region 插入操作记录
898 966
                                 Model.T_Wo_Operation oper = new Model.T_Wo_Operation();
899 967
                                 oper.F_WorkOrderId = model.WorkOrderID;
@@ -918,22 +986,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
918 986
                                 new BLL.T_Wo_Operation().Add(oper);
919 987
                                 #endregion
920 988
 
921
-                                #region 消息表
922
-                                foreach (string ur in item.ToUser.Split(','))
923
-                                {
924
-                                    Model.T_Msg_List msg = new Model.T_Msg_List();
925
-                                    msg.Type = 1;
926
-                                    msg.ToUser = ur;
927
-                                    msg.ToID = Int32.Parse(item.ID.ToString());
928
-                                    msg.Detail = strmsg;
929
-                                    msg.State = 0;
930
-                                    msg.IsDel = 0;
931
-                                    msg.CreateUser = ua.F_UserCode;
932
-                                    msg.CreateDate = DateTime.Now;
933
-
934
-                                    new BLL.T_Msg_List().Add(msg);
935
-                                }
936
-                                #endregion
989
+                                
937 990
                                 res = Success("处理成功");
938 991
                             }
939 992
                             
@@ -945,6 +998,96 @@ namespace CallCenterApi.Interface.Controllers.workorder
945 998
             return res;
946 999
         }
947 1000
 
1001
+        //微信处理工单
1002
+        public bool DealWorkOrders(string orderid,string cont,string openid,int isaudit,int infotypeid,int unitid)
1003
+        {
1004
+            bool res = false;
1005
+            Model.T_Wo_WorkOrder model = new BLL.T_Wo_WorkOrder().GetModelList(" WorkOrderID='" + orderid + "'").FirstOrDefault();
1006
+            if (model != null)
1007
+            {
1008
+                if (openid != "")
1009
+                {
1010
+                    Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModelList(" F_WxOpenId='" + openid + "'").FirstOrDefault();
1011
+                    if (ua != null)
1012
+                    {
1013
+
1014
+                        #region 新增字段
1015
+                        model.IsAudit = isaudit;//0未审核,1无效,2有效
1016
+                        model.InfoTypeID = infotypeid;//信息分类
1017
+                        if (infotypeid != 0)
1018
+                        {
1019
+                            Model.T_Sys_DictionaryValue dicVModel = dictionaryValueBLL.GetModel(infotypeid);
1020
+                            if (dicVModel != null)
1021
+                            {
1022
+                                model.InfoType = dicVModel.F_Name;
1023
+                            }
1024
+                        }
1025
+                        model.ISReward = 0;
1026
+                        model.UnitID = unitid;//交办单位
1027
+                        if (unitid != 0)
1028
+                        {
1029
+                            Model.T_Sys_DictionaryValue dicVModel = dictionaryValueBLL.GetModel(unitid);
1030
+                            if (dicVModel != null)
1031
+                            {
1032
+                                model.Unit = dicVModel.F_Name;
1033
+                            }
1034
+                        }
1035
+                        #endregion
1036
+
1037
+                        int n = new BLL.T_Wo_WorkOrder().DealWorkOrder(orderid, 1, cont, ua.F_DeptId, ua.F_UserCode, ua.F_UserCode
1038
+                            , model.IsAudit.Value, model.InfoType, model.InfoTypeID.Value
1039
+                            , model.ISReward.Value, model.RewardAmount, model.RewardTime
1040
+                            , model.UnitID.Value, model.Unit);
1041
+                        if (n > 0)
1042
+                        {
1043
+                            #region 消息通知
1044
+                            Model.T_Wo_WorkOrderItem item = new BLL.T_Wo_WorkOrderItem().GetModelList(" WorkOrderID='" + orderid + "' and Type=1 ").OrderByDescending(p => p.CreateTime).FirstOrDefault();
1045
+
1046
+                            string strmsg = string.Empty;
1047
+                            strmsg = ua.F_UserName + "通过微信完结了工单,单号:" + model.WorkOrderID;
1048
+                            #region 消息表
1049
+                            foreach (string ur in item.ToUser.Split(','))
1050
+                            {
1051
+                                Model.T_Msg_List msg = new Model.T_Msg_List();
1052
+                                msg.Type = 1;
1053
+                                msg.ToUser = ur;
1054
+                                msg.ToID = Int32.Parse(item.ID.ToString());
1055
+                                msg.Detail = strmsg;
1056
+                                msg.State = 0;
1057
+                                msg.IsDel = 0;
1058
+                                msg.CreateUser = ua.F_UserCode;
1059
+                                msg.CreateDate = DateTime.Now;
1060
+
1061
+                                new BLL.T_Msg_List().Add(msg);
1062
+                            }
1063
+                            #endregion
1064
+                            #endregion
1065
+
1066
+                            #region 插入操作记录
1067
+                            Model.T_Wo_Operation oper = new Model.T_Wo_Operation();
1068
+                            oper.F_WorkOrderId = model.WorkOrderID;
1069
+                            oper.F_State = model.State;
1070
+                            oper.F_CallRecordId = model.CallID != null ? int.Parse(model.CallID) : 0;
1071
+                            oper.F_File = model.Files;
1072
+
1073
+                            string userinfo = ua.depname + "-" + ua.F_UserName + "(" + ua.F_UserCode + ")";
1074
+
1075
+                            oper.F_Message = userinfo + "通过微信完结了工单,单号:" + model.WorkOrderID;
1076
+
1077
+                            oper.F_CreateUser = ua.F_UserCode;
1078
+                            oper.F_CreateTime = DateTime.Now;
1079
+                            oper.F_IsDelete = 0;
1080
+
1081
+                            new BLL.T_Wo_Operation().Add(oper);
1082
+                            #endregion
1083
+                            res = true;
1084
+                        }
1085
+                    }
1086
+                }
1087
+            }
1088
+            return res;
1089
+        }
1090
+
948 1091
         /// <summary>
949 1092
         /// 确认工单
950 1093
         /// </summary>
@@ -2045,7 +2188,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2045 2188
         }
2046 2189
 
2047 2190
         //获取奖励记录
2048
-        public ActionResult GetList(string woid)
2191
+        public ActionResult GetAMList(string woid)
2049 2192
         {
2050 2193
             ActionResult res = NoToken("未知错误,请重新登录");
2051 2194
             if (Request.IsAuthenticated)

+ 6 - 0
codegit/CallCenterCommon/CallCenter.Utility/FileUp.cs

@@ -119,6 +119,7 @@ namespace CallCenter.Utility
119 119
         public void SaveFile(byte[] binData, string SavePath, string fileName, string fileType)
120 120
         {
121 121
             FileStream fileStream = null;
122
+            
122 123
             MemoryStream m = new MemoryStream(binData);
123 124
             try
124 125
             {
@@ -129,10 +130,15 @@ namespace CallCenter.Utility
129 130
                 }
130 131
                 string File = savePath + fileName;//+ fileType;
131 132
                 fileStream = new FileStream(File, FileMode.Create);
133
+                
132 134
                 m.WriteTo(fileStream);
135
+                m.Flush();
133 136
             }
134 137
             finally
135 138
             {
139
+                fileStream.Dispose();
140
+                m.Dispose();
141
+
136 142
                 m.Close();
137 143
                 fileStream.Close();
138 144
             }