From 13ca8b4cab099521fc95d551c4b21c1a7ae5984d Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 30 十二月 2022 09:44:04 +0800 Subject: [PATCH] 合作业务-》 采购公告权限,顾问套餐(种类) --- zhengcaioa/Services/CooperatecustomCustomerService.cs | 131 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 126 insertions(+), 5 deletions(-) diff --git a/zhengcaioa/Services/CooperatecustomCustomerService.cs b/zhengcaioa/Services/CooperatecustomCustomerService.cs index da4db33..2a60265 100644 --- a/zhengcaioa/Services/CooperatecustomCustomerService.cs +++ b/zhengcaioa/Services/CooperatecustomCustomerService.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using AutoMapper; +using CommonToolsCore; using DTO; using IServices; using Microsoft.AspNetCore.Mvc.Rendering; @@ -16,10 +17,12 @@ { private readonly zhengcaioaContext _context; private readonly IMapper _mapper; - public CooperatecustomCustomerService(zhengcaioaContext context, IMapper mapper) + private readonly zcUserInfoN_dbContext _zcUserInfoNcontext; + public CooperatecustomCustomerService(zhengcaioaContext context, IMapper mapper, zcUserInfoN_dbContext zcUserInfoNcontext) { _context = context; _mapper = mapper; + _zcUserInfoNcontext = zcUserInfoNcontext; } public ResultEntity save(CooperatecustomCustomerDTO cooperatecustomCustomerDTO) @@ -99,7 +102,47 @@ updateproject.Weixintime = cooperatecustomCustomer.Weixintime; updateproject.Weixiner = cooperatecustomCustomer.Weixiner; updateproject.Shouxinedu = cooperatecustomCustomer.Shouxinedu; + updateproject.Taocanjianshu = cooperatecustomCustomer.Taocanjianshu; } + + _context.SaveChanges(); + + var listPosition = _context.CooperatecustomCustomers.Where(r => r.RecStatus == "A").ToList(); + + var CooperatecustomCustomerDTOs = _mapper.Map<List<CooperatecustomCustomerDTO>>(listPosition); + CacheHelperNetCore.CacheInsert("CooperatecustomCustomerDTOs", CooperatecustomCustomerDTOs); + + resultEntity.ReturnID = cooperatecustomCustomer.Id; + resultEntity.Result = true; + } + catch (Exception ex) + { + resultEntity.Result = false; + resultEntity.Message = "淇濆瓨澶辫触锛岃鑱旂郴绠$悊鍛�"; + + } + return resultEntity; + } + + + public ResultEntity saveyufukuan(CooperatecustomCustomerDTO cooperatecustomCustomerDTO) + { + ResultEntity resultEntity = new ResultEntity(); + try + { + + + var cooperatecustomCustomer = _mapper.Map<CooperatecustomCustomer>(cooperatecustomCustomerDTO); + + + + var updateproject = _context.CooperatecustomCustomers.Find(cooperatecustomCustomer.Id); + + + updateproject.Yufukuan = cooperatecustomCustomer.Yufukuan; + updateproject.Shenyushouxin = cooperatecustomCustomer.Shenyushouxin; + updateproject.Shouxinedu = cooperatecustomCustomer.Shouxinedu; + _context.SaveChanges(); resultEntity.ReturnID = cooperatecustomCustomer.Id; @@ -294,6 +337,8 @@ YufukuanName = a.Yufukuan.HasValue ? a.Yufukuan.Value.ToString("f2") : "", ShouxineduName = a.Shouxinedu.HasValue ? a.Shouxinedu.Value.ToString("f2") : "", ShenyushouxinName = a.Shenyushouxin.HasValue ? a.Shenyushouxin.Value.ToString("f2") : "", + Taocanjianshu = a.Taocanjianshu ?? 0, + Customertype = "鍚堜綔瀹㈡埛", } ).OrderByDescending(x => x.Modifytime).ToList(); @@ -310,6 +355,60 @@ data.DangyeHeji2 = Math.Round(lianlist.Sum(x => x.Shouxinedu) ?? 0, 2); data.DangyeHeji3 = Math.Round(lianlist.Sum(x => x.Shenyushouxin) ?? 0, 2); data.DangyeHeji4 = Math.Round(lianlist.Sum(x => x.Moneycountde) ?? 0, 2); + + if(lianlist!=null&& lianlist.Count > 0) + { + var members = _context.FiMembers.ToList(); + foreach (var cooperatecustomCustomerDTO in lianlist) + { + cooperatecustomCustomerDTO.Hezuoyewu = ""; + + var cooperOrders = _context.CooperOrders.Where(x => x.RecStatus == "A" && x.ShouliStatus != "0" && x.OrderType == "05" && x.Khdw == cooperatecustomCustomerDTO.Id).ToList(); + + foreach (var cooperOrder in cooperOrders) + { + var member = members.Where(x => x.Id == cooperOrder.OrderType1).FirstOrDefault(); + if (member != null) + { + if (cooperatecustomCustomerDTO.Hezuoyewu.IndexOf(member.MemberType) < 0) + { + cooperatecustomCustomerDTO.Hezuoyewu += member.MemberType + " | "; + } + } + } + + if (!string.IsNullOrEmpty(cooperatecustomCustomerDTO.HuiyuanId)) + { + var huiyuanid = new Guid(cooperatecustomCustomerDTO.HuiyuanId); + + var frameworkRoles = (from a in _zcUserInfoNcontext.OderOfVips + join b in _zcUserInfoNcontext.FrameworkRoles on a.RoleId equals b.Id + where a.IsPayEnd == true && a.IsUserDell == false && a.UserId == huiyuanid + select b + ).ToList(); + + foreach (var frameworkRole in frameworkRoles) + { + if (cooperatecustomCustomerDTO.Hezuoyewu.IndexOf(frameworkRole.RoleName) < 0) + { + cooperatecustomCustomerDTO.Hezuoyewu += frameworkRole.RoleName + " | "; + } + } + } + + + + if (cooperatecustomCustomerDTO.Hezuoyewu.IndexOf("甯稿勾鏀块噰&娉曞緥椤鹃棶") >=0) + { + cooperatecustomCustomerDTO.Hezuoyewu += "閲囪喘鍏憡鏉冮檺 | "; + } + + } + } + + + + data.LoadData(searchEntity, lianlist); return data; } @@ -348,22 +447,44 @@ /// <returns></returns> public List<CooperatecustomCustomerDTO> GetList(string HuiyuanId = "", string Name = "") { + List<CooperatecustomCustomerDTO> CooperatecustomCustomerDTOs = (List<CooperatecustomCustomerDTO>)CacheHelperNetCore.CacheValue("CooperatecustomCustomerDTOs"); + if (CooperatecustomCustomerDTOs != null && CooperatecustomCustomerDTOs.Count > 0) + { + if (!string.IsNullOrEmpty(HuiyuanId)) + { + CooperatecustomCustomerDTOs = CooperatecustomCustomerDTOs.Where(x => x.HuiyuanId == HuiyuanId).ToList(); + } + if (!string.IsNullOrEmpty(Name)) + { + CooperatecustomCustomerDTOs = CooperatecustomCustomerDTOs.Where(x => x.Name == Name).ToList(); + } + + return CooperatecustomCustomerDTOs; + } var listPosition = _context.CooperatecustomCustomers.Where(r => r.RecStatus == "A").ToList(); + CooperatecustomCustomerDTOs = _mapper.Map<List<CooperatecustomCustomerDTO>>(listPosition); + CacheHelperNetCore.CacheInsert("CooperatecustomCustomerDTOs", CooperatecustomCustomerDTOs); + + if (!string.IsNullOrEmpty(HuiyuanId)) { - listPosition = listPosition.Where(x => x.HuiyuanId == HuiyuanId).ToList(); + CooperatecustomCustomerDTOs = CooperatecustomCustomerDTOs.Where(x => x.HuiyuanId == HuiyuanId).ToList(); } if (!string.IsNullOrEmpty(Name)) { - listPosition = listPosition.Where(x => x.Name == Name).ToList(); + CooperatecustomCustomerDTOs = CooperatecustomCustomerDTOs.Where(x => x.Name == Name).ToList(); } - var list = _mapper.Map<List<CooperatecustomCustomerDTO>>(listPosition); - return list; + return CooperatecustomCustomerDTOs; + + + + + } public List<CooperatecustomCustomerDTO> GetListsalary(string userid, DateTime datemin, DateTime datemax) -- Gitblit v1.9.1