yuanrf 1 dag geleden
bovenliggende
commit
33bcc1bedd

+ 57 - 1
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -13867,8 +13867,64 @@ FROM
                 x => string.Join("\r\n", x.Select(y => $"{y.具体时间} {y.行程安排}".Trim()))
             );
 
-            return Ok(JsonView(true, "团组行程信息导出成功!", grouopTraveListByStr));
+            var groupTraveListByKey = grouopTraveListByStr.Select(x => new
+            {
+                key = x.Key,
+                value = x.Value,
+            }
+            ).ToList();
+
+
+            var blackCode = await _sqlSugar.Queryable<Air_TicketBlackCode>()
+            .Where(x => x.IsDel == 0 && x.Id == dto.BlackCodeId)
+            .FirstAsync();
+
+            if (blackCode == null)
+            {
+                jw.Msg = "黑屏代码不存在!";
+                return Ok(jw);
+            }
+
+            string chat = string.Empty;
+            var templateSetting = await _sqlSugar
+            .Queryable<Sys_SetData>()
+            .FirstAsync(x => x.Id == 1553 && x.IsDel == 0);
+
+            if (templateSetting != null && !string.IsNullOrEmpty(templateSetting.Remark))
+            {
+                var stringFormatResp = await GeneralMethod.StringFormatAsync(new StringFormatDto
+                {
+                    FormatTemplate = templateSetting.Remark,
+                    Parameters = new List<string> {
+                            JsonConvert.SerializeObject(groupTraveListByKey),
+                            blackCode.BlackCode,
+                        }
+                });
+
+                if (stringFormatResp.Success)
+                {
+                    chat = stringFormatResp.FormattedResult;
+                }
+                else
+                {
+                    jw.Msg = "对话内容模板格式化失败! templateSetting.Id: " + templateSetting.Id + ",错误:" + stringFormatResp.Message;
+                    return Ok(jw);
+                }
+            }
+            else
+            {
+                jw.Msg = "获取对话内容模板失败! templateSetting.Id: " + templateSetting.Id;
+                return Ok(jw);
+            }
+
+            var chatResult = await _doubaoService.CompleteChatAsync(new List<DouBaoChatMessage> { new DouBaoChatMessage { Role = DouBaoRole.user, Content = chat } });
+            if (string.IsNullOrEmpty(chatResult))
+            {
+                jw.Msg = "行程框架导出失败!";
+                return Ok(jw);
+            }
 
+            return Ok(JsonView(true, "行程框架导出成功!", chatResult));
         }
 
         #endregion

+ 1 - 1
OASystem/OASystem.Api/OAMethodLib/DoubaoAPI/DoubaoService.cs

@@ -40,7 +40,7 @@ namespace OASystem.API.OAMethodLib.DoubaoAPI
             options ??= new CompleteChatOptions();
             var httpClient = _httpClientFactory.CreateClient("Doubao");
             httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _doubaoSetting.ApiKey);
-            httpClient.Timeout.Add(TimeSpan.FromMinutes(10));
+            httpClient.Timeout = TimeSpan.FromMinutes(10);
 
             var body = new Dictionary<string, object>
             {

+ 2 - 0
OASystem/OASystem.Domain/Dtos/Groups/InvitationOfficialActivitiesListDto.cs

@@ -249,5 +249,7 @@ namespace OASystem.Domain.Dtos.Groups
     public class BusinessJourneyFileDownDto
     {
         public int Diid { get; set; }
+
+        public int BlackCodeId { get; set; }
     }
 }