|
|
|
@ -14,6 +14,7 @@ import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.system.query.QueryRuleEnum; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
import org.jeecg.modules.applet.util.HtmlUtils; |
|
|
|
import org.jeecg.modules.demo.appletArticle.entity.AppletArticle; |
|
|
|
import org.jeecg.modules.demo.appletArticle.service.IAppletArticleService; |
|
|
|
|
|
|
|
@ -96,20 +97,12 @@ public class AppletArticleController extends JeecgController<AppletArticle, IApp |
|
|
|
@RequiresPermissions("appletArticle:applet_article:add") |
|
|
|
@PostMapping(value = "/add") |
|
|
|
public Result<String> add(@RequestBody AppletArticle appletArticle) { |
|
|
|
String content = appletArticle.getContent(); |
|
|
|
if (content != null && !content.trim().isEmpty()) { |
|
|
|
String contentHashcode = HtmlUtils.calculateStringHash(HtmlUtils.stripHtml(content)); |
|
|
|
appletArticle.setContentHashcode(contentHashcode); |
|
|
|
} |
|
|
|
appletArticleService.save(appletArticle); |
|
|
|
|
|
|
|
// 触发长文本TTS生成:遍历所有启用音色,对content进行转换 |
|
|
|
// try { |
|
|
|
// String content = appletArticle.getContent(); |
|
|
|
// if (content != null && !content.trim().isEmpty()) { |
|
|
|
// String code = appletApiTTService.generateLongTextForArticleContentAllTimbres(content); |
|
|
|
// appletArticle.setContentHashcode(code); |
|
|
|
// appletArticleService.updateById(appletArticle); |
|
|
|
// } |
|
|
|
// } catch (Exception e) { |
|
|
|
// log.warn("文章添加后触发长文本TTS失败: {}", e.getMessage()); |
|
|
|
// } |
|
|
|
|
|
|
|
return Result.OK("添加成功!"); |
|
|
|
} |
|
|
|
|
|
|
|
@ -124,16 +117,11 @@ public class AppletArticleController extends JeecgController<AppletArticle, IApp |
|
|
|
@RequiresPermissions("appletArticle:applet_article:edit") |
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
|
|
|
public Result<String> edit(@RequestBody AppletArticle appletArticle) { |
|
|
|
// 触发长文本TTS生成:遍历所有启用音色,对content进行转换 |
|
|
|
// try { |
|
|
|
// String content = appletArticle.getContent(); |
|
|
|
// if (content != null && !content.trim().isEmpty()) { |
|
|
|
// String code = appletApiTTService.generateLongTextForArticleContentAllTimbres(content); |
|
|
|
// appletArticle.setContentHashcode(code); |
|
|
|
// } |
|
|
|
// } catch (Exception e) { |
|
|
|
// log.warn("文章编辑后触发长文本TTS失败: {}", e.getMessage()); |
|
|
|
// } |
|
|
|
String content = appletArticle.getContent(); |
|
|
|
if (content != null && !content.trim().isEmpty()) { |
|
|
|
String contentHashcode = HtmlUtils.calculateStringHash(HtmlUtils.stripHtml(content)); |
|
|
|
appletArticle.setContentHashcode(contentHashcode); |
|
|
|
} |
|
|
|
appletArticleService.updateById(appletArticle); |
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
} |
|
|
|
|