| | |
| | | //import com.qxueyou.appraisal.web.homepage.serivce.IHomepageService; |
| | | //import com.qxueyou.entity.article.ArticleDO; |
| | | //import com.qxueyou.util.CollectionUtils; |
| | | |
| | | import com.querydsl.jpa.impl.JPAQuery; |
| | | import com.qxueyou.scc.admin.classes.service.IClassLectureService; |
| | | import com.qxueyou.scc.admin.progress.dao.ProgressDAO; |
| | | import com.qxueyou.scc.base.service.impl.CommonAppService; |
| | | import com.qxueyou.scc.base.util.CollectionUtils; |
| | | import com.qxueyou.scc.evaluate.service.IEvaluateService; |
| | | import com.qxueyou.scc.operation.topic.service.ITopicService; |
| | | 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 com.qxueyou.scc.teach.res.model.Res; |
| | | import com.qxueyou.scc.teach.res.model.ResLib; |
| | | import com.qxueyou.scc.teach.res.service.IResAudioService; |
| | | import com.qxueyou.scc.teach.subject.model.QSubjectLecture; |
| | | import com.qxueyou.scc.teach.subject.model.SubjectLecture; |
| | | import com.qxueyou.scc.teach.subject.model.view.OpenSubjectV; |
| | | import com.qxueyou.scc.teach.subject.service.ILectureService; |
| | | import com.qxueyou.scc.teach.subject.service.ISubjectService; |
| | | 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; |
| | | import java.util.*; |
| | | |
| | | import static java.util.stream.Collectors.toList; |
| | | |
| | | /** |
| | | * @author ZERO 2021-03-03 09:16 |
| | | */ |
| | | @Service |
| | | public class HomepageService implements IHomepageService { |
| | | public class HomepageService extends CommonAppService implements IHomepageService { |
| | | |
| | | @Autowired |
| | | private ArticleDao articleDao; |
| | | |
| | | // @Autowired |
| | | // private AppraisalBatchDao batchDao; |
| | | @Autowired |
| | | ISubjectService subjectService; |
| | | |
| | | // @Autowired |
| | | // private ContestsBatchDao batchDao; |
| | | @Autowired |
| | | ILectureService lectureService; |
| | | |
| | | // @Autowired |
| | | // private OccupationDao occupationDao; |
| | | @Autowired |
| | | IClassLectureService clsLectureService; |
| | | |
| | | @Autowired |
| | | IResAudioService audioService; |
| | | |
| | | @Autowired |
| | | ProgressDAO progressDao; |
| | | |
| | | @Autowired |
| | | ITopicService topicService; |
| | | |
| | | @Autowired |
| | | IEvaluateService evaluateService; |
| | | |
| | | |
| | | /** |
| | | * 获取首页数据 |
| | | */ |
| | | // @Override |
| | | // public Map<String, Object> getIndexDetail() { |
| | | // |
| | | // List<OpenSubjectV> openSubjectVS = subjectService.listOpenSubjectV(); |
| | | // //华文课堂 |
| | | //// List<String> chineseLanguageClassId= openSubjectVS.stream().filter(openSubjectV -> openSubjectV.getSubjectName().equals("华文课堂")).map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | // //文化中国 |
| | | // List<String> culturalChinaId = openSubjectVS.stream().filter(openSubjectV -> openSubjectV.getSubjectName().equals("文化中国")).map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | // //文化课堂 |
| | | // List<String> culturalClassroomId = openSubjectVS.stream().filter(openSubjectV -> openSubjectV.getSubjectName().equals("文化课堂")).map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | // //实景课堂 |
| | | // List<String> realClassId = openSubjectVS.stream().filter(openSubjectV -> openSubjectV.getSubjectName().equals("实景课堂")).map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | // //中文+职业教育课程 |
| | | // List<String> chineseCourseId = openSubjectVS.stream().filter(openSubjectV -> openSubjectV.getSubjectName().equals("中文职业教育课程")).map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | // |
| | | // StringBuffer hql = new StringBuffer("from SubjectLecture p where deleteFlag is false and status=?"); |
| | | // List<Object> args = CollectionUtils.newList(SubjectLecture.STATUS_DRAFT); |
| | | // List<SubjectLecture> subjectLectureList = find(hql.toString(), args, SubjectLecture.class); |
| | | // |
| | | // //华文课堂 |
| | | //// List<String> shineseLanguageClassResId= subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getSubjectId().equals(chineseLanguageClassId.get(0))).map(SubjectLecture::getResItemId).collect(toList()); |
| | | // //文化中国 |
| | | // List<String> culturalChinaResId = subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getName().equals(culturalChinaId.get(0))).map(SubjectLecture::getResItemId).collect(toList()); |
| | | // //文化课堂 |
| | | // List<String> culturalClassroomResId = subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getName().equals(culturalClassroomId.get(0))).map(SubjectLecture::getResItemId).collect(toList()); |
| | | // //实景课堂 |
| | | // List<String> realClassResId = subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getName().equals(realClassId.get(0))).map(SubjectLecture::getResItemId).collect(toList()); |
| | | // //中文+职业教育课程 |
| | | // List<String> chineseCourseResId = subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getName().equals(chineseCourseId.get(0))).map(SubjectLecture::getResItemId).collect(toList()); |
| | | // StringBuffer hqlRes = new StringBuffer("from Res p where deleteFlag is false and status=?"); |
| | | // List<Res> resList = find(hqlRes.toString(), args, Res.class); |
| | | // ArrayList<Res> shineseLanguageClassRes = new ArrayList<>(); |
| | | // ArrayList<Res> culturalChinaRes = new ArrayList<>(); |
| | | // ArrayList<Res> culturalClassroomRes = new ArrayList<>(); |
| | | // ArrayList<Res> realClassRes = new ArrayList<>(); |
| | | // for (Res res : resList) { |
| | | //// for (String resItemId : shineseLanguageClassResId) { |
| | | //// if (res.getResId().equals(resItemId)) { |
| | | //// shineseLanguageClassRes.add(res); |
| | | //// } |
| | | //// } |
| | | // for (String resItemId : culturalChinaResId) { |
| | | // if (res.getResId().equals(resItemId)) { |
| | | // culturalChinaRes.add(res); |
| | | // } |
| | | // } |
| | | // for (String resItemId : culturalClassroomResId) { |
| | | // if (res.getResId().equals(resItemId)) { |
| | | // culturalClassroomRes.add(res); |
| | | // } |
| | | // } |
| | | // for (String resItemId : realClassResId) { |
| | | // if (res.getResId().equals(resItemId)) { |
| | | // realClassRes.add(res); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | //// 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")); |
| | | // "华文课堂", shineseLanguageClassRes, |
| | | // "文化中国", culturalChinaRes, |
| | | // "实景课堂", culturalClassroomRes, |
| | | // "中文+职业教育课程", realClassRes); |
| | | // } |
| | | @Override |
| | | public Map<String, Object> getIndexDetail() { |
| | | |
| | | List<OpenSubjectV> openSubjectVS = subjectService.listOpenSubjectV(); |
| | | //文化中国 |
| | | List<String> culturalChinaId = openSubjectVS.stream().filter(openSubjectV -> openSubjectV.getSubjectName().equals("文化中国")).map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | //文化课堂 |
| | | // List<String> culturalClassroomId = openSubjectVS.stream().filter(openSubjectV -> openSubjectV.getSubjectName().equals("文化课堂")).map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | //华文课堂 |
| | | List<String> chineseLanguageClassId= openSubjectVS.stream().filter(openSubjectV -> openSubjectV.getSubjectName().equals("华文课堂")).map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | |
| | | StringBuffer hql = new StringBuffer("from SubjectLecture p where deleteFlag is false and status=?"); |
| | | List<Object> args = CollectionUtils.newList(SubjectLecture.STATUS_DRAFT); |
| | | List<SubjectLecture> subjectLectureList = find(hql.toString(), args, SubjectLecture.class); |
| | | //文化中国 |
| | | List<String> culturalChinaResId = culturalChinaId.size() == 0 ? null : subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getSubjectId().equals(culturalChinaId.get(0))).map(SubjectLecture::getResItemId).collect(toList()); |
| | | //文化课堂 |
| | | List<String> chineseLanguageClassResId = chineseLanguageClassId.size() == 0 ? null : subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getSubjectId().equals(chineseLanguageClassId.get(0))).map(SubjectLecture::getResItemId).collect(toList()); |
| | | StringBuffer hqlRes = new StringBuffer("from Res p where deleteFlag is false and status=?"); |
| | | List<Res> resList = find(hqlRes.toString(), args, Res.class); |
| | | List<Res> culturalChinaRes = new ArrayList<>(); |
| | | List<Res> chineseLanguageClassRes = new ArrayList<>(); |
| | | if (culturalChinaResId != null) { |
| | | for (Res res : resList) { |
| | | for (String resItemId : culturalChinaResId) { |
| | | if (res.getResId().equals(resItemId)) { |
| | | culturalChinaRes.add(res); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | if (chineseLanguageClassResId != null) { |
| | | for (Res res : resList) { |
| | | for (String resItemId : chineseLanguageClassResId) { |
| | | if (res.getResId().equals(resItemId)) { |
| | | chineseLanguageClassRes.add(res); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // return CollectionUtils.newObjectMap( |
| | | // "culturalClassroomRes", chineseLanguageClassRes, |
| | | // "culturalChinaRes", culturalChinaRes); |
| | | return CollectionUtils.newObjectMap( |
| | | "culturalClassroomRes",CollectionUtils.newObjectMap("subjectId",culturalChinaId.get(0),"data",chineseLanguageClassRes), |
| | | "culturalChinaRes",CollectionUtils.newObjectMap("subjectId",chineseLanguageClassId.get(0),"data",culturalChinaRes) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getExcellentTeaching() { |
| | | |
| | | List<OpenSubjectV> openSubjectVS = subjectService.listOpenSubjectV(); |
| | | //文化课堂 |
| | | List<String> culturalClassroomId = openSubjectVS.stream() |
| | | .filter(openSubjectV -> openSubjectV.getSubjectName().equals("华文课堂")) |
| | | .map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | //实景课堂 |
| | | List<String> realClassId = openSubjectVS.stream() |
| | | .filter(openSubjectV -> openSubjectV.getSubjectName().equals("实景课堂")) |
| | | .map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | //中文+职业教育课程 |
| | | List<String> chineseCourseId = openSubjectVS.stream() |
| | | .filter(openSubjectV -> openSubjectV.getSubjectName().equals("中文+职业教育课程")) |
| | | .map(OpenSubjectV::getSubjectId).collect(toList()); |
| | | |
| | | StringBuffer hql = new StringBuffer("from SubjectLecture p where deleteFlag is false and status=?"); |
| | | List<Object> args = CollectionUtils.newList(SubjectLecture.STATUS_DRAFT); |
| | | List<SubjectLecture> subjectLectureList = find(hql.toString(), args, SubjectLecture.class); |
| | | |
| | | //华文课堂 |
| | | List<String> culturalClassroomResId = culturalClassroomId.size() == 0 ? null : subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getSubjectId().equals(culturalClassroomId.get(0))) |
| | | .sorted(Comparator.comparing(SubjectLecture::getCreateTime) |
| | | .reversed()).map(SubjectLecture::getResItemId).limit(8).collect(toList()); |
| | | //实景课堂 |
| | | List<String> realClassResId = realClassId.size() == 0 ? null : subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getSubjectId().equals(realClassId.get(0))) |
| | | .sorted(Comparator.comparing(SubjectLecture::getCreateTime) |
| | | .reversed()).map(SubjectLecture::getResItemId).limit(8).collect(toList()); |
| | | //中文+职业教育课程 |
| | | List<String> chineseCourseResId = chineseCourseId.size() == 0 ? null : subjectLectureList.stream().filter(subjectLecture -> subjectLecture.getSubjectId().equals(chineseCourseId.get(0))) |
| | | .sorted(Comparator.comparing(SubjectLecture::getCreateTime) |
| | | .reversed()).map(SubjectLecture::getResItemId).limit(8).collect(toList()); |
| | | StringBuffer hqlRes = new StringBuffer("from Res p where deleteFlag is false and status=?"); |
| | | List<Res> resList = find(hqlRes.toString(), args, Res.class); |
| | | ArrayList<Res> culturalChinaRes = new ArrayList<>(); |
| | | ArrayList<Res> culturalClassroomRes = new ArrayList<>(); |
| | | ArrayList<Res> realClassRes = new ArrayList<>(); |
| | | |
| | | if (culturalClassroomResId != null) { |
| | | for (String resItemId : culturalClassroomResId) { |
| | | for (Res res : resList) { |
| | | if (res.getResId().equals(resItemId)) { |
| | | culturalChinaRes.add(res); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (realClassResId != null) { |
| | | for (String resItemId : realClassResId) { |
| | | for (Res res : resList) { |
| | | if (res.getResId().equals(resItemId)) { |
| | | culturalClassroomRes.add(res); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (chineseCourseResId != null) { |
| | | for (String resItemId : chineseCourseResId) { |
| | | for (Res res : resList) { |
| | | if (res.getResId().equals(resItemId)) { |
| | | realClassRes.add(res); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return CollectionUtils.newObjectMap( |
| | | "culturalChinaRes",CollectionUtils.newObjectMap("subjectId",culturalClassroomId.size() == 0 ? null : culturalClassroomId.get(0),"data",culturalChinaRes), |
| | | "culturalClassroomRes",CollectionUtils.newObjectMap("subjectId",realClassId.size() == 0 ? null : realClassId.get(0),"data",culturalClassroomRes), |
| | | "realClassRes", CollectionUtils.newObjectMap("subjectId",chineseCourseId.size() == 0 ? null :chineseCourseId.get(0),"data",realClassRes)); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | boolean exist; |
| | | List<Map<String, Object>> tabs = new ArrayList<>(); |
| | | |
| | | List<Map<String,String>> sub=new ArrayList<>(); |
| | | List<Map<String, String>> sub = new ArrayList<>(); |
| | | |
| | | |
| | | exist = articleDao.exist("examBriefing"); |
| | | if (exist) tabs.add(CollectionUtils.newObjectMap("name", "媒体聚焦", "type", "examBriefing","list",sub)); |
| | | 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("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", "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", "contestFile"); |
| | | if (exist) sub.add(CollectionUtils.newStringMap("name", "海外资讯", "subColumn", "contestFile")); |
| | | |
| | | exist =articleDao.existsubColumn("examBriefing","previousContest"); |
| | | if(exist) sub.add(CollectionUtils.newStringMap("name", "往届大赛", "subColumn", "previousContest")); |
| | | 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); |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | //inc浏览数 |
| | | articleDao.incBrowseCount(id); |
| | | |
| | | Information article = articleDao.read(Information.class,id); |
| | | Information article = articleDao.read(Information.class, id); |
| | | |
| | | Map<String, Object> data = CollectionUtils.newObjectMap( |
| | | "title", article.getTitle(), |
| | |
| | | return data; |
| | | } |
| | | |
| | | public Information getArticlesType(String type,String subColumn) { |
| | | Information articleDO=articleDao.getArticle(type,subColumn); |
| | | 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); |
| | | return articleDao.getVideoList(type, subColumn, page, size); |
| | | } |
| | | } |