上传,文章修改

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;
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;

View File

@ -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());