From 6ee35d97c90d5aa8860b9c9d6df22f76315515f1 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期一, 28 六月 2021 12:44:13 +0800 Subject: [PATCH] 提交 --- zhengcaioa/Services/ProjectService.cs | 88 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 77 insertions(+), 11 deletions(-) diff --git a/zhengcaioa/Services/ProjectService.cs b/zhengcaioa/Services/ProjectService.cs index 765ddb6..e837793 100644 --- a/zhengcaioa/Services/ProjectService.cs +++ b/zhengcaioa/Services/ProjectService.cs @@ -64,6 +64,9 @@ updateproject.Name = project.Name; updateproject.Drhx = project.Drhx; updateproject.DrhxPrice = project.DrhxPrice; + updateproject.DrhxDefen = project.DrhxDefen; + updateproject.DshxDefen = project.DshxDefen; + updateproject.Dshx = project.Dshx; updateproject.Dshx = project.Dshx; updateproject.DshxPrice = project.DshxPrice; updateproject.Zhuanjia = project.Zhuanjia; @@ -188,6 +191,7 @@ } projectzhongbiao.Names = projectDTO.Names[i]; projectzhongbiao.Price = projectDTO.Price[i]; + projectzhongbiao.Defen = projectDTO.Defen[i]; projectzhongbiao.ProjectId = project.Id; _context.Projectzhongbiaos.Add(projectzhongbiao); } @@ -227,7 +231,9 @@ var projectDTO = _mapper.Map<ProjectDTO>(entity); - if(projectreasons!=null && projectreasons.Count>0) + projectDTO.DrhxDefenName = projectDTO.DrhxDefen.HasValue ? projectDTO.DrhxDefen.Value.ToString("F2") : ""; + projectDTO.DshxDefenName = projectDTO.DshxDefen.HasValue ? projectDTO.DshxDefen.Value.ToString("F2") : ""; + if (projectreasons!=null && projectreasons.Count>0) { projectDTO.projectreasons = projectreasons; } @@ -251,12 +257,26 @@ if (Projectzhongbiaos != null && Projectzhongbiaos.Count > 0) { - projectDTO.Projectzhongbiaos = Projectzhongbiaos; + List<ProjectzhongbiaoDTO> projectzhongbiaoDTOs = new List<ProjectzhongbiaoDTO>(); + foreach(var projectzhongbiao in Projectzhongbiaos) + { + ProjectzhongbiaoDTO projectzhongbiaoDTO = new ProjectzhongbiaoDTO(); + projectzhongbiaoDTO.DefenName = projectzhongbiao.Defen.HasValue ? projectzhongbiao.Defen.Value.ToString("F2") : ""; + + projectzhongbiaoDTO.ZhongbiaoId = projectzhongbiao.ZhongbiaoId; + projectzhongbiaoDTO.ProjectId = projectzhongbiao.ProjectId; + projectzhongbiaoDTO.Names = projectzhongbiao.Names; + projectzhongbiaoDTO.Price = projectzhongbiao.Price; + projectzhongbiaoDTO.Defen = projectzhongbiao.Defen; + + projectzhongbiaoDTOs.Add(projectzhongbiaoDTO); + } + projectDTO.Projectzhongbiaos = projectzhongbiaoDTOs; } else { - var Projectzhongbiaoslist = new List<Projectzhongbiao>(); - Projectzhongbiaoslist.Add(new Projectzhongbiao()); + var Projectzhongbiaoslist = new List<ProjectzhongbiaoDTO>(); + Projectzhongbiaoslist.Add(new ProjectzhongbiaoDTO()); projectDTO.Projectzhongbiaos = Projectzhongbiaoslist; } @@ -272,7 +292,7 @@ List<ProjectDTO> list = new List<ProjectDTO>(); //绛涢�� StringBuilder sql = new StringBuilder(); - sql.Append("SELECT distinct a.[Id],a.[start_time] ,b.[name] +'-'+c.[name]+'-'+d.[name] Sheng ,a.city ,a.[area_id],a.cgfs, a.[name] ,a.[number],a.creater,a.createtime,a.modifier,a.modifytime ,a.[drhx],a.[drhx_price],a.[dshx],a.[dshx_price],a.[remark],a.[rec_status] ,a.[question] ,a.[zhongbiaocishu],a.[feibiaocishu],a.[zhongbiaojine],a.[Fblx],a.[Fbyy] , a.[zhuanjia] , a.[caigourenname], a.[caigourenaddress], a.[caigourencontact], a.[dailiname], a.[dailiaddress], a.[dailicontact] ,toubiaocishu = stuff((select '銆�'+ f.[names] from [Projectzhongbiao] f where f.[ProjectId] = a.[Id] for xml path('')), 1,1, '') "); //zhuanjia = stuff((select ','+name from [Zhuanjia] f where CHARINDEX(f.id,a.[zhuanjia]) >0 for xml path('')), 1,1, '') + sql.Append("SELECT distinct a.[Id],a.[start_time],a.[drhx_defen],a.[dshx_defen] ,b.[name] +'-'+c.[name]+'-'+d.[name] Sheng ,a.city ,a.[area_id],a.cgfs, a.[name] ,a.[number],a.creater,a.createtime,a.modifier,a.modifytime ,a.[drhx],a.[drhx_price],a.[dshx],a.[dshx_price],a.[remark],a.[rec_status] ,a.[question] ,a.[zhongbiaocishu],a.[feibiaocishu],a.[zhongbiaojine],a.[Fblx],a.[Fbyy] , a.[zhuanjia] , a.[caigourenname], a.[caigourenaddress], a.[caigourencontact], a.[dailiname], a.[dailiaddress], a.[dailicontact] ,toubiaocishu = stuff((select '銆�'+ f.[names] from [Projectzhongbiao] f where f.[ProjectId] = a.[Id] for xml path('')), 1,1, '') "); //zhuanjia = stuff((select ','+name from [Zhuanjia] f where CHARINDEX(f.id,a.[zhuanjia]) >0 for xml path('')), 1,1, '') sql.Append("FROM [Project] a "); sql.Append("left join [Area] b on a.[sheng] = b.[codeID] "); sql.Append("left join [Area] c on a.[city] = c.[codeID] "); @@ -301,8 +321,39 @@ sql.Append(" )"); } - - if (!string.IsNullOrWhiteSpace(searchEntity.fblx)) + if (!string.IsNullOrWhiteSpace(searchEntity.Fencha)) + { + decimal aaaa = 0; + decimal.TryParse(searchEntity.Fencha, out aaaa); + if (aaaa > 0) + { + sql.Append(" and exists ( select b.[ProjectId] from [Projectzhongbiao] b where a.[Id]=b.[ProjectId] and (b.[defen]-a.[drhx_defen]) <= " + aaaa + " ) "); + } + } + + if (!string.IsNullOrWhiteSpace(searchEntity.Reasonname)) + { + sql.Append(" and exists (select b.[ProjectId] from [Projectreason] b where a.[Id]=b.[ProjectId] and b.[reasonname] like '%" + searchEntity.Reasonname + "%') "); + + } + + if (!string.IsNullOrWhiteSpace(searchEntity.ShiFouyReasonname)) + { + if (searchEntity.ShiFouyReasonname == "A") + { + sql.Append(" and exists (select b.[ProjectId] from [Projectreason] b where a.[Id]=b.[ProjectId] ) "); + + } + else + { + sql.Append(" and not exists (select b.[ProjectId] from [Projectreason] b where a.[Id]=b.[ProjectId] ) "); + } + + + } + + + if (!string.IsNullOrWhiteSpace(searchEntity.fblx)) { if (searchEntity.fblx == "A") { @@ -316,16 +367,31 @@ } + DateTime StartTimestarstart = DateTime.Now; + DateTime StartTimestarend = DateTime.Now; if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar)) { - sql.Append(" and a.start_time >='"+ searchEntity.StartTimestar.Trim().Replace("'","''") + "'"); - + string[] StartTimestars = searchEntity.StartTimestar.Split("|"); + DateTime.TryParse(StartTimestars[0], out StartTimestarstart); + DateTime.TryParse(StartTimestars[1], out StartTimestarend); + //Createtimeend = Createtimeend.AddDays(1); } - if (!string.IsNullOrWhiteSpace(searchEntity.StartTimeend)) + + + if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar)) { - sql.Append(" and a.start_time <='" + DateTime.Parse(searchEntity.StartTimeend.Trim().Replace("'", "''")).AddDays(1).ToString("yyyy-MM-dd") + "'"); ; + sql.Append(" and a.start_time >='" + StartTimestarstart.ToString("yyyy-MM-dd") + "'"); } + if (!string.IsNullOrWhiteSpace(searchEntity.StartTimestar)) + { + sql.Append(" and a.start_time <='" + StartTimestarend.AddDays(1).ToString("yyyy-MM-dd") + "'"); + + } + + + + if (!string.IsNullOrWhiteSpace(searchEntity.Sheng)) { -- Gitblit v1.9.1