From 07d8011732a6c6d98fc55ef68495f014f95280d5 Mon Sep 17 00:00:00 2001
From: qwj <qwjzorro@163.com>
Date: 星期四, 24 八月 2023 10:41:59 +0800
Subject: [PATCH] 方案、财务、设备、技术力量、质检报告、制度流程api

---
 DocumentServiceAPI.Model/cyDocumentModel/Doc_Info.cs                          |    7 +
 DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs    |    1 
 DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml             |   77 +++++++++++++++
 DocumentServiceAPI.Application/DocManage/Dtos/Document_List_Dto.cs            |    5 +
 DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs          |   72 ++++++++++++++
 DocumentServiceAPI.Application/DocManage/Dtos/Document_Lock_Dto.cs            |   48 +++++++++
 DocumentServiceAPI.Application/DocManage/Dtos/Project_List_Dto.cs             |   34 ++++++
 DocumentServiceAPI.Application/DocManage/DocClassificationManageAppService.cs |   11 +-
 DocumentServiceAPI.Application/DocManage/Services/ProjectManageService.cs     |   12 ++
 9 files changed, 260 insertions(+), 7 deletions(-)

diff --git a/DocumentServiceAPI.Application/DocManage/DocClassificationManageAppService.cs b/DocumentServiceAPI.Application/DocManage/DocClassificationManageAppService.cs
index de9221f..447649c 100644
--- a/DocumentServiceAPI.Application/DocManage/DocClassificationManageAppService.cs
+++ b/DocumentServiceAPI.Application/DocManage/DocClassificationManageAppService.cs
@@ -38,15 +38,15 @@
             PageModel pg = new PageModel();
             pg.PageSize = page.PageSize;
             pg.PageIndex = page.PageIndex;
-
+            
             PageResult<Doc_Classification> result = new PageResult<Doc_Classification>();
             if (page.Status.HasValue)
             {
-                result.Items = await _classificationService.GetPageListAsync(c => c.status ==page.Status && c.parent_code == page.Code, pg);
+                result.Items = await _classificationService.GetPageListAsync(c => c.status ==page.Status && c.parent_code == page.Code,pg,c=>c.sort_id,OrderByType.Asc);
             }
             else
             {
-                result.Items = await _classificationService.GetPageListAsync(c => c.parent_code == page.Code, pg);
+                result.Items = await _classificationService.GetPageListAsync(c => c.parent_code == page.Code, pg, c => c.sort_id, OrderByType.Asc);
             }
             result.TotalCount = pg.TotalCount;
             result.PageIndex = pg.PageIndex;
@@ -62,7 +62,7 @@
         public async Task<IActionResult> PostItemList(DocClassificationSearch page)
         {
             var data = await _classificationService.GetListAsync(c => c.status == 1 && c.parent_code == page.Code);
-            return new JsonResult(data);
+            return new JsonResult(data.OrderBy(c=>c.sort_id).ToList());
         }
 
         /// <summary>
@@ -78,7 +78,7 @@
             doc.doc_classification_code = "";
             doc.is_system = false;
             doc.parent_code = info.code;
-            doc.sort_id = 99;
+            doc.sort_id = info.sort;
             doc.status = info.status;
             doc.tenant_code = info.tenant_id;
             
@@ -100,6 +100,7 @@
                 model.add_time = DateTime.Now;
                 model.doc_classification = info.name;
                 model.status = info.status;
+                model.sort_id = info.sort;
 
                 msg = await _classificationService.UpdateAsync(model);
             }
diff --git a/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs b/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs
index 0365c1d..85aaef9 100644
--- a/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs
+++ b/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs
@@ -1,9 +1,12 @@
 锘縰sing DocumentServiceAPI.Application.DocManage.Dtos;
 using DocumentServiceAPI.Application.DocManage.Services;
+using DocumentServiceAPI.Application.ProjectInfo.Services;
 using DocumentServiceAPI.Application.System.Services;
 using DocumentServiceAPI.Model.cyDocumentModel;
+using DocumentServiceAPI.Services.IService;
 using DocumentServiceAPI.Utility;
 using Microsoft.AspNetCore.Mvc.RazorPages;
+using Microsoft.Extensions.Caching.Memory;
 using System.Linq.Expressions;
 
 namespace DocumentServiceAPI.Application.DocManage
@@ -17,13 +20,71 @@
         private readonly DocumentManageService _docManageService;
         private readonly OrganizationService _organizationService;
         private readonly FileManageService _fileManageService;
+        private readonly ProjectManageService _projectService;
+        private readonly IRedisCacheService _redisCache;
 
-        public DocumentManageAppService(DocClassificationService classService, DocumentManageService docService, OrganizationService orgService,FileManageService fileManageService)
+        public DocumentManageAppService(DocClassificationService classService, DocumentManageService docService, OrganizationService orgService,
+            FileManageService fileManageService, ProjectManageService projectService, IRedisCacheService redisCase)
         {
             _classificationService = classService;
             _docManageService = docService;
             _organizationService = orgService;
             _fileManageService = fileManageService;
+            _projectService = projectService;
+
+            _redisCache = redisCase;
+        }
+
+        /// <summary>
+        /// 缂栬緫鏂囨。鏃惰缃枃妗i攣瀹氱姸鎬�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns>
+        ///  true:璁剧疆閿佸畾鎴愬姛
+        ///  false:閿佸畾澶辫触锛屾枃妗e凡琚攣瀹�
+        /// </returns>
+        public bool SetDocLockStatus(DocLock_Submit_Dto model)
+        {
+            bool msg = true;
+            string key = model.tenant_id.ToString().PadLeft(4,'0') + "_" + model.id.ToString().PadLeft(8,'0');
+            if (_redisCache.Get<Document_Lock_Dto>(key) != null)
+            {
+                msg = false;
+            }
+            else
+            {
+                Document_Lock_Dto lk = new Document_Lock_Dto();
+                lk.doc_id = model.id;
+                lk.lock_time = DateTime.Now;
+                lk.lock_user = model.username;
+                lk.lock_user_id = model.userid;
+                lk.status = 0;
+                lk.tenant_id = model.tenant_id;
+                
+                var db= _redisCache.Add<Document_Lock_Dto>(key,lk ,-1);
+            }
+            return msg;
+        }
+
+        /// <summary>
+        /// 鏌ヨ椤圭洰淇℃伅
+        /// </summary>
+        /// <param name="search"></param>
+        /// <returns></returns>
+        public async Task<IActionResult> PostProjectItemList(ProjectItemSearch search)
+        {
+            var data = await _projectService.GetListAsync();//.GetListAsync(c => c.TenantID == search.tenant_id);
+            if (data != null)
+            {
+                var list = data.Select(c => new ProjectItem_List_Dto()
+                {
+                     pro_id=c.ProjectId,
+                      pro_name=c.ProjectName
+                }).OrderBy(c => c.pro_name).ToList();
+                return new JsonResult(list);
+            }
+
+            return null;
         }
 
         /// <summary>
@@ -40,6 +101,11 @@
             {
                 expression = expression.And(t => t.classification_id == model.class_id);
             }
+            if (model.project_id.HasValue && model.project_id != 0)
+            {
+                expression = expression.And(t => t.project_id == model.project_id);
+            }
+
             if (model.id > 0)
             {
                 expression = expression.And(t => t.id != model.id);
@@ -86,7 +152,9 @@
                 var data = await _docManageService.Context.Queryable<Doc_Info>()
                         .Includes(c => c.DocClassification)
                         .Includes(c=>c.DocOrganization)
+                        .Includes(c=>c.DocProject)
                         .Where(expression)
+                        .OrderByDescending(c=>c.id)
                         .ToPageListAsync(page.PageIndex, page.PageSize, total);
 
                 if (data != null && total > 0)
@@ -101,7 +169,7 @@
                         org_id = c.org_id,
                         org_name = c.DocOrganization?.UnitName,
                         project_id = c.project_id,
-                        project_name = "",
+                        project_name = c.DocProject?.ProjectName,                        
                         status = c.status
                     }).ToList();
 
diff --git a/DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs b/DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs
index 28b486c..878be55 100644
--- a/DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs
+++ b/DocumentServiceAPI.Application/DocManage/Dtos/Classification_Submit_Dto.cs
@@ -13,6 +13,7 @@
         /// </summary>           
         public string code { get; set; }
 
+        public int sort { get; set; }
         public int status { get; set; }
     }
 }
diff --git a/DocumentServiceAPI.Application/DocManage/Dtos/Document_List_Dto.cs b/DocumentServiceAPI.Application/DocManage/Dtos/Document_List_Dto.cs
index 9138c57..ad86c15 100644
--- a/DocumentServiceAPI.Application/DocManage/Dtos/Document_List_Dto.cs
+++ b/DocumentServiceAPI.Application/DocManage/Dtos/Document_List_Dto.cs
@@ -76,6 +76,11 @@
         /// </summary>
         public int? org_id { get; set; }
 
+        /// <summary>
+        /// 椤圭洰鍚嶇О
+        /// </summary>
+        public int? project_id { get; set; }
+
         public int status { get; set; }
 
         public List<DocumentFile_Submit_Dto> newfiles { get; set; }
diff --git a/DocumentServiceAPI.Application/DocManage/Dtos/Document_Lock_Dto.cs b/DocumentServiceAPI.Application/DocManage/Dtos/Document_Lock_Dto.cs
new file mode 100644
index 0000000..ea141f5
--- /dev/null
+++ b/DocumentServiceAPI.Application/DocManage/Dtos/Document_Lock_Dto.cs
@@ -0,0 +1,48 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DocumentServiceAPI.Application.DocManage.Dtos
+{
+    public class Document_Lock_Dto
+    {
+        /// <summary>
+        /// 鏂囨。id
+        /// </summary>
+        public int doc_id { get; set; }
+
+        public int lock_user_id { get; set; }
+
+        public string lock_user { get; set; }
+
+        public DateTime lock_time { get; set; }
+
+        public DateTime? release_time { get; set; }
+        public int tenant_id { get; set; }
+
+        public int status { get; set; }
+    }
+
+    /// <summary>
+    /// 鎻愪氦淇℃伅
+    /// </summary>
+    public class DocLock_Submit_Dto
+    {
+        public int id { get; set; }
+
+        /// <summary>
+        /// 浜哄憳
+        /// </summary>           
+        public int userid { get; set; }
+
+        /// <summary>
+        /// 浜哄憳
+        /// </summary>           
+        public string username { get; set; }
+
+        public int tenant_id { get; set; }
+
+    }
+}
diff --git a/DocumentServiceAPI.Application/DocManage/Dtos/Project_List_Dto.cs b/DocumentServiceAPI.Application/DocManage/Dtos/Project_List_Dto.cs
new file mode 100644
index 0000000..f04b696
--- /dev/null
+++ b/DocumentServiceAPI.Application/DocManage/Dtos/Project_List_Dto.cs
@@ -0,0 +1,34 @@
+锘縩amespace DocumentServiceAPI.Application.DocManage.Dtos
+{
+    /// <summary>
+    /// 椤圭洰鍒楄〃淇℃伅
+    /// </summary>
+    public class ProjectItem_List_Dto
+    {
+        /// <summary>
+        /// 椤圭洰id
+        /// </summary>
+        public int pro_id { get; set; }
+
+        /// <summary>
+        /// 椤圭洰鍚嶇О
+        /// </summary>
+        public string pro_name { get; set; }
+    }
+
+    /// <summary>
+    /// 椤圭洰鏌ヨ鏉′欢
+    /// </summary>
+    public class ProjectItemSearch
+    {
+        /// <summary>
+        /// 绉熸埛
+        /// </summary>
+        public int tenant_id { get; set; }
+
+        /// <summary>
+        /// 鍗曚綅
+        /// </summary>
+        public int org_id { get; set; }
+    }
+}
diff --git a/DocumentServiceAPI.Application/DocManage/Services/ProjectManageService.cs b/DocumentServiceAPI.Application/DocManage/Services/ProjectManageService.cs
new file mode 100644
index 0000000..5c7cea3
--- /dev/null
+++ b/DocumentServiceAPI.Application/DocManage/Services/ProjectManageService.cs
@@ -0,0 +1,12 @@
+锘縰sing DocumentServiceAPI.Core;
+using DocumentServiceAPI.Model.cyDocumentModel;
+
+namespace DocumentServiceAPI.Application.DocManage.Services
+{
+    /// <summary>
+    /// 椤圭洰鏌ヨ绫�
+    /// </summary>
+    public class ProjectManageService : BaseRepository<Document_ProjectInfo>, ITransient
+    {
+    }
+}
diff --git a/DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml b/DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml
index 91a23df..96b03e8 100644
--- a/DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml
+++ b/DocumentServiceAPI.Application/DocumentServiceAPI.Application.xml
@@ -56,6 +56,23 @@
             璧勬枡绠$悊
             </summary>
         </member>
+        <member name="M:DocumentServiceAPI.Application.DocManage.DocumentManageAppService.SetDocLockStatus(DocumentServiceAPI.Application.DocManage.Dtos.DocLock_Submit_Dto)">
+            <summary>
+            缂栬緫鏂囨。鏃惰缃枃妗i攣瀹氱姸鎬�
+            </summary>
+            <param name="model"></param>
+            <returns>
+             true:璁剧疆閿佸畾鎴愬姛
+             false:閿佸畾澶辫触锛屾枃妗e凡琚攣瀹�
+            </returns>
+        </member>
+        <member name="M:DocumentServiceAPI.Application.DocManage.DocumentManageAppService.PostProjectItemList(DocumentServiceAPI.Application.DocManage.Dtos.ProjectItemSearch)">
+            <summary>
+            鏌ヨ椤圭洰淇℃伅
+            </summary>
+            <param name="search"></param>
+            <returns></returns>
+        </member>
         <member name="M:DocumentServiceAPI.Application.DocManage.DocumentManageAppService.CheckNameDuplicate(DocumentServiceAPI.Application.DocManage.Dtos.Document_Submit_Dto)">
             <summary>
             妫�鏌ュ悕绉伴噸澶�
@@ -165,6 +182,11 @@
             鎶曟爣鍗曚綅
             </summary>
         </member>
+        <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.Document_Submit_Dto.project_id">
+            <summary>
+            椤圭洰鍚嶇О
+            </summary>
+        </member>
         <member name="T:DocumentServiceAPI.Application.DocManage.Dtos.Document_Info_Dto">
             <summary>
             鏌ヨ鏂囨。淇℃伅
@@ -230,9 +252,59 @@
             涓婁紶浜哄憳
             </summary>           
         </member>
+        <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.Document_Lock_Dto.doc_id">
+            <summary>
+            鏂囨。id
+            </summary>
+        </member>
+        <member name="T:DocumentServiceAPI.Application.DocManage.Dtos.DocLock_Submit_Dto">
+            <summary>
+            鎻愪氦淇℃伅
+            </summary>
+        </member>
+        <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.DocLock_Submit_Dto.userid">
+            <summary>
+            浜哄憳
+            </summary>           
+        </member>
+        <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.DocLock_Submit_Dto.username">
+            <summary>
+            浜哄憳
+            </summary>           
+        </member>
         <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.FileInfo_List_Dto.suffix">
             <summary>
             鎵╁睍鍚�
+            </summary>
+        </member>
+        <member name="T:DocumentServiceAPI.Application.DocManage.Dtos.ProjectItem_List_Dto">
+            <summary>
+            椤圭洰鍒楄〃淇℃伅
+            </summary>
+        </member>
+        <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.ProjectItem_List_Dto.pro_id">
+            <summary>
+            椤圭洰id
+            </summary>
+        </member>
+        <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.ProjectItem_List_Dto.pro_name">
+            <summary>
+            椤圭洰鍚嶇О
+            </summary>
+        </member>
+        <member name="T:DocumentServiceAPI.Application.DocManage.Dtos.ProjectItemSearch">
+            <summary>
+            椤圭洰鏌ヨ鏉′欢
+            </summary>
+        </member>
+        <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.ProjectItemSearch.tenant_id">
+            <summary>
+            绉熸埛
+            </summary>
+        </member>
+        <member name="P:DocumentServiceAPI.Application.DocManage.Dtos.ProjectItemSearch.org_id">
+            <summary>
+            鍗曚綅
             </summary>
         </member>
         <member name="P:DocumentServiceAPI.Application.DocManage.Services.DocClassificationPageSearch.Code">
@@ -300,6 +372,11 @@
             鏂囦欢绠$悊
             </summary>
         </member>
+        <member name="T:DocumentServiceAPI.Application.DocManage.Services.ProjectManageService">
+            <summary>
+            椤圭洰鏌ヨ绫�
+            </summary>
+        </member>
         <member name="T:DocumentServiceAPI.Application.ProjectInfo.ProjectInfoController">
             <summary>
             鐧诲綍鎺у埗鍣�
diff --git a/DocumentServiceAPI.Model/cyDocumentModel/Doc_Info.cs b/DocumentServiceAPI.Model/cyDocumentModel/Doc_Info.cs
index 1303c23..446ddb4 100644
--- a/DocumentServiceAPI.Model/cyDocumentModel/Doc_Info.cs
+++ b/DocumentServiceAPI.Model/cyDocumentModel/Doc_Info.cs
@@ -61,6 +61,13 @@
         [SugarColumn(IsIgnore = true)]
         [Navigate(NavigateType.OneToOne, nameof(org_id))]
         public Document_TenderUnit? DocOrganization { get; set; }
+
+        /// <summary>
+        /// 鍏宠仈椤圭洰
+        /// </summary>
+        [SugarColumn(IsIgnore = true)]
+        [Navigate(NavigateType.OneToOne, nameof(project_id))]
+        public Document_ProjectInfo? DocProject { get; set; }
     }
 
 }

--
Gitblit v1.9.1