Commit 67c60961 authored by Quxl's avatar Quxl

优化搜索引擎接口,计划任务

parent 8abd95d0
......@@ -72,17 +72,17 @@ public class SolrGoodsController {
if(this.getLock().getCode() == 200) {
try {
service.update(null);
return Rjx.jsonOk();
} finally {
this.releaseLock();
}
} else {
return Rjx.jsonErr().setMessage("该任务正在运行,请不要重复执行");
}
return Rjx.jsonOk();
}
private static final String SCHEDULE_LOCK_KEY = "SCHEDULE_LOCK_KEY";
private static final long SCHEDULE_LOCK_EXPIRE = 1000*60;
public static final String SCHEDULE_LOCK_KEY = "SCHEDULE_LOCK_KEY";
public static Long SCHEDULE_LOCK_EXPIRE = 1000L*60*60;
@ResponseBody
@PostMapping("getLock")
......
......@@ -4,7 +4,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
public interface SolrGoodsService {
public Rjx query(Page page, String queryKey, String[] keywords, String[] facetFields, String[] facetPivotFields);
public void update(String sDistrictID);
......
......@@ -34,6 +34,7 @@ import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.shop.config.XException;
import com.egolm.shop.controller.SolrGoodsController;
import com.egolm.shop.service.SolrGoodsService;
@Service
......@@ -168,6 +169,7 @@ public class SolrGoodsServiceImpl implements SolrGoodsService {
@Async
public void update(String sDistrictID) {
Long start = System.currentTimeMillis();
List<String> strs = new ArrayList<String>();
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
if(StringUtil.isBlank(sDistrictID)) {
......@@ -320,6 +322,7 @@ public class SolrGoodsServiceImpl implements SolrGoodsService {
}
}
}
SolrGoodsController.SCHEDULE_LOCK_EXPIRE = System.currentTimeMillis() - start;;
}
}
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