|
|
@@ -13,6 +13,7 @@ using System.Dynamic;
|
|
|
using System.Linq;
|
|
|
using static OASystem.API.OAMethodLib.GeneralMethod;
|
|
|
using static OASystem.API.OAMethodLib.JWTHelper;
|
|
|
+using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
|
@@ -3241,6 +3242,72 @@ And u.UId = {0} And u.FId = 1 ", dto.UserId);
|
|
|
return Ok(JsonView(false));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 数据测试
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> TransactionExTest1()
|
|
|
+ {
|
|
|
+
|
|
|
+ var groupIds = await _sqlSugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.IsDel == 0)
|
|
|
+ .Where(x => x.VisitDate >= Convert.ToDateTime("2025-01-01 00:00:00") && x.VisitDate <= Convert.ToDateTime("2025-12-31 23:59:59"))
|
|
|
+ .Select(x => x.Id)
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var datas = new List<View1>();
|
|
|
+ foreach (var id in groupIds)
|
|
|
+ {
|
|
|
+ var sql = @"
|
|
|
+SELECT
|
|
|
+ dac.DiId,
|
|
|
+ CASE ntf.City
|
|
|
+ WHEN '全部城市' THEN ntf.Country + ' -> 全部城市'
|
|
|
+ WHEN '其他城市' THEN ntf.Country + ' -> 其他城市'
|
|
|
+ ELSE ntf.Country + ' -> ' + ntf.City
|
|
|
+ END as City
|
|
|
+FROM Grp_DayAndCost dac
|
|
|
+LEFT JOIN grp_NationalTravelFee ntf ON dac.NationalTravelFeeId = ntf.Id
|
|
|
+WHERE dac.IsDel = 0
|
|
|
+ AND dac.DiId = @DiId
|
|
|
+GROUP BY
|
|
|
+ dac.DiId,
|
|
|
+ CASE ntf.City
|
|
|
+ WHEN '全部城市' THEN ntf.Country + ' -> 全部城市'
|
|
|
+ WHEN '其他城市' THEN ntf.Country + ' -> 其他城市'
|
|
|
+ ELSE ntf.Country + ' -> ' + ntf.City
|
|
|
+ END";
|
|
|
+
|
|
|
+ var data = await _sqlSugar.Ado.SqlQueryAsync<View1>(sql, new { DiId = id });
|
|
|
+
|
|
|
+ datas.AddRange(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ var view = datas.GroupBy(x => x.City)
|
|
|
+ .Select(x => new
|
|
|
+ {
|
|
|
+ x.Key,
|
|
|
+ Count = x.Count()
|
|
|
+ })
|
|
|
+ .OrderByDescending(x => x.Count)
|
|
|
+ .Skip(1)
|
|
|
+ .Take(20)
|
|
|
+ .ToList();
|
|
|
+ return Ok(JsonView(view));
|
|
|
+ }
|
|
|
+
|
|
|
+ private class View1 {
|
|
|
+
|
|
|
+ public int DiId { get; set; }
|
|
|
+
|
|
|
+ public string City { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 审批模板
|