Quellcode durchsuchen

数据解析 增加 数据关联查询

jkzlzhoujie vor 6 Jahren
Ursprung
Commit
e797b7bde6

+ 11 - 3
src/main/java/com/yihu/quota/service/cube/ElasticSearchDataProcessService.java

@ -434,7 +434,7 @@ public class ElasticSearchDataProcessService {
        dataType = dataType.toLowerCase();
        if(dataType.equals("string")){
            value = keyValue;
        }else if(dataType.equals("int")){
        }else if(dataType.equals("integer")){
            int intValue = Integer.valueOf(keyValue);
            value = intValue;
        }else if(dataType.equals("double")){
@ -443,8 +443,16 @@ public class ElasticSearchDataProcessService {
            double doubleValue = Double.valueOf(keyValue);
            value = doubleValue;
        }else if(dataType.equals("date")){
            Date dateValue = DateUtil.formatCharDateYMDHMS(keyValue);
            value = dateValue;
            String dateFormat = "yyyy-MM-dd";
            if(keyValue.length() != 10){
                dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ";
            }
            //比中国所在地区东八区少8小时.
            Date dateValue = DateUtil.parseDate(keyValue, dateFormat);
            Calendar ca = Calendar.getInstance();
            ca.setTime(dateValue);
            ca.add(Calendar.HOUR_OF_DAY, 8);
            value = ca.getTime();
        }
        return value;
    }

+ 1 - 1
src/main/java/com/yihu/quota/util/ElasticSearchHandler.java

@ -175,7 +175,7 @@ public class ElasticSearchHandler {
                if("string".equals(dataType)){
                    mapping.startObject(field).field("type", "string").field("index", "not_analyzed").endObject();
                }else if("date".equals(dataType)){
                    mapping.startObject(field).field("type", "date").field("format", "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis").endObject();
                    mapping.startObject(field).field("type", "date").field("format", "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||strict_date_optional_time||epoch_millis").endObject();
                }else if("object".equals(dataType)){//对象属性
                    mapping.startObject(field).startObject("properties");
                    //子属性