From d22e0102fe6fb921fea412f33c1e62495f48aa75 Mon Sep 17 00:00:00 2001 From: lee <332870766@qq.com> Date: Thu, 4 Jul 2024 10:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0,=E6=96=87=E7=AB=A0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CommonController.java | 2 +- .../service/impl/CmsArticleServiceImpl.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 512e2b22..d58b1078 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -84,7 +84,7 @@ public class CommonController String url = serverConfig.getUrl() + fileName; AjaxResult ajax = AjaxResult.success(); ajax.put("url", url); - ajax.put("fileName", url); + ajax.put("fileName", fileName); ajax.put("newFileName", FileUtils.getName(fileName)); ajax.put("originalFilename", file.getOriginalFilename()); return ajax; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CmsArticleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CmsArticleServiceImpl.java index 47c86925..b6a9c529 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CmsArticleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CmsArticleServiceImpl.java @@ -1,9 +1,7 @@ package com.ruoyi.system.service.impl; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.text.SimpleDateFormat; +import java.util.*; import cn.hutool.cache.Cache; import cn.hutool.cache.CacheUtil; @@ -162,13 +160,15 @@ public class CmsArticleServiceImpl implements ICmsArticleService @Override public int insertCmsArticle(CmsArticle cmsArticle) { - cmsArticle.setCreateTime(DateUtils.getNowDate()); +// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// Date date = simpleDateFormat.parse(cmsArticle.getCreateTime()); +// cmsArticle.setCreateTime(DateUtils.getNowDate()); SysUser user = SecurityUtils.getLoginUser().getUser(); cmsArticle.setYhid(user.getUserId().toString()); cmsArticle.setDeleted(0); cmsArticle.setTopFlag(1); cmsArticle.setAvailable(1); - cmsArticle.setPublishTime(DateUtils.getTime()); +// cmsArticle.setPublishTime(DateUtils.getTime()); String tags = cmsArticle.getTags(); if (StringUtils.isNotEmpty(tags)) { // 判断标签字符串是否不为空 if (tags.endsWith(",")) { // 如果标签字符串末尾有逗号,则移除逗号 @@ -201,8 +201,8 @@ public class CmsArticleServiceImpl implements ICmsArticleService newAticle.setDeleted(0); newAticle.setTopFlag(1); newAticle.setAvailable(1); - newAticle.setPublishTime(DateUtils.getTime()); - newAticle.setCreateTime(DateUtils.getNowDate()); +// newAticle.setPublishTime(DateUtils.getTime()); + newAticle.setCreateTime(cmsArticle.getCreateTime()); newAticle.setCoverImage(cmsArticle.getCoverImage()); cmsArticleMapper.insertCmsArticle(newAticle); CmsArticleContent cmsArticleContent = new CmsArticleContent(); @@ -234,7 +234,7 @@ public class CmsArticleServiceImpl implements ICmsArticleService cmsArticle.setDeleted(0); cmsArticle.setTopFlag(1); cmsArticle.setAvailable(1); - cmsArticle.setPublishTime(DateUtils.getTime()); +// cmsArticle.setCreateTime(DateUtils.getTime()); cmsArticleMapper.updateCmsArticle(cmsArticle); CmsArticleContent cmsArticleContent = contentMapper.selectCmsArticleContentById(String.valueOf(cmsArticle.getId())); cmsArticleContent.setContent(cmsArticle.getContent());