Browse Source

居民端接口 init

1、社区资讯-栏目列表
1、社区资讯-资讯列表
1、社区资讯-资讯详情
master
liuchuang 4 years ago
parent
commit
ec5117df88
  1. 2
      epdc-cloud-commons-yushan
  2. 49
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/controller/EpdcAppNoticeController.java
  3. 45
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/dao/NoticeDao.java
  4. 35
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/NoticeService.java
  5. 25
      epdc-cloud-news/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java
  6. 61
      epdc-cloud-news/src/main/resources/mapper/NoticeDao.xml
  7. 2
      epdc-cloud-parent-yushan

2
epdc-cloud-commons-yushan

@ -1 +1 @@
Subproject commit 235f56d5ea756317efe54c5e0d4be0ac45e09155
Subproject commit 31d32c81a8018a5c93745bcca1a538cc0bf59e13

49
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);
}
}
/**
* 社区资讯-栏目列表
*
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeModuleListResultDTO>>
* @author lc
* @since 2021/8/28 21:15
*/
@GetMapping("contentModuleList")
public Result<List<EpdcNoticeModuleListResultDTO>> listContentModules() {
List<EpdcNoticeModuleListResultDTO> data = noticeService.listContentModules();
return new Result<List<EpdcNoticeModuleListResultDTO>>().ok(data);
}
/**
* 社区资讯-资讯列表
*
* @param formDto
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcContentListResultDTO>>
* @author lc
* @since 2021/8/28 21:22
*/
@GetMapping("contentList")
public Result<List<EpdcContentListResultDTO>> listContents(@RequestBody EpdcContentListFormDTO formDto) {
ValidatorUtils.validateEntity(formDto);
List<EpdcContentListResultDTO> data = noticeService.listContents(formDto);
return new Result<List<EpdcContentListResultDTO>>().ok(data);
}
/**
* 社区资讯-资讯详情
*
* @param id
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.epdc.result.EpdcContentDetailResultDTO>
* @author lc
* @since 2021/8/28 21:24
*/
@GetMapping("contentDetail/{id}")
public Result<EpdcContentDetailResultDTO> getContentDetailById(@PathVariable("id") String id) {
EpdcContentDetailResultDTO data = noticeService.getContentDetailById(id);
return new Result<EpdcContentDetailResultDTO>().ok(data);
}
}

45
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<NoticeEntity> {
* @return int
*/
int selectCountByTypeId(@Param("typeId") String typeId);
}
/**
* 社区资讯-栏目列表
*
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeModuleListResultDTO>
* @author lc
* @since 2021/8/28 21:48
*/
List<EpdcNoticeModuleListResultDTO> selectListContentModules();
/**
* 社区资讯-资讯列表
*
* @param formDto
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcContentListResultDTO>
* @author lc
* @since 2021/8/28 21:48
*/
List<EpdcContentListResultDTO> 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);
}

35
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<NoticeEntity> {
* @return com.elink.esua.epdc.commons.tools.utils.Result
*/
Result handleIsUpDown(NoticeDTO dto);
}
/**
* 社区资讯-栏目列表
*
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcNoticeModuleListResultDTO>
* @author lc
* @since 2021/8/28 21:40
*/
List<EpdcNoticeModuleListResultDTO> listContentModules();
/**
* 社区资讯-资讯列表
*
* @param formDto
* @return java.util.List<com.elink.esua.epdc.dto.epdc.result.EpdcContentListResultDTO>
* @author lc
* @since 2021/8/28 21:39
*/
List<EpdcContentListResultDTO> 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);
}

25
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<NoticeDao, NoticeEntity>
return entities;
}
}
@Override
public List<EpdcNoticeModuleListResultDTO> listContentModules() {
return baseDao.selectListContentModules();
}
@Override
public List<EpdcContentListResultDTO> 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);
}
}

61
epdc-cloud-news/src/main/resources/mapper/NoticeDao.xml

@ -20,6 +20,7 @@
AND en.RELEASE_TIME &lt;= STR_TO_DATE( #{timestamp}, '%Y-%m-%d %H:%i:%s' )
AND en.CREATED_TIME &lt;= 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}
</select>
</mapper>
<select id="selectListContentModules" resultType="com.elink.esua.epdc.dto.epdc.result.EpdcNoticeModuleListResultDTO">
SELECT
id,
type_name
FROM
epdc_module_type
WHERE
DEL_FLAG = 0
AND banner_flag = '0'
AND pid IS NOT NULL
AND pid != 0
ORDER BY
sort,
create_date DESC
</select>
<select id="selectListContents" resultType="com.elink.esua.epdc.dto.epdc.result.EpdcContentListResultDTO">
SELECT
en.ID AS id,
en.NOTICE_TITLE,
en.RELEASE_TIME,
en.DEPT_NAME,
en.IMG_URL,
en.READING_AMOUNT
FROM
epdc_notice en
RIGHT JOIN epdc_notice_department nd ON en.ID = nd.NOTICE_ID
WHERE
nd.DEPT_ID = #{deptId}
AND en.DEL_FLAG = '0'
AND en.NOTICE_RELEASE_STATE = '1'
AND en.NOTICE_UP_DOWN_STATE = '1'
<if test="typeId != null and typeId !=''">
AND FIND_IN_SET(#{typeId},ALL_TYPE_ID)
</if>
ORDER BY
en.RELEASE_TIME DESC
LIMIT #{pageIndex},#{pageSize}
</select>
<update id="addContentReadingAmount">
UPDATE epdc_notice SET READING_AMOUNT = IFNULL(READING_AMOUNT+1,1) WHERE ID = #{id}
</update>
<select id="getContentDetailById" resultType="com.elink.esua.epdc.dto.epdc.result.EpdcContentDetailResultDTO">
SELECT
en.ID AS id,
en.NOTICE_TITLE,
en.RELEASE_TIME,
en.DEPT_NAME,
en.IMG_URL,
en.READING_AMOUNT
FROM
epdc_notice en
WHERE
en.ID = #{id}
</select>
</mapper>

2
epdc-cloud-parent-yushan

@ -1 +1 @@
Subproject commit db9213163f8005cba05ad21334bebb72484174b7
Subproject commit 6c53fd985cbaae46046a44a2d84f1eb9bff86a9d
Loading…
Cancel
Save