From 90858c80d9921b555119f41060c1f883f6e6ffc5 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 26 十二月 2024 12:49:35 +0800 Subject: [PATCH] 提交 --- DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs | 394 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 391 insertions(+), 3 deletions(-) diff --git a/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs b/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs index d1486e9..d440eea 100644 --- a/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs +++ b/DocumentServiceAPI.Application/DocManage/DocumentManageAppService.cs @@ -23,9 +23,11 @@ private readonly ProjectManageService _projectService; private readonly DocAchievementService _achievementService; private readonly IRedisCacheService _redisCache; + private readonly DocShebeinengliService _shebeinengliService; public DocumentManageAppService(DocClassificationService classService, DocumentManageService docService, OrganizationService orgService, - FileManageService fileManageService, ProjectManageService projectService, DocAchievementService achievementService, IRedisCacheService redisCase) + FileManageService fileManageService, ProjectManageService projectService, DocAchievementService achievementService, IRedisCacheService redisCase + , DocShebeinengliService shebeinengliService) { _classificationService = classService; _docManageService = docService; @@ -33,6 +35,7 @@ _fileManageService = fileManageService; _projectService = projectService; _achievementService = achievementService; + _shebeinengliService = shebeinengliService; _redisCache = redisCase; } @@ -105,6 +108,16 @@ } return new JsonResult(data.OrderBy(x => x.sort).Select(c => new { name = c.achievement_name, idcode = c.id+ "/002" }).ToList()); + } + else if (search.Code == "006") + { + var data = await _shebeinengliService.GetListAsync(c => c.status == 1 && 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.OrderBy(x => x.sort).Select(c => new { name = c.shebeinengli_name, idcode = c.id + "/006" }).ToList()); } else { @@ -204,6 +217,9 @@ project_name = c.DocProject?.ProjectName, status = c.status, sort = c.sort, + zb_time = c.zb_time.HasValue ? c.zb_time.Value.ToString("yyyy/MM/dd") : "", + zige_code = c.zige_code, + zige_code_name = c.document_Dictionary?.Name }).ToList(); } @@ -256,6 +272,8 @@ doc.status = info.status; doc.tenant_code = info.tenant_id; doc.sort = info.sort; + doc.zb_time = info.zb_time; + doc.zige_code = info.zige_code; var id =await _docManageService.InsertReturnIdentityAsync(doc); if (id > 0) @@ -304,6 +322,8 @@ doc.org_id = info.org_id; doc.status = info.status; doc.sort = info.sort; + doc.zb_time = info.zb_time; + doc.zige_code = info.zige_code; if (await _docManageService.UpdateAsync(doc)) { //鏂版彁浜ょ殑鏂囦欢 @@ -464,6 +484,62 @@ return new JsonResult(list_Dtos); } + else if (code == "006") + { + var data = await _shebeinengliService.GetByIdAsync(id); + List<FileInfo_List_Dto> list_Dtos = new List<FileInfo_List_Dto>(); + if (data != null) + { + if (!string.IsNullOrEmpty(data.sbzp_url) && data.sbzp_fuhe > 0) + { + FileInfo_List_Dto fileInfo_List_Dto = new FileInfo_List_Dto(); + fileInfo_List_Dto.filePath = data.sbzp_url; + fileInfo_List_Dto.fileNewName = "璁惧鐓х墖"; + fileInfo_List_Dto.suffix = Path.GetExtension(data.sbzp_url); + list_Dtos.Add(fileInfo_List_Dto); + } + + if (!string.IsNullOrEmpty(data.gmht_url) && data.gmht_fuhe > 0) + { + FileInfo_List_Dto fileInfo_List_Dto = new FileInfo_List_Dto(); + fileInfo_List_Dto.filePath = data.gmht_url; + fileInfo_List_Dto.fileNewName = "璐拱鍚堝悓"; + fileInfo_List_Dto.suffix = Path.GetExtension(data.gmht_url); + list_Dtos.Add(fileInfo_List_Dto); + } + + if (!string.IsNullOrEmpty(data.fp_url) && data.fp_fuhe > 0) + { + FileInfo_List_Dto fileInfo_List_Dto = new FileInfo_List_Dto(); + fileInfo_List_Dto.filePath = data.fp_url; + fileInfo_List_Dto.fileNewName = "鍙戠エ"; + fileInfo_List_Dto.suffix = Path.GetExtension(data.fp_url); + list_Dtos.Add(fileInfo_List_Dto); + } + + if (!string.IsNullOrEmpty(data.fkpz_url) && data.fkpz_fuhe > 0) + { + FileInfo_List_Dto fileInfo_List_Dto = new FileInfo_List_Dto(); + fileInfo_List_Dto.filePath = data.fkpz_url; + fileInfo_List_Dto.fileNewName = "浠樻鍑瘉"; + fileInfo_List_Dto.suffix = Path.GetExtension(data.fkpz_url); + list_Dtos.Add(fileInfo_List_Dto); + } + + if (!string.IsNullOrEmpty(data.csmp_url) && data.csmp_fuhe > 0) + { + FileInfo_List_Dto fileInfo_List_Dto = new FileInfo_List_Dto(); + fileInfo_List_Dto.filePath = data.csmp_url; + fileInfo_List_Dto.fileNewName = "鍙傛暟锛堥摥鐗岋級"; + fileInfo_List_Dto.suffix = Path.GetExtension(data.csmp_url); + list_Dtos.Add(fileInfo_List_Dto); + } + } + + + + return new JsonResult(list_Dtos); + } else { var data = await _fileManageService.GetListAsync(c => c.status == 1 && c.doc_id == id); @@ -605,6 +681,7 @@ zbtzs=c.zbtzs_url, status = c.status, sort = c.sort, + zb_time = c.zb_time.HasValue? c.zb_time.Value.ToString("yyyy/MM/dd") :"", }).ToList(); } @@ -629,10 +706,10 @@ { var msg = false; var ck = await _achievementService.GetFirstAsync(c=>c.status==1 && c.tenant_code==model.tenant_id - && c.achievement_name==model.name && c.classification_id==c.classification_id); + && c.achievement_name==model.name && c.classification_id== model.class_id); if (ck != null) { - if(model.id>0 && model.id != ck.id) + if (model.id <= 0 || (model.id > 0 && model.id != ck.id)) { msg = true; } @@ -671,6 +748,7 @@ doc.status = 1; doc.tenant_code = info.tenant_id; doc.sort = info.sort; + doc.zb_time = info.zb_time; return await _achievementService.UpdateAsync(doc); } else @@ -691,6 +769,7 @@ doc.status = 1; doc.tenant_code = info.tenant_id; doc.sort = info.sort; + doc.zb_time = info.zb_time; return await _achievementService.InsertAsync(doc); } @@ -739,6 +818,7 @@ achievement_Submit_Dto.tenant_id = data.tenant_code; achievement_Submit_Dto.status = data.status; achievement_Submit_Dto.sort = data.sort; + achievement_Submit_Dto.zb_time = data.zb_time; return new JsonResult(achievement_Submit_Dto); @@ -748,5 +828,313 @@ } #endregion + + + + #region 璁惧鑳藉姏 + + /// <summary> + /// 鏍规嵁鍒嗛〉鏉′欢鏌ヨ鍒嗛〉鏁版嵁 + /// </summary> + /// <param name="page"></param> + /// <returns></returns> + public async Task<IActionResult> PostShebeinengliListPage(DocumentPageSearch page) + { + PageResult<Achievement_List_Dto> result = new PageResult<Achievement_List_Dto>(); + + try + { + Expression<Func<Doc_Shebeinengli, 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.shebeinengli_name.Contains(page.Name)); + } + if (page.sbzp.HasValue) + { + if (page.sbzp == 1) + { + expression = expression.And(t => t.sbzp_url != null); + } + else + { + expression = expression.And(t => t.sbzp_url == null); + } + + } + if (page.gmht.HasValue) + { + if (page.gmht == 1) + { + expression = expression.And(t => t.gmht_url != null); + } + else + { + expression = expression.And(t => t.gmht_url == null); + } + + } + + if (page.fp.HasValue) + { + if (page.fp == 1) + { + expression = expression.And(t => t.fp_url != null); + } + else + { + expression = expression.And(t => t.fp_url == null); + } + + } + + if (page.fkpz.HasValue) + { + if (page.fkpz == 1) + { + expression = expression.And(t => t.fkpz_url != null); + } + else + { + expression = expression.And(t => t.fkpz_url == null); + } + + } + + if (page.csmp.HasValue) + { + if (page.csmp == 1) + { + expression = expression.And(t => t.csmp_url != null); + } + else + { + expression = expression.And(t => t.csmp_url == null); + } + + } + + + + RefAsync<int> total = 0; + var data = await _shebeinengliService.Context.Queryable<Doc_Shebeinengli>() + .Includes(c => c.DocClassification) + //.Includes(c => c.DocProject) + .Where(expression) + .OrderBy(c => c.sort) + .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.shebeinengli_name,//c.DocProject?.ProjectName, + + sbzp = c.sbzp_url, + gmht = c.gmht_url, + fp = c.fp_url, + fkpz = c.fkpz_url, + csmp = c.csmp_url, + status = c.status, + sort = c.sort, + zb_time = c.zb_time.HasValue ? c.zb_time.Value.ToString("yyyy/MM/dd") : "", + zige_code = (c.sbzp_zige.HasValue&& c.sbzp_zige >0 ) + || (c.gmht_zige.HasValue && c.gmht_zige > 0) + || (c.fp_zige.HasValue && c.fp_zige > 0) + || (c.fkpz_zige.HasValue && c.fkpz_zige > 0) + || (c.csmp_zige.HasValue && c.csmp_zige > 0) ? 1:null, + }).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> CheckDocShebeinengliDuplicate(Document_Submit_Dto model) + { + var msg = false; + var ck = await _shebeinengliService.GetFirstAsync(c => c.status == 1 && c.tenant_code == model.tenant_id + && c.shebeinengli_name == model.name && c.classification_id == model.class_id); + if (ck != null) + { + if (model.id <= 0 || (model.id > 0 && model.id != ck.id)) + { + msg = true; + } + else + { + msg = false; + } + + } + return msg; + } + + /// <summary> + /// 娣诲姞鏁版嵁 + /// </summary> + /// <param name="info"></param> + /// <returns></returns> + public async Task<bool> PostAddDocShebeinengli(Achievement_Submit_Dto info) + { + if (info.id > 0) + { + Doc_Shebeinengli doc = new Doc_Shebeinengli(); + doc.id = info.id; + doc.add_time = DateTime.Now; + doc.classification_id = info.class_id; + doc.project_id = info.project_id; + doc.shebeinengli_name = info.name; + + + doc.sbzp_url = info.sbzp; + doc.gmht_url = info.gmht; + doc.fp_url = info.fp; + doc.fkpz_url = info.fkpz; + doc.csmp_url = info.csmp; + + doc.status = 1; + doc.tenant_code = info.tenant_id; + doc.sort = info.sort; + doc.zb_time = info.zb_time; + doc.zige_code = info.zige_code; + + doc.sbzp_zige = info.sbzp_zige; + doc.gmht_zige = info.gmht_zige; + doc.fp_zige = info.fp_zige; + doc.fkpz_zige = info.fkpz_zige; + doc.csmp_zige = info.csmp_zige; + + doc.sbzp_fuhe = info.sbzp_fuhe; + doc.gmht_fuhe = info.gmht_fuhe; + doc.fp_fuhe = info.fp_fuhe; + doc.fkpz_fuhe = info.fkpz_fuhe; + doc.csmp_fuhe = info.csmp_fuhe; + + return await _shebeinengliService.UpdateAsync(doc); + } + else + { + Doc_Shebeinengli doc = new Doc_Shebeinengli(); + doc.add_time = DateTime.Now; + doc.classification_id = info.class_id; + doc.project_id = info.project_id; + doc.shebeinengli_name = info.name; + + doc.sbzp_url = info.sbzp; + doc.gmht_url = info.gmht; + doc.fp_url = info.fp; + doc.fkpz_url = info.fkpz; + doc.csmp_url = info.csmp; + + doc.status = 1; + doc.tenant_code = info.tenant_id; + doc.sort = info.sort; + doc.zb_time = info.zb_time; + doc.zige_code = info.zige_code; + + doc.sbzp_zige = info.sbzp_zige; + doc.gmht_zige = info.gmht_zige; + doc.fp_zige = info.fp_zige; + doc.fkpz_zige = info.fkpz_zige; + doc.csmp_zige = info.csmp_zige; + + doc.sbzp_fuhe = info.sbzp_fuhe; + doc.gmht_fuhe = info.gmht_fuhe; + doc.fp_fuhe = info.fp_fuhe; + doc.fkpz_fuhe = info.fkpz_fuhe; + doc.csmp_fuhe = info.csmp_fuhe; + + return await _shebeinengliService.InsertAsync(doc); + } + + } + + + + /// <summary> + /// 鍒犻櫎鏂囨。鏁版嵁 + /// </summary> + /// <param name="doc"></param> + /// <returns></returns> + public async Task<IActionResult> PostDelShebeinengli(Achievement_Submit_Dto doc) + { + bool msg = false; + var sss = new Doc_Shebeinengli(); + sss.id = doc.id; + + msg = await _shebeinengliService.DeleteAsync(sss); + return new JsonResult(msg); + } + + + /// <summary> + /// 鏍规嵁鏂囨。鍙锋煡璇� + /// </summary> + /// <param name="search"></param> + /// <returns></returns> + public async Task<IActionResult> PostShebeinengliInfo(DocumentSearch search) + { + var data = await _shebeinengliService.GetFirstAsync(c => c.id == search.ID && c.tenant_code == search.TenantID); + if (data != null) + { + Achievement_Submit_Dto achievement_Submit_Dto = new Achievement_Submit_Dto(); + achievement_Submit_Dto.id = data.id; + achievement_Submit_Dto.class_id = data.classification_id.Value; + //achievement_Submit_Dto.project_id = data.project_id.Value; + achievement_Submit_Dto.name = data.shebeinengli_name; + achievement_Submit_Dto.sbzp = data.sbzp_url; + achievement_Submit_Dto.gmht = data.gmht_url; + achievement_Submit_Dto.fp = data.fp_url; + achievement_Submit_Dto.fkpz = data.fkpz_url; + achievement_Submit_Dto.csmp = data.csmp_url; + achievement_Submit_Dto.tenant_id = data.tenant_code; + achievement_Submit_Dto.status = data.status; + achievement_Submit_Dto.sort = data.sort; + achievement_Submit_Dto.zb_time = data.zb_time; + achievement_Submit_Dto.zige_code = data.zige_code; + + achievement_Submit_Dto.sbzp_zige = data.sbzp_zige; + achievement_Submit_Dto.gmht_zige = data.gmht_zige; + achievement_Submit_Dto.fp_zige = data.fp_zige; + achievement_Submit_Dto.fkpz_zige = data.fkpz_zige; + achievement_Submit_Dto.csmp_zige = data.csmp_zige; + + achievement_Submit_Dto.sbzp_fuhe = data.sbzp_fuhe; + achievement_Submit_Dto.gmht_fuhe = data.gmht_fuhe; + achievement_Submit_Dto.fp_fuhe = data.fp_fuhe; + achievement_Submit_Dto.fkpz_fuhe = data.fkpz_fuhe; + achievement_Submit_Dto.csmp_fuhe = data.csmp_fuhe; + + return new JsonResult(achievement_Submit_Dto); + } + + return null; + } + + #endregion } } -- Gitblit v1.9.1