|
|
@ -3,12 +3,11 @@ package com.bsd.cases.service.impl;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.bsd.cases.constants.Constants;
|
|
|
|
import com.bsd.cases.constants.Constants;
|
|
|
|
import com.bsd.cases.mapper.CaseContentMapper;
|
|
|
|
import com.bsd.cases.mapper.*;
|
|
|
|
import com.bsd.cases.mapper.CaseContentStaticalMapper;
|
|
|
|
import com.bsd.cases.model.*;
|
|
|
|
import com.bsd.cases.model.CaseContent;
|
|
|
|
|
|
|
|
import com.bsd.cases.model.CaseContentStatical;
|
|
|
|
|
|
|
|
import com.bsd.cases.service.CaseContentService;
|
|
|
|
import com.bsd.cases.service.CaseContentService;
|
|
|
|
import com.bsd.cases.util.PageUtils;
|
|
|
|
import com.bsd.cases.util.PageUtils;
|
|
|
|
|
|
|
|
import com.bsd.cases.vo.CaseContentDetailVo;
|
|
|
|
import com.bsd.cases.vo.CaseContentVo;
|
|
|
|
import com.bsd.cases.vo.CaseContentVo;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@ -24,6 +23,13 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
private CaseContentMapper caseContentMapper;
|
|
|
|
private CaseContentMapper caseContentMapper;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private CaseContentStaticalMapper caseContentStaticalMapper;
|
|
|
|
private CaseContentStaticalMapper caseContentStaticalMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private CaseCategoryMapper caseCategoryMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private CaseContentMaterialMapper caseContentMaterialMapper;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private CaseContentAttachmentMapper caseContentAttachmentMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject getContentListByCategoryId(Long categoryId,Integer pageNum,Integer pageSize) {
|
|
|
|
public JSONObject getContentListByCategoryId(Long categoryId,Integer pageNum,Integer pageSize) {
|
|
|
@ -60,4 +66,33 @@ public class CaseContentServiceImpl extends BaseServiceImpl<CaseContentMapper, C
|
|
|
|
jsonObject.put("pages",(int) Math.ceil(Double.valueOf(pageJson.getInteger("total")) / Double.valueOf(pageSize)));
|
|
|
|
jsonObject.put("pages",(int) Math.ceil(Double.valueOf(pageJson.getInteger("total")) / Double.valueOf(pageSize)));
|
|
|
|
return jsonObject;
|
|
|
|
return jsonObject;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public CaseContentDetailVo getContentDetailByContentId(Long contentId) {
|
|
|
|
|
|
|
|
CaseContent caseContent = caseContentMapper.selectByPrimaryKey(contentId);
|
|
|
|
|
|
|
|
CaseContentDetailVo caseContentDetailVo = new CaseContentDetailVo();
|
|
|
|
|
|
|
|
caseContentDetailVo.setId(contentId);
|
|
|
|
|
|
|
|
caseContentDetailVo.setContent(caseContent.getContent());
|
|
|
|
|
|
|
|
caseContentDetailVo.setCategoryId(caseContent.getCategoryId());
|
|
|
|
|
|
|
|
CaseCategory caseCategory = caseCategoryMapper.selectByPrimaryKey(caseContent.getCategoryId());
|
|
|
|
|
|
|
|
caseContentDetailVo.setCategoryName(caseCategory.getName());
|
|
|
|
|
|
|
|
caseContentDetailVo.setUrl(caseContent.getUrl());
|
|
|
|
|
|
|
|
caseContentDetailVo.setContentTitle(caseContent.getContentTitle());
|
|
|
|
|
|
|
|
CaseContentAttachment findCaseContentAttachment = new CaseContentAttachment();
|
|
|
|
|
|
|
|
findCaseContentAttachment.setContentId(contentId);
|
|
|
|
|
|
|
|
findCaseContentAttachment.setState(Constants.STATE_VALID);
|
|
|
|
|
|
|
|
List<CaseContentAttachment> caseContentAttachmentList = caseContentAttachmentMapper.select(findCaseContentAttachment);
|
|
|
|
|
|
|
|
caseContentDetailVo.setCaseContentAttachmentList(caseContentAttachmentList);
|
|
|
|
|
|
|
|
CaseContentMaterial findCaseContentMaterial = new CaseContentMaterial();
|
|
|
|
|
|
|
|
findCaseContentMaterial.setContentId(contentId);
|
|
|
|
|
|
|
|
findCaseContentMaterial.setState(Constants.STATE_VALID);
|
|
|
|
|
|
|
|
List<CaseContentMaterial> caseContentMaterialList = caseContentMaterialMapper.select(findCaseContentMaterial);
|
|
|
|
|
|
|
|
caseContentDetailVo.setCaseContentMaterialList(caseContentMaterialList);
|
|
|
|
|
|
|
|
CaseContentStatical findCaseContentStatical = new CaseContentStatical();
|
|
|
|
|
|
|
|
findCaseContentStatical.setContentId(contentId);
|
|
|
|
|
|
|
|
findCaseContentStatical.setState(Constants.STATE_VALID);
|
|
|
|
|
|
|
|
CaseContentStatical caseContentStatical = caseContentStaticalMapper.selectOne(findCaseContentStatical);
|
|
|
|
|
|
|
|
caseContentDetailVo.setScore(caseContentStatical.getScore());
|
|
|
|
|
|
|
|
return caseContentDetailVo;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|