|
|
|
@ -17,7 +17,6 @@ namespace djy.Service.Report
|
|
|
|
|
public class ReportService : ServBase, IReportService
|
|
|
|
|
{
|
|
|
|
|
#region 获取模板
|
|
|
|
|
|
|
|
|
|
public List<DS_ReportTemplate> GetTemplate()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
@ -137,7 +136,6 @@ namespace djy.Service.Report
|
|
|
|
|
if (isbook) {
|
|
|
|
|
if (Gid.IsNull())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DS_Report report = new DS_Report();
|
|
|
|
|
report.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
report.UserID = user.GID;
|
|
|
|
@ -200,7 +198,76 @@ namespace djy.Service.Report
|
|
|
|
|
return "取消成功!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#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
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|