|
@@ -19,6 +19,7 @@ using Mapster;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
+using Microsoft.Identity.Client;
|
|
|
using SqlSugar;
|
|
|
using SqlSugar.Extensions;
|
|
|
using System.ComponentModel;
|
|
@@ -357,16 +358,17 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
|
|
|
public async Task RevocationRedPackSpecialAuditAsync(IList<string> ids)
|
|
|
{
|
|
|
+ var specialRedPackAuditIds = await _specialRedPackAuditRepository.Queryable()
|
|
|
+ .LeftJoin<Order>((special, order) => special.OrderId == order.Id)
|
|
|
+ .LeftJoin<RedPackAudit>((special, order, audit) => order.Id == audit.OrderId)
|
|
|
+ .Where((special, order, audit) => ids.Contains(audit.Id))
|
|
|
+ .Select((special, order, audit) => special.Id).ToListAsync();
|
|
|
var has = await _specialRedPackAuditRepository.Queryable()
|
|
|
- .Where(m => m.IsSend == true && ids.Contains(m.Id))
|
|
|
+ .Where(m => m.IsSend == true && specialRedPackAuditIds.Contains(m.Id))
|
|
|
.AnyAsync();
|
|
|
if (has) throw new UserFriendlyException("该工单已发放红包,不能撤销审批");
|
|
|
- await _specialRedPackAuditRepository.Updateable()
|
|
|
- .SetColumns(m => m.Status, ERedPackAuditStatus.Pending)
|
|
|
- .SetColumns(m => m.AuditType, null)
|
|
|
- .SetColumns(m => m.AuditTypeCode, null)
|
|
|
- .SetColumns(m => m.AuditRemark, null)
|
|
|
- .Where(m => ids.Contains(m.Id) && m.IsSend == false)
|
|
|
+ await _specialRedPackAuditRepository.Removeable()
|
|
|
+ .Where(m => specialRedPackAuditIds.Contains(m.Id))
|
|
|
.ExecuteCommandAsync();
|
|
|
}
|
|
|
|