xw hai 2 días
pai
achega
c49a0fc768

+ 24 - 0
fs-service/src/main/java/com/fs/qw/service/AsyncQwAiChatSopService.java

@@ -209,6 +209,8 @@ public class AsyncQwAiChatSopService {
 
                     }
 
+                    fillFileNameForFileSetting(setting);
+
                     settingList.add(setting);
 
                     QwSopTempSetting.Content clonedContent=new QwSopTempSetting.Content();
@@ -253,6 +255,28 @@ public class AsyncQwAiChatSopService {
             }
         }
     }
+
+    /** contentType=5 时若没有 fileName,则从 fileUrl 取最后一段文件名,使 content_json 与完课福利等场景字段一致 */
+    private void fillFileNameForFileSetting(QwSopTempSetting.Content.Setting setting) {
+        if (setting == null || !"5".equals(setting.getContentType())) {
+            return;
+        }
+        if (StringUtils.isNotBlank(setting.getFileName()) || StringUtils.isBlank(setting.getFileUrl())) {
+            return;
+        }
+        String fileUrl = setting.getFileUrl();
+        int slash = fileUrl.lastIndexOf('/');
+        if (slash < 0 || slash >= fileUrl.length() - 1) {
+            return;
+        }
+        String name = fileUrl.substring(slash + 1);
+        int q = name.indexOf('?');
+        if (q >= 0) {
+            name = name.substring(0, q);
+        }
+        setting.setFileName(name);
+    }
+
     //插入观看记录
     private Long addWatchLogIfNeededByNewChat(String sopId, Integer videoId, Integer courseId,
                                      Long fsUserId, Long qwUserId, Long companyUserId,

+ 4 - 0
fs-service/src/main/java/com/fs/qw/vo/QwSopTempSetting.java

@@ -121,6 +121,8 @@ public class QwSopTempSetting implements Serializable{
 
             //文件地址
             private String fileUrl;
+            //文件名称
+            private String fileName;
             //视频地址
             private String videoUrl;
             //语音地址
@@ -181,6 +183,8 @@ public class QwSopTempSetting implements Serializable{
                     clone.setMiniprogramTitle(this.getMiniprogramTitle());
                     clone.setMiniprogramPicUrl(this.getMiniprogramPicUrl());
                     clone.setMiniprogramPage(this.getMiniprogramPage());
+                    clone.setFileUrl(this.getFileUrl());
+                    clone.setFileName(this.getFileName());
                     return clone;
                 } catch (CloneNotSupportedException e) {
                     throw new AssertionError();