|
|
@@ -5,7 +5,12 @@ import com.fs.common.constant.FsConstants;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCacheT;
|
|
|
import com.fs.common.exception.base.BaseException;
|
|
|
+import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.company.domain.Company;
|
|
|
+import com.fs.company.mapper.CompanyMapper;
|
|
|
+import com.fs.qw.domain.QwCompany;
|
|
|
import com.fs.qw.domain.QwFriendWelcome;
|
|
|
+import com.fs.qw.mapper.QwCompanyMapper;
|
|
|
import com.fs.qw.mapper.QwFriendWelcomeItemMapper;
|
|
|
import com.fs.qw.mapper.QwFriendWelcomeMapper;
|
|
|
import com.fs.qw.mapper.QwUserMapper;
|
|
|
@@ -28,10 +33,10 @@ import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URL;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 好友欢迎语Service业务层处理
|
|
|
@@ -55,6 +60,10 @@ public class QwFriendWelcomeServiceImpl implements IQwFriendWelcomeService {
|
|
|
|
|
|
@Autowired
|
|
|
private RedisCacheT<Long> redisCache;
|
|
|
+ @Autowired
|
|
|
+ private CompanyMapper companyMapper;
|
|
|
+ @Autowired
|
|
|
+ private QwCompanyMapper qwCompanyMapper;
|
|
|
|
|
|
/**
|
|
|
* 查询好友欢迎语
|
|
|
@@ -389,8 +398,28 @@ public class QwFriendWelcomeServiceImpl implements IQwFriendWelcomeService {
|
|
|
* @return list
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<QwFriendWelcome> selectQwFriendWelcomeList(QwFriendWelcomeParam qwFriendWelcomeParam) {
|
|
|
- return qwFriendWelcomeMapper.selectQwFriendWelcomeList(qwFriendWelcomeParam);
|
|
|
+ public List<QwFriendWelcomeVO> selectQwFriendWelcomeList(QwFriendWelcomeParam qwFriendWelcomeParam) {
|
|
|
+ List<QwFriendWelcomeVO> qwFriendWelcomes = qwFriendWelcomeMapper.selectQwFriendWelcomeList(qwFriendWelcomeParam);
|
|
|
+
|
|
|
+ if (qwFriendWelcomes.isEmpty()) {
|
|
|
+ return qwFriendWelcomes;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> companyIds = qwFriendWelcomes.stream().map(QwFriendWelcomeVO::getCompanyId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
+ List<String> corpIds = qwFriendWelcomes.stream().map(QwFriendWelcomeVO::getCorpId).filter(StringUtils::isNotBlank).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ Map<Long, String> companyMap = companyIds.isEmpty()
|
|
|
+ ? Collections.emptyMap()
|
|
|
+ : companyMapper.selectCompanyByIds(companyIds).stream().collect(Collectors.toMap(Company::getCompanyId, Company::getCompanyName, (a, b) -> a));
|
|
|
+ Map<String, String> corpMap = corpIds.isEmpty()
|
|
|
+ ? Collections.emptyMap()
|
|
|
+ : qwCompanyMapper.selectByCorpIds(corpIds).stream().collect(Collectors.toMap(QwCompany::getCorpId, QwCompany::getCorpName, (a, b) -> a
|
|
|
+ ));
|
|
|
+ qwFriendWelcomes.forEach(qwFriendWelcome -> {
|
|
|
+ qwFriendWelcome.setCompanyName(companyMap.getOrDefault(qwFriendWelcome.getCompanyId(), ""));
|
|
|
+ qwFriendWelcome.setCorpName(corpMap.getOrDefault(qwFriendWelcome.getCorpId(), ""));
|
|
|
+ });
|
|
|
+ return qwFriendWelcomes;
|
|
|
}
|
|
|
|
|
|
/**
|