From de6201150236757c20355f39cf0109c1492dd498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=81=20=E4=BB=BB?= Date: Sat, 28 Feb 2026 14:29:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BidAnnouncementApp.cs | 159 +++++++++++++++++- .../BidAnnouncementController.cs | 27 ++- 2 files changed, 184 insertions(+), 2 deletions(-) diff --git a/OpenAuth.App/ServiceApp/BidAnnouncementManager/BidAnnouncementApp.cs b/OpenAuth.App/ServiceApp/BidAnnouncementManager/BidAnnouncementApp.cs index 5826d20..cb3758c 100644 --- a/OpenAuth.App/ServiceApp/BidAnnouncementManager/BidAnnouncementApp.cs +++ b/OpenAuth.App/ServiceApp/BidAnnouncementManager/BidAnnouncementApp.cs @@ -31,7 +31,7 @@ namespace OpenAuth.App.ServiceApp.BidAnnouncementManager #region 数据查询 /// - /// 查询公告信息 + /// 查询公告信息--首页 /// /// /// @@ -47,6 +47,163 @@ namespace OpenAuth.App.ServiceApp.BidAnnouncementManager //查询当前账号关联的公司 var companyids = base.Repository.ChangeRepository>().AsQueryable().Where(r => r.UserId == user.User.Id.ToString())?.Select(r => r.CompanyId).ToList(); + //根据账号关联的公司,查询招标公司发布的公告 + table = await base.Repository.AsQueryable() + .WhereIF(type != null, r => r.Type == type) + .LeftJoin((r, b) => r.BidingInfoId == b.Id) + .WhereIF(!string.IsNullOrEmpty(bidtype), (r, b) => b.BiddingType == bidtype) + .Where((r, b) => companyids.Contains(b.BiddingCompanyId)&&r.IsReview==true) + .LeftJoin((r,b,p)=>b.BiddingCompanyId==p.Id) + .OrderByDescending((r, b, p) => r.CreateTime) + .Select((r, b, p) => new + { + r.Id, + r.BidingInfoId, + r.Remark, + r.CreateTime, + r.Title, + r.Content, + r.Type, + b.ProjectName, + b.ProjectNum, + b.BiddingType, + r.Files, + r.IsReview, + p.Name + }) + .ToPageListAsync(page, limit, totalNumber); + } + //招标代理 + if (user != null && user.Roles[0].Name.Contains("招标代理")) + { + //查询当前账号关联的公司 + var companyids = base.Repository.ChangeRepository>().AsQueryable().Where(r => r.UserId == user.User.Id.ToString())?.Select(r => r.AgencyId).ToList(); + + //根据账号关联的公司,查询招标公司发布的公告 + table = await base.Repository.AsQueryable() + .WhereIF(type != null, r => r.Type == type) + .LeftJoin((r, b) => r.BidingInfoId == b.Id) + .WhereIF(!string.IsNullOrEmpty(bidtype), (r, b) => b.BiddingType == bidtype) + .Where((r, b) => companyids.Contains(b.BidAgent) && r.IsReview == true) + .LeftJoin((r, b, p) => b.BiddingCompanyId == p.Id) + .OrderByDescending((r, b, p) => r.CreateTime) + .Select((r, b, p) => new + { + r.Id, + r.BidingInfoId, + r.Remark, + r.CreateTime, + r.Title, + r.Content, + r.Type, + b.ProjectName, + b.ProjectNum, + b.BiddingType, + r.Files, + r.IsReview, + p.Name + }) + .ToPageListAsync(page, limit, totalNumber); + } + + //供应商 + if (user != null && user.Roles[0].Name.Contains("供应商")) + { + //查询当前账号关联的公司 + var companyids = base.Repository.ChangeRepository>().AsQueryable().Where(r => r.UserId == user.User.Id.ToString())?.Select(r => r.CompanyId).ToList(); + + //查询供应商服务的招标公司 + var biddingcomid = base.Repository.ChangeRepository>().AsQueryable().Where(r => companyids.Contains(r.SupplierId))?.Select(r => r.BiddingCompanyId).ToList(); + + ////查询供应商的企业资质 + //var zizhi = base.Repository.ChangeRepository>().AsQueryable().Where(r => companyids.Contains(r.Id))?.Select(r => r.Qualification).ToList(); + + //根据账号关联的公司,查询招标公司发布的公告 + table = await base.Repository.AsQueryable() + .WhereIF(type != null, r => r.Type == type && r.IsReview == true) + .LeftJoin((r, b) => r.BidingInfoId == b.Id) + .WhereIF(!string.IsNullOrEmpty(bidtype), (r, b) => b.BiddingType == bidtype) + .Where((r, b) => biddingcomid.Contains(b.BiddingCompanyId)) + .LeftJoin((r, b, p) => b.BiddingCompanyId == p.Id) + .OrderByDescending((r, b, p) => r.CreateTime) + .Select((r, b, p) => new + { + r.Id, + r.BidingInfoId, + r.Remark, + r.CreateTime, + r.Title, + r.Content, + r.Type, + b.ProjectName, + b.ProjectNum, + b.BiddingType, + r.Files, + r.IsReview, + p.Name + }) + .ToPageListAsync(page, limit, totalNumber); + } + + //超级管理员 + if (user != null && user.User.Id == -1) + { + //根据账号关联的公司,查询招标公司发布的公告 + table = await base.Repository.AsQueryable() + .WhereIF(type != null, r => r.Type == type) + .Where(r=>r.IsReview == true) + .LeftJoin((r, b) => r.BidingInfoId == b.Id) + .WhereIF(!string.IsNullOrEmpty(bidtype), (r, b) => b.BiddingType == bidtype) + .LeftJoin((r, b, p) => b.BiddingCompanyId == p.Id) + .OrderByDescending((r, b, p) => r.CreateTime) + .Select((r, b, p) => new + { + r.Id, + r.BidingInfoId, + r.Remark, + r.CreateTime, + r.Title, + r.Content, + r.Type, + b.ProjectName, + b.ProjectNum, + b.BiddingType, + r.Files, + r.IsReview, + p.Name + }) + .ToPageListAsync(page, limit, totalNumber); + } + + return new Response>>() + { + Result = new PageInfo> + { + Items = table, + Total = totalNumber + } + }; + } + + + /// + /// 查询公告--列表 + /// + /// + /// + /// + /// + /// + public async Task>>> LoadBidAnnouncementtable(string bidtype, short? type, int page = 1, int limit = 10) + { + var user = _auth.GetCurrentUser(); + List table = new List(); + RefAsync totalNumber = 0; + if (user != null && user.Roles[0].Name.Contains("甲方公司")) + { + //查询当前账号关联的公司 + var companyids = base.Repository.ChangeRepository>().AsQueryable().Where(r => r.UserId == user.User.Id.ToString())?.Select(r => r.CompanyId).ToList(); + //根据账号关联的公司,查询招标公司发布的公告 table = await base.Repository.AsQueryable() .WhereIF(type != null, r => r.Type == type) diff --git a/OpenAuth.WebApi/Controllers/ServiceController/BidAnnouncementController.cs b/OpenAuth.WebApi/Controllers/ServiceController/BidAnnouncementController.cs index b9d98cf..3d54358 100644 --- a/OpenAuth.WebApi/Controllers/ServiceController/BidAnnouncementController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceController/BidAnnouncementController.cs @@ -19,7 +19,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceController } /// - /// 分页查询招标公告信息 + /// 分页查询招标公告信息--首页 /// /// 招标信息类型(材料工程那些) /// 公告类型(招标公告,废标公告那些) @@ -42,6 +42,31 @@ namespace OpenAuth.WebApi.Controllers.ServiceController return result; } + + /// + /// 分页查询招标公告信息--列表 + /// + /// 招标信息类型(材料工程那些) + /// 公告类型(招标公告,废标公告那些) + /// + /// + /// + [HttpGet] + public async Task>>> LoadBidAnnouncementtable(string bidtype, short? type, int page = 1, int limit = 10) + { + var result = new Response>>(); + try + { + result = await _app.LoadBidAnnouncementtable(bidtype, type, page, limit); + } + catch (Exception ex) + { + result.Code = 500; + result.Message = ex.InnerException?.Message ?? ex.Message; + } + return result; + } + /// /// 根据id查询单个招标公告--编辑招标公告用 ///