From 21d415aeaaa4de2cee01a146ad982fa8f47da2b1 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期一, 26 十二月 2022 15:37:32 +0800 Subject: [PATCH] 提交 --- zhengcaioa/Services/CooperatecustomCustomerService.cs | 99 +++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 90 insertions(+), 9 deletions(-) diff --git a/zhengcaioa/Services/CooperatecustomCustomerService.cs b/zhengcaioa/Services/CooperatecustomCustomerService.cs index 0f51554..459f0b9 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; @@ -98,7 +99,48 @@ updateproject.Shifoutianjiaweixin = cooperatecustomCustomer.Shifoutianjiaweixin; 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; @@ -168,7 +210,7 @@ DateTime.TryParse(Createtimes[1], out Createtimeend); Createtimeend = Createtimeend.AddDays(1); } - + var query = (from a in _context.CooperatecustomCustomers join b in listCode.Where(x => x.CodeTable == "CooperatecustomCustomer" && x.CodeField == "khly") @@ -193,12 +235,12 @@ from abi in esss.DefaultIfEmpty() - join i in _context.CooperOrders.Where(x => x.RecStatus == "A" && x.ChedanStatus !="A" ).GroupBy(q => new { q.Khdw }).Select(q => new + join i in _context.CooperOrders.Where(x => x.RecStatus == "A" && x.ChedanStatus != "A").GroupBy(q => new { q.Khdw }).Select(q => new { Khdw = q.Key.Khdw, Moneycount = q.Sum(i => i.Money), Ordercount = q.Count(), - } + } ) on a.Id equals i.Khdw into isss @@ -232,7 +274,7 @@ && (string.IsNullOrWhiteSpace(searchEntity.Sheng) || a.Sheng == searchEntity.Sheng.Trim()) && (string.IsNullOrWhiteSpace(searchEntity.City) || a.City == searchEntity.City.Trim()) && (string.IsNullOrWhiteSpace(searchEntity.AreaId) || a.AreaId == searchEntity.AreaId.Trim()) - && (string.IsNullOrWhiteSpace(searchEntity.Shifouweixin) || a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim()) + && (string.IsNullOrWhiteSpace(searchEntity.Shifouweixin) || a.Shifoutianjiaweixin == searchEntity.Shifouweixin.Trim()) && (string.IsNullOrWhiteSpace(searchEntity.HuiyuanId) || a.HuiyuanId == searchEntity.HuiyuanId.Trim()) select new CooperatecustomCustomerDTO @@ -245,7 +287,7 @@ Hyfl = a.Hyfl, Khlx = a.Khlx, Ywjl = a.Ywjl, - ShengName = fff.Name + "-" + ggg.Name+ "-" + hhh.Name, + ShengName = fff.Name + "-" + ggg.Name + "-" + hhh.Name, CityName = ggg.Name, AreaIdName = hhh.Name, KhlyName = bbb.Comments, @@ -259,6 +301,7 @@ Tel = a.Tel, Ordercount = iii.Ordercount.ToString(), Moneycount = iii.Moneycount.ToString(), + Moneycountde = iii.Moneycount, Phone = a.Phone, Qq = a.Qq, Email = a.Email, @@ -286,6 +329,14 @@ HuiyuanId = a.HuiyuanId, Weixiner = a.Weixiner, Weixintime = a.Weixintime, + Yufukuan = a.Yufukuan ?? 0, + Shouxinedu = a.Shouxinedu ?? 0, + Shenyushouxin = a.Shenyushouxin ?? 0, + 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(); @@ -293,7 +344,15 @@ //if (searchEntity.totalrows == 0) searchEntity.totalrows = query.Count(); + data.Heji1 = Math.Round(query.Sum(x => x.Yufukuan) ?? 0, 2); + data.Heji2 = Math.Round(query.Sum(x => x.Shouxinedu) ?? 0, 2); + data.Heji3 = Math.Round(query.Sum(x => x.Shenyushouxin) ?? 0, 2); + data.Heji4 = Math.Round(query.Sum(x => x.Moneycountde) ?? 0, 2); var lianlist = query.Skip((searchEntity.page - 1) * searchEntity.rows).Take(searchEntity.rows).ToList(); + data.DangyeHeji1 = Math.Round(lianlist.Sum(x => x.Yufukuan) ?? 0, 2); + 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); data.LoadData(searchEntity, lianlist); return data; } @@ -332,22 +391,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