|
|
|
@ -7,7 +7,6 @@ import com.bsd.cases.mapper.*;
|
|
|
|
|
import com.bsd.cases.model.*;
|
|
|
|
|
import com.bsd.cases.service.CaseContentService;
|
|
|
|
|
import com.bsd.cases.service.CaseUsersService;
|
|
|
|
|
import com.bsd.cases.util.AjaxRequest;
|
|
|
|
|
import com.bsd.cases.util.AjaxResult;
|
|
|
|
|
import com.bsd.cases.util.PageAjax;
|
|
|
|
|
import com.bsd.cases.util.PageUtils;
|
|
|
|
@ -16,12 +15,12 @@ import com.bsd.cases.vo.CaseContentDetailBakVo;
|
|
|
|
|
import com.bsd.cases.vo.CaseContentDetailVo;
|
|
|
|
|
import com.bsd.cases.vo.CaseContentVo;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -52,6 +51,7 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取文章列表
|
|
|
|
|
*
|
|
|
|
|
* @param categoryId
|
|
|
|
|
* @param pageNum
|
|
|
|
|
* @param pageSize
|
|
|
|
@ -97,11 +97,12 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查看文章详情
|
|
|
|
|
*
|
|
|
|
|
* @param contentId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public CaseContentDetailVo getContentDetailByContentId(Long contentId) {
|
|
|
|
|
public CaseContentDetailVo getContentDetailByContentId(Long contentId) throws UnsupportedEncodingException {
|
|
|
|
|
|
|
|
|
|
CaseUsers caseUsers = caseUsersService.currentUser();
|
|
|
|
|
CaseContentView newCaseContentView = new CaseContentView();
|
|
|
|
@ -130,7 +131,8 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
|
CaseContent caseContent = caseContentMapper.selectByPrimaryKey(contentId);
|
|
|
|
|
CaseContentDetailVo caseContentDetailVo = new CaseContentDetailVo();
|
|
|
|
|
caseContentDetailVo.setId(contentId);
|
|
|
|
|
caseContentDetailVo.setContent(caseContent.getContent());
|
|
|
|
|
String content = new String(caseContent.getContent(), "utf8");
|
|
|
|
|
caseContentDetailVo.setContent(content);
|
|
|
|
|
caseContentDetailVo.setCategoryId(caseContent.getCategoryId());
|
|
|
|
|
CaseCategory caseCategory = caseCategoryMapper.selectByPrimaryKey(caseContent.getCategoryId());
|
|
|
|
|
caseContentDetailVo.setCategoryName(caseCategory.getName());
|
|
|
|
@ -169,6 +171,7 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新或者新增文章
|
|
|
|
|
*
|
|
|
|
|
* @param jsonObject
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -208,7 +211,7 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
|
CaseContent caseContent = new CaseContent();
|
|
|
|
|
caseContent.setContentTitle(contentTitle);
|
|
|
|
|
caseContent.setCategoryId(categoryId);
|
|
|
|
|
caseContent.setContent(content);
|
|
|
|
|
caseContent.setContent(content.getBytes());
|
|
|
|
|
caseContent.setUrl(url);
|
|
|
|
|
caseContent.setCreateDateTime(new Date());
|
|
|
|
|
caseContent.setUpdateDateTime(new Date());
|
|
|
|
@ -237,7 +240,7 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
|
caseContent.setUrl(url);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(content)) {
|
|
|
|
|
caseContent.setContent(content);
|
|
|
|
|
caseContent.setContent(content.getBytes());
|
|
|
|
|
}
|
|
|
|
|
if (null != categoryId) {
|
|
|
|
|
caseContent.setCategoryId(categoryId);
|
|
|
|
@ -317,6 +320,7 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除文章
|
|
|
|
|
*
|
|
|
|
|
* @param contentId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -346,13 +350,14 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public CaseContentDetailBakVo getCaseContentDetailBakVoByContentID(Long contentId) {
|
|
|
|
|
public CaseContentDetailBakVo getCaseContentDetailBakVoByContentID(Long contentId) throws UnsupportedEncodingException {
|
|
|
|
|
|
|
|
|
|
CaseContent caseContent = caseContentMapper.selectByPrimaryKey(contentId);
|
|
|
|
|
CaseContentDetailBakVo caseContentDetailBakVo = new CaseContentDetailBakVo();
|
|
|
|
|
caseContentDetailBakVo.setId(contentId);
|
|
|
|
|
caseContentDetailBakVo.setCategoryId(caseContent.getCategoryId());
|
|
|
|
|
caseContentDetailBakVo.setContent(caseContent.getContent());
|
|
|
|
|
String content = new String(caseContent.getContent(), "UTF-8");
|
|
|
|
|
caseContentDetailBakVo.setContentStr(content);
|
|
|
|
|
caseContentDetailBakVo.setContentTitle(caseContent.getContentTitle());
|
|
|
|
|
caseContentDetailBakVo.setUrl(caseContent.getUrl());
|
|
|
|
|
caseContentDetailBakVo.setState(caseContent.getState());
|
|
|
|
|