Parcourir la Source

地区模糊搜索。大屏

duhongyu il y a 6 ans
Parent
commit
f2e9ef14b0

+ 49 - 21
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/RegionCategoryController.cs

@@ -21,52 +21,80 @@ namespace CallCenterApi.Interface.Controllers.customer
21 21
         /// 获取省市县乡镇
22 22
         /// </summary>
23 23
         /// <returns></returns>
24
-        public ActionResult GetAllList(int F_Layer, string F_RegionName = "",string  keywords="")
24
+        public ActionResult GetAllList(int F_Layer=0, string F_RegionName = "")
25 25
         {
26 26
             int F_RegionId = 0;
27
-            if (F_RegionName!= "")
27
+            if (!string .IsNullOrEmpty (F_RegionName.Trim ()))
28 28
             {
29 29
                 Model.T_RegionCategory userModel = regionBLL.GetModel(F_RegionName);
30 30
                 if (userModel !=null )
31 31
                 {
32 32
                     F_RegionId = userModel.F_RegionId;
33 33
                 }
34
-                else
35
-                {
36
-                    return Success("获取失败,内容为空");
37
-                }
38 34
             }
39
-            var entityJson = new BLL.T_RegionCategory().GetModelList("F_Layer = " + F_Layer + "AND F_ParentId=" + F_RegionId + "order by F_Sort" );
40
-         
41
-            if (entityJson.Count > 0)
42
-            {
35
+            var entityJson = new BLL.T_RegionCategory().GetModelList("F_Layer = " + F_Layer + "AND F_ParentId=" + F_RegionId + "order by F_Sort");
43 36
                 return Success("加载成功", entityJson);
44
-            }
45
-            else
46
-            {
47
-                return Success("获取失败,内容为空");
48
-            }
37
+
38
+
49 39
         }
50 40
         /// <summary>
51 41
         /// 获取省市县乡镇
52 42
         /// </summary>
53 43
         /// <returns></returns>
54
-        public ActionResult GetKeywordsList(int F_Layer, string keywords = "")
44
+        public ActionResult GetKeywordsList(int F_Layer = 0, string F_RegionName = "", string keywords = "")
55 45
         {
56 46
             int F_RegionId = 0;
57
-            if (keywords != "")
47
+            int F_ParentId = 0;
48
+            if (!string.IsNullOrEmpty(F_RegionName.Trim()))
49
+            {
50
+                Model.T_RegionCategory userModel = regionBLL.GetModel(F_RegionName);
51
+                if (userModel != null)
52
+                {
53
+                    F_RegionId = userModel.F_RegionId;
54
+                    F_ParentId = int.Parse(userModel.F_ParentId.ToString());
55
+                }
56
+            }
57
+            if (!string.IsNullOrEmpty(keywords.Trim()))
58 58
             {
59
-             List <   Model.T_RegionCategory> userModel = regionBLL.GetModelList("and F_CusPhone like '%" + keywords.Trim());
59
+                List<Model.T_RegionCategory> userModel = regionBLL.GetModelList(" F_RegionName like '%" + keywords.Trim() + "%'");
60 60
                 if (userModel != null)
61 61
                 {
62 62
                     return Success("加载成功", userModel);
63 63
                 }
64
-                else
64
+
65
+            }
66
+            Model.T_RegionCategory entityJson1 = new Model.T_RegionCategory();
67
+            Model.T_RegionCategory entityJson2 = new Model.T_RegionCategory();
68
+            Model.T_RegionCategory entityJson3 = new Model.T_RegionCategory();
69
+            var entityJson = new BLL.T_RegionCategory().GetModelList("F_Layer = " + F_Layer + "AND F_ParentId=" + F_RegionId + "order by F_Sort");
70
+            F_Layer = F_Layer - 1;
71
+            if (!string.IsNullOrEmpty(F_RegionName.Trim()))
72
+            {
73
+                if (F_Layer == 2)
74
+                {
75
+                    entityJson1 = regionBLL.GetModel(F_ParentId);
76
+                }
77
+                else if (F_Layer == 3)
65 78
                 {
66
-                    return Success("获取失败,内容为空");
79
+                    entityJson2 = regionBLL.GetModel(F_ParentId);
80
+                    entityJson1 = regionBLL.GetModel(int.Parse(entityJson2.F_ParentId.ToString()));
81
+                }
82
+                else if (F_Layer == 4)
83
+                {
84
+                    entityJson3 = regionBLL.GetModel(F_ParentId);
85
+                    entityJson2 = regionBLL.GetModel(int.Parse(entityJson3.F_ParentId.ToString()));
86
+                    entityJson1 = regionBLL.GetModel(int.Parse(entityJson2.F_ParentId.ToString()));
67 87
                 }
68 88
             }
69
-            return Success("获取失败,内容为空");
89
+            var obj = new
90
+            {
91
+                entityJson1,
92
+                entityJson2,
93
+                entityJson3,
94
+                entityJson
95
+            };
96
+
97
+            return Success("加载成功", obj);
70 98
         }
71 99
         /// <summary>
72 100
         /// 导入excel

+ 385 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

@@ -21,6 +21,7 @@ namespace CallCenterApi.Interface.Controllers.report
21 21
         BLL.T_Wo_MaterialManage mmBLL = new BLL.T_Wo_MaterialManage();
22 22
         BLL.T_Wo_QuestionManage quesBLL = new BLL.T_Wo_QuestionManage();
23 23
         private readonly BLL.T_Wo_WorkOrder woBLL = new BLL.T_Wo_WorkOrder();
24
+        BLL.T_Wo_WorkOrder workOrder = new BLL.T_Wo_WorkOrder();
24 25
         public ActionResult GetDataList(string stime, string endtime, int deptid = 0)
25 26
         {
26 27
             DataTable dtNew = new DataTable();//getData(stime, endtime, deptid);
@@ -930,7 +931,387 @@ namespace CallCenterApi.Interface.Controllers.report
930 931
             public int Unsatisfactory;//不满意
931 932
             public int Total;
932 933
         }
933
-       
934
+        public class BigDate
935
+        {
936
+            public List<Template> type;//反馈类型
937
+            public List<Template> product;//产品
938
+            public List<Template> channel;//渠道
939
+            public List<Template> state;//工单状态
940
+            public List<Template> satisfaction;//满意度
941
+            public List<Template> overdue;//超期
942
+        }
943
+        /// <summary>
944
+        /// 反馈类型
945
+        /// </summary>
946
+        public class Template
947
+        {
948
+            public string name;//名称
949
+            public int number;// 数量
950
+            public Contrast contrast;//同比
951
+
952
+        }
953
+        public class Contrast
954
+        {
955
+            public int Lastyear;//去年同比
956
+            public int Lastmonth;//上月同比
957
+        }
958
+        public string GetCustomerCode(int area=0,int branch=0,string channel="")
959
+        {
960
+            string str = "";
961
+            string sql = "";
962
+            if (area >0)
963
+            {
964
+                sql += " and F_AreaID =" + area;
965
+            }
966
+            if (branch>0)
967
+            {
968
+                sql += " and F_BranchID =" + branch;
969
+            }
970
+            if (channel!="")
971
+            {
972
+                sql += " and F_Channel= '" + channel + "'";
973
+            }
974
+            str = "select F_CustomerCode from T_Cus_CustomerBaseNew where F_IsDelete=0" + sql;
975
+            return str;
976
+        }
977
+        /// <summary>
978
+        /// 大数据一览表
979
+        /// </summary>
980
+        /// <returns></returns>
981
+        public ActionResult GetFeedbacklList(string stime, string endtime,string salesBase ,string product,string channel, int  area=0,int branch=0, int type = 0)
982
+        {
983
+            #region 
984
+            string sql = $" and F_IsDelete=0";
985
+            DataTable dt = new DataTable();
986
+            #region 筛选条件
987
+            if (string.IsNullOrEmpty(stime))
988
+            {
989
+                stime = DateTime.Now.Date.ToString("yyyy-MM-01");
990
+            }
991
+            if (string.IsNullOrEmpty(endtime))
992
+            {
993
+                endtime = DateTime.Now.Date.ToString("yyyy-MM-dd");
994
+            }
995
+           
996
+            if (!string .IsNullOrEmpty (salesBase.Trim() ))
997
+            {
998
+                sql += $" and F_SalesBase='"+ salesBase.Trim()+"'";
999
+            }
1000
+        
1001
+            string smouth= Convert.ToDateTime(DateTime.Parse(stime).AddDays(1 - DateTime.Parse(stime).Day).AddMonths(-1).ToLongDateString()).ToString("yyyy-MM-dd");
1002
+            string endmouth = Convert.ToDateTime(DateTime.Parse(endtime).AddDays(1 - DateTime.Parse(endtime).Day).AddDays(-1).ToLongDateString()).ToString("yyyy-MM-dd");
1003
+            string syear = Convert.ToDateTime(DateTime.Parse(stime).AddDays(1 - DateTime.Parse(stime).Day).Date.AddYears (-1).ToLongDateString()).ToString("yyyy-MM-dd");
1004
+            string endyear= Convert.ToDateTime(DateTime.Parse(endtime).AddDays(1 - DateTime.Parse(endtime).Day).Date.AddMonths(1).AddSeconds(-1).AddYears(-1).ToLongDateString()).ToString("yyyy-MM-dd");
1005
+            string msg = "";
1006
+           
1007
+            #endregion
1008
+            string time = sql += $" and datediff(day,F_CreateOn,'{stime}')<=0 and datediff(day,F_CreateOn,'{endtime}')>=0 ";
1009
+            string lastmouth = sql += $" and datediff(day,F_CreateOn,'{smouth}')<=0 and datediff(day,F_CreateOn,'{endmouth}')>=0 ";
1010
+            string lastyear = sql += $" and datediff(day,F_CreateOn,'{syear}')<=0 and datediff(day,F_CreateOn,'{endyear}')>=0 ";
1011
+            BigDate model = new BigDate();
1012
+            model.type = new List<Template>();
1013
+            #region 反馈类型
1014
+            for (int i=0;i <=5;i++)
1015
+            {
1016
+                if (area >0|| branch>0||!string .IsNullOrEmpty (channel.Trim ()))
1017
+                {
1018
+                    sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, channel) + ") "; ;
1019
+                }
1020
+                if (!string.IsNullOrEmpty(product.Trim()))
1021
+                {
1022
+                    sql += $" and F_TS_Category='" + product.Trim() + "'";
1023
+                }
1024
+                Template template = new Template() ;
1025
+                switch (i)
1026
+                {
1027
+                    case 1:
1028
+                        template.name = "咨询";
1029
+                        break;
1030
+                    case 2:
1031
+                        template.name = "投诉";
1032
+                        break;
1033
+                    case 3:
1034
+                        template.name = "抽检";
1035
+                        break;
1036
+                    case 4:
1037
+                        template.name = "建议";
1038
+                        break;
1039
+                    case 5:
1040
+                        template.name = "合计";
1041
+                        break;
1042
+                }
1043
+                if (i<5 )
1044
+                {
1045
+                    sql += $"and F_Type = " + i;
1046
+                }
1047
+                model.type.Add(ReturenTemplate(sql,time , lastmouth, lastyear));
1048
+            }
1049
+            #endregion
1050
+            #region 产品
1051
+            var dicv = dicvalueBll.GetList(" F_DictionaryFlag='" + "ZXCPMC" + "' and F_State=1 ").Tables[0];
1052
+            model.product = new List<Template>();
1053
+            List<Model.T_Sys_DictionaryValue> dicval = new List<Model.T_Sys_DictionaryValue>();
1054
+            if (dicv != null)
1055
+            {
1056
+                dicval = dicvalueBll.DataTableToList(dicv);
1057
+            }
1058
+            if (dicval != null && dicval.Count > 0)
1059
+            {
1060
+                if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel.Trim()))
1061
+                {
1062
+                    sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, channel) + ") "; ;
1063
+                }
1064
+                if (type > 0)
1065
+                {
1066
+                    sql += $"and F_Type = " + type;
1067
+                }
1068
+                Template template = new Template();
1069
+                foreach (var it in dicval)
1070
+                {
1071
+                    sql += $"and F_TS_Category = '" + it.F_Name+"'";
1072
+                    model.product.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
1073
+                }
1074
+            }
1075
+            #endregion
1076
+            #region 渠道类型
1077
+            var QDLX = dicvalueBll.GetList(" F_DictionaryFlag='" + "QDLX" + "' and F_State=1 ").Tables[0];
1078
+            model.channel = new List<Template>();
1079
+            List<Model.T_Sys_DictionaryValue> QDLXl = new List<Model.T_Sys_DictionaryValue>();
1080
+            if (QDLX != null)
1081
+            {
1082
+                QDLXl = dicvalueBll.DataTableToList(QDLX);
1083
+            }
1084
+            if (QDLXl != null && QDLXl.Count > 0)
1085
+            {
1086
+                if (!string.IsNullOrEmpty(product.Trim()))
1087
+                {
1088
+                    sql += $" and F_TS_Category='" + product.Trim() + "'";
1089
+                }
1090
+                if (type > 0)
1091
+                {
1092
+                    sql += $"and F_Type = " + type;
1093
+                }
1094
+                Template template = new Template();
1095
+                foreach (var it in QDLXl)
1096
+                {
1097
+                    if (area > 0 || branch > 0 )
1098
+                    {
1099
+                        sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, it.F_Name) + ") "; ;
1100
+                    }
1101
+                    model.channel.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
1102
+                }
1103
+            }
1104
+            #endregion
1105
+            #region 工单类型
1106
+            for (int i = 0; i < 5; i++)
1107
+            {
1108
+                if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel.Trim()))
1109
+                {
1110
+                    sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, channel) + ") "; ;
1111
+                }
1112
+                if (!string.IsNullOrEmpty(product.Trim()))
1113
+                {
1114
+                    sql += $" and F_TS_Category='" + product.Trim() + "'";
1115
+                }
1116
+                if (type > 0)
1117
+                {
1118
+                    sql += $"and F_Type = " + type;
1119
+                }
1120
+                Template template = new Template();
1121
+                switch (i)
1122
+                {
1123
+                    case 1:
1124
+                        template.name = "待处理";
1125
+                        sql += " and F_State in (0, 1, 2, 3, 4, 5, 6, 7, 12, 14, 16)";
1126
+                        break;
1127
+                    case 2:
1128
+                        template.name = "已处理";
1129
+                        sql += " and F_State in (10,11)";
1130
+                        break;
1131
+                    case 3:
1132
+                        template.name = "待回访";
1133
+                        sql += " and F_State in (10)";
1134
+                        break;
1135
+                    case 4:
1136
+                        template.name = "已回访";
1137
+                        sql += " and F_State in (11)";
1138
+                        break;
1139
+                }
1140
+                model.state.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
1141
+            }
1142
+            #endregion
1143
+            #region 满意度
1144
+            for (int i = 0; i < 5; i++)
1145
+            {
1146
+                sql += " and F_State in (11)";
1147
+                if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel.Trim()))
1148
+                {
1149
+                    sql += $"  and T_Wo_WorkOrder.F_CustomerID in ( " + GetCustomerCode(area, branch, channel) + ") "; ;
1150
+                }
1151
+                if (!string.IsNullOrEmpty(product.Trim()))
1152
+                {
1153
+                    sql += $" and F_TS_Category='" + product.Trim() + "'";
1154
+                }
1155
+                if (type > 0)
1156
+                {
1157
+                    sql += $"and F_Type = " + type;
1158
+                }
1159
+                Template template = new Template();
1160
+                switch (i)
1161
+                {
1162
+                    case 1:
1163
+                        template.name = "非常满意";
1164
+                        sql += " and F_VisitResult ='非常满意'";
1165
+                        break;
1166
+                    case 2:
1167
+                        template.name = "满意";
1168
+                        sql += " and F_VisitResult ='满意'";
1169
+                        break;
1170
+                    case 3:
1171
+                        template.name = "一般";
1172
+                        sql += " and F_VisitResult ='一般'";
1173
+                        break;
1174
+                    case 4:
1175
+                        template.name = "不满意";
1176
+                        sql += " and F_VisitResult ='不满意'";
1177
+                        break;
1178
+                    case 5:
1179
+                        template.name = "合计";
1180
+                        break;
1181
+                }
1182
+                model.state.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
1183
+                #endregion
1184
+            }
1185
+                #endregion
1186
+                var obj = new
1187
+            {
1188
+                state = "success",
1189
+                message = "成功",
1190
+                rows = model,
1191
+                total = 6
1192
+            };
1193
+
1194
+            return Content(obj.ToJson()); ;
1195
+        }
1196
+        private bool Refresh()
1197
+        {
1198
+            int type = 0;
1199
+            var modlelist = workOrder.GetModelList(" F_IsDelete=0" + "and F_IsOver=0" + " and F_State in(" + (int)EnumWorkOrderState.dealing + "," + (int)EnumWorkOrderState.receive + "," +
1200
+                (int)EnumWorkOrderState.assign + "," + (int)EnumWorkOrderState.reback + "," + (int)EnumWorkOrderState.abreback + ")");
1201
+            if (modlelist.Count > 0)
1202
+            {
1203
+                foreach (var it in modlelist)
1204
+                {
1205
+
1206
+                    if (TimeforOver(it.F_ID))
1207
+                    {
1208
+                        type = 0;
1209
+                    }
1210
+                    else
1211
+                    {
1212
+                        type = 1;
1213
+                    }
1214
+                    if (type != it.F_IsOver)
1215
+                    {
1216
+                        it.F_IsOver = type;
1217
+                        bool n = workOrder.Update(it);
1218
+                        if (!n)
1219
+                        {
1220
+                            return false;
1221
+                        }
1222
+                    }
1223
+                }
1224
+
1225
+            }
1226
+            return true;
1227
+        }
1228
+        /// <summary>
1229
+        /// 是否超时
1230
+        /// </summary>
1231
+        /// <param name="id"></param>
1232
+        /// <returns></returns>
1233
+        private bool TimeforOver(int id)
1234
+        {
1235
+            var itemlasts = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.deal + " and  F_WoID=" + id + " ");
1236
+            string time1 = "", time2 = ""; int x = 0, y = 0;
1237
+            float time = 0;
1238
+            if (itemlasts.Count > 0)
1239
+            {
1240
+                for (int i = 0; i < itemlasts.Count; i++)
1241
+                {
1242
+                    if (itemlasts[i].F_WoState >= 1)
1243
+                    {
1244
+                        if (itemlasts[i].F_WoState == 1)
1245
+                        {
1246
+                            x = i;
1247
+                            time1 = itemlasts[i].F_CreateTime.ToString();
1248
+                            time = float.Parse(itemlasts[i].F_LimitTime);
1249
+                        }
1250
+                        if (itemlasts[i].F_WoState == 10)
1251
+                        {
1252
+                            y = i;
1253
+                            time2 = itemlasts[i].F_CreateTime.ToString();
1254
+                        }
1255
+                    }
1256
+                }
1257
+                if (time2 != "")
1258
+                {
1259
+                    if (time1 != "")
1260
+                    {
1261
+                        if (x > y)
1262
+                        {
1263
+                            int a = (DateTime.Parse(time2) - DateTime.Parse(time1)).Hours;
1264
+                            if (a > time)
1265
+                            {
1266
+                                return false;
1267
+                            }
1268
+                        }
1269
+                        else
1270
+                        {
1271
+                            int a = (DateTime.Now - DateTime.Parse(time1)).Hours;
1272
+                            if (a > time)
1273
+                            {
1274
+                                return false;
1275
+                            }
1276
+                        }
1277
+                    }
1278
+                    else
1279
+                    {
1280
+                        return true;
1281
+                    }
1282
+                }
1283
+                else if (time1 != "")
1284
+                {
1285
+                    int a = (DateTime.Now - DateTime.Parse(time1)).Hours;
1286
+                    if (a > time)
1287
+                    {
1288
+                        return false;
1289
+                    }
1290
+                }
1291
+                else
1292
+                {
1293
+                    return true;
1294
+                }
1295
+            }
1296
+            else
1297
+            {
1298
+                return true;
1299
+            }
1300
+            return true;
1301
+        }
1302
+        public Template ReturenTemplate(string sql,string time,string lastmouth,string lastyear )
1303
+        {
1304
+            Template template = new Template();
1305
+            template.number = new BLL.T_Wo_WorkOrder().GetModelList(sql + time).Count;//
1306
+            int mounthnumber = 0, yearnumber = 0;
1307
+            mounthnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastmouth).Count;//
1308
+            yearnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastyear).Count;//
1309
+            template.contrast.Lastmonth = template.number - mounthnumber;
1310
+            template.contrast.Lastyear = template.number - yearnumber;
1311
+            return template;
1312
+        }
1313
+
1314
+
934 1315
         /// <summary>
935 1316
         /// 市场反馈一览表
936 1317
         /// </summary>
@@ -1051,6 +1432,8 @@ namespace CallCenterApi.Interface.Controllers.report
1051 1432
 
1052 1433
                 return Content(obj.ToJson()); ;
1053 1434
         }
1435
+       
1436
+
1054 1437
 
1055 1438
         /// <summary>
1056 1439
         /// 渠道数量对比表
@@ -1141,6 +1524,7 @@ namespace CallCenterApi.Interface.Controllers.report
1141 1524
             public string name;
1142 1525
             public int number;
1143 1526
         }
1527
+    
1144 1528
         /// <summary>
1145 1529
         /// 产品品牌对照表
1146 1530
         /// </summary>

+ 0 - 1
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

@@ -2926,7 +2926,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
2926 2926
                
2927 2927
             }
2928 2928
             return true;
2929
-            
2930 2929
         }
2931 2930
         /// <summary>
2932 2931
         /// 获取催办工单列表