From 402f9568e48e6e1a9d29d37dcda46737047425d5 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 25 十一月 2021 10:49:10 +0800 Subject: [PATCH] 专家通讯录优化 --- zhengcaioa/Services/ExpertService.cs | 157 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 149 insertions(+), 8 deletions(-) diff --git a/zhengcaioa/Services/ExpertService.cs b/zhengcaioa/Services/ExpertService.cs index 786f74b..2721acd 100644 --- a/zhengcaioa/Services/ExpertService.cs +++ b/zhengcaioa/Services/ExpertService.cs @@ -25,13 +25,42 @@ ResultEntity resultEntity = new ResultEntity(); try { - var list = _context.Experts.Where(e => e.IdCard == expertDTO.IdCard && e.RecStatus == "A" && e.Id != expertDTO.Id).ToList(); - if (list.Count > 0 ) + if (!string.IsNullOrEmpty(expertDTO.IdCard)) { - resultEntity.Result = false; - resultEntity.Message = "璇ヤ笓瀹朵俊鎭凡缁忓瓨鍦�"; - return resultEntity; + var list = _context.Experts.Where(e => e.IdCard == expertDTO.IdCard && e.RecStatus == "A" && e.Id != expertDTO.Id).ToList(); + if (list.Count > 0) + { + resultEntity.Result = false; + resultEntity.Message = "璇ヤ笓瀹惰韩浠借瘉淇℃伅宸茬粡瀛樺湪"; + return resultEntity; + } } + + if (!string.IsNullOrEmpty(expertDTO.Phone1)) + { + var list = _context.Experts.Where(e => e.Phone1 == expertDTO.Phone1 && e.RecStatus == "A" && e.Id != expertDTO.Id).ToList(); + if (list.Count > 0) + { + resultEntity.Result = false; + resultEntity.Message = "璇ヤ笓瀹惰仈绯荤數璇濅俊鎭凡缁忓瓨鍦�"; + return resultEntity; + } + } + + if (!string.IsNullOrEmpty(expertDTO.CertiNumber)) + { + var list = _context.Experts.Where(e => e.CertiNumber == expertDTO.CertiNumber && e.RecStatus == "A" && e.Id != expertDTO.Id).ToList(); + if (list.Count > 0) + { + resultEntity.Result = false; + resultEntity.Message = "璇ヤ笓瀹朵笓瀹惰瘉鍙蜂俊鎭凡缁忓瓨鍦�"; + return resultEntity; + } + } + + + + Expert expert = _mapper.Map<Expert>(expertDTO); if (string.IsNullOrEmpty(expert.Id)) { @@ -80,6 +109,7 @@ updateplExpert.ShenheStatus = expert.ShenheStatus; updateplExpert.Modifier = expert.Modifier; updateplExpert.Modifytime = expert.Modifytime; + updateplExpert.YearJiou = expert.YearJiou; } _context.SaveChanges(); @@ -166,6 +196,12 @@ from ooo in osssss.DefaultIfEmpty() + join p in listCode.Where(x => x.CodeTable == "experts" && x.CodeField == "year_jiou") + on a.YearJiou equals p.CodeSn + into psss + from ppp in psss.DefaultIfEmpty() + + where a.RecStatus == "A" && (searchEntity.JoinCount<=0 || hhh.JoinCount >= searchEntity.JoinCount) select new ExpertDTO @@ -210,7 +246,8 @@ ShenheStatus = a.ShenheStatus, AreaName = nnn.Name + "-" + ooo.Name, - + YearJiou = a.YearJiou, + YearJiouName = ppp.Comments, }).ToList(); @@ -266,9 +303,12 @@ { query = query.Where(m => m.Creater == searchEntity.Creater).ToList(); } - + if (!string.IsNullOrEmpty(searchEntity.YearJiou)) + { + query = query.Where(m => m.YearJiou == searchEntity.YearJiou).ToList(); + } - query = query.OrderByDescending(x => x.Modifytime).ToList(); + query = query.OrderByDescending(x => x.Modifytime).ToList(); //if (searchEntity.totalrows == 0) searchEntity.totalrows = query.Count(); var expertlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); @@ -677,5 +717,106 @@ var exDTO = _mapper.Map<ExpertOrderDipatchDTO>(entity); return exDTO; } + + + public ResultEntity IdCardChongfu(string IdCard = "", string Id = "") + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = true; + try + { + if (!string.IsNullOrEmpty(IdCard)) + { + var list = _context.Experts.Where(e => e.IdCard == IdCard && e.RecStatus == "A" && e.Id != Id).ToList(); + if (list.Count > 0) + { + resultEntity.Result = false; + resultEntity.Message = "璇ヤ笓瀹惰韩浠借瘉淇℃伅宸茬粡瀛樺湪"; + return resultEntity; + } + } + + + + + + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "鏌ヨ澶辫触锛岃鑱旂郴绠$悊鍛�"; + ex.Message.ToString(); + } + return resultEntity; + } + + public ResultEntity CertiNumberChongfu(string CertiNumber = "", string Id = "") + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = true; + try + { + + + + + if (!string.IsNullOrEmpty(CertiNumber)) + { + var list = _context.Experts.Where(e => e.CertiNumber == CertiNumber && e.RecStatus == "A" && e.Id != Id).ToList(); + if (list.Count > 0) + { + resultEntity.Result = false; + resultEntity.Message = "璇ヤ笓瀹朵笓瀹惰瘉鍙蜂俊鎭凡缁忓瓨鍦�"; + return resultEntity; + } + } + + + + + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "鏌ヨ澶辫触锛岃鑱旂郴绠$悊鍛�"; + ex.Message.ToString(); + } + return resultEntity; + } + + + public ResultEntity Phone1Chongfu(string Phone1 = "", string Id = "") + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = true; + try + { + + + if (!string.IsNullOrEmpty(Phone1)) + { + var list = _context.Experts.Where(e => e.Phone1 == Phone1 && e.RecStatus == "A" && e.Id != Id).ToList(); + if (list.Count > 0) + { + resultEntity.Result = false; + resultEntity.Message = "璇ヤ笓瀹惰仈绯荤數璇濅俊鎭凡缁忓瓨鍦�"; + return resultEntity; + } + } + + + + + + + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "鏌ヨ澶辫触锛岃鑱旂郴绠$悊鍛�"; + ex.Message.ToString(); + } + return resultEntity; + } } } -- Gitblit v1.9.1