Browse Source

我的话题列表

feature/syp_points
songyunpeng 5 years ago
parent
commit
9383cd46d6
  1. 12
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiPartyGroupController.java
  2. 4
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/PartyGroupFeignClient.java
  3. 5
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/PartyGroupFeignClientFallback.java
  4. 8
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/PartyGroupService.java
  5. 7
      esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupServiceImpl.java
  6. 52
      esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/form/MyPartyTopicFormDTO.java
  7. 15
      esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/AppPartyTopicController.java
  8. 9
      esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyTopicDao.java
  9. 9
      esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyTopicService.java
  10. 17
      esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyTopicServiceImpl.java
  11. 48
      esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyTopicDao.xml

12
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/controller/ApiPartyGroupController.java

@ -77,6 +77,18 @@ public class ApiPartyGroupController {
return partyGroupService.topicList(userDetail, formDto);
}
/**
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List < com.elink.esua.epdc.dto.result.PartyTopicResultDTO>>
* @Description 我的话题
* @Author songyunpeng
* @Date 2020/6/3
* @Param [formDto]
**/
@GetMapping(value = "myTopicList/list", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<PartyTopicResultDTO> myTopicList(@LoginUser TokenDto userDetail, MyPartyTopicFormDTO formDto) {
return partyGroupService.myTopicList(userDetail, formDto);
}
/**
* @return com.elink.esua.epdc.commons.tools.utils.Result
* @Description 发布话题

4
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/PartyGroupFeignClient.java

@ -140,4 +140,8 @@ public interface PartyGroupFeignClient {
**/
@PostMapping(value = "partyGroup/user/updateInfo", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result updateInfo(@RequestBody PartyUserNewInfoFormDTO formDTO);
@GetMapping(value = "partyGroup/topic/myTopicList", consumes = MediaType.APPLICATION_JSON_VALUE)
Result<PartyTopicResultDTO> myTopicList(MyPartyTopicFormDTO formDto);
}

5
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/feign/fallback/PartyGroupFeignClientFallback.java

@ -80,4 +80,9 @@ public class PartyGroupFeignClientFallback implements PartyGroupFeignClient {
public Result updateInfo(PartyUserNewInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_PARTY_GROUP_SERVER, "updateInfo",formDTO);
}
@Override
public Result<PartyTopicResultDTO> myTopicList(MyPartyTopicFormDTO formDto) {
return ModuleUtils.feignConError(ServiceConstant.EPDC_PARTY_GROUP_SERVER, "myTopicList",formDto);
}
}

8
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/PartyGroupService.java

@ -105,4 +105,12 @@ public interface PartyGroupService {
* @return com.elink.esua.epdc.commons.tools.utils.Result
**/
Result joinGroup(TokenDto userDetail, PartyUserJoinGroupFormDTO formDto);
/**
* @Description 我的话题列表
* @Author songyunpeng
* @Date 2020/6/11
* @Param [userDetail, formDto]
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.PartyTopicResultDTO>
**/
Result<PartyTopicResultDTO> myTopicList(TokenDto userDetail, MyPartyTopicFormDTO formDto);
}

7
esua-epdc/epdc-module/epdc-api/epdc-api-server/src/main/java/com/elink/esua/epdc/service/impl/PartyGroupServiceImpl.java

@ -147,4 +147,11 @@ public class PartyGroupServiceImpl implements PartyGroupService {
formDto.setMobile(userDetail.getMobile());
return partyGroupFeignClient.joinGroup(formDto);
}
@Override
public Result<PartyTopicResultDTO> myTopicList(TokenDto userDetail, MyPartyTopicFormDTO formDto) {
if(userDetail!=null){
formDto.setUserId(userDetail.getUserId());
}
return partyGroupFeignClient.myTopicList(formDto); }
}

52
esua-epdc/epdc-module/epdc-party-group/epdc-party-group-client/src/main/java/com/elink/esua/epdc/dto/form/MyPartyTopicFormDTO.java

@ -0,0 +1,52 @@
package com.elink.esua.epdc.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author songyunpeng
* @Date 2020/6/3 16:24
*/
@Data
public class MyPartyTopicFormDTO implements Serializable {
private static final long serialVersionUID = -3034807666143092535L;
/**
* 页码
*/
@NotNull(message = "页码不能为空")
private Integer pageIndex;
/**
* 页容量
*/
@NotNull(message = "分页数量不能为空")
private Integer pageSize;
/**
* 第一页查询发起时的时间
*/
@NotBlank(message = "时间戳不能为空")
private String timestamp;
/**
* 用户ID
*/
private String userId;
/**
* 话题类型
*/
private String topicType;
/**
* 党群ID
*/
private String partyGroupId;
/**
* 话题ID
*/
private String partyTopicId;
}

15
esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/controller/AppPartyTopicController.java

@ -19,6 +19,7 @@ package com.elink.esua.epdc.controller;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
import com.elink.esua.epdc.dto.form.MyPartyTopicFormDTO;
import com.elink.esua.epdc.dto.form.PartyTopicFormDTO;
import com.elink.esua.epdc.dto.form.PartyTopicSubmitFormDTO;
import com.elink.esua.epdc.dto.form.TopicStatementFormDTO;
@ -27,8 +28,6 @@ import com.elink.esua.epdc.service.PartyTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 话题表
@ -55,6 +54,18 @@ public class AppPartyTopicController {
return partyTopicService.getAllPartyTopicResultDTO(formDTO);
}
/**
* @Description 我的话题列表
* @Author songyunpeng
* @Date 2020/6/3
* @Param [formDTO]
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.util.List<com.elink.esua.epdc.dto.result.PartyTopicResultDTO>>
**/
@GetMapping("myTopicList")
public Result<PartyTopicResultDTO> myTopicList(@RequestBody MyPartyTopicFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return partyTopicService.getMyPartyTopicResultDTO(formDTO);
}
/**
* @Description 发布话题
* @Author songyunpeng

9
esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/dao/PartyTopicDao.java

@ -19,6 +19,7 @@ package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.dto.PartyTopicDTO;
import com.elink.esua.epdc.dto.form.MyPartyTopicFormDTO;
import com.elink.esua.epdc.dto.form.PartyTopicFormDTO;
import com.elink.esua.epdc.dto.result.TopicList;
import com.elink.esua.epdc.entity.PartyTopicEntity;
@ -77,4 +78,12 @@ public interface PartyTopicDao extends BaseDao<PartyTopicEntity> {
* @return void
**/
void updateSupportNum(String id,Integer num);
/**
* @Description 我的话题列表
* @Author songyunpeng
* @Date 2020/6/11
* @Param [formDto]
* @return java.util.List<com.elink.esua.epdc.dto.result.TopicList>
**/
List<TopicList> selectListOfMyPartyTopic(MyPartyTopicFormDTO formDto);
}

9
esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/PartyTopicService.java

@ -22,6 +22,7 @@ import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.GroupTopicCloseFormDTO;
import com.elink.esua.epdc.dto.PartyTopicDTO;
import com.elink.esua.epdc.dto.form.MyPartyTopicFormDTO;
import com.elink.esua.epdc.dto.form.PartyTopicFormDTO;
import com.elink.esua.epdc.dto.form.PartyTopicSubmitFormDTO;
import com.elink.esua.epdc.dto.form.TopicStatementFormDTO;
@ -154,4 +155,12 @@ public interface PartyTopicService extends BaseService<PartyTopicEntity> {
* @return void
**/
void statement(TopicStatementFormDTO formDto);
/**
* @Description 我的话题列表
* @Author songyunpeng
* @Date 2020/6/11
* @Param [formDTO]
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.result.PartyTopicResultDTO>
**/
Result<PartyTopicResultDTO> getMyPartyTopicResultDTO(MyPartyTopicFormDTO formDTO);
}

17
esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/java/com/elink/esua/epdc/service/impl/PartyTopicServiceImpl.java

@ -32,6 +32,7 @@ import com.elink.esua.epdc.dto.PartyTopicDTO;
import com.elink.esua.epdc.dto.PartyTopicUserAttitudeDTO;
import com.elink.esua.epdc.dto.PartyUserGroupDTO;
import com.elink.esua.epdc.dto.constant.PartyGroupConstant;
import com.elink.esua.epdc.dto.form.MyPartyTopicFormDTO;
import com.elink.esua.epdc.dto.form.PartyTopicFormDTO;
import com.elink.esua.epdc.dto.form.PartyTopicSubmitFormDTO;
import com.elink.esua.epdc.dto.form.TopicStatementFormDTO;
@ -221,4 +222,20 @@ public class PartyTopicServiceImpl extends BaseServiceImpl<PartyTopicDao, PartyT
}
}
@Override
public Result<PartyTopicResultDTO> getMyPartyTopicResultDTO(MyPartyTopicFormDTO formDto) {
int pageIndex = (formDto.getPageIndex() - NumConstant.ONE) * formDto.getPageSize();
formDto.setPageIndex(pageIndex);
List<TopicList> topicLists = baseDao.selectListOfMyPartyTopic(formDto);
PartyTopicResultDTO partyTopicResultDTO = new PartyTopicResultDTO();
//获取当前用户在当前党群禁言状态
PartyUserGroupDTO userByGroupIdAndUserId = partyUserGroupService.getUserByGroupIdAndUserId(formDto.getPartyGroupId(), formDto.getUserId());
if(userByGroupIdAndUserId!=null && userByGroupIdAndUserId.getBannedEndTime()!=null && new Date().before(userByGroupIdAndUserId.getBannedEndTime())){
partyTopicResultDTO.setBannedFlag("1");
}else{
partyTopicResultDTO.setBannedFlag("0");
}
partyTopicResultDTO.setTopicList(topicLists);
return new Result<PartyTopicResultDTO>().ok(partyTopicResultDTO); }
}

48
esua-epdc/epdc-module/epdc-party-group/epdc-party-group-server/src/main/resources/mapper/PartyTopicDao.xml

@ -201,6 +201,54 @@
LIMIT #{pageIndex},#{pageSize}) tmp)
order by t.CREATED_TIME desc,t3.CREATED_TIME
</select>
<select id="selectListOfMyPartyTopic" resultType="com.elink.esua.epdc.dto.result.TopicList">
select t.ID,
t.NICKNAME,
t.USER_FACE,
t.PARTY_MEMBER,
t.CREATED_TIME,
t.TOPIC_CONTENT,
t.TOPIC_MODULE,
t.SUPPORT_NUM,
t.COMMENT_NUM,
t.TOPIC_ADDRESS,
<if test='userId != "" and userId != null'>
if( ATTITUDE_FLAG='0',1,0)likeFlag,
</if>
t2.IMG_URL,
t3.ID as commentId,
t3.USERNAME as username,
t3.USER_FACE as commentUserFace,
t3.CONTENT as content,
t3.PARTY_MEMBER as commentPartyMemberDEL_FLAG
from epdc_party_topic t
<if test='userId != "" and userId != null'>
left join epdc_party_topic_user_attitude t1 on t.ID = t1.PARTY_TOPIC_ID and t1.DEL_FLAG='0' and t1.USER_ID = #{userId}
</if>
left join epdc_party_topic_img t2 on t.ID = t2.REFERENCE_ID and t2.DEL_FLAG='0'
left join (select ID,USERNAME,USER_FACE,PARTY_MEMBER,CONTENT,TOPIC_ID,DEL_FLAG,CREATED_TIME from epdc_party_topic_comment order by CREATED_TIME desc) t3 on t.ID = t3.TOPIC_ID and t3.DEL_FLAG='0'
where
t.ID in (select tmp.ID from (SELECT
t1.ID
FROM
epdc_party_topic t1
WHERE
t1.DEL_FLAG = '0' and t1.STATE = '0' and t1.USER_ID = #{userId}
<if test="timestamp != null and timestamp.trim() != ''">
<![CDATA[ AND DATE_FORMAT(t1.CREATED_TIME,'%Y-%m-%d %H:%i:%s') <= ]]> #{timestamp}
</if>
<if test="topicType != null and topicType != ''">
and t1.TOPIC_MODULE = #{topicType}
</if>
<if test="partyTopicId!=null and partyTopicId != ''">
and t1.ID = #{partyTopicId}
</if>
ORDER BY
t1.CREATED_TIME DESC
LIMIT #{pageIndex},#{pageSize}) tmp)
order by t.CREATED_TIME desc,t3.CREATED_TIME
</select>
<update id="updateCommentNum">
UPDATE epdc_party_topic SET COMMENT_NUM = COMMENT_NUM + #{num} WHERE ID = #{id}

Loading…
Cancel
Save