From bc9e5c59961ce729e3c62d9cf26069da7dc7c39e Mon Sep 17 00:00:00 2001 From: qwj <qwjzorro@163.com> Date: 星期五, 25 八月 2023 15:39:55 +0800 Subject: [PATCH] 业绩管理 --- DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs | 130 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 129 insertions(+), 1 deletions(-) diff --git a/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs b/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs index 85aaef9..7a19cf5 100644 --- a/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs +++ b/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs @@ -21,16 +21,18 @@ private readonly OrganizationService _organizationService; private readonly FileManageService _fileManageService; private readonly ProjectManageService _projectService; + private readonly DocAchievementService _achievementService; private readonly IRedisCacheService _redisCache; public DocumentManageAppService(DocClassificationService classService, DocumentManageService docService, OrganizationService orgService, - FileManageService fileManageService, ProjectManageService projectService, IRedisCacheService redisCase) + FileManageService fileManageService, ProjectManageService projectService, DocAchievementService achievementService, IRedisCacheService redisCase) { _classificationService = classService; _docManageService = docService; _organizationService = orgService; _fileManageService = fileManageService; _projectService = projectService; + _achievementService = achievementService; _redisCache = redisCase; } @@ -85,6 +87,22 @@ } return null; + } + + /// <summary> + /// 鏍规嵁鏂囨。绫诲瀷鏌ヨ鏂囨。鍒楄〃 + /// </summary> + /// <param name="search"></param> + /// <returns></returns> + public async Task<IActionResult> PostDocumentItemList(DocumentSearch search) + { + var data = await _docManageService.GetListAsync(c => c.is_del == false && c.doc_code == search.Code && c.tenant_code == search.TenantID); + if (search.class_id > 0) + { + data = data.Where(c => c.classification_id == search.class_id).ToList(); + } + + return new JsonResult(data.Select(c => new { name= c.doc_name, c.id }).ToList()); } /// <summary> @@ -371,5 +389,115 @@ } #endregion + + #region 涓氱哗绠$悊 + + /// <summary> + /// 鏍规嵁鍒嗛〉鏉′欢鏌ヨ鍒嗛〉鏁版嵁 + /// </summary> + /// <param name="page"></param> + /// <returns></returns> + public async Task<IActionResult> PostAchievementListPage(DocumentPageSearch page) + { + PageResult<Achievement_List_Dto> result = new PageResult<Achievement_List_Dto>(); + + try + { + Expression<Func<Doc_Achievement, bool>> expression = t => true; + + expression = expression.And(t => t.tenant_code == page.TenantID && t.status == 1); + if (page.ClassCode.HasValue) + { + expression = expression.And(t => t.classification_id == page.ClassCode); + } + if (!string.IsNullOrEmpty(page.Name)) + { + expression = expression.And(t => t.achievement_name.Contains(page.Name)); + } + + RefAsync<int> total = 0; + var data = await _achievementService.Context.Queryable<Doc_Achievement>() + .Includes(c => c.DocClassification) + .Includes(c => c.DocProject) + .Where(expression) + .OrderByDescending(c => c.id) + .ToPageListAsync(page.PageIndex, page.PageSize, total); + + if (data != null && total > 0) + { + result.Items = data.Select(c => new Achievement_List_Dto() + { + add_time = c.add_time, + class_id=c.classification_id, + class_name = c.DocClassification?.doc_classification, + id = c.id, + project_id = c.project_id, + project_name = c.DocProject?.ProjectName, + fkpz=c.fkpz_url, + hjzs=c.hjzs_url, + ht=c.ht_url, + yhpj=c.yhpj_url, + ysbg=c.ysbg_url, + zbtzs=c.zbtzs_url, + status = c.status + }).ToList(); + + } + result.PageIndex = page.PageIndex; + result.PageSize = page.PageSize; + result.TotalCount = total; + } + catch (Exception er) + { + Log.Error(er.Message, er); + } + + return new JsonResult(result); + } + + /// <summary> + /// 妫�鏌ラ噸澶� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public async Task<bool> CheckDocAchievementDuplicate(Document_Submit_Dto model) + { + var msg = false; + var ck = await _achievementService.GetFirstAsync(c=>c.status==1 && c.tenant_code==model.tenant_id + && c.project_id==model.project_id && c.classification_id==c.classification_id); + if (ck != null) + { + msg = true; + } + return msg; + } + + /// <summary> + /// 娣诲姞鏁版嵁 + /// </summary> + /// <param name="info"></param> + /// <returns></returns> + public async Task<bool> PostAddDocAchievement(Achievement_Submit_Dto info) + { + Doc_Achievement doc = new Doc_Achievement(); + doc.add_time = DateTime.Now; + doc.classification_id = info.class_id; + doc.project_id = info.project_id; + doc.achievement_name = info.name; + + doc.fkpz_url = info.fkpz; + doc.hjzs_url = info.hjzs; + doc.ht_url = info.ht; + doc.yhpj_url = info.yhpj; + doc.ysbg_url = info.ysbg; + doc.zbtzs_url = info.zbtzs; + + doc.status = 1; + doc.tenant_code = info.tenant_id; + + return await _achievementService.InsertAsync(doc); + } + + #endregion } } -- Gitblit v1.9.1