提交 83a29311 作者: 袁浩杰

合并分支 'yjzx_dev' 到 'yjzx_test'

Yjzx dev

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