|
|
@ -20,6 +20,7 @@ import com.gxwebsoft.common.core.utils.RedisUtil; |
|
|
|
import com.gxwebsoft.common.core.web.PageParam; |
|
|
|
import com.gxwebsoft.common.core.web.PageResult; |
|
|
|
import com.gxwebsoft.common.system.service.UserService; |
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
@ -41,12 +42,11 @@ import static com.gxwebsoft.common.core.constants.ArticleConstants.CACHE_KEY_ART |
|
|
|
@Service |
|
|
|
public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArticle> implements CmsArticleService { |
|
|
|
@Resource |
|
|
|
@Lazy |
|
|
|
private CmsNavigationService cmsNavigationService; |
|
|
|
@Resource |
|
|
|
private CmsArticleContentService cmsArticleContentService; |
|
|
|
@Resource |
|
|
|
private CmsArticleContentService articleContentService; |
|
|
|
@Resource |
|
|
|
private UserService userService; |
|
|
|
@Resource |
|
|
|
private CmsModelService cmsModelService; |
|
|
@ -122,7 +122,7 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti |
|
|
|
// article.setBanner(model.getBanner());
|
|
|
|
// }
|
|
|
|
// 附加文字内容
|
|
|
|
CmsArticleContent content = articleContentService.getOne(new LambdaQueryWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, article.getArticleId()).last("limit 1")); |
|
|
|
CmsArticleContent content = cmsArticleContentService.getOne(new LambdaQueryWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, article.getArticleId()).last("limit 1")); |
|
|
|
if (content != null) { |
|
|
|
article.setContent(content.getContent()); |
|
|
|
} |
|
|
@ -172,9 +172,9 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti |
|
|
|
content.setArticleId(article.getArticleId()); |
|
|
|
content.setContent(article.getContent()); |
|
|
|
content.setTenantId(article.getTenantId()); |
|
|
|
articleContentService.save(content); |
|
|
|
cmsArticleContentService.save(content); |
|
|
|
// 同步翻译并保存
|
|
|
|
articleContentService.translate(article); |
|
|
|
cmsArticleContentService.translate(article); |
|
|
|
return true; |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
@ -221,11 +221,11 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti |
|
|
|
String key = CACHE_KEY_ARTICLE + article.getArticleId(); |
|
|
|
redisUtil.delete(key); |
|
|
|
// 更新内容
|
|
|
|
final boolean update = articleContentService.update(new LambdaUpdateWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, article.getArticleId()).set(CmsArticleContent::getContent, article.getContent())); |
|
|
|
final boolean update = cmsArticleContentService.update(new LambdaUpdateWrapper<CmsArticleContent>().eq(CmsArticleContent::getArticleId, article.getArticleId()).set(CmsArticleContent::getContent, article.getContent())); |
|
|
|
if (update) { |
|
|
|
// 同步翻译并保存
|
|
|
|
article.setIsUpdate(true); |
|
|
|
articleContentService.translate(article); |
|
|
|
cmsArticleContentService.translate(article); |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
// 添加内容
|
|
|
@ -233,7 +233,7 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti |
|
|
|
content.setArticleId(article.getArticleId()); |
|
|
|
content.setContent(article.getContent()); |
|
|
|
content.setTenantId(article.getTenantId()); |
|
|
|
articleContentService.save(content); |
|
|
|
cmsArticleContentService.save(content); |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|