|
|
|
@ -37,11 +37,15 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.constant.OrgInfoConstant; |
|
|
|
import com.epmet.dto.CustomerGridDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.CommonDataFilterResultDTO; |
|
|
|
import com.epmet.dto.result.IssueInitiatorResultDTO; |
|
|
|
import com.epmet.dto.result.OrgInfoResultDTO; |
|
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.modules.constant.GroupMemberConstant; |
|
|
|
import com.epmet.modules.constant.ResiGroupRedisKeys; |
|
|
|
import com.epmet.modules.feign.EpmetUserFeignClient; |
|
|
|
@ -80,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; |
|
|
|
@ -88,6 +93,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
@ -139,9 +145,15 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
@Autowired |
|
|
|
private GovOrgFeignClient govOrgFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovIssueFeignClient govIssueFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
|
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
|
private String scanApiUrl; |
|
|
|
@Value("${openapi.scan.method.textSyncScan}") |
|
|
|
@ -386,7 +398,38 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
|
|
|
|
//2. 在缓存中拉取用户信息
|
|
|
|
setCacheUserInfoWithIssue(topicPageFormDTO.getGroupId(), pastTopics); |
|
|
|
|
|
|
|
//3.用户徽章
|
|
|
|
//3.1首先需要拿到客户Id
|
|
|
|
ResiGroupEntity group = resiGroupDao.selectById(topicPageFormDTO.getGroupId()); |
|
|
|
if(null != group && StringUtils.isNotBlank(group.getCustomerId())){ |
|
|
|
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR |
|
|
|
= userOpenFeignClient.userShowBadge( |
|
|
|
new UserGroupFormDTO(group.getCustomerId(), |
|
|
|
pastTopics.stream() |
|
|
|
.filter(top -> StringUtils.equals("other",top.getReleaseUserFlag())) |
|
|
|
.map(ResiTopicIncludeIssueInfoResultDTO::getUserId) |
|
|
|
.distinct().collect(Collectors.toList()))); |
|
|
|
if(null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()){ |
|
|
|
Map<String, List<UserBadgeUnitFormDTO>> badgeM = badgeR.getData(); |
|
|
|
pastTopics.forEach(top -> { |
|
|
|
if(StringUtils.equals("other",top.getReleaseUserFlag())){ |
|
|
|
top.setBadgeList( |
|
|
|
CollectionUtils.isEmpty(badgeM.get(top.getUserId())) ? |
|
|
|
Collections.EMPTY_LIST : |
|
|
|
badgeM.get(top.getUserId()).stream().map(UserBadgeUnitFormDTO :: getBadgeIcon).collect(Collectors.toList()) |
|
|
|
); |
|
|
|
}else top.setBadgeList(Collections.EMPTY_LIST); |
|
|
|
}); |
|
|
|
|
|
|
|
}else pastTopics.forEach(top -> top.setBadgeList(Collections.EMPTY_LIST)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Result<List<ResiTopicIncludeIssueInfoResultDTO>>().ok(pastTopics); |
|
|
|
} |
|
|
|
|
|
|
|
@ -616,6 +659,18 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
} |
|
|
|
} |
|
|
|
resultDTO.setCloseDetail(closeDetail); |
|
|
|
|
|
|
|
//4.获取用户徽章的信息
|
|
|
|
List<String> userId = new LinkedList<>();userId.add(topicDetail.getCreatedBy()); |
|
|
|
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR |
|
|
|
= userOpenFeignClient.userShowBadge(new UserGroupFormDTO(group.getCustomerId(), userId)); |
|
|
|
if(null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()){ |
|
|
|
resultDTO.setBadgeList( |
|
|
|
CollectionUtils.isEmpty(badgeR.getData().get(topicDetail.getCreatedBy())) ? |
|
|
|
Collections.EMPTY_LIST: |
|
|
|
badgeR.getData().get(topicDetail.getCreatedBy()).stream().map(UserBadgeUnitFormDTO :: getBadgeIcon).collect(Collectors.toList()) |
|
|
|
); |
|
|
|
}else resultDTO.setBadgeList(Collections.EMPTY_LIST); |
|
|
|
return new Result<ResiTopicIncludeIssueDetailResultDTO>().ok(resultDTO); |
|
|
|
} |
|
|
|
|
|
|
|
@ -641,6 +696,36 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
//2.遍历用户信息
|
|
|
|
if (null != hiddenTopics && hiddenTopics.size() > 0) { |
|
|
|
setCacheUserInfo(topicPageFormDTO.getGroupId(), hiddenTopics); |
|
|
|
|
|
|
|
|
|
|
|
//3.用户徽章
|
|
|
|
//3.1首先需要拿到客户Id
|
|
|
|
ResiGroupEntity group = resiGroupDao.selectById(topicPageFormDTO.getGroupId()); |
|
|
|
if(null != group && StringUtils.isNotBlank(group.getCustomerId())){ |
|
|
|
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR |
|
|
|
= userOpenFeignClient.userShowBadge( |
|
|
|
new UserGroupFormDTO(group.getCustomerId(), |
|
|
|
hiddenTopics.stream() |
|
|
|
.filter(top -> StringUtils.equals("other",top.getReleaseUserFlag())) |
|
|
|
.map(ResiTopicInfoResultDTO::getUserId) |
|
|
|
.distinct().collect(Collectors.toList()))); |
|
|
|
if(null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()){ |
|
|
|
Map<String, List<UserBadgeUnitFormDTO>> badgeM = badgeR.getData(); |
|
|
|
hiddenTopics.forEach(top -> { |
|
|
|
if(StringUtils.equals("other",top.getReleaseUserFlag())){ |
|
|
|
top.setBadgeList( |
|
|
|
CollectionUtils.isEmpty(badgeM.get(top.getUserId())) ? |
|
|
|
Collections.EMPTY_LIST : |
|
|
|
badgeM.get(top.getUserId()).stream().map(UserBadgeUnitFormDTO :: getBadgeIcon).collect(Collectors.toList()) |
|
|
|
); |
|
|
|
}else top.setBadgeList(Collections.EMPTY_LIST); |
|
|
|
}); |
|
|
|
|
|
|
|
}else hiddenTopics.forEach(top -> top.setBadgeList(Collections.EMPTY_LIST)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new Result<List<ResiTopicInfoResultDTO>>().ok(hiddenTopics); |
|
|
|
@ -791,6 +876,30 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
|
|
|
|
//2. 在缓存中拉取用户信息
|
|
|
|
setCacheUserInfo(topicPageFormDTO.getGroupId(), pastTopics); |
|
|
|
|
|
|
|
//3.用户徽章
|
|
|
|
//3.1首先需要拿到客户Id
|
|
|
|
ResiGroupEntity group = resiGroupDao.selectById(topicPageFormDTO.getGroupId()); |
|
|
|
if (null != group && StringUtils.isNotBlank(group.getCustomerId())) { |
|
|
|
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR |
|
|
|
= userOpenFeignClient.userShowBadge( |
|
|
|
new UserGroupFormDTO(group.getCustomerId(), |
|
|
|
pastTopics.stream() |
|
|
|
.map(ResiTopicInfoResultDTO::getUserId) |
|
|
|
.distinct().collect(Collectors.toList()))); |
|
|
|
if (null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()) { |
|
|
|
Map<String, List<UserBadgeUnitFormDTO>> badgeM = badgeR.getData(); |
|
|
|
pastTopics.forEach(top -> { |
|
|
|
top.setBadgeList( |
|
|
|
CollectionUtils.isEmpty(badgeM.get(top.getUserId())) ? |
|
|
|
Collections.EMPTY_LIST : |
|
|
|
badgeM.get(top.getUserId()).stream().map(UserBadgeUnitFormDTO::getBadgeIcon).collect(Collectors.toList()) |
|
|
|
); |
|
|
|
}); |
|
|
|
|
|
|
|
} else pastTopics.forEach(top -> top.setBadgeList(Collections.EMPTY_LIST)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return new Result<List<ResiTopicInfoResultDTO>>().ok(pastTopics); |
|
|
|
|
|
|
|
@ -864,11 +973,13 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
|
|
|
|
if (result.success() && null != result.getData() && result.getData().size() > 0) { |
|
|
|
for (UserResiInfoResultDTO user : result.getData()) { |
|
|
|
ResiTopicInfoResultDTO topic = |
|
|
|
topicMap.get(user.getUserId()).get(0); |
|
|
|
topic.setReleaseUserHeadPhoto(user.getHeadPhoto()); |
|
|
|
topic.setReleaseUserName(user.getShowName()); |
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(topicMap.get(user.getUserId()))){ |
|
|
|
topicMap.get(user.getUserId()).forEach( topic -> { |
|
|
|
topic.setReleaseUserHeadPhoto(user.getHeadPhoto()); |
|
|
|
topic.setReleaseUserName(user.getShowName()); |
|
|
|
}); |
|
|
|
} |
|
|
|
//存入缓存
|
|
|
|
ResiGroupMemberInfoRedisDTO memberRedisDTO = new ResiGroupMemberInfoRedisDTO(); |
|
|
|
ResiGroupMemberDTO memberMySql = resiGroupMemberDao.selectGroupMemberInfo(groupId, user.getUserId()); |
|
|
|
@ -936,10 +1047,12 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
|
|
|
|
if (result.success() && null != result.getData() && result.getData().size() > 0) { |
|
|
|
for (UserResiInfoResultDTO user : result.getData()) { |
|
|
|
ResiTopicIncludeIssueInfoResultDTO topic = |
|
|
|
topicMap.get(user.getUserId()).get(0); |
|
|
|
topic.setReleaseUserHeadPhoto(user.getHeadPhoto()); |
|
|
|
topic.setReleaseUserName(user.getShowName()); |
|
|
|
if(!CollectionUtils.isEmpty(topicMap.get(user.getUserId()))){ |
|
|
|
topicMap.get(user.getUserId()).forEach( topic -> { |
|
|
|
topic.setReleaseUserHeadPhoto(user.getHeadPhoto()); |
|
|
|
topic.setReleaseUserName(user.getShowName()); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
//存入缓存
|
|
|
|
ResiGroupMemberInfoRedisDTO memberRedisDTO = new ResiGroupMemberInfoRedisDTO(); |
|
|
|
@ -1280,9 +1393,53 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi |
|
|
|
public List<MyTopicsResultDTO> listMyTopics(String customerId, String userId, Integer pageNo, Integer pageSize) { |
|
|
|
PageHelper.startPage(pageNo, pageSize); |
|
|
|
List<MyTopicsResultDTO> myTopics = resiTopicDao.listMyTopics(userId, customerId); |
|
|
|
// todo 查询网格名称,赋值
|
|
|
|
|
|
|
|
HashMap<String, String> gridIdAndNames = new HashMap<>(); |
|
|
|
Set<String> gridIds = myTopics.stream().map(c -> c.getReleaseGridId()).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
OrgInfoFormDTO form = new OrgInfoFormDTO(); |
|
|
|
form.setOrgType(OrgInfoConstant.GRID); |
|
|
|
form.setOrgIds(new ArrayList<>(gridIds)); |
|
|
|
Result<List<OrgInfoResultDTO>> gridInfoResult = govOrgOpenFeignClient.selectOrgInfo(form); |
|
|
|
if (gridInfoResult.success()) { |
|
|
|
List<OrgInfoResultDTO> grids = gridInfoResult.getData(); |
|
|
|
for (OrgInfoResultDTO grid : grids) { |
|
|
|
gridIdAndNames.put(grid.getOrgId(), grid.getOrgName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (MyTopicsResultDTO myTopic : myTopics) { |
|
|
|
myTopic.setReleaseGridName(gridIdAndNames.get(myTopic.getReleaseGridId())); |
|
|
|
} |
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|