Browse Source

新闻banner接口修改

hotfix/yujt_opt
yujt 5 years ago
parent
commit
dffa25af1e
  1. 2
      epdc-cloud-commons-yushan
  2. 57
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsCategoryController.java
  3. 25
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsController.java
  4. 16
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsCategoryDao.java
  5. 4
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NewsDao.java
  6. 4
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/rocketmq/consumer/OrganizationModifyConsumer.java
  7. 13
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsCategoryService.java
  8. 9
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsService.java
  9. 6
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsCategoryServiceImpl.java
  10. 10
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java
  11. 1
      epdc-cloud-news/src/main/resources/mapper/BannerDao.xml
  12. 3
      epdc-cloud-news/src/main/resources/mapper/NewsCategoryDao.xml
  13. 20
      epdc-cloud-news/src/main/resources/mapper/NewsDao.xml

2
epdc-cloud-commons-yushan

@ -1 +1 @@
Subproject commit f49128405cd591b9aab7f129df01518c5aea143e
Subproject commit 14ba01162799b397ec4cae757f29790fc88df9cb

57
epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNewsCategoryController.java

@ -0,0 +1,57 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<java.util.List < com.elink.esua.epdc.dto.epdc.result.NewsCategoryResultDTO>>
* @author work@yujt.net.cn
* @date 2020/6/23 17:56
*/
@GetMapping("listCategoryBySection/{sectionCode}")
public Result<List<NewsCategoryResultDTO>> listCategoryCodeBySection(@PathVariable("sectionCode") String sectionCode) {
List<NewsCategoryResultDTO> result = newsCategoryService.listCategoryCodeBySection(sectionCode);
return new Result().ok(result);
}
}

25
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<java.util.List < com.elink.esua.epdc.dto.epdc.result.EpdcNewsListResultDTO>>
* @author work@yujt.net.cn
* @date 2020/5/22 15:21
*/
@GetMapping("listNewsByCategory")
public Result<List<EpdcNewsListResultDTO>> listNewsByCategory(@RequestBody EpdcNewsListByCategoryFromDTO epdcNewsFromDTO) {
ValidatorUtils.validateEntity(epdcNewsFromDTO);
List<EpdcNewsListResultDTO> list = newsService.listNewsByCategory(epdcNewsFromDTO);
return new Result().ok(list);
}
/***
* @Description 新闻详情
* @Author qushutong
@ -124,15 +109,17 @@ public class EpdcAppNewsController {
}
/***
/**
* banner列表
* @param
*
* @param fromDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.BannerDTO>>
* @author qushutong
* @date 2019/9/10 20:58
*/
@GetMapping("listBanner")
public Result<List<EpdcBannerListResultDTO>> listBanner(@RequestBody EpdcBannerListFromDTO fromDTO) {
return new Result().ok(bannerService.listBanner(fromDTO));
public Result<List<EpdcBannerListResultDTO>> listBanner(@RequestBody EpdcBannerListFromDTO fromDto) {
ValidatorUtils.validateEntity(fromDto);
return new Result().ok(bannerService.listBanner(fromDto));
}
}

16
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<NewsCategoryEntity> {
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<Map<String,String>> selectListCategory(@Param("sectionCode") String sectionCode);
List<Map<String, String>> selectListCategory(@Param("sectionCode") String sectionCode);
/**
* 居民端 - 根据版块编码查询下属子类别
*
* @param sectionCode
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.NewsCategoryResultDTO>
* @author work@yujt.net.cn
* @date 2020/6/23 17:58
*/
List<NewsCategoryResultDTO> selectListCategoryCodeBySection(@Param("sectionCode") String sectionCode);
}

4
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<NewsEntity> {
*/
List<EpdcNewsListResultDTO> selectListAppNews(EpdcNewsListFromDTO formDto);
List<EpdcNewsListResultDTO> selectListAppNewsByCategory(EpdcNewsListByCategoryFromDTO formDto);
/**
* 移动端获取新闻详情
*

4
epdc-cloud-news/src/main/java/com/elink/esua/epdc/rocketmq/consumer/OrganizationModifyConsumer.java

@ -38,7 +38,7 @@ public class OrganizationModifyConsumer implements RocketMQListener<MessageExt>
@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<MessageExt>
} catch (Exception e) {
log.info("EPDC-NEWS-SERVER消费消息失败:msgId:{}", messageExt.getMsgId());
e.printStackTrace();
}
}*/
}
}

13
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<NewsCategoryEntity> {
/**
* 查出所有类别
*/
List<Map<String,String>> listCategory(String sectionCode);
List<Map<String, String>> listCategory(String sectionCode);
/**
* 居民端 - 根据版块编码查询下属子类别
*
* @param sectionCode
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.NewsCategoryResultDTO>
* @author work@yujt.net.cn
* @date 2020/6/23 17:57
*/
List<NewsCategoryResultDTO> listCategoryCodeBySection(String sectionCode);
}

9
epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NewsService.java

@ -206,13 +206,4 @@ public interface NewsService extends BaseService<NewsEntity> {
*/
void modifyOrganizationInfo(OrganizationModifyDTO dto);
/**
* 根据新闻类别获取新闻列表
*
* @param epdcNewsFromDTO
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNewsListResultDTO>
* @author work@yujt.net.cn
* @date 2020/5/22 15:24
*/
List<EpdcNewsListResultDTO> listNewsByCategory(EpdcNewsListByCategoryFromDTO epdcNewsFromDTO);
}

6
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<NewsCategoryDao, Ne
return maps;
}
@Override
public List<NewsCategoryResultDTO> listCategoryCodeBySection(String sectionCode) {
return baseDao.selectListCategoryCodeBySection(sectionCode);
}
}

10
epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NewsServiceImpl.java

@ -322,16 +322,6 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem
return new Result().ok(newsList);
}
@Override
public List<EpdcNewsListResultDTO> 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<EpdcNewsDetailResultDTO> getNewsDetail(EpdcNewsDetailFormDTO formDto) {
EpdcNewsDetailResultDTO epdcNewsDetailResultDTO = baseDao.selectOneAppNewsDetail(formDto);

1
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'

3
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}
</select>
<select id="selectListCategoryCodeBySection" resultType="com.elink.esua.epdc.dto.epdc.result.NewsCategoryResultDTO">
SELECT CATEGORY_CODE as categoryCode,CATEGORY_NAME as categoryName FROM epdc_news_category WHERE SECTION_CODE = #{sectionCode} AND DEL_FLAG = '0' ORDER BY SORT ASC
</select>
</mapper>

20
epdc-cloud-news/src/main/resources/mapper/NewsDao.xml

@ -13,6 +13,10 @@
</select>
<sql id="newsListSelect">
</sql>
<select id="selectListAppNews" resultType="com.elink.esua.epdc.dto.epdc.result.EpdcNewsListResultDTO">
SELECT
en.ID AS id,
en.NEWS_TITLE AS newsTitle,
@ -31,24 +35,16 @@
AND en.CREATED_TIME &lt;= STR_TO_DATE( #{timestamp}, '%Y-%m-%d %H:%i:%s' )
AND en.NEWS_RELEASE_STATE = '0'
AND en.NEWS_UP_DOWN_STATE = '0'
</sql>
<select id="selectListAppNews" resultType="com.elink.esua.epdc.dto.epdc.result.EpdcNewsListResultDTO">
<include refid="newsListSelect" />
<choose>
<when test="categoryCode != null and categoryCode != ''">AND nc.CATEGORY_CODE = #{categoryCode}</when>
<otherwise>en.section_code = #{sectionCode}</otherwise>
</choose>
AND nc.independent_flag = '0'
ORDER BY
en.NEWS_RELEASE_START_TIME DESC,en.CREATED_TIME DESC
LIMIT #{pageIndex},#{pageSize}
</select>
<select id="selectListAppNewsByCategory" resultType="com.elink.esua.epdc.dto.epdc.result.EpdcNewsListResultDTO">
<include refid="newsListSelect" />
AND nc.CATEGORY_CODE = #{categoryCode}
ORDER BY
en.NEWS_RELEASE_START_TIME DESC,en.CREATED_TIME DESC
LIMIT #{pageIndex},#{pageSize}
</select>
<select id="selectOneAppNewsDetail"
resultType="com.elink.esua.epdc.dto.epdc.result.EpdcNewsDetailResultDTO">
SELECT

Loading…
Cancel
Save