|
@@ -245,7 +245,7 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
var outDto = new SnapshotOrderAuditDetailOutDto { Order = order.Adapt<SnapshotOrderAuditOrderDetailOutDto>() };
|
|
|
var industry = await _industryRepository.Queryable(includeDeleted: true)
|
|
|
.LeftJoin<OrderSnapshot>((i, o) => i.Id == o.IndustryId)
|
|
|
- .Select((i, o) => new { i.Id, i.CitizenReadPackAmount , i.ArgeePoints, i.ExtraDeductedPoints, i.RefusePoints})
|
|
|
+ .Select((i, o) => new { i.Id, i.CitizenReadPackAmount, i.ArgeePoints, i.ExtraDeductedPoints, i.RefusePoints })
|
|
|
.FirstAsync();
|
|
|
outDto.Amount = industry.CitizenReadPackAmount;
|
|
|
outDto.ArgeePoints = industry.ArgeePoints;
|
|
@@ -283,7 +283,8 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
.LeftJoin<OrderSnapshot>((redPackAudit, snapshot) => redPackAudit.OrderId == snapshot.Id)
|
|
|
.LeftJoin<Order>((redPackAudit, snapshot, order) => redPackAudit.OrderId == order.Id)
|
|
|
.LeftJoin<SpecialRedPackAudit>((redPackAudit, snapshot, order, special) => redPackAudit.OrderId == special.OrderId)
|
|
|
- .Where((redPackAudit, snapshot, order, special) => (redPackAudit.Status == ERedPackAuditStatus.Agree && snapshot.IndustryName == "安全隐患" && order.OrderTagCode!.Contains("DHZY")) || snapshot.IsSafetyDepartment == true || (redPackAudit.Status == ERedPackAuditStatus.Agree && order.CreationTime >= beginTime && order.CreationTime <= endTime && redPackAudit.ApprovedAmount == 20 && order.AcceptTypeCode != "30" && snapshot.IndustryName != "电气焊作业申报"))
|
|
|
+ .LeftJoin<SupplementRecord>((redPackAudit, snapshot, order, special, supplement) => special.Id == supplement.RedPackAuditId)
|
|
|
+ .Where((redPackAudit, snapshot, order, special) => (redPackAudit.Status == ERedPackAuditStatus.Agree && snapshot.IndustryName == "安全隐患" && order.OrderTagCode!.Contains("DHZY")) || (redPackAudit.Status == ERedPackAuditStatus.Agree && order.CreationTime >= beginTime && order.CreationTime <= endTime && redPackAudit.ApprovedAmount == 20 && order.AcceptTypeCode != "30" && snapshot.IndustryName != "电气焊作业申报" && (order.HotspotId == null || order.HotspotId.StartsWith("18") == false)))
|
|
|
.WhereIF(dto.Status == 0, (redPackAudit, snapshot, order, special) => special.Id == null)
|
|
|
.WhereIF(dto.Status == 1, (redPackAudit, snapshot, order, special) => special.Status == ERedPackAuditStatus.Agree)
|
|
|
.WhereIF(dto.Status == 2, (redPackAudit, snapshot, order, special) => special.Status == ERedPackAuditStatus.Refuse)
|
|
@@ -302,8 +303,8 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
.WhereIF(dto.AcutalAmount.HasValue, (redPackAudit, snapshot, order, special) => special.AcutalAmount == dto.AcutalAmount)
|
|
|
.WhereIF(dto.ApprovedAmount.HasValue, (redPackAudit, snapshot, order, special) => special.ApprovedAmount == dto.ApprovedAmount)
|
|
|
.WhereIF(dto.IsDanger.HasValue, (redPackAudit, snapshot, order, special) => snapshot.IsDanger == dto.IsDanger)
|
|
|
- .OrderByDescending((redPackAudit, snapshot, order, special) => redPackAudit.CreationTime)
|
|
|
- .Select((redPackAudit, snapshot, order, special) => new SnapshotOrderAuditItemsOutDto
|
|
|
+ .OrderByDescending((redPackAudit, snapshot, order, special, supplement) => redPackAudit.CreationTime)
|
|
|
+ .Select((redPackAudit, snapshot, order, special, supplement) => new SnapshotOrderAuditItemsOutDto
|
|
|
{
|
|
|
Id = redPackAudit.Id,
|
|
|
RedPackAuditId = redPackAudit.Id,
|
|
@@ -338,10 +339,13 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
AuditOrgId = special.AuditOrgId,
|
|
|
AuditOrgName = special.AuditOrgName,
|
|
|
AuditRemark = special.AuditRemark,
|
|
|
- //BankCardNo = record.BankCardNo,
|
|
|
- //OpenBank = record.OpenBank,
|
|
|
+ BankCardNo = supplement.BankCardNo,
|
|
|
+ OpenBank = supplement.OpenBank,
|
|
|
AuditStatus = special.Status,
|
|
|
});
|
|
|
+#if DEBUG
|
|
|
+ var sql = query.ToSqlString();
|
|
|
+#endif
|
|
|
return query;
|
|
|
}
|
|
|
|
|
@@ -380,7 +384,7 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
.LeftJoin<RedPackRecord>((redPackAudit, order, snapshot, record) => redPackAudit.Id == record.OrderId)
|
|
|
.LeftJoin<Industry>((redPackAudit, order, snapshot, record, industry) => snapshot.IndustryId == industry.Id)
|
|
|
.LeftJoin<IndustryCase>((redPackAudit, order, snapshot, record, industry, industryCase) => snapshot.IndustryCase == industryCase.Id)
|
|
|
- .Where((redPackAudit, order, snapshot, record, industry) => order.Status >= EOrderStatus.Filed)
|
|
|
+ .Where((redPackAudit, order, snapshot, record, industry) => (order.HotspotId == null || order.HotspotId.StartsWith("18") == false) && order.Status >= EOrderStatus.Filed)
|
|
|
.WhereIF(dto.No.NotNullOrEmpty(), (redPackAudit, order, snapshot, record, industry) => order.No.Contains(dto.No))
|
|
|
.WhereIF(dto.Title.NotNullOrEmpty(), (redPackAudit, order, snapshot, record, industry) => order.Title.Contains(dto.Title))
|
|
|
.WhereIF(dto.FromPhone.NotNullOrEmpty(), (redPackAudit, order, snapshot, record, industry) => order.FromPhone.Contains(dto.FromPhone))
|
|
@@ -573,37 +577,31 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task UpdateRedPackRecordAsync(UpdateRedPackRecordInDto dto)
|
|
|
{
|
|
|
- //var record = await _redPackRecordRepository.Queryable()
|
|
|
- // .Where(m => m.RedPackAuditId == dto.RedPackAuditId)
|
|
|
- // .FirstAsync() ?? throw UserFriendlyException.SameMessage("审核记录不存在");
|
|
|
- //record.DistributionState = EReadPackSendStatus.Successful;
|
|
|
- //record.PickupStatus = ERedPackPickupStatus.Received;
|
|
|
- var audit = await _redPackAuditRepository.GetAsync(dto.RedPackAuditId) ?? throw UserFriendlyException.SameMessage("审核记录不存在");
|
|
|
- var orderNo = await _orderRepository.Queryable().Where(m => m.Id == audit.OrderId).Select(m => m.No).FirstAsync();
|
|
|
-
|
|
|
- dto.Adapt(audit);
|
|
|
- audit.IsSend = true;
|
|
|
- audit.AcutalAmount = dto.ReplenishAmount;
|
|
|
- await _redPackAuditRepository.UpdateAsync(audit);
|
|
|
- //await _redPackRecordRepository.UpdateAsync(record);
|
|
|
+ await _redPackAuditRepository.Queryable().Where(m => m.Id == dto.RedPackAuditId)
|
|
|
+ .Select(m => new { m.Id, m.OrderId})
|
|
|
+ .FirstAsync()
|
|
|
+ .Then(async audit =>
|
|
|
+ {
|
|
|
+ var orderNo = await _orderRepository.Queryable().Where(m => m.Id == audit.OrderId).Select(m => m.No).FirstAsync();
|
|
|
|
|
|
- var entity = dto.Adapt<SupplementRecord>();
|
|
|
- var industryName = await _orderSnapshotRepository.Queryable()
|
|
|
- .Where(m => m.Id == audit.OrderId)
|
|
|
- .Select(m => new { m.IndustryName, m.IndustryId })
|
|
|
- .FirstAsync();
|
|
|
- entity.OrderId = audit.OrderId;
|
|
|
- //entity.RedPackRecordId = record.Id;
|
|
|
- entity.RedPackAuditId = audit.Id;
|
|
|
- entity.No = orderNo;
|
|
|
- entity.IndustryName = industryName.IndustryName;
|
|
|
- entity.IndustryId = industryName.IndustryId;
|
|
|
- await _supplementRecordRepository.AddAsync(entity);
|
|
|
-
|
|
|
- if (dto.IsSendSMS)
|
|
|
- {
|
|
|
- // TODO: 发送短信
|
|
|
- }
|
|
|
+ var entity = dto.Adapt<SupplementRecord>();
|
|
|
+ var industryName = await _orderSnapshotRepository.Queryable()
|
|
|
+ .Where(m => m.Id == audit.OrderId)
|
|
|
+ .Select(m => new { m.IndustryName, m.IndustryId })
|
|
|
+ .FirstAsync();
|
|
|
+ entity.OrderId = audit.OrderId;
|
|
|
+ entity.RedPackAuditId = audit.Id;
|
|
|
+ entity.No = orderNo;
|
|
|
+ entity.IndustryName = industryName.IndustryName;
|
|
|
+ entity.IndustryId = industryName.IndustryId;
|
|
|
+ entity.ReplenishRemark = dto.ReplenishRemark;
|
|
|
+ await _supplementRecordRepository.AddAsync(entity);
|
|
|
+
|
|
|
+ if (dto.IsSendSMS)
|
|
|
+ {
|
|
|
+ // TODO: 发送短信
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -613,37 +611,32 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
/// <returns></returns>
|
|
|
public async Task UpdateRedPackSpecialRecordAsync(UpdateRedPackRecordInDto dto)
|
|
|
{
|
|
|
- //var record = await _redPackRecordRepository.Queryable()
|
|
|
- // .Where(m => m.RedPackAuditId == dto.RedPackAuditId)
|
|
|
- // .FirstAsync() ?? throw UserFriendlyException.SameMessage("审核记录不存在");
|
|
|
- //record.DistributionState = EReadPackSendStatus.Successful;
|
|
|
- //record.PickupStatus = ERedPackPickupStatus.Received;
|
|
|
- var audit = await _specialRedPackAuditRepository.GetAsync(dto.RedPackAuditId) ?? throw UserFriendlyException.SameMessage("审核记录不存在");
|
|
|
- var orderNo = await _orderRepository.Queryable().Where(m => m.Id == audit.OrderId).Select(m => m.No).FirstAsync();
|
|
|
-
|
|
|
- dto.Adapt(audit);
|
|
|
- audit.IsSend = true;
|
|
|
- audit.AcutalAmount = dto.ReplenishAmount;
|
|
|
- await _specialRedPackAuditRepository.UpdateAsync(audit);
|
|
|
- //await _redPackRecordRepository.UpdateAsync(record);
|
|
|
-
|
|
|
- var entity = dto.Adapt<SupplementRecord>();
|
|
|
- var industryName = await _orderSnapshotRepository.Queryable()
|
|
|
- .Where(m => m.Id == audit.OrderId)
|
|
|
- .Select(m => new { m.IndustryName, m.IndustryId })
|
|
|
- .FirstAsync();
|
|
|
- entity.OrderId = audit.OrderId;
|
|
|
- //entity.RedPackRecordId = record.Id;
|
|
|
- entity.RedPackAuditId = audit.Id;
|
|
|
- entity.No = orderNo;
|
|
|
- entity.IndustryName = industryName.IndustryName;
|
|
|
- entity.IndustryId = industryName.IndustryId;
|
|
|
- await _supplementRecordRepository.AddAsync(entity);
|
|
|
-
|
|
|
- if (dto.IsSendSMS)
|
|
|
- {
|
|
|
- // TODO: 发送短信
|
|
|
- }
|
|
|
+ await _specialRedPackAuditRepository.Queryable()
|
|
|
+ .Where(m => m.Id == dto.RedPackAuditId)
|
|
|
+ .Select(m => new { m.Id, m.OrderId })
|
|
|
+ .FirstAsync()
|
|
|
+ .Then(async audit =>
|
|
|
+ {
|
|
|
+ var orderNo = await _orderRepository.Queryable().Where(m => m.Id == audit.OrderId).Select(m => m.No).FirstAsync();
|
|
|
+
|
|
|
+ var entity = dto.Adapt<SupplementRecord>();
|
|
|
+ var industryName = await _orderSnapshotRepository.Queryable()
|
|
|
+ .Where(m => m.Id == audit.OrderId)
|
|
|
+ .Select(m => new { m.IndustryName, m.IndustryId })
|
|
|
+ .FirstAsync();
|
|
|
+ entity.OrderId = audit.OrderId;
|
|
|
+ entity.RedPackAuditId = audit.Id;
|
|
|
+ entity.No = orderNo;
|
|
|
+ entity.IndustryName = industryName.IndustryName;
|
|
|
+ entity.IndustryId = industryName.IndustryId;
|
|
|
+ entity.ReplenishRemark = dto.ReplenishRemark;
|
|
|
+ await _supplementRecordRepository.AddAsync(entity);
|
|
|
+
|
|
|
+ if (dto.IsSendSMS)
|
|
|
+ {
|
|
|
+ // TODO: 发送短信
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|