Selaa lähdekoodia

管理中心数据读取bug,工单测试后bug,微信登录获取rolecode

zhengbingbing 6 vuotta sitten
vanhempi
commit
add8703a62

+ 1 - 0
codegit/CallCenterApi/CallCenterAPI.WechatSDK/Models/WxLoginDto.cs

@@ -13,6 +13,7 @@ namespace CallCenterAPI.WechatSDK.Models
13 13
         #region 坐席登录所需
14 14
         public string UserCode { get; set; }
15 15
         public string Password { get; set; }
16
+        public string RoleCode { get; set; }
16 17
         /// <summary>
17 18
         /// 返回时候用:用户角色(坐席表用户【-1管理员 1--接待部(客服端) 2--办理人员 3--区域客服 4--监管】,客户档案用户【5用户端】) 
18 19
         /// 登陆时候用: 1员工端,2业主端

+ 30 - 16
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/IndexController.cs

@@ -2,6 +2,7 @@
2 2
 using CallCenterApi.Common;
3 3
 using CallCenterApi.Interface.Controllers.Base;
4 4
 using CallCenterApi.Interface.Controllers.workorder;
5
+using CallCenterApi.Interface.Models.Enum;
5 6
 using System;
6 7
 using System.Collections.Generic;
7 8
 using System.Data;
@@ -249,10 +250,15 @@ namespace CallCenterApi.Interface.Controllers
249 250
                         }
250 251
 
251 252
                         BLL.T_Wo_WorkOrder bll = new BLL.T_Wo_WorkOrder();
252
-                        var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =2 and IsDel=0 ").Tables[0];
253
-                        var list2 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State in (0,1) and IsDel=0 ").Tables[0];
254
-                        var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =2 and IsDel=0 ").Tables[0];
255
-                        var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State in (0,1) and IsDel=0 ").Tables[0];
253
+                        var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =" + (int)EnumWorkOrderState.finish + " and IsDel=0 ").Tables[0];
254
+                        var list2 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State <" + (int)EnumWorkOrderState.finish + " and IsDel=0 ").Tables[0];
255
+                        var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =" + (int)EnumWorkOrderState.finish + " and IsDel=0 ").Tables[0];
256
+                        var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State <" + (int)EnumWorkOrderState.finish + " and IsDel=0 ").Tables[0];
257
+                        #region
258
+                        //var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =2 and IsDel=0 ").Tables[0];
259
+                        //var list2 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State in (0,1) and IsDel=0 ").Tables[0];
260
+                        //var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =2 and IsDel=0 ").Tables[0];
261
+                        //var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State in (0,1) and IsDel=0 ").Tables[0];
256 262
 
257 263
                         ////日已完成
258 264
                         //var list1 = bll.GetList(uwhere + " and CONVERT(varchar(10),CreateTime, 23)='" + strDate + "' and State =1 and IsDel=0 ").Tables[0];
@@ -262,7 +268,7 @@ namespace CallCenterApi.Interface.Controllers
262 268
                         //var list3 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State =1 and IsDel=0 ").Tables[0];
263 269
                         ////月未完成
264 270
                         //var list4 = bll.GetList(uwhere + " and CONVERT(char(7),CreateTime,20)='" + strMonth + "' and State=0 and IsDel=0 ").Tables[0];
265
-
271
+                        #endregion
266 272
                         var obj = new
267 273
                         {
268 274
                             daywc = list1.Rows.Count,
@@ -517,29 +523,37 @@ namespace CallCenterApi.Interface.Controllers
517 523
                         if (ua.F_RoleId != 17)
518 524
                         {
519 525
                             uwhere += " and CreateUser='" + ua.F_UserCode + "' ";
520
-                            uwhere += " and State =0 ";
526
+                            uwhere += " and State =" + (int)EnumWorkOrderState.neworder + " ";
527
+                            //uwhere += " and State =0 ";
521 528
                         }
522 529
                         //2、待接单的
523
-                        string djdwhere = " 1=1 and State =1 and WorkOrderID in ( " + woController.GetDJDWorkOrderID(ua.F_UserCode) + ") ";
530
+                        string djdwhere = $" 1=1 and State =" + (int)EnumWorkOrderState.assign + " and T_Wo_WorkOrder.ID in ( " + woController.GetDJDWorkOrderID(ua.F_UserCode) + ") ";//" 1=1 and State =1 and WorkOrderID in ( " + woController.GetDJDWorkOrderID(ua.F_UserCode) + ") ";
524 531
                         //3、待完成(处理)的
525
-                        string dclwhere = " 1=1 and State =1 and WorkOrderID in ( " + woController.GetDWCWorkOrderID(ua.F_UserCode) + ") ";
532
+                        string dclwhere = $" 1=1 and State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," + (int)EnumWorkOrderState.reback + ") and T_Wo_WorkOrder.ID in ( " + woController.GetDWCWorkOrderID(ua.F_UserCode) + ") ";//" 1=1 and State =1 and WorkOrderID in ( " + woController.GetDWCWorkOrderID(ua.F_UserCode) + ") ";
526 533
                         //4、已处理的
527
-                        string yclwhere = " 1=1 and State =2 and LastDealUser = '" + ua.F_UserCode + "' ";
534
+                        string yclwhere = $" 1=1 and State =" + (int)EnumWorkOrderState.finish + " and LastDealUser = '" + ua.F_UserCode + "' ";//" 1=1 and State =2 and LastDealUser = '" + ua.F_UserCode + "' ";
528 535
                         //5、我参与的
529
-                        string wcywhere = " 1=1 and  (CreateUser= '" + ua.F_UserCode + "' or WorkOrderID in ( " + woController.GetCYWorkOrderID(ua.F_UserCode) + ")) ";
536
+                        string wcywhere = $" 1=1 and (CreateUser= '" + ua.F_UserCode + "' or T_Wo_WorkOrder.ID in ( " + woController.GetCYWorkOrderID(ua.F_UserCode) + ")) ";//" 1=1 and  (CreateUser= '" + ua.F_UserCode + "' or WorkOrderID in ( " + woController.GetCYWorkOrderID(ua.F_UserCode) + ")) ";
530 537
                         //5、超期工单
531
-                        string cqwhere = $" 1=1 and DATEADD(DAY,{days},CreateTime) < GETDATE() AND State < 2  ";
538
+                        string cqwhere = $" 1=1 and DATEADD(DAY,{days},CreateTime) < GETDATE() AND State < " + (int)EnumWorkOrderState.finish + " ";//$" 1=1 and DATEADD(DAY,{days},CreateTime) < GETDATE() AND State < 2  ";
532 539
                         //5、未审核微信工单
533 540
                         string wxwhere = $" 1=1 ";  // ANd Type = (SELECT F_DictionaryValueId FROM dbo.T_Sys_DictionaryValue (NOLOCK) WHERE F_DictionaryFlag = 'GDLY' AND F_Name = '微信')
534 541
                         var obj = new
535 542
                         {
536
-                            dpd = bll.GetList(uwhere + sql+ " and State=0 and IsAudit = 1 ").Tables[0].Rows.Count,                    //待指派的统计
537
-                            djd = bll.GetList(djdwhere + sql + " and State =1 and IsAudit = 1 ").Tables[0].Rows.Count,    //待接单的统计
538
-                            dcl = bll.GetList(dclwhere + sql + " and State =1 and IsAudit = 1 ").Tables[0].Rows.Count,    //待处理的统计
539
-                            ycl = bll.GetList(yclwhere + sql + " and State =2 and IsAudit = 1 ").Tables[0].Rows.Count,    //已处理的统计
543
+                            dpd = bll.GetList(uwhere + sql + " and State=" + (int)EnumWorkOrderState.neworder + " and IsAudit = 1 ").Tables[0].Rows.Count,                    //待指派的统计
544
+                            djd = bll.GetList(djdwhere + sql + " and State =" + (int)EnumWorkOrderState.assign + " and IsAudit = 1 ").Tables[0].Rows.Count,    //待接单的统计
545
+                            dcl = bll.GetList(dclwhere + sql + " and State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," + (int)EnumWorkOrderState.reback + ") and IsAudit = 1 ").Tables[0].Rows.Count,    //待处理的统计
546
+                            ycl = bll.GetList(yclwhere + sql + " and State =" + (int)EnumWorkOrderState.finish + " and IsAudit = 1 ").Tables[0].Rows.Count,    //已处理的统计
540 547
                             wyc = bll.GetList(wcywhere + sql + " and IsAudit = 1 ").Tables[0].Rows.Count,    //我参与的的统计
541
-                            cq = bll.GetList(cqwhere + sql + " AND State < 2 and IsAudit = 1 ").Tables[0].Rows.Count,    //超期工单的统计
548
+                            cq = bll.GetList(cqwhere + sql + " AND State < " + (int)EnumWorkOrderState.finish + " and IsAudit = 1 ").Tables[0].Rows.Count,    //超期工单的统计
542 549
                             wx = bll.GetList(wxwhere + sql + " and IsAudit = 0 ").Tables[0].Rows.Count,    //微信工单的统计
550
+                            //dpd = bll.GetList(uwhere + sql+ " and State=0 and IsAudit = 1 ").Tables[0].Rows.Count,                    //待指派的统计
551
+                            //djd = bll.GetList(djdwhere + sql + " and State =1 and IsAudit = 1 ").Tables[0].Rows.Count,    //待接单的统计
552
+                            //dcl = bll.GetList(dclwhere + sql + " and State =1 and IsAudit = 1 ").Tables[0].Rows.Count,    //待处理的统计
553
+                            //ycl = bll.GetList(yclwhere + sql + " and State =2 and IsAudit = 1 ").Tables[0].Rows.Count,    //已处理的统计
554
+                            //wyc = bll.GetList(wcywhere + sql + " and IsAudit = 1 ").Tables[0].Rows.Count,    //我参与的的统计
555
+                            //cq = bll.GetList(cqwhere + sql + " AND State < 2 and IsAudit = 1 ").Tables[0].Rows.Count,    //超期工单的统计
556
+                            //wx = bll.GetList(wxwhere + sql + " and IsAudit = 0 ").Tables[0].Rows.Count,    //微信工单的统计
543 557
                             //djd = new BLL.T_Wo_WorkOrderItem().GetModelList(" IsDel=0 and Type=1 and (state='0' and ','+ToUser+',' like '%," + ua.F_UserCode + ",%')  ").Select(p => p.WorkOrderID).Distinct().Count(),
544 558
                             //dcl = new BLL.T_Wo_WorkOrderItem().GetModelList(" IsDel=0 and Type=1 and (state='1' and SureUser='" + ua.F_UserCode + "')  ").Select(p => p.WorkOrderID).Distinct().Count()
545 559
                         };

+ 17 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

@@ -19,6 +19,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
19 19
     public class WxLoginController : BaseController
20 20
     {
21 21
         private readonly BLL.T_Sys_UserAccount userAccountBLL = new BLL.T_Sys_UserAccount();
22
+        private readonly BLL.T_Sys_RoleInfo roleBLL = new BLL.T_Sys_RoleInfo();
22 23
         private readonly BLL.T_Cus_CustomerBaseNew customerBaseBLL = new BLL.T_Cus_CustomerBaseNew();
23 24
         private readonly BLL.T_Cus_CustomerFinance finbll = new BLL.T_Cus_CustomerFinance();
24 25
         private readonly BLL.T_Wo_WorkOrder woBLL = new BLL.T_Wo_WorkOrder();
@@ -77,15 +78,19 @@ namespace CallCenterApi.Interface.Controllers.weixin
77 78
                     //var user = userAccountBLL.GetModel(login.UserCode);   //20180926 次方法查询有漏洞
78 79
                     var user = userAccountBLL.DataTableToList(dt).ToList().FirstOrDefault();
79 80
                     user.F_WxOpenId = login.OpenId;
80
-                    int UserType = 0;
81
+                    int UserType = 0;string rolecode = "";
81 82
 
82 83
                     //部门
83 84
                     Model.T_Sys_Department modelDep = new BLL.T_Sys_Department().GetModel(user.F_DeptId);
84 85
                     if (modelDep == null)
85 86
                         return Error("获取失败!");
86
-
87
-                    #region 部门角色
88
-                    //部门角色(-1管理员,1接待部,2案场经理、项目负责人,3销售部总经理、物业部总经理、工程总经理、设计总经理,4区域客服,5业主(客户档案))
87
+                    #region 读取角色code
88
+                    var rolemodel = roleBLL.GetModel(user.F_RoleId);
89
+                    if (rolemodel != null)
90
+                        rolecode = rolemodel.F_RoleCode;
91
+                    #endregion
92
+                        #region 部门角色
93
+                        //部门角色(-1管理员,1接待部,2案场经理、项目负责人,3销售部总经理、物业部总经理、工程总经理、设计总经理,4区域客服,5业主(客户档案))
89 94
                     if (user.F_RoleId == 17 || user.F_RoleId == 57)
90 95
                     {
91 96
                         //-1管理员
@@ -127,7 +132,8 @@ namespace CallCenterApi.Interface.Controllers.weixin
127 132
                     {
128 133
                         openid = login.OpenId,
129 134
                         usercode = login.UserCode,
130
-                        usertype = UserType
135
+                        usertype = UserType,
136
+                        rolecode=rolecode,
131 137
                     };
132 138
 
133 139
                     if (userAccountBLL.Update(user))
@@ -339,7 +345,11 @@ namespace CallCenterApi.Interface.Controllers.weixin
339 345
                     if (modelDep == null)
340 346
                         return Error("获取失败!");
341 347
                     wld.UserCode = usertemp.F_UserCode;
342
-
348
+                    #region 读取角色code
349
+                    var rolemodel = roleBLL.GetModel(usertemp.F_RoleId);
350
+                    if (rolemodel != null)
351
+                        wld.RoleCode = rolemodel.F_RoleCode;
352
+                    #endregion
343 353
                     #region 部门角色
344 354
                     if (usertemp.F_RoleId == 17)
345 355
                     {
@@ -410,6 +420,7 @@ namespace CallCenterApi.Interface.Controllers.weixin
410 420
                 openid = wld.OpenId,
411 421
                 usercode = wld.UserCode,
412 422
                 usertype = wld.UserType,
423
+                rolecode = wld.RoleCode,
413 424
             };
414 425
             return Success("成功", newobj);
415 426
         }

+ 45 - 43
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -195,7 +195,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
195 195
                             {
196 196
                                 uwhere += " and CreateUser='" + ua.F_UserCode + "' ";
197 197
                             }
198
-                            sql += " and State =0 " + uwhere;
198
+                            sql += " and State =" + (int)EnumWorkOrderState.neworder + " " + uwhere;
199 199
                             break;
200 200
                         case "1"://待接单的
201 201
                             sql += " and State ="+ (int)EnumWorkOrderState.assign + " and T_Wo_WorkOrder.ID in ( " + GetDJDWorkOrderID(ua.F_UserCode) + ") ";
@@ -403,7 +403,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
403 403
         public string GetDJDWorkOrderID(string user)
404 404
         {
405 405
             string str = string.Empty;
406
-            str = "select F_WoID from T_Wo_WorkOrderItem_New where Type=" + (int)EnumItemType.deal 
406
+            str = "select F_WoID from T_Wo_WorkOrderItem_New where F_ItemType=" + (int)EnumItemType.deal 
407 407
                 + " and F_WoState="+ (int)EnumWorkOrderState.assign
408 408
                 + " and isnull(F_IsUsed,'0')='0' and F_NextUser='" + user + "' ";
409 409
            
@@ -418,7 +418,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
418 418
         {
419 419
             string str = string.Empty;
420 420
 
421
-            str = "select F_WoID from T_Wo_WorkOrderItem_New where Type=" + (int)EnumItemType.deal
421
+            str = "select F_WoID from T_Wo_WorkOrderItem_New where F_ItemType=" + (int)EnumItemType.deal
422 422
                 + " and ("
423 423
                     +"(F_WoState in(" + (int)EnumWorkOrderState.dealing + ","+ (int)EnumWorkOrderState.receive + ") and F_CreateUser='" + user + "') "//办理中和接单状态的操作人
424 424
                     +" or (F_WoState="+ (int)EnumWorkOrderState.reback + " and F_NextUser='" + user + "')"//退回下一步操作人
@@ -1031,54 +1031,55 @@ namespace CallCenterApi.Interface.Controllers.workorder
1031 1031
                     {
1032 1032
                         var res = RemindWO(ua, model, cont);
1033 1033
                         if (res)
1034
-                            Success("催办成功!");
1034
+                            return Success("催办成功!");
1035 1035
                         else
1036
-                            Success("操作失败!");
1036
+                            return Error("操作失败!");
1037 1037
                     }
1038 1038
                     return Error("工单不存在!");
1039 1039
                 }
1040 1040
             }
1041 1041
             return Error("无操作权限!");
1042 1042
         }
1043
-        /// <summary>
1044
-        /// 审核
1045
-        /// </summary>
1046
-        [Authority]
1047
-        public ActionResult AuditWorkOrder(long orderid, string note, int iseffective = 0)
1048
-        {
1049
-            int userId = CurrentUser.UserData.F_UserId;
1050
-            if (userId != 0)
1051
-            {
1052
-                Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
1053
-                if (ua != null)
1054
-                {
1055
-                    Model.T_Wo_WorkOrder model = bll.GetModel(orderid);
1056
-                    if (model != null)
1057
-                    {
1058
-                        if (iseffective == 1 && string.IsNullOrEmpty(note))
1059
-                            return Error("请输入无效原因,如不填写,工单无法创建");
1060 1043
 
1061
-                        model.IsAudit = 1;
1062
-                        model.AuditTime = DateTime.Now;
1063
-                        model.IsEffective = iseffective;    //是否有效工单项(0有效,1无效)
1064
-                        if (iseffective == 1)
1065
-                            model.Province = System.Web.HttpUtility.UrlDecode(note, System.Text.Encoding.UTF8); //备注
1066
-                        if (bll.Update(model))
1067
-                        {
1068
-                            AddLog(model.ID, model.State.Value, "", (int)EnumItemType.deal, (int)EnumItemOpt.audit, "", 0, ua);
1069
-                            return Success("操作成功");
1070
-                        }
1071
-                        return Error("操作失败");
1072
-                    }
1073
-                    else
1074
-                        return Error("工单不存在");
1075
-                }
1076
-            }
1077
-            return Error("无操作权限!");
1078
-        }
1079 1044
         #endregion
1080 1045
         #region 暂时不用
1081 1046
         ///// <summary>
1047
+        ///// 审核
1048
+        ///// </summary>
1049
+        //[Authority]
1050
+        //public ActionResult AuditWorkOrder(long orderid, string note, int iseffective = 0)
1051
+        //{
1052
+        //    int userId = CurrentUser.UserData.F_UserId;
1053
+        //    if (userId != 0)
1054
+        //    {
1055
+        //        Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
1056
+        //        if (ua != null)
1057
+        //        {
1058
+        //            Model.T_Wo_WorkOrder model = bll.GetModel(orderid);
1059
+        //            if (model != null)
1060
+        //            {
1061
+        //                if (iseffective == 1 && string.IsNullOrEmpty(note))
1062
+        //                    return Error("请输入无效原因,如不填写,工单无法创建");
1063
+
1064
+        //                model.IsAudit = 1;
1065
+        //                model.AuditTime = DateTime.Now;
1066
+        //                model.IsEffective = iseffective;    //是否有效工单项(0有效,1无效)
1067
+        //                if (iseffective == 1)
1068
+        //                    model.Province = System.Web.HttpUtility.UrlDecode(note, System.Text.Encoding.UTF8); //备注
1069
+        //                if (bll.Update(model))
1070
+        //                {
1071
+        //                    AddLog(model.ID, model.State.Value, "", (int)EnumItemType.deal, (int)EnumItemOpt.audit, "", 0, ua);
1072
+        //                    return Success("操作成功");
1073
+        //                }
1074
+        //                return Error("操作失败");
1075
+        //            }
1076
+        //            else
1077
+        //                return Error("工单不存在");
1078
+        //        }
1079
+        //    }
1080
+        //    return Error("无操作权限!");
1081
+        //}
1082
+        ///// <summary>
1082 1083
         ///// 导出工单列表
1083 1084
         ///// </summary>
1084 1085
         ///// <returns></returns>
@@ -2354,13 +2355,14 @@ namespace CallCenterApi.Interface.Controllers.workorder
2354 2355
         /// </summary>
2355 2356
         public bool RemindWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, string cont)
2356 2357
         {
2357
-            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + model.ID + "' F_IsUsed=0 order by F_CreateTime desc").FirstOrDefault();
2358
+            var itemlast = itembll.GetModelList(" F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID='" + model.ID + "' and F_IsUsed=0 order by F_CreateTime desc").FirstOrDefault();
2358 2359
             #region 接收人
2359 2360
             int todept = 0; string touser = "";
2360 2361
             if (itemlast != null)
2361 2362
             {
2362
-                todept = itemlast.F_NextDept.Value;
2363 2363
                 touser = itemlast.F_NextUser;
2364
+                if (!string.IsNullOrWhiteSpace(touser))
2365
+                    touser = itemlast.F_CreateUser;
2364 2366
                 #region 读取当前登录人部门
2365 2367
                 string deptname = "";
2366 2368
                 var deptmodel = sysDeptBll.GetModel(nowUser.F_DeptId);
@@ -2370,7 +2372,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
2370 2372
                 }
2371 2373
                 #endregion
2372 2374
                 var content = deptname + nowUser.F_UserName + "(" + nowUser.F_UserCode + ")催办工单,单号:" + model.WorkOrderID + ",催办说明:" + cont;
2373
-                long itemid = AddLog(model.ID, model.State.Value, "", (int)EnumItemType.urge, (int)EnumItemOpt.urge, touser, todept, nowUser);
2375
+                long itemid = AddLog(model.ID, model.State.Value, content, (int)EnumItemType.urge, (int)EnumItemOpt.urge, touser, todept, nowUser);
2374 2376
                 if (itemid > 0)
2375 2377
                 {
2376 2378
                     sendsysmsg(model, nowUser, touser, Int32.Parse(itemid.ToString()), "催办");