diff --git a/epdc-cloud-commons-yushan b/epdc-cloud-commons-yushan index f491284..14ba011 160000 --- a/epdc-cloud-commons-yushan +++ b/epdc-cloud-commons-yushan @@ -1 +1 @@ -Subproject commit f49128405cd591b9aab7f129df01518c5aea143e +Subproject commit 14ba01162799b397ec4cae757f29790fc88df9cb diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsCategoryController.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsCategoryController.java new file mode 100644 index 0000000..4ba2a8a --- /dev/null +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsCategoryController.java @@ -0,0 +1,57 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.dto.epdc.result.NewsCategoryResultDTO; +import com.elink.esua.epdc.service.NewsCategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +/** + * 新闻类别表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-09-04 + */ +@RestController +@RequestMapping(Constant.EPDC_APP + "newscategory") +public class EpdcAppNewsCategoryController { + + @Autowired + private NewsCategoryService newsCategoryService; + + /** + * 居民端 - 根据版块编码,查询下属子类别 + * + * @param sectionCode + * @return com.elink.esua.epdc.commons.tools.utils.Result> + * @author work@yujt.net.cn + * @date 2020/6/23 17:56 + */ + @GetMapping("listCategoryBySection/{sectionCode}") + public Result> listCategoryCodeBySection(@PathVariable("sectionCode") String sectionCode) { + List result = newsCategoryService.listCategoryCodeBySection(sectionCode); + return new Result().ok(result); + } + +} \ No newline at end of file diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java index 292c31c..39c65a5 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java @@ -64,21 +64,6 @@ public class EpdcAppNewsController { return newsService.listNews(epdcNewsFromDTO); } - /** - * 小程序端 根据新闻类别获取新闻列表 - * - * @param epdcNewsFromDTO - * @return com.elink.esua.epdc.commons.tools.utils.Result> - * @author work@yujt.net.cn - * @date 2020/5/22 15:21 - */ - @GetMapping("listNewsByCategory") - public Result> listNewsByCategory(@RequestBody EpdcNewsListByCategoryFromDTO epdcNewsFromDTO) { - ValidatorUtils.validateEntity(epdcNewsFromDTO); - List list = newsService.listNewsByCategory(epdcNewsFromDTO); - return new Result().ok(list); - } - /*** * @Description 新闻详情 * @Author qushutong @@ -124,15 +109,17 @@ public class EpdcAppNewsController { } - /*** - * banner列表 - * @param + /** + * banner列表 + * + * @param fromDto * @return com.elink.esua.epdc.commons.tools.utils.Result> * @author qushutong * @date 2019/9/10 20:58 */ @GetMapping("listBanner") - public Result> listBanner(@RequestBody EpdcBannerListFromDTO fromDTO) { - return new Result().ok(bannerService.listBanner(fromDTO)); + public Result> listBanner(@RequestBody EpdcBannerListFromDTO fromDto) { + ValidatorUtils.validateEntity(fromDto); + return new Result().ok(bannerService.listBanner(fromDto)); } } \ No newline at end of file diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsCategoryDao.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsCategoryDao.java index 60bb95f..196dfe1 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsCategoryDao.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsCategoryDao.java @@ -18,6 +18,7 @@ package com.elink.esua.epdc.dao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.epdc.result.NewsCategoryResultDTO; import com.elink.esua.epdc.entity.NewsCategoryEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -34,10 +35,19 @@ import java.util.Map; @Mapper public interface NewsCategoryDao extends BaseDao { - int selectCodeCount(String categoryCode,String id); + int selectCodeCount(String categoryCode, String id); - int selectNameCount(String categoryName,String id); + int selectNameCount(String categoryName, String id); - List> selectListCategory(@Param("sectionCode") String sectionCode); + List> selectListCategory(@Param("sectionCode") String sectionCode); + /** + * 居民端 - 根据版块编码,查询下属子类别 + * + * @param sectionCode + * @return java.util.List + * @author work@yujt.net.cn + * @date 2020/6/23 17:58 + */ + List selectListCategoryCodeBySection(@Param("sectionCode") String sectionCode); } \ No newline at end of file diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsDao.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsDao.java index 1f25897..386f614 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsDao.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsDao.java @@ -20,7 +20,6 @@ package com.elink.esua.epdc.dao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.dto.NewsDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNewsDetailFormDTO; -import com.elink.esua.epdc.dto.epdc.form.EpdcNewsListByCategoryFromDTO; import com.elink.esua.epdc.dto.epdc.form.EpdcNewsListFromDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNewsDetailResultDTO; import com.elink.esua.epdc.dto.epdc.result.EpdcNewsListResultDTO; @@ -53,9 +52,6 @@ public interface NewsDao extends BaseDao { */ List selectListAppNews(EpdcNewsListFromDTO formDto); - - List selectListAppNewsByCategory(EpdcNewsListByCategoryFromDTO formDto); - /** * 移动端获取新闻详情 * diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/rocketmq/consumer/OrganizationModifyConsumer.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/rocketmq/consumer/OrganizationModifyConsumer.java index 8cb6c92..b75a40d 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/rocketmq/consumer/OrganizationModifyConsumer.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/rocketmq/consumer/OrganizationModifyConsumer.java @@ -38,7 +38,7 @@ public class OrganizationModifyConsumer implements RocketMQListener @Override public void onMessage(MessageExt messageExt) { log.info("EPDC-NEWS-SERVER消费消息START:{topic:{}, msgId:{}}", RocketMqConstant.MQ_TOPIC_ORGANIZATION, messageExt.getMsgId()); - try { + /*try { String charset = "UTF-8"; String body = new String(messageExt.getBody(), charset); OrganizationModifyDTO dto = JSONObject.parseObject(body, OrganizationModifyDTO.class); @@ -52,6 +52,6 @@ public class OrganizationModifyConsumer implements RocketMQListener } catch (Exception e) { log.info("EPDC-NEWS-SERVER消费消息失败:msgId:{}", messageExt.getMsgId()); e.printStackTrace(); - } + }*/ } } diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsCategoryService.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsCategoryService.java index 1d22884..9a729eb 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsCategoryService.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsCategoryService.java @@ -20,6 +20,7 @@ package com.elink.esua.epdc.service; import com.elink.esua.epdc.commons.mybatis.service.BaseService; import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.dto.NewsCategoryDTO; +import com.elink.esua.epdc.dto.epdc.result.NewsCategoryResultDTO; import com.elink.esua.epdc.entity.NewsCategoryEntity; import java.util.List; @@ -96,5 +97,15 @@ public interface NewsCategoryService extends BaseService { /** * 查出所有类别 */ - List> listCategory(String sectionCode); + List> listCategory(String sectionCode); + + /** + * 居民端 - 根据版块编码,查询下属子类别 + * + * @param sectionCode + * @return java.util.List + * @author work@yujt.net.cn + * @date 2020/6/23 17:57 + */ + List listCategoryCodeBySection(String sectionCode); } \ No newline at end of file diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsService.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsService.java index d960ff9..9664510 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsService.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsService.java @@ -206,13 +206,4 @@ public interface NewsService extends BaseService { */ void modifyOrganizationInfo(OrganizationModifyDTO dto); - /** - * 根据新闻类别获取新闻列表 - * - * @param epdcNewsFromDTO - * @return java.util.List - * @author work@yujt.net.cn - * @date 2020/5/22 15:24 - */ - List listNewsByCategory(EpdcNewsListByCategoryFromDTO epdcNewsFromDTO); } diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsCategoryServiceImpl.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsCategoryServiceImpl.java index 1d98023..6fb2672 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsCategoryServiceImpl.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsCategoryServiceImpl.java @@ -28,6 +28,7 @@ import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; import com.elink.esua.epdc.commons.tools.constant.FieldConstant; import com.elink.esua.epdc.dao.NewsCategoryDao; import com.elink.esua.epdc.dto.NewsCategoryDTO; +import com.elink.esua.epdc.dto.epdc.result.NewsCategoryResultDTO; import com.elink.esua.epdc.entity.NewsCategoryEntity; import com.elink.esua.epdc.service.NewsCategoryService; import com.elink.esua.epdc.service.NewsService; @@ -148,4 +149,9 @@ public class NewsCategoryServiceImpl extends BaseServiceImpl listCategoryCodeBySection(String sectionCode) { + return baseDao.selectListCategoryCodeBySection(sectionCode); + } } \ No newline at end of file diff --git a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java index 731bc17..0396430 100644 --- a/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java +++ b/epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java @@ -322,16 +322,6 @@ public class NewsServiceImpl extends BaseServiceImpl implem return new Result().ok(newsList); } - @Override - public List listNewsByCategory(EpdcNewsListByCategoryFromDTO formDto) { - if (IndependentFunctionCodeEnum.getByCode(formDto.getCategoryCode()) == null) { - return Lists.newArrayList(); - } - int pageIndex = (formDto.getPageIndex() - NumConstant.ONE) * formDto.getPageSize(); - formDto.setPageIndex(pageIndex); - return this.baseDao.selectListAppNewsByCategory(formDto); - } - @Override public Result getNewsDetail(EpdcNewsDetailFormDTO formDto) { EpdcNewsDetailResultDTO epdcNewsDetailResultDTO = baseDao.selectOneAppNewsDetail(formDto); diff --git a/epdc-cloud-news/src/main/resources/mapper/BannerDao.xml b/epdc-cloud-news/src/main/resources/mapper/BannerDao.xml index be64882..ec76704 100644 --- a/epdc-cloud-news/src/main/resources/mapper/BannerDao.xml +++ b/epdc-cloud-news/src/main/resources/mapper/BannerDao.xml @@ -17,6 +17,7 @@ WHERE eb.STATE = '1' AND eb.POSITION = #{position} + AND eb.SECTION_CODE = #{sectionCode} AND ed.GRID_ID = #{deptId} AND eb.DEL_FLAG = '0' AND ed.DEL_FLAG = '0' diff --git a/epdc-cloud-news/src/main/resources/mapper/NewsCategoryDao.xml b/epdc-cloud-news/src/main/resources/mapper/NewsCategoryDao.xml index 1483078..3d0f5cc 100644 --- a/epdc-cloud-news/src/main/resources/mapper/NewsCategoryDao.xml +++ b/epdc-cloud-news/src/main/resources/mapper/NewsCategoryDao.xml @@ -33,4 +33,7 @@ SELECT ID as id,CATEGORY_NAME as name FROM epdc_news_category where DEL_FLAG= '0' and section_code = #{sectionCode} + \ No newline at end of file diff --git a/epdc-cloud-news/src/main/resources/mapper/NewsDao.xml b/epdc-cloud-news/src/main/resources/mapper/NewsDao.xml index 9169c27..502ca8f 100644 --- a/epdc-cloud-news/src/main/resources/mapper/NewsDao.xml +++ b/epdc-cloud-news/src/main/resources/mapper/NewsDao.xml @@ -13,6 +13,10 @@ + + + + - + + AND nc.CATEGORY_CODE = #{categoryCode} + en.section_code = #{sectionCode} + AND nc.independent_flag = '0' ORDER BY en.NEWS_RELEASE_START_TIME DESC,en.CREATED_TIME DESC LIMIT #{pageIndex},#{pageSize} - -