Browse Source

个人中心-我发表的话题-审核中列表

master
sunyuchao 5 years ago
parent
commit
b3e85549b8
  1. 37
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingListFormDTO.java
  2. 49
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingListResultDTO.java
  3. 16
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java
  4. 13
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java
  5. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java
  6. 52
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java
  7. 21
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml

37
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingListFormDTO.java

@ -0,0 +1,37 @@
package com.epmet.resi.group.dto.topic.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
/**
* @Author sun
* @Description 个人中心-我发表的话题-审核中列表-接口入参
*/
@Data
public class MyAuditingListFormDTO {
/**
* 客户Id
*/
@NotBlank(message = "客户ID不能为空",groups = {MyAuditingListFormDTO.AuditingTopicForm.class})
private String customerId;
/**
* 页码从1开始
*/
@Min(value = 1, message = "页码必须大于0", groups = { MyAuditingListFormDTO.AuditingTopicForm.class })
private Integer pageNo;
/**
* 页容量默认10页
*/
@Min(value = 1, message = "每页条数必须大于0", groups = { MyAuditingListFormDTO.AuditingTopicForm.class })
private Integer pageSize;
/**
* token中用户Id
*/
private String userId;
public interface AuditingTopicForm{}
}

49
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingListResultDTO.java

@ -0,0 +1,49 @@
package com.epmet.resi.group.dto.topic.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author sun
* @Description 个人中心-我发表的话题-审核中列表-接口返参
*/
@Data
public class MyAuditingListResultDTO implements Serializable {
private static final long serialVersionUID = -703102629653169023L;
/**
* 话题草稿id
*/
private String topicDraftId;
/**
* 话题来源网格名称
*/
private String releaseGridName;
@JsonIgnore
private String gridId;
/**
* 发布时间戳
*/
private Long releaseTime;
/**
* 话题内容
*/
private String topicContent;
/**
* 小组名称
*/
private String releaseGroupName;
/**
* 状态
*/
private String status;
}

16
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java

@ -17,7 +17,9 @@
package com.epmet.modules.topic.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -28,6 +30,8 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.modules.topic.excel.TopicDraftExcel;
import com.epmet.modules.topic.service.TopicDraftService;
import com.epmet.resi.group.dto.topic.TopicDraftDTO;
import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -91,4 +95,16 @@ public class TopicDraftController {
ExcelUtils.exportExcelToTarget(response, null, list, TopicDraftExcel.class);
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 个人中心-我发表的话题-审核中列表
**/
@PostMapping(value = "myauditinglist")
public Result<List<MyAuditingListResultDTO>> myAuditingList(@LoginUser TokenDto tokenDto, @RequestBody MyAuditingListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, MyAuditingListFormDTO.AuditingTopicForm.class);
formDTO.setUserId(tokenDto.getUserId());
return new Result<List<MyAuditingListResultDTO>>().ok(topicDraftService.myAuditingList(formDTO));
}
}

13
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java

@ -19,8 +19,12 @@ package com.epmet.modules.topic.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.topic.entity.TopicDraftEntity;
import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 话题草稿内容表
*
@ -29,5 +33,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TopicDraftDao extends BaseDao<TopicDraftEntity> {
/**
* @param formDTO
* @return
* @Author sun
* @Description 个人中心-我发表的话题-审核中列表
**/
List<MyAuditingListResultDTO> selectAuditingList(MyAuditingListFormDTO formDTO);
}

10
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java

@ -21,6 +21,8 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.modules.topic.entity.TopicDraftEntity;
import com.epmet.resi.group.dto.topic.TopicDraftDTO;
import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO;
import java.util.List;
import java.util.Map;
@ -92,4 +94,12 @@ public interface TopicDraftService extends BaseService<TopicDraftEntity> {
* @date 2020-12-17
*/
void delete(String[] ids);
/**
* @param formDTO
* @return
* @Author sun
* @Description 个人中心-我发表的话题-审核中列表
**/
List<MyAuditingListResultDTO> myAuditingList(MyAuditingListFormDTO formDTO);
}

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

@ -21,19 +21,29 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.modules.topic.dao.TopicDraftDao;
import com.epmet.modules.topic.entity.TopicDraftEntity;
import com.epmet.modules.topic.service.TopicDraftService;
import com.epmet.resi.group.dto.topic.TopicDraftDTO;
import com.epmet.resi.group.dto.topic.form.MyAuditingListFormDTO;
import com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO;
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 话题草稿内容表
@ -43,6 +53,10 @@ import java.util.Map;
*/
@Service
public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicDraftEntity> implements TopicDraftService {
private static Logger logger = LoggerFactory.getLogger(TopicDraftServiceImpl.class);
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Override
public PageData<TopicDraftDTO> page(Map<String, Object> params) {
@ -96,4 +110,36 @@ public class TopicDraftServiceImpl extends BaseServiceImpl<TopicDraftDao, TopicD
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 个人中心-我发表的话题-审核中列表
**/
@Override
public List<MyAuditingListResultDTO> myAuditingList(MyAuditingListFormDTO formDTO) {
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setPageNo(pageIndex);
//1.获取当前用户创建的还未成为话题的话题草稿数据
List<MyAuditingListResultDTO> list = baseDao.selectAuditingList(formDTO);
if(list.size()<NumConstant.ONE){
return new ArrayList<>();
}
//2.获取网格名称,封装数据并返回 【组织-网格】
List<String> gridIds = list.stream().map(l -> l.getGridId()).collect(Collectors.toList());
Result<List<AllGridsByUserIdResultDTO>> rst = govOrgOpenFeignClient.getGridListByGridIds(gridIds);
if (!rst.success()) {
logger.error("查询【个人中心-我发表的话题-审核中列表】,根据网格id查询网格名称失败, InternalMsg:{},Msg:{}", rst.getInternalMsg(), rst.getMsg());
} else {
List<AllGridsByUserIdResultDTO> gridList = rst.getData();
if (CollectionUtils.isNotEmpty(gridList)) {
HashMap<String, String> gridIdAndNames = new HashMap<>();
gridList.stream().forEach(g -> gridIdAndNames.put(g.getGridId(), g.getGridName()));
list.stream().forEach(pt -> pt.setReleaseGridName(gridIdAndNames.get(pt.getGridId())));
}
}
return list;
}
}

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

@ -3,5 +3,26 @@
<mapper namespace="com.epmet.modules.topic.dao.TopicDraftDao">
<select id="selectAuditingList" resultType="com.epmet.resi.group.dto.topic.result.MyAuditingListResultDTO">
SELECT
td.id AS "topicDraftId",
td.grid_id AS "gridId",
UNIX_TIMESTAMP(td.created_time) AS "releaseTime",
IF(td.topic_content IS NULL OR td.topic_content = '','语音内容',td.topic_content) AS "topicContent",
rg.group_name AS "releaseGroupName",
IF(td.draft_status = 'block' OR td.draft_status = 'rejected','已驳回','待审核') AS "status"
FROM
topic_draft td
INNER JOIN resi_group rg ON td.group_id = rg.id
WHERE
td.del_flag = '0'
AND rg.del_flag = '0'
AND td.IS_SEE = '0' <!-- 创建者是否可见(0是 1否) -->
AND td.draft_status NOT IN('auto_passed','approved') <!-- 不查询系统自动通过和人工审核通过的数据 -->
AND td.created_by = #{userId}
ORDER BY
td.updated_time DESC
LIMIT #{pageNo}, #{pageSize}
</select>
</mapper>
Loading…
Cancel
Save