Parcourir la Source

消息提醒调整

zhengbingbing il y a 6 ans
Parent
commit
3d96d8824a

+ 14 - 13
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/MsgController.cs

@@ -333,27 +333,28 @@ namespace CallCenterApi.Interface.Controllers
333 333
         {
334 334
             string usercode = CurrentUser.UserData.F_UserCode;
335 335
             //获取一个月内服务周期到期的客户信息
336
-            var cusbaseList = new BLL.T_Cus_CustomerBaseNew().GetModelList(" DATEDIFF(month,getdate(),F_CycleEnd)>0 and DATEDIFF(month,getdate(),F_CycleEnd)<=1 ");
336
+            var cusbaseList = new BLL.T_Cus_CustomerBaseNew().GetModelList(" DATEDIFF(month,F_CycleEnd,getdate())<=1 ");
337 337
             //获取一个月内当前登录工号的消息提醒
338
-            var msgList = new BLL.T_Msg_List().GetModelList(" ToUser='" + usercode + "' and Type=2 and IsDel=0 and DATEDIFF(month,getdate(),CreateDate)>0 and DATEDIFF(month,getdate(),CreateDate)<=1  ");
338
+            var msgList = new BLL.T_Msg_List().GetModelList(" ToUser='" + usercode + "' and Type=2 and IsDel=0 and DATEDIFF(month,CreateDate,getdate())<=1  ");
339 339
 
340 340
             foreach (var cusbase in cusbaseList)
341 341
             {
342 342
                 var msgnew = msgList.Where(m => m.ToID == cusbase.F_CustomerId);
343 343
                 //若消息列表中不能存在该客户信息,则添加
344
-                if(msgnew.Count()>0)
344
+                if (msgnew.Count() > 0)
345 345
                 {
346
-                    Model.T_Msg_List msg = new Model.T_Msg_List();
347
-                    msg.Type = 2;//服务周期
348
-                    msg.ToUser = usercode;
349
-                    msg.ToID = cusbase.F_CustomerId;
350
-                    msg.Detail = "客户编号为:“"+cusbase.F_CustomerCode+"”的客户服务周期即将到期,请及时提醒!";
351
-                    msg.State = 0;
352
-                    msg.IsDel = 0;
353
-                    msg.CreateDate = DateTime.Now;
354
-
355
-                    new BLL.T_Msg_List().Add(msg);
346
+                    continue;
356 347
                 }
348
+                Model.T_Msg_List msg = new Model.T_Msg_List();
349
+                msg.Type = 2;//服务周期
350
+                msg.ToUser = usercode;
351
+                msg.ToID = cusbase.F_CustomerId;
352
+                msg.Detail = "客户编号为:“" + cusbase.F_CustomerCode + "”的客户服务周期即将到期,请及时提醒!";
353
+                msg.State = 0;
354
+                msg.IsDel = 0;
355
+                msg.CreateDate = DateTime.Now;
356
+
357
+                new BLL.T_Msg_List().Add(msg);
357 358
             }
358 359
             var msgListnew = new BLL.T_Msg_List().GetModelList(" ToUser='" + usercode + "' and Type=2 and State=0 and IsDel=0 ");
359 360
             return Success("获取消息", msgListnew);