|
@@ -29,6 +29,7 @@ using OASystem.Domain.Entities.Groups;
|
|
|
using OASystem.Domain.ViewModels.Financial;
|
|
|
using OASystem.Domain.ViewModels.Groups;
|
|
|
using OASystem.Domain.ViewModels.OCR;
|
|
|
+using OASystem.Domain.ViewModels.Statistics;
|
|
|
using OASystem.Infrastructure.Repositories.CRM;
|
|
|
using OASystem.Infrastructure.Repositories.Financial;
|
|
|
using OASystem.Infrastructure.Repositories.Groups;
|
|
@@ -39,6 +40,7 @@ using System.Data;
|
|
|
using System.Diagnostics;
|
|
|
using System.Globalization;
|
|
|
using System.IO.Compression;
|
|
|
+using System.Text.Json.Nodes;
|
|
|
using System.Web;
|
|
|
using static OASystem.API.OAMethodLib.JWTHelper;
|
|
|
using static OASystem.Infrastructure.Repositories.Groups.AirTicketResRepository;
|
|
@@ -4254,7 +4256,16 @@ FROM
|
|
|
int dataId = groupData.Data.GetType().GetProperty("dataId").GetValue(groupData.Data, null);
|
|
|
|
|
|
//自动审核
|
|
|
- var autoAdit = await _feeAuditRep.FeeAutomaticAudit(5, diId, dataId);
|
|
|
+ var autoAdit = await _feeAuditRep.FeeAutomaticAudit(5, diId, dataId); //机票费用合计方式
|
|
|
+
|
|
|
+ #region 舱位单价方式
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
await AppNoticeLibrary.SendChatMsg_GroupStatus_ApplyFee(ccpId, sign, QiyeWeChatEnum.GuoJiaoLeaderChat);
|
|
@@ -4282,9 +4293,101 @@ FROM
|
|
|
return Ok(JsonView(true, groupData.Msg, groupData.Data));
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 机票费用自动审核 AI识别方式
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task<(bool, string)> AirTicketResAutoAudit(int diId,int dataId)
|
|
|
+ {
|
|
|
+ var auditFeeTypeIds = new List<int>() {
|
|
|
+ 457, //头等舱
|
|
|
+ 458, //公务舱
|
|
|
+ 459, //超经舱
|
|
|
+ 460, //经济舱
|
|
|
+ 1430, //公务舱(实际经济舱)
|
|
|
+ 1431, //头等舱(实际公务舱)
|
|
|
+ 1432, //头等舱(实际经济舱)
|
|
|
+ };
|
|
|
+
|
|
|
+ int currModule = 85;
|
|
|
+ var airInfo = await _sqlSugar.Queryable<Grp_AirTicketReservations>()
|
|
|
+ .InnerJoin<Grp_CreditCardPayment>((x, y) => x.Id == y.CId && y.CTable == currModule && y.IsDel == 0)
|
|
|
+ .Where((x, y) => x.Id == dataId && x.IsDel == 0 && auditFeeTypeIds.Contains(x.CType))
|
|
|
+ .Select((x, y) => new {
|
|
|
+ x.Id,
|
|
|
+ CcpId = y.Id,
|
|
|
+ x.FlightsDate,
|
|
|
+ x.Price,
|
|
|
+ x.CType,
|
|
|
+ x.ClientNum,
|
|
|
+ x.DIId
|
|
|
+ })
|
|
|
+ .FirstAsync();
|
|
|
+ if (airInfo == null) return (false, "机票信息为空或费用类型不在自动审核范围内,不可自动审核!");
|
|
|
+
|
|
|
+ var groupDetails = await _sqlSugar.Queryable<Grp_DelegationInfo>().FirstAsync(x => x.IsDel == 0 && x.Id == diId);
|
|
|
+ if (groupDetails == null) return (false, "团组信息为空,不可自动审核!");
|
|
|
+
|
|
|
+ var groupCostInfo = await _sqlSugar.Queryable<Grp_GroupCostParameter>().FirstAsync(x => x.IsDel == 0 && x.DiId == diId);
|
|
|
+ if (groupCostInfo == null) return (false, "团组成本信息未填写!");
|
|
|
+
|
|
|
+ var groupCostContents = await _sqlSugar
|
|
|
+ .SqlQueryable<GroupCostAuditView>($"Select * From Grp_GroupCost")
|
|
|
+ .Where(x => x.IsDel == 0 && x.Diid == diId)
|
|
|
+ .ToListAsync();
|
|
|
+ if (groupCostContents.Count < 1) return (false, "团组成本信息未填写!");
|
|
|
+
|
|
|
+ //处理 成本详细信息日期为空 填装费用信息
|
|
|
+ var airFeeLabel = new StringBuilder();
|
|
|
+ for (int i = 0; i < groupCostContents.Count; i++)
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(groupCostContents[i].Date))
|
|
|
+ {
|
|
|
+ int index = i - 1;
|
|
|
+ if (index >= 0)
|
|
|
+ {
|
|
|
+ groupCostContents[i].Date = groupCostContents[index].Date;
|
|
|
+ var dtBool = DateTime.TryParse(groupCostContents[i].Date, out DateTime _dateTime);
|
|
|
+ if (dtBool) groupCostContents[i].CurrTime = _dateTime;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var dtBool = DateTime.TryParse(groupCostContents[i].Date, out DateTime _dateTime);
|
|
|
+ if (dtBool) groupCostContents[i].CurrTime = _dateTime;
|
|
|
+ }
|
|
|
+
|
|
|
+ var item = groupCostContents[i];
|
|
|
+ airFeeLabel.AppendLine($"{item.Date}");
|
|
|
+ airFeeLabel.AppendLine($"{item.ITIN.Replace("\n"," ")}");
|
|
|
+ }
|
|
|
+ airFeeLabel.AppendLine($"注:费用:位置:航班号或者航班时间后面; 组成:经济舱/公务舱;");
|
|
|
+ airFeeLabel.AppendLine($"取出{airInfo.FlightsDate}费用金额,按照经济舱/公务舱格式返回,如果不存在的话则返回0.00/0.00,只返回金额格式文本;不需要其他文字描述;");
|
|
|
+
|
|
|
+ //访问Kimi AI 返回价格结果
|
|
|
+ var msgs = new List<SeedMessages>()
|
|
|
+ {
|
|
|
+ new ()
|
|
|
+ {
|
|
|
+ Role = KimiRole.user,
|
|
|
+ Content = airFeeLabel.ToString()
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ KiMiApiClient client = new KiMiApiClient();
|
|
|
+ var kimiApiResult = await client.SeedMessage(msgs);
|
|
|
+ var kimiApiResult_JObject = JObject.Parse(kimiApiResult);
|
|
|
+ string clients = kimiApiResult_JObject["content"].ToString();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return (false,"不可自动审核!");
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 机票费用录入
|
|
|
- /// 自动审核测试
|
|
|
+ /// 自动审核测试 - AI 识别
|
|
|
/// </summary>
|
|
|
/// <param name="groupId"></param>
|
|
|
/// <param name="Id"></param>
|
|
@@ -4293,9 +4396,9 @@ FROM
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> AirTicketResAutoAuditTest(int groupId, int Id)
|
|
|
{
|
|
|
- var autoAdit = await _feeAuditRep.FeeAutomaticAudit(5, groupId, Id);
|
|
|
+ (bool status,string msg) = await AirTicketResAutoAudit(groupId, Id);
|
|
|
|
|
|
- return Ok(JsonView(true, autoAdit.Msg, autoAdit.Data));
|
|
|
+ return Ok(JsonView(status, msg));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|