Browse Source

Merge branch 'dev' of yeshijie/wlyy2.0 into dev

叶仕杰 4 years ago
parent
commit
9ccd8f153c

+ 45 - 18
common/common-entity-es/src/main/java/com/yihu/jw/datainput/DataBodySignsDO.java

@ -13,16 +13,19 @@ public class DataBodySignsDO {
    @JestId
    private String id;
    private String access_token; //访问token
    private String data_source; //数据来源
    private String sn;          //设备序列码
    private String ext_code;    //设备A,B键,取值为0,1,代表绑定不同的用户,
    private String device_name; //设备名称
    private String device_model;//设备型号
    private List<Data> data;    //设备所测量的数据内容
    private List<MeasureData> measure_data;    //设备所测量的数据内容
    private List<PositionData> position_data;    //设备所测量的数据内容
    private String idCard;      //设备绑定的用户身份证号
    private String username;    //用户名
    private String usercode;    //用户在系统中的code,唯一识别
    private String rid; // 存到hbase中的id
    private Integer status =0; //状态:0为标准,1为异常
    private Integer del = 1; //删除标记,1代表正常,0代表删除
    public String getId() {
        return this.id;
@ -32,14 +35,6 @@ public class DataBodySignsDO {
        this.id = id;
    }
    public String getAccess_token() {
        return access_token;
    }
    public void setAccess_token(String access_token) {
        this.access_token = access_token;
    }
    public String getData_source() {
        return data_source;
    }
@ -80,14 +75,6 @@ public class DataBodySignsDO {
        this.device_model = device_model;
    }
    public List<Data> getData() {
        return data;
    }
    public void setData(List<Data> data) {
        this.data = data;
    }
    public String getIdCard() {
        return idCard;
    }
@ -111,4 +98,44 @@ public class DataBodySignsDO {
    public void setUsercode(String usercode) {
        this.usercode = usercode;
    }
    public String getRid() {
        return rid;
    }
    public void setRid(String rid) {
        this.rid = rid;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public List<MeasureData> getMeasure_data() {
        return measure_data;
    }
    public void setMeasure_data(List<MeasureData> measure_data) {
        this.measure_data = measure_data;
    }
    public List<PositionData> getPosition_data() {
        return position_data;
    }
    public void setPosition_data(List<PositionData> position_data) {
        this.position_data = position_data;
    }
}

+ 80 - 0
common/common-entity-es/src/main/java/com/yihu/jw/datainput/MeasureData.java

@ -0,0 +1,80 @@
package com.yihu.jw.datainput;
/**
 * Created by yeshijie on 2020/6/18.
 */
public class MeasureData {
    private String type;//体征类型
    private String measure_time;//测量时间
    private String sign_name;//体征指标名称
    private String sign_value;//体征指标值
    private String sign_unit;//体征指标单位
    private String explain;//测量结果的解释分析
    private String filepath;// 测量附件
    private String reference;//测量结果参考标准
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getMeasure_time() {
        return measure_time;
    }
    public void setMeasure_time(String measure_time) {
        this.measure_time = measure_time;
    }
    public String getSign_name() {
        return sign_name;
    }
    public void setSign_name(String sign_name) {
        this.sign_name = sign_name;
    }
    public String getSign_value() {
        return sign_value;
    }
    public void setSign_value(String sign_value) {
        this.sign_value = sign_value;
    }
    public String getSign_unit() {
        return sign_unit;
    }
    public void setSign_unit(String sign_unit) {
        this.sign_unit = sign_unit;
    }
    public String getExplain() {
        return explain;
    }
    public void setExplain(String explain) {
        this.explain = explain;
    }
    public String getFilepath() {
        return filepath;
    }
    public void setFilepath(String filepath) {
        this.filepath = filepath;
    }
    public String getReference() {
        return reference;
    }
    public void setReference(String reference) {
        this.reference = reference;
    }
}

+ 37 - 0
common/common-entity-es/src/main/java/com/yihu/jw/datainput/PositionData.java

@ -0,0 +1,37 @@
package com.yihu.jw.datainput;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
/**
 * Created by yeshijie on 2020/6/18.
 */
public class PositionData {
    private GeoPoint location;//坐标 lat lon
    private String altitude; //海拨
    private String position; //位置描述,例如几号病房几床
    public GeoPoint getLocation() {
        return location;
    }
    public void setLocation(GeoPoint location) {
        this.location = location;
    }
    public String getAltitude() {
        return altitude;
    }
    public void setAltitude(String altitude) {
        this.altitude = altitude;
    }
    public String getPosition() {
        return position;
    }
    public void setPosition(String position) {
        this.position = position;
    }
}

+ 51 - 49
svr/svr-iot/sql-scripts/body_health_data_es.txt

@ -6,57 +6,25 @@ POST http://172.26.0.112:9200/body_health_data/signs_data/_mapping
{
    "signs_data": {
        "properties": {
            "access_token": {
            "device_name": {
                "type": "string",
                "index": "not_analyzed"
            },
            "device_name": {
            "del": {
                "type": "string",
                "index": "not_analyzed"
            },
            "data": {
            "rid": {
                "type": "string",
                "index": "not_analyzed"
            },
            "status": {
                "type": "string",
                "index": "not_analyzed"
            },
            "measure_data": {
                "properties": {
                    "value1": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value2": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value3": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value4": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value5": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value6": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value7": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value8": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value9": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "value10": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "del": {
                    "type": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
@ -64,15 +32,42 @@ POST http://172.26.0.112:9200/body_health_data/signs_data/_mapping
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "rid": {
                        "type": "string",
                        "index": "not_analyzed"
                     "sign_name": {
                         "type": "string",
                         "index": "not_analyzed"
                     },
                     "sign_value": {
                         "type": "string",
                         "index": "not_analyzed"
                     },
                     "sign_unit": {
                         "type": "string",
                         "index": "not_analyzed"
                     },
                      "explain": {
                          "type": "string",
                          "index": "not_analyzed"
                      },
                      "filepath": {
                          "type": "string",
                          "index": "not_analyzed"
                      },
                      "reference": {
                          "type": "string",
                          "index": "not_analyzed"
                      }
                }
            },
            "position_data": {
                "properties": {
                    "location": {
                        "type": "geo_point"
                    },
                    "type": {
                    "altitude": {
                        "type": "string",
                        "index": "not_analyzed"
                    },
                    "status": {
                    "position": {
                        "type": "string",
                        "index": "not_analyzed"
                    }
@ -90,6 +85,10 @@ POST http://172.26.0.112:9200/body_health_data/signs_data/_mapping
                "type": "string",
                "index": "not_analyzed"
            },
            "idcard": {
                "type": "string",
                "index": "not_analyzed"
            },
            "sn": {
                "type": "string",
                "index": "not_analyzed"
@ -109,3 +108,6 @@ POST http://172.26.0.112:9200/body_health_data/signs_data/_mapping
        }
    }
}

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/third/ThirdDataInputController.java

@ -31,9 +31,9 @@ public class ThirdDataInputController {
    @Autowired
    private DataSearchService dataSearchService;
    @PostMapping(value = IotRequestMapping.ThirdOpen.bindUser)
    @PostMapping(value = IotRequestMapping.ThirdOpen.registedevice)
    @ApiOperation(value = "设备注册绑定", notes = "设备注册并绑定用户")
    public MixEnvelop bindUser(@ApiParam(name = "jsonData", value = "", defaultValue = "") @RequestParam String jsonData){
    public MixEnvelop registedevice(@ApiParam(name = "jsonData", value = "", defaultValue = "") @RequestParam String jsonData){
        try{
            return MixEnvelop.getSuccess(DataRequestMapping.DataInput.message_success,dataInputService.bindUser(jsonData));
        } catch (ApiException e){

+ 13 - 25
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java

@ -138,7 +138,6 @@ public class DataInputService {
        //提取json某些项值
        DataBodySignsDO dataBodySignsDO = JSONObject.parseObject(json,DataBodySignsDO.class);
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
@ -168,7 +167,7 @@ public class DataInputService {
                    measuretime = DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss);
                }
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(dataSource,deviceSn);
                rowkey = RowKeyUtils.makeRowKey();
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {
@ -264,6 +263,7 @@ public class DataInputService {
        if(StringUtils.isEmpty(json)){
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","parameter json is null");
            result.put("status",-1);
            return result.toString();
        }
        String fileName = "";
@ -277,11 +277,11 @@ public class DataInputService {
            logger.error("json parse error,invalid json string");
            result.put("msg","json parse error,invalid json string");
            result.put("response",ConstantUtils.FAIL);
            result.put("status",-1);
            return result.toString();
        }
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
@ -293,44 +293,31 @@ public class DataInputService {
            updateBindUser(dataSource,deviceSn,idcard,username);
        }*/
        JSONArray jsonArray = jsonObject.getJSONArray("data");
        JSONArray jsonArray = jsonObject.getJSONArray("measure_data");
        if(null == jsonArray || jsonArray.size() == 0){
            result.put("response",ConstantUtils.FAIL);
            result.put("msg","parameter 'data' of json no exist");
            result.put("status",-1);
            return result.toString();
        }
        List<String> rowkeyList = new ArrayList<>();
        List<Map<String,Map<String,String>>> familyList = new ArrayList<>();
        //生成一份json数据的rowkey
        rowkey = RowKeyUtils.makeRowKey();
        jsonObject.put("rid",rowkey);//hbase的rowkey
        rowkeyList.add(rowkey);
        //循环数据,一组数据存一行,生成一个rowkey,并将该rowkey存到es中
        for(Object obj:jsonArray){
            JSONObject data = (JSONObject)obj;
            data.put("del","1"); //添加删除标记
            try {
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(dataSource,deviceSn);
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {
                logger.error("make rowkey error");
                result.put("msg","make rowkey error");
                result.put("response",ConstantUtils.FAIL);
                return result.toString();
            }
            //组装B列
            Map<String, Map<String, String>> family = new HashMap<>();
            Map<String, String> columnsB = new HashMap<>();
            for(String key:data.keySet()){
                if(StringUtils.equalsIgnoreCase("rid",key)){ //存到hbase里的数据不需要rid
                    continue;
                }
                columnsB.put(key,data.getString(key));
            }
            if(data.containsKey("ecg")){
                fileName = data.getString("fileName");
                fileAbsPath = data.getString("filepath");
            }
            family.put(ConstantUtils.familyB,columnsB);
            familyList.add(family);
        }
@ -350,8 +337,10 @@ public class DataInputService {
            rids.addAll(rowkeyList);
            result.put("rid",rids);
            result.put("response",ConstantUtils.SUCCESS);
            result.put("status",200);
        }else{
            result.put("response",ConstantUtils.FAIL);
            result.put("status",-1);
        }
        /*try {
@ -400,7 +389,6 @@ public class DataInputService {
        }
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
@ -428,7 +416,7 @@ public class DataInputService {
            data.put("del","1"); //添加删除标记
            try {
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(dataSource,deviceSn);
                rowkey = RowKeyUtils.makeRowKey();
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataStandardConvertService.java

@ -54,7 +54,7 @@ public class DataStandardConvertService {
        DataBodySignsDO dataBodySignsDO = JSONObject.parseObject(oldJson,DataBodySignsDO.class);
        JSONObject jsonObject = JSONObject.parseObject(oldJson);
        //如果没有授权或者数据来源,则表示数据异常
        if(null == dataBodySignsDO.getAccess_token() || (null != dataBodySignsDO.getAccess_token() && null == dataBodySignsDO.getData_source())){
        if(null == dataBodySignsDO.getData_source()){
            logger.warn("传过来的数据无有效access_token或data_source",oldJson);
            return "";
        }

+ 9 - 0
svr/svr-iot/src/main/java/com/yihu/iot/datainput/util/RowKeyUtils.java

@ -11,6 +11,7 @@ import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
import java.security.Key;
import java.security.spec.AlgorithmParameterSpec;
import java.util.UUID;
public class RowKeyUtils {
@ -26,6 +27,14 @@ public class RowKeyUtils {
    }
    /**
     * 用uuid做rowkey
     * @return
     */
    public static String makeRowKey(){
        return UUID.randomUUID().toString();
    }
    /**
     * 将rowkey里的信息还原回去
     */

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/model/BaseResultModel.java

@ -31,8 +31,8 @@ public class BaseResultModel {
    public enum statusEm {
        success(10000, "请求成功"),//请求成功
        error_Appid(-9000, "appid不存在"),//appid不存在
        error_AppSecret(-9001, "AppSecret不存在"),//AppSecret不存在
        error_Appid(40004, "appid不存在"),//appid不存在
        error_AppSecret(40001, "AppSecret不存在"),//AppSecret不存在
        token_out_effect(-9002, "无效的token"),//token无效
        token_no_power(-9003, "用户没权限"),// 没权限 包括未授权 或者uri错误
        token_out_time(-9004, "accesstoken已过期"),//token无效

+ 91 - 49
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/IotAnalyzerService.java

@ -10,10 +10,8 @@ import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.datainput.util.RowKeyUtils;
import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.jw.datainput.DataBodySignsDO;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.apache.http.client.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -52,6 +50,14 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
    @Autowired
    private DeviceHealthyInfoMappingDao deviceHealthyInfoMappingDao;
    private String bloodSugarUnit = "mmol/L";
    private String bloodPressureUnit = "mmHg";
    private String pulseUnit = "bpm";
    private String heightUnit = "cm";
    private String weightUnit = "kg";
    private String bmiUnit = "kg/m^2";
    private String waistUnit = "cm";
    public void initIHealthIntoEs(){
        try {
            Integer id = 0;
@ -74,7 +80,7 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
                        DeviceHealthyInfoMapping info = new DeviceHealthyInfoMapping();
                        info.setCreateTime(new Date());
                        info.setIndexId(one.getLong("id"));
                        info.setRid(tmp.getJSONArray("data").getJSONObject(0).getString("rid"));
                        info.setRid(tmp.getString("rid"));
                        infos.add(info);
                    }
                }
@ -94,7 +100,7 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
                deviceHealthyInfoMappingDao.save(infos);
                //下一次
                id = list.get(list.size()-1).getInteger("id");
                list = myJdbcTemplate.queryJson(sql,new Object[]{id});
//                list = myJdbcTemplate.queryJson(sql,new Object[]{id});
            }
        }catch (Exception e){
@ -110,7 +116,6 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
    public String initUpload(JSONObject jsonObject){
        JSONObject json = new JSONObject();
        Integer type = jsonObject.getInteger("type");
        json.put("access_token","iHealth");
        json.put("data_source","iHealth");
        json.put("sn",StringUtils.trimToEmpty(jsonObject.getString("device_sn")));
        json.put("ext_code",StringUtils.trimToEmpty(jsonObject.getString("user_type")));
@ -119,54 +124,111 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
            json.put("device_model",StringUtils.trimToEmpty(jsonObject.getString("device_name")));
        }else{
            //历史数据未绑定居民
            String sql = "SELECT i.device_code,i.device_model,i.device_name from device.wlyy_devices i WHERE device_code = '"+jsonObject.getString("device_sn")+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            if(list.size()>0){
                json.put("device_name",StringUtils.trimToEmpty(list.get(0).get("device_name").toString()));
                json.put("device_model",StringUtils.trimToEmpty(list.get(0).get("device_model").toString()));
            if(StringUtils.isNotEmpty(jsonObject.getString("device_sn"))){
                String sql = "SELECT i.device_code,i.device_model,i.device_name from device.wlyy_devices i WHERE device_code = '"+jsonObject.getString("device_sn")+"'";
                List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
                if(list.size()>0){
                    json.put("device_name",StringUtils.trimToEmpty(list.get(0).get("device_name").toString()));
                    json.put("device_model",StringUtils.trimToEmpty(list.get(0).get("device_model").toString()));
                }
            }
        }
        json.put("idcard",StringUtils.trimToEmpty(jsonObject.getString("idcard")));
        json.put("username",StringUtils.trimToEmpty(jsonObject.getString("name")));
        json.put("usercode",StringUtils.trimToEmpty(jsonObject.getString("user")));
        json.put("del",StringUtils.trimToEmpty(jsonObject.getString("del")));
        json.put("status",getStatus(jsonObject.getString("status")));
        JSONArray jsonArray = new JSONArray();
        JSONObject js = new JSONObject();
        js.put("measure_time",subStringTime(jsonObject.getString("record_date")));
        js.put("del",StringUtils.trimToEmpty(jsonObject.getString("del")));
        js.put("status",getStatus(jsonObject.getString("status")));
        js.put("type",String.valueOf(type));
        String measure_time = subStringTime(jsonObject.getString("record_date"));
        switch (type){
            case 1:
                //血糖
                js.put("value1",jsonObject.getString("value1"));
                js.put("value2",jsonObject.getString("value2"));
                JSONObject blood_sugar = new JSONObject();
                blood_sugar.put("measure_time",measure_time);
                blood_sugar.put("type","BloodSugar");
                blood_sugar.put("sign_name","blood_sugar");
                blood_sugar.put("sign_value",jsonObject.getString("value1"));
                blood_sugar.put("sign_unit",bloodSugarUnit);
                jsonArray.add(blood_sugar);
                JSONObject blood_sugar_result = new JSONObject();
                blood_sugar_result.put("measure_time",measure_time);
                blood_sugar_result.put("type","BloodSugar");
                blood_sugar_result.put("sign_name","blood_sugar_result");
                blood_sugar_result.put("sign_value",jsonObject.getString("value2"));
                jsonArray.add(blood_sugar_result);
                break;
            case 2:
                //血压
                js.put("value1",jsonObject.getString("value1"));
                js.put("value2",jsonObject.getString("value2"));
                JSONObject systolic = new JSONObject();
                systolic.put("measure_time",measure_time);
                systolic.put("type","BloodPressure");
                systolic.put("sign_name","systolic");
                systolic.put("sign_value",jsonObject.getString("value1"));
                systolic.put("sign_unit",bloodPressureUnit);
                jsonArray.add(systolic);
                JSONObject diastolic = new JSONObject();
                diastolic.put("measure_time",measure_time);
                diastolic.put("type","BloodPressure");
                diastolic.put("sign_name","diastolic");
                diastolic.put("sign_value",jsonObject.getString("value2"));
                diastolic.put("sign_unit",bloodPressureUnit);
                jsonArray.add(diastolic);
                if(StringUtils.isNotBlank(jsonObject.getString("value3"))){
                    js.put("value3",jsonObject.getString("value3"));
                    JSONObject pulse = new JSONObject();
                    pulse.put("measure_time",measure_time);
                    pulse.put("type","BloodPressure");
                    pulse.put("sign_name","pulse");
                    pulse.put("sign_value",jsonObject.getString("value3"));
                    pulse.put("sign_unit",pulseUnit);
                    jsonArray.add(pulse);
                }
                break;
            case 3:
                //体重/身高/BMI
                js.put("value1",jsonObject.getString("value1"));
                js.put("value2",jsonObject.getString("value2"));
                JSONObject height = new JSONObject();
                height.put("measure_time",measure_time);
                height.put("type","Height");
                height.put("sign_name","height");
                height.put("sign_value",jsonObject.getString("value1"));
                height.put("sign_unit",heightUnit);
                jsonArray.add(height);
                JSONObject weight = new JSONObject();
                weight.put("measure_time",measure_time);
                weight.put("type","Height");
                weight.put("sign_name","weight");
                weight.put("sign_value",jsonObject.getString("value2"));
                weight.put("sign_unit",weightUnit);
                jsonArray.add(weight);
                if(StringUtils.isNotBlank(jsonObject.getString("value3"))){
                    js.put("value3",jsonObject.getString("value3"));
                    JSONObject bmi = new JSONObject();
                    bmi.put("measure_time",measure_time);
                    bmi.put("type","Height");
                    bmi.put("sign_name","bmi");
                    bmi.put("sign_value",jsonObject.getString("value3"));
                    bmi.put("sign_unit",bmiUnit);
                    jsonArray.add(bmi);
                }
                break;
            case 4:
                //腰围
                js.put("value1",jsonObject.getString("value1"));
                JSONObject waist = new JSONObject();
                waist.put("measure_time",measure_time);
                waist.put("type","Waist");
                waist.put("sign_name","waist");
                waist.put("sign_value",jsonObject.getString("value1"));
                waist.put("sign_unit",waistUnit);
                jsonArray.add(waist);
                break;
            default:
                break;
        }
        jsonArray.add(js);
        json.put("data",jsonArray);
        json.put("measure_data",jsonArray);
        //上传
        return json.toJSONString();
    }
@ -289,36 +351,16 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
            logger.error("json parse error,invalid json string");
            return null;
        }
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
        JSONArray jsonArray = jsonObject.getJSONArray("data");
        JSONArray jsonArray = jsonObject.getJSONArray("measure_data");
        if(null == jsonArray || jsonArray.size() == 0){
            logger.error("msg","parameter 'data' of json no exist");
            return null;
        }
        rowkey = RowKeyUtils.makeRowKey();
        jsonObject.put("rid",rowkey);//hbase的rowkey
        //循环数据,一组数据存一行,生成一个rowkey,并将该rowkey存到es中
        for(Object obj:jsonArray){
            JSONObject data = (JSONObject)obj;
            data.put("del","1"); //添加删除标记
            try {
                String measuretime = jsonObject.getString("measure_time");
                if(null == measuretime){
                    measuretime = DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss);
                }
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(dataSource,deviceSn);
                data.put("rid",rowkey);//hbase的rowkey
            } catch (Exception e) {
                logger.error("make rowkey error");
                return null;
            }
        }
        return jsonObject;
    }