master
parent
1c9110e21e
commit
de62011502
|
|
@ -31,7 +31,7 @@ namespace OpenAuth.App.ServiceApp.BidAnnouncementManager
|
|||
|
||||
#region 数据查询
|
||||
/// <summary>
|
||||
/// 查询公告信息
|
||||
/// 查询公告信息--首页
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="page"></param>
|
||||
|
|
@ -47,6 +47,163 @@ namespace OpenAuth.App.ServiceApp.BidAnnouncementManager
|
|||
//查询当前账号关联的公司
|
||||
var companyids = base.Repository.ChangeRepository<SugarRepositiry<PpCompanyaccount>>().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<PpBiddinginfo>((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<PpBiddingcompany>((r,b,p)=>b.BiddingCompanyId==p.Id)
|
||||
.OrderByDescending((r, b, p) => r.CreateTime)
|
||||
.Select<dynamic>((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<SugarRepositiry<PpAgencyaccount>>().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<PpBiddinginfo>((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<PpBiddingcompany>((r, b, p) => b.BiddingCompanyId == p.Id)
|
||||
.OrderByDescending((r, b, p) => r.CreateTime)
|
||||
.Select<dynamic>((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<SugarRepositiry<PpCompanyaccount>>().AsQueryable().Where(r => r.UserId == user.User.Id.ToString())?.Select(r => r.CompanyId).ToList();
|
||||
|
||||
//查询供应商服务的招标公司
|
||||
var biddingcomid = base.Repository.ChangeRepository<SugarRepositiry<PpBiddingsupplier>>().AsQueryable().Where(r => companyids.Contains(r.SupplierId))?.Select(r => r.BiddingCompanyId).ToList();
|
||||
|
||||
////查询供应商的企业资质
|
||||
//var zizhi = base.Repository.ChangeRepository<SugarRepositiry<PpCompanyinfo>>().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<PpBiddinginfo>((r, b) => r.BidingInfoId == b.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty(bidtype), (r, b) => b.BiddingType == bidtype)
|
||||
.Where((r, b) => biddingcomid.Contains(b.BiddingCompanyId))
|
||||
.LeftJoin<PpBiddingcompany>((r, b, p) => b.BiddingCompanyId == p.Id)
|
||||
.OrderByDescending((r, b, p) => r.CreateTime)
|
||||
.Select<dynamic>((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<PpBiddinginfo>((r, b) => r.BidingInfoId == b.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty(bidtype), (r, b) => b.BiddingType == bidtype)
|
||||
.LeftJoin<PpBiddingcompany>((r, b, p) => b.BiddingCompanyId == p.Id)
|
||||
.OrderByDescending((r, b, p) => r.CreateTime)
|
||||
.Select<dynamic>((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<PageInfo<List<dynamic>>>()
|
||||
{
|
||||
Result = new PageInfo<List<dynamic>>
|
||||
{
|
||||
Items = table,
|
||||
Total = totalNumber
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询公告--列表
|
||||
/// </summary>
|
||||
/// <param name="bidtype"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Response<PageInfo<List<dynamic>>>> LoadBidAnnouncementtable(string bidtype, short? type, int page = 1, int limit = 10)
|
||||
{
|
||||
var user = _auth.GetCurrentUser();
|
||||
List<dynamic> table = new List<dynamic>();
|
||||
RefAsync<int> totalNumber = 0;
|
||||
if (user != null && user.Roles[0].Name.Contains("甲方公司"))
|
||||
{
|
||||
//查询当前账号关联的公司
|
||||
var companyids = base.Repository.ChangeRepository<SugarRepositiry<PpCompanyaccount>>().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)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace OpenAuth.WebApi.Controllers.ServiceController
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询招标公告信息
|
||||
/// 分页查询招标公告信息--首页
|
||||
/// </summary>
|
||||
/// <param name="bidtype">招标信息类型(材料工程那些)</param>
|
||||
/// <param name="type">公告类型(招标公告,废标公告那些)</param>
|
||||
|
|
@ -42,6 +42,31 @@ namespace OpenAuth.WebApi.Controllers.ServiceController
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询招标公告信息--列表
|
||||
/// </summary>
|
||||
/// <param name="bidtype">招标信息类型(材料工程那些)</param>
|
||||
/// <param name="type">公告类型(招标公告,废标公告那些)</param>
|
||||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Response<PageInfo<List<dynamic>>>> LoadBidAnnouncementtable(string bidtype, short? type, int page = 1, int limit = 10)
|
||||
{
|
||||
var result = new Response<PageInfo<List<dynamic>>>();
|
||||
try
|
||||
{
|
||||
result = await _app.LoadBidAnnouncementtable(bidtype, type, page, limit);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.Code = 500;
|
||||
result.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据id查询单个招标公告--编辑招标公告用
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue