From 6c0b60ad8577af7a2ea98fbf446e3cb83e79c776 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期一, 25 七月 2022 11:24:12 +0800
Subject: [PATCH] 文书管理

---
 zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs |  311 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 294 insertions(+), 17 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
index ff08a23..b1ed7a0 100644
--- a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
+++ b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
@@ -47,6 +47,7 @@
         private readonly IFiOrderrecievemoneyService _fiOrderrecievemoneyService;
         private readonly IFiAccountService _fiAccountService;
         private readonly IFiAccountRecordService _iFiAccountRecordService;
+        private readonly ISysAttachmentService _sysAttachmentService;
 
 
         public CooperOrderController(ILogger<CooperOrderController> logger, ILiaotianService liaotianService, IUserService userService, ICooperOrderService cooperOrderService
@@ -60,6 +61,7 @@
             , IFiOrderrecievemoneyService fiOrderrecievemoneyService
             , IFiAccountService fiAccountService
             , IFiAccountRecordService iFiAccountRecordService
+             , ISysAttachmentService sysAttachmentService
             )
         {
             _logger = logger;
@@ -80,6 +82,7 @@
             _fiOrderrecievemoneyService = fiOrderrecievemoneyService;
             _fiAccountService = fiAccountService;
             _iFiAccountRecordService = iFiAccountRecordService;
+            _sysAttachmentService = sysAttachmentService;
         }
 
         [CheckLogin]
@@ -1017,7 +1020,13 @@
             ResultEntity resultEntity = new ResultEntity();
             resultEntity.Result = false;
 
-            using (TransactionScope scope = new TransactionScope())
+            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
+          new TransactionOptions
+          {
+              IsolationLevel = IsolationLevel.ReadCommitted,
+              Timeout = TransactionManager.MaximumTimeout
+          }
+          ))
             {
 
                 CooperOrderDTO dto = _cooperOrderService.Get(id);
@@ -1084,6 +1093,59 @@
                 }
 
 
+                if(dto.Money<=0 && dto.OrderType == "05")
+                {
+                var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(dto.Khdw);
+                var fiMemberDTO = _fiMemberService.Get(dto.OrderType1);
+                //寮�閫氫細鍛�
+                string huiyuanurl = _configuration.GetSection("huiyuanurl").Value;
+                string OAWriteChangeAsync = _configuration.GetSection("OAWriteChangeAsync").Value;
+
+                Uri postUrl2 = new Uri(huiyuanurl + OAWriteChangeAsync);
+                JObject questions2 = new JObject();
+                questions2.Add("UserID", cooperatecustomCustomerDTO.HuiyuanId);
+                questions2.Add("PhoneNumber", cooperatecustomCustomerDTO.Tel);
+                questions2.Add("VIPName", fiMemberDTO.MemberType);
+                questions2.Add("FromName", "OA");
+                questions2.Add("UserName", cooperatecustomCustomerDTO.Name);
+
+
+
+
+
+                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);
+                    }
+
+                }
 
                 dto.Shoulier = curentuser.Id;
                 dto.Shoulitime = DateTime.Now;
@@ -1140,9 +1202,10 @@
 
             ResultEntity resultEntity = new ResultEntity();
             resultEntity.Result = false;
+            
             using (TransactionScope scope = new TransactionScope())
             {
-
+              
                 CooperOrderDTO dto = _cooperOrderService.Get(Chedanid);
                 if (dto.ShouliStatus != "2")
                 {
@@ -1669,7 +1732,7 @@
 
 
 
-        public IActionResult EditZhiyihan(string id = null)
+        public IActionResult EditZhiyihan(string id = null, string ReturnID = null)
         {
             var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
             ViewData["curentuser"] = curentuser;
@@ -1679,7 +1742,7 @@
             {
                 var sysCodeDtl1 = sysCodeDtls.Where(x => x.CodeSn == sysCodeDtl.Comments).FirstOrDefault();
                 if (sysCodeDtl1 != null)
-                    sysCodeDtl.CodeSn = sysCodeDtl1.Comments;
+                    sysCodeDtl.Classify3 = sysCodeDtl1.Comments;
             }
 
             //璐ㄧ枒鍑�
@@ -1699,9 +1762,29 @@
                     foreach (var challengeItemDTO in challengeletterDTO.challengeItemDTOs)
                     {
                       var sysCodeDtls2 =  sysCodeDtls1.Where(x => x.Classify1 == challengeItemDTO.Question).ToList();
-                        if (!string.IsNullOrEmpty(challengeItemDTO.Law))
+                        if (!string.IsNullOrEmpty(challengeItemDTO.Law) || !string.IsNullOrEmpty(ReturnID))
                         {
-                            sysCodeDtls2 = sysCodeDtls2.Where(x => challengeItemDTO.Law.Split(',').Contains(x.Comments)).ToList();
+                            var law = "";
+                            if (!string.IsNullOrEmpty(challengeItemDTO.Law))
+                            {
+                                law = challengeItemDTO.Law;
+                                if (!string.IsNullOrEmpty(ReturnID))
+                                {
+                                    law += "," + ReturnID;
+                                }
+
+                            }
+                            else
+                            {
+                                law = ReturnID;
+                            }
+
+                            if (!string.IsNullOrEmpty(law))
+                            {
+                                sysCodeDtls2 = sysCodeDtls2.Where(x => law.Split(',').Contains(x.CodeSn)).ToList();
+                            }
+
+                           
                         }
                         challengeItemDTO.sysCodeDtls = sysCodeDtls2;
                     }
@@ -1780,7 +1863,7 @@
             {
                 var sysCodeDtl1 = sysCodeDtls1.Where(x => x.CodeSn == sysCodeDtl.Comments).FirstOrDefault();
                 if (sysCodeDtl1 != null)
-                    sysCodeDtl.CodeSn = sysCodeDtl1.Comments;
+                    sysCodeDtl.Classify3 = sysCodeDtl1.Comments;
             }
 
             //if (sysCodeDtl != null)
@@ -1805,7 +1888,7 @@
             {
                 var sysCodeDtl1 = sysCodeDtls.Where(x => x.CodeSn == sysCodeDtl.Comments).FirstOrDefault();
                 if (sysCodeDtl1 != null)
-                    sysCodeDtl.CodeSn = sysCodeDtl1.Comments;
+                    sysCodeDtl.Classify3 = sysCodeDtl1.Comments;
             }
 
             //璐ㄧ枒鍑�
@@ -2135,7 +2218,7 @@
             {
                 var sysCodeDtl1 = sysCodeDtls.Where(x => x.CodeSn == sysCodeDtl.Comments).FirstOrDefault();
                 if (sysCodeDtl1 != null)
-                    sysCodeDtl.CodeSn = sysCodeDtl1.Comments;
+                    sysCodeDtl.Classify3 = sysCodeDtl1.Comments;
             }
             //璐ㄧ枒鍑�
             List<TChallengeletterDTO> challengeletterDTOs = _cooperOrderService.GetListChallengeletter(id);
@@ -2156,7 +2239,7 @@
                         var sysCodeDtls2 = sysCodeDtls1.Where(x => x.Classify1 == challengeItemDTO.Question).ToList();
                         if (!string.IsNullOrEmpty(challengeItemDTO.Law))
                         {
-                            sysCodeDtls2 = sysCodeDtls2.Where(x => challengeItemDTO.Law.Split(',').Contains(x.Comments)).ToList();
+                            sysCodeDtls2 = sysCodeDtls2.Where(x => challengeItemDTO.Law.Split(',').Contains(x.CodeSn)).ToList();
                         }
                         challengeItemDTO.sysCodeDtls = sysCodeDtls2;
                     }
@@ -2200,15 +2283,58 @@
             //ViewBag.law = sysCodeDtls1;//娉曞緥渚濇嵁
 
 
+            var cooperOrderDTO = _cooperOrderService.Get(id);
+            var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(cooperOrderDTO.Khdw);
+            if (cooperatecustomCustomerDTO.Name.IndexOf("鑲′唤鏈夐檺鍏徃") >= 0)
+            {
+                cooperatecustomCustomerDTO.Zhiwu = "钁d簨闀�";
+            }
+            else if (cooperatecustomCustomerDTO.Name.IndexOf("鏈夐檺鍏徃") >= 0 || cooperatecustomCustomerDTO.Name.IndexOf("鏈夐檺璐d换鍏徃") >= 0)
+            {
+                cooperatecustomCustomerDTO.Zhiwu = "鎵ц钁d簨";
+            }
+            else if (cooperatecustomCustomerDTO.Name.IndexOf("鍗忎細") >= 0)
+            {
+                cooperatecustomCustomerDTO.Zhiwu = "浼氶暱";
+            }
+            else 
+            {
+                cooperatecustomCustomerDTO.Zhiwu = "鎬荤粡鐞�";
+            }
 
 
+            ResultDataEntity<SysAttachmentDTO> resultsyinyezhizhao = new ResultDataEntity<SysAttachmentDTO>();
+
+            SysAttachmentDTOSearch searchEntity = new SysAttachmentDTOSearch();
+            searchEntity.page = 1;
+            searchEntity.rows = 1000;
+            searchEntity.AttObj = "Cooperyinyezhizhao";
+            searchEntity.AttObjid = cooperOrderDTO.Khdw;
+            resultsyinyezhizhao = _sysAttachmentService.SearchByPaging(searchEntity);
+
+            ViewBag.yinyezhizhao = resultsyinyezhizhao;
+
+
+            ResultDataEntity<SysAttachmentDTO> resultshenfenzheng = new ResultDataEntity<SysAttachmentDTO>();
+
+            SysAttachmentDTOSearch searchEntity1 = new SysAttachmentDTOSearch();
+            searchEntity1.page = 1;
+            searchEntity1.rows = 1000;
+            searchEntity1.AttObj = "Cooperashenfenzheng";
+            searchEntity1.AttObjid = cooperOrderDTO.Khdw;
+            resultshenfenzheng = _sysAttachmentService.SearchByPaging(searchEntity1);
+            ViewBag.shenfenzheng = resultshenfenzheng;
+
+            ViewBag.cooperatecustomCustomerDTO = cooperatecustomCustomerDTO;
 
             ViewData.Model = challengeletterDTO;
+
+            
             return View();
         }
 
 
-        public IActionResult EditTousushu(string id = null)
+        public IActionResult EditTousushu(string id = null, string ReturnID = null)
         {
             var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
             ViewData["curentuser"] = curentuser;
@@ -2219,7 +2345,7 @@
             {
                 var sysCodeDtl1 = sysCodeDtls.Where(x => x.CodeSn == sysCodeDtl.Comments).FirstOrDefault();
                 if (sysCodeDtl1 != null)
-                    sysCodeDtl.CodeSn = sysCodeDtl1.Comments;
+                    sysCodeDtl.Classify3 = sysCodeDtl1.Comments;
             }
             //鎶曡瘔涔�
             List<TComplaintletterDTO> complaintletterDTOs = _cooperOrderService.GetListComplaintletter(id);
@@ -2255,10 +2381,33 @@
                     foreach (var complaintItemDTO in complaintletterDTO.complaintItemDTOs)
                     {
                         var sysCodeDtls2 = sysCodeDtls1.Where(x => x.Classify1 == complaintItemDTO.Question).ToList();
-                        if (!string.IsNullOrEmpty(complaintItemDTO.Law))
+                       
+
+                        if (!string.IsNullOrEmpty(complaintItemDTO.Law) || !string.IsNullOrEmpty(ReturnID))
                         {
-                            sysCodeDtls2 = sysCodeDtls2.Where(x => complaintItemDTO.Law.Split(',').Contains(x.Comments)).ToList();
+                            var law = "";
+                            if (!string.IsNullOrEmpty(complaintItemDTO.Law))
+                            {
+                                law = complaintItemDTO.Law;
+                                if (!string.IsNullOrEmpty(ReturnID))
+                                {
+                                    law += "," + ReturnID;
+                                }
+
+                            }
+                            else
+                            {
+                                law = ReturnID;
+                            }
+
+                            if (!string.IsNullOrEmpty(law))
+                            {
+                                sysCodeDtls2 = sysCodeDtls2.Where(x => law.Split(',').Contains(x.CodeSn)).ToList();
+                            }
+
+
                         }
+
                         complaintItemDTO.sysCodeDtls = sysCodeDtls2;
                     }
                 }
@@ -2611,7 +2760,7 @@
             {
                 var sysCodeDtl1 = sysCodeDtls.Where(x => x.CodeSn == sysCodeDtl.Comments).FirstOrDefault();
                 if (sysCodeDtl1 != null)
-                    sysCodeDtl.CodeSn = sysCodeDtl1.Comments;
+                    sysCodeDtl.Classify3 = sysCodeDtl1.Comments;
             }
             //鎶曡瘔涔�
             List<TComplaintletterDTO> complaintletterDTOs = _cooperOrderService.GetListComplaintletter(id);
@@ -2649,7 +2798,7 @@
                         var sysCodeDtls2 = sysCodeDtls1.Where(x => x.Classify1 == complaintItemDTO.Question).ToList();
                         if (!string.IsNullOrEmpty(complaintItemDTO.Law))
                         {
-                            sysCodeDtls2 = sysCodeDtls2.Where(x => complaintItemDTO.Law.Split(',').Contains(x.Comments)).ToList();
+                            sysCodeDtls2 = sysCodeDtls2.Where(x => complaintItemDTO.Law.Split(',').Contains(x.CodeSn)).ToList();
                         }
                         complaintItemDTO.sysCodeDtls = sysCodeDtls2;
                     }
@@ -2731,14 +2880,142 @@
 
                 
             }
-             
+
+            var cooperOrderDTO = _cooperOrderService.Get(id);
+            var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(cooperOrderDTO.Khdw);
+            if (cooperatecustomCustomerDTO.Name.IndexOf("鑲′唤鏈夐檺鍏徃") >= 0)
+            {
+                cooperatecustomCustomerDTO.Zhiwu = "钁d簨闀�";
+            }
+            else if (cooperatecustomCustomerDTO.Name.IndexOf("鏈夐檺鍏徃") >= 0 || cooperatecustomCustomerDTO.Name.IndexOf("鏈夐檺璐d换鍏徃") >= 0)
+            {
+                cooperatecustomCustomerDTO.Zhiwu = "鎵ц钁d簨";
+            }
+            else if (cooperatecustomCustomerDTO.Name.IndexOf("鍗忎細") >= 0)
+            {
+                cooperatecustomCustomerDTO.Zhiwu = "浼氶暱";
+            }
+            else
+            {
+                cooperatecustomCustomerDTO.Zhiwu = "鎬荤粡鐞�";
+            }
 
 
+            ResultDataEntity<SysAttachmentDTO> resultsyinyezhizhao = new ResultDataEntity<SysAttachmentDTO>();
 
+            SysAttachmentDTOSearch searchEntity = new SysAttachmentDTOSearch();
+            searchEntity.page = 1;
+            searchEntity.rows = 1000;
+            searchEntity.AttObj = "Cooperyinyezhizhao";
+            searchEntity.AttObjid = cooperOrderDTO.Khdw;
+            resultsyinyezhizhao = _sysAttachmentService.SearchByPaging(searchEntity);
+
+            ViewBag.yinyezhizhao = resultsyinyezhizhao;
+
+
+            ResultDataEntity<SysAttachmentDTO> resultshenfenzheng = new ResultDataEntity<SysAttachmentDTO>();
+
+            SysAttachmentDTOSearch searchEntity1 = new SysAttachmentDTOSearch();
+            searchEntity1.page = 1;
+            searchEntity1.rows = 1000;
+            searchEntity1.AttObj = "Cooperashenfenzheng";
+            searchEntity1.AttObjid = cooperOrderDTO.Khdw;
+            resultshenfenzheng = _sysAttachmentService.SearchByPaging(searchEntity1);
+            ViewBag.shenfenzheng = resultshenfenzheng;
+
+            ViewBag.cooperatecustomCustomerDTO = cooperatecustomCustomerDTO;
 
 
             ViewData.Model = complaintletterDTO;
             return View();
         }
+
+
+
+
+        public IActionResult Printbiaoshuhetong(string id = null)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+
+           var cooperOrderDTO =  _cooperOrderService.Get(id);
+           var cooperatecustomCustomerDTO =  _cooperatecustomCustomerService.Get(cooperOrderDTO.Khdw);
+            cooperOrderDTO.MoneyName = MoneyToUpperHelper.MoneyToUpper(cooperOrderDTO.Money.Value.ToString("0.##"));
+
+            ViewData["cooperOrderDTO"] = cooperOrderDTO;
+            ViewData["cooperatecustomCustomerDTO"] = cooperatecustomCustomerDTO;
+
+
+            return View();
+        }
+
+        public IActionResult Printzhiyitousuhetong(string id = null)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+
+            var cooperOrderDTO = _cooperOrderService.Get(id);
+            var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(cooperOrderDTO.Khdw);
+            cooperOrderDTO.MoneyName = MoneyToUpperHelper.MoneyToUpper(cooperOrderDTO.Money.Value.ToString("0.##"));
+
+            ViewData["cooperOrderDTO"] = cooperOrderDTO;
+            ViewData["cooperatecustomCustomerDTO"] = cooperatecustomCustomerDTO;
+
+
+            return View();
+        }
+
+        public IActionResult Printhuiyuanhetong(string id = null)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+
+            var cooperOrderDTO = _cooperOrderService.Get(id);
+            var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(cooperOrderDTO.Khdw);
+            cooperOrderDTO.MoneyName = MoneyToUpperHelper.MoneyToUpper(cooperOrderDTO.Money.Value.ToString("0.##"));
+
+            FiMemberDTO fiMemberDTO = _fiMemberService.GetList().Where(x => x.Id == cooperOrderDTO.OrderType1).FirstOrDefault();
+
+            if (fiMemberDTO != null)
+            {
+                cooperOrderDTO.OrderType1Name = fiMemberDTO.MemberType;
+                cooperOrderDTO.OrderType2 = fiMemberDTO.MemberAuthority;
+            }
+             
+
+
+
+            ViewData["cooperOrderDTO"] = cooperOrderDTO;
+            ViewData["cooperatecustomCustomerDTO"] = cooperatecustomCustomerDTO;
+
+
+            return View();
+        }
+
+        public IActionResult Printfengxianhetong(string id = null)
+        {
+            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
+            ViewData["curentuser"] = curentuser;
+
+            var cooperOrderDTO = _cooperOrderService.Get(id);
+            var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(cooperOrderDTO.Khdw);
+            cooperOrderDTO.MoneyName = MoneyToUpperHelper.MoneyToUpper(cooperOrderDTO.Money.Value.ToString("0.##"));
+            var jichumoney = cooperOrderDTO.Jichumoney.HasValue ? cooperOrderDTO.Jichumoney.Value : 0;
+            var tuihuimoney = cooperOrderDTO.Money.Value - jichumoney;
+
+            cooperOrderDTO.Jichumoney = tuihuimoney;
+            cooperOrderDTO.JichumoneyName = MoneyToUpperHelper.MoneyToUpper(tuihuimoney.ToString("0.##"));
+
+
+
+
+            ViewData["cooperOrderDTO"] = cooperOrderDTO;
+            ViewData["cooperatecustomCustomerDTO"] = cooperatecustomCustomerDTO;
+
+
+            return View();
+        }
+
+
     }
 }

--
Gitblit v1.9.1