diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingListFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/MyAuditingListFormDTO.java new file mode 100644 index 0000000000..dc4a989bed --- /dev/null +++ b/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{} + +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingListResultDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/result/MyAuditingListResultDTO.java new file mode 100644 index 0000000000..14b35755ec --- /dev/null +++ b/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; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java index 71f79e615b..ca60f2e453 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/controller/TopicDraftController.java +++ b/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> myAuditingList(@LoginUser TokenDto tokenDto, @RequestBody MyAuditingListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, MyAuditingListFormDTO.AuditingTopicForm.class); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(topicDraftService.myAuditingList(formDTO)); + } } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java index e4a41b173b..0ccebb0a33 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/TopicDraftDao.java +++ b/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 { - + + /** + * @param formDTO + * @return + * @Author sun + * @Description 个人中心-我发表的话题-审核中列表 + **/ + List selectAuditingList(MyAuditingListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java index d32cd5a42a..467553bb0c 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/TopicDraftService.java +++ b/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 { * @date 2020-12-17 */ void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 个人中心-我发表的话题-审核中列表 + **/ + List myAuditingList(MyAuditingListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java index ac3df4b7b8..b216097a86 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/TopicDraftServiceImpl.java +++ b/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 implements TopicDraftService { + private static Logger logger = LoggerFactory.getLogger(TopicDraftServiceImpl.class); + + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; @Override public PageData page(Map params) { @@ -96,4 +110,36 @@ public class TopicDraftServiceImpl extends BaseServiceImpl myAuditingList(MyAuditingListFormDTO formDTO) { + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); + //1.获取当前用户创建的还未成为话题的话题草稿数据 + List list = baseDao.selectAuditingList(formDTO); + if(list.size()(); + } + + //2.获取网格名称,封装数据并返回 【组织-网格】 + List gridIds = list.stream().map(l -> l.getGridId()).collect(Collectors.toList()); + Result> rst = govOrgOpenFeignClient.getGridListByGridIds(gridIds); + if (!rst.success()) { + logger.error("查询【个人中心-我发表的话题-审核中列表】,根据网格id查询网格名称失败, InternalMsg:{},Msg:{}", rst.getInternalMsg(), rst.getMsg()); + } else { + List gridList = rst.getData(); + if (CollectionUtils.isNotEmpty(gridList)) { + HashMap 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; + } + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml index acecc51e74..96213c43aa 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/TopicDraftDao.xml @@ -3,5 +3,26 @@ + \ No newline at end of file