From 49dbcdadd860b7613063ee618fbe38a0593d5bd9 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 11 Jul 2022 15:45:29 +0800
Subject: [PATCH] fix
---
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java | 47 ++++++++++++++++++++++++-----------------------
1 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
index d64310a..f6af191 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java
@@ -69,24 +69,19 @@
if(StrUtil.isNotEmpty(title)){
articleEntity.setTitle(title);
}
- Integer contentType = adminArticleDto.getContentType() == null ? 0 : adminArticleDto.getContentType();
- if(contentType != 0){
- QueryWrapper<ColumnEntity> objectQueryWrapper = new QueryWrapper<>();
- objectQueryWrapper.eq("content_type",contentType);
- List<ColumnEntity> columnEntities = columnMapper.selectList(objectQueryWrapper);
- if(CollUtil.isNotEmpty(columnEntities)){
- List<Long> columIds = new ArrayList<>();
- for(ColumnEntity columnEntity : columnEntities){
- Long id = columnEntity.getId();
- columIds.add(id);
- }
- articleEntity.setColumnIds(columIds);
- }
- }
+
if(UserEntity.USER_BELONG_TOP != companyId){
articleEntity.setCompanyId(companyId);
}
IPage<AdminArticleVo> list = this.baseMapper.selectAdminArticleInPage(page,articleEntity);
+ if (CollUtil.isNotEmpty(list.getRecords())) {
+ for (AdminArticleVo record : list.getRecords()) {
+ // 站内
+ if (record.getType() == 1) {
+ record.setArticleUrl(record.getBaseUrl() + record.getPath() + "/" + record.getId() + ".html");
+ }
+ }
+ }
return Result.ok(list);
}
@@ -120,14 +115,14 @@
String atlas = adminAddArticleDto.getAtlas();
articleEntity.setAtlas(atlas);
Date releaseTime = adminAddArticleDto.getReleaseTime();
+ if (releaseTime == null) {
+ releaseTime = new Date();
+ }
articleEntity.setReleaseTime(releaseTime);
Integer isTop = adminAddArticleDto.getIsTop();
articleEntity.setIsTop(isTop);
Integer releaseStatus = adminAddArticleDto.getReleaseStatus();
articleEntity.setReleaseStatus(releaseStatus);
- if(ArticleEntity.RELEASE_STATUS_YES == releaseStatus){
- articleEntity.setReleaseTime(new Date());
- }
String articleDetails = adminAddArticleDto.getArticleDetails();
articleEntity.setArticleDetails(articleDetails);
String uploadFile = adminAddArticleDto.getUploadFile();
@@ -186,7 +181,12 @@
if(ObjectUtil.isEmpty(columnEntity)){
return Result.fail("请选择文章栏目");
}
+
+ if (!articleEntity.getColumnId().equals(columnId) && articleEntity.getBeforeColumnId() == -1) {
+ articleEntity.setBeforeColumnId(articleEntity.getColumnId());
+ }
articleEntity.setColumnId(columnId);
+
Integer visits = adminUpdateArticleDto.getVisits() == null ? 0 : adminUpdateArticleDto.getVisits();
articleEntity.setVisits(visits);
String mainDiagram = adminUpdateArticleDto.getMainDiagram();
@@ -199,9 +199,6 @@
}
Integer releaseStatus = adminUpdateArticleDto.getReleaseStatus();
articleEntity.setReleaseStatus(releaseStatus);
- if(ArticleEntity.RELEASE_STATUS_YES == releaseStatus){
- articleEntity.setReleaseTime(new Date());
- }
String articleDetails = adminUpdateArticleDto.getArticleDetails();
articleEntity.setArticleDetails(articleDetails);
String uploadFile = adminUpdateArticleDto.getUploadFile();
@@ -210,6 +207,7 @@
articleEntity.setArticleUrl(adminUpdateArticleDto.getArticleUrl());
articleEntity.setType(adminUpdateArticleDto.getType());
articleEntity.setContentType(adminUpdateArticleDto.getContentType());
+
String authorBelong = adminUpdateArticleDto.getAuthorBelong();
articleEntity.setAuthorBelong(authorBelong);
this.baseMapper.updateById(articleEntity);
@@ -240,6 +238,8 @@
}
articleEntity.setReleaseStatus(ArticleEntity.RELEASE_STATUS_NO);
this.baseMapper.updateById(articleEntity);
+
+ releaseService.releaseColumn(articleEntity.getColumnId(), 2, articleEntity.getCompanyId());
return Result.ok("操作成功");
}
@@ -297,15 +297,16 @@
@Override
public Result updateStatusOn(Long id) {
+ Long companyId = LoginUserUtil.getCompanyId();
ArticleEntity articleEntity = this.baseMapper.selectById(id);
if(ObjectUtil.isEmpty(articleEntity)){
return Result.fail("文章不存在");
}
articleEntity.setReleaseStatus(ArticleEntity.RELEASE_STATUS_YES);
- articleEntity.setReleaseTime(new Date());
+ articleEntity.setBeforeColumnId(null);
this.baseMapper.updateById(articleEntity);
- releaseService.releaseArticle(articleEntity.getId());
+ releaseService.releaseArticle(articleEntity.getId(), companyId);
return Result.ok("操作成功");
}
@@ -314,7 +315,7 @@
Long companyId = 0L;
if(CollUtil.isNotEmpty(companyEntities)){
for(CompanyEntity companyEntity : companyEntities){
- boolean contains = StrUtil.contains(website, companyEntity.getWebAddress());
+ boolean contains = StrUtil.contains(companyEntity.getWebAddress(), website);
if(contains){
companyId = companyEntity.getId();
}
--
Gitblit v1.9.1