|
|
@ -17,7 +17,6 @@ namespace djy.Service.Report
|
|
|
|
public class ReportService : ServBase, IReportService
|
|
|
|
public class ReportService : ServBase, IReportService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#region 获取模板
|
|
|
|
#region 获取模板
|
|
|
|
|
|
|
|
|
|
|
|
public List<DS_ReportTemplate> GetTemplate()
|
|
|
|
public List<DS_ReportTemplate> GetTemplate()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
@ -137,7 +136,6 @@ namespace djy.Service.Report
|
|
|
|
if (isbook) {
|
|
|
|
if (isbook) {
|
|
|
|
if (Gid.IsNull())
|
|
|
|
if (Gid.IsNull())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
DS_Report report = new DS_Report();
|
|
|
|
DS_Report report = new DS_Report();
|
|
|
|
report.GID = Guid.NewGuid().ToString("N");
|
|
|
|
report.GID = Guid.NewGuid().ToString("N");
|
|
|
|
report.UserID = user.GID;
|
|
|
|
report.UserID = user.GID;
|
|
|
@ -202,5 +200,74 @@ namespace djy.Service.Report
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 定时任务
|
|
|
|
|
|
|
|
public void TemplateTask() {
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{ ///获取所有订阅过的用户
|
|
|
|
|
|
|
|
var datetime = DateTime.Now.AddDays(-1);
|
|
|
|
|
|
|
|
var list = DbBus.Get(DbList.DSDB).Select<DS_Report>().Where(x => x.IsBook == true && x.EndTime < datetime).ToList();
|
|
|
|
|
|
|
|
var templist = DbBus.Get(DbList.DSDB).Select<DS_ReportTemplate>().ToList();
|
|
|
|
|
|
|
|
var fin = new FinanceService();
|
|
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SENDUSERID = item.UserID,
|
|
|
|
|
|
|
|
LURURENID = item.UserID,
|
|
|
|
|
|
|
|
CtnrCount = 1,
|
|
|
|
|
|
|
|
CtnrInfo = string.Empty,
|
|
|
|
|
|
|
|
BSTYPE = 17,
|
|
|
|
|
|
|
|
SENDTYPE = templist.Where(x => x.GID == item.TemplateID).Select(x => x.SendType).FirstOrDefault(), ////templist.SendType,
|
|
|
|
|
|
|
|
BSNO = item.GID,
|
|
|
|
|
|
|
|
}, 0);
|
|
|
|
|
|
|
|
if (!getfinrs.Status)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
///扣费失败 ,更改状态
|
|
|
|
|
|
|
|
var date = DateTime.Now;
|
|
|
|
|
|
|
|
if (item.EndTime<date) {
|
|
|
|
|
|
|
|
DbBus.Get(DbList.DSDB).Update<DS_Report>().Set(w => new DS_Report
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IsBook = false,
|
|
|
|
|
|
|
|
}).Where(w => w.GID == item.GID).ExecuteAffrows();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
////余额充足 ,执行扣费,
|
|
|
|
|
|
|
|
fin.Expend(new CustFee
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SENDUSERID = item.UserID,
|
|
|
|
|
|
|
|
LURURENID = item.UserID,
|
|
|
|
|
|
|
|
CtnrCount = 1,
|
|
|
|
|
|
|
|
CtnrInfo = string.Empty,
|
|
|
|
|
|
|
|
BSTYPE = 17,
|
|
|
|
|
|
|
|
SENDTYPE = templist.Where(x => x.GID == item.TemplateID).Select(x => x.SendType).FirstOrDefault(), ////templist.SendType,
|
|
|
|
|
|
|
|
BSNO = item.GID,
|
|
|
|
|
|
|
|
}, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.DSDB).Update<DS_Report>().Set(w => new DS_Report
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
EndTime = Convert.ToDateTime(w.EndTime).AddMonths(1),///修改截止日期
|
|
|
|
|
|
|
|
LastUpdate = DateTime.Now,
|
|
|
|
|
|
|
|
LastUserId = item.GID
|
|
|
|
|
|
|
|
}).Where(w => w.GID == item.GID).ExecuteAffrows();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Exception excep = ex;
|
|
|
|
|
|
|
|
while (excep != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_LogsAdd("TemplateTask", "post", $"报表定时任务:{excep.Message}{excep.StackTrace}");
|
|
|
|
|
|
|
|
excep = excep.InnerException;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|