|
|
@@ -90,54 +90,6 @@ public class SendNoticeTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 每天13点、19点、23点定时检测下发货提醒和订单索引
|
|
|
- */
|
|
|
- @Scheduled(cron = "0 0 13,19,23 * * ? ")
|
|
|
- public void checkIndex() throws Exception{
|
|
|
- Date date = new Date();
|
|
|
- Calendar calendar = Calendar.getInstance();
|
|
|
- calendar.setTime(date);
|
|
|
- calendar.add(Calendar.DATE,-1);
|
|
|
- date = calendar.getTime();
|
|
|
- List<Long> idsNotice = purchaseNoticeDao.findByDate(date);
|
|
|
- calendar.add(Calendar.DATE,-4);
|
|
|
- date = calendar.getTime();
|
|
|
- List<Long> idsOrders = purchaseOrderDao.findByDate(date);
|
|
|
- if (!CollectionUtils.isEmpty(idsNotice)) {
|
|
|
- checkAndUpateAll("purc$notice",idsNotice);
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(idsOrders)) {
|
|
|
- checkAndUpateAll("purc$orders",idsOrders);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void checkAndUpateAll(String tableName,List<Long> ids) throws Exception{
|
|
|
- List<Long> noExistIds = new ArrayList<>();
|
|
|
- for (Long id :ids) {
|
|
|
- String searchInfoUrl = "http://10.10.100.179:8081/search/object?tableName=" + tableName + "&id=";
|
|
|
- HttpUtil.Response response = HttpUtil.sendGetRequest(searchInfoUrl + id, null);
|
|
|
- if (StringUtils.isEmpty(response.getResponseText())) {
|
|
|
- noExistIds.add(id);
|
|
|
- logger.error(String.format("表"+tableName+"未建索引","id为"+id));
|
|
|
- }
|
|
|
- }
|
|
|
- if (!CollectionUtils.isEmpty(noExistIds)) {
|
|
|
- for (Long noExistId : noExistIds) {
|
|
|
- String searchUpdateUrl ="http://10.10.100.179:8081/index/maintain?tableName=" + tableName + "&methodType=update&dataId=";
|
|
|
- HttpRequestBase request = new HttpRequestBase() {
|
|
|
- @Override
|
|
|
- public String getMethod() {
|
|
|
- return "GET";
|
|
|
- }
|
|
|
- };
|
|
|
- request.addHeader("Authorization", "Basic YWRtaW46c2VsZWN0MTExKioq");
|
|
|
- request.setURI(URI.create(searchUpdateUrl + noExistId));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 可发货状态判断逻辑
|
|
|
* <pre>
|