From ed3015095f1b0e88bc579877c678a3fac191381f Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期一, 28 六月 2021 14:32:26 +0800
Subject: [PATCH] Merge branch 'master' of http://47.108.235.38:8080/r/zhengcaioa

---
 zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs |  292 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 292 insertions(+), 0 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs b/zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs
new file mode 100644
index 0000000..3904acf
--- /dev/null
+++ b/zhengcaioa/zhengcaioa/Controllers/Expert/ZhuanjiahuidaController.cs
@@ -0,0 +1,292 @@
+锘縰sing DTO;
+using IServices;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IdentityModel.Tokens.Jwt;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Threading.Tasks;
+using zhengcaioa.IService;
+using zhengcaioa.Models;
+
+namespace zhengcaioa.Controllers.Expert
+{
+    public class ZhuanjiahuidaController : Controller
+    {
+        private readonly ILogger<ZhuanjiahuidaController> _logger;
+        private readonly ILZhuanjiahuidumService _lZhuanjiahuidumService;
+        private readonly ILiaotianService _liaotianService;
+        private readonly IConfiguration _configuration;
+
+
+
+
+        public ZhuanjiahuidaController(ILogger<ZhuanjiahuidaController> logger, ILZhuanjiahuidumService lZhuanjiahuidumService, ILiaotianService liaotianService)
+        {
+            _logger = logger;
+            _lZhuanjiahuidumService = lZhuanjiahuidumService;
+            _liaotianService = liaotianService;
+        }
+        [CheckLogin]
+        public IActionResult Index()
+        {
+            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);
+            ViewData["ActionInfo"] = actionlist;
+
+            ViewBag.shifou = _liaotianService.GetSYScode("system", "shifou").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
+            return View();
+        }
+
+        [CheckLogin]
+        public IActionResult GetList(LZhuanjiahuidumDTOSearch search)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            //JsonResult jsonResult =   new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver());
+            return new JsonResult(_lZhuanjiahuidumService.SearchByPaging(search));
+        }
+
+
+        #region 缂栬緫
+        [CheckLogin]
+        public ActionResult Edit(string id = null)
+        {
+
+
+
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+
+            LZhuanjiahuidumDTO dto = new LZhuanjiahuidumDTO();
+            if (!String.IsNullOrEmpty(id))
+            {
+                dto = _lZhuanjiahuidumService.Get(id);
+
+            }
+     
+
+
+
+
+            ViewData.Model = dto;
+            return View();
+        }
+
+
+
+
+
+
+
+
+
+
+        /// <summary>
+        /// 淇濆瓨
+        /// </summary>
+        /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param>
+        /// <returns></returns>
+        [HttpPost]
+        [CheckLogin]
+        public IActionResult Save(LZhuanjiahuidumDTO data)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            data.RecStatus = "A";
+            if (String.IsNullOrEmpty(data.Id))
+            {
+                data.Creater = curentuser.Id;
+                data.Createtime = DateTime.Now;
+            }
+            else
+            {
+                data.HuidaStatus = "A";
+            }
+            data.Modifier = curentuser.Id;
+            data.Modifytime = DateTime.Now;
+
+            ResultEntity resultEntity = _lZhuanjiahuidumService.save(data);
+
+            return new JsonResult(resultEntity);
+        }
+        #endregion
+
+        /// <summary>
+        /// 鍒犻櫎涓讳俊鎭�
+        /// </summary>
+        /// <param name="info">瀹炰綋</param>
+        /// <returns></returns>
+        /// 
+        [CheckLogin]
+        public IActionResult Nullify(string Id = "")
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+            return new JsonResult(_lZhuanjiahuidumService.ModifyStatus(Id, curentuser.Id));
+        }
+
+
+
+        //鎻愰棶
+        public IActionResult Wenti([FromBody]LZhuanjiahuidumDTO data)
+        {
+            ReturnMsg<LZhuanjiahuidumDTO> returnMsg = new ReturnMsg<LZhuanjiahuidumDTO>();
+            returnMsg.code = 2;
+            try
+            {
+                var headers = Request.Headers;
+                if (headers != null)
+                {
+                    //string SecurityKey = _configuration.GetSection("SecurityKey").Value;
+                    var keyId = headers["Authorization"].FirstOrDefault();
+                    if (string.IsNullOrEmpty("keyId"))
+                    {
+                        returnMsg.code = 2;
+                        returnMsg.error = "娌℃湁鑾峰彇鍒皌oken";
+                        returnMsg.count = 0;
+
+                        return new JsonResult(returnMsg);
+                    }
+
+
+                    JwtSecurityToken jwt = null;
+                    var handler = new JwtSecurityTokenHandler();
+                    var key1 = keyId.Replace("Bearer", "").Trim();
+                    jwt = handler.ReadJwtToken(key1);
+                    System.Security.Claims.Claim sss = jwt.Claims.Where(x => x.Type == "id").FirstOrDefault();
+                    data.Userid = sss.Value;
+
+                }
+
+               var lZhuanjiahuidumDTOs = _lZhuanjiahuidumService.GetList(data.Userid, data.Question);
+
+                if(lZhuanjiahuidumDTOs!=null&& lZhuanjiahuidumDTOs.Count > 0)
+                {
+                    returnMsg.code = 3;
+                    returnMsg.error = "杩欎釜闂宸茬粡鎻愰棶杩囦簡";
+                    returnMsg.count = 0;
+
+                    return new JsonResult(returnMsg);
+                }
+
+                data.RecStatus = "A";
+                if (String.IsNullOrEmpty(data.Id))
+                {
+                    data.Creater = "1";
+                    data.Createtime = DateTime.Now;
+                }
+                data.Modifier = "1"; ;
+                data.Modifytime = DateTime.Now;
+
+                ResultEntity resultEntity = _lZhuanjiahuidumService.save(data);
+                if (resultEntity.Result)
+                {
+                    returnMsg.code = 1;
+                }
+            }
+            catch (Exception ex)
+            {
+                returnMsg.code = 2;
+                returnMsg.error = "娌℃湁鑾峰彇鍒皌oken";
+                returnMsg.count = 0;
+                
+            }
+
+           
+
+            return new JsonResult(returnMsg);
+        }
+
+
+
+
+        //鎻愰棶
+        public IActionResult Huida()
+        {
+            ReturnMsg<List<LZhuanjiahuidumDTO>> returnMsg = new ReturnMsg<List<LZhuanjiahuidumDTO>> ();
+            returnMsg.code = 2;
+            try
+            {
+                string userid = "";
+                var headers = Request.Headers;
+                if (headers != null)
+                {
+                    //string SecurityKey = _configuration.GetSection("SecurityKey").Value;
+                    var keyId = headers["Authorization"].FirstOrDefault();
+                    if (string.IsNullOrEmpty("keyId"))
+                    {
+                        returnMsg.code = 2;
+                        returnMsg.error = "娌℃湁鑾峰彇鍒皌oken";
+                        returnMsg.count = 0;
+
+                        return new JsonResult(returnMsg);
+                    }
+
+
+                    JwtSecurityToken jwt = null;
+                    var handler = new JwtSecurityTokenHandler();
+                    var key1 = keyId.Replace("Bearer", "").Trim();
+                    jwt = handler.ReadJwtToken(key1);
+                    System.Security.Claims.Claim sss = jwt.Claims.Where(x => x.Type == "id").FirstOrDefault();
+                    userid = sss.Value;
+
+                }
+                LZhuanjiahuidumDTOSearch searchEntity = new LZhuanjiahuidumDTOSearch();
+                searchEntity.Userid = userid;
+                //searchEntity.HuidaStatus = "A";
+                searchEntity.page = 1;
+                searchEntity.rows = 1000;
+
+                ResultDataEntity<LZhuanjiahuidumDTO> resultDataEntity = _lZhuanjiahuidumService.SearchByPaging(searchEntity);
+                returnMsg.code = 1;
+                returnMsg.returnObj = resultDataEntity.DataList;
+                returnMsg.count = resultDataEntity.DataList.Count;
+
+
+            }
+            catch (Exception ex)
+            {
+                returnMsg.code = 2;
+                returnMsg.error = "娌℃湁鑾峰彇鍒皌oken";
+                returnMsg.count = 0;
+
+            }
+           
+
+             
+
+            
+
+            return new JsonResult(returnMsg);
+        }
+
+    
+
+}
+
+
+
+
+
+}

--
Gitblit v1.9.1