|
@@ -23,6 +23,7 @@ import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class BrandServiceImpl implements BrandService {
|
|
@@ -63,6 +64,7 @@ public class BrandServiceImpl implements BrandService {
|
|
|
@Autowired
|
|
|
BrandCityTierMapper tierMapper;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public List<BrandSearch> searchByLikeName(String text) {
|
|
|
// 根据品牌名称模糊查询
|
|
@@ -73,18 +75,18 @@ public class BrandServiceImpl implements BrandService {
|
|
|
|
|
|
List<BrandSearch> sList = new ArrayList<>();
|
|
|
// 补齐品牌的企业信息
|
|
|
- for (Brand brand : list) {
|
|
|
- QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
- enterpriseQueryWrapper.eq("enterprise_usci", brand.getEnterpriseUsci());
|
|
|
- Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
|
- BrandSearch bs = new BrandSearch();
|
|
|
- bs.setBrandId(brand.getBrandId());
|
|
|
- bs.setBrandName(brand.getBrandName());
|
|
|
- if (enterprise != null)
|
|
|
- bs.setEnterpriseName(enterprise.getEnterpriseName());
|
|
|
- bs.setUpdateTime(brand.getUpdateTime());
|
|
|
- sList.add(bs);
|
|
|
- }
|
|
|
+// for (Brand brand : list) {
|
|
|
+// QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
+// enterpriseQueryWrapper.eq("enterprise_usci", brand.getEnterpriseUsci());
|
|
|
+// Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
|
+// BrandSearch bs = new BrandSearch();
|
|
|
+// bs.setBrandId(brand.getBrandId());
|
|
|
+// bs.setBrandName(brand.getBrandName());
|
|
|
+// if (enterprise != null)
|
|
|
+// bs.setEnterpriseName(enterprise.getEnterpriseName());
|
|
|
+// bs.setUpdateTime(brand.getUpdateTime());
|
|
|
+// sList.add(bs);
|
|
|
+// }
|
|
|
return sList;
|
|
|
}
|
|
|
|
|
@@ -98,7 +100,7 @@ public class BrandServiceImpl implements BrandService {
|
|
|
|
|
|
if (brand == null)
|
|
|
return null;
|
|
|
- // 查询企业
|
|
|
+/* // 查询企业
|
|
|
QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
enterpriseQueryWrapper.eq("enterprise_usci", brand.getEnterpriseUsci());
|
|
|
Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
@@ -109,12 +111,13 @@ public class BrandServiceImpl implements BrandService {
|
|
|
industryCategoryQueryWrapper.eq("industry_code", brand.getIndustryCode());
|
|
|
IndustryCategory industryCategory = industryCategoryDao.selectOne(industryCategoryQueryWrapper);
|
|
|
info.setIndustryName(industryCategory != null ? industryCategory.getSubCategory() : null);
|
|
|
- } else info.setIndustryName(null);
|
|
|
+ } else info.setIndustryName(null);*/
|
|
|
// 是否已经关注
|
|
|
QueryWrapper<AttentionPool> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("brand_id", brandId)
|
|
|
.eq("wd_id", "");
|
|
|
AttentionPool pool = attentionPoolDao.selectOne(queryWrapper);
|
|
|
+ BrandInfo info = new BrandInfo(brand,null);
|
|
|
info.setAttention(pool == null ? 0 : 1);
|
|
|
return info;
|
|
|
}
|
|
@@ -255,13 +258,32 @@ public class BrandServiceImpl implements BrandService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageInfo<List<BrandSearch>> searchListByMulti(ListQueryBody body, String userId) {
|
|
|
- PageHelper.startPage(body.getPageNum(), body.getPageSize(), true);
|
|
|
- List<String> industryCode = body.getIndustryCode();
|
|
|
- /*
|
|
|
- industryCode行业类别码,例如101000,但不确定,需要对其拆解,查询其子类别。
|
|
|
- 因数据库数据不齐,这里没有进行相关处理
|
|
|
- */
|
|
|
+ public Page<BrandSearch> searchListByMulti(ListQueryBody body, String userId) {
|
|
|
+ QueryWrapper<Enterprise> queryWrapper = null;
|
|
|
+ //过滤企业
|
|
|
+ if (body.getIsOpenEnterprise()){
|
|
|
+ queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.select("enterprise_usci");
|
|
|
+ //获取符合条件的企业id
|
|
|
+ //营业状态
|
|
|
+ if (body.getBusinessStatus() != null && !body.getBusinessStatus().equals("")) {
|
|
|
+ queryWrapper.eq("business_status",body.getBusinessStatus());
|
|
|
+ }
|
|
|
+ //企业类型
|
|
|
+ if (body.getEnterpriseType() != null && !body.getEnterpriseType().equals("")) {
|
|
|
+ queryWrapper.and(stringQueryWrapper -> {
|
|
|
+ stringQueryWrapper.eq("enterprise_type",body.getEnterpriseType());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //企业名称
|
|
|
+ if (body.getEnterpriseName() != null && !body.getEnterpriseName().equals("")) {
|
|
|
+ queryWrapper.and(stringQueryWrapper -> {
|
|
|
+ stringQueryWrapper.like("enterprise_name",body.getEnterpriseName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Page<BrandSearch> page = new Page<>(body.getPageNum(), body.getPageSize());
|
|
|
Integer countDown = null;
|
|
|
Integer countUp = null;
|
|
|
Integer coverDown = null;
|
|
@@ -282,10 +304,11 @@ public class BrandServiceImpl implements BrandService {
|
|
|
coverUp = Integer.parseInt(body.getCoverCityCount().get(1));
|
|
|
}
|
|
|
}
|
|
|
- List<BrandSearch> brandSearches = brandMapper.searchSearchByMulti(body.getText(), industryCode, countUp, countDown, coverUp, coverDown);
|
|
|
+
|
|
|
+ Page<BrandSearch> brandSearches = brandMapper.searchSearchByMulti(page,body.getText(), countUp, countDown, coverUp, coverDown,queryWrapper);
|
|
|
// 赋予attention字段信息,0:未关注;1:已关注
|
|
|
if (userId == null || userId.equals("")) { // 用户未登录或无效用户id,都是未关注状态
|
|
|
- for (BrandSearch search : brandSearches) {
|
|
|
+ for (BrandSearch search : brandSearches.getRecords()) {
|
|
|
QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
enterpriseQueryWrapper.eq("enterprise_usci", search.getEnterpriseName());
|
|
|
Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
@@ -297,7 +320,7 @@ public class BrandServiceImpl implements BrandService {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
for (AttentionPool pool : pools)
|
|
|
map.put(pool.getBrandId(), "1");
|
|
|
- for (BrandSearch search : brandSearches) {
|
|
|
+ for (BrandSearch search : brandSearches.getRecords()) {
|
|
|
QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
enterpriseQueryWrapper.eq("enterprise_usci", search.getEnterpriseName());
|
|
|
Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
@@ -305,7 +328,7 @@ public class BrandServiceImpl implements BrandService {
|
|
|
search.setAttention(map.get(search.getBrandId()) == null ? 0 : 1);
|
|
|
}
|
|
|
}
|
|
|
- return new PageInfo(brandSearches);
|
|
|
+ return brandSearches;
|
|
|
}
|
|
|
|
|
|
@Override
|