From ec5117df885f86f37c0119f120838ead3f057b79 Mon Sep 17 00:00:00 2001 From: liuchuang <123456> Date: Sat, 28 Aug 2021 22:17:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20init=201=E3=80=81=E7=A4=BE=E5=8C=BA=E8=B5=84=E8=AE=AF-?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E5=88=97=E8=A1=A8=201=E3=80=81=E7=A4=BE?= =?UTF-8?q?=E5=8C=BA=E8=B5=84=E8=AE=AF-=E8=B5=84=E8=AE=AF=E5=88=97?= =?UTF-8?q?=E8=A1=A8=201=E3=80=81=E7=A4=BE=E5=8C=BA=E8=B5=84=E8=AE=AF-?= =?UTF-8?q?=E8=B5=84=E8=AE=AF=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epdc-cloud-commons-yushan | 2 +- .../controller/EpdcAppNoticeController.java | 49 ++++++++++++++- .../com/elink/esua/epdc/dao/NoticeDao.java | 45 +++++++++++++- .../esua/epdc/service/NoticeService.java | 35 ++++++++++- .../epdc/service/impl/NoticeServiceImpl.java | 25 +++++++- .../src/main/resources/mapper/NoticeDao.xml | 61 ++++++++++++++++++- epdc-cloud-parent-yushan | 2 +- 7 files changed, 204 insertions(+), 15 deletions(-) diff --git a/epdc-cloud-commons-yushan b/epdc-cloud-commons-yushan index 235f56d..31d32c8 160000 --- a/epdc-cloud-commons-yushan +++ b/epdc-cloud-commons-yushan @@ -1 +1 @@ -Subproject commit 235f56d5ea756317efe54c5e0d4be0ac45e09155 +Subproject commit 31d32c81a8018a5c93745bcca1a538cc0bf59e13 diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNoticeController.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNoticeController.java index 38e968c..2b631aa 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNoticeController.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNoticeController.java @@ -20,10 +20,10 @@ package com.elink.esua.epdc.controller; import com.elink.esua.epdc.commons.tools.constant.Constant; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; +import com.elink.esua.epdc.dto.epdc.form.EpdcContentListFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeBrowseFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO; -import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO; -import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO; +import com.elink.esua.epdc.dto.epdc.result.*; import com.elink.esua.epdc.service.NoticeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -84,4 +84,47 @@ public class EpdcAppNoticeController { ValidatorUtils.validateEntity(formDto); return this.noticeService.updateReadingAmount(formDto); } -} \ No newline at end of file + + /** + * 社区资讯-栏目列表 + * + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/8/28 21:15 + */ + @GetMapping("contentModuleList") + public Result> listContentModules() { + List data = noticeService.listContentModules(); + return new Result>().ok(data); + } + + /** + * 社区资讯-资讯列表 + * + * @param formDto + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author lc + * @since 2021/8/28 21:22 + */ + @GetMapping("contentList") + public Result> listContents(@RequestBody EpdcContentListFormDTO formDto) { + ValidatorUtils.validateEntity(formDto); + List data = noticeService.listContents(formDto); + return new Result>().ok(data); + } + + /** + * 社区资讯-资讯详情 + * + * @param id + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author lc + * @since 2021/8/28 21:24 + */ + @GetMapping("contentDetail/{id}") + public Result getContentDetailById(@PathVariable("id") String id) { + EpdcContentDetailResultDTO data = noticeService.getContentDetailById(id); + return new Result().ok(data); + } + +} diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java index d582d9e..0329675 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java @@ -19,9 +19,9 @@ package com.elink.esua.epdc.dao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.dto.NoticeDTO; +import com.elink.esua.epdc.dto.epdc.form.EpdcContentListFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO; -import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO; -import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO; +import com.elink.esua.epdc.dto.epdc.result.*; import com.elink.esua.epdc.entity.NoticeEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -127,4 +127,43 @@ public interface NoticeDao extends BaseDao { * @return int */ int selectCountByTypeId(@Param("typeId") String typeId); -} \ No newline at end of file + + /** + * 社区资讯-栏目列表 + * + * @return java.util.List + * @author lc + * @since 2021/8/28 21:48 + */ + List selectListContentModules(); + + /** + * 社区资讯-资讯列表 + * + * @param formDto + * @return java.util.List + * @author lc + * @since 2021/8/28 21:48 + */ + List selectListContents(EpdcContentListFormDTO formDto); + + /** + * 内容浏览数加 1 + * + * @param id + * @return void + * @author lc + * @since 2021/8/28 21:48 + */ + void addContentReadingAmount(String id); + + /** + * 社区资讯-资讯详情 + * + * @param id + * @return com.elink.esua.epdc.dto.epdc.result.EpdcContentDetailResultDTO + * @author lc + * @since 2021/8/28 21:48 + */ + EpdcContentDetailResultDTO getContentDetailById(String id); +} diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NoticeService.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NoticeService.java index ebc792b..e1c9119 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NoticeService.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NoticeService.java @@ -21,10 +21,10 @@ import com.elink.esua.epdc.commons.mybatis.service.BaseService; import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.dto.NoticeDTO; +import com.elink.esua.epdc.dto.epdc.form.EpdcContentListFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeBrowseFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO; -import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO; -import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO; +import com.elink.esua.epdc.dto.epdc.result.*; import com.elink.esua.epdc.entity.NoticeEntity; import com.elink.esua.epdc.rocketmq.dto.OrganizationModifyDTO; @@ -204,4 +204,33 @@ public interface NoticeService extends BaseService { * @return com.elink.esua.epdc.commons.tools.utils.Result */ Result handleIsUpDown(NoticeDTO dto); -} \ No newline at end of file + + /** + * 社区资讯-栏目列表 + * + * @return java.util.List + * @author lc + * @since 2021/8/28 21:40 + */ + List listContentModules(); + + /** + * 社区资讯-资讯列表 + * + * @param formDto + * @return java.util.List + * @author lc + * @since 2021/8/28 21:39 + */ + List listContents(EpdcContentListFormDTO formDto); + + /** + * 社区资讯-资讯详情 + * + * @param id + * @return com.elink.esua.epdc.dto.epdc.result.EpdcContentDetailResultDTO + * @author lc + * @since 2021/8/28 21:39 + */ + EpdcContentDetailResultDTO getContentDetailById(String id); +} diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java index 8e51036..69f35c7 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java @@ -35,10 +35,10 @@ import com.elink.esua.epdc.dao.NoticeDao; import com.elink.esua.epdc.dao.NoticeDepartmentDao; import com.elink.esua.epdc.dto.NoticeDTO; import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; +import com.elink.esua.epdc.dto.epdc.form.EpdcContentListFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeBrowseFormDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO; -import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO; -import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO; +import com.elink.esua.epdc.dto.epdc.result.*; import com.elink.esua.epdc.entity.NoticeEntity; import com.elink.esua.epdc.feign.AdminFeignClient; import com.elink.esua.epdc.redis.NoticeRedis; @@ -448,4 +448,23 @@ public class NoticeServiceImpl extends BaseServiceImpl return entities; } -} \ No newline at end of file + + @Override + public List listContentModules() { + return baseDao.selectListContentModules(); + } + + @Override + public List listContents(EpdcContentListFormDTO formDto) { + int pageIndex = (formDto.getPageIndex() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageIndex(pageIndex); + return baseDao.selectListContents(formDto); + } + + @Override + public EpdcContentDetailResultDTO getContentDetailById(String id) { + // 增加浏览数 + baseDao.addContentReadingAmount(id); + return baseDao.getContentDetailById(id); + } +} diff --git a/epdc-cloud-news/src/main/resources/mapper/NoticeDao.xml b/epdc-cloud-news/src/main/resources/mapper/NoticeDao.xml index ab158b5..e9d48d7 100644 --- a/epdc-cloud-news/src/main/resources/mapper/NoticeDao.xml +++ b/epdc-cloud-news/src/main/resources/mapper/NoticeDao.xml @@ -20,6 +20,7 @@ AND en.RELEASE_TIME <= STR_TO_DATE( #{timestamp}, '%Y-%m-%d %H:%i:%s' ) AND en.CREATED_TIME <= STR_TO_DATE( #{timestamp}, '%Y-%m-%d %H:%i:%s' ) AND en.DEL_FLAG = '0' + AND en.TYPE_ID = '' ORDER BY en.RELEASE_TIME DESC LIMIT #{pageIndex},#{pageSize} @@ -115,4 +116,62 @@ and type_id=#{typeId} - \ No newline at end of file + + + + + + UPDATE epdc_notice SET READING_AMOUNT = IFNULL(READING_AMOUNT+1,1) WHERE ID = #{id} + + + + + diff --git a/epdc-cloud-parent-yushan b/epdc-cloud-parent-yushan index db92131..6c53fd9 160000 --- a/epdc-cloud-parent-yushan +++ b/epdc-cloud-parent-yushan @@ -1 +1 @@ -Subproject commit db9213163f8005cba05ad21334bebb72484174b7 +Subproject commit 6c53fd985cbaae46046a44a2d84f1eb9bff86a9d