|
|
@ -1,8 +1,26 @@ |
|
|
|
package com.epmet.service.evaluationindex.extract.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.dto.form.TimeListResultDTO; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.dao.evaluationindex.extract.FactOriginIssueMainDailyDao; |
|
|
|
import com.epmet.dto.extract.FactOriginIssueMainDailyDTO; |
|
|
|
import com.epmet.dto.extract.result.IssueInfoResultDTO; |
|
|
|
import com.epmet.dto.extract.result.TopicInfoResultDTO; |
|
|
|
import com.epmet.service.Issue.IssueService; |
|
|
|
import com.epmet.service.evaluationindex.extract.IssueExtractService; |
|
|
|
import com.epmet.service.topic.TopicService; |
|
|
|
import com.epmet.service.user.UserService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author zxc |
|
|
@ -12,6 +30,85 @@ import org.springframework.stereotype.Service; |
|
|
|
@Slf4j |
|
|
|
public class IssueExtractServiceImpl implements IssueExtractService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FactOriginIssueMainDailyDao issueMainDailyDao; |
|
|
|
@Autowired |
|
|
|
private IssueService issueService; |
|
|
|
@Autowired |
|
|
|
private UserService userService; |
|
|
|
@Autowired |
|
|
|
private TopicService topicService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 议题抽取 |
|
|
|
* @param customerId |
|
|
|
* @param dateId |
|
|
|
* @author zxc |
|
|
|
* @date 2020/9/15 2:02 下午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Boolean issueExtract(String customerId, String dateId) { |
|
|
|
|
|
|
|
// 议题信息查询
|
|
|
|
List<IssueInfoResultDTO> listResult = issueService.selectIssueInfo(customerId, dateId); |
|
|
|
List<FactOriginIssueMainDailyDTO> result = new ArrayList<>(); |
|
|
|
if (CollectionUtils.isEmpty(listResult)){ |
|
|
|
throw new RenException("查询议题信息为空"); |
|
|
|
} |
|
|
|
listResult.forEach(issue -> { |
|
|
|
FactOriginIssueMainDailyDTO factOriginIssueMainDailyDTO = ConvertUtils.sourceToTarget(issue, FactOriginIssueMainDailyDTO.class); |
|
|
|
factOriginIssueMainDailyDTO.setId(issue.getIssueId()); |
|
|
|
result.add(factOriginIssueMainDailyDTO); |
|
|
|
}); |
|
|
|
|
|
|
|
// 创建议题人ID
|
|
|
|
List<String> userIds = listResult.stream().map(issue -> issue.getUserId()).distinct().collect(Collectors.toList()); |
|
|
|
Map<String,Integer> map = userService.selectUserIsParty(userIds); |
|
|
|
if (null != map){ |
|
|
|
result.forEach(r -> { |
|
|
|
map.forEach((userId,isParty) -> { |
|
|
|
if (r.getUserId().equals(userId)){ |
|
|
|
r.setIsParty(isParty); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 创建话题用户身份信息查询
|
|
|
|
List<String> topicIds = listResult.stream().map(issue -> issue.getTopicId()).collect(Collectors.toList()); |
|
|
|
List<TopicInfoResultDTO> topicInfoList = topicService.selectTopicInfo(topicIds); |
|
|
|
if (CollectionUtils.isEmpty(topicInfoList)){ |
|
|
|
throw new RenException("查询创建话题用户身份信息为空"); |
|
|
|
} |
|
|
|
List<String> createTopicUserIds = topicInfoList.stream().map(topic -> topic.getUserId()).distinct().collect(Collectors.toList()); |
|
|
|
Map<String, Integer> topicUserIsParty = userService.selectUserIsParty(createTopicUserIds); |
|
|
|
topicInfoList.forEach(topic -> { |
|
|
|
topicUserIsParty.forEach((userId,isParty) -> { |
|
|
|
if (topic.getUserId().equals(userId)){ |
|
|
|
topic.setIsParty(isParty); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 根据dateId赋值
|
|
|
|
TimeListResultDTO timeList = DateUtils.getTimeList(dateId); |
|
|
|
result.forEach(r -> { |
|
|
|
r.setDateId(dateId); |
|
|
|
r.setWeekId(timeList.getWeekId()); |
|
|
|
r.setMonthId(timeList.getMonthId()); |
|
|
|
r.setQuarterId(timeList.getQuarterId()); |
|
|
|
r.setYearId(timeList.getYearId()); |
|
|
|
topicInfoList.forEach(topic -> { |
|
|
|
if (r.getTopicId().equals(topic.getTopicId())){ |
|
|
|
r.setCreateTopicUserId(topic.getUserId()); |
|
|
|
r.setTopicUserIsParty(topic.getIsParty()); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|