From 8de9b17d1070f3e0cd2094e0385035fe0c1ef535 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Fri, 14 Aug 2020 18:20:00 +0800
Subject: [PATCH] Merge branch 'whole' of https://gitee.com/chonggaoxiao/new_excoin into whole

---
 src/main/java/com/xcong/excoin/modules/helpCenter/service/impl/HelpCenterServiceImpl.java |   80 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/helpCenter/service/impl/HelpCenterServiceImpl.java b/src/main/java/com/xcong/excoin/modules/helpCenter/service/impl/HelpCenterServiceImpl.java
index c20c3f6..dcf0c23 100644
--- a/src/main/java/com/xcong/excoin/modules/helpCenter/service/impl/HelpCenterServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/helpCenter/service/impl/HelpCenterServiceImpl.java
@@ -2,7 +2,9 @@
 
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
@@ -15,13 +17,18 @@
 import com.xcong.excoin.common.response.Result;
 import com.xcong.excoin.modules.helpCenter.dao.HelpCenterArticleDao;
 import com.xcong.excoin.modules.helpCenter.dao.HelpCenterNoticeDao;
+import com.xcong.excoin.modules.helpCenter.dao.HelpCenterTypeDao;
 import com.xcong.excoin.modules.helpCenter.dto.ImportantNoticePageDto;
 import com.xcong.excoin.modules.helpCenter.dto.NewNoticePageDto;
+import com.xcong.excoin.modules.helpCenter.dto.NewNoticeTypePageDto;
+import com.xcong.excoin.modules.helpCenter.dto.NoticePageDto;
 import com.xcong.excoin.modules.helpCenter.entity.HelpCenterArticleEntity;
 import com.xcong.excoin.modules.helpCenter.entity.HelpCenterNoticeEntity;
+import com.xcong.excoin.modules.helpCenter.entity.HelpCenterTypeEntity;
 import com.xcong.excoin.modules.helpCenter.service.HelpCenterService;
 import com.xcong.excoin.modules.helpCenter.vo.ImportantNoticeVo;
 import com.xcong.excoin.modules.helpCenter.vo.NewNoticeInfoVo;
+import com.xcong.excoin.modules.helpCenter.vo.NewNoticeTypeInfoVo;
 import com.xcong.excoin.modules.helpCenter.vo.NoticeInfoVo;
 
 import cn.hutool.core.collection.CollUtil;
@@ -36,6 +43,8 @@
     private HelpCenterArticleDao helpCenterArticleDao;
 	@Resource
     private HelpCenterNoticeDao helpCenterNoticeDao;
+	@Resource
+	private HelpCenterTypeDao helpCenterTypeDao;
 	
 	@Override
 	public Result getNewNoticeList(@Valid NewNoticePageDto newNoticePageDto) {
@@ -136,6 +145,77 @@
 		return Result.ok(noticeInfoVo);
 	}
 
+	@Override
+	public Result getNewNoticeTypeList(@Valid NewNoticeTypePageDto newNoticeTypePageDto) {
+        
+		List<NewNoticeTypeInfoVo> arrayList = new ArrayList<>();
+        Page<HelpCenterTypeEntity> page = new Page<>(newNoticeTypePageDto.getPageNum(), newNoticeTypePageDto.getPageSize());
+        //获取【类别】
+        HelpCenterTypeEntity helpCenterTypeEntity = new HelpCenterTypeEntity();
+        IPage<HelpCenterTypeEntity> helpCenterTypeEntitys = helpCenterTypeDao.getNoticeTypeList(page, helpCenterTypeEntity);
+        List<HelpCenterTypeEntity> records = helpCenterTypeEntitys.getRecords();
+        if(CollUtil.isNotEmpty(records)) {
+        	for(HelpCenterTypeEntity helpCenterType : records) {
+        		NewNoticeTypeInfoVo noticeInfoVo = new NewNoticeTypeInfoVo();
+        		Long id = helpCenterType.getId();
+        		noticeInfoVo.setId(id);
+        		int type = newNoticeTypePageDto.getType();
+        		if(type == 2) {
+        			String contentUs = helpCenterType.getContentUs();
+        			noticeInfoVo.setContent(contentUs);
+        		}else {
+        			String content = helpCenterType.getContent();
+        			noticeInfoVo.setContent(content);
+        		}
+        		arrayList.add(noticeInfoVo);
+        	}
+        }
+		return Result.ok(arrayList);
+	}
+
+	@Override
+	public Result getNoticeList(@Valid NoticePageDto noticePageDto) {
+		
+		List<NewNoticeInfoVo> arrayList = new ArrayList<>();
+		int noticeType = noticePageDto.getType();
+		//获取【类别】数据
+		Long id = noticePageDto.getId();
+		HelpCenterTypeEntity helpCenterTypeEntity = helpCenterTypeDao.selectById(id);
+		if(ObjectUtil.isNotEmpty(helpCenterTypeEntity)) {
+			int type = helpCenterTypeEntity.getType();
+			//获取对应的【帮助中心公告】
+			Map<String, Object> columnMap = new HashMap<String, Object>();
+			columnMap.put("article_notice", type);
+			List<HelpCenterNoticeEntity> helpCenterNoticeEntitys = helpCenterNoticeDao.selectByMap(columnMap);
+			if(CollUtil.isNotEmpty(helpCenterNoticeEntitys)) {
+				for(HelpCenterNoticeEntity helpCenterNoticeEntity : helpCenterNoticeEntitys) {
+					NewNoticeInfoVo newNoticeInfoVo = new NewNoticeInfoVo();
+					Long noticeId = helpCenterNoticeEntity.getId();
+					newNoticeInfoVo.setId(noticeId);
+					String createBy = helpCenterNoticeEntity.getCreateBy();
+					newNoticeInfoVo.setCreateBy(createBy);
+					Date createTime = helpCenterNoticeEntity.getCreateTime();
+					newNoticeInfoVo.setCreateTime(createTime);
+					if(noticeType == 2) {
+						Long articleIdUs = helpCenterNoticeEntity.getArticleIdUs();
+						newNoticeInfoVo.setArticleId(articleIdUs);
+						String articleTitle = helpCenterNoticeEntity.getArticleTitleUs();
+						newNoticeInfoVo.setArticleTitle(articleTitle);
+					}else {
+						Long articleId = helpCenterNoticeEntity.getArticleId();
+						newNoticeInfoVo.setArticleId(articleId);
+						String articleTitle = helpCenterNoticeEntity.getArticleTitle();
+						helpCenterNoticeEntity.getArticleTitle();
+						newNoticeInfoVo.setArticleTitle(articleTitle);
+					}
+					arrayList.add(newNoticeInfoVo);
+				}
+			}
+		}
+		
+		return Result.ok(arrayList);
+	}
+
 
 	
 	

--
Gitblit v1.9.1