|
@@ -28,14 +28,15 @@ namespace MySystem
|
|
|
{
|
|
{
|
|
|
while (true)
|
|
while (true)
|
|
|
{
|
|
{
|
|
|
- if (DateTime.Now.Hour < 20)
|
|
|
|
|
|
|
+ if (DateTime.Now.Day == 20 && DateTime.Now.Hour < 12)
|
|
|
|
|
+ // if (DateTime.Now.Hour < 20)
|
|
|
{
|
|
{
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- string check = function.ReadInstance("/InstallmentDeduction/check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
|
|
|
|
|
|
|
+ string check = function.ReadInstance("/InstallmentDeduction/check" + DateTime.Now.ToString("yyyy-MM-20") + ".txt");
|
|
|
if (string.IsNullOrEmpty(check))
|
|
if (string.IsNullOrEmpty(check))
|
|
|
{
|
|
{
|
|
|
- function.WritePage("/InstallmentDeduction/", "check" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", DateTime.Now.ToString("HH:mm:ss"));
|
|
|
|
|
|
|
+ function.WritePage("/InstallmentDeduction/", "check" + DateTime.Now.ToString("yyyy-MM-20") + ".txt", DateTime.Now.ToString("HH:mm:ss"));
|
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
|
|
|
|
|
|
var info = db.ToChargeBackRecord.Where(m => m.Sort > 0 && m.Status == 0 && m.ChargeType == 2).ToList();//分期扣款记录
|
|
var info = db.ToChargeBackRecord.Where(m => m.Sort > 0 && m.Status == 0 && m.ChargeType == 2).ToList();//分期扣款记录
|
|
@@ -43,6 +44,8 @@ namespace MySystem
|
|
|
{
|
|
{
|
|
|
var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == items.UserId) ?? new UserAccount();
|
|
var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == items.UserId) ?? new UserAccount();
|
|
|
var record = info.FirstOrDefault(m => m.Id == items.Id);
|
|
var record = info.FirstOrDefault(m => m.Id == items.Id);
|
|
|
|
|
+ ToChargeBackRecordSub toChargeBackRecordSub = new ToChargeBackRecordSub();
|
|
|
|
|
+ ToChargeByStage toChargeByStage = new ToChargeByStage();
|
|
|
if (userAccount.BalanceAmount >= record.ChargeAmount)
|
|
if (userAccount.BalanceAmount >= record.ChargeAmount)
|
|
|
{
|
|
{
|
|
|
var userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord
|
|
var userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord
|
|
@@ -56,8 +59,8 @@ namespace MySystem
|
|
|
Remark = "分期扣款",
|
|
Remark = "分期扣款",
|
|
|
|
|
|
|
|
}).Entity;
|
|
}).Entity;
|
|
|
- var toChargeBackRecordSub = db.ToChargeBackRecordSub.FirstOrDefault(m => m.Id == record.Sort) ?? new ToChargeBackRecordSub();
|
|
|
|
|
- var toChargeByStage = db.ToChargeByStage.FirstOrDefault(m => m.Id == toChargeBackRecordSub.ParentId && record.TimeNumber > m.QueryCount) ?? new ToChargeByStage();
|
|
|
|
|
|
|
+ toChargeBackRecordSub = db.ToChargeBackRecordSub.FirstOrDefault(m => m.Id == record.Sort) ?? new ToChargeBackRecordSub();
|
|
|
|
|
+ toChargeByStage = db.ToChargeByStage.FirstOrDefault(m => m.Id == toChargeBackRecordSub.ParentId && m.TimeNumber > m.QueryCount) ?? new ToChargeByStage();
|
|
|
record.Status = 1;
|
|
record.Status = 1;
|
|
|
toChargeBackRecordSub.Status = 1;
|
|
toChargeBackRecordSub.Status = 1;
|
|
|
toChargeByStage.QueryCount += 1;
|
|
toChargeByStage.QueryCount += 1;
|
|
@@ -70,26 +73,27 @@ namespace MySystem
|
|
|
userAccount.ToChargeAmount -= record.ChargeAmount;//分期扣款
|
|
userAccount.ToChargeAmount -= record.ChargeAmount;//分期扣款
|
|
|
}
|
|
}
|
|
|
userAccount.BalanceAmount -= record.ChargeAmount;//扣减余额
|
|
userAccount.BalanceAmount -= record.ChargeAmount;//扣减余额
|
|
|
- }
|
|
|
|
|
- if (record.Status == 1)
|
|
|
|
|
- {
|
|
|
|
|
- var toChargeBackRecordSub = db.ToChargeBackRecordSub.FirstOrDefault(m => m.Id == record.Sort) ?? new ToChargeBackRecordSub();
|
|
|
|
|
- var toChargeByStage = db.ToChargeByStage.FirstOrDefault(m => m.Id == toChargeBackRecordSub.ParentId && record.TimeNumber > m.QueryCount) ?? new ToChargeByStage();
|
|
|
|
|
- if (toChargeByStage.Id > 0)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (record.Status == 1)
|
|
|
{
|
|
{
|
|
|
- var toChargeBackRecordSubs = db.ToChargeBackRecordSub.FirstOrDefault(m => m.Status == 0 && m.ParentId == toChargeByStage.Id) ?? new ToChargeBackRecordSub();
|
|
|
|
|
- if (toChargeBackRecordSubs.Id > 0)
|
|
|
|
|
|
|
+ if (toChargeByStage.Id > 0 && toChargeByStage.TimeNumber > toChargeByStage.QueryCount)
|
|
|
{
|
|
{
|
|
|
- userAccount.ToChargeAmount += toChargeBackRecordSubs.ChargeAmount;//增加预扣款
|
|
|
|
|
- var toChargeBackRecord = db.ToChargeBackRecord.Add(new ToChargeBackRecord
|
|
|
|
|
|
|
+ var toChargeBackRecordSubs = db.ToChargeBackRecordSub.FirstOrDefault(m => m.Status == 0 && m.ParentId == toChargeByStage.Id) ?? new ToChargeBackRecordSub();
|
|
|
|
|
+ var time = DateTime.Now.ToString("yyyy-MM-20");
|
|
|
|
|
+ var date = DateTime.Parse(toChargeBackRecordSubs.StartDate.ToString()).ToString("yyyy-MM-dd");
|
|
|
|
|
+ if (toChargeBackRecordSubs.Id > 0 && time == date)
|
|
|
{
|
|
{
|
|
|
- CreateDate = DateTime.Now,
|
|
|
|
|
- UserId = toChargeByStage.UserId,
|
|
|
|
|
- ChargeAmount = toChargeBackRecordSubs.ChargeAmount,
|
|
|
|
|
- ChargeType = 2,//2 分期扣款 1 普通预扣
|
|
|
|
|
- Remark = "分期扣款",
|
|
|
|
|
|
|
+ userAccount.ToChargeAmount += toChargeBackRecordSubs.ChargeAmount;//增加预扣款
|
|
|
|
|
+ var toChargeBackRecord = db.ToChargeBackRecord.Add(new ToChargeBackRecord
|
|
|
|
|
+ {
|
|
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
|
|
+ UserId = toChargeByStage.UserId,
|
|
|
|
|
+ ChargeAmount = toChargeBackRecordSubs.ChargeAmount,
|
|
|
|
|
+ ChargeType = 2,//2 分期扣款 1 普通预扣
|
|
|
|
|
+ Remark = "分期扣款",
|
|
|
|
|
|
|
|
- }).Entity;
|
|
|
|
|
|
|
+ }).Entity;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|