username@email.com
2022-07-28 976aa1a04fff81af4939affa80d3357013157353
zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
@@ -418,12 +418,15 @@
            return new JsonResult(_cooperOrderService.SearchByPaging(search));
        }
        [CheckLogin]
        public IActionResult Edit(string id = null, string ShouliStatus = "1")
        public IActionResult Edit(string id = null, string ShouliStatus = "1",string dingdantype = "0")
        {
            var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User"));
            ViewData["curentuser"] = curentuser;
            CooperOrderDTO dto = new CooperOrderDTO();
            if(dingdantype == "0")
            {
            if (!String.IsNullOrEmpty(id))
            {
                dto = _cooperOrderService.Get(id);
@@ -530,6 +533,122 @@
                ViewBag.complaintletterDTO = complaintletterDTO;
            }
            }
            else if (dingdantype == "1")
            {
                dto = _cooperOrderService.Get(id);
                ViewBag.ShouliStatus = ShouliStatus;
                //质疑函
                TChallengeletterDTO challengeletterDTO = new TChallengeletterDTO();
                challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { new TChallengeItemDTO() };
                challengeletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                ViewBag.challengeletterDTO = challengeletterDTO;
                //投诉书
                TComplaintletterDTO complaintletterDTO = new TComplaintletterDTO();
                complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { new TComplaintItemDTO() };
                complaintletterDTO.complaintRespondentDTOs = new List<TComplaintRespondentDTO>() { new TComplaintRespondentDTO() };
                //complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                complaintletterDTO.complaintGongyingshangDTOs = new List<TComplaintGongyingshangDTO>()/* { new TComplaintGongyingshangDTO() }*/;
                List<TChallengeletterDTO> challengeletterDTOs = _cooperOrderService.GetListChallengeletter(id);
                if (challengeletterDTOs != null && challengeletterDTOs.Count > 0)
                {
                    complaintletterDTO.TsrName = challengeletterDTOs[0].GysName;
                    complaintletterDTO.TsrAddress = challengeletterDTOs[0].GysAddress;
                    complaintletterDTO.TsrPostcode = challengeletterDTOs[0].GysPostcode;
                    complaintletterDTO.TsrCorporation = challengeletterDTOs[0].GysContacts;
                    complaintletterDTO.TsrPhone = challengeletterDTOs[0].GysPhone;
                    complaintletterDTO.XmName = challengeletterDTOs[0].XmName;
                    complaintletterDTO.XmCode = challengeletterDTOs[0].XmCode;
                    complaintletterDTO.XmPackage = challengeletterDTOs[0].XmPackage;
                    complaintletterDTO.PurchaserName = challengeletterDTOs[0].PurchaserName;
                    //complaintletterDTO.Agency = challengeletterDTOs[0].PurchaserName;
                    complaintletterDTO.ChallengeDateName = challengeletterDTOs[0].DocumentsDate.HasValue ? challengeletterDTOs[0].DocumentsDate.Value.ToString("yyyy-MM-dd") : "";
                    complaintletterDTO.RequestInfo = challengeletterDTOs[0].RequestInfo;
                    complaintletterDTO.Questioned = challengeletterDTOs[0].PurchaserName;
                    List<TComplaintShouquandaibiaoDTO> complaintShouquandaibiaoDTOs = _cooperOrderService.GetListComplaintShouquandaibiao(challengeletterDTOs[0].Id);
                    if (complaintShouquandaibiaoDTOs.Count > 0)
                        complaintletterDTO.complaintShouquandaibiaoDTOs = complaintShouquandaibiaoDTOs;
                    else
                        complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                }
                    ViewBag.complaintletterDTO = complaintletterDTO;
                dto.Id = "";
                dto.OrderType = "02";
                dto.OrderType1 = "代拟投诉书";
                //dto.OrderType2 = "";
            }
            else if (dingdantype == "2")
            {
                dto = _cooperOrderService.Get(id);
                ViewBag.ShouliStatus = ShouliStatus;
                dto.Id = "";
                dto.OrderType = "08";
                dto.OrderType1 = "复议诉讼";
                dto.OrderType2 = "";
                //质疑函
                TChallengeletterDTO challengeletterDTO = new TChallengeletterDTO();
                challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { new TChallengeItemDTO() };
                challengeletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                ViewBag.challengeletterDTO = challengeletterDTO;
                //投诉书
                TComplaintletterDTO complaintletterDTO = new TComplaintletterDTO();
                complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { new TComplaintItemDTO() };
                complaintletterDTO.complaintRespondentDTOs = new List<TComplaintRespondentDTO>() { new TComplaintRespondentDTO() };
                complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                complaintletterDTO.complaintGongyingshangDTOs = new List<TComplaintGongyingshangDTO>()/* { new TComplaintGongyingshangDTO() }*/;
                ViewBag.complaintletterDTO = complaintletterDTO;
            }
            else if (dingdantype == "3")
            {
                dto = _cooperOrderService.Get(id);
                ViewBag.ShouliStatus = ShouliStatus;
                dto.Id = "";
                //质疑函
                TChallengeletterDTO challengeletterDTO = new TChallengeletterDTO();
                challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { new TChallengeItemDTO() };
                challengeletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                ViewBag.challengeletterDTO = challengeletterDTO;
                //投诉书
                TComplaintletterDTO complaintletterDTO = new TComplaintletterDTO();
                complaintletterDTO.complaintItemDTOs = new List<TComplaintItemDTO>() { new TComplaintItemDTO() };
                complaintletterDTO.complaintRespondentDTOs = new List<TComplaintRespondentDTO>() { new TComplaintRespondentDTO() };
                complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                complaintletterDTO.complaintGongyingshangDTOs = new List<TComplaintGongyingshangDTO>()/* { new TComplaintGongyingshangDTO() }*/;
                ViewBag.complaintletterDTO = complaintletterDTO;
            }
            ViewBag.request_info = _liaotianService.GetSYScode("t_challengeletter", "request_info");//质疑请求
            ViewBag.question = _liaotianService.GetSYScode("t_challenge_items", "question"); //   质疑事项
            ViewBag.law = _liaotianService.GetSYScode("t_complaint_items", "law");//法律依据
@@ -1803,6 +1922,13 @@
                    challengeletterDTO.complaintShouquandaibiaoDTOs = complaintShouquandaibiaoDTOs;
                else
                    challengeletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                List<TChallengeRequestInfoDTO> challengeRequestInfoDTOs = _cooperOrderService.GetListChallengeRequestInfo(challengeletterDTO.Id);
                if (challengeRequestInfoDTOs.Count > 0)
                    challengeletterDTO.challengeRequestInfoDTOs = challengeRequestInfoDTOs;
                else
                    challengeletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() { new TChallengeRequestInfoDTO() };
            }
            else
            {
@@ -1811,6 +1937,7 @@
                challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { challengeItemDTO };
                challengeletterDTO.challengeItemDTOs[0].sysCodeDtls = new List<SysCodeDtl>() { new SysCodeDtl() };
                challengeletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                challengeletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() { new TChallengeRequestInfoDTO() };
            }
            //ViewBag.challengeletterDTO = challengeletterDTO;
@@ -1872,6 +1999,7 @@
            //}
            resultEntity.Message = no;
            resultEntity.Remark = challengeItemId;
            resultEntity.Remark2 = id;
            resultEntity.DataList = sysCodeDtls;
            return new JsonResult(resultEntity);
@@ -2191,6 +2319,7 @@
                            var challengeItemDTO = new TChallengeItemDTO();
                            challengeItemDTO.ChallengeId = challengeletterDTO.Id;
                            challengeItemDTO.Question = data.Question[i];
                            challengeItemDTO.Questionname = data.Questionname[i];
                            challengeItemDTO.Evidential = data.Evidential[i];
                            challengeItemDTO.Law = Law;
                            //challengeItemDTO.Lawcoment = data.Lawcoment[i];
@@ -2200,6 +2329,26 @@
                       
                    }
                }
                resultEntity = _cooperOrderService.deleteChallengeRequestInfo(challengeletterDTO.Id);
                if (data.RequestInfos != null && data.RequestInfos.Length > 0)
                {
                    for (int i = 0; i < data.RequestInfos.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(data.RequestInfos[i]))
                        {
                            var challengeRequestInfoDTO = new TChallengeRequestInfoDTO();
                            challengeRequestInfoDTO.ChallengeId = challengeletterDTO.Id;
                            challengeRequestInfoDTO.RequestInfo = data.RequestInfos[i];
                            challengeRequestInfoDTO.RequestInfoname = data.RequestInfoname[i];
                            resultEntity = _cooperOrderService.saveChallengeRequestInfo(challengeRequestInfoDTO);
                        }
                    }
                }
                scope.Complete();
            }
@@ -2257,12 +2406,21 @@
                    challengeletterDTO.complaintShouquandaibiaoDTOs = complaintShouquandaibiaoDTOs;
                else
                    challengeletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() /*{ new TComplaintShouquandaibiaoDTO() }*/;
                List<TChallengeRequestInfoDTO> challengeRequestInfoDTOs = _cooperOrderService.GetListChallengeRequestInfo(challengeletterDTO.Id);
                if (challengeRequestInfoDTOs.Count > 0)
                    challengeletterDTO.challengeRequestInfoDTOs = challengeRequestInfoDTOs;
                else
                    challengeletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() /*{ new TChallengeRequestInfoDTO() }*/;
            }
            else
            {
                challengeletterDTO.challengeItemDTOs = new List<TChallengeItemDTO>() { new TChallengeItemDTO() };
                challengeletterDTO.challengeItemDTOs[0].sysCodeDtls = new List<SysCodeDtl>() { new SysCodeDtl() };
                challengeletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() /*{ new TComplaintShouquandaibiaoDTO() }*/;
                challengeletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() /*{ new TChallengeRequestInfoDTO() }*/;
            }
            //ViewBag.challengeletterDTO = challengeletterDTO;
@@ -2432,6 +2590,12 @@
                else
                    complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                List<TChallengeRequestInfoDTO> challengeRequestInfoDTOs = _cooperOrderService.GetListChallengeRequestInfo(complaintletterDTO.Id);
                if (challengeRequestInfoDTOs.Count > 0)
                    complaintletterDTO.challengeRequestInfoDTOs = challengeRequestInfoDTOs;
                else
                    complaintletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() { new TChallengeRequestInfoDTO() };
                List<TComplaintGongyingshangDTO> complaintGongyingshangDTOs = _cooperOrderService.GetListComplaintGongyingshang(complaintletterDTO.Id);
                if (complaintGongyingshangDTOs.Count > 0)
                    complaintletterDTO.complaintGongyingshangDTOs = complaintGongyingshangDTOs;
@@ -2448,10 +2612,11 @@
                complaintletterDTO.complaintRespondentDTOs = new List<TComplaintRespondentDTO>() { new TComplaintRespondentDTO() };
                complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                complaintletterDTO.complaintGongyingshangDTOs = new List<TComplaintGongyingshangDTO>()/* { new TComplaintGongyingshangDTO() }*/;
                complaintletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() { new TChallengeRequestInfoDTO() };
            }
            //判断是否有质疑函
            if (complaintletterDTO.Status != 2)
            if (complaintletterDTO.Status != 2 && string.IsNullOrEmpty(complaintletterDTO.complaintItemDTOs[0].Question))
            {
                CooperOrderDTO cooperOrderDTO = _cooperOrderService.Get(complaintletterDTO.OrderId);
                List<TChallengeletterDTO> challengeletterDTOs = _cooperOrderService.GetListChallengelettertousu(cooperOrderDTO.Khdw, complaintletterDTO.XmCode);
@@ -2468,6 +2633,11 @@
                        complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() { new TComplaintShouquandaibiaoDTO() };
                    complaintletterDTO.challengeRequestInfoDTOs = _cooperOrderService.GetListChallengeRequestInfo(challengeletterDTO.Id);
                    if (complaintletterDTO.challengeRequestInfoDTOs.Count == 0)
                        complaintletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() { new TChallengeRequestInfoDTO() };
                    List<TChallengeItemDTO> challengeItemDTOs = _cooperOrderService.GetListChallengeItem(challengeletterDTO.Id);
                    if (challengeItemDTOs.Count > 0)
                    {
@@ -2478,6 +2648,7 @@
                            complaintItemDTO.Id = challengeItemDTO.Id;
                            complaintItemDTO.ComplaintId = challengeItemDTO.ChallengeId;
                            complaintItemDTO.Question = challengeItemDTO.Question;
                            complaintItemDTO.Questionname = challengeItemDTO.Questionname;
                            complaintItemDTO.Evidential = challengeItemDTO.Evidential;
                            complaintItemDTO.Law = challengeItemDTO.Law;
                            complaintItemDTO.Lawcoment = challengeItemDTO.Lawcoment;
@@ -2732,6 +2903,7 @@
                            var complaintItemDTO = new TComplaintItemDTO();
                            complaintItemDTO.ComplaintId = complaintletterDTO.Id;
                            complaintItemDTO.Question = data.Question[i];
                            complaintItemDTO.Questionname = data.Questionname[i];
                            complaintItemDTO.Evidential = data.Evidential[i];
                            complaintItemDTO.Law = Law;
                            //complaintItemDTO.Lawcoment = data.Lawcoment[i];
@@ -2741,6 +2913,26 @@
                    }
                }
                resultEntity = _cooperOrderService.deleteChallengeRequestInfo(complaintletterDTO.Id);
                if (data.RequestInfos != null && data.RequestInfos.Length > 0)
                {
                    for (int i = 0; i < data.RequestInfos.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(data.RequestInfos[i]))
                        {
                            var challengeRequestInfoDTO = new TChallengeRequestInfoDTO();
                            challengeRequestInfoDTO.ChallengeId = complaintletterDTO.Id;
                            challengeRequestInfoDTO.RequestInfo = data.RequestInfos[i];
                            challengeRequestInfoDTO.RequestInfoname = data.RequestInfoname[i];
                            resultEntity = _cooperOrderService.saveChallengeRequestInfo(challengeRequestInfoDTO);
                        }
                    }
                }
                scope.Complete();
            }
@@ -2823,6 +3015,12 @@
                else
                    complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>() /*{ new TComplaintShouquandaibiaoDTO() }*/;
                List<TChallengeRequestInfoDTO> challengeRequestInfoDTOs = _cooperOrderService.GetListChallengeRequestInfo(complaintletterDTO.Id);
                if (challengeRequestInfoDTOs.Count > 0)
                    complaintletterDTO.challengeRequestInfoDTOs = challengeRequestInfoDTOs;
                else
                    complaintletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() /*{ new TChallengeRequestInfoDTO() }*/;
                List<TComplaintGongyingshangDTO> complaintGongyingshangDTOs = _cooperOrderService.GetListComplaintGongyingshang(complaintletterDTO.Id);
                if (complaintGongyingshangDTOs.Count > 0)
                    complaintletterDTO.complaintGongyingshangDTOs = complaintGongyingshangDTOs;
@@ -2837,7 +3035,7 @@
                complaintletterDTO.complaintRespondentDTOs = new List<TComplaintRespondentDTO>() { new TComplaintRespondentDTO() };
                complaintletterDTO.complaintShouquandaibiaoDTOs = new List<TComplaintShouquandaibiaoDTO>()/* { new TComplaintShouquandaibiaoDTO() }*/;
                complaintletterDTO.complaintGongyingshangDTOs = new List<TComplaintGongyingshangDTO>() /*{ new TComplaintGongyingshangDTO() }*/;
                complaintletterDTO.challengeRequestInfoDTOs = new List<TChallengeRequestInfoDTO>() /*{ new TChallengeRequestInfoDTO() }*/;
            }