From 2e177c04047f38876f89e5d9ccabcc3bed112727 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 08 七月 2021 15:06:20 +0800 Subject: [PATCH] 今日开发 问题新增 增加是否出书 是否收藏:是、否 每个人的收藏不一样 档案客户访问: 选择短信内容,然后提交的时候发送短信给客户 --- zhengcaioa/IServices/IIntentionVisitService.cs | 4 zhengcaioa/DTO/IntentionVisitDuanxinDTO.cs | 18 + zhengcaioa/zhengcaioa/Controllers/Customer/CooperVisitController.cs | 2 zhengcaioa/zhengcaioa/Controllers/LiaotianController.cs | 65 ++++ zhengcaioa/DTO/LiaotianDTO.cs | 6 zhengcaioa/DTO/LiaotianShoucangDTO.cs | 17 + zhengcaioa/IServices/ILiaotianService.cs | 6 zhengcaioa/Model/zhengcaioaContext.cs | 45 +++ 表修改.sql | 106 ++++++++ zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs | 5 zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs | 63 ++++ zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml | 59 ++++ zhengcaioa/Services/IntentionVisitService.cs | 30 ++ zhengcaioa/Model/LiaotianShoucang.cs | 18 + zhengcaioa/Model/Liaotian.cs | 3 zhengcaioa/Services/LiaotianService.cs | 213 ++++++++++----- zhengcaioa/zhengcaioa/Views/Liaotian/Indexcheck.cshtml | 20 + zhengcaioa/zhengcaioa/Views/Liaotian/Edit.cshtml | 90 ++++++ 18 files changed, 683 insertions(+), 87 deletions(-) diff --git a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs index 4363cff..9556863 100644 --- a/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs +++ b/zhengcaioa/CommonToolsCore/AutoMapperConfigs.cs @@ -215,6 +215,11 @@ CreateMap<OrderBanciOrder, OrderBanciOrderDTO>(); CreateMap<OrderBanciOrderDTO, OrderBanciOrder>(); + CreateMap<LiaotianShoucang, LiaotianShoucangDTO>(); + CreateMap<LiaotianShoucangDTO, LiaotianShoucang>(); + + CreateMap<IntentionVisitDuanxin, IntentionVisitDuanxinDTO>(); + CreateMap<IntentionVisitDuanxinDTO, IntentionVisitDuanxin>(); } } } diff --git a/zhengcaioa/DTO/IntentionVisitDuanxinDTO.cs b/zhengcaioa/DTO/IntentionVisitDuanxinDTO.cs new file mode 100644 index 0000000..278c250 --- /dev/null +++ b/zhengcaioa/DTO/IntentionVisitDuanxinDTO.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class IntentionVisitDuanxinDTO + { + public string Id { get; set; } + public string DuanxinTitle { get; set; } + public string DuanxinNeirong { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + } +} diff --git a/zhengcaioa/DTO/LiaotianDTO.cs b/zhengcaioa/DTO/LiaotianDTO.cs index c9fe512..f722329 100644 --- a/zhengcaioa/DTO/LiaotianDTO.cs +++ b/zhengcaioa/DTO/LiaotianDTO.cs @@ -20,6 +20,7 @@ public string Questiontype { get; set; } public string Problemtype { get; set; } + public string ChushuStatus { get; set; } public string _Modifytimetxt; public string Modifytimetxt @@ -48,6 +49,8 @@ _Createtimetxt = value; } } + + public string ShouCangStatus { get; set; } } public class LiaotianDTOSearch : SearchEntity @@ -64,7 +67,10 @@ public string Creater { get; set; } public string Shifoushenhe { get; set; } + public string ChushuStatus { get; set; } + public string ShouCangStatus { get; set; } + public string ShouCangCreater { get; set; } } } diff --git a/zhengcaioa/DTO/LiaotianShoucangDTO.cs b/zhengcaioa/DTO/LiaotianShoucangDTO.cs new file mode 100644 index 0000000..f53df80 --- /dev/null +++ b/zhengcaioa/DTO/LiaotianShoucangDTO.cs @@ -0,0 +1,17 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace DTO +{ + public class LiaotianShoucangDTO + { + public string Id { get; set; } + public string LiaotianId { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + } +} diff --git a/zhengcaioa/IServices/IIntentionVisitService.cs b/zhengcaioa/IServices/IIntentionVisitService.cs index ff9d598..319b573 100644 --- a/zhengcaioa/IServices/IIntentionVisitService.cs +++ b/zhengcaioa/IServices/IIntentionVisitService.cs @@ -21,5 +21,9 @@ List<IntentionCustomerDTO> GetList(string[] id); List<IntentionVisitDTO> GetListsalary(string userid, DateTime datemin, DateTime datemax); + + IntentionVisitDuanxinDTO GetDuanxin(string id); + + List<IntentionVisitDuanxinDTO> GetListDuanxin(); } } diff --git a/zhengcaioa/IServices/ILiaotianService.cs b/zhengcaioa/IServices/ILiaotianService.cs index 0fdcd4b..cf7e8f0 100644 --- a/zhengcaioa/IServices/ILiaotianService.cs +++ b/zhengcaioa/IServices/ILiaotianService.cs @@ -21,5 +21,11 @@ List<LiaotianDTO> SearchForPrint(LiaotianDTOSearch searchEntity); + ResultEntity saveLiaotianShoucang(LiaotianShoucangDTO liaotian); + + ResultEntity ModifyStatusLiaotianShoucang(string id, string userid); + + List<LiaotianShoucangDTO> getListLiaotianShoucang(string userId,string LiaotianId); + } } diff --git a/zhengcaioa/Model/Liaotian.cs b/zhengcaioa/Model/Liaotian.cs index de82acf..602f12f 100644 --- a/zhengcaioa/Model/Liaotian.cs +++ b/zhengcaioa/Model/Liaotian.cs @@ -19,5 +19,8 @@ public string Questiontype { get; set; } public string Problemtype { get; set; } public string Shiyongfatiao { get; set; } + + public string ChushuStatus { get; set; } + } } diff --git a/zhengcaioa/Model/LiaotianShoucang.cs b/zhengcaioa/Model/LiaotianShoucang.cs new file mode 100644 index 0000000..73c6f0f --- /dev/null +++ b/zhengcaioa/Model/LiaotianShoucang.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; + +#nullable disable + +namespace zhengcaioa.Models +{ + public partial class LiaotianShoucang + { + public string Id { get; set; } + public string LiaotianId { get; set; } + public string RecStatus { get; set; } + public string Creater { get; set; } + public DateTime Createtime { get; set; } + public string Modifier { get; set; } + public DateTime Modifytime { get; set; } + } +} diff --git a/zhengcaioa/Model/zhengcaioaContext.cs b/zhengcaioa/Model/zhengcaioaContext.cs index cda5db5..6d92116 100644 --- a/zhengcaioa/Model/zhengcaioaContext.cs +++ b/zhengcaioa/Model/zhengcaioaContext.cs @@ -69,6 +69,7 @@ public virtual DbSet<IntentionVisit> IntentionVisits { get; set; } public virtual DbSet<IntentionVisitDuanxin> IntentionVisitDuanxins { get; set; } public virtual DbSet<Liaotian> Liaotians { get; set; } + public virtual DbSet<LiaotianShoucang> LiaotianShoucangs { get; set; } public virtual DbSet<LZhuanjiahuidum> LZhuanjiahuida { get; set; } public virtual DbSet<Oayouhui> Oayouhuis { get; set; } public virtual DbSet<OrderBanci> OrderBancis { get; set; } @@ -3300,6 +3301,11 @@ .HasMaxLength(4000) .HasColumnName("anwser"); + entity.Property(e => e.ChushuStatus) + .HasMaxLength(1) + .HasColumnName("chushu_status") + .HasDefaultValueSql("('D')"); + entity.Property(e => e.Clientid) .HasMaxLength(50) .HasColumnName("clientid"); @@ -3350,6 +3356,45 @@ .HasColumnName("shiyongfatiao"); }); + modelBuilder.Entity<LiaotianShoucang>(entity => + { + entity.ToTable("Liaotian_shoucang"); + + entity.Property(e => e.Id).HasMaxLength(50); + + entity.Property(e => e.Creater) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("creater") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Createtime) + .HasColumnType("datetime") + .HasColumnName("createtime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.LiaotianId) + .HasMaxLength(50) + .HasColumnName("Liaotian_id"); + + entity.Property(e => e.Modifier) + .IsRequired() + .HasMaxLength(50) + .HasColumnName("modifier") + .HasDefaultValueSql("('1')"); + + entity.Property(e => e.Modifytime) + .HasColumnType("datetime") + .HasColumnName("modifytime") + .HasDefaultValueSql("(getdate())"); + + entity.Property(e => e.RecStatus) + .IsRequired() + .HasMaxLength(1) + .HasColumnName("rec_status") + .HasDefaultValueSql("('a')"); + }); + modelBuilder.Entity<LZhuanjiahuidum>(entity => { entity.ToTable("l_zhuanjiahuida"); diff --git a/zhengcaioa/Services/IntentionVisitService.cs b/zhengcaioa/Services/IntentionVisitService.cs index 05b58f5..b22c1c1 100644 --- a/zhengcaioa/Services/IntentionVisitService.cs +++ b/zhengcaioa/Services/IntentionVisitService.cs @@ -304,5 +304,35 @@ return result; } + + public IntentionVisitDuanxinDTO GetDuanxin(string id) + { + + var entity = _context.IntentionVisitDuanxins.Find(id); + + if (entity.RecStatus != "A") + { + entity = new IntentionVisitDuanxin(); + } + + var result = _mapper.Map<IntentionVisitDuanxinDTO>(entity); + + + return result; + } + + /// <summary> + /// 鑾峰彇鎵�鏈夋湁鏁堟剰鍚戝鎴� + /// </summary> + /// <returns></returns> + public List<IntentionVisitDuanxinDTO> GetListDuanxin() + { + + var listIntentionCustomers = _context.IntentionVisitDuanxins.Where(r => r.RecStatus == "A").ToList(); + + var result = _mapper.Map<List<IntentionVisitDuanxinDTO>>(listIntentionCustomers); + + return result; + } } } diff --git a/zhengcaioa/Services/LiaotianService.cs b/zhengcaioa/Services/LiaotianService.cs index 5630f89..fac8a6b 100644 --- a/zhengcaioa/Services/LiaotianService.cs +++ b/zhengcaioa/Services/LiaotianService.cs @@ -9,7 +9,7 @@ namespace Services { - public class LiaotianService: ILiaotianService + public class LiaotianService : ILiaotianService { private readonly zhengcaioaContext _context; private readonly IMapper _mapper; @@ -19,7 +19,7 @@ _mapper = mapper; } - public ResultEntity saveLiaotian(LiaotianDTO liaotiandto) + public ResultEntity saveLiaotian(LiaotianDTO liaotiandto) { ResultEntity resultEntity = new ResultEntity(); try @@ -42,18 +42,19 @@ } else { - var updateliaotian = _context.Liaotians.Find(liaotian.Id); + var updateliaotian = _context.Liaotians.Find(liaotian.Id); updateliaotian.Question = liaotian.Question; updateliaotian.Anwser = liaotian.Anwser; updateliaotian.RecStatus = liaotian.RecStatus; updateliaotian.Clientid = liaotian.Clientid; - // updateliaotian.Creater = liaotian.Creater; + // updateliaotian.Creater = liaotian.Creater; //updateliaotian.Createtime = liaotian.Createtime; updateliaotian.Modifier = liaotian.Modifier; updateliaotian.Modifytime = liaotian.Modifytime; updateliaotian.Questiontype = liaotian.Questiontype; updateliaotian.Problemtype = liaotian.Problemtype; updateliaotian.Shiyongfatiao = liaotian.Shiyongfatiao; + updateliaotian.ChushuStatus = liaotian.ChushuStatus; } _context.SaveChanges(); @@ -64,7 +65,7 @@ { resultEntity.Result = false; resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; - + } return resultEntity; } @@ -83,21 +84,21 @@ return liaotiandto; } - public List<SysCodeDtl> GetSYScode(string code_table,string code_field) + public List<SysCodeDtl> GetSYScode(string code_table, string code_field) { List<SysCodeDtl> sysCodeDtls = (from e in _context.SysCodes join c in _context.SysCodeDtls - on e.Id equals c.CodeId - where e.RecStatus == "A" + on e.Id equals c.CodeId + where e.RecStatus == "A" && c.RecStatus == "A" - && e.CodeTable == code_table + && e.CodeTable == code_table && e.CodeField == code_field - select c).OrderBy(x=>x.Sort).ToList(); - - - + select c).OrderBy(x => x.Sort).ToList(); + + + @@ -108,29 +109,8 @@ public ResultDataEntity<LiaotianDTO> SearchByPaging(LiaotianDTOSearch searchEntity) { ResultDataEntity<LiaotianDTO> data = new ResultDataEntity<LiaotianDTO>(); - List<LiaotianDTO> list = new List<LiaotianDTO>(); - //绛涢�� - var query = _context.Liaotians - .Where(b => b.RecStatus=="A") - .ToList(); + //List<LiaotianDTO> list = new List<LiaotianDTO>(); - if (!string.IsNullOrEmpty(searchEntity.Question)) - { - query = query.Where(m => m.Question.Contains(searchEntity.Question)).ToList(); - } - if (!string.IsNullOrEmpty(searchEntity.Questiontype)) - { - query = query.Where(m => m.Questiontype == searchEntity.Questiontype).ToList(); - } - if (!string.IsNullOrEmpty(searchEntity.Problemtype)) - { - query = query.Where(m => m.Problemtype.Contains(searchEntity.Problemtype)).ToList(); - } - if (!string.IsNullOrEmpty(searchEntity.Shifoushenhe)) - { - query = query.Where(m => m.Clientid == searchEntity.Shifoushenhe ).ToList(); - } - DateTime Createtimestart = DateTime.Now; DateTime Createtimeend = DateTime.Now; if (!string.IsNullOrWhiteSpace(searchEntity.Createtime)) @@ -140,50 +120,61 @@ DateTime.TryParse(Createtimes[1], out Createtimeend); Createtimeend = Createtimeend.AddDays(1); } - if (!string.IsNullOrEmpty(searchEntity.Createtime)) - { - query = query.Where(m => m.Createtime >= Createtimestart).ToList(); - } - if (!string.IsNullOrEmpty(searchEntity.Createtime)) - { - query = query.Where(m => m.Createtime <= Createtimeend).ToList(); - } - if (!string.IsNullOrEmpty(searchEntity.Creater)) - { - query = query.Where(m => m.Creater == searchEntity.Creater).ToList(); - } - - if (!string.IsNullOrEmpty(searchEntity.Info)) - { - var check = searchEntity.Info.Split(' '); - List<Liaotian> liaotians = new List<Liaotian>(); - if(check!=null&& check.Length > 0) - { - for(int i = 0;i< check.Length; i++) - { - if (!string.IsNullOrWhiteSpace(check[i])){ - liaotians = liaotians.Union(query.Where(m => m.Question.Contains(check[i])).ToList()).Distinct().ToList(); - } - - } - - } - - query = liaotians; + //绛涢�� + var query = (from a in _context.Liaotians - } - else - { - query = query.OrderByDescending(x => x.Modifytime).ToList(); - } + join h in _context.LiaotianShoucangs.Where(x => x.RecStatus == "A" && x.Creater == searchEntity.ShouCangCreater) + on a.Id equals h.LiaotianId + into hsss + from hhh in hsss.DefaultIfEmpty() + + + where a.RecStatus == "A" + && (string.IsNullOrWhiteSpace(searchEntity.Createtime) || (a.Createtime >= Createtimestart && a.Createtime <= Createtimeend)) + + && (string.IsNullOrWhiteSpace(searchEntity.Question) || (a.Question.Contains(searchEntity.Question.Trim()))) + && (string.IsNullOrWhiteSpace(searchEntity.Questiontype) || (a.Questiontype == searchEntity.Questiontype.Trim())) + && (string.IsNullOrWhiteSpace(searchEntity.Problemtype) || (a.Problemtype.Contains(searchEntity.Problemtype.Trim()))) + && (string.IsNullOrWhiteSpace(searchEntity.Shifoushenhe) || (a.Clientid == searchEntity.Shifoushenhe.Trim())) + && (string.IsNullOrWhiteSpace(searchEntity.ChushuStatus) || (a.ChushuStatus == searchEntity.ChushuStatus.Trim())) + && (string.IsNullOrWhiteSpace(searchEntity.Creater) || (a.Creater == searchEntity.Creater.Trim())) + && (string.IsNullOrWhiteSpace(searchEntity.ShouCangStatus) || (searchEntity.ShouCangStatus == "A" && hhh.Id !=null) || (searchEntity.ShouCangStatus != "A" && hhh.Id == null)) + select new LiaotianDTO + { + Id = a.Id, + Question = a.Question, + Anwser = a.Anwser, + RecStatus = a.RecStatus, + Creater = a.Creater, + Createtime = a.Createtime, + Modifier = a.Modifier, + Modifytime = a.Modifytime, + Clientid = a.Clientid, + Questiontype = a.Questiontype, + Problemtype = a.Problemtype, + Shiyongfatiao = a.Shiyongfatiao, + ChushuStatus= a.ChushuStatus, + } + ) + .Distinct() .OrderByDescending(x => x.Modifytime).ToList(); + + + + + + + + + + if (searchEntity.totalrows == 0) searchEntity.totalrows = query.Count(); var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); - list = _mapper.Map<List<LiaotianDTO>>(lianlist); - data.LoadData(searchEntity, list); + //list = _mapper.Map<List<LiaotianDTO>>(lianlist); + data.LoadData(searchEntity, query); return data; } @@ -219,7 +210,7 @@ /// <returns></returns> public List<LiaotianDTO> SearchForPrint(LiaotianDTOSearch searchEntity) { - + List<LiaotianDTO> list = new List<LiaotianDTO>(); //绛涢�� var query = _context.Liaotians @@ -262,10 +253,82 @@ query = query.OrderByDescending(x => x.Modifytime).ToList(); - + list = _mapper.Map<List<LiaotianDTO>>(query); - + return list; } + + + + public ResultEntity saveLiaotianShoucang(LiaotianShoucangDTO dto) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + + + var liaotian = _mapper.Map<LiaotianShoucang>(dto); + if (String.IsNullOrEmpty(liaotian.Id)) + { + liaotian.Id = Guid.NewGuid().ToString(); + dto.Id = liaotian.Id; + _context.LiaotianShoucangs.Add(liaotian); + } + else + { + var updateliaotian = _context.LiaotianShoucangs.Find(liaotian.Id); + updateliaotian.LiaotianId = liaotian.LiaotianId; + + updateliaotian.RecStatus = liaotian.RecStatus; + + // updateliaotian.Creater = liaotian.Creater; + //updateliaotian.Createtime = liaotian.Createtime; + updateliaotian.Modifier = liaotian.Modifier; + updateliaotian.Modifytime = liaotian.Modifytime; + + } + + _context.SaveChanges(); + resultEntity.ReturnID = liaotian.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } + + public ResultEntity ModifyStatusLiaotianShoucang(string id, string userid) + { + ResultEntity result = new ResultEntity(); + result.Result = true; + + var model = _context.LiaotianShoucangs.Find(id); + if (model != null) + { + model.RecStatus = "D"; + model.Modifier = userid; + model.Modifytime = DateTime.Now; + _context.SaveChanges(); + } + + return result; + } + + public List<LiaotianShoucangDTO> getListLiaotianShoucang(string userId, string LiaotianId) + { + List<LiaotianShoucangDTO> result = new List<LiaotianShoucangDTO>(); + + + var listFiServices = _context.LiaotianShoucangs.Where(r => r.RecStatus == "A" && (string.IsNullOrEmpty(userId) || r.Creater == userId) && (string.IsNullOrEmpty(LiaotianId) || r.LiaotianId == LiaotianId)).OrderBy(x => x.Createtime).ToList(); + + result = _mapper.Map<List<LiaotianShoucangDTO>>(listFiServices); + + return result; + } } } diff --git a/zhengcaioa/zhengcaioa/Controllers/Customer/CooperVisitController.cs b/zhengcaioa/zhengcaioa/Controllers/Customer/CooperVisitController.cs index e7fd1b8..562766a 100644 --- a/zhengcaioa/zhengcaioa/Controllers/Customer/CooperVisitController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/Customer/CooperVisitController.cs @@ -197,7 +197,7 @@ { for (int i = 0; i < result.Count; i++) { - number.Append(result[i].Phone); + number.Append(string.IsNullOrEmpty(result[i].Phone) ? result[i].Tel : result[i].Phone); customename += result[i].Name + ","; if (i != result.Count - 1) { diff --git a/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs b/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs index ebb16bc..f14ae68 100644 --- a/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/Customer/IntentionVisitController.cs @@ -138,11 +138,30 @@ ViewData["yx"] = _liaotianService.GetSYScode("CooperVisit", "yx"); ViewData["jy"] = _liaotianService.GetSYScode("CooperVisit", "jy"); + ViewData["Duanxin"] = _intentionVisitService.GetListDuanxin(); ViewBag.IsYwjl = IsYwjl; ViewData.Model = dto; return View(); + } + + + public IActionResult getDuanxin(string id) + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = true; + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + + var intentionVisitDuanxinDTO = _intentionVisitService.GetDuanxin(id); + if(intentionVisitDuanxinDTO!=null && !string.IsNullOrEmpty(intentionVisitDuanxinDTO.DuanxinNeirong)) + { + resultEntity.Message = string.Format(intentionVisitDuanxinDTO.DuanxinNeirong, curentuser.UserName, curentuser.Phone); + } + + + return new JsonResult(resultEntity); } @@ -169,7 +188,10 @@ using (TransactionScope scope = new TransactionScope()) { resultEntity = _intentionVisitService.save(data); - + if (!resultEntity.Result) + { + return new JsonResult(resultEntity); + } if (!string.IsNullOrEmpty(data.IsYwjl)) @@ -181,6 +203,10 @@ intentionCustomerDTO.Ywjl = curentuser.Id; } resultEntity = _intentionCustomerService.save(intentionCustomerDTO); + if (!resultEntity.Result) + { + return new JsonResult(resultEntity); + } } else if (data.Jy == "05") { @@ -189,8 +215,41 @@ intentionCustomerDTO.Yixiangtime = data.Vistime; intentionCustomerDTO.Dianxiaozhuanyuan = curentuser.Id; resultEntity = _intentionCustomerService.save(intentionCustomerDTO); + if (!resultEntity.Result) + { + return new JsonResult(resultEntity); + } } + + + if (!string.IsNullOrEmpty(data.DuanxinNeirong)) + { + IntentionCustomerDTO intentionCustomerDTO = _intentionCustomerService.Get(data.Viscustomer); + if(intentionCustomerDTO!=null && ( !string.IsNullOrEmpty(intentionCustomerDTO.Phone) || !string.IsNullOrEmpty(intentionCustomerDTO.Tel))) + { + string sss = SMSHelper.PushWToUserMES(string.IsNullOrEmpty(intentionCustomerDTO.Phone)? intentionCustomerDTO.Tel: intentionCustomerDTO.Phone, data.DuanxinNeirong); + if (int.Parse(sss) <= 0) + { + resultEntity.Result = false; + resultEntity.Message = "鐭俊鍙戦�佸け璐�"; + + } + if (!resultEntity.Result) + { + return new JsonResult(resultEntity); + } + } + else + { + resultEntity.Result = false; + resultEntity.Message = "瀹㈡埛鏃犳墜鏈哄彿鐮�"; + return new JsonResult(resultEntity); + } + + + } + scope.Complete(); @@ -250,7 +309,7 @@ { for(int i=0;i< result.Count; i++) { - number.Append(result[i].Phone); + number.Append(string.IsNullOrEmpty(result[i].Phone)? result[i].Tel: result[i].Phone); customename += result[i].Name + ","; if (i!= result.Count - 1) { diff --git a/zhengcaioa/zhengcaioa/Controllers/LiaotianController.cs b/zhengcaioa/zhengcaioa/Controllers/LiaotianController.cs index 6108fcf..b318520 100644 --- a/zhengcaioa/zhengcaioa/Controllers/LiaotianController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/LiaotianController.cs @@ -261,7 +261,9 @@ [CheckLogin] public string GetLiaotianList(LiaotianDTOSearch search) { - + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + search.ShouCangCreater = curentuser.Id; //JsonResult jsonResult = new JsonResult(_liaotianService.SearchByPaging(search), new Newtonsoft.Json.Serialization.DefaultContractResolver()); return JsonConvert.SerializeObject(_liaotianService.SearchByPaging(search)); } @@ -276,6 +278,16 @@ if (!String.IsNullOrEmpty(id)) { liaotianDTO = _liaotianService.GetLiaotianEntity(id); + var liaotianShoucangDTOs = _liaotianService.getListLiaotianShoucang(curentuser.Id, id); + if(liaotianShoucangDTOs!=null&& liaotianShoucangDTOs.Count > 0) + { + liaotianDTO.ShouCangStatus = "A"; + } + else + { + liaotianDTO.ShouCangStatus = "D"; + + } } ViewData.Model = liaotianDTO; @@ -287,6 +299,7 @@ ViewData["questiontype"] = _liaotianService.GetSYScode("Liaotian", "questiontype"); ViewData["problemtype"] = _liaotianService.GetSYScode("Liaotian", "problemtype").Where(x=>x.Contents == liaotianDTO.Questiontype).ToList(); + return View(); } @@ -314,6 +327,8 @@ [CheckLogin] public async Task<string> SaveAsync(LiaotianDTO data) { + + ResultEntity resultEntity = new ResultEntity(); resultEntity.Result = false; var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); @@ -369,6 +384,8 @@ resultEntity = _liaotianService.saveLiaotian(data); + + //string api_domain = _configuration.GetSection("Elasticsearchurl").Value; @@ -427,6 +444,49 @@ return JsonConvert.SerializeObject(resultEntity); } + /// <summary> + /// 鎻愪氦骞跺鏍� + /// </summary> + /// <param name="data">宀椾綅瀹炰綋绫诲璞�</param> + /// <returns></returns> + [HttpPost] + [CheckLogin] + public IActionResult ShouCang(LiaotianDTO data) + { + ResultEntity resultEntity = new ResultEntity(); + resultEntity.Result = false; + var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + ViewData["curentuser"] = curentuser; + + var liaotianShoucangDTOs = _liaotianService.getListLiaotianShoucang(curentuser.Id, data.Id); + if (data.ShouCangStatus == "A") + { + if (liaotianShoucangDTOs == null || liaotianShoucangDTOs.Count == 0) + { + LiaotianShoucangDTO liaotianShoucangDTO = new LiaotianShoucangDTO(); + liaotianShoucangDTO.LiaotianId = data.Id; + liaotianShoucangDTO.RecStatus = "A"; + liaotianShoucangDTO.Creater = curentuser.Id; + liaotianShoucangDTO.Createtime = DateTime.Now; + liaotianShoucangDTO.Modifier = curentuser.Id; + liaotianShoucangDTO.Modifytime = DateTime.Now; + resultEntity = _liaotianService.saveLiaotianShoucang(liaotianShoucangDTO); + } + } + else + { + if (liaotianShoucangDTOs != null || liaotianShoucangDTOs.Count > 0) + { + foreach (var liaotianShoucangDTO in liaotianShoucangDTOs) + { + resultEntity = _liaotianService.ModifyStatusLiaotianShoucang(liaotianShoucangDTO.Id, curentuser.Id); + } + } + } + + return new JsonResult(resultEntity); ; + } + /// <summary> /// 鎻愪氦骞跺鏍� @@ -437,6 +497,7 @@ [CheckLogin] public async Task<string> TijiaobingshenheAsync(LiaotianDTO data) { + ResultEntity resultEntity = new ResultEntity(); resultEntity.Result = false; var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); @@ -455,6 +516,8 @@ resultEntity = _liaotianService.saveLiaotian(data); + + string api_domain = _configuration.GetSection("Elasticsearchurl").Value; string url = $"{api_domain}/liaotian/person/" + data.Id; LiaotianElasticsearchDTO liaotianElasticsearchDTO = new LiaotianElasticsearchDTO(); diff --git a/zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml b/zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml index a588d53..900506c 100644 --- a/zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml +++ b/zhengcaioa/zhengcaioa/Views/IntentionVisit/Edit.cshtml @@ -13,6 +13,8 @@ string IsYwjl = ViewBag.IsYwjl as string; + List<IntentionVisitDuanxinDTO> Duanxin = ViewData["Duanxin"] as List<IntentionVisitDuanxinDTO>; //鐭俊 + } @{ Layout = null; @@ -302,7 +304,32 @@ </div> </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">鐭俊妯℃澘<i class="red">*</i></label> + <div class="col-sm-2 col-md-2" grouptype="Vdata"> + <select id="Duanxin" class="form-control" name="Duanxin" data-placeholder="閫夋嫨 搴忓垪 ..."> + <option value="" hassubinfo="true">璇烽�夋嫨</option> + @foreach (var item in Duanxin) + { + <option value="@item.Id" hassubinfo="true"> + @item.DuanxinTitle + </option> + + + } + + + </select> + + </div> + </div> + <div class="clearfix layer-area" style="padding-bottom:15px;"> + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label">鐭俊鍐呭<i class="red">*</i></label> + <div class="col-sm-8 col-md-8"> + <textarea class="form-control bt" id="DuanxinNeirong" name="DuanxinNeirong" title="鐭俊鍐呭" isempty="" maxlength="4000" length="long" style="resize:none;overflow-y:hidden; min-height:60px;" onpropertychange="this.style.height=this.scrollHeight + 'px'" oninput="this.style.height=this.scrollHeight + 'px'" >@Model.DuanxinNeirong</textarea> + </div> + </div> @@ -328,6 +355,11 @@ </form> <script type="text/javascript"> + + var DuanxinNeirong = document.getElementById("DuanxinNeirong"); + + DuanxinNeirong.style.height = DuanxinNeirong.scrollHeight + 'px'; + var hh = document.body.clientHeight - $('.ibox-title').height() - $("#top").height() * 2 - 95; $("#div_content").height(hh); @@ -492,8 +524,33 @@ - + + $("#Duanxin").change(function () { + var sheng = $("#Duanxin").val(); + $.ajax({ + type: "GET", + url: "/IntentionVisit/getDuanxin?id=" + sheng, + dataType: "json", + global: false, + data: "", + success: function (data) { + if (data.Result) { + $("#DuanxinNeirong").val(data.Message); + var DuanxinNeirong = document.getElementById("DuanxinNeirong"); + + DuanxinNeirong.style.height = DuanxinNeirong.scrollHeight + 'px'; + } else { + parent.layer.msg('鏌ヨ澶辫触', { icon: 5 }); + } + }, + error: function () { + + + parent.layer.msg('鏌ヨ澶辫触', { icon: 5 }); + } + }); + }); function _pageAutoClose() { parent.window._reloadPageData(); diff --git a/zhengcaioa/zhengcaioa/Views/Liaotian/Edit.cshtml b/zhengcaioa/zhengcaioa/Views/Liaotian/Edit.cshtml index 7eb43f8..c9f6e0b 100644 --- a/zhengcaioa/zhengcaioa/Views/Liaotian/Edit.cshtml +++ b/zhengcaioa/zhengcaioa/Views/Liaotian/Edit.cshtml @@ -159,6 +159,38 @@ </div> + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label"> + 鏄惁鍑轰功 + </label> + <div class="col-sm-2 col-md-2" grouptype="Vdata"> + @if ("A" == Model.ChushuStatus) + { + <input type="checkbox" class="form-control" id="ChushuStatusName" checked="checked" name="ChushuStatusName" value="A" /> + } + else + { + <input type="checkbox" class="form-control" id="ChushuStatusName" name="ChushuStatusName" value="A" /> + } + <input type="hidden" id="ChushuStatus" name="ChushuStatus" value="" /> + + </div> + + <label grouptype="Vdata" class="text-right col-sm-1 col-md-1 control-label"> + 鏀惰棌 + </label> + <div class="col-sm-2 col-md-2" grouptype="Vdata"> + @if ("A" == Model.ShouCangStatus) + { + <input type="checkbox" class="form-control" id="ShouCangStatusName" checked="checked" name="ShouCangStatusName" value="A" /> + } + else + { + <input type="checkbox" class="form-control" id="ShouCangStatusName" name="ShouCangStatusName" value="A" /> + } + <input type="hidden" id="ShouCangStatus" name="ShouCangStatus" value="" /> + + </div> + </div> <div class="clearfix layer-area" style="padding-bottom:15px;"> <label class="text-right col-sm-1 col-md-1 control-label">闂<i class="red">*</i></label> @@ -363,6 +395,15 @@ toastr.warning("绛旀涓嶈兘涓虹┖"); return; } + + if ($("#ChushuStatusName").is(':checked')) { + $("#ChushuStatus").val("A"); + } else { + $("#ChushuStatus").val("D"); + } + + + imgLoad = parent.layer.load(2, { shade: [0.2, '#fff'] }); $.ajax({ @@ -370,7 +411,7 @@ url: "/Liaotian/Save", dataType: "json", global: false, - data: { Id: id, Question: $("#Question").val(), Anwser: $("#Anwser").val(), Questiontype: $("#Questiontype").val(), Problemtype: $("#Problemtype").val(), Shiyongfatiao: $("#Shiyongfatiao").val()}, + data: { Id: id, Question: $("#Question").val(), Anwser: $("#Anwser").val(), Questiontype: $("#Questiontype").val(), Problemtype: $("#Problemtype").val(), Shiyongfatiao: $("#Shiyongfatiao").val(), ChushuStatus: $("#ChushuStatus").val()}, success: function (data) { @@ -420,6 +461,13 @@ toastr.warning("绛旀涓嶈兘涓虹┖"); return; } + + if ($("#ChushuStatusName").is(':checked')) { + $("#ChushuStatus").val("A"); + } else { + $("#ChushuStatus").val("D"); + } + imgLoad = parent.layer.load(2, { shade: [0.2, '#fff'] }); $.ajax({ @@ -427,7 +475,7 @@ url: "/Liaotian/Tijiaobingshenhe", dataType: "json", global: false, - data: { Id: id, Question: $("#Question").val(), Anwser: $("#Anwser").val(), Questiontype: $("#Questiontype").val(), Problemtype: $("#Problemtype").val(), Shiyongfatiao: $("#Shiyongfatiao").val() }, + data: { Id: id, Question: $("#Question").val(), Anwser: $("#Anwser").val(), Questiontype: $("#Questiontype").val(), Problemtype: $("#Problemtype").val(), Shiyongfatiao: $("#Shiyongfatiao").val(), ChushuStatus: $("#ChushuStatus").val() }, success: function (data) { @@ -456,9 +504,43 @@ }); } - - + + $("#ShouCangStatusName").change(function () { + + if ($("#ShouCangStatusName").is(':checked')) { + $("#ShouCangStatus").val("A"); + } else { + $("#ShouCangStatus").val("D"); + } + + + $.ajax({ + type: "POST", + url: "/Liaotian/ShouCang", + dataType: "json", + global: false, + data:{ Id: id, Question: $("#Question").val(), Anwser: $("#Anwser").val(), Questiontype: $("#Questiontype").val(), Problemtype: $("#Problemtype").val(), Shiyongfatiao: $("#Shiyongfatiao").val(), ChushuStatus: $("#ChushuStatus").val(), ShouCangStatus: $("#ShouCangStatus").val() }, + success: function (data) { + + if (data.Result) { + // parent._afterSave(true); + parent.layer.msg('鎿嶄綔鎴愬姛', { icon: 6 }); + + } + else { + + parent.layer.msg(data.Message, { icon: 5 }); + } + }, + error: function () { + + + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + }); + $("#Questiontype").change(function () { diff --git a/zhengcaioa/zhengcaioa/Views/Liaotian/Indexcheck.cshtml b/zhengcaioa/zhengcaioa/Views/Liaotian/Indexcheck.cshtml index d7ec3a7..df22020 100644 --- a/zhengcaioa/zhengcaioa/Views/Liaotian/Indexcheck.cshtml +++ b/zhengcaioa/zhengcaioa/Views/Liaotian/Indexcheck.cshtml @@ -33,7 +33,21 @@ - } }, + } + }, + { + label: '鏄惁鍑轰功', name: 'ChushuStatus', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + if (cellvalue == "D") { + return "鍚�" + } else { + return "鏄�" + } + + + + } + }, { label: '鐘舵��', name: 'RecStatus', labtype: 'txt', hidden: true }, { label: '鍒涘缓浜�', name: 'Creater', labtype: 'txt', hidden: true }, { label: '鍒涘缓鏃堕棿', name: 'Createtimetxt', labtype: 'txt', hidden: true }, @@ -50,8 +64,8 @@ { label: '鏄惁瀹℃牳', name: 'Shifoushenhe', labtype: 'combox', hidden: false, data: JSON.parse(shifou), cwidth: '5%', cccwidth: '8%' }, { label: '褰曞叆鏃堕棿', name: 'Createtime', labtype: 'datearea', hidden: false }, { label: '褰曞叆浜�', name: 'Creater', labtype: 'combox', hidden: false, data: JSON.parse(Creater), cwidth: '5%', cccwidth: '8%' }, - - + { label: '鏄惁鍑轰功', name: 'ChushuStatus', labtype: 'combox', hidden: false, data: JSON.parse(shifou), cwidth: '5%', cccwidth: '8%' }, + { label: '鏄惁鏀惰棌', name: 'ShouCangStatus', labtype: 'combox', hidden: false, data: JSON.parse(shifou), cwidth: '5%', cccwidth: '8%' }, ]; var _pageAdd = function () { OpenWindow("鏂板闂", "98%", "90%", "/Liaotian/Edit/"); diff --git "a/\350\241\250\344\277\256\346\224\271.sql" "b/\350\241\250\344\277\256\346\224\271.sql" index f5c27f9..bac131b 100644 --- "a/\350\241\250\344\277\256\346\224\271.sql" +++ "b/\350\241\250\344\277\256\346\224\271.sql" @@ -1,6 +1,112 @@ USE [zhengcaioa] GO +/****** Object: Table [dbo].[Liaotian_shoucang] Script Date: 2021/7/8 8:49:01 ******/ +SET ANSI_NULLS ON +GO + +SET QUOTED_IDENTIFIER ON +GO + +CREATE TABLE [dbo].[Liaotian_shoucang]( + [Id] [nvarchar](50) NOT NULL, + [Liaotian_id] [nvarchar](50) NULL, + [rec_status] [nvarchar](1) NOT NULL, + [creater] [nvarchar](50) NOT NULL, + [createtime] [datetime] NOT NULL, + [modifier] [nvarchar](50) NOT NULL, + [modifytime] [datetime] NOT NULL, + CONSTRAINT [PK_Liaotian_shoucang] PRIMARY KEY CLUSTERED +( + [Id] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +) ON [PRIMARY] +GO + +ALTER TABLE [dbo].[Liaotian_shoucang] ADD DEFAULT ('a') FOR [rec_status] +GO + +ALTER TABLE [dbo].[Liaotian_shoucang] ADD DEFAULT ('1') FOR [creater] +GO + +ALTER TABLE [dbo].[Liaotian_shoucang] ADD CONSTRAINT [DF_Liaotian_shoucang_createtime] DEFAULT (getdate()) FOR [createtime] +GO + +ALTER TABLE [dbo].[Liaotian_shoucang] ADD DEFAULT ('1') FOR [modifier] +GO + +ALTER TABLE [dbo].[Liaotian_shoucang] ADD CONSTRAINT [DF_Liaotian_shoucang_modifytime] DEFAULT (getdate()) FOR [modifytime] +GO + + + + + + + +ALTER TABLE [dbo].[Liaotian] ADD [chushu_status] [nvarchar](1) NULL DEFAULT ('D') +GO + +update [dbo].[Liaotian] set [chushu_status] = 'D' +GO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +USE [zhengcaioa] +GO + /****** Object: Table [dbo].[order_banci_order] Script Date: 2021/7/5 14:33:24 ******/ SET ANSI_NULLS ON GO -- Gitblit v1.9.1