From 05f3eec8ba39fb05eac09d8d3f2930cd77dd41f7 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 12 Jul 2022 11:39:30 +0800
Subject: [PATCH] 20220606
---
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ArticleServiceImpl.java | 56 +++++++++++++++++++++++++++++---------------------------
1 files changed, 29 insertions(+), 27 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 ce04c47..eaf6ad1 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
@@ -1,6 +1,7 @@
package com.xcong.farmer.cms.modules.system.service.Impl;
import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
@@ -55,12 +56,12 @@
long companyId = userlogin.getCompanyId() == null ? UserEntity.USER_BELONG_TOP : userlogin.getCompanyId();
Page<AdminArticleVo> page = new Page<>(adminArticleDto.getPageNum(), adminArticleDto.getPageSize());
ArticleEntity articleEntity = new ArticleEntity();
- String columnIdStr = adminArticleDto.getColumnIdStr();
- if(StrUtil.isNotEmpty(columnIdStr)){
- long[] columnIdLongs = StrUtil.splitToLong(columnIdStr, StrUtil.COMMA);
+ String columnIdStrs = adminArticleDto.getColumnIdStr();
+ if(StrUtil.isNotEmpty(columnIdStrs)){
+ String[] columnIdStr = columnIdStrs.split(StringPool.COMMA);
List<Long> columnList = new ArrayList<>();
- for(long columnIdLong : columnIdLongs){
- columnList.add(columnIdLong);
+ for(String columnIdString : columnIdStr){
+ columnList.add(Long.valueOf(columnIdString));
}
articleEntity.setColumnList(columnList);
}
@@ -68,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);
}
@@ -124,9 +120,6 @@
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();
@@ -198,9 +191,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();
@@ -286,7 +276,20 @@
if(UserEntity.USER_BELONG_TOP != companyId){
articleEntity.setCompanyId(companyId);
}
+ String timeType = webArticleInPageDto.getTimeType();
+ if(StrUtil.isNotEmpty(timeType)){
+ articleEntity.setTimeType(timeType);
+ }
IPage<WebArticleVo> list = this.baseMapper.selectWebArticleInPage(page,articleEntity);
+
+ if (CollUtil.isNotEmpty(list.getRecords())) {
+ for (WebArticleVo record : list.getRecords()) {
+ // 站内
+ if (record.getType() == 1) {
+ record.setArticleUrl(record.getBaseUrl() + record.getPath() + "/" + record.getId() + ".html");
+ }
+ }
+ }
return Result.ok(list);
}
@@ -297,7 +300,6 @@
return Result.fail("文章不存在");
}
articleEntity.setReleaseStatus(ArticleEntity.RELEASE_STATUS_YES);
- articleEntity.setReleaseTime(new Date());
this.baseMapper.updateById(articleEntity);
releaseService.releaseArticle(articleEntity.getId());
@@ -309,7 +311,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