From c60a7d7b29faba465969555e2a9c69acb8510f90 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 25 二月 2022 09:11:41 +0800
Subject: [PATCH] 如果客户资料中有“*”的内容,生产文书时自动填上,质疑单位默认填写客户名称,可修改

---
 zhengcaioa/Services/ExpertTestTopicService.cs |  422 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 389 insertions(+), 33 deletions(-)

diff --git a/zhengcaioa/Services/ExpertTestTopicService.cs b/zhengcaioa/Services/ExpertTestTopicService.cs
index 36a11e2..2b227c6 100644
--- a/zhengcaioa/Services/ExpertTestTopicService.cs
+++ b/zhengcaioa/Services/ExpertTestTopicService.cs
@@ -65,7 +65,7 @@
                     updateproject.RecStatus = entity.RecStatus;
                     updateproject.Modifier = entity.Modifier;
                     updateproject.Modifytime = entity.Modifytime;
-
+                    updateproject.Jiexi = entity.Jiexi;
                 }
 
 
@@ -103,6 +103,45 @@
                         }
                     }
                 }
+
+
+
+                //瑙f瀽
+
+                var expertTestTopicjiexis = _context.ExpertTestTopicjiexis.Where(x => x.Topic == dto.Id).ToList();
+                if (expertTestTopicjiexis != null && expertTestTopicjiexis.Count > 0)
+                {
+                    foreach (var expertTestTopicjiexi in expertTestTopicjiexis)
+                    {
+                        _context.ExpertTestTopicjiexis.Remove(expertTestTopicjiexi);
+                    }
+                }
+                var Falv = dto.Falv;
+                if (Falv != null && Falv.Length > 0)
+                {
+                    for (int i = 0; i < Falv.Length; i++)
+                    {
+                        if (!string.IsNullOrEmpty(dto.Falv[i]) || !string.IsNullOrEmpty(dto.Fatiao[i]) || !string.IsNullOrEmpty(dto.Fatiaomingxi[i]))
+                        {
+                            ExpertTestTopicjiexi expertTestTopicjiexi = new ExpertTestTopicjiexi();
+
+                            expertTestTopicjiexi.Id = Guid.NewGuid().ToString();
+                            expertTestTopicjiexi.Topic = dto.Id;
+
+
+                            expertTestTopicjiexi.Falv = dto.Falv[i];
+                            expertTestTopicjiexi.Fatiao = dto.Fatiao[i];
+                            expertTestTopicjiexi.Flag = dto.Flag[i];
+                            expertTestTopicjiexi.Jiexi = dto.Fatiaomingxi[i];  
+                            expertTestTopicjiexi.Creater = dto.Modifier;
+                            expertTestTopicjiexi.Createtime = DateTime.Now;
+                            expertTestTopicjiexi.Modifier = dto.Modifier;
+                            expertTestTopicjiexi.Modifytime = DateTime.Now;
+                            _context.ExpertTestTopicjiexis.Add(expertTestTopicjiexi);
+                        }
+                    }
+                }
+
 
 
                 _context.SaveChanges();
@@ -147,8 +186,7 @@
             var listCode = (from a in _context.SysCodeDtls
                             join b in _context.SysCodes
                             on a.CodeId equals b.Id
-                            where a.RecStatus == "A"
-                                          && b.RecStatus == "A"
+                            where  b.RecStatus == "A"
                             select new CodeDataEntity()
                             {
                                 CodeId = b.Id,
@@ -204,28 +242,33 @@
                  into ksssss
                          from kkk in ksssss.DefaultIfEmpty()
 
-
-                         //join ll in ( from  aaa in _context.ExpertTestTopicanwsers.Where(x => x.RecStatus == "A").Select(e => new { Topic = e.Topic, Items = e.Anwserno + " " + e.Anwser + "</br>" }).GroupBy(e => new { e.Topic })
-                         //             let ids = aaa.Select(b => b.Items.ToString()).ToArray()
-
-                         //             select new { Topic = aaa.Key.Topic, Items = String.Join(" ", ids) }
-                         // //.Select(eg => new
-                         // //{
-                         // //    Topic = eg.Key.Topic,
-                         // //    //EmployeeName = eg.First().EmployeeName,
-                         // //    Items = eg.Select(i => i.Anwserno) + " " + eg.Select(i => i.Anwser) + "</br>",
-                         // //})
-                         // )
-                         //on a.Id equals ll.Topic
-                         //  into llsssss
-                         //from llll in llsssss.DefaultIfEmpty()
+                         join l in _context.ExpertTestTopicjiexis
+              on a.Id equals l.Topic
+              into lsssss
+                         from lll in lsssss.DefaultIfEmpty()
 
 
-                         
+                             //join ll in ( from  aaa in _context.ExpertTestTopicanwsers.Where(x => x.RecStatus == "A").Select(e => new { Topic = e.Topic, Items = e.Anwserno + " " + e.Anwser + "</br>" }).GroupBy(e => new { e.Topic })
+                             //             let ids = aaa.Select(b => b.Items.ToString()).ToArray()
+
+                             //             select new { Topic = aaa.Key.Topic, Items = String.Join(" ", ids) }
+                             // //.Select(eg => new
+                             // //{
+                             // //    Topic = eg.Key.Topic,
+                             // //    //EmployeeName = eg.First().EmployeeName,
+                             // //    Items = eg.Select(i => i.Anwserno) + " " + eg.Select(i => i.Anwser) + "</br>",
+                             // //})
+                             // )
+                             //on a.Id equals ll.Topic
+                             //  into llsssss
+                             //from llll in llsssss.DefaultIfEmpty()
 
 
 
-            where a.RecStatus == "A"
+
+
+
+                         where a.RecStatus == "A"
 
                           && (string.IsNullOrWhiteSpace(searchEntity.Topictype) || a.Topictype == searchEntity.Topictype.Trim())
                            && (string.IsNullOrWhiteSpace(searchEntity.Zhishitype) || a.Zhishitype == searchEntity.Zhishitype.Trim())
@@ -233,13 +276,14 @@
                              && (string.IsNullOrWhiteSpace(searchEntity.JiexiStatus) || a.JiexiStatus == searchEntity.JiexiStatus.Trim())
                             && (string.IsNullOrWhiteSpace(searchEntity.ShenpiStatus) || a.ShenpiStatus == searchEntity.ShenpiStatus.Trim())
                              && (string.IsNullOrWhiteSpace(searchEntity.Topic) || a.Topic.Contains(searchEntity.Topic.Trim()))
-                            
+                              && (string.IsNullOrWhiteSpace(searchEntity.Area) || a.Area == searchEntity.Area.Trim())
+
+                               && (string.IsNullOrWhiteSpace(searchEntity.Falv) || lll.Falv == searchEntity.Falv.Trim())
+
+                                && (string.IsNullOrWhiteSpace(searchEntity.shanchuzhishitype) || a.Zhishitype == searchEntity.shanchuzhishitype.Trim()) 
 
 
-
-
-
-                         select new ExpertTestTopicDTO
+                         select  new ExpertTestTopicDTO
                          {
                              Id = a.Id,
                              Topictype = a.Topictype,
@@ -251,6 +295,7 @@
                              ZhongdianName = ggg.Comments,
                              JiexiStatus = a.JiexiStatus,
                              JiexiStatusName  = hhh.Comments,
+                             Jiexi = a.Jiexi,
                              ShenpiStatus = a.ShenpiStatus,
                              ShenpiStatusName = iii.Comments,
                              Area = a.Area,
@@ -265,15 +310,15 @@
                              Modifytime = a.Modifytime,
 
                          }
-                ).OrderByDescending(x => x.Modifytime).ToList();
+                ).Distinct().OrderByDescending(x => x.Modifytime).ToList();
 
-           
+
+             
 
 
 
-                                
-                           //if (searchEntity.totalrows == 0)
-            searchEntity.totalrows = query.Count();
+                //if (searchEntity.totalrows == 0)
+                searchEntity.totalrows = query.Count();
             var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList();
 
             var lianlist11 = lianlist.Select(x => x.Id).ToList();
@@ -286,10 +331,42 @@
 
                 foreach (var quer in querydel)
                 {
-                    lian.Topic += quer.Anwserno + " " + quer.Anwser + " </br>";
+                    if (lian.Topictype != "03")
+                    {
+                        lian.Topic += quer.Anwserno + " " + quer.Anwser + " </br>";
+                    }
+                 
+                    if(quer.Shifouzhengqu == "A")
+                    {
+                        lian.Anwsers += quer.Anwserno ;
+                    }
+                    
                 }
             }
 
+
+            var queryjiexis = (from aaa in _context.ExpertTestTopicjiexis.Where(x => x.RecStatus == "A" && lianlist11.Contains(x.Topic)) select aaa).ToList();
+            var falvs = listCode.Where(x => x.CodeTable == "expert_test_topicjiexi" && x.CodeField == "falv").ToList();
+            foreach (var lian in lianlist)
+            {
+                var queryjiexi = queryjiexis.Where(x => x.Topic == lian.Id).OrderBy(x => x.Flag).ToList();
+                var jiexi = "";
+                foreach (var quer in queryjiexi)
+                {
+                 var falv = falvs.Where(x => x.CodeSn == quer.Falv).FirstOrDefault();
+
+                    jiexi +=(falv!=null? "銆�" + falv.Comments + "銆�" : "") + " " + quer.Fatiao + " " + quer.Jiexi + " </br>" ;
+                }
+                if (string.IsNullOrEmpty(lian.Jiexi))
+                {
+                    lian.Jiexi = jiexi;
+                }
+                else
+                {
+                    lian.Jiexi = jiexi + lian.Jiexi + " </br>";
+                }
+               
+            }
 
             data.LoadData(searchEntity, lianlist);
             return data;
@@ -330,9 +407,31 @@
         /// <returns></returns>
         public List<ExpertTestTopicDTO> GetList()
         {
+            var listCode = (from a in _context.SysCodeDtls
+                            join b in _context.SysCodes
+                            on a.CodeId equals b.Id
+                            where a.RecStatus == "A" &&  b.RecStatus == "A"
+                            select new CodeDataEntity()
+                            {
+                                CodeId = b.Id,
+                                CodeTable = b.CodeTable,
+                                CodeField = b.CodeField,
+                                CodeSn = a.CodeSn,
+                                Comments = a.Comments,
+                                Contents = a.Contents,
+                                RecStatus = a.RecStatus,
+                                Sort = a.Sort
+                            }
+                              );
 
-
-            var listRole = _context.ExpertTestTopics.Where(r => r.RecStatus == "A").ToList();
+            var listRole = 
+                 ( from a in _context.ExpertTestTopics.Where(r => r.RecStatus == "A")
+                   join f in listCode.Where(x => x.CodeTable == "expert_test_topic" && x.CodeField == "zhishitype")
+                    on a.Zhishitype equals f.CodeSn
+                 
+                   
+                   
+                   select a ).ToList();
 
 
             var list = _mapper.Map<List<ExpertTestTopicDTO>>(listRole);
@@ -666,5 +765,262 @@
 
             return result;
         }
+
+
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夋湁鏁堣鑹�
+        /// </summary>
+        /// <returns></returns>
+        public List<ExpertTestResultDTO> GetListResult()
+        {
+            var listCode = (from a in _context.SysCodeDtls
+                            join b in _context.SysCodes
+                            on a.CodeId equals b.Id
+                            where a.RecStatus == "A"
+                                          && b.RecStatus == "A"
+                            select new CodeDataEntity()
+                            {
+                                CodeId = b.Id,
+                                CodeTable = b.CodeTable,
+                                CodeField = b.CodeField,
+                                CodeSn = a.CodeSn,
+                                Comments = a.Comments,
+                                Contents = a.Contents,
+                                RecStatus = a.RecStatus,
+                                Sort = a.Sort
+                            }
+                             );
+
+            var listRole = (from a in _context.ExpertTestResults
+
+                            join e in listCode.Where(x => x.CodeTable == "expert_test_result" && x.CodeField == "resulttype")
+                     on a.Resulttype equals e.CodeSn
+                     into esssss
+                            from eee in esssss.DefaultIfEmpty()
+
+                           
+
+                            where a.RecStatus == "A"
+                              //&& (string.IsNullOrWhiteSpace(topicId) || a.Topic == topicId.Trim())
+                            select new ExpertTestResultDTO
+                            {
+                                Id = a.Id,
+                                Resulttype = a.Resulttype,
+                                
+                                ResulttypeName = eee.Comments,
+                                Result = a.Result,
+                                
+
+                                Creater = a.Creater,
+                                Createtime = a.Createtime,
+
+                                RecStatus = a.RecStatus,
+                                Modifier = a.Modifier,
+                                Modifytime = a.Modifytime,
+
+                            }
+                ).OrderBy(x => x.Resulttype).ToList();
+
+            return listRole;
+        }
+
+
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夋湁鏁堣鑹�
+        /// </summary>
+        /// <returns></returns>
+        public List<ExpertTestTopicpeizhiDTO> GetListpeizhi()
+        {
+            var listCode = (from a in _context.SysCodeDtls
+                            join b in _context.SysCodes
+                            on a.CodeId equals b.Id
+                            where a.RecStatus == "A"
+                                          && b.RecStatus == "A"
+                            select new CodeDataEntity()
+                            {
+                                CodeId = b.Id,
+                                CodeTable = b.CodeTable,
+                                CodeField = b.CodeField,
+                                CodeSn = a.CodeSn,
+                                Comments = a.Comments,
+                                Contents = a.Contents,
+                                RecStatus = a.RecStatus,
+                                Sort = a.Sort
+                            }
+                             );
+
+            var listRole = (from a in _context.ExpertTestTopicpeizhis
+
+                            join e in listCode.Where(x => x.CodeTable == "expert_test_topic" && x.CodeField == "topictype")
+                     on a.Topictype equals e.CodeSn
+                     into esssss
+                            from eee in esssss.DefaultIfEmpty()
+
+                            join f in listCode.Where(x => x.CodeTable == "expert_test_topic" && x.CodeField == "zhishitype")
+                       on a.Zhishitype equals f.CodeSn
+                       //into fsssss
+                       //     from fff in fsssss.DefaultIfEmpty()
+
+
+                            where a.RecStatus == "A"
+                              //&& (string.IsNullOrWhiteSpace(topicId) || a.Topic == topicId.Trim())
+                            select new ExpertTestTopicpeizhiDTO
+                            {
+                                Id = a.Id,
+                                ShijianId = a.ShijianId,
+                                Topictype = a.Topictype,
+                                TopictypeName = eee.Comments,
+                                Zhishitype = a.Zhishitype,
+                                ZhishitypeName = f.Comments,
+                                Fenshu = a.Fenshu ?? 0,
+                                Fenzhi = a.Fenzhi??0,
+                                FenshuName = (a.Fenshu ?? 0).ToString("0.##"),
+                                FenzhiName = (a.Fenzhi ?? 0).ToString("0.##"),
+                                Creater = a.Creater,
+                                Createtime = a.Createtime,
+
+                                RecStatus = a.RecStatus,
+                                Modifier = a.Modifier,
+                                Modifytime = a.Modifytime,
+
+                            }
+                ).OrderBy(x => x.Topictype).ThenBy(x => x.Zhishitype).ToList();
+
+            return listRole;
+        }
+
+
+        public ResultEntity saveResult(ExpertTestResultDTO dto)
+        {
+            ResultEntity resultEntity = new ResultEntity();
+            try
+            {
+
+
+                var entity = _mapper.Map<ExpertTestResult>(dto);
+
+
+                if (String.IsNullOrEmpty(entity.Id))
+                {
+                    entity.Id = Guid.NewGuid().ToString();
+                    dto.Id = entity.Id;
+                    _context.ExpertTestResults.Add(entity);
+                }
+                else
+                {
+                    var updateproject = _context.ExpertTestResults.Find(entity.Id);
+
+                    updateproject.Resulttype = entity.Resulttype;
+                    updateproject.Result = entity.Result;
+
+
+                     
+
+
+                    updateproject.RecStatus = entity.RecStatus;
+                    updateproject.Modifier = entity.Modifier;
+                    updateproject.Modifytime = entity.Modifytime;
+
+                }
+
+                _context.SaveChanges();
+                resultEntity.ReturnID = entity.Id;
+                resultEntity.Result = true;
+            }
+            catch (Exception ex)
+            {
+                resultEntity.Result = false;
+                resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�";
+
+            }
+            return resultEntity;
+        }
+
+
+
+        public ResultEntity savepeizhi(ExpertTestTopicpeizhiDTO dto)
+        {
+            ResultEntity resultEntity = new ResultEntity();
+            try
+            {
+
+
+                var entity = _mapper.Map<ExpertTestTopicpeizhi>(dto);
+
+
+                if (String.IsNullOrEmpty(entity.Id))
+                {
+                    entity.Id = Guid.NewGuid().ToString();
+                    dto.Id = entity.Id;
+                    _context.ExpertTestTopicpeizhis.Add(entity);
+                }
+                else
+                {
+                    var updateproject = _context.ExpertTestTopicpeizhis.Find(entity.Id);
+
+                    updateproject.ShijianId = entity.ShijianId;
+                    updateproject.Topictype = entity.Topictype;
+                    updateproject.Zhishitype = entity.Zhishitype;
+                    updateproject.Fenshu = entity.Fenshu;
+                    updateproject.Fenzhi = entity.Fenzhi;
+
+
+
+
+
+                    updateproject.RecStatus = entity.RecStatus;
+                    updateproject.Modifier = entity.Modifier;
+                    updateproject.Modifytime = entity.Modifytime;
+
+                }
+
+                _context.SaveChanges();
+                resultEntity.ReturnID = entity.Id;
+                resultEntity.Result = true;
+            }
+            catch (Exception ex)
+            {
+                resultEntity.Result = false;
+                resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�";
+
+            }
+            return resultEntity;
+        }
+
+
+
+        public ExpertTestResultDTO GetResult(string Resulttype)
+        {
+
+            var entity = _context.ExpertTestResults.Where(x=>x.RecStatus =="A" && x.Resulttype == Resulttype).FirstOrDefault();
+
+            if (entity==null)
+            {
+                entity = new ExpertTestResult();
+            }
+
+            var result = _mapper.Map<ExpertTestResultDTO>(entity);
+
+
+            return result;
+        }
+
+
+        public ExpertTestTopicpeizhiDTO Getpeizhi(string Topictype, string Zhishitype)
+        {
+
+            var entity = _context.ExpertTestTopicpeizhis.Where(x => x.RecStatus == "A" && x.Topictype == Topictype && x.Zhishitype == Zhishitype).FirstOrDefault();
+
+            if (entity == null)
+            {
+                entity = new ExpertTestTopicpeizhi();
+            }
+
+            var result = _mapper.Map<ExpertTestTopicpeizhiDTO>(entity);
+
+
+            return result;
+        }
+
     }
 }

--
Gitblit v1.9.1