package com.qxueyou.scc.portal.homepage.serivce.imp;
|
|
//import com.qxueyou.appraisal.web.homepage.dao.AppraisalBatchDao;
|
|
//import com.qxueyou.appraisal.web.homepage.dao.ArticleDao;
|
//import com.qxueyou.appraisal.web.homepage.dao.ContestsBatchDao;
|
//import com.qxueyou.appraisal.web.homepage.dao.OccupationDao;
|
//import com.qxueyou.appraisal.web.homepage.serivce.IHomepageService;
|
//import com.qxueyou.entity.article.ArticleDO;
|
//import com.qxueyou.util.CollectionUtils;
|
import com.qxueyou.scc.base.util.CollectionUtils;
|
import com.qxueyou.scc.portal.homepage.dao.ArticleDao;
|
import com.qxueyou.scc.portal.homepage.serivce.IHomepageService;
|
import com.qxueyou.scc.portal.information.model.Information;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.data.domain.Sort;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @author ZERO 2021-03-03 09:16
|
*/
|
@Service
|
public class HomepageService implements IHomepageService {
|
|
@Autowired
|
private ArticleDao articleDao;
|
|
// @Autowired
|
// private AppraisalBatchDao batchDao;
|
|
// @Autowired
|
// private ContestsBatchDao batchDao;
|
|
// @Autowired
|
// private OccupationDao occupationDao;
|
|
/**
|
* 获取首页数据
|
*/
|
// @Override
|
// public Map<String, Object> getIndexDetail() {
|
//// System.err.println("================>获取首页数据");
|
// return CollectionUtils.newObjectMap(
|
// "appraisalBatchInfo", batchDao.findBatches(1, 24, null).get("data"), // createTime browseCount dateTime
|
// "occupationInfo", articleDao.findPage(CollectionUtils.newObjectMap("type", "qualifiedSet", "status", ArticleDO.UP_STATUS), 1, 8, "dateTime", Sort.Direction.DESC).get("data"),
|
// "news", articleDao.findPage(CollectionUtils.newObjectMap("type", "policiesRegulations", "status", ArticleDO.UP_STATUS), 1, 8, "dateTime", Sort.Direction.DESC).get("data"));
|
// }
|
|
|
/**
|
* 获取首页标签
|
*/
|
@Override
|
public List<Map<String, Object>> getTabs() {
|
|
boolean exist;
|
List<Map<String, Object>> tabs = new ArrayList<>();
|
|
List<Map<String,String>> sub=new ArrayList<>();
|
|
|
exist = articleDao.exist("examBriefing");
|
if (exist) tabs.add(CollectionUtils.newObjectMap("name", "媒体聚焦", "type", "examBriefing","list",sub));
|
|
exist = articleDao.exist("qualifiedSet");
|
if (exist) tabs.add(CollectionUtils.newObjectMap("name", "华教新鲜事", "type", "qualifiedSet"));
|
|
exist = articleDao.exist("policiesRegulations");
|
if (exist) tabs.add(CollectionUtils.newObjectMap("name", "新闻中心", "type", "policiesRegulations"));
|
|
exist = articleDao.exist("examinationGuide");
|
if (exist) tabs.add(CollectionUtils.newObjectMap("name", "专家风采", "type", "examinationGuide"));
|
|
exist = articleDao.exist("popularInformation");
|
if (exist) tabs.add(CollectionUtils.newObjectMap("name", "联系我们", "type", "popularInformation"));
|
|
exist =articleDao.existsubColumn("examBriefing","introduce");
|
if(exist) sub.add(CollectionUtils.newStringMap("name", "海外资讯", "subColumn", "introduce") );
|
|
exist =articleDao.existsubColumn("examBriefing","contestFile");
|
if(exist) sub.add(CollectionUtils.newStringMap("name", "海外资讯", "subColumn", "contestFile"));
|
|
exist =articleDao.existsubColumn("examBriefing","previousContest");
|
if(exist) sub.add(CollectionUtils.newStringMap("name", "往届大赛", "subColumn", "previousContest"));
|
|
return tabs;
|
}
|
|
/**
|
* 获取文章列表
|
*/
|
@Override
|
public Map<String, Object> getArticle(String type,String subColumn,String numbers,int page, int size, String keyword) {
|
return articleDao.moreOccupation(type,subColumn,numbers,page, size, keyword);
|
}
|
|
|
/**
|
* @param id
|
* @return
|
*/
|
|
@Override
|
public Map<String, Object> getArticleDetail(String id) {
|
|
//inc浏览数
|
articleDao.incBrowseCount(id);
|
|
Information article = articleDao.read(Information.class,id);
|
|
Map<String, Object> data = CollectionUtils.newObjectMap(
|
"title", article.getTitle(),
|
"dateTime", article.getDateTime(),
|
"browseCount", article.getBrowseCount(),
|
"content", article.getContent(),
|
"attachment", article.getAttachment());
|
|
Map<String, Object> preAndBehindArticle = articleDao.getPreAndBehindArticle(id, article.getType());
|
|
|
data.putAll(preAndBehindArticle);
|
|
return data;
|
}
|
|
public Information getArticlesType(String type,String subColumn) {
|
Information articleDO=articleDao.getArticle(type,subColumn);
|
return articleDO;
|
}
|
|
@Override
|
public Map<String, Object> getVideo(String type, String subColumn, int page, int size) {
|
return articleDao.getVideoList(type,subColumn,page, size);
|
}
|
}
|