Quellcode durchsuchen

添加档案转移处理接口

mengjie vor 5 Jahren
Ursprung
Commit
96fb681efe

+ 4 - 0
代码/System.Model/T_Cus_Msg.cs

@@ -24,6 +24,10 @@ namespace System.Model
24 24
         /// </summary>				
25 25
         public string F_ToPerson { get; set; }
26 26
         /// <summary>
27
+        /// 消息内容
28
+        /// </summary>				
29
+        public string F_Notice { get; set; }
30
+        /// <summary>
27 31
         /// 状态:0未读,1已读但未处理,2同意转移,3拒绝
28 32
         /// </summary>				
29 33
         public int F_State { get; set; }

+ 61 - 11
代码/TVShoppingCallCenter_ZLJ/Controllers/Customer/CusMsgController.cs

@@ -8,6 +8,7 @@ using System.Security.Claims;
8 8
 using System.Threading.Tasks;
9 9
 using Microsoft.AspNetCore.Authorization;
10 10
 using Microsoft.AspNetCore.Mvc;
11
+using SqlSugar;
11 12
 
12 13
 // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
13 14
 
@@ -38,23 +39,18 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
38 39
         /// <param name="input"></param>
39 40
         /// <returns></returns>
40 41
         [HttpPost("add")]
41
-        public async Task<IActionResult> AddAsync(int start, int getpercent, int getday, int startdebit, int debitpercent)
42
+        public async Task<IActionResult> AddAsync(int type, int vipid, string  toperson, string notifyperson,string notice)
42 43
         {
43 44
 
44 45
             var model = new T_Cus_Msg();
45
-            model.F_Type = start;
46
-            model.F_VipInfoID = getpercent;
47
-            model.F_ToPerson = "";
46
+            model.F_Type = 1;
47
+            model.F_VipInfoID = vipid;
48
+            model.F_ToPerson = toperson;
48 49
             model.F_State = 0;
49
-            model.F_NotifyPerson = "";
50
+            model.F_Notice = notice;
51
+            model.F_NotifyPerson = notifyperson;
50 52
             model.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
51 53
             model.F_CreateOn = DateTime.Now;
52
-
53
-            //if (await _cus_score_setRepository.GetCount(x => x.F_Name == input.name) > 0)
54
-            //{
55
-            //    return Error("添加失败,存在相同标签信息");
56
-            //}
57
-                  
58 54
             var res = await _cus_msgRepository.Add(model);
59 55
             if (res > 0)
60 56
             {
@@ -66,5 +62,59 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
66 62
             }
67 63
 
68 64
         }
65
+
66
+        /// <summary>
67
+        /// 获取列表分页
68
+        /// </summary>
69
+        /// <param name="keyword"></param>
70
+        /// <param name="pageindex"></param>
71
+        /// <param name="pagesize"></param>
72
+        /// <returns></returns>
73
+        [HttpGet("getlistbypage")]
74
+        public async Task<IActionResult> GetListsByPageAsync(int getstate,string tousercode, string fromusercode, int type,int pageindex = 1, int pagesize = 20)//getstate传0时获取全部,传1时获取未处理,传2时获取已处理
75
+        {
76
+            List<IConditionalModel> conModels = new List<IConditionalModel>();
77
+            #region 条件筛选
78
+            if (getstate == 1)
79
+            {
80
+                conModels.Add(new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = getstate.ToString() });
81
+            }
82
+            else if (getstate == 2)
83
+            {
84
+                    conModels.Add(new ConditionalCollections()
85
+                    {
86
+                        ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
87
+                    {
88
+                        new  KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = "2" }),
89
+                        new  KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_State", ConditionalType = ConditionalType.Equal, FieldValue = "3" })
90
+
91
+                    }
92
+                    });
93
+            }
94
+            if (!string.IsNullOrEmpty(tousercode))
95
+            {
96
+                conModels.Add(new ConditionalModel() { FieldName = "F_ToPerson", ConditionalType = ConditionalType.Equal , FieldValue = tousercode });
97
+            }
98
+            if (!string.IsNullOrEmpty(fromusercode))
99
+            {
100
+                conModels.Add(new ConditionalModel() { FieldName = "F_CreateBy", ConditionalType = ConditionalType.Equal, FieldValue = fromusercode });
101
+            }
102
+            //if (!string.IsNullOrEmpty(keyword))
103
+            //{
104
+            //    conModels.Add(new ConditionalModel() { FieldName = "F_Name", ConditionalType = ConditionalType.Like, FieldValue = keyword });
105
+            //}
106
+            
107
+            #endregion
108
+            int recordCount = 0;
109
+            var list = await _cus_msgRepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount });
110
+            var obj = new
111
+            {
112
+                state = "success",
113
+                message = "成功",
114
+                rows = list,
115
+                total = recordCount,
116
+            };
117
+            return Content(obj.ToJson());
118
+        }
69 119
     }
70 120
 }

+ 80 - 10
代码/TVShoppingCallCenter_ZLJ/Controllers/Customer/VIPInfoController.cs

@@ -20,11 +20,13 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
20 20
     {
21 21
         private readonly ICus_VipInfoRepository _cus_vip_infoRepository;
22 22
         private readonly ISys_UserAccountRepository _sys_user_accountRepository;
23
+        private readonly ICus_MsgRepository _cus_msgRepository;
23 24
 
24
-        public VipInfoController(ICus_VipInfoRepository cus_vip_infoRepository, ISys_UserAccountRepository sys_user_accountRepository)
25
+        public VipInfoController(ICus_VipInfoRepository cus_vip_infoRepository, ISys_UserAccountRepository sys_user_accountRepository, ICus_MsgRepository cus_msgRepository)
25 26
         {
26 27
             _cus_vip_infoRepository = cus_vip_infoRepository;
27 28
             _sys_user_accountRepository = sys_user_accountRepository;
29
+            _cus_msgRepository = cus_msgRepository;
28 30
         }
29 31
 
30 32
         [HttpGet]
@@ -316,22 +318,90 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Customer
316 318
                 foreach (var item in ids)
317 319
                 {
318 320
                     var ml = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == item);
321
+                    if (ml != null)
322
+                    {
323
+                        #region 创建消息提醒
324
+                        var model = new T_Cus_Msg();
325
+                        model.F_Type = 1;
326
+                        model.F_VipInfoID = item;
327
+                        model.F_ToPerson = toperson;
328
+                        model.F_State = 0;
329
+                        model.F_NotifyPerson = ml.F_Saleperson;
330
+                        model.F_CreateBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
331
+                        model.F_CreateOn = DateTime.Now;
332
+                        var su = await _cus_msgRepository.Add(model);
333
+                        if (su > 0)
334
+                        {
335
+                            res += 1;
336
+                        }
337
+                        #endregion
338
+                    }                  
339
+                    //ml.F_Saleperson = toperson;
340
+                    //ml.F_LastModifyOn = DateTime.Now.ToLocalTime();
341
+                    //ml.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
342
+                    //if (_cus_vip_infoRepository.Update(ml).Result)
343
+                    //    res += 1;
344
+                }
345
+                if (res == ids.Length)
346
+                    return Success("转移消息创建成功");
347
+                else if (res > 0 && res < ids.Length)
348
+                    return Error("部分转移消息创建失败,请查看后重新操作");
349
+                else
350
+                    return Error("转移消息创建失败,请查看后重新操作");
351
+            }
352
+            else
353
+                return Error("请选择要转移的记录");
354
+        }
355
+
356
+        /// <summary>
357
+        /// 转移消息处理
358
+        /// </summary>
359
+        /// <param name="ids"></param>
360
+        /// <returns></returns>
361
+        [HttpPost("deal")]
362
+        public async Task<IActionResult> Deal(int[] ids, int notagree)//同意传0,不同意传1
363
+        {
364
+            var res = 0;
365
+            if (ids != null && ids.Length > 0)
366
+            {
367
+                foreach (var item in ids)
368
+                {
369
+                    var ml = await _cus_msgRepository.GetSingle(x => x.F_ID == item);
370
+                    
371
+                    if (ml != null)
372
+                    {
373
+                        #region 创建消息提醒
374
+                        //var model = new T_Cus_Msg();
375
+                        ml.F_Type = 1;                       
376
+                        ml.F_State = notagree +2;                        
377
+                        ml.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
378
+                        ml.F_LastModifyOn = DateTime.Now;
379
+                        if (_cus_msgRepository.Update(ml).Result)
380
+                        {
381
+                            if (notagree == 0)//同意转移时更新会员信息
382
+                            {
383
+                                var m = await _cus_vip_infoRepository.GetSingle(x => x.F_ID == ml.F_VipInfoID );
384
+                                m.F_Saleperson = ml.F_ToPerson ;
385
+                                m.F_LastModifyOn = DateTime.Now.ToLocalTime();
386
+                                m.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
387
+                                if (_cus_vip_infoRepository.Update(m).Result)
388
+                                { }
389
+                            }
390
+                            res += 1;
391
+                        }
392
+                        #endregion
393
+                    }
319 394
                     
320
-                    ml.F_Saleperson = toperson;
321
-                    ml.F_LastModifyOn = DateTime.Now.ToLocalTime();
322
-                    ml.F_LastModifyBy = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
323
-                    if (_cus_vip_infoRepository.Update(ml).Result)
324
-                        res += 1;
325 395
                 }
326 396
                 if (res == ids.Length)
327
-                    return Success("转移成功");
397
+                    return Success("处理成功");
328 398
                 else if (res > 0 && res < ids.Length)
329
-                    return Error("部分转移失败,请查看后重新操作");
399
+                    return Error("部分消息处理失败,请查看后重新操作");
330 400
                 else
331
-                    return Error("转移失败,请查看后重新操作");
401
+                    return Error("处理消息失败,请查看后重新操作");
332 402
             }
333 403
             else
334
-                return Error("请选择要删除的记录");
404
+                return Error("请选择要处理的记录");
335 405
         }
336 406
     }
337 407
 }