调整优化代码逻辑
parent
3341f9f729
commit
41841a3bc9
|
|
@ -257,6 +257,7 @@ namespace New_College.Api.Controllers.Front
|
|||
var firstmodels = planmajordesc.Where(e => e.UniversityName == s.UniversityName).FirstOrDefault();
|
||||
planmajordesc.Where(ww => planids.Contains(ww.ID)).ToList().ForEach(a =>
|
||||
{
|
||||
string remark = string.IsNullOrWhiteSpace(a.Remark) ? "" : "("+a.Remark + ")";
|
||||
tableDetailItemsViews.Add(new VolunteerItemsViewMinExcelAttr()
|
||||
{
|
||||
UniversityName = s.UniversityName,
|
||||
|
|
@ -264,7 +265,7 @@ namespace New_College.Api.Controllers.Front
|
|||
AreaName = planstatus ? firstmodels.Province != null ? firstmodels.Province + "|" + (planstatus ? firstmodels.City : "") : "" : "",
|
||||
Nature = planstatus ? firstmodels.Nature != null ? firstmodels.Nature : "" : "",
|
||||
fee = string.IsNullOrEmpty(a.Fee) ? "--" : a.Fee,
|
||||
Major = a.MajorName,
|
||||
Major = a.MajorName + remark,
|
||||
MajorCode = a.MajorCode,
|
||||
// MajorGroup = a.MajorGroup,
|
||||
//// MajorRemark = a.Remark,
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\fonts\AlimamaDongFangDaKai-Regular.otf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="wwwroot\fonts\NotoSansCJKsc-Regular.otf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -34,34 +34,41 @@ namespace New_College.Tasks
|
|||
|
||||
private void DoWork(object state)
|
||||
{
|
||||
HtmlAgHelper agHelper = new HtmlAgHelper();
|
||||
var list = agHelper.HtmlCreatePageData();
|
||||
list.ForEach(async c =>
|
||||
try
|
||||
{
|
||||
var newsinfo = await newsInfoServices.Query(e => e.Title.Trim() == c.title);
|
||||
if (!newsinfo.Any() && c.pubtime.Year > DateTime.Now.Year - 1)
|
||||
HtmlAgHelper agHelper = new HtmlAgHelper();
|
||||
var list = agHelper.HtmlCreatePageData();
|
||||
list.ForEach(async c =>
|
||||
{
|
||||
|
||||
await newsInfoServices.Add(new Model.Models.D_NewsInfo()
|
||||
var newsinfo = await newsInfoServices.Query(e => e.Title.Trim() == c.title);
|
||||
if (!newsinfo.Any() && c.pubtime.Year > DateTime.Now.Year - 1)
|
||||
{
|
||||
Author = c.author,
|
||||
CategoryId = 1,
|
||||
CreateBy = "spdier",
|
||||
ProvinceCode = "370000",
|
||||
CreateId = 1,
|
||||
CreateTime = c.pubtime,
|
||||
|
||||
// Detail = c.detail,
|
||||
CoverImg = "https://static-data.ycymedu.com/static/newstop.png",
|
||||
OrderSort = 0,
|
||||
IsDelete = false,
|
||||
Title = c.title,
|
||||
Summary = HtmlHelper.ReplaceHtmlTag(c.detail).Length > 200 ? HtmlHelper.ReplaceHtmlTag(c.detail).Substring(0, 200) : HtmlHelper.ReplaceHtmlTag(c.detail)
|
||||
});
|
||||
await newsInfoServices.Add(new Model.Models.D_NewsInfo()
|
||||
{
|
||||
Author = c.author,
|
||||
CategoryId = 1,
|
||||
CreateBy = "spdier",
|
||||
ProvinceCode = "370000",
|
||||
CreateId = 1,
|
||||
CreateTime = c.pubtime,
|
||||
|
||||
}
|
||||
});
|
||||
ConsoleHelper.WriteWarningLine($"Job spider success: {DateTime.Now}-{list.Count}");
|
||||
// Detail = c.detail,
|
||||
CoverImg = "https://static-data.ycymedu.com/static/newstop.png",
|
||||
OrderSort = 0,
|
||||
IsDelete = false,
|
||||
Title = c.title,
|
||||
Summary = HtmlHelper.ReplaceHtmlTag(c.detail).Length > 200 ? HtmlHelper.ReplaceHtmlTag(c.detail).Substring(0, 200) : HtmlHelper.ReplaceHtmlTag(c.detail)
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
ConsoleHelper.WriteWarningLine($"Job spider success: {DateTime.Now}-{list.Count}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ConsoleHelper.WriteWarningLine($"Job spider 抓取异常");
|
||||
}
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace PDFGenerateApi
|
|||
pdf.SetDefaultPageSize(pageSize);
|
||||
Document document = new Document(pdf);
|
||||
// 加载中文字体
|
||||
string fontsPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "fonts", "NotoSansCJKsc-Regular.otf");
|
||||
string fontsPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "fonts", "AlimamaDongFangDaKai-Regular.otf");
|
||||
//if (!File.Exists(fontsPath))
|
||||
//{
|
||||
// bool aa = true;
|
||||
|
|
@ -135,11 +135,11 @@ namespace PDFGenerateApi
|
|||
h++;
|
||||
if (h == 4)
|
||||
{
|
||||
table.AddHeaderCell(new Cell().Add(new Paragraph(header).SetWidth(85).SetFont(font).SetBold().SetTextAlignment(TextAlignment.CENTER)));
|
||||
table.AddHeaderCell(new Cell().Add(new Paragraph(header).SetWidth(120).SetFont(font).SetBold().SetTextAlignment(TextAlignment.CENTER)));
|
||||
}
|
||||
else
|
||||
{
|
||||
table.AddHeaderCell(new Cell().Add(new Paragraph(header).SetFont(font).SetBold().SetTextAlignment(TextAlignment.CENTER)));
|
||||
table.AddHeaderCell(new Cell().Add(new Paragraph(header).SetWidth(50).SetFont(font).SetBold().SetTextAlignment(TextAlignment.CENTER)));
|
||||
}
|
||||
}
|
||||
dataList.ForEach(a =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue