using DocumentServiceAPI.Application.ProjectInfo.Services.Interfaces;
|
using DocumentServiceAPI.Application.ProjectInfo.ViewMode;
|
using DocumentServiceAPI.Application.Repository;
|
using DocumentServiceAPI.Model.cyDocumentModel;
|
using DocumentServiceAPI.Model.UserInfoModel;
|
using DocumentServiceAPI.Utility;
|
using MapsterMapper;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using NetTaste;
|
using SqlSugar.Extensions;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Runtime.Intrinsics.Arm;
|
using System.Security.Claims;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace DocumentServiceAPI.Application.ProjectInfo.Services
|
{
|
public class SheZhiService : ISheZhiService, IScoped
|
{
|
|
private ISqlSugarClient _db { get; set; }
|
private ProjectInfoRepository _projectInfoRepository { get; set; }
|
private IMapper _mapper { get; set; }
|
public SheZhiService(ISqlSugarClient db, ProjectInfoRepository projectInfoRepository, IMapper mapper)
|
{
|
_db = db;
|
_projectInfoRepository = projectInfoRepository;
|
_mapper = mapper;
|
}
|
|
public PageResult<Document_DelegatePersonInfo> postDelegatePersonList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<Document_DelegatePersonInfo> result = new PageResult<Document_DelegatePersonInfo>();
|
|
|
|
result.Items = _db.Queryable<Document_DelegatePersonInfo>()
|
.Where(a => a.TenantID == aaa.TEID)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.delegateName), a => a.DelegateName.Contains(page.delegateName))
|
.WhereIF(page.isUse > 0, a => a.IsUse == page.isUse)
|
|
|
.OrderByDescending(a => a.DelegateId).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
|
|
return result;
|
}
|
|
|
public bool GetDelDocumentDelegatePersonInfo(int ID)
|
{
|
_db.Deleteable<Document_DelegatePersonInfo>().Where(x => x.DelegateId == ID).ExecuteCommand();
|
|
return true;
|
}
|
|
public bool SaveDocumentDelegatePersonInfo(Document_DelegatePersonInfo dp)
|
{
|
if (dp.DelegateId > 0)
|
{
|
_db.Updateable<Document_DelegatePersonInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_DelegatePersonInfo>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
public Document_DelegatePersonInfo GetDocumentDelegatePersonInfo(int ID)
|
{
|
var result = _db.Queryable<Document_DelegatePersonInfo>().Where(x => x.DelegateId == ID).First();//执行查询
|
return result;
|
}
|
|
|
|
|
|
public PageResult<Document_TenderUnit> postDocumentTenderUnitList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<Document_TenderUnit> result = new PageResult<Document_TenderUnit>();
|
|
|
|
result.Items = _db.Queryable<Document_TenderUnit>()
|
.Where(a => a.TenantId == aaa.TEID)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.delegateName), a => a.UnitName.Contains(page.delegateName))
|
.WhereIF(page.isUse > 0, a => a.IsUsed == page.isUse)
|
|
|
.OrderByDescending(a => a.UnitId).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
|
|
return result;
|
}
|
|
|
|
|
public bool SaveDocumentTenderUnitInfo(Document_TenderUnit dp)
|
{
|
if (dp.UnitId > 0)
|
{
|
_db.Updateable<Document_TenderUnit>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_TenderUnit>(dp).ExecuteCommand();
|
}
|
|
return true;
|
}
|
|
public Document_TenderUnit GetDocumentTenderUnitInfo(int ID)
|
{
|
var result = _db.Queryable<Document_TenderUnit>().Where(x => x.UnitId == ID).First();//执行查询
|
return result;
|
}
|
|
|
|
public PageResult<DocumentEmployeeInfoDTO> postDocumentEmployeeInfoList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<DocumentEmployeeInfoDTO> result = new PageResult<DocumentEmployeeInfoDTO>();
|
|
|
|
var document_EmployeeInfos = _db.Queryable<Document_EmployeeInfo, EmployeeAtTenant>((a, b) =>
|
new JoinQueryInfos
|
(
|
JoinType.Inner, a.EmployeeId == b.EmployeeID && b.TenantID == aaa.TEID
|
|
)
|
)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.txtName), (a, b) => a.EmployeeName.Contains(page.txtName))
|
|
|
.OrderByDescending((a, b) => a.EmployeeId).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
|
|
|
var documentEmployeeInfoDTOs = _mapper.Map<List<DocumentEmployeeInfoDTO>>(document_EmployeeInfos);
|
|
|
|
if (documentEmployeeInfoDTOs != null && documentEmployeeInfoDTOs.Count > 0)
|
{
|
var ret = _db.Queryable<Document_EmployeeRole>().ToList();
|
foreach (var documentEmployeeInfoDTO in documentEmployeeInfoDTOs)
|
{
|
if (documentEmployeeInfoDTO.IsWork.HasValue && documentEmployeeInfoDTO.IsWork.Value>0)
|
{
|
documentEmployeeInfoDTO.IsWorkName = "在职";
|
}
|
else
|
{
|
documentEmployeeInfoDTO.IsWorkName = "离职";
|
}
|
|
if (documentEmployeeInfoDTO.IsWork.HasValue && documentEmployeeInfoDTO.IsWork.Value == 1)
|
{
|
documentEmployeeInfoDTO.LeaveTimeName = "";
|
}
|
else
|
{
|
if (documentEmployeeInfoDTO.LeaveTime.HasValue)
|
{
|
documentEmployeeInfoDTO.LeaveTimeName = documentEmployeeInfoDTO.LeaveTime.Value.ToString("yyyy-MM-dd");
|
}
|
else
|
{
|
documentEmployeeInfoDTO.LeaveTimeName = "";
|
}
|
}
|
|
var document_EmployeeRole = ret.Where(x => x.EmployeeId == documentEmployeeInfoDTO.EmployeeId && x.RoleType == 1).FirstOrDefault();
|
if(document_EmployeeRole != null)
|
{
|
documentEmployeeInfoDTO.BMRID = "是";
|
}
|
else
|
{
|
documentEmployeeInfoDTO.BMRID = "否";
|
}
|
|
var document_EmployeeRole1 = ret.Where(x => x.EmployeeId == documentEmployeeInfoDTO.EmployeeId && x.RoleType == 2).FirstOrDefault();
|
if (document_EmployeeRole1 != null)
|
{
|
documentEmployeeInfoDTO.BSZZRID = "是";
|
}
|
else
|
{
|
documentEmployeeInfoDTO.BSZZRID = "否";
|
}
|
|
var document_EmployeeRole2 = ret.Where(x => x.EmployeeId == documentEmployeeInfoDTO.EmployeeId && x.RoleType == 3).FirstOrDefault();
|
if (document_EmployeeRole2 != null)
|
{
|
documentEmployeeInfoDTO.TBRID = "是";
|
}
|
else
|
{
|
documentEmployeeInfoDTO.TBRID = "否";
|
}
|
|
|
}
|
}
|
|
result.Items = documentEmployeeInfoDTOs;
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
|
return result;
|
}
|
|
public bool GetDelDocumentEmployeeInfoInfo(int ID)
|
{
|
_db.Deleteable<EmployeeAtTenant>().Where(x => x.EmployeeID == ID).ExecuteCommand();
|
_db.Deleteable<Document_EmployeeRole>().Where(x => x.EmployeeId == ID).ExecuteCommand();
|
_db.Deleteable<Document_EmployeeInfo>().Where(x => x.EmployeeId == ID).ExecuteCommand();
|
|
|
|
return true;
|
}
|
|
public bool SaveDocumentEmployeeInfoInfo(DocumentEmployeeInfoDTO dp)
|
{
|
var document_EmployeeInfo = _mapper.Map<Document_EmployeeInfo>(dp);
|
|
if (dp.EmployeeId > 0)
|
{
|
_db.Updateable<Document_EmployeeInfo>(document_EmployeeInfo).ExecuteCommand();
|
|
}
|
else
|
{
|
var aaa = GetJwtInfo();
|
|
|
|
dp.EmployeeId = _db.Insertable<Document_EmployeeInfo>(document_EmployeeInfo).ExecuteReturnIdentity();
|
|
EmployeeAtTenant employeeAtTenant = new EmployeeAtTenant();
|
employeeAtTenant.EmployeeID = dp.EmployeeId;
|
employeeAtTenant.TenantID = aaa.TEID.Value;
|
_db.Insertable<EmployeeAtTenant>(employeeAtTenant).ExecuteCommand();
|
}
|
|
|
if (!string.IsNullOrEmpty(dp.BMRID) && !string.IsNullOrEmpty(dp.BSZZRID) && !string.IsNullOrEmpty(dp.TBRID))
|
{
|
_db.Deleteable<Document_EmployeeRole>().Where(x => x.EmployeeId == dp.EmployeeId).ExecuteCommand();
|
if (dp.BMRID == "是")
|
{
|
Document_EmployeeRole document_EmployeeRole = new Document_EmployeeRole();
|
document_EmployeeRole.EmployeeId = dp.EmployeeId;
|
document_EmployeeRole.RoleType = 1;
|
_db.Insertable<Document_EmployeeRole>(document_EmployeeRole).ExecuteCommand();
|
}
|
if (dp.BSZZRID == "是")
|
{
|
Document_EmployeeRole document_EmployeeRole = new Document_EmployeeRole();
|
document_EmployeeRole.EmployeeId = dp.EmployeeId;
|
document_EmployeeRole.RoleType = 2;
|
_db.Insertable<Document_EmployeeRole>(document_EmployeeRole).ExecuteCommand();
|
}
|
if (dp.TBRID == "是")
|
{
|
Document_EmployeeRole document_EmployeeRole = new Document_EmployeeRole();
|
document_EmployeeRole.EmployeeId = dp.EmployeeId;
|
document_EmployeeRole.RoleType = 3;
|
_db.Insertable<Document_EmployeeRole>(document_EmployeeRole).ExecuteCommand();
|
}
|
}
|
|
return true;
|
}
|
|
public DocumentEmployeeInfoDTO GetDocumentEmployeeInfoInfo(int ID)
|
{
|
var result = _db.Queryable<Document_EmployeeInfo>().Where(x => x.EmployeeId == ID).First();//执行查询
|
|
var documentEmployeeInfoDTO = _mapper.Map<DocumentEmployeeInfoDTO>(result);
|
|
|
|
if (documentEmployeeInfoDTO != null )
|
{
|
var ret = _db.Queryable<Document_EmployeeRole>().ToList();
|
|
if (documentEmployeeInfoDTO.IsWork.HasValue && documentEmployeeInfoDTO.IsWork.Value > 0)
|
{
|
documentEmployeeInfoDTO.IsWorkName = "在职";
|
}
|
else
|
{
|
documentEmployeeInfoDTO.IsWorkName = "离职";
|
}
|
|
if (documentEmployeeInfoDTO.IsWork.HasValue && documentEmployeeInfoDTO.IsWork.Value == 1)
|
{
|
documentEmployeeInfoDTO.LeaveTimeName = "";
|
}
|
else
|
{
|
if (documentEmployeeInfoDTO.LeaveTime.HasValue)
|
{
|
documentEmployeeInfoDTO.LeaveTimeName = documentEmployeeInfoDTO.LeaveTime.Value.ToString("yyyy-MM-dd");
|
}
|
else
|
{
|
documentEmployeeInfoDTO.LeaveTimeName = "";
|
}
|
}
|
|
var document_EmployeeRole = ret.Where(x => x.EmployeeId == documentEmployeeInfoDTO.EmployeeId && x.RoleType == 1).FirstOrDefault();
|
if (document_EmployeeRole != null)
|
{
|
documentEmployeeInfoDTO.BMRID = "是";
|
}
|
else
|
{
|
documentEmployeeInfoDTO.BMRID = "否";
|
}
|
|
var document_EmployeeRole1 = ret.Where(x => x.EmployeeId == documentEmployeeInfoDTO.EmployeeId && x.RoleType == 2).FirstOrDefault();
|
if (document_EmployeeRole1 != null)
|
{
|
documentEmployeeInfoDTO.BSZZRID = "是";
|
}
|
else
|
{
|
documentEmployeeInfoDTO.BSZZRID = "否";
|
}
|
|
var document_EmployeeRole2 = ret.Where(x => x.EmployeeId == documentEmployeeInfoDTO.EmployeeId && x.RoleType == 3).FirstOrDefault();
|
if (document_EmployeeRole2 != null)
|
{
|
documentEmployeeInfoDTO.TBRID = "是";
|
}
|
else
|
{
|
documentEmployeeInfoDTO.TBRID = "否";
|
}
|
|
|
|
}
|
|
return documentEmployeeInfoDTO;
|
}
|
|
public Document_EmployeeInfo GetDocumentEmployeeInfoByName(string EmployeeName)
|
{
|
var aaa = GetJwtInfo();
|
var documentEmployeeInfoDTO = _db.Queryable<Document_EmployeeInfo, EmployeeAtTenant>((a, b) =>
|
new JoinQueryInfos
|
(
|
JoinType.Inner, a.EmployeeId == b.EmployeeID && b.TenantID == aaa.TEID
|
)
|
)
|
//文件名称
|
.Where((a, b) => a.EmployeeName == EmployeeName).First();
|
|
|
|
|
|
return documentEmployeeInfoDTO;
|
}
|
|
|
public Document_EmployeeInfo GetDocumentEmployeeInfoByLoginName(string textUserName)
|
{
|
var aaa = GetJwtInfo();
|
var documentEmployeeInfoDTO = _db.Queryable<Document_EmployeeInfo, EmployeeAtTenant>((a, b) =>
|
new JoinQueryInfos
|
(
|
JoinType.Inner, a.EmployeeId == b.EmployeeID && b.TenantID == aaa.TEID
|
)
|
)
|
//文件名称
|
.Where((a, b) => a.UserName == textUserName).First();
|
|
|
|
|
|
return documentEmployeeInfoDTO;
|
}
|
|
|
public PageResult<Document_PerformanceInfo> GetDocumentPerformanceInfoListByPaper(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
List<Document_PerformanceInfo> m_Document_PerformanceInfoList = new List<Document_PerformanceInfo>();
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<Document_PerformanceInfo> result = new PageResult<Document_PerformanceInfo>();
|
|
DateTime txtWorkStartTime = string.IsNullOrEmpty(page.txtWorkStartTime) ? DateTime.MinValue : DateTime.Parse(page.txtWorkStartTime);
|
DateTime txtWorkEndTime = string.IsNullOrEmpty(page.txtWorkEndTime) ? DateTime.MaxValue : DateTime.Parse(page.txtWorkEndTime);
|
|
var dt_Signup = _db.Queryable<Document_ProjectExpand, Document_ProjectInfo>((a, b) =>
|
new JoinQueryInfos
|
(
|
JoinType.Inner, a.ProjectId == b.ProjectId && b.TenantID == aaa.TEID
|
|
)
|
)
|
.Where((a, b) => a.IsSignup == 1)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkStartTime), (a, b) => a.SignupTime >= txtWorkStartTime)
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkEndTime), (a, b) => a.SignupTime <= txtWorkEndTime)
|
.WhereIF(!string.IsNullOrEmpty(page.txtEmployeeId) && page.txtEmployeeId != "请选择" , (a, b) => a.SignupPerson == page.txtEmployeeId)
|
.WhereIF(!string.IsNullOrEmpty(page.projectName), (a, b) => b.ProjectName.Contains(page.projectName))
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkItem), (a, b) => "报名" == page.txtWorkItem)
|
.Select((a, b) =>new Document_PerformanceInfo
|
{
|
WorkTime = a.SignupTime,
|
EmployeeName = a.SignupPerson,
|
Price = a.SignupAllowance,
|
ProjectName = b.ProjectName,
|
WorkItem = "报名",
|
}).ToList()
|
;
|
|
|
var dt_Document = _db.Queryable<Document_ProjectExpand, Document_ProjectInfo, Document_ProjectDocumentInfo>((a, b,c) =>
|
new JoinQueryInfos
|
(
|
JoinType.Inner, a.ProjectId == b.ProjectId && b.TenantID == aaa.TEID,
|
JoinType.Left, a.ProjectId == c.ProjectId
|
)
|
)
|
.Where((a, b, c) => a.DocumentStatus == 17)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkStartTime), (a, b, c) => c.LastUpdateTime >= txtWorkStartTime)
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkEndTime), (a, b, c) => c.LastUpdateTime <= txtWorkEndTime)
|
.WhereIF(!string.IsNullOrEmpty(page.txtEmployeeId) && page.txtEmployeeId != "请选择", (a, b) => a.DocumentManager == page.txtEmployeeId)
|
.WhereIF(!string.IsNullOrEmpty(page.projectName), (a, b, c) => b.ProjectName.Contains(page.projectName))
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkItem), (a, b, c) => "标书制作" == page.txtWorkItem)
|
.Select((a, b, c) => new Document_PerformanceInfo
|
{
|
WorkTime = c.LastUpdateTime,
|
EmployeeName = a.DocumentManager,
|
Price = a.DocumentPrice,
|
ProjectName = b.ProjectName,
|
WorkItem = "标书制作",
|
}).ToList()
|
;
|
|
var dt_Tender = _db.Queryable<Document_ProjectExpand, Document_ProjectInfo>((a, b) =>
|
new JoinQueryInfos
|
(
|
JoinType.Inner, a.ProjectId == b.ProjectId && b.TenantID == aaa.TEID
|
)
|
)
|
.Where((a, b) => a.TenderStatus == 1)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkStartTime), (a, b) => b.TenderTime >= txtWorkStartTime)
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkEndTime), (a, b) => b.TenderTime <= txtWorkEndTime)
|
.WhereIF(!string.IsNullOrEmpty(page.txtEmployeeId) && page.txtEmployeeId != "请选择", (a, b) => a.TenderPerson == page.txtEmployeeId)
|
.WhereIF(!string.IsNullOrEmpty(page.projectName), (a, b) => b.ProjectName.Contains(page.projectName))
|
.WhereIF(!string.IsNullOrEmpty(page.txtWorkItem), (a, b) => "投标" == page.txtWorkItem)
|
.Select((a, b) => new Document_PerformanceInfo
|
{
|
WorkTime = b.TenderTime,
|
EmployeeName = a.DocumentManager,
|
Price = a.DocumentPrice,
|
ProjectName = b.ProjectName,
|
WorkItem = "投标",
|
}).ToList();
|
var newDataTable = new List<Document_PerformanceInfo>();
|
object[] obj = new object[newDataTable.Count];
|
|
for (int i = 0; i < dt_Signup.Count; i++)
|
{
|
|
newDataTable.Add(dt_Signup[i]);
|
}
|
for (int i = 0; i < dt_Document.Count; i++)
|
{
|
|
newDataTable.Add(dt_Document[i]);
|
}
|
|
for (int i = 0; i < dt_Tender.Count; i++)
|
{
|
|
newDataTable.Add(dt_Tender[i]);
|
}
|
|
for (int i = 0; i < newDataTable.Count; i++)
|
{
|
Document_PerformanceInfo m_Document_PerformanceInfo = new Document_PerformanceInfo();
|
m_Document_PerformanceInfo.EmployeeId = 0;
|
m_Document_PerformanceInfo.Id = 0;
|
m_Document_PerformanceInfo.ProjectName = newDataTable[i].ProjectName;
|
m_Document_PerformanceInfo.WorkItem = newDataTable[i].WorkItem;
|
if (newDataTable[i].Price.HasValue)
|
{
|
m_Document_PerformanceInfo.Price = newDataTable[i].Price;
|
}
|
else
|
{
|
m_Document_PerformanceInfo.Price = 0;
|
}
|
m_Document_PerformanceInfo.EmployeeName = newDataTable[i].EmployeeName;
|
m_Document_PerformanceInfo.WorkTime = newDataTable[i].WorkTime;
|
|
|
|
if (m_Document_PerformanceInfo.Price.HasValue && m_Document_PerformanceInfo.Price.Value>0)
|
{
|
m_Document_PerformanceInfoList.Add(m_Document_PerformanceInfo);
|
result.AllPageMoney += m_Document_PerformanceInfo.Price.Value;
|
}
|
}
|
;
|
|
|
|
|
|
|
|
//.ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
|
|
var document_PerformanceInfos = m_Document_PerformanceInfoList.Skip(page.PageIndex - 1).Take(page.PageSize).ToList();
|
|
foreach (var item in document_PerformanceInfos)
|
{
|
result.NowPageMoney += item.Price.Value;
|
}
|
|
|
result.Items = document_PerformanceInfos;
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
|
return result;
|
}
|
|
/// <summary>
|
/// 获取Jwt相关信息
|
/// </summary>
|
public Model.JwtInfo GetJwtInfo()
|
{
|
Model.JwtInfo jwtInfo = new Model.JwtInfo();
|
jwtInfo.LogInSource = (Model.LogInFrom)(App.User?.FindFirstValue("loginfrom")?.ObjToInt() ?? 0);
|
jwtInfo.EID = App.User?.FindFirstValue("eid")?.ObjToInt();
|
jwtInfo.UID = App.User?.FindFirstValue("uid")?.ObjToInt();
|
jwtInfo.TEID = App.User?.FindFirstValue("teid")?.ObjToInt();
|
var guid = App.User?.FindFirstValue("jid");
|
jwtInfo.JID = string.IsNullOrEmpty(guid) ? null : new Guid(guid);
|
return jwtInfo;
|
}
|
|
|
public PageResult<DocumentProjectInfoDTO> postGetFinancialList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<DocumentProjectInfoDTO> result = new PageResult<DocumentProjectInfoDTO>();
|
|
|
|
result.Items = _db.Queryable<Document_ProjectInfo, Document_ProjectExpand>((a, d) =>
|
new JoinQueryInfos
|
(
|
JoinType.Left, a.ProjectId == d.ProjectId && d.UnitId == page.UnitId
|
|
))
|
.Where((a, d) => a.TenantID == aaa.TEID)
|
//省
|
.WhereIF(!string.IsNullOrEmpty(page.Province) && page.Province != "请选择", (a, d) => (a.Province == page.Province))
|
//市
|
.WhereIF(!string.IsNullOrEmpty(page.City) && page.City != "请选择", (a, d) => (a.City == page.City))
|
//区县
|
.WhereIF(!string.IsNullOrEmpty(page.County) && page.County != "请选择", (a, d) => (a.County == page.County))
|
//报名时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlSignupStartTime), (a, d) => a.SignupStartTime >= DateTime.Parse(page.ddlSignupStartTime))
|
//报名时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlSignupEndTime), (a, d) => a.SignupEndTime <= DateTime.Parse(page.ddlSignupEndTime))
|
//开标时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlTenderStartTime), (a, d) => a.TenderTime >= DateTime.Parse(page.ddlTenderStartTime))
|
//开标时间
|
.WhereIF(!string.IsNullOrEmpty(page.ddlTenderEndTime), (a, d) => a.TenderTime <= DateTime.Parse(page.ddlTenderEndTime))
|
//采购方式
|
.WhereIF(page.ddlPurchaseMethod > 0, (a, d) => a.PurchaseMethod == page.ddlPurchaseMethod)
|
//项目名称
|
.WhereIF(!string.IsNullOrEmpty(page.txtProjectName), (a, d) => a.ProjectName.Contains(page.txtProjectName))
|
//项目编号
|
.WhereIF(!string.IsNullOrEmpty(page.txtProjectCode), (a, d) => a.ProjectCode.Contains(page.txtProjectCode))
|
//采购单位
|
.WhereIF(!string.IsNullOrEmpty(page.txtPurchaseUnit), (a, d) => a.PurchaseUnit.Contains(page.txtPurchaseUnit))
|
//代理机构
|
.WhereIF(!string.IsNullOrEmpty(page.txtAgencyUnit), (a, d) => a.AgencyUnit.Contains(page.txtAgencyUnit))
|
////投标人
|
//.WhereIF(!string.IsNullOrEmpty(page.txtTenderPerson), (a, d) => d.TenderPerson.Contains(page.txtTenderPerson))
|
// //专家
|
// .WhereIF(!string.IsNullOrEmpty(page.Experts), (a, d) => d.Experts.Contains(page.Experts))
|
// //报名状态
|
// .WhereIF(page.ddlSignUp > 0 && page.ddlSignUp == 1, (a, d) => (d.IsSignup == 0 || d.IsSignup == null))
|
// .WhereIF(page.ddlSignUp > 0 && page.ddlSignUp != 1, (a, d) => d.IsSignup == 1)
|
//保证金状态
|
.WhereIF(page.ddlTenderDeposit > 0 && page.ddlTenderDeposit == 12, (a, d) => d.TenderDepositStatus == null)
|
.WhereIF(page.ddlTenderDeposit > 0 && page.ddlTenderDeposit == 36, (a, d) => a.TenderTime < DateTime.Now.AddDays(15) && d.TenderDepositStatus == 13)
|
.WhereIF(page.ddlTenderDeposit > 0 && page.ddlTenderDeposit != 12 && page.ddlTenderDeposit != 36, (a, d) => d.TenderDepositStatus == page.ddlTenderDeposit)
|
//履约金状态
|
.WhereIF(page.ddlBidbond > 0 && page.ddlBidbond == 32, (a, d) => (d.BidbondStatus == null))
|
.WhereIF(page.ddlBidbond > 0 && page.ddlBidbond != 32, (a, d) => d.BidbondStatus == page.ddlBidbond)
|
// //标书状态
|
// .WhereIF(page.ddlDocumentStatus > 0 && page.ddlDocumentStatus == 15, (a, d) => (d.DocumentStatus == null || d.DocumentStatus == 0 || d.DocumentStatus == 15))
|
// .WhereIF(page.ddlDocumentStatus > 0 && page.ddlDocumentStatus != 15, (a, d) => d.DocumentStatus == page.ddlDocumentStatus)
|
// //投标状态
|
// .WhereIF(page.ddlTenderStatus > 0 && page.ddlTenderStatus == 1, (a, d) => (d.TenderStatus == null || d.TenderStatus == 0))
|
// .WhereIF(page.ddlTenderStatus > 0 && page.ddlTenderStatus != 1, (a, d) => d.TenderStatus == 1)
|
////中标情况
|
//.WhereIF(page.ddlWinStatus > 0 && page.ddlWinStatus == 1, (a, d) => n.IsWin == null)
|
// .WhereIF(page.ddlWinStatus > 0 && page.ddlWinStatus != 1, (a, d) => n.IsWin == (page.ddlWinStatus - 1))
|
////质疑情况
|
//.WhereIF(page.ddlOppugnStatus > 0 && page.ddlOppugnStatus == 1, (a, d) => (e.FilePath == null || e.FilePath == ""))
|
// .WhereIF(page.ddlOppugnStatus > 0 && page.ddlOppugnStatus != 1, (a, d) => (e.FilePath != null && e.FilePath != ""))
|
////投诉情况
|
//.WhereIF(page.ddlComplainStatus > 0 && page.ddlComplainStatus == 1, (a, d) => (f.FilePath == null || f.FilePath == ""))
|
// .WhereIF(page.ddlComplainStatus > 0 && page.ddlComplainStatus != 1, (a, d) => (f.FilePath != null && f.FilePath != ""))
|
// //复议情况
|
// .WhereIF(page.ddlReviewStatus > 0 && page.ddlReviewStatus == 1, (a, d) => (g.FilePath == null || g.FilePath == ""))
|
// .WhereIF(page.ddlReviewStatus > 0 && page.ddlReviewStatus != 1, (a, d) => (g.FilePath != null && g.FilePath != ""))
|
// //诉讼情况
|
// .WhereIF(page.ddlLitigationStatus > 0 && page.ddlLitigationStatus == 1, (a, d) => (h.FilePath == null || h.FilePath == ""))
|
// .WhereIF(page.ddlLitigationStatus > 0 && page.ddlLitigationStatus != 1, (a, d) => (h.FilePath != null && h.FilePath != ""))
|
.Select((a, d) => new DocumentProjectInfoDTO
|
{
|
ProjectId = a.ProjectId,
|
SignupStartTime = a.SignupStartTime,
|
Province = a.Province,
|
City = a.City,
|
County = a.County,
|
ProjectName = a.ProjectName,
|
PurchaseUnit = a.PurchaseUnit,
|
AgencyUnit = a.AgencyUnit,
|
TenderTime = a.TenderTime,
|
TenderPerson = d.TenderPerson,
|
IsSignup = d.IsSignup,
|
TenderDepositStatus = d.TenderDepositStatus,
|
BidbondStatus = d.BidbondStatus,
|
TenderStatus = d.TenderStatus,
|
tbqk = "投标情况",
|
wj = "",
|
NoticeTypeName = "招标公告",
|
NoticeType = a.NoticeType,
|
PurchaseMethod = a.PurchaseMethod,
|
DocumentStatus = d.DocumentStatus,
|
TenderDepositStartTime = d.TenderDepositStartTime,
|
TenderDeposit = a.TenderDeposit,
|
TenderDepositEndTime = d.TenderDepositEndTime,
|
BidbondStartTime = d.BidbondStartTime,
|
BidbondEndTime = d.BidbondEndTime,
|
Bidbond = a.Bidbond,
|
}
|
)
|
.OrderByDescending(a => a.ProjectId).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
if (result.Items != null && result.Items.Count > 0)
|
{
|
var ret = _db.Queryable<Document_Dictionary>().ToList();
|
foreach (var documentProjectInfoDTO in result.Items)
|
{
|
if (documentProjectInfoDTO.City == "请选择" && documentProjectInfoDTO.County == "请选择")
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.Province;
|
}
|
else if (documentProjectInfoDTO.City == "请选择" && documentProjectInfoDTO.County == "其他")
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.City;
|
}
|
else
|
{
|
documentProjectInfoDTO.xmqy = documentProjectInfoDTO.City + documentProjectInfoDTO.County;
|
}
|
|
//if (documentProjectInfoDTO.IsSignup == 1)
|
//{
|
// documentProjectInfoDTO.bm = "√";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.bm = "报名";
|
//}
|
|
if (!documentProjectInfoDTO.TenderDepositStatus.HasValue || documentProjectInfoDTO.TenderDepositStatus == 0)
|
{
|
documentProjectInfoDTO.bzj = "缴费";
|
}
|
else if (documentProjectInfoDTO.TenderDepositStatus == 13)
|
{
|
documentProjectInfoDTO.bzj = "退款";
|
}
|
else
|
{
|
documentProjectInfoDTO.bzj = "√";
|
}
|
|
if (!documentProjectInfoDTO.BidbondStatus.HasValue || documentProjectInfoDTO.BidbondStatus == 0)
|
{
|
documentProjectInfoDTO.lybzj = "缴费";
|
}
|
else if (documentProjectInfoDTO.BidbondStatus == 33)
|
{
|
documentProjectInfoDTO.lybzj = "退款";
|
}
|
else
|
{
|
documentProjectInfoDTO.lybzj = "√";
|
}
|
|
//if (documentProjectInfoDTO.TenderStatus == 1)
|
//{
|
// documentProjectInfoDTO.tb = "√";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.tb = "投标";
|
//}
|
|
//if (documentProjectInfoDTO.DocumentStatus == 17)
|
//{
|
// documentProjectInfoDTO.bs = "√";
|
//}
|
//else if (documentProjectInfoDTO.DocumentStatus == 16)
|
//{
|
// documentProjectInfoDTO.bs = "制作中";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.bs = "未制作";
|
//}
|
|
|
//if (!documentProjectInfoDTO.IsWin.HasValue || documentProjectInfoDTO.IsWin <= 0)
|
//{
|
// documentProjectInfoDTO.zb = "中标";
|
//}
|
//else if (documentProjectInfoDTO.IsWin == 2)
|
//{
|
// documentProjectInfoDTO.zb = "√";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.zb = "×";
|
//}
|
|
//if (documentProjectInfoDTO.IsAdvise == 1)
|
//{
|
// documentProjectInfoDTO.Advise = "方案保存";// "√";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.Advise = "方案保存";
|
//}
|
|
//if (!string.IsNullOrEmpty(documentProjectInfoDTO.FilePathzy))
|
//{
|
// documentProjectInfoDTO.zy = "√";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.zy = "";
|
//}
|
|
//if (!string.IsNullOrEmpty(documentProjectInfoDTO.FilePathts))
|
//{
|
// documentProjectInfoDTO.ts = "√";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.ts = "";
|
//}
|
|
|
//if (!string.IsNullOrEmpty(documentProjectInfoDTO.FilePathfy))
|
//{
|
// documentProjectInfoDTO.fy = "√";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.fy = "";
|
//}
|
|
|
//if (!string.IsNullOrEmpty(documentProjectInfoDTO.FilePathss))
|
//{
|
// documentProjectInfoDTO.ss = "√";
|
//}
|
//else
|
//{
|
// documentProjectInfoDTO.ss = "";
|
//}
|
//if (documentProjectInfoDTO.PurchaseMethod.HasValue && documentProjectInfoDTO.PurchaseMethod.Value > 0)
|
//{
|
// var document_Dictionary = ret.Where(x => x.Id == documentProjectInfoDTO.PurchaseMethod).FirstOrDefault();
|
// if (document_Dictionary != null)
|
// {
|
// documentProjectInfoDTO.PurchaseMethodName = document_Dictionary.Name;
|
// }
|
//}
|
|
}
|
}
|
|
return result;
|
}
|
|
|
|
public PageResult<Document_LayInfo> postDocumentLayInfoList(DocumentProjectInfoPageSearch page)
|
{
|
var aaa = GetJwtInfo();
|
|
SqlSugar.PageModel pg = new SqlSugar.PageModel();
|
pg.PageSize = page.PageSize;
|
pg.PageIndex = page.PageIndex;
|
//page.ToEmployeeId = a.EID;
|
int total = 0;
|
PageResult<Document_LayInfo> result = new PageResult<Document_LayInfo>();
|
|
|
|
result.Items = _db.Queryable<Document_LayInfo>()
|
.Where(a => a.TenantID == aaa.TEID)
|
//文件名称
|
.WhereIF(!string.IsNullOrEmpty(page.LayName), a => a.LayName == page.LayName)
|
.WhereIF(!string.IsNullOrEmpty(page.LayType) && page.LayType != "请选择", a => a.LayType == page.LayType)
|
.WhereIF(!string.IsNullOrEmpty(page.LayProvince), a => a.LayProvince == page.LayProvince)
|
|
.OrderByDescending(a => a.LayId).ToPageList(page.PageIndex, page.PageSize, ref total);
|
|
|
result.TotalCount = total;
|
result.TotalPage = total % page.PageSize == 0 ? total / page.PageSize : total / page.PageSize + 1;
|
|
|
|
return result;
|
}
|
|
public bool GetDelDocumentLayInfo(int ID)
|
{
|
_db.Deleteable<Document_LayInfo>().Where(x => x.LayId == ID).ExecuteCommand();
|
|
|
|
return true;
|
}
|
|
public bool SaveDocumentLayInfo(Document_LayInfo dp)
|
{
|
if (dp.LayId > 0)
|
{
|
_db.Updateable<Document_LayInfo>(dp).ExecuteCommand();
|
}
|
else
|
{
|
_db.Insertable<Document_LayInfo>(dp).ExecuteCommand();
|
}
|
return true;
|
}
|
|
public Document_LayInfo GetDocumentLayInfo(int ID)
|
{
|
var result = _db.Queryable<Document_LayInfo>().Where(x => x.LayId == ID).First();//执行查询
|
return result;
|
}
|
|
public Document_LayInfo GetDocumentLayInfoByName(string LayName)
|
{
|
var aaa = GetJwtInfo();
|
var result = _db.Queryable<Document_LayInfo>().Where(x => x.LayName == LayName && x.TenantID == aaa.EID).First();//执行查询
|
return result;
|
}
|
}
|
}
|