上传,文章修改

This commit is contained in:
lee 2024-07-04 10:30:02 +08:00
parent 7569abc76a
commit d22e0102fe
2 changed files with 10 additions and 10 deletions

View File

@ -84,7 +84,7 @@ public class CommonController
String url = serverConfig.getUrl() + fileName; String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("url", url); ajax.put("url", url);
ajax.put("fileName", url); ajax.put("fileName", fileName);
ajax.put("newFileName", FileUtils.getName(fileName)); ajax.put("newFileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename()); ajax.put("originalFilename", file.getOriginalFilename());
return ajax; return ajax;

View File

@ -1,9 +1,7 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.ArrayList; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
import cn.hutool.cache.Cache; import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil; import cn.hutool.cache.CacheUtil;
@ -162,13 +160,15 @@ public class CmsArticleServiceImpl implements ICmsArticleService
@Override @Override
public int insertCmsArticle(CmsArticle cmsArticle) 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(); SysUser user = SecurityUtils.getLoginUser().getUser();
cmsArticle.setYhid(user.getUserId().toString()); cmsArticle.setYhid(user.getUserId().toString());
cmsArticle.setDeleted(0); cmsArticle.setDeleted(0);
cmsArticle.setTopFlag(1); cmsArticle.setTopFlag(1);
cmsArticle.setAvailable(1); cmsArticle.setAvailable(1);
cmsArticle.setPublishTime(DateUtils.getTime()); // cmsArticle.setPublishTime(DateUtils.getTime());
String tags = cmsArticle.getTags(); String tags = cmsArticle.getTags();
if (StringUtils.isNotEmpty(tags)) { // 判断标签字符串是否不为空 if (StringUtils.isNotEmpty(tags)) { // 判断标签字符串是否不为空
if (tags.endsWith(",")) { // 如果标签字符串末尾有逗号则移除逗号 if (tags.endsWith(",")) { // 如果标签字符串末尾有逗号则移除逗号
@ -201,8 +201,8 @@ public class CmsArticleServiceImpl implements ICmsArticleService
newAticle.setDeleted(0); newAticle.setDeleted(0);
newAticle.setTopFlag(1); newAticle.setTopFlag(1);
newAticle.setAvailable(1); newAticle.setAvailable(1);
newAticle.setPublishTime(DateUtils.getTime()); // newAticle.setPublishTime(DateUtils.getTime());
newAticle.setCreateTime(DateUtils.getNowDate()); newAticle.setCreateTime(cmsArticle.getCreateTime());
newAticle.setCoverImage(cmsArticle.getCoverImage()); newAticle.setCoverImage(cmsArticle.getCoverImage());
cmsArticleMapper.insertCmsArticle(newAticle); cmsArticleMapper.insertCmsArticle(newAticle);
CmsArticleContent cmsArticleContent = new CmsArticleContent(); CmsArticleContent cmsArticleContent = new CmsArticleContent();
@ -234,7 +234,7 @@ public class CmsArticleServiceImpl implements ICmsArticleService
cmsArticle.setDeleted(0); cmsArticle.setDeleted(0);
cmsArticle.setTopFlag(1); cmsArticle.setTopFlag(1);
cmsArticle.setAvailable(1); cmsArticle.setAvailable(1);
cmsArticle.setPublishTime(DateUtils.getTime()); // cmsArticle.setCreateTime(DateUtils.getTime());
cmsArticleMapper.updateCmsArticle(cmsArticle); cmsArticleMapper.updateCmsArticle(cmsArticle);
CmsArticleContent cmsArticleContent = contentMapper.selectCmsArticleContentById(String.valueOf(cmsArticle.getId())); CmsArticleContent cmsArticleContent = contentMapper.selectCmsArticleContentById(String.valueOf(cmsArticle.getId()));
cmsArticleContent.setContent(cmsArticle.getContent()); cmsArticleContent.setContent(cmsArticle.getContent());