27 changed files with 378 additions and 34 deletions
@ -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,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; |
|||
} |
@ -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,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,27 @@ |
|||
package com.epmet.modules.person.service; |
|||
|
|||
import com.epmet.resi.mine.dto.result.MyCreateTopicsResultDTO; |
|||
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); |
|||
} |
@ -0,0 +1,83 @@ |
|||
package com.epmet.modules.person.service.impl; |
|||
|
|||
import com.epmet.commons.tools.exception.RenException; |
|||
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.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.result.MyCreateTopicsResultDTO; |
|||
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 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; |
|||
|
|||
@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()); |
|||
} |
|||
|
|||
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()); |
|||
} |
|||
List<com.epmet.resi.group.dto.topic.result.MyCreateTopicsResultDTO > topics = result.getData(); |
|||
return ConvertUtils.sourceToTarget(topics, MyCreateTopicsResultDTO.class); |
|||
} |
|||
} |
Loading…
Reference in new issue