Selaa lähdekoodia

富文本中的图片获取临时地址错误修复

lizhenhao 2 vuotta sitten
vanhempi
commit
69e1ea25b5

+ 2 - 0
jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/mapper/NotifyMapper.java

@@ -47,4 +47,6 @@ public interface NotifyMapper extends BaseMapper <Notify> {
 
     void updateStatusById(@Param ( "id" ) String id, @Param ( "status" ) String status);
 
+    void updateContentById(@Param ( "content" ) String content, @Param ( "id" ) String id);
+
 }

+ 4 - 0
jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/mapper/xml/NotifyMapper.xml

@@ -214,4 +214,8 @@
         update plugin_notify set status = #{status} where id = #{id}
     </update>
 
+    <update id="updateContentById">
+        update plugin_notify set content = #{content} where id = #{id}
+    </update>
+
 </mapper>

+ 6 - 1
jeeplus-plugins/jeeplus-notify/src/main/java/com/jeeplus/notify/service/NotifyService.java

@@ -77,6 +77,9 @@ public class NotifyService extends ServiceImpl <NotifyMapper, Notify> {
     @Resource
     private PluginNotifyCommentsMapper commentsMapper;
 
+    @Resource
+    private NotifyMapper notifyMapper;
+
     /**
      * 根据id获取通知
      */
@@ -112,7 +115,9 @@ public class NotifyService extends ServiceImpl <NotifyMapper, Notify> {
             // 1. 将富文本中的临时图片地址更换为新的
             // 2. 获取富文本中的图片信息
             if(StringUtils.isNotBlank(notifyDTO.getContent())){
-                notifyDTO.setContent(editorFilesService.getNewContent(notifyDTO.getContent(), id));
+                String newContent = editorFilesService.getNewContent(notifyDTO.getContent(), id);
+                notifyMapper.updateContentById(newContent,id);
+                notifyDTO.setContent(newContent);
                 List<EditorFiles> list = editorFilesService.list(new QueryWrapper<EditorFiles>().lambda().eq(EditorFiles::getSourceId, id));
                 List<EditorFilesDTO> editorFilesDTOList = new ArrayList<>();
                 list.stream().forEach(item->{