调整优化代码逻辑
parent
3341f9f729
commit
41841a3bc9
|
|
@ -257,6 +257,7 @@ namespace New_College.Api.Controllers.Front
|
||||||
var firstmodels = planmajordesc.Where(e => e.UniversityName == s.UniversityName).FirstOrDefault();
|
var firstmodels = planmajordesc.Where(e => e.UniversityName == s.UniversityName).FirstOrDefault();
|
||||||
planmajordesc.Where(ww => planids.Contains(ww.ID)).ToList().ForEach(a =>
|
planmajordesc.Where(ww => planids.Contains(ww.ID)).ToList().ForEach(a =>
|
||||||
{
|
{
|
||||||
|
string remark = string.IsNullOrWhiteSpace(a.Remark) ? "" : "("+a.Remark + ")";
|
||||||
tableDetailItemsViews.Add(new VolunteerItemsViewMinExcelAttr()
|
tableDetailItemsViews.Add(new VolunteerItemsViewMinExcelAttr()
|
||||||
{
|
{
|
||||||
UniversityName = s.UniversityName,
|
UniversityName = s.UniversityName,
|
||||||
|
|
@ -264,7 +265,7 @@ namespace New_College.Api.Controllers.Front
|
||||||
AreaName = planstatus ? firstmodels.Province != null ? firstmodels.Province + "|" + (planstatus ? firstmodels.City : "") : "" : "",
|
AreaName = planstatus ? firstmodels.Province != null ? firstmodels.Province + "|" + (planstatus ? firstmodels.City : "") : "" : "",
|
||||||
Nature = planstatus ? firstmodels.Nature != null ? firstmodels.Nature : "" : "",
|
Nature = planstatus ? firstmodels.Nature != null ? firstmodels.Nature : "" : "",
|
||||||
fee = string.IsNullOrEmpty(a.Fee) ? "--" : a.Fee,
|
fee = string.IsNullOrEmpty(a.Fee) ? "--" : a.Fee,
|
||||||
Major = a.MajorName,
|
Major = a.MajorName + remark,
|
||||||
MajorCode = a.MajorCode,
|
MajorCode = a.MajorCode,
|
||||||
// MajorGroup = a.MajorGroup,
|
// MajorGroup = a.MajorGroup,
|
||||||
//// MajorRemark = a.Remark,
|
//// MajorRemark = a.Remark,
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,9 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Update="wwwroot\fonts\AlimamaDongFangDaKai-Regular.otf">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Update="wwwroot\fonts\NotoSansCJKsc-Regular.otf">
|
<Content Update="wwwroot\fonts\NotoSansCJKsc-Regular.otf">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -34,34 +34,41 @@ namespace New_College.Tasks
|
||||||
|
|
||||||
private void DoWork(object state)
|
private void DoWork(object state)
|
||||||
{
|
{
|
||||||
HtmlAgHelper agHelper = new HtmlAgHelper();
|
try
|
||||||
var list = agHelper.HtmlCreatePageData();
|
|
||||||
list.ForEach(async c =>
|
|
||||||
{
|
{
|
||||||
var newsinfo = await newsInfoServices.Query(e => e.Title.Trim() == c.title);
|
HtmlAgHelper agHelper = new HtmlAgHelper();
|
||||||
if (!newsinfo.Any() && c.pubtime.Year > DateTime.Now.Year - 1)
|
var list = agHelper.HtmlCreatePageData();
|
||||||
|
list.ForEach(async c =>
|
||||||
{
|
{
|
||||||
|
var newsinfo = await newsInfoServices.Query(e => e.Title.Trim() == c.title);
|
||||||
await newsInfoServices.Add(new Model.Models.D_NewsInfo()
|
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()
|
||||||
});
|
{
|
||||||
ConsoleHelper.WriteWarningLine($"Job spider success: {DateTime.Now}-{list.Count}");
|
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)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ConsoleHelper.WriteWarningLine($"Job spider success: {DateTime.Now}-{list.Count}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ConsoleHelper.WriteWarningLine($"Job spider 抓取异常");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task StopAsync(CancellationToken cancellationToken)
|
public Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace PDFGenerateApi
|
||||||
pdf.SetDefaultPageSize(pageSize);
|
pdf.SetDefaultPageSize(pageSize);
|
||||||
Document document = new Document(pdf);
|
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))
|
//if (!File.Exists(fontsPath))
|
||||||
//{
|
//{
|
||||||
// bool aa = true;
|
// bool aa = true;
|
||||||
|
|
@ -135,11 +135,11 @@ namespace PDFGenerateApi
|
||||||
h++;
|
h++;
|
||||||
if (h == 4)
|
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
|
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 =>
|
dataList.ForEach(a =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue