Commit 8ba8e0d8 authored by tianyiming's avatar tianyiming

1、es中任务添加任务类型字段并赋值

2、es任务列表查询修改
parent a9366239
......@@ -101,6 +101,7 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -916,6 +917,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} else {
try {
String isFixDate = plan.getIsFixedDate();// 是否固定日期
String planType = PlanTaskTypeStatusEnum.getEnum(Integer.valueOf(plan.getPlanType())).getName();
List<Long> pointIdList = iRoutePointDao.queryRoutePointIds(plan.getRouteId());
int pointNum = iRoutePointDao.countRoutePoint(plan.getRouteId());
long batchNo = now.getTime();
......@@ -1009,6 +1011,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
esPlanTaskListDto.setPlanTaskId(String.valueOf(planTask.getId()));
esPlanTaskListDto.setPlanId(String.valueOf(plan.getId()));
esPlanTaskListDto.setTaskName(plan.getName());
esPlanTaskListDto.setType(planType);
esPlanTaskListDtos.add(esPlanTaskListDto);
}
em.flush();
......@@ -1685,13 +1688,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
public Page<Map<String, Object>> getPlanTasks(String toke, String product, String appKey, HashMap<String, Object> params) {
CommonPageable pageParam = new CommonPageable();
List<Map<String, Object>> content = Lists.newArrayList();
if(params.containsKey("finishStatus")) {
params.put("finishStatus", String.valueOf(PlanTaskTheStatusEnum.getValue(params.get("finishStatus").toString())));
}
if(params.containsKey("type")) {
params.put("type", String.valueOf(PlanTaskTypeStatusEnum.getValue(params.get("type").toString())));
}
SearchRequest request = new SearchRequest();
request.indices("web_app_plan_task_list");
......@@ -1715,14 +1714,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
query.must(QueryBuilders.matchPhraseQuery("finishStatus", "*" + params.get("finishStatus") + "*"));
boolMust.must(query);
}
// if (!ObjectUtils.isEmpty(params.get("type"))) {
// BoolQueryBuilder query = QueryBuilders.boolQuery();
// query.must(QueryBuilders.matchPhraseQuery("type", "*" + params.get("type") + "*"));
// boolMust.must(query);
// }
if (!ObjectUtils.isEmpty(params.get("type"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchPhraseQuery("type", "*" + params.get("type") + "*"));
boolMust.must(query);
}
builder.query(boolMust);
// builder.sort("checkDate", SortOrder.DESC);
if (!ValidationUtil.isEmpty(params.get("orderBy"))) {
String[] split = params.get("orderBy").toString().split(" ");
builder.sort(split[0], split[1].equals("desc") ? SortOrder.DESC : SortOrder.ASC);
} else {
builder.sort("checkDate", SortOrder.DESC);
}
builder.from((Integer.parseInt(params.get("number").toString())) * Integer.parseInt(params.get("size").toString()));
builder.size(Integer.parseInt(params.get("size").toString()));
request.source(builder);
......
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