using DTO; using IServices; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Threading.Tasks; using System.Transactions; using zhengcaioa.IService; using zhengcaioa.Models; namespace zhengcaioa.Controllers.ExpertTest { public class ExpertTestTopicController : Controller { private readonly ILogger _logger; private readonly ILiaotianService _liaotianService; private readonly IExpertTestTopicService _expertTestTopicService; private readonly IAreaService _areaService; private readonly IConfiguration _configuration; private readonly IPltPageService _pltPageService; private readonly IHttpClientFactory _clientFactory; public ExpertTestTopicController(ILogger logger, ILiaotianService liaotianService, IExpertTestTopicService expertTestTopicService , IAreaService areaService , IConfiguration configuration , IPltPageService pltPageService , IHttpClientFactory clientFactory) { _logger = logger; _liaotianService = liaotianService; _expertTestTopicService = expertTestTopicService; _areaService = areaService; _configuration = configuration; _pltPageService = pltPageService; _clientFactory = clientFactory; } public IActionResult Index() { var curentuser = JsonConvert.DeserializeObject(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; List actionlist = new List(); 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.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(); } public IActionResult GetList(ExpertTestTopicDTOSearch search) { var curentuser = JsonConvert.DeserializeObject(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; //search.Creater = curentuser.Id; //JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver()); return new JsonResult(_expertTestTopicService.SearchByPaging(search)); } public IActionResult Edit(string id = null, string Topictype = "", string Zhishitype = "", string Area = "") { var curentuser = JsonConvert.DeserializeObject(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; var expertTestTopicanwserDTOs = new List(); var expertTestTopicjiexiDTOs = new List(); ExpertTestTopicDTO dto = new ExpertTestTopicDTO(); 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()); } dto.expertTestTopicanwserDTOs = expertTestTopicanwserDTOs; expertTestTopicjiexiDTOs = _expertTestTopicService.GetListjiexi(id); if (expertTestTopicjiexiDTOs.Count == 0) { var ssssss = new ExpertTestTopicjiexiDTO(); ssssss.Flag = "A"; expertTestTopicjiexiDTOs.Add(ssssss); } dto.expertTestTopicjiexiDTOs = expertTestTopicjiexiDTOs; } else { if (Topictype == "03") { var expertTestTopicanwserDTO = new ExpertTestTopicanwserDTO(); expertTestTopicanwserDTO.Anwserno = "√"; expertTestTopicanwserDTOs.Add(expertTestTopicanwserDTO); var expertTestTopicanwserDTO1 = new ExpertTestTopicanwserDTO(); expertTestTopicanwserDTO1.Anwserno = "×"; expertTestTopicanwserDTOs.Add(expertTestTopicanwserDTO1); dto.expertTestTopicanwserDTOs = expertTestTopicanwserDTOs; } else { var expertTestTopicanwserDTO = new ExpertTestTopicanwserDTO(); expertTestTopicanwserDTO.Anwserno = "A"; expertTestTopicanwserDTOs.Add(expertTestTopicanwserDTO); var expertTestTopicanwserDTO1 = new ExpertTestTopicanwserDTO(); expertTestTopicanwserDTO1.Anwserno = "B"; expertTestTopicanwserDTOs.Add(expertTestTopicanwserDTO1); var expertTestTopicanwserDT2 = new ExpertTestTopicanwserDTO(); expertTestTopicanwserDT2.Anwserno = "C"; expertTestTopicanwserDTOs.Add(expertTestTopicanwserDT2); var expertTestTopicanwserDT3 = new ExpertTestTopicanwserDTO(); expertTestTopicanwserDT3.Anwserno = "D"; expertTestTopicanwserDTOs.Add(expertTestTopicanwserDT3); dto.expertTestTopicanwserDTOs = expertTestTopicanwserDTOs; } var ssssss = new ExpertTestTopicjiexiDTO(); ssssss.Flag = "A"; expertTestTopicjiexiDTOs.Add(ssssss); dto.expertTestTopicjiexiDTOs = expertTestTopicjiexiDTOs; if (string.IsNullOrEmpty(Topictype)) { dto.Topictype = "01"; } else { dto.Topictype = Topictype; } if (string.IsNullOrEmpty(Zhishitype)) { dto.Zhishitype = "01"; } else { dto.Zhishitype = Zhishitype; } if (string.IsNullOrEmpty(Area)) { dto.Area = "100000"; } else { dto.Area = Area; } } ViewBag.topictype = _liaotianService.GetSYScode("expert_test_topic", "topictype"); ViewBag.zhishitype = _liaotianService.GetSYScode("expert_test_topic", "zhishitype"); ViewBag.zhongdian = _liaotianService.GetSYScode("system", "shifou").OrderByDescending(x=>x.Sort).ToList(); ViewBag.jiexi_status = _liaotianService.GetSYScode("expert_test_topic", "jiexi_status"); ViewBag.shenpi_status = _liaotianService.GetSYScode("expert_test_topic", "shenpi_status"); ViewBag.Flag = _liaotianService.GetSYScode("system", "shifou"); ViewBag.falv = _liaotianService.GetSYScode("expert_test_topicjiexi", "falv"); 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; List pageEntities = _pltPageService.GetUserPage(curentuser.Id, "/ExpertTestTopic/Index"); ViewData["pageEntities"] = pageEntities; ViewData.Model = dto; return View(); } /// /// 保存 /// /// 岗位实体类对象 /// /// [HttpPost] public async Task SaveAsync(ExpertTestTopicDTO data) { ResultEntity resultEntity = new ResultEntity(); if (!string.IsNullOrEmpty(data.Id)) { string api_domain = _configuration.GetSection("Elasticsearchurl").Value; string url = $"{api_domain}/liaotian/person/" + data.Id; //string requestJson = "{\"id\": \"" + Id + "\",\"question\": \"" + data.Question + "\",\"anwser\": \"" + data.Anwser + "\"}"; try { string result = string.Empty; Uri postUrl = new Uri(url); var httpClient = _clientFactory.CreateClient(); httpClient.Timeout = new TimeSpan(0, 0, 60); var Result = await httpClient.DeleteAsync(postUrl); 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; } } catch (Exception e) { resultEntity.Result = false; throw e; } } using (TransactionScope scope = new TransactionScope()) { var curentuser = JsonConvert.DeserializeObject(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; data.RecStatus = "A"; if (String.IsNullOrEmpty(data.Id)) { data.Creater = curentuser.Id; data.Createtime = DateTime.Now; data.ShenpiStatus = "D"; //data.JiexiStatus = "D"; } else { var ddd = _expertTestTopicService.Get(data.Id); data.ShenpiStatus = "D"; //data.JiexiStatus = ddd.JiexiStatus; } if (string.IsNullOrEmpty(data.Jiexi)) { data.JiexiStatus = "D"; } else { data.JiexiStatus = "A"; } data.Modifier = curentuser.Id; data.Modifytime = DateTime.Now; resultEntity = _expertTestTopicService.save(data); scope.Complete(); } return new JsonResult(resultEntity); } /// /// 审核 /// /// 岗位实体类对象 /// [HttpPost] [CheckLogin] public async Task ShenheAsync(String Id) { ResultEntity resultEntity = new ResultEntity(); resultEntity.Result = false; var curentuser = JsonConvert.DeserializeObject(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; var data = _expertTestTopicService.Get(Id); var datadtls = _expertTestTopicService.GetListanwser(Id); data.ShenpiStatus = "A"; data.Modifier = curentuser.Id; data.Modifytime = DateTime.Now; resultEntity = _expertTestTopicService.shenpi(data); string api_domain = _configuration.GetSection("Elasticsearchurl").Value; string url = $"{api_domain}/liaotian/person/" + data.Id; LiaotianElasticsearchDTO liaotianElasticsearchDTO = new LiaotianElasticsearchDTO(); liaotianElasticsearchDTO.id = data.Id; liaotianElasticsearchDTO.question = data.Topic; liaotianElasticsearchDTO.anwser = data.Topic+"
"; foreach(var datadtl in datadtls) { if (datadtl.Shifouzhengqu == "A") { liaotianElasticsearchDTO.anwser += ""+datadtl.Anwserno + " " + datadtl.Anwser + "
"; } else { liaotianElasticsearchDTO.anwser += datadtl.Anwserno + " " + datadtl.Anwser + "
"; } } string requestJson = JsonConvert.SerializeObject(liaotianElasticsearchDTO); ;// "{\"id\": \"" + liaotianDTO.Id + "\",\"question\": \"" + liaotianDTO.Question.Replace("\n", "")+ "\",\"anwser\": \"" + liaotianDTO.Anwser.Replace("\n", "") + "\"}"; try { 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; } } catch (Exception e) { resultEntity.Result = false; throw e; } return JsonConvert.SerializeObject(resultEntity); } /// /// 提交并审核 /// /// 岗位实体类对象 /// [HttpPost] [CheckLogin] public async Task TijiaobingshenheAsync(ExpertTestTopicDTO data) { ResultEntity resultEntity = new ResultEntity(); using (TransactionScope scope = new TransactionScope()) { var curentuser = JsonConvert.DeserializeObject(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; data.RecStatus = "A"; if (String.IsNullOrEmpty(data.Id)) { data.Creater = curentuser.Id; data.Createtime = DateTime.Now; data.ShenpiStatus = "A"; //data.JiexiStatus = "D"; } else { var ddd = _expertTestTopicService.Get(data.Id); data.ShenpiStatus = "A"; //data.JiexiStatus = ddd.JiexiStatus; } if (string.IsNullOrEmpty(data.Jiexi)) { data.JiexiStatus = "D"; } else { data.JiexiStatus = "A"; } data.Modifier = curentuser.Id; data.Modifytime = DateTime.Now; resultEntity = _expertTestTopicService.save(data); scope.Complete(); } 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; LiaotianElasticsearchDTO liaotianElasticsearchDTO = new LiaotianElasticsearchDTO(); liaotianElasticsearchDTO.id = data.Id; liaotianElasticsearchDTO.question = data.Topic; liaotianElasticsearchDTO.anwser = data.Topic + "
"; foreach (var datadtl in datadtls) { if (datadtl.Shifouzhengqu == "A") { liaotianElasticsearchDTO.anwser += "" + datadtl.Anwserno + " " + datadtl.Anwser + "
"; } else { liaotianElasticsearchDTO.anwser += datadtl.Anwserno + " " + datadtl.Anwser + "
"; } } string requestJson = JsonConvert.SerializeObject(liaotianElasticsearchDTO); ;// "{\"id\": \"" + liaotianDTO.Id + "\",\"question\": \"" + liaotianDTO.Question.Replace("\n", "")+ "\",\"anwser\": \"" + liaotianDTO.Anwser.Replace("\n", "") + "\"}"; try { 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; } } catch (Exception e) { resultEntity.Result = false; throw e; } return JsonConvert.SerializeObject(resultEntity); } /// /// 删除主信息 /// /// 实体 /// /// public async Task NullifyAsync(string Id = "") { var curentuser = JsonConvert.DeserializeObject(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; ResultEntity resultEntity = _expertTestTopicService.ModifyStatus(Id, curentuser.Id); string api_domain = _configuration.GetSection("Elasticsearchurl").Value; string url = $"{api_domain}/liaotian/person/" + Id; //string requestJson = "{\"id\": \"" + Id + "\",\"question\": \"" + data.Question + "\",\"anwser\": \"" + data.Anwser + "\"}"; try { string result = string.Empty; Uri postUrl = new Uri(url); var httpClient = _clientFactory.CreateClient(); httpClient.Timeout = new TimeSpan(0, 0, 60); var Result = await httpClient.DeleteAsync(postUrl); 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; } } catch (Exception e) { resultEntity.Result = false; throw e; } return new JsonResult(resultEntity); } public IActionResult print(ExpertTestTopicDTOSearch search) { var curentuser = JsonConvert.DeserializeObject(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; search.page = 1; search.rows = 10000; ViewBag.listExpertTestTopicDTO = _expertTestTopicService.SearchByPaging(search).DataList; return View(); } public IActionResult EditResult() { var curentuser = JsonConvert.DeserializeObject(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(); 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(); } /// /// 保存 /// /// 岗位实体类对象 /// /// [HttpPost] public IActionResult SaveResult(ExpertTestResultDTO data) { ResultEntity resultEntity = new ResultEntity(); using (TransactionScope scope = new TransactionScope()) { var curentuser = JsonConvert.DeserializeObject(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(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(); 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(); } /// /// 保存 /// /// 岗位实体类对象 /// /// [HttpPost] public IActionResult SavePeizhi(ExpertTestTopicpeizhiDTO data) { ResultEntity resultEntity = new ResultEntity(); using (TransactionScope scope = new TransactionScope()) { var curentuser = JsonConvert.DeserializeObject(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); } } }