Browse Source

修改前内容,修改后内容对比详情接口

lihai 7 years ago
parent
commit
dfcdbb9d9d

+ 79 - 3
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/knowledge/KnowledgeController.cs

@@ -1,4 +1,5 @@
1 1
 using CallCenter.Utility;
2
+using CallCenterApi.DB;
2 3
 using CallCenterApi.Interface.Controllers.Base;
3 4
 using System;
4 5
 using System.Collections.Generic;
@@ -75,7 +76,7 @@ namespace CallCenterApi.Interface.Controllers.knowledge
75 76
             #region 获取分类信息
76 77
             dt.Columns.Add("CategoryId", typeof(string));   //分类id
77 78
             dt.Columns.Add("CategoryName", typeof(string)); //分类名称
78
-            dt.Columns.Add("isfavorites", typeof(string));   //是否收藏0未收藏,1收藏
79
+            dt.Columns.Add("favoritesid", typeof(string));   //是否收藏0未收藏,>0收藏
79 80
             var list = bllcategory.DataTableToList(bllcategory.GetList(" 1=1 ").Tables[0]);
80 81
             var listFavorites = bllfavorites.DataTableToList(bllfavorites.GetList($" 1=1 and UserId = {userid} ").Tables[0]);
81 82
             foreach (DataRow dr in dt.Rows)
@@ -87,11 +88,11 @@ namespace CallCenterApi.Interface.Controllers.knowledge
87 88
                     dr["CategoryName"] = modelcategory.F_CategoryName;
88 89
                 }
89 90
                 //添加是否收藏
90
-                dr["isfavorites"] = 0;
91
+                dr["favoritesid"] = 0;
91 92
                 var modeFavorites = listFavorites.FirstOrDefault(x => x.F_RepositoryId == Convert.ToInt32(dr["F_RepositoryId"].ToString()));
92 93
                 if (modeFavorites != null)
93 94
                 {
94
-                    dr["isfavorites"] = 1;
95
+                    dr["favoritesid"] = modeFavorites.Id;
95 96
                 }
96 97
             }
97 98
             #endregion
@@ -270,6 +271,81 @@ namespace CallCenterApi.Interface.Controllers.knowledge
270 271
             return Content(obj.ToJson());
271 272
         }
272 273
 
274
+        /// <summary>
275
+        /// 获取审核列表 修改前修改后对比
276
+        /// </summary>
277
+        /// <param name="auditid">id</param>
278
+        /// <returns></returns>
279
+        public ActionResult GetAuditCompareInfo(int auditid = 0, int ispass = 0)
280
+        {
281
+            DataTable dt = new DataTable();
282
+
283
+            string sql = ""; string sqlLog = "";
284
+            sql += " and isnull(F_ISPass,0)=" + ispass;
285
+            if (ispass == 0)
286
+                sql += " and F_RepositoryId in (select F_RepositoryId from T_RepositoryInformation where F_ISSubmitAudit=1)";
287
+
288
+            string sqllist = $"SELECT * FROM dbo.T_RepositoryAudit WHERE 1=1 {sql} "
289
+                    + " ORDER BY F_AuditId desc ";
290
+            dt = DbHelperSQL.Query(sqllist).Tables[0];
291
+            List<Model.T_RepositoryAudit> auditList = new BLL.T_RepositoryAudit().DataTableToList(dt);
292
+            var model = auditList.SingleOrDefault(x => x.F_AuditId == auditid);
293
+
294
+            List<Model.T_RepositoryLog> logList = new BLL.T_RepositoryLog().GetModelList(" 1=1 " + sqlLog);
295
+            var listcategory = bllcategory.DataTableToList(bllcategory.GetList(" 1=1 ").Tables[0]);
296
+            if (model != null)
297
+            {
298
+                var preContent = ""; var afterContent = "";
299
+                var predis = ""; var afterdis = "";
300
+                var title = ""; var ptitle = ""; var atitle = "";
301
+                int categoryid = 0, aftercategoryid = 0;
302
+                if (model.F_PreLogID != null)
303
+                {
304
+                    Model.T_RepositoryLog logModel = logList.Where(y => y.F_LogId == model.F_PreLogID.Value).FirstOrDefault();
305
+                    if (logModel != null)
306
+                    {
307
+                        preContent = logModel.F_Content;
308
+                        predis = logModel.F_Description;
309
+                        ptitle = logModel.F_Title;
310
+                        categoryid = logModel.F_IntExpand1 ?? 0;
311
+                    }
312
+                }
313
+                if (model.F_AfterLogID != null)
314
+                {
315
+                    Model.T_RepositoryLog logModel = logList.Where(y => y.F_LogId == model.F_AfterLogID.Value).FirstOrDefault();
316
+                    if (logModel != null)
317
+                    {
318
+                        afterContent = logModel.F_Content;
319
+                        afterdis = logModel.F_Description;
320
+                        atitle = logModel.F_Title;
321
+                        aftercategoryid = logModel.F_IntExpand1 ?? 0;
322
+                    }
323
+                }
324
+                //分类
325
+                var modelcategory= listcategory.FirstOrDefault(x=>x.F_CategoryId == model.)
326
+                //if (ptitle != "")
327
+                //{ title = ptitle; }
328
+                //else { title = atitle; }
329
+                var obj = new
330
+                {
331
+                    F_AuditId = model.F_AuditId,
332
+                    F_Action = model.F_Action,
333
+                    F_CategoryId = categoryid,
334
+                    F_Title = ptitle,
335
+                    F_PreContent = preContent,
336
+                    F_PreDescription = predis,
337
+                    F_AfterCategoryId = aftercategoryid,
338
+                    F_AfterTitle = atitle,
339
+                    F_AfterContent = afterContent,
340
+                    F_AfterDescription = afterdis,
341
+                    F_ISPass = model.F_ISPass,
342
+                    F_AuditRemark = model.F_AuditRemark
343
+                };
344
+                return Success("获取成功", obj);
345
+            }
346
+            return Error("获取失败");
347
+        }
348
+
273 349
         [Authority]
274 350
         //添加知识库
275 351
         public ActionResult AddInfo(string title, string con, string pid, int issub)

+ 6 - 4
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/knowledge/KnowledgeFavoritesController.cs

@@ -39,7 +39,7 @@ namespace CallCenterApi.Interface.Controllers.knowledge
39 39
             }
40 40
             if (!string.IsNullOrEmpty(keywords))
41 41
             {
42
-                sql += " and (a.F_Title like '%" + keywords.Trim() + "%' or a.F_Content like '%" + keywords.Trim() + "%')";
42
+                sql += " and (b.F_Title like '%" + keywords.Trim() + "%' or b.F_Content like '%" + keywords.Trim() + "%')";
43 43
             }
44 44
             if (strpageindex.Trim() != "")
45 45
             {
@@ -54,7 +54,7 @@ namespace CallCenterApi.Interface.Controllers.knowledge
54 54
             dt = BLL.PagerBLL.GetListPager(
55 55
                 "dbo.T_RepositoryFavorites a LEFT JOIN dbo.T_RepositoryInformation b ON b.F_RepositoryId = a.F_RepositoryId LEFT JOIN dbo.T_RepositoryCategory c ON c.F_CategoryId = b.F_CategoryId ",
56 56
                 "a.Id",
57
-                "a.*,b.F_Title,b.F_Content,c.F_CategoryId,c.F_CategoryName",
57
+                "a.*,b.F_Title,b.F_Description,b.F_Content,c.F_CategoryId,c.F_CategoryName",
58 58
                 sql,
59 59
                 "ORDER BY a.F_CreateTime asc",
60 60
                 pagesize,
@@ -76,8 +76,10 @@ namespace CallCenterApi.Interface.Controllers.knowledge
76 76
         /// </summary>
77 77
         /// <param name="repositoryid">知识库id</param>
78 78
         /// <returns></returns>
79
-        public ActionResult AddFavoritesInfo(int repositoryid)
79
+        public ActionResult AddFavoritesInfo(int repositoryid = 0)
80 80
         {
81
+            if (repositoryid <= 0)
82
+                return Error("参数错误");
81 83
             int userid = int.Parse(User.UserData["F_UserID"]);
82 84
             Model.T_RepositoryFavorites model = new Model.T_RepositoryFavorites();
83 85
 
@@ -105,7 +107,7 @@ namespace CallCenterApi.Interface.Controllers.knowledge
105 107
         {
106 108
             if (ids != null && ids.Length > 0)
107 109
             {
108
-                string idd = " ";
110
+                string idd = "";
109 111
                 foreach (string str in ids)
110 112
                 {
111 113
                     idd += str + ",";