|
@@ -72,8 +72,9 @@ public abstract class SnapshotApplicationBase
|
|
|
private readonly IGuiderInfoRepository _guiderInfoRepository;
|
|
|
private readonly IFileDomainService _fileDomainService;
|
|
|
private readonly ICommunityInfoRepository _communityInfoRepository;
|
|
|
+ private readonly IRedPackAuditRepository _redPackAuditRepository;
|
|
|
|
|
|
- public SnapshotApplicationBase(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, ISnapshotBulletinRepository bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IOrderSnapshotRepository orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService, IFileRepository fileRepository, ISystemDicDataCacheManager systemDicDataCacheManager, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, IRepository<WorkflowTrace> workflowTraceRepository, IPractitionerRepository practitionerRepository, IRepository<SystemArea> systemAreaRepository, IVolunteerRepository volunteerRepository, IVolunteerReportRepository volunteerReportRepository, ISystemLogRepository systemLog, IGuiderSystemService guiderSystemService, ICapPublisher capPublisher, Publisher publisher, IGuiderInfoRepository guiderInfoRepository, IFileDomainService fileDomainService, ICommunityInfoRepository communityInfoRepository)
|
|
|
+ public SnapshotApplicationBase(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, ISnapshotBulletinRepository bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IOrderSnapshotRepository orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService, IFileRepository fileRepository, ISystemDicDataCacheManager systemDicDataCacheManager, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, IRepository<WorkflowTrace> workflowTraceRepository, IPractitionerRepository practitionerRepository, IRepository<SystemArea> systemAreaRepository, IVolunteerRepository volunteerRepository, IVolunteerReportRepository volunteerReportRepository, ISystemLogRepository systemLog, IGuiderSystemService guiderSystemService, ICapPublisher capPublisher, Publisher publisher, IGuiderInfoRepository guiderInfoRepository, IFileDomainService fileDomainService, ICommunityInfoRepository communityInfoRepository, IRedPackAuditRepository redPackAuditRepository)
|
|
|
{
|
|
|
_thirdLoginService = thirdLoginService;
|
|
|
_industryRepository = industryRepository;
|
|
@@ -100,8 +101,10 @@ public abstract class SnapshotApplicationBase
|
|
|
_guiderInfoRepository = guiderInfoRepository;
|
|
|
_fileDomainService = fileDomainService;
|
|
|
_communityInfoRepository = communityInfoRepository;
|
|
|
+ _redPackAuditRepository = redPackAuditRepository;
|
|
|
}
|
|
|
|
|
|
+ #region 小程序
|
|
|
/// <summary>
|
|
|
/// 获取随手拍小程序首页数据
|
|
|
/// </summary>
|
|
@@ -198,23 +201,6 @@ public abstract class SnapshotApplicationBase
|
|
|
return outDto;
|
|
|
}
|
|
|
|
|
|
- public async Task AddOrderPublishAsync(AddSnapshotOrderPublishInDto dto, CancellationToken cancellation)
|
|
|
- {
|
|
|
- dto.ValidateObject();
|
|
|
- var snapshotOrder = await _orderSnapshotRepository.GetAsync(dto.OrderId)
|
|
|
- ?? throw UserFriendlyException.SameMessage("工单不存在");
|
|
|
- var order = await _orderRepository.Queryable()
|
|
|
- .Where(m => m.Id == dto.OrderId)
|
|
|
- .Select(m => new { m.Id, m.No })
|
|
|
- .FirstAsync(cancellation)
|
|
|
- ?? throw UserFriendlyException.SameMessage("工单不存在");
|
|
|
- var entity = dto.Adapt<SnapshotOrderPublish>();
|
|
|
- entity.Id = order.Id;
|
|
|
- entity.IndustryId = snapshotOrder.IndustryId;
|
|
|
- entity.IndustryName = snapshotOrder.IndustryName;
|
|
|
- entity.No = order.No;
|
|
|
- await _snapshotOrderPublishRepository.AddAsync(entity);
|
|
|
- }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取公开工单集合
|
|
@@ -457,45 +443,6 @@ public abstract class SnapshotApplicationBase
|
|
|
return detail;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 添加随手拍公告
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task<string> AddBulletinAsync(AddSnapshotBulletinInDto dto)
|
|
|
- {
|
|
|
- dto.ValidateObject();
|
|
|
- var entity = dto.Adapt<SnapshotBulletin>();
|
|
|
- entity.BulletinState = EBulletinState.InReview;
|
|
|
- entity.Id = await _bulletinRepository.AddAsync(entity);
|
|
|
- return entity.Id;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 审核公告
|
|
|
- /// </summary>
|
|
|
- /// <param name="examineBulletinDto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task AuditBulletinAsync(ExamineBulletinDto dto)
|
|
|
- {
|
|
|
- var bulletin = await _bulletinRepository.GetAsync(dto.Id)
|
|
|
- ?? throw UserFriendlyException.SameMessage("无效数据");
|
|
|
- if (bulletin.BulletinState != EBulletinState.InReview)
|
|
|
- throw UserFriendlyException.SameMessage("当前状态不能审核");
|
|
|
-
|
|
|
- bulletin.ExaminOpinion = dto.Reason;
|
|
|
- bulletin.ExaminTime = DateTime.Now;
|
|
|
- bulletin.ExaminManId = _sessionContext.RequiredUserId;
|
|
|
- if (dto.IsPass)
|
|
|
- {
|
|
|
- bulletin.BulletinState = EBulletinState.ReviewPass;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- bulletin.BulletinState = EBulletinState.ReviewNoPass;
|
|
|
- }
|
|
|
- await _bulletinRepository.UpdateAsync(bulletin);
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 保存用户自己的邀请码
|
|
|
/// </summary>
|
|
@@ -510,6 +457,9 @@ public abstract class SnapshotApplicationBase
|
|
|
await _thirdAccountRepository.UpdateAsync(third);
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 网格员
|
|
|
/// <summary>
|
|
|
/// 推送工单到网格员系统
|
|
|
/// </summary>
|
|
@@ -651,6 +601,7 @@ public abstract class SnapshotApplicationBase
|
|
|
await _communityInfoRepository.UpdateAsync(community, cancellationToken);
|
|
|
}
|
|
|
}
|
|
|
+ #endregion
|
|
|
|
|
|
#region 从业人员
|
|
|
|
|
@@ -726,6 +677,12 @@ public abstract class SnapshotApplicationBase
|
|
|
|
|
|
#region 志愿者
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 添加志愿者
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
public async Task<string> AddVolunteerAsync(AddVolunteerInDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
var entity = dto.Adapt<Volunteer>();
|
|
@@ -755,4 +712,91 @@ public abstract class SnapshotApplicationBase
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
+ #region 红包
|
|
|
+ /// <summary>
|
|
|
+ /// 生成用户红包审核数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="id"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [LogToData]
|
|
|
+ public async Task<string> AddRedPardAsync(string orderId, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ var order = await _orderRepository.Queryable()
|
|
|
+ .Where(m => m.Id == orderId)
|
|
|
+ .Select(m => new {m.Id, m.Status , m.No})
|
|
|
+ .FirstAsync(cancellationToken) ?? throw new UserFriendlyException($"{orderId} 工单不存在");
|
|
|
+ if (order.Status != EOrderStatus.Filed) return $"{order.No} 工单状态非 {EOrderStatus.Filed} 不处理;";
|
|
|
+ var redPack = await _redPackAuditRepository.GetByOrderIdAsync(orderId, cancellationToken);
|
|
|
+ if (redPack != null) return $"{order.No} 工单已存在红包信息,不处理;";
|
|
|
+ var entity = new RedPackAudit
|
|
|
+ {
|
|
|
+ OrderId = order.Id,
|
|
|
+ Status = ERedPackAuditStatus.Pending,
|
|
|
+
|
|
|
+ };
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 公开工单
|
|
|
+
|
|
|
+ public async Task AddOrderPublishAsync(AddSnapshotOrderPublishInDto dto, CancellationToken cancellation)
|
|
|
+ {
|
|
|
+ dto.ValidateObject();
|
|
|
+ var snapshotOrder = await _orderSnapshotRepository.GetAsync(dto.OrderId)
|
|
|
+ ?? throw UserFriendlyException.SameMessage("工单不存在");
|
|
|
+ var order = await _orderRepository.Queryable()
|
|
|
+ .Where(m => m.Id == dto.OrderId)
|
|
|
+ .Select(m => new { m.Id, m.No })
|
|
|
+ .FirstAsync(cancellation)
|
|
|
+ ?? throw UserFriendlyException.SameMessage("工单不存在");
|
|
|
+ var entity = dto.Adapt<SnapshotOrderPublish>();
|
|
|
+ entity.Id = order.Id;
|
|
|
+ entity.IndustryId = snapshotOrder.IndustryId;
|
|
|
+ entity.IndustryName = snapshotOrder.IndustryName;
|
|
|
+ entity.No = order.No;
|
|
|
+ await _snapshotOrderPublishRepository.AddAsync(entity);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 随手拍公告
|
|
|
+ /// <summary>
|
|
|
+ /// 添加随手拍公告
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<string> AddBulletinAsync(AddSnapshotBulletinInDto dto)
|
|
|
+ {
|
|
|
+ dto.ValidateObject();
|
|
|
+ var entity = dto.Adapt<SnapshotBulletin>();
|
|
|
+ entity.BulletinState = EBulletinState.InReview;
|
|
|
+ entity.Id = await _bulletinRepository.AddAsync(entity);
|
|
|
+ return entity.Id;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 审核公告
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="examineBulletinDto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task AuditBulletinAsync(ExamineBulletinDto dto)
|
|
|
+ {
|
|
|
+ var bulletin = await _bulletinRepository.GetAsync(dto.Id)
|
|
|
+ ?? throw UserFriendlyException.SameMessage("无效数据");
|
|
|
+ if (bulletin.BulletinState != EBulletinState.InReview)
|
|
|
+ throw UserFriendlyException.SameMessage("当前状态不能审核");
|
|
|
+
|
|
|
+ bulletin.ExaminOpinion = dto.Reason;
|
|
|
+ bulletin.ExaminTime = DateTime.Now;
|
|
|
+ bulletin.ExaminManId = _sessionContext.RequiredUserId;
|
|
|
+ if (dto.IsPass)
|
|
|
+ {
|
|
|
+ bulletin.BulletinState = EBulletinState.ReviewPass;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bulletin.BulletinState = EBulletinState.ReviewNoPass;
|
|
|
+ }
|
|
|
+ await _bulletinRepository.UpdateAsync(bulletin);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
}
|