Commit c381b1d7 authored by Quxl's avatar Quxl

x

parent aae64de0
...@@ -12,12 +12,20 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,12 +12,20 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.egolm.common.FileUtil; import com.egolm.common.FileUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate; import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.shop.schedules.AbstractSolrApi; import com.egolm.shop.schedules.AbstractSolrApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api(tags={"搜索引擎更新工具"})
@Controller @Controller
@RequestMapping("util/search/goods")
public class GoodsCollectTask extends AbstractSolrApi{ public class GoodsCollectTask extends AbstractSolrApi{
@Autowired @Autowired
...@@ -52,6 +60,27 @@ public class GoodsCollectTask extends AbstractSolrApi{ ...@@ -52,6 +60,27 @@ public class GoodsCollectTask extends AbstractSolrApi{
deleteIndexQuerySql = FileUtil.fileToString(updateIndexQueryFilePath); deleteIndexQuerySql = FileUtil.fileToString(updateIndexQueryFilePath);
} }
@ApiOperation("更新全量索引")
@PostMapping("createFullIndex")
public String createFullIndex() {
this.createIndex();
return Rjx.jsonOk().toJson();
}
@ApiOperation("更新当天索引")
@PostMapping("updateTodayIndex")
public String updateTodayIndex() {
this.dayExecute();
return Rjx.jsonOk().toJson();
}
@ApiOperation("更新最新索引")
@PostMapping("updateIndex")
public String updateIndex() {
this.minuteExecute();
return Rjx.jsonOk().toJson();
}
@Scheduled(cron="${solr.goods.cron-for-day}") @Scheduled(cron="${solr.goods.cron-for-day}")
public void dayExecute() { public void dayExecute() {
Date date = new Date(System.currentTimeMillis() - (offsetMinuteForDay*60L*1000L)); Date date = new Date(System.currentTimeMillis() - (offsetMinuteForDay*60L*1000L));
......
...@@ -33,8 +33,6 @@ spring.redis.pool.max-wait=2000 ...@@ -33,8 +33,6 @@ spring.redis.pool.max-wait=2000
spring.redis.pool.max-idle=5 spring.redis.pool.max-idle=5
spring.redis.pool.min-idle=0 spring.redis.pool.min-idle=0
solr.baseURL=http://10.10.0.15:8983/solr/goods
### 游客 用户生成用户的前缀 ### 游客 用户生成用户的前缀
redis.guest.key=B2B_Guest redis.guest.key=B2B_Guest
#### 用户验证码存储的前缀 #### 用户验证码存储的前缀
......
...@@ -10,4 +10,5 @@ solr.goods.core-url= http://10.10.0.15:8983/solr/goods ...@@ -10,4 +10,5 @@ solr.goods.core-url= http://10.10.0.15:8983/solr/goods
solr.goods.offset-minute-for-day: 1500 solr.goods.offset-minute-for-day: 1500
solr.goods.offset-minute-for-minute: 10 solr.goods.offset-minute-for-minute: 10
solr.goods.cron-for-day: 0 0 3 * * ? solr.goods.cron-for-day: 0 0 3 * * ?
solr.goods.cron-for-minute: 0 * * * * ? solr.goods.cron-for-minute: 0 * * * * ?
\ No newline at end of file solr.baseURL=http://10.10.0.15:8983/solr/goods
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment