|
@@ -45,8 +45,9 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
|
|
private readonly IRepository<Hotspot> _hotspotTypeRepository;
|
|
private readonly IRepository<Hotspot> _hotspotTypeRepository;
|
|
private readonly ISessionContext _sessionContext;
|
|
private readonly ISessionContext _sessionContext;
|
|
private readonly IOrderRepository _orderRepository;
|
|
private readonly IOrderRepository _orderRepository;
|
|
|
|
+ private readonly ICommunityInfoRepository _communityInfoRepository;
|
|
|
|
|
|
- public BiSnapshotApplication(IOrderSnapshotRepository orderSnapshotRepository, IRedPackRecordRepository redPackRecordRepository, IIndustryRepository industryRepository, IIndustryCaseRepository industryCaseRepository, IRedPackAuditRepository redPackAuditRepository, IRepository<Hotspot> hotspotTypeRepository, ISessionContext sessionContext, IOrderRepository orderRepository)
|
|
|
|
|
|
+ public BiSnapshotApplication(IOrderSnapshotRepository orderSnapshotRepository, IRedPackRecordRepository redPackRecordRepository, IIndustryRepository industryRepository, IIndustryCaseRepository industryCaseRepository, IRedPackAuditRepository redPackAuditRepository, IRepository<Hotspot> hotspotTypeRepository, ISessionContext sessionContext, IOrderRepository orderRepository, ICommunityInfoRepository communityInfoRepository)
|
|
{
|
|
{
|
|
_orderSnapshotRepository = orderSnapshotRepository;
|
|
_orderSnapshotRepository = orderSnapshotRepository;
|
|
_redPackRecordRepository = redPackRecordRepository;
|
|
_redPackRecordRepository = redPackRecordRepository;
|
|
@@ -56,6 +57,7 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
|
|
_hotspotTypeRepository = hotspotTypeRepository;
|
|
_hotspotTypeRepository = hotspotTypeRepository;
|
|
_sessionContext = sessionContext;
|
|
_sessionContext = sessionContext;
|
|
_orderRepository = orderRepository;
|
|
_orderRepository = orderRepository;
|
|
|
|
+ _communityInfoRepository = communityInfoRepository;
|
|
}
|
|
}
|
|
|
|
|
|
public ISugarQueryable<HotspotStatisticsOutDto> GetHotspotStatistics(HotspotStatisticsInDto dto)
|
|
public ISugarQueryable<HotspotStatisticsOutDto> GetHotspotStatistics(HotspotStatisticsInDto dto)
|
|
@@ -434,7 +436,7 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
|
|
public ISugarQueryable<GuiderWorkStatisticsOutDto> GetGuiderWorkStatisticsAsync(GuiderWorkStatisticsInDto dto)
|
|
public ISugarQueryable<GuiderWorkStatisticsOutDto> GetGuiderWorkStatisticsAsync(GuiderWorkStatisticsInDto dto)
|
|
{
|
|
{
|
|
var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
|
|
var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
|
|
- .Where(snapshot => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime && snapshot.MemberName != null )
|
|
|
|
|
|
+ .Where(snapshot => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime && snapshot.MemberName != null)
|
|
.GroupBy(snapshot => new { snapshot.MemberName, snapshot.MemberMobile })
|
|
.GroupBy(snapshot => new { snapshot.MemberName, snapshot.MemberMobile })
|
|
.Select(snapshot => new GuiderWorkStatisticsOutDto
|
|
.Select(snapshot => new GuiderWorkStatisticsOutDto
|
|
{
|
|
{
|
|
@@ -463,7 +465,7 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
|
|
_ => throw new UserFriendlyException($"入参: {dto.FieldName} 异常")
|
|
_ => throw new UserFriendlyException($"入参: {dto.FieldName} 异常")
|
|
};
|
|
};
|
|
return query.Select((snapshot, order) => new GuiderWorkStatisticsDetailsOutDto
|
|
return query.Select((snapshot, order) => new GuiderWorkStatisticsDetailsOutDto
|
|
- {
|
|
|
|
|
|
+ {
|
|
}, true);
|
|
}, true);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -490,7 +492,7 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
|
|
.Where((snapshot, order) => snapshot.IsGuidSystemCallBack == true)
|
|
.Where((snapshot, order) => snapshot.IsGuidSystemCallBack == true)
|
|
.WhereIF(dto.MemberMobile.NotNullOrEmpty(), snapshot => snapshot.MemberMobile.Contains(dto.MemberMobile))
|
|
.WhereIF(dto.MemberMobile.NotNullOrEmpty(), snapshot => snapshot.MemberMobile.Contains(dto.MemberMobile))
|
|
.WhereIF(dto.BeginCreationTime != null && dto.EndCreationTime != null, snapshot => snapshot.CreationTime >= dto.BeginCreationTime && snapshot.CreationTime <= dto.EndCreationTime)
|
|
.WhereIF(dto.BeginCreationTime != null && dto.EndCreationTime != null, snapshot => snapshot.CreationTime >= dto.BeginCreationTime && snapshot.CreationTime <= dto.EndCreationTime)
|
|
- .WhereIF(dto.MemberName.NotNullOrEmpty(), snapshot => snapshot.MemberName.Contains( dto.MemberName))
|
|
|
|
|
|
+ .WhereIF(dto.MemberName.NotNullOrEmpty(), snapshot => snapshot.MemberName.Contains(dto.MemberName))
|
|
.WhereIF(dto.No.NotNullOrEmpty(), (snapshot, order) => order.No.Contains(dto.No))
|
|
.WhereIF(dto.No.NotNullOrEmpty(), (snapshot, order) => order.No.Contains(dto.No))
|
|
.WhereIF(dto.Title.NotNullOrEmpty(), (snapshot, order) => order.Title.Contains(dto.Title))
|
|
.WhereIF(dto.Title.NotNullOrEmpty(), (snapshot, order) => order.Title.Contains(dto.Title))
|
|
.WhereIF(dto.NetworkENumber.NotNullOrEmpty(), (snapshot, order) => snapshot.NetworkENumber.Contains(dto.NetworkENumber))
|
|
.WhereIF(dto.NetworkENumber.NotNullOrEmpty(), (snapshot, order) => snapshot.NetworkENumber.Contains(dto.NetworkENumber))
|
|
@@ -518,4 +520,39 @@ public class BiSnapshotApplication : IBiSnapshotApplication, IScopeDependency
|
|
.Select((snapshot, order) => new DuplicateItemsOutDto(), true);
|
|
.Select((snapshot, order) => new DuplicateItemsOutDto(), true);
|
|
return query;
|
|
return query;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public ISugarQueryable<CommunityStatisticsOutDto> GetCommunityStatistics(CommunityStatisticsInDto dto)
|
|
|
|
+ {
|
|
|
|
+ var query = _communityInfoRepository.Queryable(includeDeleted: true)
|
|
|
|
+ .LeftJoin<OrderSnapshot>((it, s) => s.CommunityFullName.Contains(it.FullName) && s.CreationTime >= dto.StartTime && s.CreationTime <= dto.EndTime)
|
|
|
|
+ .WhereIF(dto.CommunityCode.IsNullOrEmpty(), (it, s) => it.ParentCode == null)
|
|
|
|
+ .WhereIF(dto.CommunityCode.NotNullOrEmpty(), (it, s) => it.ParentCode == dto.CommunityCode)
|
|
|
|
+ .WhereIF(dto.IndustryId.NotNullOrEmpty(), (it, s) => s.IndustryId == dto.IndustryId)
|
|
|
|
+ .GroupBy((it, s) => new { it.Name, it.Id })
|
|
|
|
+ .Select((it, s) => new CommunityStatisticsOutDto
|
|
|
|
+ {
|
|
|
|
+ CommunityCode = it.Id,
|
|
|
|
+ CommunityName = it.Name,
|
|
|
|
+ CommunityFullName = it.FullName,
|
|
|
|
+ SumCount = SqlFunc.Subqueryable<OrderSnapshot>().Where(snapshot => snapshot.CommunityFullName.Contains(it.FullName)).Count(),
|
|
|
|
+ HasChild = SqlFunc.Subqueryable<CommunityInfo>().Where(c => c.ParentCode == it.Id).Any()
|
|
|
|
+ });
|
|
|
|
+#if DEBUG
|
|
|
|
+ var sql = query.ToSqlString();
|
|
|
|
+#endif
|
|
|
|
+ return query;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public ISugarQueryable<CommunityStatisticsDetailsOutDto> GetCommunityStatisticsDetails(CommunityStatisticsDetailsInDto dto)
|
|
|
|
+ {
|
|
|
|
+ var query = _orderSnapshotRepository.Queryable(includeDeleted: true)
|
|
|
|
+ .LeftJoin<Order>((snapshot, order) => snapshot.Id == order.Id)
|
|
|
|
+ .Where((snapshot, order) => snapshot.CreationTime >= dto.StartTime && snapshot.CreationTime <= dto.EndTime && snapshot.CommunityFullName.Contains(dto.CommunityFullName))
|
|
|
|
+ .WhereIF(dto.IndustryId.NotNullOrEmpty(), (snapshot, order) => snapshot.IndustryId == dto.IndustryId)
|
|
|
|
+ .Select((snapshot, order) => new CommunityStatisticsDetailsOutDto(), true);
|
|
|
|
+#if DEBUG
|
|
|
|
+ var sql = query.ToSqlString();
|
|
|
|
+#endif
|
|
|
|
+ return query;
|
|
|
|
+ }
|
|
}
|
|
}
|