From 15eb82df2d6ec539e9d4245bfe08d531e8eb6379 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期日, 27 四月 2025 14:33:26 +0800 Subject: [PATCH] 修改培训订单占多个座位 --- zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs | 658 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 624 insertions(+), 34 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs index 66ac251..9a21fb7 100644 --- a/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/ExpertTest/ExpertTestTopicController.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Net.Http; using System.Net.Http.Headers; +using System.Text; using System.Threading.Tasks; using System.Transactions; using zhengcaioa.IService; @@ -51,38 +52,60 @@ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; List<ActionEntity> actionlist = new List<ActionEntity>(); - ActionEntity actionEntity = new ActionEntity(); - actionEntity.OpenType = 0; - actionEntity.ActionUrl = ""; - actionEntity.ActionFun = "Search"; - actionEntity.PageIco = "fa fa-search"; - actionEntity.ActionName = "鏌ヨ"; - actionlist.Add(actionEntity); + //ActionEntity actionEntity = new ActionEntity(); + //actionEntity.OpenType = 0; + //actionEntity.ActionUrl = ""; + //actionEntity.ActionFun = "Search"; + //actionEntity.PageIco = "fa fa-search"; + //actionEntity.ActionName = "鏌ヨ"; + //actionlist.Add(actionEntity); - ActionEntity actionEntity1 = new ActionEntity(); - actionEntity1.OpenType = 0; - actionEntity1.ActionUrl = ""; - actionEntity1.ActionFun = "Add"; - actionEntity1.PageIco = "fa fa-plus"; - actionEntity1.ActionName = "鏂板"; - actionlist.Add(actionEntity1); + //ActionEntity actionEntity1 = new ActionEntity(); + //actionEntity1.OpenType = 0; + //actionEntity1.ActionUrl = ""; + //actionEntity1.ActionFun = "Add"; + //actionEntity1.PageIco = "fa fa-plus"; + //actionEntity1.ActionName = "鏂板"; + //actionlist.Add(actionEntity1); - ActionEntity actionEntity2 = new ActionEntity(); - actionEntity2.OpenType = 0; - actionEntity2.ActionUrl = ""; - actionEntity2.ActionFun = "Print"; - actionEntity2.PageIco = "fa fa-print"; - actionEntity2.ActionName = "鎵撳嵃"; - actionlist.Add(actionEntity2); + //ActionEntity actionEntity2 = new ActionEntity(); + //actionEntity2.OpenType = 0; + //actionEntity2.ActionUrl = ""; + //actionEntity2.ActionFun = "Print"; + //actionEntity2.PageIco = "fa fa-print"; + //actionEntity2.ActionName = "鎵撳嵃"; + //actionlist.Add(actionEntity2); + + //ActionEntity actionEntity3 = new ActionEntity(); + //actionEntity3.OpenType = 0; + //actionEntity3.ActionUrl = ""; + //actionEntity3.ActionFun = "Zhuanyi"; + //actionEntity3.PageIco = "fa fa-plus"; + //actionEntity3.ActionName = "鏁版嵁杞Щ"; + //actionlist.Add(actionEntity3); + var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/ExpertTestTopic/Index"); + var pageEntities1 = pageEntities.Where(x => x.PageMethod == "01").ToList(); + foreach (var pageEntity in pageEntities1) + { + ActionEntity actionEntity1 = new ActionEntity(); + actionEntity1.OpenType = pageEntity.OpenType; + actionEntity1.ActionUrl = ""; + actionEntity1.ActionFun = pageEntity.PageShortcut; + actionEntity1.PageIco = pageEntity.PageIco; + actionEntity1.ActionName = pageEntity.PageName; + actionlist.Add(actionEntity1); + } ViewData["ActionInfo"] = actionlist; + var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList(); + ViewData["ActionInfo2"] = pageEntities2; @@ -92,6 +115,10 @@ ViewBag.zhongdian = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); ViewBag.jiexi_status = _liaotianService.GetSYScode("expert_test_topic", "jiexi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); ViewBag.shenpi_status = _liaotianService.GetSYScode("expert_test_topic", "shenpi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.Falv = _liaotianService.GetSYScode("expert_test_topicjiexi", "falv").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + + ViewBag.shanchuzhishitype = _liaotianService.GetSYScodeshanchu("expert_test_topic", "zhishitype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + var areaDTOs = _areaService.GetList().Where(x => x.ParentId == "0 ").ToList(); foreach (var areaDTO in areaDTOs) { @@ -122,10 +149,15 @@ return new JsonResult(_expertTestTopicService.SearchByPaging(search)); } - public IActionResult Edit(string id = null, string Topictype = "", string Zhishitype = "", string Area = "") + public IActionResult Edit(string id = null, string Topictype = "", string Zhishitype = "", string Area = "",string Falv ="") { var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; + + var pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/ExpertTestTopic/Index"); + var pageEntities2 = pageEntities.Where(x => x.PageMethod == "02").ToList(); + ViewData["ActionInfo2"] = pageEntities2; + var expertTestTopicanwserDTOs = new List<ExpertTestTopicanwserDTO>(); var expertTestTopicjiexiDTOs = new List<ExpertTestTopicjiexiDTO>(); @@ -134,7 +166,12 @@ if (!String.IsNullOrEmpty(id)) { dto = _expertTestTopicService.Get(id); + expertTestTopicanwserDTOs = _expertTestTopicService.GetListanwser(id); + if (dto.Topictype=="03") + { + expertTestTopicanwserDTOs = expertTestTopicanwserDTOs.OrderBy(x=>x.Anwserno).ToList(); + } if (expertTestTopicanwserDTOs.Count == 0) { expertTestTopicanwserDTOs.Add(new ExpertTestTopicanwserDTO()); @@ -163,7 +200,7 @@ expertTestTopicanwserDTO.Anwserno = "鈭�"; expertTestTopicanwserDTOs.Add(expertTestTopicanwserDTO); var expertTestTopicanwserDTO1 = new ExpertTestTopicanwserDTO(); - expertTestTopicanwserDTO1.Anwserno = "脳"; + expertTestTopicanwserDTO1.Anwserno = "x"; expertTestTopicanwserDTOs.Add(expertTestTopicanwserDTO1); @@ -186,12 +223,39 @@ dto.expertTestTopicanwserDTOs = expertTestTopicanwserDTOs; } + if (!string.IsNullOrEmpty(Falv)) + { + string[] falvs = Falv.Split(','); + for(int i=0;i< falvs.Length; i++) + { + if (i == 0) + { + var ssssss = new ExpertTestTopicjiexiDTO(); + ssssss.Flag = "A"; + ssssss.Falv = falvs[i]; + expertTestTopicjiexiDTOs.Add(ssssss); + + } + else if(!string.IsNullOrEmpty(falvs[i])) + { + var ssssss = new ExpertTestTopicjiexiDTO(); + ssssss.Flag = "D"; + ssssss.Falv = falvs[i]; + expertTestTopicjiexiDTOs.Add(ssssss); + + } + } + dto.expertTestTopicjiexiDTOs = expertTestTopicjiexiDTOs; + } + else + { + var ssssss = new ExpertTestTopicjiexiDTO(); + ssssss.Flag = "A"; + expertTestTopicjiexiDTOs.Add(ssssss); + dto.expertTestTopicjiexiDTOs = expertTestTopicjiexiDTOs; + } - - var ssssss = new ExpertTestTopicjiexiDTO(); - ssssss.Flag = "A"; - expertTestTopicjiexiDTOs.Add(ssssss); - dto.expertTestTopicjiexiDTOs = expertTestTopicjiexiDTOs; + if (string.IsNullOrEmpty(Topictype)) { @@ -217,6 +281,7 @@ { dto.Area = Area; } + } @@ -253,8 +318,6 @@ - List<PageEntity> pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/ExpertTestTopic/Index"); - ViewData["pageEntities"] = pageEntities; ViewData.Model = dto; @@ -278,7 +341,7 @@ { string api_domain = _configuration.GetSection("Elasticsearchurl").Value; - string url = $"{api_domain}/liaotian/person/" + data.Id; + string url = $"{api_domain}/liaotian/_doc/" + data.Id; //string requestJson = "{\"id\": \"" + Id + "\",\"question\": \"" + data.Question + "\",\"anwser\": \"" + data.Anwser + "\"}"; try { @@ -379,7 +442,7 @@ resultEntity = _expertTestTopicService.shenpi(data); string api_domain = _configuration.GetSection("Elasticsearchurl").Value; - string url = $"{api_domain}/liaotian/person/" + data.Id; + string url = $"{api_domain}/liaotian/_doc/" + data.Id; LiaotianElasticsearchDTO liaotianElasticsearchDTO = new LiaotianElasticsearchDTO(); liaotianElasticsearchDTO.id = data.Id; liaotianElasticsearchDTO.question = data.Topic; @@ -495,7 +558,7 @@ data = _expertTestTopicService.Get(data.Id); var datadtls = _expertTestTopicService.GetListanwser(data.Id); string api_domain = _configuration.GetSection("Elasticsearchurl").Value; - string url = $"{api_domain}/liaotian/person/" + data.Id; + string url = $"{api_domain}/liaotian/_doc/" + data.Id; LiaotianElasticsearchDTO liaotianElasticsearchDTO = new LiaotianElasticsearchDTO(); liaotianElasticsearchDTO.id = data.Id; liaotianElasticsearchDTO.question = data.Topic; @@ -578,7 +641,7 @@ ResultEntity resultEntity = _expertTestTopicService.ModifyStatus(Id, curentuser.Id); string api_domain = _configuration.GetSection("Elasticsearchurl").Value; - string url = $"{api_domain}/liaotian/person/" + Id; + string url = $"{api_domain}/liaotian/_doc/" + Id; //string requestJson = "{\"id\": \"" + Id + "\",\"question\": \"" + data.Question + "\",\"anwser\": \"" + data.Anwser + "\"}"; try { @@ -631,5 +694,532 @@ 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.##") : ""; + } + foreach (var zhishitype in zhishitypes) + { + var bbbb = expertTestTopicpeizhiDTOs.Where(x => x.Zhishitype == zhishitype.CodeSn).ToList(); + if (bbbb.Count <= 0) + { + foreach (var topictype in topictypes) + { + 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); + } + + expertTestTopicpeizhiDTOs = expertTestTopicpeizhiDTOs.OrderBy(x => x.Topictype).ThenBy(x => x.Zhishitype).ToList(); + } + } + + + + } + + + + + 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); + } + + public IActionResult shititongji() + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + var expertTestTopicDTOs = new List<ExpertTestTopicDTO>(); + + var expertTestTopicDTOs1 = _expertTestTopicService.GetList(); + + var sysCodeDtls = _liaotianService.GetSYScode("expert_test_topic", "topictype"); + + var sysCodeDtls1 = _liaotianService.GetSYScode("expert_test_topic", "zhishitype"); + + foreach (var sysCodeDtl1 in sysCodeDtls1) + { + foreach (var sysCodeDtl in sysCodeDtls) + { + var shuliang = expertTestTopicDTOs1.Count(x => x.Zhishitype == sysCodeDtl1.CodeSn && x.Topictype == sysCodeDtl.CodeSn); + + var expertTestTopicDTO = new ExpertTestTopicDTO(); + expertTestTopicDTO.Shuliang = shuliang; + var sysCodeDtl2 = sysCodeDtls1.Where(x => x.CodeSn == sysCodeDtl1.CodeSn).FirstOrDefault(); + if (sysCodeDtl2 != null) + { + expertTestTopicDTO.ZhishitypeName = sysCodeDtl2.Comments; + } + expertTestTopicDTO.Zhishitype = sysCodeDtl1.CodeSn; + expertTestTopicDTO.Topictype = sysCodeDtl.CodeSn; + expertTestTopicDTOs.Add(expertTestTopicDTO); + + } + } + + foreach (var sysCodeDtl in sysCodeDtls) + { + + var shuliang = expertTestTopicDTOs1.Count(x => x.Topictype == sysCodeDtl.CodeSn); + var expertTestTopicDTO = new ExpertTestTopicDTO(); + expertTestTopicDTO.Shuliang = shuliang; + expertTestTopicDTO.ZhishitypeName = "鍚堣"; + + expertTestTopicDTO.Zhishitype = ""; + expertTestTopicDTO.Topictype = sysCodeDtl.CodeSn; + expertTestTopicDTOs.Add(expertTestTopicDTO); + } + + + + + + + //ViewBag.topictype = sysCodeDtls; + + //ViewBag.zhishitype = sysCodeDtls1; + + //ViewBag.listExpertTestTopicDTO = expertTestTopicDTOs; + + + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append("<table style=\"width:50%;\">"); + stringBuilder.Append(" <tr>"); + + stringBuilder.Append("<td style=\"width:25%;\"> 鐭ヨ瘑鐐�/棰樺瀷</td>"); + foreach (var sysCodeDtl in sysCodeDtls) + { + stringBuilder.Append("<td style = \"width:25%;\" > " + sysCodeDtl.Comments + "</td >"); + } + + stringBuilder.Append(" </tr>"); + + int i = 0; + + + foreach(var ExpertTestTopicDTO in expertTestTopicDTOs) + { + if(i != 0 && i % 3 == 0) + { + stringBuilder.Append(" </tr>"); + } + + if(i == 0 || i % 3 == 0) + { + stringBuilder.Append("<tr>"); + stringBuilder.Append(" <td>" + ExpertTestTopicDTO.ZhishitypeName + "</td>"); + } + + + + + stringBuilder.Append("<td><a onclick=\"OpenWindow(' ','98%','100%', '/ExpertTestTopic/tongjiIndex?Topictype=" + ExpertTestTopicDTO.Topictype + "&Zhishitype=" + ExpertTestTopicDTO.Zhishitype + "')\" > " + ExpertTestTopicDTO.Shuliang +"</a></td>"); + + if (i == expertTestTopicDTOs.Count - 1) + { + stringBuilder.Append(" </tr>"); + } + + + + + i++; + } + + + + + + + stringBuilder.Append("</table>"); + + ViewBag.htmlstring = stringBuilder.ToString(); ; + + return View(); + } + + + + public IActionResult tongjiIndex(string Topictype="", string Zhishitype = "") + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + List<ActionEntity> actionlist = new List<ActionEntity>(); + ActionEntity actionEntity = new ActionEntity(); + actionEntity.OpenType = 0; + actionEntity.ActionUrl = ""; + actionEntity.ActionFun = "Search"; + actionEntity.PageIco = "fa fa-search"; + actionEntity.ActionName = "鏌ヨ"; + actionlist.Add(actionEntity); + + + + + + //ActionEntity actionEntity1 = new ActionEntity(); + //actionEntity1.OpenType = 0; + //actionEntity1.ActionUrl = ""; + //actionEntity1.ActionFun = "Add"; + //actionEntity1.PageIco = "fa fa-plus"; + //actionEntity1.ActionName = "鏂板"; + //actionlist.Add(actionEntity1); + + + //ActionEntity actionEntity2 = new ActionEntity(); + //actionEntity2.OpenType = 0; + //actionEntity2.ActionUrl = ""; + //actionEntity2.ActionFun = "Print"; + //actionEntity2.PageIco = "fa fa-print"; + //actionEntity2.ActionName = "鎵撳嵃"; + //actionlist.Add(actionEntity2); + + + ViewData["ActionInfo"] = actionlist; + + ViewBag.Topictype1 = Topictype; + ViewBag.Zhishitype1 = Zhishitype; + + + ViewBag.topictype = _liaotianService.GetSYScode("expert_test_topic", "topictype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + + ViewBag.zhishitype = _liaotianService.GetSYScode("expert_test_topic", "zhishitype").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.zhongdian = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.jiexi_status = _liaotianService.GetSYScode("expert_test_topic", "jiexi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + ViewBag.shenpi_status = _liaotianService.GetSYScode("expert_test_topic", "shenpi_status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList(); + var areaDTOs = _areaService.GetList().Where(x => x.ParentId == "0 ").ToList(); + foreach (var areaDTO in areaDTOs) + { + if (areaDTO.CodeId == "510000") + { + areaDTOs.Remove(areaDTO); + break; + } + } + var areaDTOsic = new AreaDTO(); + areaDTOsic.CodeId = "510000"; + areaDTOsic.Name = "鍥涘窛鐪�"; + areaDTOsic.ParentId = "0 "; + areaDTOs.Insert(1, areaDTOsic); + ViewBag.Area = areaDTOs.Select(x => new { code = x.CodeId, label = x.Name }).ToList(); ; + + + return View(); + + } + + + + /// <summary> + /// 杞Щ鏁版嵁 + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + + [CheckLogin] + public async Task<string> ZhuanyiAsync() + { + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = false; + + var expertTestTopicDTOs = _expertTestTopicService.GetList().Where(x => x.ShenpiStatus == "A").ToList(); + + + try + { + foreach (var data in expertTestTopicDTOs) + { + + + string api_domain = _configuration.GetSection("Elasticsearchurl").Value; + string url = $"{api_domain}/liaotian/_doc/" + data.Id; + + var datadtls = _expertTestTopicService.GetListanwser(data.Id); + LiaotianElasticsearchDTO liaotianElasticsearchDTO = new LiaotianElasticsearchDTO(); + liaotianElasticsearchDTO.id = data.Id; + liaotianElasticsearchDTO.question = data.Topic; + liaotianElasticsearchDTO.anwser = data.Topic + " </br> "; + foreach (var datadtl in datadtls) + { + if (datadtl.Shifouzhengqu == "A") + { + liaotianElasticsearchDTO.anwser += "<font color=\"#FF0000\">" + datadtl.Anwserno + " " + datadtl.Anwser + "</font> </br>"; + } + else + { + liaotianElasticsearchDTO.anwser += datadtl.Anwserno + " " + datadtl.Anwser + " </br> "; + } + + } + + + + string requestJson = JsonConvert.SerializeObject(liaotianElasticsearchDTO); + + + + + + + string result = string.Empty; + Uri postUrl = new Uri(url); + + using (HttpContent httpContent = new StringContent(requestJson)) + { + httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); + + var httpClient = _clientFactory.CreateClient(); + httpClient.Timeout = new TimeSpan(0, 0, 60); + var Result = await httpClient.PutAsync(postUrl, httpContent); + result = Result.Content.ReadAsStringAsync().Result; + + + + } + + Newtonsoft.Json.Linq.JObject jobject = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(result); + + if (jobject["error"] == null && jobject["_shards"]["successful"].ToString() == "1") + { + resultEntity.Result = true; + } + else + { + resultEntity.Result = false; + return JsonConvert.SerializeObject(resultEntity); + } + } + + + + } + catch (Exception e) + { + resultEntity.Result = false; + throw e; + + + } + + + + + + return JsonConvert.SerializeObject(resultEntity); + } + } } -- Gitblit v1.9.1