Commit cddc9736 authored by 曹盼盼's avatar 曹盼盼

修改设备列表

parent d881e72a
...@@ -69,8 +69,8 @@ public class ESEquipmentCategoryDto { ...@@ -69,8 +69,8 @@ public class ESEquipmentCategoryDto {
@Field(type = FieldType.Text) @Field(type = FieldType.Text)
private String STATUS; private String STATUS;
@Field(type = FieldType.Date, format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_second") @Field(type = FieldType.Long)
private Date REC_DATE; private Long REC_DATE;
} }
...@@ -40,6 +40,7 @@ import org.elasticsearch.client.RestHighLevelClient; ...@@ -40,6 +40,7 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
...@@ -870,7 +871,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -870,7 +871,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Long count = bizJdbcTemplate.queryForObject(countSql, Long.class); Long count = bizJdbcTemplate.queryForObject(countSql, Long.class);
return count; return count;
} }
/** /**
* es数据同步 * es数据同步
* *
...@@ -901,6 +901,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -901,6 +901,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* es保存设备数据 * es保存设备数据
*/ */
public ESEquipmentCategoryDto saveESEquipmentCategory(Map<String, Object> map) { public ESEquipmentCategoryDto saveESEquipmentCategory(Map<String, Object> map) {
//处理时间问题
long recDate = new Date(map.get("REC_DATE").toString()).getTime();
map.put("REC_DATE",recDate);
ESEquipmentCategoryDto dto = JSONObject.parseObject(JSONObject.toJSONString(map), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto dto = JSONObject.parseObject(JSONObject.toJSONString(map), ESEquipmentCategoryDto.class);
ESEquipmentCategoryDto save = esEquipmentCategory.save(dto); ESEquipmentCategoryDto save = esEquipmentCategory.save(dto);
if (!ObjectUtils.isEmpty(save)) { if (!ObjectUtils.isEmpty(save)) {
...@@ -958,7 +961,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -958,7 +961,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_NAME"))) { if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("ORG_BRANCH_NAME", "*" + map.getString("ORG_BRANCH_NAME") + "*")); query.must(QueryBuilders.matchQuery("ORG_BRANCH_NAME", map.getString("ORG_BRANCH_NAME") ));
boolMust.must(query); boolMust.must(query);
} }
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
...@@ -968,7 +971,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -968,7 +971,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) { if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_NAME"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
query.must(QueryBuilders.matchQuery("USE_UNIT_NAME", "*" + map.getString("USE_UNIT_NAME") + "*")); query.must(QueryBuilders.matchQuery("USE_UNIT_NAME", map.getString("USE_UNIT_NAME")));
boolMust.must(query); boolMust.must(query);
} }
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE"))) {
...@@ -1034,6 +1037,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1034,6 +1037,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
builder.query(boolMust); builder.query(boolMust);
builder.sort("REC_DATE", SortOrder.DESC);
builder.from((map.getInteger("number") - 1) * map.getInteger("size")); builder.from((map.getInteger("number") - 1) * map.getInteger("size"));
builder.size(map.getInteger("size")); builder.size(map.getInteger("size"));
request.source(builder); 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