Browse Source

心连心大数据,微信别的设备登录

duhongyu 6 years ago
parent
commit
ce530e7e3f

+ 256 - 101
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/report/WOReportController.cs

22
         BLL.T_Wo_QuestionManage quesBLL = new BLL.T_Wo_QuestionManage();
22
         BLL.T_Wo_QuestionManage quesBLL = new BLL.T_Wo_QuestionManage();
23
         private readonly BLL.T_Wo_WorkOrder woBLL = new BLL.T_Wo_WorkOrder();
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
         BLL.T_Wo_WorkOrder workOrder = new BLL.T_Wo_WorkOrder();
25
+        public ActionResult GetDicValueListByFlag(string flag)
26
+        {
27
+                DataTable dt = new DataTable();
28
+
29
+                dt = new BLL.T_Sys_DictionaryValue().GetList(" F_DictionaryFlag='" + flag + "' and F_State=1 ").Tables[0];
30
+
31
+              return Success("列表加载成功", dt);
32
+        }
25
         public ActionResult GetDataList(string stime, string endtime, int deptid = 0)
33
         public ActionResult GetDataList(string stime, string endtime, int deptid = 0)
26
         {
34
         {
27
             DataTable dtNew = new DataTable();//getData(stime, endtime, deptid);
35
             DataTable dtNew = new DataTable();//getData(stime, endtime, deptid);
947
         {
955
         {
948
             public string name;//名称
956
             public string name;//名称
949
             public int number;// 数量
957
             public int number;// 数量
950
-            public Contrast contrast;//同比
951
-
952
-        }
953
-        public class Contrast
954
-        {
958
+            public int Lastyearnumber;//去年同比
959
+            public int Lastmonthnumber;//上月同比
955
             public int Lastyear;//去年同比
960
             public int Lastyear;//去年同比
956
             public int Lastmonth;//上月同比
961
             public int Lastmonth;//上月同比
962
+
957
         }
963
         }
964
+      
958
         public string GetCustomerCode(int area=0,int branch=0,string channel="")
965
         public string GetCustomerCode(int area=0,int branch=0,string channel="")
959
         {
966
         {
960
             string str = "";
967
             string str = "";
971
             {
978
             {
972
                 sql += " and F_Channel= '" + channel + "'";
979
                 sql += " and F_Channel= '" + channel + "'";
973
             }
980
             }
974
-            str = "select F_CustomerCode from T_Cus_CustomerBaseNew where F_IsDelete=0" + sql;
981
+            if (sql != "")
982
+            {
983
+                str = "select F_CustomerCode from T_Cus_CustomerBaseNew where F_IsDelete=0" + sql;
984
+            }
985
+            return str;
986
+        }
987
+        public string GetCustomerrel(int area = 0, int branch = 0, string channel = "")
988
+        {
989
+            string str = "";
990
+            string sql = "";
991
+            if (area > 0)
992
+            {
993
+                sql += " and F_AreaID =" + area;
994
+            }
995
+            if (branch > 0)
996
+            {
997
+                sql += " and F_BranchID =" + branch;
998
+            }
999
+            if (channel != "")
1000
+            {
1001
+                sql += " and F_Channel= '" + channel + "'";
1002
+            }
1003
+            str = "select F_LegalPhone from T_Cus_CustomerBaseNew where F_IsDelete=0"  +sql;
975
             return str;
1004
             return str;
976
         }
1005
         }
977
         /// <summary>
1006
         /// <summary>
978
         /// 大数据一览表
1007
         /// 大数据一览表
979
         /// </summary>
1008
         /// </summary>
980
         /// <returns></returns>
1009
         /// <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)
1010
+        public ActionResult GetBigdataList(string stime, string endtime,string salesBase ,string product,string channel, int  area=0,int branch=0, int type = 0)
982
         {
1011
         {
983
             #region 
1012
             #region 
984
-            string sql = $" and F_IsDelete=0";
1013
+            if (!Refresh())
1014
+            {
1015
+                return Error("查询失败");
1016
+            }
1017
+            string sql = $"  F_IsDelete=0";
985
             DataTable dt = new DataTable();
1018
             DataTable dt = new DataTable();
986
             #region 筛选条件
1019
             #region 筛选条件
987
             if (string.IsNullOrEmpty(stime))
1020
             if (string.IsNullOrEmpty(stime))
992
             {
1025
             {
993
                 endtime = DateTime.Now.Date.ToString("yyyy-MM-dd");
1026
                 endtime = DateTime.Now.Date.ToString("yyyy-MM-dd");
994
             }
1027
             }
995
-           
996
-            if (!string .IsNullOrEmpty (salesBase.Trim() ))
1028
+            int  Months = 1;
1029
+           if (!string.IsNullOrEmpty(stime)&& !string.IsNullOrEmpty(endtime))
1030
+            {
1031
+                Months = DateTime.Parse(endtime).Month - DateTime.Parse(stime).Month;
1032
+                if (DateTime.Parse(endtime).Day > DateTime.Parse(stime).Day )
1033
+                {
1034
+                    Months = Months + 1;
1035
+                }
1036
+            }
1037
+            if (!string .IsNullOrEmpty (salesBase ))
997
             {
1038
             {
998
                 sql += $" and F_SalesBase='"+ salesBase.Trim()+"'";
1039
                 sql += $" and F_SalesBase='"+ salesBase.Trim()+"'";
999
             }
1040
             }
1000
         
1041
         
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");
1042
+            string smouth= Convert.ToDateTime(DateTime.Parse(stime).AddDays(1 - DateTime.Parse(stime).Day).AddMonths(-Months).ToLongDateString()).ToString("yyyy-MM-dd");
1043
+            string endmouth = Convert.ToDateTime(DateTime.Parse(endtime).AddDays(1 - DateTime.Parse(endtime).Day).AddMonths(-Months).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");
1044
             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");
1045
             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 = "";
1046
+           
1006
            
1047
            
1007
             #endregion
1048
             #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 ";
1049
+            string time = $" and datediff(day,F_CreateOn,'{stime}')<=0 and datediff(day,F_CreateOn,'{endtime}')>=0 ";
1050
+            string lastmouth = $" and datediff(day,F_CreateOn,'{smouth}')<=0 and datediff(day,F_CreateOn,'{endmouth}')>=0 ";
1051
+            string lastyear= $" and datediff(day,F_CreateOn,'{syear}')<=0 and datediff(day,F_CreateOn,'{endyear}')>=0 ";
1011
             BigDate model = new BigDate();
1052
             BigDate model = new BigDate();
1012
             model.type = new List<Template>();
1053
             model.type = new List<Template>();
1054
+            string strType = "";
1055
+            if (type > 0)
1056
+            {
1057
+                strType = $"and F_Type = " + type;
1058
+            }
1059
+            string strChannel = "";
1060
+            if (area > 0 || branch > 0 || !string.IsNullOrEmpty(channel))
1061
+            {
1062
+                strChannel= " and  T_Wo_WorkOrder.F_CusPhone in ( " + GetCustomerrel(area, branch, channel) + ") ";
1063
+            }
1064
+            string strCategory = "";
1065
+            if (!string.IsNullOrEmpty(product))
1066
+            {
1067
+                strCategory = $" and F_TS_Category='" + product.Trim() + "'";
1068
+            }
1013
             #region 反馈类型
1069
             #region 反馈类型
1014
-            for (int i=0;i <=5;i++)
1070
+            for (int i=0;i <5;i++)
1015
             {
1071
             {
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
-                }
1072
+                string sqltype = "";
1024
                 Template template = new Template() ;
1073
                 Template template = new Template() ;
1025
                 switch (i)
1074
                 switch (i)
1026
                 {
1075
                 {
1076
+                    case 0:
1077
+                        template.name = "合计";
1078
+                        break;
1027
                     case 1:
1079
                     case 1:
1028
                         template.name = "咨询";
1080
                         template.name = "咨询";
1029
                         break;
1081
                         break;
1036
                     case 4:
1088
                     case 4:
1037
                         template.name = "建议";
1089
                         template.name = "建议";
1038
                         break;
1090
                         break;
1039
-                    case 5:
1040
-                        template.name = "合计";
1041
-                        break;
1091
+                   
1042
                 }
1092
                 }
1043
-                if (i<5 )
1093
+                if (i>0 )
1044
                 {
1094
                 {
1045
-                    sql += $"and F_Type = " + i;
1095
+                    sqltype = $"and F_Type = " + i;
1046
                 }
1096
                 }
1047
-                model.type.Add(ReturenTemplate(sql,time , lastmouth, lastyear));
1097
+                model.type.Add(ReturenTemplate(template,sql + sqltype+ strChannel+ strCategory, time , lastmouth, lastyear));
1048
             }
1098
             }
1049
             #endregion
1099
             #endregion
1050
             #region 产品
1100
             #region 产品
1055
             {
1105
             {
1056
                 dicval = dicvalueBll.DataTableToList(dicv);
1106
                 dicval = dicvalueBll.DataTableToList(dicv);
1057
             }
1107
             }
1058
-            if (dicval != null && dicval.Count > 0)
1108
+            if (dicval != null && dicval.Count > 0) 
1059
             {
1109
             {
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();
1110
                 Template template = new Template();
1111
+                template.name = "合计";
1112
+                model.product.Add(ReturenTemplate(template, sql + strChannel + strType, time, lastmouth, lastyear));
1069
                 foreach (var it in dicval)
1113
                 foreach (var it in dicval)
1070
                 {
1114
                 {
1071
-                    sql += $"and F_TS_Category = '" + it.F_Name+"'";
1072
-                    model.product.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
1115
+                    Template templates = new Template();
1116
+                    string mag = "";
1117
+                    mag = $"and F_TS_Category = '" + it.F_Name+"'";
1118
+                    templates.name = it.F_Name;
1119
+                    model.product.Add(ReturenTemplate(templates, sql + strChannel + strType + mag, time, lastmouth, lastyear));
1073
                 }
1120
                 }
1074
             }
1121
             }
1075
             #endregion
1122
             #endregion
1083
             }
1130
             }
1084
             if (QDLXl != null && QDLXl.Count > 0)
1131
             if (QDLXl != null && QDLXl.Count > 0)
1085
             {
1132
             {
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();
1133
+                Template templates = new Template();
1134
+                templates.name = "合计";
1135
+                model.channel.Add(ReturenTemplate(templates, sql + strCategory + strType , time, lastmouth, lastyear));
1095
                 foreach (var it in QDLXl)
1136
                 foreach (var it in QDLXl)
1096
                 {
1137
                 {
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));
1138
+                    Template template = new Template();
1139
+                    string str = "";
1140
+                    str = " and  T_Wo_WorkOrder.F_CusPhone in ( " + GetCustomerrel(area, branch, it.F_Name) + ") ";
1141
+                    template.name = it.F_Name;
1142
+                    model.channel.Add(ReturenTemplate(template,sql+strCategory  + strType + str, time, lastmouth, lastyear));
1102
                 }
1143
                 }
1103
             }
1144
             }
1104
             #endregion
1145
             #endregion
1105
             #region 工单类型
1146
             #region 工单类型
1147
+            model.state = new List<Template>();
1106
             for (int i = 0; i < 5; i++)
1148
             for (int i = 0; i < 5; i++)
1107
             {
1149
             {
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
-                }
1150
+                string sqlchannel = "";
1151
+           
1120
                 Template template = new Template();
1152
                 Template template = new Template();
1121
                 switch (i)
1153
                 switch (i)
1122
                 {
1154
                 {
1155
+                    case 0:
1156
+                        template.name = "合计";
1157
+                        break;
1123
                     case 1:
1158
                     case 1:
1124
                         template.name = "待处理";
1159
                         template.name = "待处理";
1125
-                        sql += " and F_State in (0, 1, 2, 3, 4, 5, 6, 7, 12, 14, 16)";
1160
+                        sqlchannel = " and F_State in (0, 1, 2, 3, 4, 5, 6, 7, 12, 14, 16)";
1126
                         break;
1161
                         break;
1127
                     case 2:
1162
                     case 2:
1128
                         template.name = "已处理";
1163
                         template.name = "已处理";
1129
-                        sql += " and F_State in (10,11)";
1164
+                        sqlchannel = " and F_State in (10,11)";
1130
                         break;
1165
                         break;
1131
                     case 3:
1166
                     case 3:
1132
                         template.name = "待回访";
1167
                         template.name = "待回访";
1133
-                        sql += " and F_State in (10)";
1168
+                        sqlchannel = " and F_State in (10)";
1134
                         break;
1169
                         break;
1135
                     case 4:
1170
                     case 4:
1136
                         template.name = "已回访";
1171
                         template.name = "已回访";
1137
-                        sql += " and F_State in (11)";
1172
+                        sqlchannel = " and F_State in (11)";
1138
                         break;
1173
                         break;
1174
+                   
1139
                 }
1175
                 }
1140
-                model.state.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
1176
+                model.state.Add(ReturenTemplate(template,sql  + sqlchannel+strChannel + strCategory + strType, time, lastmouth, lastyear));
1141
             }
1177
             }
1142
             #endregion
1178
             #endregion
1143
             #region 满意度
1179
             #region 满意度
1144
-            for (int i = 0; i < 5; i++)
1180
+            model.satisfaction = new List<Template>();
1181
+            for (int i = 0; i <5; i++)
1145
             {
1182
             {
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
-                }
1183
+                string sqlsatisfaction = "";
1184
+                sqlsatisfaction += " and F_State in (11)";
1185
+                sqlsatisfaction += " and F_IsVisit =1";
1159
                 Template template = new Template();
1186
                 Template template = new Template();
1160
                 switch (i)
1187
                 switch (i)
1161
                 {
1188
                 {
1189
+                    case 0:
1190
+                        template.name += "合计";
1191
+                        break;
1162
                     case 1:
1192
                     case 1:
1163
                         template.name = "非常满意";
1193
                         template.name = "非常满意";
1164
-                        sql += " and F_VisitResult ='非常满意'";
1194
+                        sqlsatisfaction += " and F_VisitResult ='非常满意'";
1165
                         break;
1195
                         break;
1166
                     case 2:
1196
                     case 2:
1167
                         template.name = "满意";
1197
                         template.name = "满意";
1168
-                        sql += " and F_VisitResult ='满意'";
1198
+                        sqlsatisfaction += " and F_VisitResult ='满意'";
1169
                         break;
1199
                         break;
1170
                     case 3:
1200
                     case 3:
1171
                         template.name = "一般";
1201
                         template.name = "一般";
1172
-                        sql += " and F_VisitResult ='一般'";
1202
+                        sqlsatisfaction += " and F_VisitResult ='一般'";
1173
                         break;
1203
                         break;
1174
                     case 4:
1204
                     case 4:
1175
                         template.name = "不满意";
1205
                         template.name = "不满意";
1176
-                        sql += " and F_VisitResult ='不满意'";
1177
-                        break;
1178
-                    case 5:
1179
-                        template.name = "合计";
1206
+                        sqlsatisfaction += " and F_VisitResult ='不满意'";
1180
                         break;
1207
                         break;
1208
+                  
1181
                 }
1209
                 }
1182
-                model.state.Add(ReturenTemplate(sql, time, lastmouth, lastyear));
1210
+                model.satisfaction .Add(ReturenTemplate(template,sql + sqlsatisfaction + strChannel + strCategory + strType, time, lastmouth, lastyear));
1183
                 #endregion
1211
                 #endregion
1212
+              
1213
+                 
1184
             }
1214
             }
1185
-                #endregion
1186
-                var obj = new
1215
+            #endregion
1216
+            #region 超期工单
1217
+            model.overdue = new List<Template>();
1218
+            string sqloverdue = "";
1219
+            sqloverdue += strChannel + strCategory + strType;
1220
+            var modlelist = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + time);
1221
+            Template templatee = new Template();
1222
+            templatee.name = "合计";
1223
+            templatee.number =0;
1224
+            model.overdue.Add(templatee);
1225
+            if (modlelist.Count > 0)
1226
+            {
1227
+                foreach (var it in modlelist)
1228
+                {
1229
+                    var itemList = itembll.GetModelList("  F_WoID=" + it.F_ID + "and F_WoState=1" + " order by F_ID desc");
1230
+                    if (itemList.Count > 0)
1231
+                    {
1232
+                        if (itemList[0].F_NextDept > 0)
1233
+                        {
1234
+                            var deptmodel = departmentBLL.GetModel(int.Parse(itemList[0].F_NextDept.ToString()));
1235
+                            if (model.overdue.Count > 0)
1236
+                            {
1237
+                                 
1238
+                                  int overdue = 0;
1239
+                                    foreach (var im in model.overdue)
1240
+                                    {
1241
+                                        if (im.name == deptmodel.F_DeptName)
1242
+                                        {
1243
+                                            im.number += 1;
1244
+                                            overdue = 1;
1245
+                                        }
1246
+                                      if (im .name =="合计")
1247
+                                      {
1248
+                                        im.number += 1;
1249
+                                         }
1250
+                                       }
1251
+                                    if (overdue == 0)
1252
+                                    {
1253
+                                        Template templates = new Template();
1254
+                                        templates.name = deptmodel.F_DeptName;
1255
+                                        templates.number = 1;
1256
+                                        model.overdue.Add(templates);
1257
+                                   }
1258
+                            }
1259
+                            else
1260
+                            {
1261
+                                Template templates = new Template();
1262
+                                templates.name = deptmodel.F_DeptName;
1263
+                                templates.number = 1;
1264
+                                model.overdue.Add(templates);
1265
+                            }
1266
+
1267
+
1268
+                        }
1269
+                    }
1270
+                }
1271
+            }
1272
+            if (model.overdue.Count > 0)
1273
+            {
1274
+                foreach (var it in model.overdue)
1275
+                {
1276
+                    if (it .name =="合计")
1277
+                    {
1278
+                        var lastmouthmodlel = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + lastmouth).Count ;
1279
+                        var lastyearmodlel = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + lastyear).Count ;
1280
+                        it.Lastmonthnumber = lastmouthmodlel;
1281
+                        it.Lastyearnumber = lastyearmodlel;
1282
+                        it.Lastmonth = it.number - lastmouthmodlel;
1283
+                        it.Lastyear = it.number - lastyearmodlel;
1284
+                    }
1285
+                    else
1286
+                    {
1287
+                        var deptmodel = departmentBLL.GetModel(it.name);
1288
+                        var lastmouthmodlel = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + lastmouth);
1289
+                        int lastmouthlist = 0;
1290
+                        int lastyearlist = 0;
1291
+                        if (lastmouthmodlel.Count > 0)
1292
+                        {
1293
+                            foreach (var im in lastmouthmodlel)
1294
+                            {
1295
+                                var itemList = itembll.GetModelList("  F_WoID=" + im.F_ID + "and F_WoState=1" + "and F_NextDept=" + deptmodel.F_DeptId + " order by F_ID desc");
1296
+                                if (itemList.Count > 0)
1297
+                                {
1298
+                                    lastmouthlist++;
1299
+                                }
1300
+                            }
1301
+                        }
1302
+                        var lastyearmodlel = workOrder.GetModelList(sql + sqloverdue + "and F_IsOver=1" + lastyear);
1303
+                        if (lastyearmodlel.Count > 0)
1304
+                        {
1305
+                            foreach (var im in lastyearmodlel)
1306
+                            {
1307
+                                var itemList = itembll.GetModelList("  F_WoID=" + im.F_ID + "and F_WoState=1" + "and F_NextDept=" + deptmodel.F_DeptId + " order by F_ID desc");
1308
+                                if (itemList.Count > 0)
1309
+                                {
1310
+                                    lastyearlist++;
1311
+                                }
1312
+                            }
1313
+                        }
1314
+                        it.Lastmonthnumber = lastmouthlist;
1315
+                        it.Lastyearnumber = lastyearlist;
1316
+                        it.Lastmonth = it.number - lastmouthlist;
1317
+                        it.Lastyear = it.number - lastyearlist;
1318
+                    }
1319
+                }
1320
+                 
1321
+            }
1322
+            if (model.overdue.Count > 0)
1323
+            {
1324
+                for (int j = 0; j < model.overdue.Count - 1; j++)
1325
+                {
1326
+                    for (int z = 0; z < model.overdue.Count - 1 - j; z++)
1327
+                    {
1328
+                        if (model.overdue[z].number < model.overdue[z + 1].number)
1329
+                        {
1330
+                            var temp = model.overdue[z + 1];
1331
+                            model.overdue[z + 1] = model.overdue[z];
1332
+                            model.overdue[z] = temp;
1333
+                        }
1334
+                    }
1335
+                }
1336
+            }
1337
+            #endregion
1338
+            var obj = new
1187
             {
1339
             {
1188
                 state = "success",
1340
                 state = "success",
1189
                 message = "成功",
1341
                 message = "成功",
1193
 
1345
 
1194
             return Content(obj.ToJson()); ;
1346
             return Content(obj.ToJson()); ;
1195
         }
1347
         }
1348
+      
1349
+   
1196
         private bool Refresh()
1350
         private bool Refresh()
1197
         {
1351
         {
1198
             int type = 0;
1352
             int type = 0;
1299
             }
1453
             }
1300
             return true;
1454
             return true;
1301
         }
1455
         }
1302
-        public Template ReturenTemplate(string sql,string time,string lastmouth,string lastyear )
1456
+        public Template ReturenTemplate(Template template,string sql,string time,string lastmouth,string lastyear )
1303
         {
1457
         {
1304
-            Template template = new Template();
1305
             template.number = new BLL.T_Wo_WorkOrder().GetModelList(sql + time).Count;//
1458
             template.number = new BLL.T_Wo_WorkOrder().GetModelList(sql + time).Count;//
1306
             int mounthnumber = 0, yearnumber = 0;
1459
             int mounthnumber = 0, yearnumber = 0;
1307
             mounthnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastmouth).Count;//
1460
             mounthnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastmouth).Count;//
1308
             yearnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastyear).Count;//
1461
             yearnumber = new BLL.T_Wo_WorkOrder().GetModelList(sql + lastyear).Count;//
1309
-            template.contrast.Lastmonth = template.number - mounthnumber;
1310
-            template.contrast.Lastyear = template.number - yearnumber;
1462
+            template.Lastmonthnumber = mounthnumber;
1463
+            template.Lastyearnumber = yearnumber;
1464
+            template.Lastmonth = template.number - mounthnumber;
1465
+            template.Lastyear = template.number - yearnumber;
1311
             return template;
1466
             return template;
1312
         }
1467
         }
1313
 
1468
 

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

537
             {
537
             {
538
                 //  Model.T_Sys_UserAccount ua = userAccountBLL.GetModel(userId);
538
                 //  Model.T_Sys_UserAccount ua = userAccountBLL.GetModel(userId);
539
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
539
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
540
-              //  Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
540
+                if (ua == null)
541
+                {
542
+                    return Error("该账号已在别的设备登录,请及时修改密码重新登录。");
543
+                }
544
+                //  Model.T_Sys_RoleInfo ro = rolebll.GetModel(ua.F_RoleId);
541
                 string sql = $" and F_IsDelete=0";
545
                 string sql = $" and F_IsDelete=0";
542
                 DataTable dt = new DataTable();
546
                 DataTable dt = new DataTable();
543
                 #region 筛选条件
547
                 #region 筛选条件
841
             {
845
             {
842
                 //  Model.T_Sys_UserAccount ua = userAccountBLL.GetModel(userId);
846
                 //  Model.T_Sys_UserAccount ua = userAccountBLL.GetModel(userId);
843
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
847
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
848
+                if (ua == null)
849
+                {
850
+                    return Error("该账号已在别的设备登录,请及时修改密码重新登录。");
851
+                }
844
                 string sql = $" and F_IsDelete=0";
852
                 string sql = $" and F_IsDelete=0";
845
                 DataTable dt = new DataTable();
853
                 DataTable dt = new DataTable();
846
                 #region 筛选条件
854
                 #region 筛选条件
1338
             if (!string.IsNullOrEmpty(OpenId))
1346
             if (!string.IsNullOrEmpty(OpenId))
1339
             {
1347
             {
1340
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
1348
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
1341
-               
1349
+                if (ua == null)
1350
+                {
1351
+                    return Error("该账号已在别的设备登录,请及时修改密码重新登录。");
1352
+                }
1342
                 string sql = "";
1353
                 string sql = "";
1343
                 if (id > 0)
1354
                 if (id > 0)
1344
                 {
1355
                 {
3024
             if (!string.IsNullOrEmpty(OpenId))
3035
             if (!string.IsNullOrEmpty(OpenId))
3025
             {
3036
             {
3026
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
3037
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
3038
+                if (ua==null )
3039
+                {
3040
+                    return Error("该账号已在别的设备登录,请及时修改密码重新登录。");
3041
+                }
3027
                 if (!Refresh())
3042
                 if (!Refresh())
3028
                 {
3043
                 {
3029
                     return Error("查询失败");
3044
                     return Error("查询失败");