提交 83a29311 作者: 袁浩杰

合并分支 'yjzx_dev' 到 'yjzx_test'

Yjzx dev

查看合并请求 !2
......@@ -5,4 +5,8 @@ public class CommonConstants {
* 智库性质字典key
*/
public static final String DIC_THINK_TANK_NATURE = "think_tank_nature";
/**
* 国家中国id
*/
public static final String CHINA_ID = "1405761925932109826";
}
......@@ -3,7 +3,6 @@ package com.zzsn.thinktank.service.impl;
import cn.hutool.core.map.MapUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -11,6 +10,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.zzsn.thinktank.constants.CommonConstants;
import com.zzsn.thinktank.entity.*;
import com.zzsn.thinktank.mapper.ThinktankBasicInfoMapper;
......@@ -27,7 +28,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
......@@ -40,7 +40,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
......@@ -357,9 +356,25 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
@Override
public Result<?> getList(ThinktankBasicInfoListVo thinktankBasicInfoListVo) {
if(thinktankBasicInfoListVo!=null && StringUtils.isNotBlank(thinktankBasicInfoListVo.getTypeId())
// 缓存的type类型
String cacheTypeStr = thinktankBasicInfoListVo.getTypeId();
if (StringUtils.equals(thinktankBasicInfoListVo.getQueryType(), "all")) {
cacheTypeStr = "all";
thinktankBasicInfoListVo.setTypeId(null);
// 排除中国的
thinktankBasicInfoListVo.setExcludeTypeIds(Lists.newArrayList(CommonConstants.CHINA_ID));
} else if (StringUtils.equals(thinktankBasicInfoListVo.getQueryType(), "other")) {
// 其它-排除热门的
cacheTypeStr = "other" + thinktankBasicInfoListVo.getExcludeTypeIds().toString();
thinktankBasicInfoListVo.setTypeId(null);
thinktankBasicInfoListVo.getExcludeTypeIds().add(CommonConstants.CHINA_ID);
} else {
thinktankBasicInfoListVo.setExcludeTypeIds(null);
}
if(StringUtils.isNotBlank(cacheTypeStr)
&& StringUtils.isBlank(thinktankBasicInfoListVo.getTagId())){
IPage cacheObject = (IPage)simRedisUtil.getCacheObject(KEY + "_" + thinktankBasicInfoListVo.getTypeId()
IPage cacheObject = (IPage)simRedisUtil.getCacheObject(KEY + "_" + cacheTypeStr
+ "_" + thinktankBasicInfoListVo.getColumn() + "_" + thinktankBasicInfoListVo.getOrder());
if(cacheObject!=null){
return Result.OK(cacheObject);
......@@ -452,9 +467,18 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
thinktankTagService.addTagTop(s);
}
}
if(thinktankBasicInfoListVo!=null && StringUtils.isNotBlank(thinktankBasicInfoListVo.getTypeId())
&& StringUtils.isBlank(thinktankBasicInfoListVo.getTagId())){
simRedisUtil.setCacheObject(KEY + "_" + thinktankBasicInfoListVo.getTypeId()
if(StringUtils.isNotBlank(cacheTypeStr) && StringUtils.isBlank(thinktankBasicInfoListVo.getTagId())){
if (Arrays.asList("all", "other").contains(cacheTypeStr) || cacheTypeStr.contains("other")) {
// all 和other数据量过大,只存id
List<Map<String, Object>> ids = (List<Map<String, Object>>) page.getRecords().stream()
.map(v -> {
Map<String, Object> map = Maps.newHashMap();
map.put("id", ((ThinktankBasicInfoVo) v).getId());
return map;
}).collect(Collectors.toList());
page.setRecords(ids);
}
simRedisUtil.setCacheObject(KEY + "_" + cacheTypeStr
+ "_" + thinktankBasicInfoListVo.getColumn() + "_" + thinktankBasicInfoListVo.getOrder(), page,10L, TimeUnit.DAYS);
}
return Result.OK(page);
......@@ -786,7 +810,7 @@ public class ThinktankBasicInfoServiceImpl extends ServiceImpl<ThinktankBasicInf
}
}
queryWrapper.orderByAsc("SUBSTRING(english_whole, 1, 1)");
queryWrapper.orderByDesc("update_time");
Integer total = this.getBaseMapper().selectCount(queryWrapper);
......
......@@ -38,6 +38,10 @@ public class ThinktankBasicInfoListVo {
//类别 根据左侧树id
private String typeId;
//all other
private String queryType;
//查询排除类别
private List<String> excludeTypeIds;
//标签
private String tagId;
......
......@@ -3,8 +3,8 @@ server:
eureka:
instance:
#注册到注册中心通过Feign调用时,hostname必须是服务器ip
hostname: 114.115.141.81
instance-id: 114.115.141.81:9099
hostname: 1.95.42.138
instance-id: 1.95.42.138:9099
prefer-ip-address: false
client:
register-with-eureka: true
......
......@@ -3,8 +3,8 @@ server:
eureka:
instance:
#注册到注册中心通过Feign调用时,hostname必须是服务器ip
hostname: 114.115.141.81
instance-id: 114.115.141.81:9098
hostname: 1.95.42.138
instance-id: 1.95.42.138:9098
prefer-ip-address: false
client:
register-with-eureka: true
......
......@@ -3,8 +3,8 @@ server:
eureka:
instance:
#注册到注册中心通过Feign调用时,hostname必须是服务器ip
hostname: 114.115.141.81
instance-id: 114.115.141.81:9099
hostname: 1.95.42.138
instance-id: 1.95.42.138:9099
prefer-ip-address: false
client:
register-with-eureka: true
......
......@@ -27,6 +27,12 @@
AND a.tag_id like '%${item}%'
</foreach>
</if>
<if test="excludeTypeIds != null and excludeTypeIds.size > 0">
AND a.belong_country_id not in
<foreach item="item" index="index" collection="excludeTypeIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="keyword != null and keyword != ''">
AND
......@@ -50,6 +56,14 @@
<if test="typeId != null and typeId != ''">
AND a.belong_country_id = #{typeId}
</if>
<if test="excludeTypeIds != null and excludeTypeIds.size > 0">
AND a.belong_country_id not in
<foreach item="item" index="index" collection="excludeTypeIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="thinktankName != null and thinktankName != ''">
AND a.chinese_whole like '%${thinktankName}%'
</if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论