From 6108fe7c4f3a329e8d309d00ee0b1761b8c5ad8f Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 16 十二月 2022 09:39:55 +0800
Subject: [PATCH] 请示批复”里增加“招标信息网”的试用权限

---
 zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs |  276 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 275 insertions(+), 1 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
index 23e8156..66e6368 100644
--- a/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/admin/AdmAskController.cs
@@ -2,11 +2,15 @@
 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;
@@ -35,6 +39,7 @@
         private readonly IFiAccountService _fiAccountService;
 
         private readonly IFiAccountRecordService _iFiAccountRecordService;
+        private readonly IConfiguration _configuration;
 
         public AdmAskController(ILogger<AdmAskController> logger, IAskService askService, IHrDeptService hrDeptService, IWfRunProcessService wfRunProcessService
             , IWfHistoryService wfHistoryService, IWfNeeddeelService wfNeeddeelService
@@ -48,7 +53,9 @@
             , IAdmGoodsRecordService admGoodsRecordService
             , IFiSubjectService ifiSubjectService
             , IFiAccountService fiAccountService
-            , IFiAccountRecordService iFiAccountRecordService)
+            , IFiAccountRecordService iFiAccountRecordService
+             , IConfiguration configuration
+            )
         {
             _logger = logger;
             _hrDeptService = hrDeptService;
@@ -67,6 +74,7 @@
             _ifiSubjectService = ifiSubjectService;
             _fiAccountService = fiAccountService;
             _iFiAccountRecordService = iFiAccountRecordService;
+            _configuration = configuration;
         }
 
         public IActionResult Askcost(string id = "")
@@ -1977,5 +1985,271 @@
             return JsonConvert.SerializeObject(resultEntity);
         }
 
+
+
+
+
+        //鑾峰彇鎷涙爣淇℃伅缃戣瘯鐢ㄥ鎵�
+
+        public IActionResult AskZBXXW(string id = "")
+        {
+            AdmAskzczbwsyDTO dto = new AdmAskzczbwsyDTO();
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+
+
+            //娴佺▼鐩稿叧
+            string shifoubiaoji = "A";
+            string sifoudangqian = "A";
+            string dangqianbuzhou = "鎻愪氦";
+            var lishiyijian = new List<WfHistoryDTO>();
+
+            if (string.IsNullOrEmpty(id))
+            {
+                dto.CreaterName = curentuser.UserName;
+                dto.Tittle = "鎷涙爣淇℃伅缃戣瘯鐢ㄧ敵璇凤紙" + curentuser.UserName + "锛�";
+            }
+            else if (dto != null)
+            {
+                dto = _askService.GetAskZBXXW(id);
+
+                var wfRunProcessDTO = _wfRunProcessService.GetList(dto.Id, "24").FirstOrDefault();
+                if (wfRunProcessDTO == null)
+                {
+                    shifoubiaoji = "D";
+                    sifoudangqian = "D";
+                }
+                else
+                {
+                    dangqianbuzhou = wfRunProcessDTO.Step;
+                    //鏌ヨ瀹℃壒杩涘害
+                    lishiyijian = _wfHistoryService.GetListshenpi(wfRunProcessDTO.Id);
+                    if (wfRunProcessDTO.Step != "鎻愪氦")
+                    {
+                        shifoubiaoji = "D";
+                    }
+
+                    //鏌ヨ寰呭姙
+                    var chaxundaiban = _wfNeeddeelService.GetListTracking(wfRunProcessDTO.Id, wfRunProcessDTO.Step).Where(x => x.DeelUserId == curentuser.Id).ToList();
+                    if (chaxundaiban != null && chaxundaiban.Count > 0)
+                    {
+                        sifoudangqian = "A";
+                    }
+                    else
+                    {
+                        sifoudangqian = "D";
+                    }
+
+                }
+
+
+
+
+            }
+
+            ViewBag.shifoubiaoji = shifoubiaoji;
+            ViewBag.sifoudangqian = sifoudangqian;
+            ViewBag.lishiyijian = lishiyijian;
+            ViewBag.dangqianbuzhou = dangqianbuzhou;
+
+            ViewBag.shiyongstandard = _liaotianService.GetSYScode("ADM_Askzczbwsy", "shiyongstandard");
+
+
+            //ViewBag.CooperatecustomCustomerDTOs = _cooperatecustomCustomerService.GetList();
+
+            ViewData.Model = dto;
+            return View();
+        }
+
+
+        /// <summary>
+        /// 淇濆瓨閿�鍞垂鐢ㄧ敵璇�
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult SaveZBXXW(AdmAskzczbwsyDTO data)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ResultEntity resultEntity = new ResultEntity();
+            using (TransactionScope scope = new TransactionScope())
+            {
+                if (data.Step == "鎻愪氦")
+                {
+
+                    data.ShenpiStatus = "D";
+                    data.RecStatus = "A";
+                    data.Creater = curentuser.Id;
+                    data.Createtime = DateTime.Now;
+                    data.Modifier = data.Creater;
+                    data.Modifytime = data.Createtime;
+
+                    resultEntity = _askService.SaveAskZBXXW(data);
+                    if (!resultEntity.Result)
+                    {
+                        return new JsonResult(resultEntity);
+                    }
+                }
+                if (data.Step == "鎷涙爣淇℃伅缃戣瘯鐢ㄥ鎵�" && data.Tongguojujue == "A")
+                {
+                    //璋冪敤鎺ュ彛寮�鍚敤鎴疯瘯鐢ㄦ潈闄�
+
+                  var admAskzczbwsyDTO =  _askService.GetAskZBXXW(data.Id);
+                   var  userDTO   = _userService.GetPltUserEntity(admAskzczbwsyDTO.Creater);
+
+                    string huiyuanurl = _configuration.GetSection("huiyuanurl").Value;
+                    string SetCaseOrder = _configuration.GetSection("OASetOtherBusiness").Value;
+
+                    Uri postUrl2 = new Uri(huiyuanurl + SetCaseOrder);
+                    if (data.CustomerId != null && data.CustomerId.Length > 0)
+                    {
+                       for(int i=0;i< data.CustomerId.Length; i++)
+                        {
+                            if (data.Customertype[i] == "鍚堜綔瀹㈡埛")
+                            {
+                              var cooperatecustomCustomerDTO =  _cooperatecustomCustomerService.Get(data.CustomerId[i]);
+                                JObject questions2 = new JObject();
+                                questions2.Add("UserID", cooperatecustomCustomerDTO.HuiyuanId);
+                                questions2.Add("UserName", cooperatecustomCustomerDTO.Name);
+                                questions2.Add("PhoneNumber", cooperatecustomCustomerDTO.Tel);
+                                questions2.Add("BusinessKey", "CGGG");
+                                if (admAskzczbwsyDTO.Shiyongstandard == "01")
+                                {
+                                    questions2.Add("EndTime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss"));
+                                }
+                                else if (admAskzczbwsyDTO.Shiyongstandard == "02")
+                                {
+                                    questions2.Add("EndTime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss"));
+                                }
+                                else if(admAskzczbwsyDTO.Shiyongstandard == "03")
+                                {
+                                    questions2.Add("EndTime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss"));
+                                }
+
+
+
+
+                                questions2.Add("FromName",  userDTO.UserName +" " +userDTO.Phone);
+                                questions2.Add("Describe", "OA");
+
+
+                                string requestJson2 = questions2.ToString();
+                                string result2 = string.Empty;
+
+                                using (HttpContent httpContent = new StringContent(requestJson2))
+                                {
+                                    httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+
+
+                                    using (HttpClient httpClient = new HttpClient())
+                                    {
+                                        httpClient.Timeout = new TimeSpan(0, 0, 10);
+                                        HttpResponseMessage responseMessage = httpClient.PostAsync(postUrl2, httpContent).Result;
+                                        result2 = responseMessage.Content.ReadAsStringAsync().Result;
+                                    }
+                                }
+
+                                _logger.LogInformation("result2:" + result2);
+                                JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2);
+
+                                if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1")
+                                {
+                                    cooperatecustomCustomerDTO.HuiyuanId = jobjectresult["UserID"].ToString();
+                                    _cooperatecustomCustomerService.save(cooperatecustomCustomerDTO);
+                                    resultEntity.Result = true;
+                                }
+                                else
+                                {
+                                    resultEntity.Result = false;
+                                    resultEntity.Message = "寮�閫氭嫑鏍囦俊鎭綉璇曠敤鏉冮檺澶辫触";
+                                    return new JsonResult(resultEntity);
+                                }
+                            }
+                            else
+                            {
+                              var cooperatecustomCustomerDTO = _intentionCustomerService.Get(data.CustomerId[i]);
+                                JObject questions2 = new JObject();
+                                questions2.Add("UserID", cooperatecustomCustomerDTO.HuiyuanId);
+                                questions2.Add("UserName", cooperatecustomCustomerDTO.Name);
+                                questions2.Add("PhoneNumber", cooperatecustomCustomerDTO.Tel);
+                                questions2.Add("BusinessKey", "CGGG");
+                                if (admAskzczbwsyDTO.Shiyongstandard == "01")
+                                {
+                                    questions2.Add("EndTime", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss"));
+                                }
+                                else if (admAskzczbwsyDTO.Shiyongstandard == "02")
+                                {
+                                    questions2.Add("EndTime", DateTime.Now.AddMonths(2).ToString("yyyy-MM-dd HH:mm:ss"));
+                                }
+                                else if (admAskzczbwsyDTO.Shiyongstandard == "03")
+                                {
+                                    questions2.Add("EndTime", DateTime.Now.AddMonths(3).ToString("yyyy-MM-dd HH:mm:ss"));
+                                }
+
+
+
+
+                                questions2.Add("FromName", userDTO.UserName + " " + userDTO.Phone);
+                                questions2.Add("Describe", "OA");
+
+
+
+                                string requestJson2 = questions2.ToString();
+                                string result2 = string.Empty;
+
+                                using (HttpContent httpContent = new StringContent(requestJson2))
+                                {
+                                    httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+
+
+                                    using (HttpClient httpClient = new HttpClient())
+                                    {
+                                        httpClient.Timeout = new TimeSpan(0, 0, 10);
+                                        HttpResponseMessage responseMessage = httpClient.PostAsync(postUrl2, httpContent).Result;
+                                        result2 = responseMessage.Content.ReadAsStringAsync().Result;
+                                    }
+                                }
+
+                                _logger.LogInformation("result2:" + result2);
+                                JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2);
+
+                                if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1")
+                                {
+                                    cooperatecustomCustomerDTO.HuiyuanId = jobjectresult["UserID"].ToString();
+                                    _intentionCustomerService.save(cooperatecustomCustomerDTO);
+                                    resultEntity.Result = true;
+                                }
+                                else
+                                {
+                                    resultEntity.Result = false;
+                                    resultEntity.Message = "寮�閫氭嫑鏍囦俊鎭綉璇曠敤鏉冮檺澶辫触";
+                                    return new JsonResult(resultEntity);
+                                }
+                            }
+
+
+                           
+                        }
+                    }
+
+
+
+                  
+                    
+
+                }
+
+
+                    //鍙戣捣娴佺▼鐩稿叧
+
+                resultEntity = _wfRunProcessService.WfAskZBXXW(data.Id, data.Step, data.Tongguojujue, curentuser.Id, data.Content, data.Tittle, "v1");
+                if (!resultEntity.Result)
+                {
+                    return new JsonResult(resultEntity);
+                }
+                scope.Complete();
+            }
+            return new JsonResult(resultEntity);
+        }
+
     }
 }

--
Gitblit v1.9.1