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 |  449 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 418 insertions(+), 31 deletions(-)

diff --git a/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs b/zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
index 638a5d5..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]
@@ -687,6 +690,12 @@
 
             }
 
+
+            if(data.OrderType1 == "姘戜簨绾犵悍" || data.OrderType1 == "鍏朵粬绾犵悍")
+            {
+                data.OrderType2 = data.OrderType3;
+            }
+
             using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
            new TransactionOptions
            {
@@ -1011,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);
@@ -1078,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;
@@ -1134,9 +1202,10 @@
 
             ResultEntity resultEntity = new ResultEntity();
             resultEntity.Result = false;
+            
             using (TransactionScope scope = new TransactionScope())
             {
-
+              
                 CooperOrderDTO dto = _cooperOrderService.Get(Chedanid);
                 if (dto.ShouliStatus != "2")
                 {
@@ -1413,7 +1482,7 @@
                 var shi = _fiBookService.GetList().Select(x => new { code = x.Id, label = x.BookName }).ToList();
                 result = JsonConvert.SerializeObject(shi);
             }
-            if (OrderType == "02"  || OrderType == "04" || OrderType == "06"   || OrderType == "09")
+            if (OrderType == "02"  || OrderType == "04" || OrderType == "06"   || OrderType == "09" || OrderType == "08")
             {
                 var shi = _fiServiceService.GetList().Where(x=>x.ServiceTypeTop == OrderType).Select(x => new { code = x.ServiceType, label = x.ServiceType }).Distinct().ToList();
                 result = JsonConvert.SerializeObject(shi);
@@ -1429,7 +1498,7 @@
                 result = JsonConvert.SerializeObject(shi);
             }
 
-            if (OrderType == "08" || OrderType == "10" || OrderType == "11")
+            if (OrderType == "10" || OrderType == "11")
             {
                
                 result = "[]";
@@ -1612,13 +1681,7 @@
             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.status = _liaotianService.GetSYScode("t_challengeletter", "status").Select(x => new { code = x.CodeSn, label = x.Comments }).ToList();
@@ -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,12 +1762,38 @@
                     foreach (var challengeItemDTO in challengeletterDTO.challengeItemDTOs)
                     {
                       var sysCodeDtls2 =  sysCodeDtls1.Where(x => x.Classify1 == challengeItemDTO.Question).ToList();
+                        if (!string.IsNullOrEmpty(challengeItemDTO.Law) || !string.IsNullOrEmpty(ReturnID))
+                        {
+                            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;
                     }
                 }
                 else
                 {
-                    challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { new TChallengeItemDTO() };
+                    var challengeItemDTO = new TChallengeItemDTO();
+                    challengeItemDTO.Id = 1;
+                    challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { challengeItemDTO };
                     challengeletterDTO.challengeItemDTOs[0].sysCodeDtls = new List<SysCodeDtl>() { new SysCodeDtl() };
                 }
                   
@@ -1717,7 +1806,9 @@
             }
             else
             {
-                challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { new TChallengeItemDTO() };
+                var challengeItemDTO = new TChallengeItemDTO();
+                challengeItemDTO.Id = 1;
+                challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { challengeItemDTO };
                 challengeletterDTO.challengeItemDTOs[0].sysCodeDtls = new List<SysCodeDtl>() { new SysCodeDtl() };
                 challengeletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
             }
@@ -1759,7 +1850,7 @@
             return new JsonResult(resultEntity);
         }
 
-        public IActionResult getQuestionLaw(string id, string no)
+        public IActionResult getQuestionLaw(string id, string no,string challengeItemId = "")
         {
             ResultEntity<SysCodeDtl> resultEntity = new ResultEntity<SysCodeDtl>();
             resultEntity.Result = true;
@@ -1772,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)
@@ -1780,6 +1871,7 @@
             //    resultEntity.Message = sysCodeDtl.Contents;
             //}
             resultEntity.Message = no;
+            resultEntity.Remark = challengeItemId;
             resultEntity.DataList = sysCodeDtls;
 
             return new JsonResult(resultEntity);
@@ -1796,7 +1888,7 @@
             {
                 var sysCodeDtl1 = sysCodeDtls.Where(x => x.CodeSn == sysCodeDtl.Comments).FirstOrDefault();
                 if (sysCodeDtl1 != null)
-                    sysCodeDtl.CodeSn = sysCodeDtl1.Comments;
+                    sysCodeDtl.Classify3 = sysCodeDtl1.Comments;
             }
 
             //璐ㄧ枒鍑�
@@ -2015,7 +2107,7 @@
                     challengeletterDTO.DocumentsDate = data.zhiyiDocumentsDate;
                     challengeletterDTO.Modifier = curentuser.Id;
                     challengeletterDTO.Modifytime = DateTime.Now;
-                    challengeletterDTO.Status = 2;
+                    challengeletterDTO.Status = int.Parse(data.Status);
                     challengeletterDTO.RequestInfo = data.RequestInfo;
                     challengeletterDTO.PrintNum = data.PrintNum;
                     resultEntity = _cooperOrderService.saveChallengeletter(challengeletterDTO);
@@ -2039,7 +2131,7 @@
                     challengeletterDTO.Modifytime = DateTime.Now;
                     challengeletterDTO.Creater = curentuser.Id;
                     challengeletterDTO.Createtime = challengeletterDTO.Modifytime;
-                    challengeletterDTO.Status = 2;
+                    challengeletterDTO.Status =  int.Parse(data.Status); ;
                     challengeletterDTO.RequestInfo = data.RequestInfo;
                     challengeletterDTO.PrintNum = data.PrintNum;
                     resultEntity = _cooperOrderService.saveChallengeletter(challengeletterDTO);
@@ -2078,11 +2170,29 @@
                             && string.IsNullOrEmpty(data.Evidential[i])
                            ))
                         {
+                            string Law = "";
+                            var challengeItemId = data.challengeItemId[i];
+                            var Laws = data.Law;
+                            var challengeItemIdlaw = data.challengeItemIdlaw;
+                            if(Laws != null&& Laws.Length > 0)
+                            {
+                                for (int j = 0; j < Laws.Length; j++)
+                                {
+                                    if(challengeItemId == challengeItemIdlaw[j])
+                                    {
+                                        Law += Laws[j] + ",";
+                                    }
+
+                                }
+                                if(!string.IsNullOrEmpty(Law))
+                                    Law = Law.TrimEnd(',');  //绉婚櫎鏈�鍚庣殑閫楀彿
+                            }
+
                             var challengeItemDTO = new TChallengeItemDTO();
                             challengeItemDTO.ChallengeId = challengeletterDTO.Id;
                             challengeItemDTO.Question = data.Question[i];
                             challengeItemDTO.Evidential = data.Evidential[i];
-                            //challengeItemDTO.Law = data.Law[i];
+                            challengeItemDTO.Law = Law;
                             //challengeItemDTO.Lawcoment = data.Lawcoment[i];
                             challengeItemDTO.Sort = i;
                             resultEntity = _cooperOrderService.saveChallengeItem(challengeItemDTO);
@@ -2108,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);
@@ -2127,6 +2237,10 @@
                     foreach (var challengeItemDTO in challengeletterDTO.challengeItemDTOs)
                     {
                         var sysCodeDtls2 = sysCodeDtls1.Where(x => x.Classify1 == challengeItemDTO.Question).ToList();
+                        if (!string.IsNullOrEmpty(challengeItemDTO.Law))
+                        {
+                            sysCodeDtls2 = sysCodeDtls2.Where(x => challengeItemDTO.Law.Split(',').Contains(x.CodeSn)).ToList();
+                        }
                         challengeItemDTO.sysCodeDtls = sysCodeDtls2;
                     }
                 }
@@ -2169,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;
@@ -2188,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);
@@ -2224,12 +2381,41 @@
                     foreach (var complaintItemDTO in complaintletterDTO.complaintItemDTOs)
                     {
                         var sysCodeDtls2 = sysCodeDtls1.Where(x => x.Classify1 == complaintItemDTO.Question).ToList();
+                       
+
+                        if (!string.IsNullOrEmpty(complaintItemDTO.Law) || !string.IsNullOrEmpty(ReturnID))
+                        {
+                            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;
                     }
                 }
                 else
                 {
-                    complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { new TComplaintItemDTO() };
+                    var complaintItemDTO = new TComplaintItemDTO();
+                    complaintItemDTO.Id = 1;
+                    complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { complaintItemDTO };
                     complaintletterDTO.complaintItemDTOs[0].sysCodeDtls = new List<SysCodeDtl>() { new SysCodeDtl() };
                 }
                    
@@ -2255,15 +2441,66 @@
             }
             else
             {
-                complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { new TComplaintItemDTO() };
+                var complaintItemDTO = new TComplaintItemDTO();
+                complaintItemDTO.Id = 1;
+                complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { complaintItemDTO };
                 complaintletterDTO.complaintItemDTOs[0].sysCodeDtls = new List<SysCodeDtl>() { new SysCodeDtl() };
                 complaintletterDTO.complaintRespondentDTOs = new List<TComplaintRespondentDTO>() { new TComplaintRespondentDTO() };
                 complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                 complaintletterDTO.complaintGongyingshangDTOs = new List<TComplaintGongyingshangDTO>()/* { new TComplaintGongyingshangDTO() }*/;
 
             }
+            //鍒ゆ柇鏄惁鏈夎川鐤戝嚱
+            if (complaintletterDTO.Status != 2)
+            {
+                CooperOrderDTO cooperOrderDTO = _cooperOrderService.Get(complaintletterDTO.OrderId);
+                List<TChallengeletterDTO> challengeletterDTOs = _cooperOrderService.GetListChallengelettertousu(cooperOrderDTO.Khdw, complaintletterDTO.XmCode);
+
+                if(challengeletterDTOs!=null&& challengeletterDTOs.Count > 0)
+                {
+                    TChallengeletterDTO challengeletterDTO = challengeletterDTOs[0];
+                    complaintletterDTO.PurchaserName = challengeletterDTO.PurchaserName;
+                    complaintletterDTO.ChallengeDateName = challengeletterDTO.DocumentsDate.HasValue ? challengeletterDTO.DocumentsDate.Value.ToString("yyyy-MM-dd") : "";
+                    complaintletterDTO.RequestInfo = challengeletterDTO.RequestInfo;
+                    complaintletterDTO.Questioned = challengeletterDTO.PurchaserName;
+                    complaintletterDTO.complaintShouquandaibiaoDTOs = _cooperOrderService.GetListComplaintShouquandaibiao(challengeletterDTO.Id);
+                    if (complaintletterDTO.complaintShouquandaibiaoDTOs.Count == 0)
+                        complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
 
 
+                    List<TChallengeItemDTO> challengeItemDTOs = _cooperOrderService.GetListChallengeItem(challengeletterDTO.Id);
+                    if (challengeItemDTOs.Count > 0)
+                    {
+                        List<TComplaintItemDTO> complaintItemDTOs = new List<TComplaintItemDTO>();
+                        foreach(var challengeItemDTO in challengeItemDTOs)
+                        {
+                            TComplaintItemDTO complaintItemDTO = new TComplaintItemDTO();
+                            complaintItemDTO.Id = challengeItemDTO.Id;
+                            complaintItemDTO.ComplaintId = challengeItemDTO.ChallengeId;
+                            complaintItemDTO.Question = challengeItemDTO.Question;
+                            complaintItemDTO.Evidential = challengeItemDTO.Evidential;
+                            complaintItemDTO.Law = challengeItemDTO.Law;
+                            complaintItemDTO.Lawcoment = challengeItemDTO.Lawcoment;
+                            complaintItemDTO.Sort = challengeItemDTO.Sort;
+
+                            complaintItemDTOs.Add(complaintItemDTO);
+                        }
+
+                        complaintletterDTO.complaintItemDTOs = complaintItemDTOs;
+                        foreach (var complaintItemDTO in complaintletterDTO.complaintItemDTOs)
+                        {
+                            var sysCodeDtls2 = sysCodeDtls1.Where(x => x.Classify1 == complaintItemDTO.Question).ToList();
+                            complaintItemDTO.sysCodeDtls = sysCodeDtls2;
+                        }
+                    }
+                    else
+                    {
+                        complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { new TComplaintItemDTO() };
+                        complaintletterDTO.complaintItemDTOs[0].sysCodeDtls = new List<SysCodeDtl>() { new SysCodeDtl() };
+                    }
+
+                }
+            }
 
 
             ViewBag.request_info = _liaotianService.GetSYScode("t_challengeletter", "request_info").OrderBy(x => x.CodeSn).ToList();//璐ㄧ枒璇锋眰
@@ -2341,7 +2578,7 @@
 
                     complaintletterDTO.Modifier = curentuser.Id;
                     complaintletterDTO.Modifytime = DateTime.Now;
-                    complaintletterDTO.Status = 2;
+                    complaintletterDTO.Status = int.Parse(data.Status);
                     complaintletterDTO.RequestInfo = data.RequestInfo;
                     complaintletterDTO.PrintNum = data.PrintNum;
                     complaintletterDTO.TsrId = data.TsrId;
@@ -2380,7 +2617,7 @@
                     complaintletterDTO.Modifytime = DateTime.Now;
                     complaintletterDTO.Creater = curentuser.Id;
                     complaintletterDTO.Createtime = complaintletterDTO.Modifytime;
-                    complaintletterDTO.Status = 2;
+                    complaintletterDTO.Status =  int.Parse(data.Status);
                     complaintletterDTO.RequestInfo = data.RequestInfo;
                     complaintletterDTO.PrintNum = data.PrintNum;
                     complaintletterDTO.TsrId = data.TsrId;
@@ -2474,11 +2711,29 @@
                             && string.IsNullOrEmpty(data.Evidential[i])
                             ))
                         {
+                            string Law = "";
+                            var complaintItemId = data.complaintItemId[i];
+                            var Laws = data.Law;
+                            var complaintItemIdlaw = data.complaintItemIdlaw;
+                            if (Laws != null && Laws.Length > 0)
+                            {
+                                for (int j = 0; j < Laws.Length; j++)
+                                {
+                                    if (complaintItemId == complaintItemIdlaw[j])
+                                    {
+                                        Law += Laws[j] + ",";
+                                    }
+
+                                }
+                                if (!string.IsNullOrEmpty(Law))
+                                    Law = Law.TrimEnd(',');  //绉婚櫎鏈�鍚庣殑閫楀彿
+                            }
+
                             var complaintItemDTO = new TComplaintItemDTO();
                             complaintItemDTO.ComplaintId = complaintletterDTO.Id;
                             complaintItemDTO.Question = data.Question[i];
                             complaintItemDTO.Evidential = data.Evidential[i];
-                            //complaintItemDTO.Law = data.Law[i];
+                            complaintItemDTO.Law = Law;
                             //complaintItemDTO.Lawcoment = data.Lawcoment[i];
                             complaintItemDTO.Sort = i;
                             resultEntity = _cooperOrderService.saveComplaintItem(complaintItemDTO);
@@ -2505,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);
@@ -2541,6 +2796,10 @@
                     foreach (var complaintItemDTO in complaintletterDTO.complaintItemDTOs)
                     {
                         var sysCodeDtls2 = sysCodeDtls1.Where(x => x.Classify1 == complaintItemDTO.Question).ToList();
+                        if (!string.IsNullOrEmpty(complaintItemDTO.Law))
+                        {
+                            sysCodeDtls2 = sysCodeDtls2.Where(x => complaintItemDTO.Law.Split(',').Contains(x.CodeSn)).ToList();
+                        }
                         complaintItemDTO.sysCodeDtls = sysCodeDtls2;
                     }
                 }
@@ -2621,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