From 60e78c332cd5597f955e150e1a5f239db8facc59 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 15 十月 2021 15:41:47 +0800
Subject: [PATCH] 题库规则和测试结论

---
 zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs |  218 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 218 insertions(+), 0 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs
index 66ac251..12a24d0 100644
--- a/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs
@@ -134,7 +134,12 @@
             if (!String.IsNullOrEmpty(id))
             {
                 dto = _expertTestTopicService.Get(id);
+               
                 expertTestTopicanwserDTOs = _expertTestTopicService.GetListanwser(id);
+                if (dto.Topictype=="03")
+                {
+                    expertTestTopicanwserDTOs = expertTestTopicanwserDTOs.OrderByDescending(x=>x.Anwserno).ToList();
+                }
                 if (expertTestTopicanwserDTOs.Count == 0)
                 {
                     expertTestTopicanwserDTOs.Add(new ExpertTestTopicanwserDTO());
@@ -631,5 +636,218 @@
 
             return View();
         }
+
+
+
+        public IActionResult EditResult()
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            var resultDTOs = _expertTestTopicService.GetListResult();
+            var sysCodeDtls = _liaotianService.GetSYScode("expert_test_result", "resulttype");
+
+            if (resultDTOs==null || resultDTOs.Count == 0)
+            {
+                resultDTOs = new List<ExpertTestResultDTO>();
+                foreach (var sysCodeDtl in sysCodeDtls)
+                {
+                    ExpertTestResultDTO expertTestResultDTO = new ExpertTestResultDTO();
+                    expertTestResultDTO.Resulttype = sysCodeDtl.CodeSn;
+                    expertTestResultDTO.ResulttypeName = sysCodeDtl.Comments;
+                    expertTestResultDTO.Result = "";
+                    resultDTOs.Add(expertTestResultDTO);
+                }
+            }
+
+
+
+
+            ViewBag.resultDTOs = resultDTOs;
+
+
+            ViewBag.resulttype = sysCodeDtls;
+
+            return View();
+        }
+
+
+        /// <summary>
+        /// 淇濆瓨
+        /// </summary>
+        /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
+        /// <returns></returns>
+        /// 
+        [HttpPost]
+        public  IActionResult SaveResult(ExpertTestResultDTO data)
+        {
+
+            ResultEntity resultEntity = new ResultEntity();
+
+          
+
+            using (TransactionScope scope = new TransactionScope())
+            {
+                var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+                ViewData["curentuser"] = curentuser;
+                data.RecStatus = "A";
+                if(data.Resulttypes!=null&& data.Resulttypes.Length > 0)
+                {
+                   for(int i=0;i< data.Resulttypes.Length; i++)
+                    {
+                      var resultDTO = _expertTestTopicService.GetResult(data.Resulttypes[i]);
+                        if (string.IsNullOrEmpty(resultDTO.Id))
+                        {
+                            resultDTO = new ExpertTestResultDTO();
+                            resultDTO.Resulttype = data.Resulttypes[i];
+                            resultDTO.Result = data.Results[i];
+                            resultDTO.Creater = curentuser.Id;
+                            resultDTO.Createtime = DateTime.Now;
+                        }
+                        else
+                        {
+                            resultDTO.Resulttype = data.Resulttypes[i];
+                            resultDTO.Result = data.Results[i];
+                        }
+                        resultDTO.Modifier = curentuser.Id;
+                        resultDTO.Modifytime = DateTime.Now;
+
+                        resultEntity = _expertTestTopicService.saveResult(resultDTO);
+                    }
+                }
+                scope.Complete();
+            }
+
+
+            return new JsonResult(resultEntity);
+        }
+
+
+        public IActionResult EditPeizhi()
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            var expertTestTopicpeizhiDTOs = _expertTestTopicService.GetListpeizhi();
+            var topictypes = _liaotianService.GetSYScode("expert_test_topic", "topictype");
+            var zhishitypes = _liaotianService.GetSYScode("expert_test_topic", "zhishitype");
+
+            if (expertTestTopicpeizhiDTOs == null || expertTestTopicpeizhiDTOs.Count == 0)
+            {
+                expertTestTopicpeizhiDTOs = new List<ExpertTestTopicpeizhiDTO>();
+                foreach (var topictype in topictypes)
+                {
+                    foreach (var zhishitype in zhishitypes)
+                    {
+                        ExpertTestTopicpeizhiDTO expertTestTopicpeizhiDTO = new ExpertTestTopicpeizhiDTO();
+                        expertTestTopicpeizhiDTO.ShijianId = "01";
+                        expertTestTopicpeizhiDTO.Topictype = topictype.CodeSn;
+                        expertTestTopicpeizhiDTO.TopictypeName = topictype.Comments;
+
+                        expertTestTopicpeizhiDTO.Zhishitype = zhishitype.CodeSn;
+                        expertTestTopicpeizhiDTO.ZhishitypeName = zhishitype.Comments;
+
+                        expertTestTopicpeizhiDTO.Fenshu = 0;
+                        expertTestTopicpeizhiDTO.Fenzhi = 0;
+                        expertTestTopicpeizhiDTO.FenshuName = "0";
+                        expertTestTopicpeizhiDTO.FenzhiName = "0";
+                        expertTestTopicpeizhiDTO.zongFenshu = "0";
+                        expertTestTopicpeizhiDTO.zongFenzhi = "0";
+                        expertTestTopicpeizhiDTOs.Add(expertTestTopicpeizhiDTO);
+                    }
+                }
+
+            }
+            else
+            {
+                foreach (var expertTestTopicpeizhiDTO in expertTestTopicpeizhiDTOs)
+                {
+                    var aaaa  = expertTestTopicpeizhiDTOs.Where(x => x.Topictype == expertTestTopicpeizhiDTO.Topictype).Sum(x => x.Fenshu);
+                    expertTestTopicpeizhiDTO.zongFenshu = aaaa.HasValue? aaaa.Value.ToString("0.##"):"";
+                    expertTestTopicpeizhiDTO.zongFenzhi = expertTestTopicpeizhiDTO.Fenzhi.HasValue ? expertTestTopicpeizhiDTO.Fenzhi.Value.ToString("0.##") : "";
+                }
+            }
+
+             
+
+
+            ViewBag.expertTestTopicpeizhiDTOs = expertTestTopicpeizhiDTOs;
+
+
+            ViewBag.topictype = topictypes;
+            ViewBag.zhishitype = zhishitypes;
+
+            return View();
+        }
+
+
+        /// <summary>
+        /// 淇濆瓨
+        /// </summary>
+        /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
+        /// <returns></returns>
+        /// 
+        [HttpPost]
+        public IActionResult SavePeizhi(ExpertTestTopicpeizhiDTO data)
+        {
+
+            ResultEntity resultEntity = new ResultEntity();
+
+
+
+            using (TransactionScope scope = new TransactionScope())
+            {
+                var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+                ViewData["curentuser"] = curentuser;
+                data.RecStatus = "A";
+                if (data.Zhishitypes != null && data.Zhishitypes.Length > 0)
+                {
+                    for (int i = 0; i < data.Zhishitypes.Length; i++)
+                    {
+                        var resultDTO = _expertTestTopicService.Getpeizhi(data.Topictypes[i],data.Zhishitypes[i]);
+                        if (string.IsNullOrEmpty(resultDTO.Id))
+                        {
+                            resultDTO = new ExpertTestTopicpeizhiDTO();
+                            resultDTO.ShijianId = data.ShijianIds[i];
+                            resultDTO.Topictype = data.Topictypes[i];
+                            resultDTO.Zhishitype = data.Zhishitypes[i];
+                            resultDTO.Fenshu = data.Fenshus[i];
+                            for (int j = 0; j < data.Topictypeszong.Length; j++)
+                            {
+                                if(data.Topictypeszong[j]== resultDTO.Topictype)
+                                {
+                                    resultDTO.Fenzhi = data.Fenzhizong[j];
+                                }
+                            }
+                              
+                            resultDTO.Creater = curentuser.Id;
+                            resultDTO.Createtime = DateTime.Now;
+                        }
+                        else
+                        {
+                            resultDTO.ShijianId = data.ShijianIds[i];
+                            resultDTO.Topictype = data.Topictypes[i];
+                            resultDTO.Zhishitype = data.Zhishitypes[i];
+                            resultDTO.Fenshu = data.Fenshus[i];
+                            for (int j = 0; j < data.Topictypeszong.Length; j++)
+                            {
+                                if (data.Topictypeszong[j] == resultDTO.Topictype)
+                                {
+                                    resultDTO.Fenzhi = data.Fenzhizong[j];
+                                }
+                            }
+                        }
+                        resultDTO.Modifier = curentuser.Id;
+                        resultDTO.Modifytime = DateTime.Now;
+
+                        resultEntity = _expertTestTopicService.savepeizhi(resultDTO);
+                    }
+                }
+                scope.Complete();
+            }
+
+
+            return new JsonResult(resultEntity);
+        }
+
+
     }
 }

--
Gitblit v1.9.1