|
@@ -15,6 +15,7 @@ using Hotline.Snapshot.Interfaces;
|
|
|
using Hotline.ThirdAccountDomainServices.Interfaces;
|
|
|
using Mapster;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.EntityFrameworkCore;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using SqlSugar;
|
|
|
using SqlSugar.Extensions;
|
|
@@ -48,9 +49,8 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
private readonly IPushDomainService _pushDomainService;
|
|
|
private readonly ILogger<RedPackApplication> _logger;
|
|
|
private readonly ISystemDicDataCacheManager _systemDic;
|
|
|
- private readonly ISnapshotUserInfoRepository _snapshotUserInfoRepository;
|
|
|
|
|
|
- public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, IRepository<OrderSpecial> orderSpecialRepository, ISessionContext sessionContext, IRedPackGuiderAuditRepository redPackGuiderAuditRepository, IThirdAccountRepository thirdAccountRepository, ISupplementRecordRepository supplementRecordRepository, IPushDomainService pushDomainService, ILogger<RedPackApplication> logger, ISpecialRedPackAuditRepository specialRedPackAuditRepository, ISystemDicDataCacheManager systemDic, ISnapshotUserInfoRepository snapshotUserInfoRepository)
|
|
|
+ public RedPackApplication(IOrderSnapshotRepository orderSnapshotRepository, ISnapshotSMSTemplateRepository snapshotSMSTemplateRepository, IOrderRepository orderRepository, IIndustryRepository industryRepository, IRedPackAuditRepository redPackAuditRepository, IRedPackRecordRepository redPackRecordRepository, IRepository<OrderSpecial> orderSpecialRepository, ISessionContext sessionContext, IRedPackGuiderAuditRepository redPackGuiderAuditRepository, IThirdAccountRepository thirdAccountRepository, ISupplementRecordRepository supplementRecordRepository, IPushDomainService pushDomainService, ILogger<RedPackApplication> logger, ISpecialRedPackAuditRepository specialRedPackAuditRepository, ISystemDicDataCacheManager systemDic)
|
|
|
{
|
|
|
_orderSnapshotRepository = orderSnapshotRepository;
|
|
|
_snapshotSMSTemplateRepository = snapshotSMSTemplateRepository;
|
|
@@ -67,7 +67,6 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
_logger = logger;
|
|
|
_specialRedPackAuditRepository = specialRedPackAuditRepository;
|
|
|
_systemDic = systemDic;
|
|
|
- _snapshotUserInfoRepository = snapshotUserInfoRepository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -95,7 +94,7 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
var order = await _orderRepository.Queryable()
|
|
|
.LeftJoin<OrderSnapshot>((order, snapshot) => order.Id == snapshot.Id)
|
|
|
.Where((order, snapshot) => order.Id == redPackAudit.OrderId)
|
|
|
- .Select((order, snapshot) => new { order.Id, order.No, order.FromName, order.FromPhone , snapshot.SnapshotUserId})
|
|
|
+ .Select((order, snapshot) => new { order.Id, order.No, order.FromName, order.FromPhone, snapshot.SnapshotUserId })
|
|
|
.FirstAsync(token) ?? throw UserFriendlyException.SameMessage("工单不存在");
|
|
|
if (status == ERedPackAuditStatus.Agree)
|
|
|
{
|
|
@@ -267,7 +266,7 @@ 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")) || (redPackAudit.Status == ERedPackAuditStatus.Agree && order.CreationTime >= beginTime && order.CreationTime <= endTime && redPackAudit.ApprovedAmount == 20 && order.AcceptTypeCode != "30" && snapshot.IndustryName != "电气焊作业申报"))
|
|
|
+ .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 != "电气焊作业申报"))
|
|
|
.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)
|
|
@@ -329,6 +328,21 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
return query;
|
|
|
}
|
|
|
|
|
|
+ public async Task RevocationRedPackSpecialAuditAsync(IList<string> ids)
|
|
|
+ {
|
|
|
+ var has = await _specialRedPackAuditRepository.Queryable()
|
|
|
+ .Where(m => m.IsSend == true && ids.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)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 红包审核集合
|
|
|
/// </summary>
|
|
@@ -348,6 +362,7 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
.LeftJoin<OrderSnapshot>((redPackAudit, order, snapshot) => redPackAudit.OrderId == snapshot.Id)
|
|
|
.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)
|
|
|
.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))
|
|
@@ -366,7 +381,7 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
.WhereIF(dto.IsDanger.HasValue, (redPackAudit, order, snapshot, record, industry) => snapshot.IsDanger == dto.IsDanger)
|
|
|
.WhereIF(status.HasValue, (redPackAudit, order, snapshot, record, industry) => redPackAudit.Status == status)
|
|
|
.OrderByDescending((redPackAudit, order, snapshot, record, industry) => redPackAudit.CreationTime)
|
|
|
- .Select((redPackAudit, order, snapshot, record, industry) => new SnapshotOrderAuditItemsOutDto
|
|
|
+ .Select((redPackAudit, order, snapshot, record, industry, industryCase) => new SnapshotOrderAuditItemsOutDto
|
|
|
{
|
|
|
Id = redPackAudit.Id,
|
|
|
RedPackAuditId = redPackAudit.Id,
|
|
@@ -374,6 +389,8 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
No = order.No,
|
|
|
Title = order.Title,
|
|
|
IndustryName = industry.Name,
|
|
|
+ IndustryCaseId = snapshot.IndustryCase,
|
|
|
+ IndustryCase = industryCase.Name,
|
|
|
IndustryId = industry.Id,
|
|
|
SourceChannel = order.SourceChannel,
|
|
|
SourceChannelCode = order.SourceChannelCode,
|
|
@@ -405,7 +422,7 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
AwardName = record.Name,
|
|
|
OpenBank = record.OpenBank,
|
|
|
AuditStatus = redPackAudit.Status,
|
|
|
- });
|
|
|
+ }, true);
|
|
|
return query;
|
|
|
}
|
|
|
|
|
@@ -803,5 +820,6 @@ public class RedPackApplication : IRedPackApplication, IScopeDependency
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
#endregion
|
|
|
}
|