1107 lines
50 KiB
C#
1107 lines
50 KiB
C#
using Hg.Core.Domain.Dto.CmsNews;
|
||
using Hg.Core.Domain.Dto.Lecturer;
|
||
using Hg.Core.Domain.Dto.Live;
|
||
using Hg.Core.Domain.Dto.Meeting;
|
||
using Hg.Core.Domain.Dto.News;
|
||
using Hg.Core.Entity.Dncmsbase;
|
||
using MySqlConnector;
|
||
using Newtonsoft.Json;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Linq.Expressions;
|
||
using System.Net;
|
||
using System.Text;
|
||
using System.Text.RegularExpressions;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace Hg.Core.Domain
|
||
{
|
||
internal class LiveDomain : ILiveDomain
|
||
{
|
||
private readonly IBaseRepository<DncmsbaseDbContext> _dncmsbaseRepository;
|
||
private readonly IBaseRepository<ZxdDbContext> _zxdRepository;
|
||
private readonly IRedisManager _redisManager;
|
||
private readonly IConfiguration _configuration;
|
||
private readonly IHttpClient _httpClient;
|
||
private readonly IMapper _mapper;
|
||
private readonly SystemConfig _systemConfig;
|
||
private readonly IInneruserDomain _inneruserDomain;
|
||
private readonly ICacheDomain _cacheDomain;
|
||
private readonly NotificationHub _notificationHub;
|
||
|
||
public LiveDomain(IBaseRepository<DncmsbaseDbContext> dncmsbaseRepository,
|
||
IBaseRepository<ZxdDbContext> repository,
|
||
IRedisManager redisManager,
|
||
IConfiguration configuration,
|
||
IMapper mapper,
|
||
IHttpClient httpClient,
|
||
IInneruserDomain inneruserDomain,
|
||
ICacheDomain cacheDomain,
|
||
NotificationHub notificationHub)
|
||
{
|
||
_dncmsbaseRepository = dncmsbaseRepository;
|
||
_redisManager = redisManager;
|
||
_mapper = mapper;
|
||
_httpClient = httpClient;
|
||
_configuration = configuration;
|
||
_inneruserDomain = inneruserDomain;
|
||
_cacheDomain = cacheDomain;
|
||
_zxdRepository = repository;
|
||
_notificationHub = notificationHub;
|
||
_systemConfig = _configuration.GetSection("SystemConfig").Get<SystemConfig>();
|
||
}
|
||
|
||
public async Task<PageResult<LiveSystemPlanDto>> Page(SearchLiveSystemPlanDto dto)
|
||
{
|
||
var query = _dncmsbaseRepository.GetRepository<ZhiboSystemPlan>().Query().Where(m => m.status == 1)
|
||
.Include(x => x.ComplianceCheckStatus)
|
||
.Select(x => new LiveSystemPlanDto
|
||
{
|
||
Id = x.Id,
|
||
Dept = x.Dept,
|
||
Duration = x.Duration,
|
||
BeforeStatus = x.BeforeStatus,
|
||
DuringStatus = x.DuringStatus,
|
||
AfterStatus = x.AfterStatus,
|
||
Title = x.Title,
|
||
Scene = x.Scene,
|
||
Usetype = x.Usetype,
|
||
Zbtime = x.Zbtime,
|
||
DeptId = x.OperatorDeptid,
|
||
DeptName = x.DeptName,
|
||
Memo = x.ComplianceCheckStatus.FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.直播计划) == null ? "" : x.ComplianceCheckStatus.OrderByDescending(n => n.Id).FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.直播计划).Memo,
|
||
Eid = x.ComplianceCheckStatus.FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.直播计划) == null ? 0 : x.ComplianceCheckStatus.OrderByDescending(n => n.Id).FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.直播计划).OperatorId,
|
||
scenetype = x.Scenetype
|
||
});
|
||
if (!string.IsNullOrWhiteSpace(dto.BeforeStatus))
|
||
{
|
||
var beforeStatusIds = dto.BeforeStatus.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
query = query.Where(n => n.BeforeStatus.HasValue && beforeStatusIds.Contains(n.BeforeStatus.Value));
|
||
}
|
||
if (dto.DuringStatus.HasValue)
|
||
{
|
||
query = query.Where(n => n.DuringStatus == dto.DuringStatus);
|
||
}
|
||
if (dto.AfterStatus.HasValue)
|
||
{
|
||
query = query.Where(n => n.AfterStatus == dto.AfterStatus);
|
||
}
|
||
if (dto.Usetype.HasValue)
|
||
{
|
||
query = query.Where(n => n.Usetype == dto.Usetype);
|
||
}
|
||
if (dto.StartTime.HasValue)
|
||
{
|
||
query = query.Where(n => n.Zbtime >= dto.StartTime.Value);
|
||
}
|
||
if (dto.EndTime.HasValue)
|
||
{
|
||
dto.EndTime = dto.EndTime.Value.AddDays(1);
|
||
query = query.Where(n => n.Zbtime < dto.EndTime);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.DeptId))
|
||
{
|
||
var deptids = dto.DeptId.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
query = query.Where(n => n.DeptId.HasValue && deptids.Contains(n.DeptId.Value));
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Eid))
|
||
{
|
||
var eids = dto.Eid.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
query = query.Where(n => n.Eid.HasValue && eids.Contains(n.Eid.Value));
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Reason))
|
||
{
|
||
var predicates = new List<Expression<Func<LiveSystemPlanDto, bool>>>();
|
||
foreach (var reason in dto.Reason.Split(","))
|
||
{
|
||
predicates.Add(m => m.Memo.Contains(reason));
|
||
}
|
||
query = query.WhereOR(predicates.ToArray());
|
||
}
|
||
var total = await query.CountAsync();
|
||
|
||
var data = await query.OrderByDescending(x => x.Zbtime)
|
||
.Skip((dto.PageIndex - 1) * dto.PageSize)
|
||
.Take(dto.PageSize)
|
||
.ToListAsync();
|
||
var deptments = await _cacheDomain.GetDeptments();
|
||
foreach (var item in data)
|
||
{
|
||
item.Duration = item.Duration == null ? 0 : item.Duration / 60;
|
||
if (string.IsNullOrEmpty(item.Dept)) continue;
|
||
var Deptids = item.Dept.Split(',').Select(x => x.Replace(";", ",")).Select(x => int.Parse(x)).ToList();
|
||
var deptment = deptments.Where(x => Deptids.Contains(x.Id));
|
||
item.Deptments = string.Join(",", deptment.Select(x => x.Title).ToList());
|
||
if (item.scenetype.HasValue)
|
||
{
|
||
item.scenetypeStr = ((ZhiboSystemPlanSceneType)item.scenetype).GetDescription();
|
||
}
|
||
}
|
||
|
||
return new PageResult<LiveSystemPlanDto>(dto.PageIndex, dto.PageSize, total, data);
|
||
}
|
||
|
||
public async Task<LiveSystemPlanDto> Detail(int id, int type)
|
||
{
|
||
var data = await _dncmsbaseRepository.GetRepository<ZhiboSystemPlan>().Query()
|
||
.Where(x => x.Id == id)
|
||
.Select(x => new LiveSystemPlanDto
|
||
{
|
||
Id = x.Id,
|
||
Dept = x.Dept,
|
||
Duration = x.Duration,
|
||
AfterStatus = x.AfterStatus.HasValue ? x.AfterStatus : 60,
|
||
BeforeStatus = x.BeforeStatus,
|
||
DuringStatus = x.DuringStatus.HasValue ? x.DuringStatus : 0,
|
||
Title = x.Title,
|
||
Scene = x.Scene,
|
||
Usetype = x.Usetype,
|
||
Zbtime = x.Zbtime,
|
||
Content = x.Content,
|
||
scenetype = x.Scenetype,
|
||
Files = x.Files,
|
||
Lecturer = x.Lecturer,
|
||
DeptId = x.OperatorDeptid,
|
||
DeptName = x.DeptName,
|
||
sceneid = x.sceneid,
|
||
LiveLink = x.LiveLink
|
||
}).FirstOrDefaultAsync();
|
||
string pattern = @"http://\S+";
|
||
Regex regex = new Regex(pattern);
|
||
|
||
string httpspattern = @"https://\S+";
|
||
Regex httpsregex = new Regex(httpspattern);
|
||
if (!string.IsNullOrWhiteSpace(data.LiveLink))
|
||
{
|
||
MatchCollection matches = regex.Matches(data.LiveLink);
|
||
// 遍历匹配结果,生成a标签
|
||
foreach (Match match in matches)
|
||
{
|
||
string url = match.Value;
|
||
string linkText = url; // 默认链接文本为URL
|
||
|
||
string anchorTag = $"<a style='color:#1e9fff' target='_blank' href=\"{url}\">{linkText}</a>";
|
||
data.LiveLink = data.LiveLink.Replace(url, anchorTag);
|
||
}
|
||
|
||
MatchCollection httpsmatches = httpsregex.Matches(data.LiveLink);
|
||
// 遍历匹配结果,生成a标签
|
||
foreach (Match match in httpsmatches)
|
||
{
|
||
string url = match.Value;
|
||
string linkText = url; // 默认链接文本为URL
|
||
|
||
string anchorTag = $"<a style='color:#1e9fff' target='_blank' href=\"{url}\">{linkText}</a>";
|
||
data.LiveLink = data.LiveLink.Replace(url, anchorTag);
|
||
}
|
||
}
|
||
|
||
if (data == null) throw new ApiException("不存在直播计划");
|
||
var deptments = await _cacheDomain.GetDeptments();
|
||
if (!string.IsNullOrEmpty(data.Dept))
|
||
{
|
||
var Deptids = data.Dept.Split(',').Select(x => x.Replace(";", ",")).Select(x => int.Parse(x)).ToList();
|
||
var deptment = deptments.Where(x => Deptids.Contains(x.Id));
|
||
data.Deptments = string.Join(",", deptment.Select(x => x.Title).ToList());
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(data.Lecturer))
|
||
{
|
||
var teacherIds = data.Lecturer.Split(",").Select(n => Convert.ToInt32(n)).Distinct().ToList();
|
||
var teachers = await _dncmsbaseRepository.GetRepository<Lecturer>().Query().Where(n => teacherIds.Contains(n.Id)).ToListAsync();
|
||
data.Lecturer = String.Join(",", teachers.Select(n => n.Name));
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(data.Content))
|
||
{
|
||
data.Content = DomainDecode(data.Content);
|
||
}
|
||
if (data.scenetype.HasValue)
|
||
{
|
||
data.scenetypeStr = ((ZhiboSystemPlanSceneType)data.scenetype).GetDescription();
|
||
}
|
||
data.sceneidStr = "";
|
||
|
||
if (data.scenetype == 4)
|
||
{
|
||
var scenedto = await _dncmsbaseRepository.GetRepository<KuaiShou>().Query().FirstOrDefaultAsync(n => n.id == data.sceneid);
|
||
if (scenedto != null)
|
||
{
|
||
data.sceneidStr = scenedto.name;
|
||
}
|
||
}
|
||
else if (data.scenetype == 2)
|
||
{
|
||
var scenedto = await _dncmsbaseRepository.GetRepository<WeiXinChannels>().Query().FirstOrDefaultAsync(n => n.id == data.sceneid);
|
||
if (scenedto != null)
|
||
{
|
||
data.sceneidStr = scenedto.name;
|
||
}
|
||
}
|
||
else if (data.scenetype == 3)
|
||
{
|
||
var scenedto = await _dncmsbaseRepository.GetRepository<Tiktok>().Query().FirstOrDefaultAsync(n => n.id == data.sceneid);
|
||
if (scenedto != null)
|
||
{
|
||
data.sceneidStr = scenedto.name;
|
||
}
|
||
}
|
||
else if (data.scenetype == 5)
|
||
{
|
||
data.sceneidStr = data.LiveLink;
|
||
}
|
||
else
|
||
{
|
||
var scenedto = await _dncmsbaseRepository.GetRepository<ZhiboSystemSchedules>().Query().FirstOrDefaultAsync(n => n.Id == data.sceneid);
|
||
if (scenedto != null)
|
||
{
|
||
data.sceneidStr = scenedto.Title;
|
||
}
|
||
data.zhiboLink = $"http://admin.hc.dn8188.com:188/ZhiboSystemDiscussion/show.html?scheduleid={data.sceneid}";
|
||
data.zhiboLink = $"<a style='color:#1e9fff' target='_blank' href=\"{data.zhiboLink}\">{data.zhiboLink}</a>";
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(data.Files))
|
||
{
|
||
var files = data.Files.Split(",");
|
||
List<string> link = new List<string>();
|
||
foreach (var item in files)
|
||
{
|
||
var linkstr = item;
|
||
if (!string.IsNullOrWhiteSpace(linkstr))
|
||
{
|
||
MatchCollection matches = regex.Matches(linkstr);
|
||
// 遍历匹配结果,生成a标签
|
||
foreach (Match match in matches)
|
||
{
|
||
string oldurl = match.Value;
|
||
string url = match.Value;
|
||
string linkText = url; // 默认链接文本为URL
|
||
if (url.Contains(".m3u8") && !url.Contains("activity/00000036.html"))
|
||
{
|
||
url = $"https://app.hc.idongniu.com/activity/00000036.html?zburl={url}";
|
||
}
|
||
string anchorTag = $"<a style='color:#1e9fff' target='_blank' href=\"{url}\">{linkText}</a>";
|
||
linkstr = linkstr.Replace(oldurl, anchorTag);
|
||
}
|
||
|
||
MatchCollection httpsmatches = httpsregex.Matches(linkstr);
|
||
// 遍历匹配结果,生成a标签
|
||
foreach (Match match in httpsmatches)
|
||
{
|
||
string oldurl = match.Value;
|
||
string url = match.Value;
|
||
string linkText = url; // 默认链接文本为URL
|
||
if (url.Contains(".m3u8") && !url.Contains("activity/00000036.html"))
|
||
{
|
||
url = $"https://app.hc.idongniu.com/activity/00000036.html?zburl={url}";
|
||
}
|
||
string anchorTag = $"<a style='color:#1e9fff' target='_blank' href=\"{url}\">{linkText}</a>";
|
||
linkstr = linkstr.Replace(oldurl, anchorTag);
|
||
}
|
||
}
|
||
link.Add(linkstr);
|
||
}
|
||
data.Files = string.Join(",", link);
|
||
}
|
||
data.LiveLogs = await _dncmsbaseRepository.GetRepository<ComplianceCheckStatus>().Query()
|
||
.OrderBy(n => n.Id)
|
||
.Where(x => x.SourceId == data.Id && x.SourceType == (int)ComplianceCheckSourceType.直播计划 && x.CheckType == type)
|
||
.Select(x => new LiveSystemPlanLogDto
|
||
{
|
||
Id = x.Id,
|
||
Ctime = x.Ctime,
|
||
Memo = x.Memo,
|
||
Status = x.Status,
|
||
Operation = GetOperation(type, x.Status),
|
||
Operatorname = x.OperatorName
|
||
}).ToListAsync();
|
||
|
||
return data;
|
||
}
|
||
|
||
public async Task Audit(LivePlanAuditDto dto)
|
||
{
|
||
var transaction = await _dncmsbaseRepository.BeginTransactionAsync();
|
||
//默认直播计划
|
||
if (dto.sourcetype == (int)ComplianceCheckSourceType.直播计划 || !dto.sourcetype.HasValue)
|
||
{
|
||
dto.sourcetype = (int)ComplianceCheckSourceType.直播计划;
|
||
var data = await _dncmsbaseRepository.GetRepository<ZhiboSystemPlan>().Query()
|
||
.Where(x => x.Id == dto.PlanId).FirstOrDefaultAsync();
|
||
|
||
if (data == null) throw new ApiException("找不到直播计划");
|
||
|
||
switch (dto.CheckType)
|
||
{
|
||
case 1:
|
||
data.BeforeStatus = dto.Status;
|
||
data.Utime = DateTime.Now;
|
||
break;
|
||
|
||
case 2:
|
||
data.DuringStatus = dto.Status;
|
||
data.Utime = DateTime.Now;
|
||
break;
|
||
|
||
case 3:
|
||
data.AfterStatus = dto.Status;
|
||
data.Utime = DateTime.Now;
|
||
break;
|
||
|
||
default:
|
||
throw new ApiException("找不到直播计划");
|
||
}
|
||
await _dncmsbaseRepository.GetRepository<ZhiboSystemPlan>().UpdateAsync(data, x => new
|
||
{
|
||
x.AfterStatus,
|
||
x.BeforeStatus,
|
||
x.DuringStatus,
|
||
x.Utime
|
||
});
|
||
}
|
||
else if (dto.sourcetype == (int)ComplianceCheckSourceType.讲师)
|
||
{
|
||
var data = await _dncmsbaseRepository.GetRepository<Lecturer>().Query()
|
||
.Where(x => x.Id == dto.PlanId).FirstOrDefaultAsync();
|
||
if (data == null) throw new ApiException("找不到讲师");
|
||
data.checkstatus = dto.Status;
|
||
await _dncmsbaseRepository.GetRepository<Lecturer>().UpdateAsync(data, x => new
|
||
{
|
||
x.checkstatus
|
||
});
|
||
dto.CheckType = (int)ComplianceCheckType.事前;
|
||
}
|
||
else if (dto.sourcetype == (int)ComplianceCheckSourceType.资讯)
|
||
{
|
||
var data = await _dncmsbaseRepository.GetRepository<News>().Query()
|
||
.Where(x => x.id == dto.PlanId).FirstOrDefaultAsync();
|
||
if (data == null) throw new ApiException("找不到资讯");
|
||
data.checkstatus = dto.Status;
|
||
await _dncmsbaseRepository.GetRepository<News>().UpdateAsync(data, x => new
|
||
{
|
||
x.checkstatus
|
||
});
|
||
dto.CheckType = (int)ComplianceCheckType.事前;
|
||
}
|
||
var log = new ComplianceCheckStatus
|
||
{
|
||
Ctime = DateTime.Now,
|
||
CheckType = dto.CheckType,
|
||
Memo = dto.Memo,
|
||
Status = dto.Status,
|
||
OperatorId = dto.OperatorId,
|
||
OperatorName = dto.OperatorName,
|
||
SourceId = dto.PlanId,
|
||
SourceType = dto.sourcetype
|
||
};
|
||
|
||
try
|
||
{
|
||
await _dncmsbaseRepository.GetRepository<ComplianceCheckStatus>().InsertAsync(log);
|
||
await transaction.CommitAsync();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.Error(ex, "直播计划审核出错!");
|
||
await transaction.RollbackAsync();
|
||
await transaction.DisposeAsync();
|
||
}
|
||
}
|
||
|
||
private static string GetOperation(int checkType, int? status)
|
||
{
|
||
return checkType switch
|
||
{
|
||
1 => ((ComplianceCheckBeforeStatus)status).GetDescription(),
|
||
2 => ((ComplianceCheckDuringStatus)status).GetDescription(),
|
||
3 => ((ComplianceCheckAfterStatus)status).GetDescription(),
|
||
_ => "",
|
||
};
|
||
}
|
||
|
||
#region 讲师报备
|
||
|
||
public async Task<PageResult<LecturerListModel>> LecturerPage(LecturerSearchDto dto)
|
||
{
|
||
List<int> containStatus = new List<int> { 0, 1 };
|
||
var query = _dncmsbaseRepository.GetRepository<Lecturer>().Query()
|
||
.Include(x => x.ComplianceCheckStatus)
|
||
.Select(x => new LecturerListModel
|
||
{
|
||
id = x.Id,
|
||
status = x.Status,
|
||
name = x.Name,
|
||
title = x.Title,
|
||
img = $"{_systemConfig.cmsHost.Trim('/')}/{x.Img}",
|
||
issac = x.issac,
|
||
checkstatus = x.checkstatus,
|
||
Eid = x.ComplianceCheckStatus.FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.讲师) == null ? 0 : x.ComplianceCheckStatus.OrderByDescending(n => n.Id).FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.讲师).OperatorId,
|
||
Ename = x.ComplianceCheckStatus.FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.讲师) == null ? "" : x.ComplianceCheckStatus.OrderByDescending(n => n.Id).FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.讲师).OperatorName,
|
||
DeptId = x.OperatorDeptid,
|
||
DeptName = x.DeptName,
|
||
Memo = x.ComplianceCheckStatus.FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.讲师) == null ? "" : x.ComplianceCheckStatus.OrderByDescending(n => n.Id).FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.讲师).Memo
|
||
});
|
||
query = query.Where(n => n.status.HasValue && containStatus.Contains(n.status.Value));
|
||
if (dto.Status.HasValue)
|
||
{
|
||
query = query.Where(n => n.status == dto.Status);
|
||
}
|
||
if (dto.Checkstatus.HasValue)
|
||
{
|
||
query = query.Where(n => n.checkstatus == dto.Checkstatus);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Name))
|
||
{
|
||
query = query.Where(n => n.name == dto.Name);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.DeptId))
|
||
{
|
||
var deptids = dto.DeptId.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
query = query.Where(n => n.DeptId.HasValue && deptids.Contains(n.DeptId.Value));
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Eid))
|
||
{
|
||
var eids = dto.Eid.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
query = query.Where(n => n.Eid.HasValue && eids.Contains(n.Eid.Value));
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Reason))
|
||
{
|
||
var predicates = new List<Expression<Func<LecturerListModel, bool>>>();
|
||
foreach (var reason in dto.Reason.Split(","))
|
||
{
|
||
predicates.Add(m => m.Memo.Contains(reason));
|
||
}
|
||
query = query.WhereOR(predicates.ToArray());
|
||
}
|
||
var total = await query.CountAsync();
|
||
|
||
var data = await query.OrderByDescending(x => x.id)
|
||
.Skip((dto.PageIndex - 1) * dto.PageSize)
|
||
.Take(dto.PageSize)
|
||
.ToListAsync();
|
||
|
||
return new PageResult<LecturerListModel>(dto.PageIndex, dto.PageSize, total, data);
|
||
}
|
||
|
||
public async Task<LecturerAuditDetailModel> LecturerDetail(int? id)
|
||
{
|
||
LecturerAuditDetailModel data = new LecturerAuditDetailModel();
|
||
var sql = $" select a.*,b.certifNo,b.pracCtegName,b.isdelete,b.employeeid from Lecturer as a left join db_company_base_conf.Sac_registration_publicity as b on a.sacid=b.id where a.id=@id";
|
||
var param = new List<MySqlParameter>()
|
||
{
|
||
new MySqlParameter() { ParameterName="id", MySqlDbType = MySqlDbType.Int32, Value=id }
|
||
};
|
||
data = await _dncmsbaseRepository.ExecuteSqlToEntityAsync<LecturerAuditDetailModel>(sql, param.ToArray());
|
||
if (!string.IsNullOrWhiteSpace(data.img))
|
||
{
|
||
data.img = $"{_systemConfig.cmsHost.Trim('/')}/{data.img}";
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(data.portrait))
|
||
{
|
||
data.portrait = $"{_systemConfig.cmsHost.Trim('/')}/{data.portrait}";
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(data.qrcode))
|
||
{
|
||
data.qrcode = $"{_systemConfig.cmsHost.Trim('/')}/{data.qrcode}";
|
||
}
|
||
var deptments = await _cacheDomain.GetDeptments();
|
||
if (!string.IsNullOrEmpty(data.dept))
|
||
{
|
||
var Deptids = data.dept.Split(',').Select(x => x.Replace(";", ",")).Select(x => int.Parse(x)).ToList();
|
||
var deptment = deptments.Where(x => Deptids.Contains(x.Id));
|
||
data.deptments = string.Join(",", deptment.Select(x => x.Title).ToList());
|
||
}
|
||
if (data.authorid>0)
|
||
{
|
||
var auth = GetRisktips(data.authorid);
|
||
if (auth != null)
|
||
data.risktips = auth.risktips;
|
||
else
|
||
data.risktips = String.Empty;
|
||
}
|
||
data.Logs = await _dncmsbaseRepository.GetRepository<ComplianceCheckStatus>().Query()
|
||
.OrderBy(n => n.Id)
|
||
.Where(x => x.SourceId == data.id && x.SourceType == (int)ComplianceCheckSourceType.讲师 && x.CheckType == (int)ComplianceCheckType.事前)
|
||
.Select(x => new LiveSystemPlanLogDto
|
||
{
|
||
Id = x.Id,
|
||
Ctime = x.Ctime,
|
||
Memo = x.Memo,
|
||
Status = x.Status,
|
||
Operation = GetOperation((int)ComplianceCheckType.事前, x.Status),
|
||
Operatorname = x.OperatorName
|
||
}).ToListAsync();
|
||
return data;
|
||
}
|
||
|
||
#endregion 讲师报备
|
||
|
||
#region 资讯报备
|
||
|
||
public async Task<PageResult<NewsListModel>> NewsPage(NewsSearchDto dto)
|
||
{
|
||
var query = from n in _dncmsbaseRepository.GetRepository<News>().Query()
|
||
.Include(x => x.ComplianceCheckStatus)
|
||
join b in _dncmsbaseRepository.GetRepository<NewsClass>().Query()
|
||
on n.classid equals b.id into temp
|
||
from pb in temp.DefaultIfEmpty()
|
||
select new NewsListModel
|
||
{
|
||
Id = n.id,
|
||
status = n.status,
|
||
checkStatus = n.checkstatus,
|
||
title = n.title,
|
||
classtitle = pb.title,
|
||
newstype = n.newstype,
|
||
others = n.others,
|
||
shortessay = n.shortessay,
|
||
ctime = n.ctime,
|
||
DeptId = n.operatordeptid,
|
||
usememo = pb.usememo,
|
||
classid = n.classid,
|
||
DeptName = n.deptname,
|
||
Memo = n.ComplianceCheckStatus.FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.资讯) == null ? "" : n.ComplianceCheckStatus.OrderByDescending(n => n.Id).FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.资讯).Memo,
|
||
Eid = n.ComplianceCheckStatus.FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.资讯) == null ? 0 : n.ComplianceCheckStatus.OrderByDescending(n => n.Id).FirstOrDefault(n => n.SourceType == (int)ComplianceCheckSourceType.资讯).OperatorId
|
||
};
|
||
List<int> containStatus = new List<int> { 0, 1 };
|
||
query = query.Where(n => n.status.HasValue && containStatus.Contains(n.status.Value));
|
||
if (dto.StartTime.HasValue)
|
||
{
|
||
query = query.Where(n => n.ctime >= dto.StartTime.Value);
|
||
}
|
||
if (dto.EndTime.HasValue)
|
||
{
|
||
dto.EndTime = dto.EndTime.Value.AddDays(1);
|
||
query = query.Where(n => n.ctime < dto.EndTime);
|
||
}
|
||
if (dto.Status.HasValue)
|
||
{
|
||
query = query.Where(n => n.status == dto.Status);
|
||
}
|
||
if (dto.CheckStatus.HasValue)
|
||
{
|
||
query = query.Where(n => n.checkStatus == dto.CheckStatus);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Key))
|
||
{
|
||
var id = 0;
|
||
int.TryParse(dto.Key, out id);
|
||
query = query.Where(n => n.title.Contains(dto.Key) || n.Id == id);
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.DeptId))
|
||
{
|
||
var deptids = dto.DeptId.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
query = query.Where(n => n.DeptId.HasValue && deptids.Contains(n.DeptId.Value));
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Eid))
|
||
{
|
||
var eids = dto.Eid.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
query = query.Where(n => n.Eid.HasValue && eids.Contains(n.Eid.Value));
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(dto.Reason))
|
||
{
|
||
var predicates = new List<Expression<Func<NewsListModel, bool>>>();
|
||
foreach (var reason in dto.Reason.Split(","))
|
||
{
|
||
predicates.Add(m => m.Memo.Contains(reason));
|
||
}
|
||
query = query.WhereOR(predicates.ToArray());
|
||
}
|
||
var total = await query.CountAsync();
|
||
var data = await query.OrderByDescending(x => x.Id)
|
||
.Skip((dto.PageIndex - 1) * dto.PageSize)
|
||
.Take(dto.PageSize)
|
||
.ToListAsync();
|
||
var deptments = await _cacheDomain.GetDeptments();
|
||
foreach (var item in data)
|
||
{
|
||
if (item.newstype == 15 && !string.IsNullOrWhiteSpace(item.others))
|
||
{
|
||
var stockList = JsonHelper.FromJson<OthersModel>(item.others);
|
||
var stockStr = "";
|
||
foreach (var st in stockList.list)
|
||
{
|
||
stockStr += $"<span class='stockitem'>{st.name}({st.data})</span>";
|
||
}
|
||
item.others = stockStr;
|
||
}
|
||
if (item.newstype == 12 && !string.IsNullOrWhiteSpace(item.others))
|
||
{
|
||
var dpModel = JsonHelper.FromJson<DpModel>(item.others);
|
||
item.others = $"{dpModel.dp.stock}({dpModel.dp.code})";
|
||
}
|
||
}
|
||
return new PageResult<NewsListModel>(dto.PageIndex, dto.PageSize, total, data);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取风向提示
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
public AuthorsExDto GetRisktips(int id)
|
||
{
|
||
AuthorsExDto model = null;
|
||
if (id > 0)
|
||
{
|
||
|
||
|
||
var retmodel = (from n in _dncmsbaseRepository.GetRepository<Authors>().Query()
|
||
join b in _dncmsbaseRepository.GetRepository<Risktips>().Query()
|
||
on n.risktipsid equals b.id into temp
|
||
from pb in temp.DefaultIfEmpty()
|
||
where n.id == id
|
||
select new AuthorsExDto()
|
||
{
|
||
id = n.id,
|
||
img = n.img,
|
||
members = n.members,
|
||
name = n.name,
|
||
risktipscontent = pb.content,
|
||
risktipsid = n.risktipsid,
|
||
status = n.status,
|
||
title = n.title,
|
||
type = n.type
|
||
}).FirstOrDefault();
|
||
if (retmodel != null)
|
||
{
|
||
var risktips = "";
|
||
|
||
if (retmodel.type == 2)
|
||
{
|
||
if (!string.IsNullOrEmpty(retmodel.members))
|
||
{
|
||
var ids = retmodel.members.Split(',').Where(m => !string.IsNullOrEmpty(m)).Select(m => Convert.ToInt32(m));
|
||
|
||
var list = _dncmsbaseRepository.GetRepository<Lecturer>().Query().Where(m => m.Status == 1 && ids.Contains(m.Id)).ToList();
|
||
for (var i = 0; i < list.Count; i++)
|
||
{
|
||
risktips += list[i].Name + ",投顾编号:" + list[i].Code + ";";
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
var _one = _dncmsbaseRepository.GetRepository<Lecturer>().Query().Where(m => m.Id == id).FirstOrDefault();
|
||
if (_one != null)
|
||
risktips += _one.Name + ",投顾编号:" + _one.Code + ";";
|
||
|
||
}
|
||
model = new AuthorsExDto();
|
||
model.id = retmodel.id;
|
||
model.title = retmodel.title;
|
||
model.img = retmodel.img;
|
||
model.risktips = string.Concat(retmodel.risktipscontent, risktips);// 风险提示
|
||
}
|
||
return model;
|
||
}
|
||
return model;
|
||
}
|
||
public async Task<NewsDetailModel> NewsDetail(int? id)
|
||
{
|
||
var newsList = from n in _dncmsbaseRepository.GetRepository<News>().Query()
|
||
join b in _dncmsbaseRepository.GetRepository<NewsClass>().Query()
|
||
on n.classid equals b.id into temp
|
||
from pb in temp.DefaultIfEmpty()
|
||
where n.id == id
|
||
select new NewsDetailModel
|
||
{
|
||
id = n.id,
|
||
classtitle = pb.title,
|
||
status = n.status,
|
||
newstype = n.newstype,
|
||
stocks = n.stocks,
|
||
title = n.title,
|
||
subtitle = n.subtitle,
|
||
intro = n.intro,
|
||
thumb = n.thumb,
|
||
url = n.url,
|
||
shortessay = n.shortessay,
|
||
files = n.files,
|
||
urltxt = n.urltxt,
|
||
authorid = n.authorid,
|
||
newssubtype = n.newssubtype,
|
||
ctime = n.ctime,
|
||
others = n.others,
|
||
checkstatus = n.checkstatus,
|
||
deptId = n.operatordeptid,
|
||
usememo = pb.usememo,
|
||
DeptName = n.deptname,
|
||
risktips = pb.risktips
|
||
};
|
||
var news = await newsList.FirstOrDefaultAsync();
|
||
if (news == null)
|
||
{
|
||
throw new Exception("找不到对应的资讯");
|
||
}
|
||
if (news.authorid.HasValue)
|
||
{
|
||
var auth = GetRisktips(news.authorid.Value);
|
||
if (auth != null)
|
||
news.risktips = auth.risktips;
|
||
else
|
||
news.risktips = String.Empty;
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(news.thumb))
|
||
{
|
||
news.thumb = news.thumb.Replace("/UploadFile", $"{_systemConfig.cmsHost.Trim('/')}/UploadFile");
|
||
}
|
||
if (news.newstype == 1)
|
||
{
|
||
var cmodel = await _dncmsbaseRepository.GetRepository<NewsContent>().FirstOrDefaultAsync(n => n.id == id);
|
||
if (cmodel != null)
|
||
{
|
||
news.content = DomainDecode(cmodel.content);
|
||
}
|
||
}
|
||
if (!string.IsNullOrWhiteSpace(news.files))
|
||
{
|
||
news.files = news.files.Replace("/UploadFile", $"{_systemConfig.cmsHost.Trim('/')}/UploadFile");
|
||
}
|
||
var authors = await _dncmsbaseRepository.GetRepository<Authors>().FirstOrDefaultAsync(n => n.id == news.authorid);
|
||
if (authors != null)
|
||
{
|
||
news.authors = authors.name;
|
||
List<int> authorids = new List<int>() { news.authorid.Value };
|
||
if (authors.type == 2)
|
||
{
|
||
if (!string.IsNullOrWhiteSpace(authors.members))
|
||
{
|
||
authorids = authors.members.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
}
|
||
//团队的时候需要把状态为1的过滤一下,离职的不能显示
|
||
var lecturerlist = await _dncmsbaseRepository.GetRepository<Lecturer>().Query().Where(n => authorids.Contains(n.Id)).Where(m => m.Status == 1)
|
||
.Select(n => new NewsLecturerModel { code = n.Code, name = n.Name })
|
||
.ToListAsync();
|
||
news.LecturerModel = lecturerlist;
|
||
}
|
||
else
|
||
{
|
||
var lecturerlist = await _dncmsbaseRepository.GetRepository<Lecturer>().Query().Where(n => authorids.Contains(n.Id))
|
||
.Select(n => new NewsLecturerModel { code = n.Code, name = n.Name })
|
||
.ToListAsync();
|
||
news.LecturerModel = lecturerlist;
|
||
}
|
||
}
|
||
if (news.newssubtype > 0)
|
||
{
|
||
var subtype = await _dncmsbaseRepository.GetRepository<NewsSubType>().FirstOrDefaultAsync(n => n.id == news.newssubtype);
|
||
if (subtype != null)
|
||
{
|
||
news.newssubtypename = subtype.name;
|
||
}
|
||
}
|
||
news.Logs = await _dncmsbaseRepository.GetRepository<ComplianceCheckStatus>().Query()
|
||
.OrderBy(n => n.Id)
|
||
.Where(x => x.SourceId == news.id && x.SourceType == (int)ComplianceCheckSourceType.资讯 && x.CheckType == (int)ComplianceCheckType.事前)
|
||
.Select(x => new LiveSystemPlanLogDto
|
||
{
|
||
Id = x.Id,
|
||
Ctime = x.Ctime,
|
||
Memo = x.Memo,
|
||
Status = x.Status,
|
||
Operation = GetOperation((int)ComplianceCheckType.事前, x.Status),
|
||
Operatorname = x.OperatorName
|
||
}).ToListAsync();
|
||
return news;
|
||
}
|
||
|
||
public async Task<List<NewsLinkModel>> NewsLink(int? id)
|
||
{
|
||
List<NewsLinkModel> res = new List<NewsLinkModel>();
|
||
var newsClass = await _dncmsbaseRepository.GetRepository<NewsClass>().FirstOrDefaultAsync(n => n.id == id);
|
||
if (newsClass != null && !string.IsNullOrWhiteSpace(newsClass.dept))
|
||
{
|
||
var deptids = newsClass.dept.Split(",").Select(n => Convert.ToInt32(n)).ToList();
|
||
var deptList = await _cacheDomain.GetDeptments();
|
||
var link = _systemConfig.app_cms_url;
|
||
Log.Information($"deptids{deptids}");
|
||
foreach (var did in deptids)
|
||
{
|
||
NewsLinkModel model = new NewsLinkModel
|
||
{
|
||
DeptId = did,
|
||
};
|
||
if (did == 1)
|
||
{
|
||
model.Ch = 0;
|
||
model.DeptName = "总部管理";
|
||
}
|
||
model.Link = $"{link}/class.html?id={id}";
|
||
var dept = deptList.FirstOrDefault(n => n.Id == did);
|
||
if (dept != null)
|
||
{
|
||
model.DeptName = dept.Title;
|
||
if (dept.DeptmentCampains != null)
|
||
{
|
||
model.Ch = dept.DeptmentCampains.FirstOrDefault()?.StartCampainId;
|
||
}
|
||
|
||
if (model.Ch.HasValue && model.Ch > 0)
|
||
{
|
||
model.Link = $"{link}/class.html?id={id}&channel={model.Ch}";
|
||
}
|
||
}
|
||
res.Add(model);
|
||
}
|
||
}
|
||
Log.Information($"res:{res.Count}");
|
||
|
||
return res;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 替换域名解码
|
||
/// </summary>
|
||
/// <param name="text"></param>
|
||
/// <returns></returns>
|
||
public string DomainDecode(string text)
|
||
{
|
||
string _UploadFilePath = "/UploadFile";
|
||
string _cmsUrlEncodeKey = "domainkey.com";
|
||
string _softUrlEncodeKey = "soft.domain.com";
|
||
if (string.IsNullOrEmpty(text)) return text;
|
||
text = text.Replace(_cmsUrlEncodeKey, _systemConfig.cmsUrl);
|
||
text = text.Replace(_softUrlEncodeKey, _systemConfig.softUrl);
|
||
text = text.Replace(_UploadFilePath, _systemConfig.imgUrl);
|
||
return text;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 校验股票池是否通过
|
||
/// </summary>
|
||
/// <param name="stockInfo"></param>
|
||
/// <returns></returns>
|
||
public async Task<bool> JustStockInfo(JustStockMode model)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(model.Stocks))
|
||
{
|
||
return true;
|
||
}
|
||
var stockList = JsonConvert.DeserializeObject<List<StockModelInfo>>(model.Stocks);
|
||
var stockUrl = $"{_systemConfig.StockUrl.Trim('/')}/stockpool/api/stock/pool/page";
|
||
var authorization = _systemConfig.StockPoolAuthorization;
|
||
var errMsg = new List<string>();
|
||
foreach (var item in stockList)
|
||
{
|
||
if (string.IsNullOrWhiteSpace(item.c))
|
||
{
|
||
continue;
|
||
}
|
||
var dto = new StockPoolDto
|
||
{
|
||
CheckStatus = 99,
|
||
PageNum = 1,
|
||
PageSize = 100,
|
||
StockCode = item.c,
|
||
Status = 0
|
||
};
|
||
var json = JsonConvert.SerializeObject(dto, Formatting.Indented, new JsonSerializerSettings
|
||
{
|
||
NullValueHandling = NullValueHandling.Ignore,
|
||
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
|
||
});
|
||
var response = PostAjaxData($"{stockUrl}", json, authorization, true);
|
||
var data = JsonConvert.DeserializeObject<StockPoolResult<StockPoolResultRow>>(response);
|
||
if (data.Total <= 0)
|
||
{
|
||
errMsg.Add(item.n);
|
||
}
|
||
}
|
||
if (errMsg.Count > 0)
|
||
{
|
||
//如果不存在审核通过的股票池 则自动驳回
|
||
LivePlanAuditDto auditModel = new LivePlanAuditDto
|
||
{
|
||
OperatorId = 1000,
|
||
OperatorName = "系统管理员",
|
||
sourcetype = (int)ComplianceCheckSourceType.资讯,
|
||
Status = (int)ComplianceCheckBeforeStatus.驳回,
|
||
Memo = $"{string.Join(",", errMsg)}未在股票池报备",
|
||
PlanId = model.Id
|
||
};
|
||
await Audit(auditModel);
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
public string PostAjaxData(string url, string param, string Authorization, bool jsonContentType)
|
||
{
|
||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||
request.Method = "POST";
|
||
if (jsonContentType)
|
||
{
|
||
request.ContentType = "application/json;charet=utf-8";
|
||
}
|
||
//request.Headers.Add("dataType", "json");
|
||
//request.Headers.Add("type", "post");
|
||
if (!string.IsNullOrEmpty(Authorization))
|
||
{
|
||
request.Headers.Add("Authorization", Authorization);
|
||
}
|
||
byte[] data = Encoding.UTF8.GetBytes(param);
|
||
|
||
using (BinaryWriter reqStream = new BinaryWriter(request.GetRequestStream()))
|
||
{
|
||
reqStream.Write(data, 0, data.Length);
|
||
}
|
||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
||
{
|
||
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
|
||
string result = reader.ReadToEnd();
|
||
return result;
|
||
}
|
||
}
|
||
|
||
public async Task<List<OperatorModel>> GetOperator()
|
||
{
|
||
var res = await _dncmsbaseRepository.GetRepository<ComplianceCheckStatus>().Query().Where(n => n.OperatorId.HasValue && !string.IsNullOrWhiteSpace(n.OperatorName))
|
||
.GroupBy(n => new { eid = n.OperatorId, ename = n.OperatorName }).Select(m => new OperatorModel { Eid = m.Key.eid, Ename = m.Key.ename })
|
||
.ToListAsync();
|
||
return res;
|
||
}
|
||
|
||
#endregion 资讯报备
|
||
|
||
public async Task<List<AuditNoticeDto>> SendAuditNotice()
|
||
{
|
||
bool send = false;
|
||
List<AuditNoticeDto> res = new List<AuditNoticeDto>();
|
||
try
|
||
{
|
||
var stockUrl = $"{_systemConfig.StockUrl.Trim('/')}/stockpool/api/stock/pool/page";
|
||
var authorization = _systemConfig.StockPoolAuthorization;
|
||
var dto = new StockPoolDto
|
||
{
|
||
CheckStatus = 20, //合规审核
|
||
PageNum = 1,
|
||
PageSize = int.MaxValue
|
||
};
|
||
var json = JsonConvert.SerializeObject(dto, Formatting.Indented, new JsonSerializerSettings
|
||
{
|
||
NullValueHandling = NullValueHandling.Ignore,
|
||
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
|
||
});
|
||
var response = PostAjaxData($"{stockUrl}", json, authorization, true);
|
||
var data = JsonConvert.DeserializeObject<StockPoolResult<StockPoolResultRow>>(response);
|
||
AuditNoticeDto smodel = new AuditNoticeDto
|
||
{
|
||
Title = "股票池",
|
||
Count = 0,
|
||
};
|
||
if (data.Total > 0)
|
||
{
|
||
send = true;
|
||
smodel.Count = data.Total;
|
||
}
|
||
res.Add(smodel);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.Error($"查询股票池出错{ex.Message}");
|
||
}
|
||
try
|
||
{
|
||
AuditNoticeDto cmodel = new AuditNoticeDto
|
||
{
|
||
Title = "策略池",
|
||
Count = 0,
|
||
};
|
||
var stockUrl = $"{_systemConfig.StockUrl.Trim('/')}/stockpool/api/stock/report/page";
|
||
var authorization = _systemConfig.StockPoolAuthorization;
|
||
var dto = new
|
||
{
|
||
Checked = 20, //合规审核
|
||
PageNum = 1,
|
||
PageSize = int.MaxValue
|
||
};
|
||
var json = JsonConvert.SerializeObject(dto, Formatting.Indented, new JsonSerializerSettings
|
||
{
|
||
NullValueHandling = NullValueHandling.Ignore,
|
||
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
|
||
});
|
||
var response = PostAjaxData($"{stockUrl}", json, authorization, true);
|
||
var data = JsonConvert.DeserializeObject<StockPoolResult<StockPoolResultRow>>(response);
|
||
if (data.Total > 0)
|
||
{
|
||
send = true;
|
||
cmodel.Count = data.Total;
|
||
}
|
||
res.Add(cmodel);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
Log.Error($"策略池{ex.Message}");
|
||
}
|
||
var passtime = DateTime.Now.Date.AddDays(-7);
|
||
AuditNoticeDto lmodel = new AuditNoticeDto
|
||
{
|
||
Title = "讲师",
|
||
Count = 0,
|
||
};
|
||
List<int> containStatus = new List<int> { 0, 1 };
|
||
var lecturerCount = _dncmsbaseRepository.GetRepository<Lecturer>().Query().Where(n => n.Status.HasValue && containStatus.Contains(n.Status.Value) && n.checkstatus == (int)ComplianceCheckBeforeStatus.提审).Count();
|
||
if (lecturerCount > 0)
|
||
{
|
||
send = true;
|
||
lmodel.Count = lecturerCount;
|
||
}
|
||
res.Add(lmodel);
|
||
|
||
AuditNoticeDto livemodel = new AuditNoticeDto
|
||
{
|
||
Title = "视频直播",
|
||
Count = 0,
|
||
};
|
||
var liveCount = _dncmsbaseRepository.GetRepository<ZhiboSystemPlan>().Query().Where(n => n.BeforeStatus == (int)ComplianceCheckBeforeStatus.提审).Count();
|
||
if (liveCount > 0)
|
||
{
|
||
send = true;
|
||
livemodel.Count = liveCount;
|
||
}
|
||
res.Add(livemodel);
|
||
AuditNoticeDto zmodel = new AuditNoticeDto
|
||
{
|
||
Title = "资讯",
|
||
Count = 0,
|
||
};
|
||
var zxCount = _dncmsbaseRepository.GetRepository<News>().Query().Where(n => n.checkstatus == (int)ComplianceCheckBeforeStatus.提审).Count();
|
||
if (zxCount > 0)
|
||
{
|
||
send = true;
|
||
zmodel.Count = zxCount;
|
||
}
|
||
res.Add(zmodel);
|
||
|
||
AuditNoticeDto nmodel = new AuditNoticeDto
|
||
{
|
||
Title = "文案审核",
|
||
Count = 0,
|
||
};
|
||
var cmsNewCount = _zxdRepository.GetRepository<CmsNews>().Query().Where(n => n.CTime >= passtime && n.Status == CmsNewStatus.未审核).Count();
|
||
if (cmsNewCount > 0)
|
||
{
|
||
send = true;
|
||
nmodel.Count = cmsNewCount;
|
||
}
|
||
res.Add(nmodel);
|
||
//获取角色
|
||
if (send)
|
||
{
|
||
var sendeidlist = (from a in _zxdRepository.GetRepository<BAS_INNERUSER>().Query()
|
||
join b in _zxdRepository.GetRepository<BAS_INNERUSERROLE>().Query() on a.PKID equals b.INNERUSERID
|
||
join c in _zxdRepository.GetRepository<BAS_ROLE>().Query() on b.ROLEID equals c.ROLEID
|
||
where c.CODE == "HGBB"
|
||
where a.ISDISMISS == 0
|
||
where a.ISHIDE == 0
|
||
select a.EID
|
||
).ToList();
|
||
//发送信息
|
||
foreach (var item in sendeidlist.Distinct().ToList())
|
||
{
|
||
await _notificationHub.SendHgReport(item, res.ToJson());
|
||
}
|
||
}
|
||
return res;
|
||
}
|
||
}
|
||
} |