Commit 67c60961 authored by Quxl's avatar Quxl

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

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