Browse Source

我参与过的话题

master
wangchao 5 years ago
parent
commit
11c9ba0c07
  1. 30
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CustomerPageFormDTO.java
  2. 26
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/ParticipatedTopicUnitResultDTO.java
  3. 11
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java
  4. 7
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java
  5. 13
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java
  6. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java
  7. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java
  8. 27
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  9. 21
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml

30
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/CustomerPageFormDTO.java

@ -0,0 +1,30 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 客户Id 用户Id 分页
* @ClassName CustomerPageFormDTO
* @Auth wangc
* @Date 2020-11-11 23:15
*/
@Data
public class CustomerPageFormDTO implements Serializable {
private static final long serialVersionUID = 8678047078015445193L;
@NotBlank(message = "客户Id不能为空")
private String customerId;
@NotBlank(message = "用户Id不能为空")
private String userId;
@Min(1)
private Integer pageNo;
@Min(1)
private Integer pageSize;
}

26
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/ParticipatedTopicUnitResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.resi.group.dto.topic.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 个人中心 参与过的话题返参DTO
* @ClassName ParticipatedTopicUnitResultDTO
* @Auth wangc
* @Date 2020-11-11 23:00
*/
@Data
public class ParticipatedTopicUnitResultDTO implements Serializable {
private static final long serialVersionUID = 1392205563783715932L;
private String topicId;
private String topicReleaseGridName;
private String topicContent;
private Long releaseTime;
private String topicReleaseGroupName;
}

11
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java

@ -4,7 +4,9 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.group.dto.group.form.GroupInfoFormDTO;
import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.topic.form.CustomerPageFormDTO;
import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO;
import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO;
import com.epmet.resi.group.feign.fallback.ResiGroupOpenFeignClientFallback;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import org.springframework.cloud.openfeign.FeignClient;
@ -39,4 +41,13 @@ public interface ResiGroupOpenFeignClient {
@PostMapping("resi/group/group/groupinfo")
Result<List<GroupInfoResultDTO>> selectGroupInfo(@RequestBody GroupInfoFormDTO groupInfoFormDTO);
/**
* @Description 个人中心-我参与过的话题
* @param param
* @return java.util.List<com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO>
* @author wangc
* @date 2020.11.11 23:20
*/
@PostMapping("resi/group/topic/my-part-topics")
Result<List<ParticipatedTopicUnitResultDTO>> myPartTopics(@RequestBody CustomerPageFormDTO param);
}

7
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java

@ -5,7 +5,9 @@ import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.resi.group.dto.group.form.GroupInfoFormDTO;
import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO;
import com.epmet.resi.group.dto.topic.form.CustomerPageFormDTO;
import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO;
import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO;
import org.springframework.stereotype.Component;
@ -31,4 +33,9 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "selectGroupInfo", groupInfoFormDTO);
}
@Override
public Result<List<ParticipatedTopicUnitResultDTO>> myPartTopics(CustomerPageFormDTO param) {
return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "myPartTopics", param);
}
}

13
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/ResiTopicController.java

@ -272,5 +272,18 @@ public class ResiTopicController {
return new Result().ok(myTopics);
}
/**
* @Description 个人中心-我参与过的话题
* @param param
* @return java.util.List<com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO>
* @author wangc
* @date 2020.11.11 23:20
*/
@PostMapping("my-part-topics")
public Result<List<ParticipatedTopicUnitResultDTO>> myPartTopics(@RequestBody CustomerPageFormDTO param){
ValidatorUtils.validateEntity(param);
return new Result<List<ParticipatedTopicUnitResultDTO>>().ok(topicService.getParticipatedTopics(param));
}
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java

@ -161,4 +161,13 @@ public interface ResiTopicDao extends BaseDao<ResiTopicEntity> {
*/
List<IssueGridResultDTO> selectIssueList(@Param("topicList") List<String> topicList);
/**
* @Description 查询我参与过的话题
* @param customerId
* @param userId
* @return java.util.List<com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO>
* @author wangc
* @date 2020.11.11 23:08
*/
List<ParticipatedTopicUnitResultDTO> selectParticipatedTopics(@Param("customerId") String customerId,@Param("userId") String userId);
}

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/ResiTopicService.java

@ -271,4 +271,13 @@ public interface ResiTopicService extends BaseService<ResiTopicEntity> {
* @date 2020.11.10 15:03
*/
List<MyTopicsResultDTO> listMyTopics(String customerId, String userId, Integer pageNo, Integer pageSize);
/**
* @Description 个人中心-我参与过的话题
* @param param
* @return java.util.List<com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO>
* @author wangc
* @date 2020.11.11 23:20
*/
List<ParticipatedTopicUnitResultDTO> getParticipatedTopics(CustomerPageFormDTO param);
}

27
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -84,6 +84,7 @@ import com.epmet.resi.group.dto.topic.form.CheckTopicPublisherFormDTO;
import com.epmet.resi.group.dto.topic.form.GovTopicIssueInfoFormDTO;
import com.epmet.resi.group.dto.topic.result.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@ -1413,6 +1414,32 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
return myTopics;
}
/**
* @Description 个人中心-我参与过的话题
* @param param
* @return java.util.List<com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO>
* @author wangc
* @date 2020.11.11 23:20
*/
@Override
public List<ParticipatedTopicUnitResultDTO> getParticipatedTopics(CustomerPageFormDTO param) {
PageInfo<ParticipatedTopicUnitResultDTO> page =
PageHelper.startPage(Optional.ofNullable(param.getPageNo()).orElse(NumConstant.ONE),
Optional.ofNullable(param.getPageSize()).orElse(NumConstant.ONE)).doSelectPageInfo(() ->
baseDao.selectParticipatedTopics(param.getCustomerId(),param.getUserId()));
List<ParticipatedTopicUnitResultDTO> result = page.getList();
if(CollectionUtils.isEmpty(result)) return Collections.EMPTY_LIST;
Result<List<OrgInfoResultDTO>> gridR = govOrgOpenFeignClient.selectOrgInfo(
new OrgInfoFormDTO(OrgInfoConstant.GRID,result.stream().map(ParticipatedTopicUnitResultDTO :: getTopicReleaseGridName).distinct().collect(Collectors.toList())));
if(gridR.success() && !CollectionUtils.isEmpty(gridR.getData())){
return result.stream().flatMap(topic -> gridR.getData().stream() .filter(grid -> StringUtils.equals(grid.getOrgId(),topic.getTopicReleaseGridName())).map(orgInfo -> {
topic.setTopicReleaseGridName(orgInfo.getOrgId());
return topic;
})).collect(Collectors.toList());
} return Collections.EMPTY_LIST;
}
}

21
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml

@ -474,5 +474,26 @@
</foreach>
</select>
<!-- 查询我参与过的话题 -->
<select id="selectParticipatedTopics" resultType="com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO">
SELECT
topic.id AS topicId,
topic.topic_content,
UNIX_TIMESTAMP(topic.created_time) AS releaseTime,
groupp.group_name AS topicReleaseGroupName,
groupp.grid_id AS topicReleaseGridName
FROM
resi_topic topic LEFT JOIN resi_group groupp ON topic.group_id = groupp.ID AND groupp.del_flag = '0' AND groupp.customer_id = #{customerId}
WHERE
topic.del_flag = '0'
AND
topic.id IN (
SELECT DISTINCT topic_id FROM resi_topic_comment WHERE
del_flag = '0' AND created_by = #{userId}
)
AND topic.created_by <![CDATA[ <> ]]> #{userId}
ORDER BY topic.created_time desc
</select>
</mapper>

Loading…
Cancel
Save