43 changed files with 793 additions and 44 deletions
@ -0,0 +1,38 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/11/13 3:30 下午 |
|||
*/ |
|||
@Data |
|||
public class MyShiftIssueTopicsFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3943178729586797400L; |
|||
|
|||
public interface MyShiftIssueTopics{} |
|||
|
|||
/** |
|||
* 页码 |
|||
*/ |
|||
@NotNull(message = "页码不能为空",groups = {MyShiftIssueTopics.class}) |
|||
private Integer pageNo; |
|||
|
|||
/** |
|||
* 每页数量 |
|||
*/ |
|||
@NotNull(message = "每页数量不能为空",groups = {MyShiftIssueTopics.class}) |
|||
private Integer pageSize; |
|||
|
|||
|
|||
@NotBlank(message = "客户ID不能为空",groups = {MyShiftIssueTopics.class}) |
|||
private String customerId; |
|||
|
|||
private String userId; |
|||
|
|||
} |
@ -0,0 +1,43 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/11/13 3:31 下午 |
|||
*/ |
|||
@Data |
|||
public class MyShiftIssueTopicsResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -703102629653169023L; |
|||
|
|||
/** |
|||
* 话题ID |
|||
*/ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 转议题时间 |
|||
*/ |
|||
private Long shiftIssueTime; |
|||
|
|||
/** |
|||
* 建议 |
|||
*/ |
|||
private String suggestion; |
|||
|
|||
/** |
|||
* 议题标题 |
|||
*/ |
|||
private String issueTitle; |
|||
|
|||
/** |
|||
* 话题发表网格名称 |
|||
*/ |
|||
private String releaseGridName; |
|||
|
|||
private String gridId; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
public class ProjectByCreateTopicUserFormDTO { |
|||
|
|||
public interface ListByUserGroup {} |
|||
|
|||
@NotBlank(message = "客户ID不能为空", groups = { ListByUserGroup.class }) |
|||
private String customerId; |
|||
|
|||
@NotBlank(message = "用户ID不能为空", groups = { ListByUserGroup.class }) |
|||
private String userId; |
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class ProjectOfCreateTopicUserResultDTO { |
|||
|
|||
private String topicId; |
|||
private String projectId; |
|||
private String gridId; |
|||
private Long shiftProjectTime; |
|||
private List<String> departmentNameList; |
|||
private String projectTitle; |
|||
private String releaseGridId; |
|||
|
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.resi.group.dto.topic; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
public class MyCreateTopicsFormDTO { |
|||
|
|||
@NotBlank(message = "客户id不能为空") |
|||
private String customerId; |
|||
|
|||
@NotBlank(message = "用户id不能为空") |
|||
private String userId; |
|||
|
|||
private Integer pageSize = 10; |
|||
|
|||
private Integer pageNo = 1; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.epmet.resi.group.dto.topic.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/11/13 4:27 下午 |
|||
*/ |
|||
@Data |
|||
public class TopicIdListFormDTO{ |
|||
|
|||
private String userId; |
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.epmet.resi.mine.dto.from; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
public class MyCreateTopicsFormDTO { |
|||
@NotBlank(message = "客户id不能为空") |
|||
private String customerId; |
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.epmet.resi.mine.dto.from; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/11/13 3:30 下午 |
|||
*/ |
|||
@Data |
|||
public class MyShiftIssueTopicsFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -3943178729586797400L; |
|||
|
|||
public interface MyShiftIssueTopics{} |
|||
|
|||
/** |
|||
* 页码 |
|||
*/ |
|||
@NotNull(message = "页码不能为空",groups = {MyShiftIssueTopics.class}) |
|||
private Integer pageNo; |
|||
|
|||
/** |
|||
* 每页数量 |
|||
*/ |
|||
@NotNull(message = "每页数量不能为空",groups = {MyShiftIssueTopics.class}) |
|||
private Integer pageSize; |
|||
|
|||
|
|||
@NotBlank(message = "客户ID不能为空",groups = {MyShiftIssueTopics.class}) |
|||
private String customerId; |
|||
|
|||
private String userId; |
|||
|
|||
} |
@ -1,14 +1,14 @@ |
|||
package com.epmet.resi.group.dto.topic; |
|||
package com.epmet.resi.mine.dto.from; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class MyTopicsFormDTO { |
|||
public class MyShiftProjectTopicsFormDTO { |
|||
|
|||
private String customerId; |
|||
|
|||
private Integer pageSize = 10; |
|||
|
|||
private Integer pageNo = 1; |
|||
|
|||
private Integer pageSize = 10; |
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.epmet.resi.mine.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class MyCreateTopicsResultDTO { |
|||
private String topicId; |
|||
private Long releaseTime; |
|||
private String topicContent; |
|||
private String releaseGroupName; |
|||
private String releaseGridId; |
|||
private String releaseGridName; |
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.epmet.resi.mine.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/11/13 3:31 下午 |
|||
*/ |
|||
@Data |
|||
public class MyShiftIssueTopicsResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -703102629653169023L; |
|||
|
|||
/** |
|||
* 话题ID |
|||
*/ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 转议题时间 |
|||
*/ |
|||
private Long shiftIssueTime; |
|||
|
|||
/** |
|||
* 建议 |
|||
*/ |
|||
private String suggestion; |
|||
|
|||
/** |
|||
* 议题标题 |
|||
*/ |
|||
private String issueTitle; |
|||
|
|||
/** |
|||
* 话题发表网格名称 |
|||
*/ |
|||
private String releaseGridName; |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.epmet.resi.mine.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class MyShiftProjectTopicsResultDTO { |
|||
private String topicId; |
|||
private String gridId; |
|||
private Long shiftProjectTime; |
|||
private List<String> departmentNameList; |
|||
private String projectTitle; |
|||
private String releaseGridName; |
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.epmet.modules.person.service; |
|||
|
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.resi.mine.dto.from.MyShiftIssueTopicsFormDTO; |
|||
import com.epmet.resi.mine.dto.result.MyCreateTopicsResultDTO; |
|||
import com.epmet.resi.mine.dto.result.MyShiftIssueTopicsResultDTO; |
|||
import com.epmet.resi.mine.dto.result.MyShiftProjectTopicsResultDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 话题service |
|||
*/ |
|||
public interface TopicService { |
|||
/** |
|||
* @Description 列出我的已转项目的话题列表 |
|||
* @return |
|||
* @author wxz |
|||
* @date 2020.11.13 10:17 |
|||
*/ |
|||
List<MyShiftProjectTopicsResultDTO> listMyShiftProjectTopics(String userId, String customerId, Integer pageNo, Integer pageSize); |
|||
|
|||
/** |
|||
* @Description 我创建的话题列表 |
|||
* @return |
|||
* @author wxz |
|||
* @date 2020.11.13 15:00 |
|||
*/ |
|||
List<MyCreateTopicsResultDTO> listMyCreateTopics(String customerId, String userId, Integer pageNo, Integer pageSize); |
|||
|
|||
/** |
|||
* @Description 个人中心-我发表的话题列表-已转议题列表 |
|||
* @Param tokenDto |
|||
* @Param myShiftIssueTopicsResultDTO |
|||
* @author zxc |
|||
* @date 2020/11/13 3:42 下午 |
|||
*/ |
|||
List<MyShiftIssueTopicsResultDTO> myShiftIssueTopics(TokenDto tokenDto, MyShiftIssueTopicsFormDTO myShiftIssueTopicsFormDTO); |
|||
} |
@ -0,0 +1,112 @@ |
|||
package com.epmet.modules.person.service.impl; |
|||
|
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.dto.form.ProjectByCreateTopicUserFormDTO; |
|||
import com.epmet.dto.result.AllGridsByUserIdResultDTO; |
|||
import com.epmet.dto.result.ProjectOfCreateTopicUserResultDTO; |
|||
import com.epmet.feign.GovIssueOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.feign.GovProjectOpenFeignClient; |
|||
import com.epmet.modules.person.service.TopicService; |
|||
import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; |
|||
import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; |
|||
import com.epmet.resi.mine.dto.from.MyShiftIssueTopicsFormDTO; |
|||
import com.epmet.resi.mine.dto.result.MyCreateTopicsResultDTO; |
|||
import com.epmet.resi.mine.dto.result.MyShiftIssueTopicsResultDTO; |
|||
import com.epmet.resi.mine.dto.result.MyShiftProjectTopicsResultDTO; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
public class TopicServiceImpl implements TopicService { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(TopicServiceImpl.class); |
|||
|
|||
@Autowired |
|||
private GovProjectOpenFeignClient govProjectOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private ResiGroupOpenFeignClient resiGroupOpenFeignClient; |
|||
|
|||
@Autowired |
|||
private GovIssueOpenFeignClient govIssueOpenFeignClient; |
|||
|
|||
@Override |
|||
public List<MyShiftProjectTopicsResultDTO> listMyShiftProjectTopics(String userId, String customerId, Integer pageNo, Integer pageSize) { |
|||
ProjectByCreateTopicUserFormDTO form = new ProjectByCreateTopicUserFormDTO(); |
|||
form.setCustomerId(customerId); |
|||
form.setUserId(userId); |
|||
form.setPageNo(pageNo); |
|||
form.setPageSize(pageSize); |
|||
Result<List<ProjectOfCreateTopicUserResultDTO>> result = govProjectOpenFeignClient.listProjectsByCreateTopicUserId(form); |
|||
if (!result.success()) { |
|||
throw new RenException(result.getCode(), result.getInternalMsg(), result.getMsg(), RenException.MessageMode.CODE_INTERNAL_EXTERNAL); |
|||
} |
|||
|
|||
List<ProjectOfCreateTopicUserResultDTO> projects = result.getData(); |
|||
|
|||
List<MyShiftProjectTopicsResultDTO> projectTopics = ConvertUtils.sourceToTarget(projects, MyShiftProjectTopicsResultDTO.class); |
|||
List<String> gridIds = projects.stream().map(p -> p.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> gridInfos = rst.getData(); |
|||
HashMap<String, String> gridIdAndNames = new HashMap<>(); |
|||
gridInfos.stream().forEach(g -> gridIdAndNames.put(g.getGridId(), g.getGridName())); |
|||
projectTopics.stream().forEach(pt -> pt.setReleaseGridName(gridIdAndNames.get(pt.getGridId()))); |
|||
} |
|||
|
|||
return projectTopics; |
|||
} |
|||
|
|||
@Override |
|||
public List<MyCreateTopicsResultDTO> listMyCreateTopics(String customerId, String userId, Integer pageNo, Integer pageSize) { |
|||
MyCreateTopicsFormDTO form = new MyCreateTopicsFormDTO(); |
|||
form.setCustomerId(customerId); |
|||
form.setUserId(userId); |
|||
form.setPageNo(pageNo); |
|||
form.setPageSize(pageSize); |
|||
Result<List<com.epmet.resi.group.dto.topic.result.MyCreateTopicsResultDTO >> result = resiGroupOpenFeignClient.listMyCreateTopics(form); |
|||
if (!result.success()) { |
|||
throw new RenException(result.getCode(), result.getInternalMsg(), result.getMsg(), RenException.MessageMode.CODE_INTERNAL_EXTERNAL); |
|||
} |
|||
List<com.epmet.resi.group.dto.topic.result.MyCreateTopicsResultDTO > topics = result.getData(); |
|||
return ConvertUtils.sourceToTarget(topics, MyCreateTopicsResultDTO.class); |
|||
} |
|||
|
|||
/** |
|||
* @Description 个人中心-我发表的话题列表-已转议题列表 |
|||
* @Param tokenDto |
|||
* @Param myShiftIssueTopicsResultDTO |
|||
* @author zxc |
|||
* @date 2020/11/13 3:42 下午 |
|||
*/ |
|||
@Override |
|||
public List<MyShiftIssueTopicsResultDTO> myShiftIssueTopics(TokenDto tokenDto, MyShiftIssueTopicsFormDTO myShiftIssueTopicsFormDTO) { |
|||
myShiftIssueTopicsFormDTO.setUserId(tokenDto.getUserId()); |
|||
Result<List<MyShiftIssueTopicsResultDTO>> listResult = govIssueOpenFeignClient.myShiftIssueTopics(myShiftIssueTopicsFormDTO); |
|||
if (!listResult.success()){ |
|||
throw new RenException("查询我发表的话题列表-已转议题列表失败......"); |
|||
} |
|||
if (CollectionUtils.isEmpty(listResult.getData())){ |
|||
return new ArrayList<>(); |
|||
} |
|||
return listResult.getData(); |
|||
} |
|||
} |
Loading…
Reference in new issue