|
@@ -3846,6 +3846,136 @@ WHERE
|
|
|
return Ok(JsonView(true, "操作成功!", groupByData));
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 团组数据统计
|
|
|
+ /// 团组合作前十的客户TOP10排序
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("StatisticsCooperativeCustomer")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> StatisticsCooperativeCustomer(YOYDto _dto)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (_dto.Year < 1) return Ok(JsonView(false, "操作失败"));
|
|
|
+
|
|
|
+
|
|
|
+ string beginDt = $"{_dto.Year}-01-01 00:00:00",
|
|
|
+ endDt = $"{_dto.Year}-12-31 23:59:59";
|
|
|
+ DateTime _beginDt = Convert.ToDateTime(beginDt),
|
|
|
+ _endDt = Convert.ToDateTime(endDt);
|
|
|
+
|
|
|
+ var groupInfos = await _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.IsDel == 0)
|
|
|
+ .Where(x => x.IsSure == 1)
|
|
|
+ .Where(x => x.VisitDate >= _beginDt && x.VisitDate <= _endDt)
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var groupInfos1 = groupInfos.GroupBy(x => x.ClientName);
|
|
|
+
|
|
|
+ var view = groupInfos1.Select(x =>
|
|
|
+ new {
|
|
|
+ clienName = x.Key,
|
|
|
+ clientUnit = x.FirstOrDefault()?.ClientUnit ?? "",
|
|
|
+ visitsNum = x.Count()
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .OrderByDescending(x => x.visitsNum)
|
|
|
+ .Take(10)
|
|
|
+ .ToList();
|
|
|
+ return Ok(JsonView(true, "操作成功!", view));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 团组数据统计
|
|
|
+ /// 已出团客户单位的类型比例图(饼状图-政府团、企业团等)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("StatisticsCooperativeCustomerType")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> StatisticsCooperativeCustomerType(YOYDto _dto)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (_dto.Year < 1) return Ok(JsonView(false, "操作失败"));
|
|
|
+
|
|
|
+
|
|
|
+ string beginDt = $"{_dto.Year}-01-01 00:00:00",
|
|
|
+ endDt = $"{_dto.Year}-12-31 23:59:59";
|
|
|
+ DateTime _beginDt = Convert.ToDateTime(beginDt),
|
|
|
+ _endDt = Convert.ToDateTime(endDt);
|
|
|
+
|
|
|
+ var groupInfos = await _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .LeftJoin<Sys_SetData>((di,sd) => di.TeamDid == sd.Id)
|
|
|
+ .Where((di, sd) => di.IsDel == 0)
|
|
|
+ .Where((di, sd) => di.VisitDate >= _beginDt && di.VisitDate <= _endDt)
|
|
|
+ .Select((di, sd) => new {
|
|
|
+ Id = di.Id,
|
|
|
+ GroupTypeId = di.TeamDid,
|
|
|
+ GroupTypeName = sd.Name,
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+
|
|
|
+ var groupInfos1 = groupInfos.GroupBy(x => x.GroupTypeName);
|
|
|
+
|
|
|
+ var view = groupInfos1.Select(x =>
|
|
|
+ new {
|
|
|
+ groupTypeName = x.Key,
|
|
|
+ groupNum = x.Count(),
|
|
|
+ linkGroupId = x.Select(x1 => x1.Id).ToList()
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .OrderByDescending(x => x.groupNum)
|
|
|
+ .ToList();
|
|
|
+ return Ok(JsonView(true, "操作成功!", view));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 团组数据统计
|
|
|
+ /// 团组数量、人数
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="_dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("StatisticsCooperativeCustomerType")]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> StatisticsGroupInfo(YOYDto _dto)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (_dto.Year < 1) return Ok(JsonView(false, "操作失败"));
|
|
|
+
|
|
|
+
|
|
|
+ string beginDt = $"{_dto.Year}-01-01 00:00:00",
|
|
|
+ endDt = $"{_dto.Year}-12-31 23:59:59";
|
|
|
+ DateTime _beginDt = Convert.ToDateTime(beginDt),
|
|
|
+ _endDt = Convert.ToDateTime(endDt);
|
|
|
+
|
|
|
+ var groupInfos = await _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.IsDel == 0)
|
|
|
+ .Where(x => x.VisitDate >= _beginDt && x.VisitDate <= _endDt)
|
|
|
+ .Select(x => new {
|
|
|
+ Id = x.Id,
|
|
|
+ x.VisitDate,
|
|
|
+ Month = x.VisitDate.Month,
|
|
|
+ x.VisitPNumber
|
|
|
+ })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+
|
|
|
+ var groupInfos1 = groupInfos.GroupBy(x => x.Id);
|
|
|
+
|
|
|
+ var view = groupInfos1.Select(x =>
|
|
|
+ new {
|
|
|
+ groupTypeName = x.Key,
|
|
|
+ groupNum = x.Count(),
|
|
|
+ linkGroupId = x.Select(x1 => x1.Id).ToList()
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .OrderByDescending(x => x.groupNum)
|
|
|
+ .ToList();
|
|
|
+ return Ok(JsonView(true, "操作成功!", view));
|
|
|
+ }
|
|
|
#endregion
|
|
|
}
|
|
|
}
|