Bläddra i källkod

hbase连接配置修改,新增logback配置,体征数据返回实体类VO

LiTaohong 7 år sedan
förälder
incheckning
1d8a2f13d2
24 ändrade filer med 2076 tillägg och 119 borttagningar
  1. 10 2
      base/common-data-hbase/src/main/java/com/yihu/base/hbase/config/HbaseConfig.java
  2. 2 2
      base/common-data-hbase/src/main/resources/hbase/core-site.xml
  3. 1 1
      base/common-data-hbase/src/main/resources/hbase/hbase-site.xml
  4. 1 1
      base/common-data-mysql/src/main/java/com/yihu/base/mysql/query/BaseJpaService.java
  5. 15 0
      common/common-entity/pom.xml
  6. 583 0
      common/common-entity/src/main/java/com/yihu/jw/iot/datainput/Data.java
  7. 104 0
      common/common-entity/src/main/java/com/yihu/jw/iot/datainput/DataBodySignsDO.java
  8. 1 2
      common/common-entity/src/main/java/com/yihu/jw/iot/data_input/DataProcessLogDO.java
  9. 1 2
      common/common-entity/src/main/java/com/yihu/jw/iot/data_input/DataStandardDO.java
  10. 2 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/DataRequestMapping.java
  11. 114 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/datainput/DataBodySignsVO.java
  12. 630 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/datainput/DataVO.java
  13. 0 19
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/controller/DataInputController.java
  14. 11 11
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/controller/DataSearchController.java
  15. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/dao/DataProcessLogDao.java
  16. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/dao/DataStandardDao.java
  17. 94 18
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java
  18. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataProcessLogService.java
  19. 54 18
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataSearchService.java
  20. 8 39
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataStandardConvertService.java
  21. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataStandardService.java
  22. 163 0
      svr/svr-iot/src/main/resources/core-site.xml
  23. 243 0
      svr/svr-iot/src/main/resources/hbase-site.xml
  24. 35 0
      svr/svr-iot/src/main/resources/logback.xml

+ 10 - 2
base/common-data-hbase/src/main/java/com/yihu/base/hbase/config/HbaseConfig.java

@ -6,6 +6,8 @@ import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.security.User;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.security.UserGroupInformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
@ -23,6 +25,7 @@ import java.util.*;
@Configuration
@ConfigurationProperties(prefix = "hadoop")
public class HbaseConfig{
    private static Logger logger = LoggerFactory.getLogger(HbaseConfig.class);
    private Map<String, String> hbaseProperties = new HashMap<>();
    public Map<String, String> getHbaseProperties(){
@ -57,9 +60,14 @@ public class HbaseConfig{
        try
        {
            logger.info("set System property for hbase ---",user);
            System.setProperty("HADOOP_USER_NAME", user);
            String tableName = "HealthProfile";
            //覆盖默认的配置文件
            org.apache.hadoop.conf.Configuration.addDefaultResource("core-site.xml");
            org.apache.hadoop.conf.Configuration.addDefaultResource("hbase-site.xml");
            Connection connection = ConnectionFactory.createConnection(configuration);
            logger.info("Hbase createConnection finished---",connection.getConfiguration());
            Admin admin = connection.getAdmin();
            boolean ex = admin.tableExists(TableName.valueOf(tableName));
            //判断是否存在
@ -80,9 +88,9 @@ public class HbaseConfig{
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
            logger.info("Hbase createConnection failure",ex.getMessage());
        }
        return hbaseTemplate;
    }
}

+ 2 - 2
base/common-data-hbase/src/main/resources/hbase/core-site.xml

@ -132,12 +132,12 @@
    
    <property>
      <name>ipc.client.connect.max.retries</name>
      <value>50</value>
      <value>2</value><!--50-->
    </property>
    
    <property>
      <name>ipc.client.connection.maxidletime</name>
      <value>30000</value>
      <value>1000</value><!--30000-->
    </property>
    
    <property>

+ 1 - 1
base/common-data-hbase/src/main/resources/hbase/hbase-site.xml

@ -17,7 +17,7 @@
    
    <property>
      <name>hbase.client.retries.number</name>
      <value>35</value>
      <value>1</value><!--35-->
    </property>
    
    <property>

+ 1 - 1
base/common-data-mysql/src/main/java/com/yihu/base/mysql/query/BaseJpaService.java

@ -26,7 +26,7 @@ import java.text.ParseException;
import java.util.*;
/**
 * Service基础类。此类基于Spring Data JPA进行封装(Spring Data JPA又是基于JPA封装,EHR平台使用Hibernate作为JPA实现者)。
 * Service基础类。此类基于Spring DataVO JPA进行封装(Spring DataVO JPA又是基于JPA封装,EHR平台使用Hibernate作为JPA实现者)。
 * 需要注意的是,部分功能会跳过JPA接口而直接使用Hibernate接口,比如访问Hibernate的Session接口,因为它把JPA的EntityManager功能强大。
 *
 * @author lincl

+ 15 - 0
common/common-entity/pom.xml

@ -36,5 +36,20 @@
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>io.searchbox</groupId>
            <artifactId>jest-common</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>io.searchbox</groupId>
            <artifactId>jest-common</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-data-es</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
</project>

+ 583 - 0
common/common-entity/src/main/java/com/yihu/jw/iot/datainput/Data.java

@ -0,0 +1,583 @@
package com.yihu.jw.iot.datainput;
/**
 * 具体各项体征指标数据值
 * @author lith on 2018/01/17.
 */
public class Data {
    private String rid; // 存到hbase中的id
    private int del = 1; //删除标记,1代表正常,0代表删除
    private String measure_time;     //测量时间  yyyy-MM-dd HH:mm:ss
    private double systolic;        //收缩压
    private String systolic_unit;   //收缩压测量单位
    private double diastolic;       //舒张压
    private double pulse;            //脉搏
    private String pulse_unit;
    private double blood_sugar;     //血糖
    private String blood_sugar_unit;
    private double blood_sugar_result;
    private double blood_oxygen; //血氧
    private String blood_oxygen_unit;
    private double bbt; //体温
    private String bbt_unit;
    private double ket; //酮体
    private String ket_unit;
    private double uro; //尿胆原
    private String uro_unit;
    private double uric_acid;   //尿酸
    private String uric_acid_unit;
    private double tchol;   //总胆固醇
    private String tchol_unit;
    private double hdl; //高密度脂蛋白
    private String hdl_unit;
    private double tg;  //甘油三酯
    private String tg_unit;
    private double ldl; //低密度脂蛋白
    private String ldl_unit;
    private double height;  //身高
    private String height_unit;
    private double weight;  //体重
    private String weight_unit;
    private double waist;   //腰围
    private String waist_unit;
    private double bmi; //BMI
    private String bmi_unit;
    private double hgb; //血红蛋白
    private String hgb_unit;
    private double hbalc;   //糖化血红蛋白
    private String hbalc_unit;
    private double left_eye;//  左眼
    private String left_eye_unit;
    private double right_eye;// 左眼
    private String right_eye_unit;
    private double ecg; //心电
    private String ecg_attach;
    private double ph;  //PH值
    private double nit; //亚硝酸盐
    private String nit_unit;
    private double pro; //蛋白质
    private String pro_unit;
    private double glu; //葡萄糖
    private String glu_unit;
    private double bil; //胆红素
    private String bil_unit;
    private double sg;  //比重
    private String sg_unit;
    private double wbc; //白细胞
    private String wbc_unit;
    private double vc;      //维生素C
    private String vc_unit;
    private double bld; //潜血
    private String bld_unit;
    public String getRid() {
        return rid;
    }
    public void setRid(String rid) {
        this.rid = rid;
    }
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
    public String getMeasure_time() {
        return measure_time;
    }
    public void setMeasure_time(String measure_time) {
        this.measure_time = measure_time;
    }
    public double getSystolic() {
        return systolic;
    }
    public void setSystolic(double systolic) {
        this.systolic = systolic;
    }
    public String getSystolic_unit() {
        return systolic_unit;
    }
    public void setSystolic_unit(String systolic_unit) {
        this.systolic_unit = systolic_unit;
    }
    public double getDiastolic() {
        return diastolic;
    }
    public void setDiastolic(double diastolic) {
        this.diastolic = diastolic;
    }
    public double getPulse() {
        return pulse;
    }
    public void setPulse(double pulse) {
        this.pulse = pulse;
    }
    public String getPulse_unit() {
        return pulse_unit;
    }
    public void setPulse_unit(String pulse_unit) {
        this.pulse_unit = pulse_unit;
    }
    public double getBlood_sugar() {
        return blood_sugar;
    }
    public void setBlood_sugar(double blood_sugar) {
        this.blood_sugar = blood_sugar;
    }
    public String getBlood_sugar_unit() {
        return blood_sugar_unit;
    }
    public void setBlood_sugar_unit(String blood_sugar_unit) {
        this.blood_sugar_unit = blood_sugar_unit;
    }
    public double getBlood_sugar_result() {
        return blood_sugar_result;
    }
    public void setBlood_sugar_result(double blood_sugar_result) {
        this.blood_sugar_result = blood_sugar_result;
    }
    public double getBlood_oxygen() {
        return blood_oxygen;
    }
    public void setBlood_oxygen(double blood_oxygen) {
        this.blood_oxygen = blood_oxygen;
    }
    public String getBlood_oxygen_unit() {
        return blood_oxygen_unit;
    }
    public void setBlood_oxygen_unit(String blood_oxygen_unit) {
        this.blood_oxygen_unit = blood_oxygen_unit;
    }
    public double getBbt() {
        return bbt;
    }
    public void setBbt(double bbt) {
        this.bbt = bbt;
    }
    public String getBbt_unit() {
        return bbt_unit;
    }
    public void setBbt_unit(String bbt_unit) {
        this.bbt_unit = bbt_unit;
    }
    public double getKet() {
        return ket;
    }
    public void setKet(double ket) {
        this.ket = ket;
    }
    public String getKet_unit() {
        return ket_unit;
    }
    public void setKet_unit(String ket_unit) {
        this.ket_unit = ket_unit;
    }
    public double getUro() {
        return uro;
    }
    public void setUro(double uro) {
        this.uro = uro;
    }
    public String getUro_unit() {
        return uro_unit;
    }
    public void setUro_unit(String uro_unit) {
        this.uro_unit = uro_unit;
    }
    public double getUric_acid() {
        return uric_acid;
    }
    public void setUric_acid(double uric_acid) {
        this.uric_acid = uric_acid;
    }
    public String getUric_acid_unit() {
        return uric_acid_unit;
    }
    public void setUric_acid_unit(String uric_acid_unit) {
        this.uric_acid_unit = uric_acid_unit;
    }
    public double getTchol() {
        return tchol;
    }
    public void setTchol(double tchol) {
        this.tchol = tchol;
    }
    public String getTchol_unit() {
        return tchol_unit;
    }
    public void setTchol_unit(String tchol_unit) {
        this.tchol_unit = tchol_unit;
    }
    public double getHdl() {
        return hdl;
    }
    public void setHdl(double hdl) {
        this.hdl = hdl;
    }
    public String getHdl_unit() {
        return hdl_unit;
    }
    public void setHdl_unit(String hdl_unit) {
        this.hdl_unit = hdl_unit;
    }
    public double getTg() {
        return tg;
    }
    public void setTg(double tg) {
        this.tg = tg;
    }
    public String getTg_unit() {
        return tg_unit;
    }
    public void setTg_unit(String tg_unit) {
        this.tg_unit = tg_unit;
    }
    public double getLdl() {
        return ldl;
    }
    public void setLdl(double ldl) {
        this.ldl = ldl;
    }
    public String getLdl_unit() {
        return ldl_unit;
    }
    public void setLdl_unit(String ldl_unit) {
        this.ldl_unit = ldl_unit;
    }
    public double getHeight() {
        return height;
    }
    public void setHeight(double height) {
        this.height = height;
    }
    public String getHeight_unit() {
        return height_unit;
    }
    public void setHeight_unit(String height_unit) {
        this.height_unit = height_unit;
    }
    public double getWeight() {
        return weight;
    }
    public void setWeight(double weight) {
        this.weight = weight;
    }
    public String getWeight_unit() {
        return weight_unit;
    }
    public void setWeight_unit(String weight_unit) {
        this.weight_unit = weight_unit;
    }
    public double getWaist() {
        return waist;
    }
    public void setWaist(double waist) {
        this.waist = waist;
    }
    public String getWaist_unit() {
        return waist_unit;
    }
    public void setWaist_unit(String waist_unit) {
        this.waist_unit = waist_unit;
    }
    public double getBmi() {
        return bmi;
    }
    public void setBmi(double bmi) {
        this.bmi = bmi;
    }
    public String getBmi_unit() {
        return bmi_unit;
    }
    public void setBmi_unit(String bmi_unit) {
        this.bmi_unit = bmi_unit;
    }
    public double getHgb() {
        return hgb;
    }
    public void setHgb(double hgb) {
        this.hgb = hgb;
    }
    public String getHgb_unit() {
        return hgb_unit;
    }
    public void setHgb_unit(String hgb_unit) {
        this.hgb_unit = hgb_unit;
    }
    public double getHbalc() {
        return hbalc;
    }
    public void setHbalc(double hbalc) {
        this.hbalc = hbalc;
    }
    public String getHbalc_unit() {
        return hbalc_unit;
    }
    public void setHbalc_unit(String hbalc_unit) {
        this.hbalc_unit = hbalc_unit;
    }
    public double getLeft_eye() {
        return left_eye;
    }
    public void setLeft_eye(double left_eye) {
        this.left_eye = left_eye;
    }
    public String getLeft_eye_unit() {
        return left_eye_unit;
    }
    public void setLeft_eye_unit(String left_eye_unit) {
        this.left_eye_unit = left_eye_unit;
    }
    public double getRight_eye() {
        return right_eye;
    }
    public void setRight_eye(double right_eye) {
        this.right_eye = right_eye;
    }
    public String getRight_eye_unit() {
        return right_eye_unit;
    }
    public void setRight_eye_unit(String right_eye_unit) {
        this.right_eye_unit = right_eye_unit;
    }
    public double getEcg() {
        return ecg;
    }
    public void setEcg(double ecg) {
        this.ecg = ecg;
    }
    public String getEcg_attach() {
        return ecg_attach;
    }
    public void setEcg_attach(String ecg_attach) {
        this.ecg_attach = ecg_attach;
    }
    public double getPh() {
        return ph;
    }
    public void setPh(double ph) {
        this.ph = ph;
    }
    public double getNit() {
        return nit;
    }
    public void setNit(double nit) {
        this.nit = nit;
    }
    public String getNit_unit() {
        return nit_unit;
    }
    public void setNit_unit(String nit_unit) {
        this.nit_unit = nit_unit;
    }
    public double getPro() {
        return pro;
    }
    public void setPro(double pro) {
        this.pro = pro;
    }
    public String getPro_unit() {
        return pro_unit;
    }
    public void setPro_unit(String pro_unit) {
        this.pro_unit = pro_unit;
    }
    public double getGlu() {
        return glu;
    }
    public void setGlu(double glu) {
        this.glu = glu;
    }
    public String getGlu_unit() {
        return glu_unit;
    }
    public void setGlu_unit(String glu_unit) {
        this.glu_unit = glu_unit;
    }
    public double getBil() {
        return bil;
    }
    public void setBil(double bil) {
        this.bil = bil;
    }
    public String getBil_unit() {
        return bil_unit;
    }
    public void setBil_unit(String bil_unit) {
        this.bil_unit = bil_unit;
    }
    public double getSg() {
        return sg;
    }
    public void setSg(double sg) {
        this.sg = sg;
    }
    public String getSg_unit() {
        return sg_unit;
    }
    public void setSg_unit(String sg_unit) {
        this.sg_unit = sg_unit;
    }
    public double getWbc() {
        return wbc;
    }
    public void setWbc(double wbc) {
        this.wbc = wbc;
    }
    public String getWbc_unit() {
        return wbc_unit;
    }
    public void setWbc_unit(String wbc_unit) {
        this.wbc_unit = wbc_unit;
    }
    public double getVc() {
        return vc;
    }
    public void setVc(double vc) {
        this.vc = vc;
    }
    public String getVc_unit() {
        return vc_unit;
    }
    public void setVc_unit(String vc_unit) {
        this.vc_unit = vc_unit;
    }
    public double getBld() {
        return bld;
    }
    public void setBld(double bld) {
        this.bld = bld;
    }
    public String getBld_unit() {
        return bld_unit;
    }
    public void setBld_unit(String bld_unit) {
        this.bld_unit = bld_unit;
    }
}

+ 104 - 0
common/common-entity/src/main/java/com/yihu/jw/iot/datainput/DataBodySignsDO.java

@ -0,0 +1,104 @@
package com.yihu.jw.iot.datainput;
import com.yihu.base.es.config.model.SaveModel;
import java.util.List;
/**
 * 体征数据实体类,新的标准的数据格式
 * @author lith on 2018/01/17.
 */
public class DataBodySignsDO extends SaveModel {
    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 String idCard;      //设备绑定的用户身份证号
    private String username;    //用户名
    private String usercode;    //用户在系统中的code,唯一识别
    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;
    }
    public void setData_source(String data_source) {
        this.data_source = data_source;
    }
    public String getSn() {
        return sn;
    }
    public void setSn(String sn) {
        this.sn = sn;
    }
    public String getExt_code() {
        return ext_code;
    }
    public void setExt_code(String ext_code) {
        this.ext_code = ext_code;
    }
    public String getDevice_name() {
        return device_name;
    }
    public void setDevice_name(String device_name) {
        this.device_name = device_name;
    }
    public String getDevice_model() {
        return device_model;
    }
    public void setDevice_model(String device_model) {
        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;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getUsercode() {
        return usercode;
    }
    public void setUsercode(String usercode) {
        this.usercode = usercode;
    }
}

+ 1 - 2
common/common-entity/src/main/java/com/yihu/jw/iot/data_input/DataProcessLogDO.java

@ -1,7 +1,6 @@
package com.yihu.jw.iot.data_input;
package com.yihu.jw.iot.datainput;
import com.yihu.jw.IdEntity;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;

+ 1 - 2
common/common-entity/src/main/java/com/yihu/jw/iot/data_input/DataStandardDO.java

@ -1,7 +1,6 @@
package com.yihu.jw.iot.data_input;
package com.yihu.jw.iot.datainput;
import com.yihu.jw.IdEntity;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;

+ 2 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/DataRequestMapping.java

@ -46,6 +46,8 @@ public class DataRequestMapping {
        public static final String api_user_update = "update";
        public static final String message_success = "search success";
        public static final String update_success = "update success";
        public static final String delete_success = "delete success";
        public static final String message_fail = "search fail";
        public static final String message_fail_jsonData_is_null = "param is null";
    }

+ 114 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/datainput/DataBodySignsVO.java

@ -0,0 +1,114 @@
package com.yihu.jw.restmodel.iot.datainput;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
 * 体征数据实体类,新的标准的数据格式
 * @author lith on 2018/01/17.
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel
public class DataBodySignsVO {
    private String access_token; //访问token
    private String data_source; //数据来源
    private String sn;          //设备序列码
    @ApiModelProperty(value = "设备数据识别代码",hidden = true)
    private String ext_code;    //设备A,B键,取值为0,1,代表绑定不同的用户,
    @ApiModelProperty(value = "设备名称",hidden = true)
    private String device_name; //设备名称
    @ApiModelProperty(value = "设备型号",hidden = true)
    private String device_model;//设备型号
    private List<DataVO> data;    //设备所测量的数据内容
    @ApiModelProperty(value = "身份证号",hidden = true)
    private String idCard;      //设备绑定的用户身份证号
    @ApiModelProperty(value = "用户名",hidden = true)
    private String username;    //用户名
    @ApiModelProperty(value = "用户code",hidden = true)
    private String usercode;    //用户在系统中的code,唯一识别
    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;
    }
    public void setData_source(String data_source) {
        this.data_source = data_source;
    }
    public String getSn() {
        return sn;
    }
    public void setSn(String sn) {
        this.sn = sn;
    }
    public String getExt_code() {
        return ext_code;
    }
    public void setExt_code(String ext_code) {
        this.ext_code = ext_code;
    }
    public String getDevice_name() {
        return device_name;
    }
    public void setDevice_name(String device_name) {
        this.device_name = device_name;
    }
    public String getDevice_model() {
        return device_model;
    }
    public void setDevice_model(String device_model) {
        this.device_model = device_model;
    }
    public List<DataVO> getData() {
        return data;
    }
    public void setData(List<DataVO> data) {
        this.data = data;
    }
    public String getIdCard() {
        return idCard;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getUsercode() {
        return usercode;
    }
    public void setUsercode(String usercode) {
        this.usercode = usercode;
    }
}

+ 630 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/datainput/DataVO.java

@ -0,0 +1,630 @@
package com.yihu.jw.restmodel.iot.datainput;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * 具体各项体征指标数据值
 * @author lith on 2018/01/17.
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel
public class DataVO {
    @ApiModelProperty(hidden = true)
    private String rid; // 存到hbase中的id
    @ApiModelProperty(value = "是否删除,0代表删除,1代表未删除",hidden = true)
    private int del = 1; //删除标记,1代表正常,0代表删除
    @ApiModelProperty(value = "测量时间",hidden = true)
    private String measure_time;     //测量时间  yyyy-MM-dd HH:mm:ss
    @ApiModelProperty(value = "收缩压",hidden = true)
    private  String systolic;        //收缩压
    private String systolic_unit;   //收缩压测量单位
    @ApiModelProperty(value = "舒张压",hidden = true)
    private  String diastolic;       //舒张压
    @ApiModelProperty(value = "脉搏",hidden = true)
    private  String pulse;            //脉搏
    private String pulse_unit;
    @ApiModelProperty(value = "血糖",hidden = true)
    private  String blood_sugar;     //血糖
    private String blood_sugar_unit;
    @ApiModelProperty(value = "血糖,1 : 空腹血糖 , 2 : 早餐后血糖 , 3 : 午餐前血糖 , 4 : 午餐后血糖 , 5 : 晚餐前血糖 , 6 : 晚餐后血糖 , 7 : 睡前血糖",hidden = true)
    private  String blood_sugar_result;
    @ApiModelProperty(value = "血氧",hidden = true)
    private  String blood_oxygen; //血氧
    private String blood_oxygen_unit;
    @ApiModelProperty(value = "体温",hidden = true)
    private  String bbt; //体温
    private String bbt_unit;
    @ApiModelProperty(value = "酮体",hidden = true)
    private  String ket; //酮体
    private String ket_unit;
    @ApiModelProperty(value = "尿胆原",hidden = true)
    private  String uro; //尿胆原
    private String uro_unit;
    @ApiModelProperty(value = "尿酸",hidden = true)
    private  String uric_acid;   //尿酸
    private String uric_acid_unit;
    @ApiModelProperty(value = "总胆固醇",hidden = true)
    private  String tchol;   //总胆固醇
    private String tchol_unit;
    @ApiModelProperty(value = "高密度脂蛋白",hidden = true)
    private  String hdl; //高密度脂蛋白
    private String hdl_unit;
    @ApiModelProperty(value = "甘油三酯",hidden = true)
    private  String tg;  //甘油三酯
    private String tg_unit;
    @ApiModelProperty(value = "低密度脂蛋白",hidden = true)
    private  String ldl; //低密度脂蛋白
    private String ldl_unit;
    @ApiModelProperty(value = "身高",hidden = true)
    private  String height;  //身高
    private String height_unit;
    @ApiModelProperty(value = "体重",hidden = true)
    private  String weight;  //体重
    private String weight_unit;
    @ApiModelProperty(value = "腰围",hidden = true)
    private  String waist;   //腰围
    private String waist_unit;
    @ApiModelProperty(value = "BMI",hidden = true)
    private  String bmi; //BMI
    private String bmi_unit;
    @ApiModelProperty(value = "血红蛋白",hidden = true)
    private  String hgb; //血红蛋白
    private String hgb_unit;
    private  String hbalc;   //糖化血红蛋白
    @ApiModelProperty(value = "糖化血红蛋白",hidden = true)
    private String hbalc_unit;
    @ApiModelProperty(value = "左眼",hidden = true)
    private  String left_eye;//  左眼
    private String left_eye_unit;
    @ApiModelProperty(value = "右眼",hidden = true)
    private  String right_eye;// 右眼
    private String right_eye_unit;
    @ApiModelProperty(value = "心电图",hidden = true)
    private  String ecg; //心电
    private String ecg_attach;
    @ApiModelProperty(value = "PH",hidden = true)
    private  String ph;  //PH值
    @ApiModelProperty(value = "亚硝酸盐",hidden = true)
    private  String nit; //亚硝酸盐
    private String nit_unit;
    @ApiModelProperty(value = "蛋白质",hidden = true)
    private  String pro; //蛋白质
    private String pro_unit;
    @ApiModelProperty(value = "葡萄糖",hidden = true)
    private  String glu; //葡萄糖
    private String glu_unit;
    @ApiModelProperty(value = "胆红素",hidden = true)
    private  String bil; //胆红素
    private String bil_unit;
    @ApiModelProperty(value = "比重",hidden = true)
    private  String sg;  //比重
    private String sg_unit;
    @ApiModelProperty(value = "白细胞",hidden = true)
    private  String wbc; //白细胞
    @ApiModelProperty(value = "白细胞数值单位",hidden = true)
    private String wbc_unit;
    @ApiModelProperty(value = "维生素C",hidden = true)
    private  String vc;      //维生素C
    @ApiModelProperty(value = "维生素C数值单位",hidden = true)
    private String vc_unit;
    @ApiModelProperty(value = "潜血",hidden = true)
    private  String bld;
    @ApiModelProperty(value = "潜血数值单位",hidden = true)
    private String bld_unit;
    public String getRid() {
        return rid;
    }
    public void setRid(String rid) {
        this.rid = rid;
    }
    public int getDel() {
        return del;
    }
    public void setDel(int del) {
        this.del = del;
    }
    public String getMeasure_time() {
        return measure_time;
    }
    public void setMeasure_time(String measure_time) {
        this.measure_time = measure_time;
    }
    public  String getSystolic() {
        return systolic;
    }
    public void setSystolic( String systolic) {
        this.systolic = systolic;
    }
    public String getSystolic_unit() {
        return systolic_unit;
    }
    public void setSystolic_unit(String systolic_unit) {
        this.systolic_unit = systolic_unit;
    }
    public  String getDiastolic() {
        return diastolic;
    }
    public void setDiastolic( String diastolic) {
        this.diastolic = diastolic;
    }
    public  String getPulse() {
        return pulse;
    }
    public void setPulse( String pulse) {
        this.pulse = pulse;
    }
    public String getPulse_unit() {
        return pulse_unit;
    }
    public void setPulse_unit(String pulse_unit) {
        this.pulse_unit = pulse_unit;
    }
    public  String getBlood_sugar() {
        return blood_sugar;
    }
    public void setBlood_sugar( String blood_sugar) {
        this.blood_sugar = blood_sugar;
    }
    public String getBlood_sugar_unit() {
        return blood_sugar_unit;
    }
    public void setBlood_sugar_unit(String blood_sugar_unit) {
        this.blood_sugar_unit = blood_sugar_unit;
    }
    public  String getBlood_sugar_result() {
        return blood_sugar_result;
    }
    public void setBlood_sugar_result( String blood_sugar_result) {
        this.blood_sugar_result = blood_sugar_result;
    }
    public  String getBlood_oxygen() {
        return blood_oxygen;
    }
    public void setBlood_oxygen( String blood_oxygen) {
        this.blood_oxygen = blood_oxygen;
    }
    public String getBlood_oxygen_unit() {
        return blood_oxygen_unit;
    }
    public void setBlood_oxygen_unit(String blood_oxygen_unit) {
        this.blood_oxygen_unit = blood_oxygen_unit;
    }
    public  String getBbt() {
        return bbt;
    }
    public void setBbt( String bbt) {
        this.bbt = bbt;
    }
    public String getBbt_unit() {
        return bbt_unit;
    }
    public void setBbt_unit(String bbt_unit) {
        this.bbt_unit = bbt_unit;
    }
    public  String getKet() {
        return ket;
    }
    public void setKet( String ket) {
        this.ket = ket;
    }
    public String getKet_unit() {
        return ket_unit;
    }
    public void setKet_unit(String ket_unit) {
        this.ket_unit = ket_unit;
    }
    public  String getUro() {
        return uro;
    }
    public void setUro( String uro) {
        this.uro = uro;
    }
    public String getUro_unit() {
        return uro_unit;
    }
    public void setUro_unit(String uro_unit) {
        this.uro_unit = uro_unit;
    }
    public  String getUric_acid() {
        return uric_acid;
    }
    public void setUric_acid( String uric_acid) {
        this.uric_acid = uric_acid;
    }
    public String getUric_acid_unit() {
        return uric_acid_unit;
    }
    public void setUric_acid_unit(String uric_acid_unit) {
        this.uric_acid_unit = uric_acid_unit;
    }
    public  String getTchol() {
        return tchol;
    }
    public void setTchol( String tchol) {
        this.tchol = tchol;
    }
    public String getTchol_unit() {
        return tchol_unit;
    }
    public void setTchol_unit(String tchol_unit) {
        this.tchol_unit = tchol_unit;
    }
    public  String getHdl() {
        return hdl;
    }
    public void setHdl( String hdl) {
        this.hdl = hdl;
    }
    public String getHdl_unit() {
        return hdl_unit;
    }
    public void setHdl_unit(String hdl_unit) {
        this.hdl_unit = hdl_unit;
    }
    public  String getTg() {
        return tg;
    }
    public void setTg( String tg) {
        this.tg = tg;
    }
    public String getTg_unit() {
        return tg_unit;
    }
    public void setTg_unit(String tg_unit) {
        this.tg_unit = tg_unit;
    }
    public  String getLdl() {
        return ldl;
    }
    public void setLdl( String ldl) {
        this.ldl = ldl;
    }
    public String getLdl_unit() {
        return ldl_unit;
    }
    public void setLdl_unit(String ldl_unit) {
        this.ldl_unit = ldl_unit;
    }
    public  String getHeight() {
        return height;
    }
    public void setHeight( String height) {
        this.height = height;
    }
    public String getHeight_unit() {
        return height_unit;
    }
    public void setHeight_unit(String height_unit) {
        this.height_unit = height_unit;
    }
    public  String getWeight() {
        return weight;
    }
    public void setWeight( String weight) {
        this.weight = weight;
    }
    public String getWeight_unit() {
        return weight_unit;
    }
    public void setWeight_unit(String weight_unit) {
        this.weight_unit = weight_unit;
    }
    public  String getWaist() {
        return waist;
    }
    public void setWaist( String waist) {
        this.waist = waist;
    }
    public String getWaist_unit() {
        return waist_unit;
    }
    public void setWaist_unit(String waist_unit) {
        this.waist_unit = waist_unit;
    }
    public  String getBmi() {
        return bmi;
    }
    public void setBmi( String bmi) {
        this.bmi = bmi;
    }
    public String getBmi_unit() {
        return bmi_unit;
    }
    public void setBmi_unit(String bmi_unit) {
        this.bmi_unit = bmi_unit;
    }
    public  String getHgb() {
        return hgb;
    }
    public void setHgb( String hgb) {
        this.hgb = hgb;
    }
    public String getHgb_unit() {
        return hgb_unit;
    }
    public void setHgb_unit(String hgb_unit) {
        this.hgb_unit = hgb_unit;
    }
    public  String getHbalc() {
        return hbalc;
    }
    public void setHbalc( String hbalc) {
        this.hbalc = hbalc;
    }
    public String getHbalc_unit() {
        return hbalc_unit;
    }
    public void setHbalc_unit(String hbalc_unit) {
        this.hbalc_unit = hbalc_unit;
    }
    public  String getLeft_eye() {
        return left_eye;
    }
    public void setLeft_eye( String left_eye) {
        this.left_eye = left_eye;
    }
    public String getLeft_eye_unit() {
        return left_eye_unit;
    }
    public void setLeft_eye_unit(String left_eye_unit) {
        this.left_eye_unit = left_eye_unit;
    }
    public  String getRight_eye() {
        return right_eye;
    }
    public void setRight_eye( String right_eye) {
        this.right_eye = right_eye;
    }
    public String getRight_eye_unit() {
        return right_eye_unit;
    }
    public void setRight_eye_unit(String right_eye_unit) {
        this.right_eye_unit = right_eye_unit;
    }
    public  String getEcg() {
        return ecg;
    }
    public void setEcg( String ecg) {
        this.ecg = ecg;
    }
    public String getEcg_attach() {
        return ecg_attach;
    }
    public void setEcg_attach(String ecg_attach) {
        this.ecg_attach = ecg_attach;
    }
    public  String getPh() {
        return ph;
    }
    public void setPh( String ph) {
        this.ph = ph;
    }
    public  String getNit() {
        return nit;
    }
    public void setNit( String nit) {
        this.nit = nit;
    }
    public String getNit_unit() {
        return nit_unit;
    }
    public void setNit_unit(String nit_unit) {
        this.nit_unit = nit_unit;
    }
    public  String getPro() {
        return pro;
    }
    public void setPro( String pro) {
        this.pro = pro;
    }
    public String getPro_unit() {
        return pro_unit;
    }
    public void setPro_unit(String pro_unit) {
        this.pro_unit = pro_unit;
    }
    public  String getGlu() {
        return glu;
    }
    public void setGlu( String glu) {
        this.glu = glu;
    }
    public String getGlu_unit() {
        return glu_unit;
    }
    public void setGlu_unit(String glu_unit) {
        this.glu_unit = glu_unit;
    }
    public  String getBil() {
        return bil;
    }
    public void setBil( String bil) {
        this.bil = bil;
    }
    public String getBil_unit() {
        return bil_unit;
    }
    public void setBil_unit(String bil_unit) {
        this.bil_unit = bil_unit;
    }
    public  String getSg() {
        return sg;
    }
    public void setSg( String sg) {
        this.sg = sg;
    }
    public String getSg_unit() {
        return sg_unit;
    }
    public void setSg_unit(String sg_unit) {
        this.sg_unit = sg_unit;
    }
    public  String getWbc() {
        return wbc;
    }
    public void setWbc( String wbc) {
        this.wbc = wbc;
    }
    public String getWbc_unit() {
        return wbc_unit;
    }
    public void setWbc_unit(String wbc_unit) {
        this.wbc_unit = wbc_unit;
    }
    public  String getVc() {
        return vc;
    }
    public void setVc( String vc) {
        this.vc = vc;
    }
    public String getVc_unit() {
        return vc_unit;
    }
    public void setVc_unit(String vc_unit) {
        this.vc_unit = vc_unit;
    }
    public  String getBld() {
        return bld;
    }
    public void setBld( String bld) {
        this.bld = bld;
    }
    public String getBld_unit() {
        return bld_unit;
    }
    public void setBld_unit(String bld_unit) {
        this.bld_unit = bld_unit;
    }
}

+ 0 - 19
svr/svr-iot/src/main/java/com/yihu/iot/datainput/controller/DataInputController.java

@ -51,23 +51,4 @@ public class DataInputController {
        return Envelop.getSuccess(DataRequestMapping.DataInput.message_success, str);
    }
    @PostMapping(value = DataRequestMapping.DataInput.api_update_record, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "用户体征状态修改", notes = "用户体征状态修改,0-标准,1-异常")
    public Envelop updateRecord(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
        try{
            return Envelop.getSuccess(DataRequestMapping.DataInput.message_success,dataInputService.updateRecordStatus(jsonData));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PostMapping(value = DataRequestMapping.DataInput.api_delete_record, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "删除体征数据", notes = "删除标志,支持伪删除")
    public Envelop deleteRecord(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
        try{
            return Envelop.getSuccess(DataRequestMapping.DataInput.message_success,dataInputService.updateRecordStatus(jsonData));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
}

+ 11 - 11
svr/svr-iot/src/main/java/com/yihu/iot/datainput/controller/DataSearchController.java

@ -1,15 +1,14 @@
package com.yihu.iot.datainput.controller;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.datainput.service.DataSearchService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.datainput.DataBodySignsVO;
import com.yihu.jw.rm.iot.DataRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -24,10 +23,10 @@ public class DataSearchController {
    @PostMapping(value = DataRequestMapping.DataSearch.api_data_search_one, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "查询单条数据", notes = "根据id查询单条数据")
    public Envelop getOne(
    public Envelop<DataBodySignsVO> getOne(
            @ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
        try{
            return Envelop.getSuccess(DataRequestMapping.DataSearch.message_success,dataSearchService.getData(jsonData));
            return Envelop.getSuccess(DataRequestMapping.DataSearch.message_success,dataSearchService.getDataToBean(jsonData));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
@ -35,9 +34,10 @@ public class DataSearchController {
    @PostMapping(value = DataRequestMapping.DataSearch.api_user_search_list, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "查询数据", notes = "根据条件查询数据")
    public Envelop getList(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
    @ApiModelProperty()
    public Envelop<DataBodySignsVO> getList(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
        try{
            return Envelop.getSuccess(DataRequestMapping.DataSearch.message_success,dataSearchService.getData(jsonData));
            return Envelop.getSuccess(DataRequestMapping.DataSearch.message_success,dataSearchService.getDataToBean(jsonData));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
@ -55,9 +55,9 @@ public class DataSearchController {
    @PostMapping(value = DataRequestMapping.DataSearch.api_user_search_recent5, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "获取最近5条数据", notes = "根据居民的体征类型,测量时间获取")
    public Envelop getRecent5ByTypeAndTime(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData ){
    public Envelop<DataBodySignsVO> getRecent5ByTypeAndTime(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData ){
        try{
            return Envelop.getSuccess(DataRequestMapping.DataSearch.message_success,dataSearchService.getData(jsonData));
            return Envelop.getSuccess(DataRequestMapping.DataSearch.message_success,dataSearchService.getDataToBean(jsonData));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
@ -97,7 +97,7 @@ public class DataSearchController {
    @ApiOperation(value = "体征数据删除", notes = "根据id删除标志,支持伪删除")
    public Envelop delete(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
        try{
            return Envelop.getSuccess(DataRequestMapping.DataSearch.message_success,dataSearchService.updateData(jsonData));
            return Envelop.getSuccess(DataRequestMapping.DataSearch.delete_success,dataSearchService.updateData(jsonData));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
@ -107,7 +107,7 @@ public class DataSearchController {
    @ApiOperation(value = "更新体征记录", notes = "根据id更新体征记录(包括体征值、上传时间等)")
    public Envelop update(@ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData){
        try{
            return Envelop.getSuccess(DataRequestMapping.DataSearch.message_success,dataSearchService.updateData(jsonData));
            return Envelop.getSuccess(DataRequestMapping.DataSearch.update_success,dataSearchService.updateData(jsonData));
        } catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/datainput/dao/DataProcessLogDao.java

@ -1,6 +1,6 @@
package com.yihu.iot.datainput.dao;
import com.yihu.jw.iot.data_input.DataProcessLogDO;
import com.yihu.jw.iot.datainput.DataProcessLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/datainput/dao/DataStandardDao.java

@ -1,6 +1,6 @@
package com.yihu.iot.datainput.dao;
import com.yihu.jw.iot.data_input.DataStandardDO;
import com.yihu.jw.iot.datainput.DataStandardDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

+ 94 - 18
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java

@ -3,12 +3,14 @@ package com.yihu.iot.datainput.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.base.es.config.ElastricSearchHelper;
import com.yihu.base.es.config.model.SaveModel;
import com.yihu.base.hbase.HBaseAdmin;
import com.yihu.base.hbase.HBaseHelper;
import com.yihu.iot.datainput.enums.DataOperationTypeEnum;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.datainput.util.RowKeyUtils;
import com.yihu.iot.service.device.IotDeviceService;
import com.yihu.jw.iot.datainput.DataBodySignsDO;
import com.yihu.jw.iot.device.IotDeviceDO;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang.StringUtils;
@ -127,11 +129,12 @@ public class DataInputService {
        String fileAbsPath = "";
        String rowkey = "";
        //提取json某些项值
        DataBodySignsDO dataBodySignsDO = JSONObject.parseObject(json,DataBodySignsDO.class);
        JSONObject jsonObject = JSONObject.parseObject(json);
        String accessToken= jsonObject.getString("access_token");
        String dataSource = jsonObject.getString("data_source");
        String deviceSn = jsonObject.getString("sn");
        String extCode = jsonObject.getString("ext_code");
        String accessToken= dataBodySignsDO.getAccess_token();
        String dataSource = dataBodySignsDO.getData_source();
        String deviceSn = dataBodySignsDO.getSn();
        String extCode = dataBodySignsDO.getExt_code();
        //包含居民身份的数据,对设备数据进行校验绑定,此处包含的信息只有身份证号和用户名以及设备序列号,如果设备库中存在该序号的设备,则对绑定居民进行修改,改为当前居民,如果没有则跳过
        if(jsonObject.containsKey("idcard") && jsonObject.containsKey("username")){
@ -158,7 +161,7 @@ public class DataInputService {
                    measuretime = DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss);
                }
                //生成一份json数据的rowkey
                rowkey = RowKeyUtils.makeRowKey(accessToken,deviceSn, extCode, DateUtil.dateTimeParse(measuretime).getTime());
                rowkey = RowKeyUtils.makeRowKey(accessToken,dataSource, extCode, DateUtil.dateTimeParse(measuretime).getTime());
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {
@ -208,22 +211,95 @@ public class DataInputService {
    }
    /**
     * 修改用户体征状态标志
     * 上传数据
     * @param json
     * @return
     */
    public String updateRecordStatus(String json){
//        elastricSearchHelper.update();
        return "";
    }
    public String inputData(String json){
        String fileName = "";
        String fileAbsPath = "";
        String rowkey = "";
        //提取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();
    /**
     * 修改用户体征状态标志
     * @param json
     * @return
     */
    public String deleteRecord(String json){
//        elastricSearchHelper.deleteData();
        return "";
        //包含居民身份的数据,对设备数据进行校验绑定,此处包含的信息只有身份证号和用户名以及设备序列号,如果设备库中存在该序号的设备,则对绑定居民进行修改,改为当前居民,如果没有则跳过
        if(jsonObject.containsKey("idcard") && jsonObject.containsKey("username")){
            String idcard = jsonObject.getString("idcard");
            String username = jsonObject.getString("username");
            updateBindUser(dataSource,deviceSn,idcard,username);
        }
        JSONArray jsonArray = jsonObject.getJSONArray("data");
        if(null == jsonArray || jsonArray.size() == 0){
            return "json no data";
        }
        List<String> rowkeyList = new ArrayList<>();
        List<Map<String,Map<String,String>>> familyList = new ArrayList<>();
        //循环数据,一组数据存一行,生成一个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(accessToken,dataSource, extCode, DateUtil.dateTimeParse(measuretime).getTime());
                data.put("rid",rowkey);//hbase的rowkey
                rowkeyList.add(rowkey);
            } catch (Exception e) {
                e.printStackTrace();
            }
            //组装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);
        }
        DataBodySignsDO bodySignsDO = JSONObject.parseObject(jsonObject.toJSONString(),DataBodySignsDO.class);
        List<SaveModel> list = new ArrayList<>();
        list.add(bodySignsDO);
        //将数据存入es
        elastricSearchHelper.save(ConstantUtils.esIndex, ConstantUtils.esType, list);
        /*try {
            boolean tableExists = hBaseAdmin.isTableExists(ConstantUtils.tableName);
            if (!tableExists) {
                hBaseAdmin.createTable(ConstantUtils.tableName,ConstantUtils.familyB);
            }
            hBaseHelper.addBulk(ConstantUtils.tableName, rowkeyList, familyList);
        } catch (Exception e) {
            e.printStackTrace();
            //保存日志
            dataProcessLogService.saveLog(fileName, fileAbsPath, dataSource, "", DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss), "1", "3", "com.yihu.iot.datainput.service.DataInputService.uploadData", DataOperationTypeEnum.upload1.getName(), 1);
            return "fail";
        }*/
        //保存日志
        dataProcessLogService.saveLog(fileName, fileAbsPath, dataSource, "", DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss), "1", "4", "com.yihu.iot.datainput.service.DataInputService.uploadData", DataOperationTypeEnum.upload1.getName(), 0);
        JSONObject result = new JSONObject();
        JSONArray rids = new JSONArray();
        rids.addAll(rowkeyList);
        result.put("rid",rids);
        result.put("upload_time",DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        return result.toJSONString();
    }
}

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

@ -2,7 +2,7 @@ package com.yihu.iot.datainput.service;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.datainput.dao.DataProcessLogDao;
import com.yihu.jw.iot.data_input.DataProcessLogDO;
import com.yihu.jw.iot.datainput.DataProcessLogDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

+ 54 - 18
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataSearchService.java

@ -1,18 +1,18 @@
package com.yihu.iot.datainput.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.yihu.base.es.config.ElastricSearchHelper;
import com.yihu.base.hbase.HBaseHelper;
import com.yihu.iot.datainput.enums.DataTypeEnum;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.datainput.util.RowKeyUtils;
import com.yihu.jw.iot.datainput.Data;
import com.yihu.jw.iot.datainput.DataBodySignsDO;
import com.yihu.jw.iot.datainput.DataStandardDO;
import com.yihu.jw.restmodel.iot.datainput.DataBodySignsVO;
import com.yihu.jw.util.date.DateUtil;
import io.searchbox.core.SearchResult;
import io.searchbox.core.Update;
import org.apache.commons.lang.StringUtils;
@ -20,23 +20,22 @@ import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.CollectionUtils;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.index.query.*;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.SortBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.query.UpdateQuery;
import org.springframework.data.elasticsearch.core.query.UpdateQueryBuilder;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Component
public class DataSearchService {
@ -49,7 +48,15 @@ public class DataSearchService {
    @Autowired
    private HBaseHelper hBaseHelper;
    private Set<String> fieldsSet = new HashSet<>();
    @PostConstruct
    public void init(){
        PropertyDescriptor[] properties = BeanUtils.getPropertyDescriptors(Data.class);
        for(PropertyDescriptor field:properties){
            fieldsSet.add(field.getName());
        }
    }
    /**
     * 拼接es搜索json string
     * @param json
@ -117,7 +124,7 @@ public class DataSearchService {
    }
    public String getData(String jsonData){
//        String query = getQueryString(jsonData);
        logger.info("load data from elasticsearch start:" + org.apache.http.client.utils.DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        JSONObject resultJsonObj = new JSONObject();
        JSONArray  resultArray = new JSONArray();
       /* List list = new ArrayList();
@ -147,6 +154,7 @@ public class DataSearchService {
        resultArray.addAll(esResult.getSourceAsStringList());
        resultJsonObj.put("data", resultArray);
        resultJsonObj.put("count", esResult.getTotal());
        logger.info("load data from elasticsearch end:" + org.apache.http.client.utils.DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        return resultJsonObj.toJSONString();
//        if (!CollectionUtils.isEmpty(rowkeys)) {
@ -172,8 +180,8 @@ public class DataSearchService {
    private SearchSourceBuilder getQueryBuilder(String jsonData) {
        JSONObject json = JSONObject.parseObject(jsonData);
        List<Map<String, Object>> filter = (List)json.getJSONArray("filter");
        int page = json.getIntValue("page");
        int size = json.getIntValue("size");
        int page = json.getIntValue("page") == 0 ? 1:json.getIntValue("page"); //从第一页开始
        int size = json.getIntValue("size") == 0 ? 1:json.getIntValue("size"); //默认值为1,最少获取一条记录
        JSONArray sort = json.getJSONArray("sort");
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
@ -182,8 +190,7 @@ public class DataSearchService {
            String condition = String.valueOf(param.get("condition"));
            String field = String.valueOf(param.get("field"));
            Object value = param.get("value");
            String baseName = DataTypeEnum.body_sign_params.name().toString();
            if(null != DataStandardConvertService.dataMap.get(baseName) && DataStandardConvertService.dataMap.get(baseName).contains(field) || StringUtils.equalsIgnoreCase("rid",field)){
            if(!CollectionUtils.isEmpty(fieldsSet) && fieldsSet.contains(field)){
                field = "data." + field;
            }
            if(condition.equals("=")) {
@ -221,24 +228,33 @@ public class DataSearchService {
                }
            }
        }
        searchSourceBuilder.query(boolQueryBuilder);
        searchSourceBuilder.from((page -1)*size);
        searchSourceBuilder.size(size);
        if(CollectionUtils.notEmpty(sort)){
            for(Object obj:sort){
                JSONObject object = JSONObject.parseObject(obj.toString());
                FieldSortBuilder fieldSortBuilder = null;
                for(String key:object.keySet()){
                    FieldSortBuilder fieldSortBuilder = new FieldSortBuilder(key);
                    if(fieldsSet.contains(key)){
                        fieldSortBuilder = new FieldSortBuilder("data." + key);
                    }else{
                        fieldSortBuilder = new FieldSortBuilder(key);
                    }
                    JSONObject sortValue = object.getJSONObject(key);
                    if(StringUtils.equalsIgnoreCase(SortOrder.ASC.toString(),sortValue.getString("order"))){
                        fieldSortBuilder.order(SortOrder.ASC);
                    }else if(StringUtils.equalsIgnoreCase(SortOrder.DESC.toString(),sortValue.getString("order"))){
                        fieldSortBuilder.order(SortOrder.DESC);
                    }
                    fieldSortBuilder.setNestedPath("data");
                    searchSourceBuilder.sort(fieldSortBuilder);
                }
            }
        }
        NestedQueryBuilder nestedQueryBuilder = new NestedQueryBuilder("data",boolQueryBuilder);
        searchSourceBuilder.query(nestedQueryBuilder);
        return searchSourceBuilder;
    }
@ -278,6 +294,8 @@ public class DataSearchService {
        JSONObject updateObj = new JSONObject();
        updateObj.put("data",datas);
//        boolean bool = elastricSearchHelper.update(ConstantUtils.esIndex, ConstantUtils.esType, _id, updateObj.toJSONString());
//        Update update = new Update();
//        update.
        boolean bool = elastricSearchHelper.update(ConstantUtils.esIndex, ConstantUtils.esType, _id, resultObject);
        JSONObject updateResult = new JSONObject();
        updateResult.put("result", bool);
@ -302,6 +320,8 @@ public class DataSearchService {
     * @return
     */
    public String getDataFromHbase(List<String> rowkeys,SearchResult esResult){
        long time = System.currentTimeMillis();
        logger.info("load data from hbase start:" + org.apache.http.client.utils.DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        JSONObject resultJsonObj = new JSONObject();
        JSONArray  resultArray = new JSONArray();
        List<Map<String, Object>> resultList = new ArrayList<>();
@ -338,10 +358,26 @@ public class DataSearchService {
        resultArray.addAll(resultList);
        resultJsonObj.put("data",resultArray);
        resultJsonObj.put("count",esResult.getTotal());
        long count = System.currentTimeMillis() - time;
        logger.info("load data from hbase end:" + org.apache.http.client.utils.DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss) + ",count: " + count);
        return resultJsonObj.toJSONString();
    }
    public List<DataBodySignsVO> getDataToBean(String jsonData){
        List<DataBodySignsVO> result = new ArrayList<>();
        logger.info("load data from elasticsearch start:" + org.apache.http.client.utils.DateUtils.formatDate(new Date(), DateUtil.yyyy_MM_dd_HH_mm_ss));
        SearchSourceBuilder query = getQueryBuilder(jsonData);
        SearchResult esResult = elastricSearchHelper.search(ConstantUtils.esIndex,ConstantUtils.esType,query.toString());
        if(esResult.getTotal() == 0){
            return result;
        }
        for(String str :esResult.getSourceAsStringList()){
            DataBodySignsVO dataBodySignsVO = JSONObject.parseObject(str,DataBodySignsVO.class);
            result.add(dataBodySignsVO);
        }
        return result;
    }
    public static void main(String args[]) {
    }

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

@ -5,12 +5,13 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.datainput.enums.DataDeviceTypeEnum;
import com.yihu.iot.datainput.enums.DataOperationTypeEnum;
import com.yihu.iot.datainput.enums.DataTypeEnum;
import com.yihu.jw.iot.data_input.DataStandardDO;
import com.yihu.jw.iot.datainput.DataBodySignsDO;
import com.yihu.jw.iot.datainput.DataStandardDO;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.spring.SpringContextHolder;
import org.apache.http.client.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -52,49 +53,17 @@ public class DataStandardConvertService {
     * @param oldJson 要转换的json
     */
    public String iconvert(String oldJson){
        //将传过来的数据转换为对象
        DataBodySignsDO dataBodySignsDO = JSONObject.parseObject(oldJson,DataBodySignsDO.class);
        JSONObject jsonObject = JSONObject.parseObject(oldJson);
        //如果没有授权或者数据来源,则表示数据异常
        if(!jsonObject.containsKey("access_token") || !jsonObject.containsKey("data_source")){
        if(null == dataBodySignsDO.getAccess_token() || (null != dataBodySignsDO.getAccess_token() && null == dataBodySignsDO.getData_source())){
            logger.warn("传过来的数据无有效access_token或data_source",oldJson);
            return "";
        }
        //拿到i健康json数据里的各项值
        Object id = jsonObject.get("id");
        if(null == id){
            id = UUID.randomUUID();
        }
        String access_token = (String)jsonObject.get("access_token");
        String data_source = (String)jsonObject.get("data_source");
        String sn = (String)jsonObject.get("deviceSn");
        String deviceType = jsonObject.getString("deviceType");
        String ext_code = (String)jsonObject.get("userType");
        String data = (String)jsonObject.get("userType") + (String)jsonObject.get("unit");
        String device_name = (String)jsonObject.get("device_name");
        String device_model = (String)jsonObject.get("device_model");
        String measure_time = (String)jsonObject.get("sendTime");
        JSONObject newJsonObject = new JSONObject();
        JSONArray jsonArray = new JSONArray();
        JSONObject dataJsonObject = new JSONObject();
        newJsonObject.put("id",id);
        newJsonObject.put("access_token",access_token);
        newJsonObject.put("data_source",data_source);
        newJsonObject.put("sn",sn);
        newJsonObject.put("ext_code",ext_code);
        newJsonObject.put("device_name",device_name);
        newJsonObject.put("device_model",device_model);
        newJsonObject.put("data",jsonArray);
        dataJsonObject.put("measure_time",measure_time);
        String deviceDataName = DataDeviceTypeEnum.getNameByType(deviceType);
        dataJsonObject.put(deviceDataName,data);
        jsonArray.add(dataJsonObject);
        //保存日志
        dataProcessLogService.saveLog("","",data_source,measure_time, DateUtils.formatDate(new Date(),DateUtil.yyyy_MM_dd_HH_mm_ss),"1","4","com.yihu.iot.datainput.service.DataStandardConvertService.iconvert", DataOperationTypeEnum.convert.getName(),0);
        //转换后的标准json数据
        return newJsonObject.toJSONString();
        dataProcessLogService.saveLog("","",dataBodySignsDO.getData_source(),"", DateUtils.formatDate(new Date(),DateUtil.yyyy_MM_dd_HH_mm_ss),"1","4","com.yihu.iot.datainput.service.DataStandardConvertService.iconvert", DataOperationTypeEnum.convert.getName(),0);
        return String.valueOf(dataBodySignsDO);
    }
}

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

@ -2,7 +2,7 @@ package com.yihu.iot.datainput.service;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.datainput.dao.DataStandardDao;
import com.yihu.jw.iot.data_input.DataStandardDO;
import com.yihu.jw.iot.datainput.DataStandardDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

+ 163 - 0
svr/svr-iot/src/main/resources/core-site.xml

@ -0,0 +1,163 @@
  <configuration>
    
    <property>
      <name>fs.defaultFS</name>
      <value>hdfs://dev</value>
    </property>
    
    <property>
      <name>fs.trash.interval</name>
      <value>360</value>
    </property>
    
    <property>
      <name>ha.failover-controller.active-standby-elector.zk.op.retries</name>
      <value>120</value>
    </property>
    
    <property>
      <name>ha.zookeeper.quorum</name>
      <value>node1.hde.h3c.com:2181,node2.hde.h3c.com:2181,node3.hde.h3c.com:2181</value>
    </property>
    
    <property>
      <name>hadoop.http.authentication.simple.anonymous.allowed</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hbase.groups</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hbase.hosts</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hcat.groups</name>
      <value>users</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hcat.hosts</name>
      <value>node2.hde.h3c.com</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hdfs.groups</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hdfs.hosts</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hive.groups</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hive.hosts</name>
      <value>node2.hde.h3c.com</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.HTTP.groups</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.HTTP.hosts</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hue.groups</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.hue.hosts</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.oozie.groups</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.proxyuser.oozie.hosts</name>
      <value>*</value>
    </property>
    
    <property>
      <name>hadoop.security.auth_to_local</name>
      <value>DEFAULT</value>
    </property>
    
    <property>
      <name>hadoop.security.authentication</name>
      <value>simple</value>
    </property>
    
    <property>
      <name>hadoop.security.authorization</name>
      <value>false</value>
    </property>
    
    <property>
      <name>hadoop.security.key.provider.path</name>
      <value></value>
    </property>
    
    <property>
      <name>io.compression.codecs</name>
      <value>org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec,org.apache.hadoop.io.compress.SnappyCodec</value>
    </property>
    
    <property>
      <name>io.file.buffer.size</name>
      <value>131072</value>
    </property>
    
    <property>
      <name>io.serializations</name>
      <value>org.apache.hadoop.io.serializer.WritableSerialization</value>
    </property>
    
    <property>
      <name>ipc.client.connect.max.retries</name>
      <value>1</value><!--50-->
    </property>
    
    <property>
      <name>ipc.client.connection.maxidletime</name>
      <value>1000</value><!--30000-->
    </property>
    
    <property>
      <name>ipc.client.idlethreshold</name>
      <value>8000</value>
    </property>
    
    <property>
      <name>ipc.server.tcpnodelay</name>
      <value>true</value>
    </property>
    
    <property>
      <name>mapreduce.jobtracker.webinterface.trusted</name>
      <value>false</value>
    </property>
    
    <property>
      <name>net.topology.script.file.name</name>
      <value>/etc/hadoop/conf/topology_script.py</value>
    </property>
    
  </configuration>

+ 243 - 0
svr/svr-iot/src/main/resources/hbase-site.xml

@ -0,0 +1,243 @@
  <configuration>
    
    <property>
      <name>dfs.domain.socket.path</name>
      <value>/var/lib/hadoop-hdfs/dn_socket</value>
    </property>
    
    <property>
      <name>hbase.bulkload.staging.dir</name>
      <value>/apps/hbase/staging</value>
    </property>
    
    <property>
      <name>hbase.client.keyvalue.maxsize</name>
      <value>1048576</value>
    </property>
    
    <property>
      <name>hbase.client.retries.number</name>
      <value>1</value><!--35-->
    </property>
    
    <property>
      <name>hbase.client.scanner.caching</name>
      <value>100</value>
    </property>
    
    <property>
      <name>hbase.cluster.distributed</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hbase.coprocessor.master.classes</name>
      <value>org.apache.hadoop.hbase.security.access.AccessController</value>
    </property>
    
    <property>
      <name>hbase.coprocessor.region.classes</name>
      <value>org.apache.hadoop.hbase.security.access.AccessController,org.apache.hadoop.hbase.security.access.SecureBulkLoadEndpoint</value>
    </property>
    
    <property>
      <name>hbase.coprocessor.regionserver.classes</name>
      <value>org.apache.hadoop.hbase.security.access.AccessController</value>
    </property>
    
    <property>
      <name>hbase.defaults.for.version.skip</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hbase.hregion.majorcompaction</name>
      <value>604800000</value>
    </property>
    
    <property>
      <name>hbase.hregion.majorcompaction.jitter</name>
      <value>0.50</value>
    </property>
    
    <property>
      <name>hbase.hregion.max.filesize</name>
      <value>10737418240</value>
    </property>
    
    <property>
      <name>hbase.hregion.memstore.block.multiplier</name>
      <value>4</value>
    </property>
    
    <property>
      <name>hbase.hregion.memstore.flush.size</name>
      <value>134217728</value>
    </property>
    
    <property>
      <name>hbase.hregion.memstore.mslab.enabled</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hbase.hstore.blockingStoreFiles</name>
      <value>10</value>
    </property>
    
    <property>
      <name>hbase.hstore.compaction.max</name>
      <value>10</value>
    </property>
    
    <property>
      <name>hbase.hstore.compactionThreshold</name>
      <value>3</value>
    </property>
    
    <property>
      <name>hbase.local.dir</name>
      <value>${hbase.tmp.dir}/local</value>
    </property>
    
    <property>
      <name>hbase.master.info.bindAddress</name>
      <value>0.0.0.0</value>
    </property>
    
    <property>
      <name>hbase.master.info.port</name>
      <value>16010</value>
    </property>
    
    <property>
      <name>hbase.master.port</name>
      <value>16000</value>
    </property>
    
    <property>
      <name>hbase.regionserver.global.memstore.size</name>
      <value>0.4</value>
    </property>
    
    <property>
      <name>hbase.regionserver.handler.count</name>
      <value>30</value>
    </property>
    
    <property>
      <name>hbase.regionserver.info.port</name>
      <value>16030</value>
    </property>
    
    <property>
      <name>hbase.regionserver.port</name>
      <value>16020</value>
    </property>
    
    <property>
      <name>hbase.regionserver.thrift.http</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hbase.regionserver.wal.codec</name>
      <value>org.apache.hadoop.hbase.regionserver.wal.WALCellCodec</value>
    </property>
    
    <property>
      <name>hbase.replication</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hbase.rootdir</name>
      <value>hdfs://dev/apps/hbase/data</value>
    </property>
    
    <property>
      <name>hbase.rpc.protection</name>
      <value>authentication</value>
    </property>
    
    <property>
      <name>hbase.rpc.timeout</name>
      <value>90000</value>
    </property>
    
    <property>
      <name>hbase.security.authentication</name>
      <value>simple</value>
    </property>
    
    <property>
      <name>hbase.security.authorization</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hbase.superuser</name>
      <value>hbase</value>
    </property>
    
    <property>
      <name>hbase.thrift.support.proxyuser</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hbase.tmp.dir</name>
      <value>/hadoop/hbase</value>
    </property>
    
    <property>
      <name>hbase.zookeeper.property.clientPort</name>
      <value>2181</value>
    </property>
    
    <property>
      <name>hbase.zookeeper.quorum</name>
      <value>node1.hde.h3c.com,node2.hde.h3c.com,node3.hde.h3c.com</value>
    </property>
    
    <property>
      <name>hbase.zookeeper.useMulti</name>
      <value>true</value>
    </property>
    
    <property>
      <name>hfile.block.cache.size</name>
      <value>0.40</value>
    </property>
    
    <property>
      <name>phoenix.query.timeoutMs</name>
      <value>60000</value>
    </property>
    
    <property>
      <name>replication.replicationsource.implementation</name>
      <value>com.ngdata.sep.impl.SepReplicationSource</value>
    </property>
    
    <property>
      <name>replication.source.nb.capacity</name>
      <value>1000</value>
    </property>
    
    <property>
      <name>replication.source.ratio</name>
      <value>1</value>
    </property>
    
    <property>
      <name>zookeeper.session.timeout</name>
      <value>90000</value>
    </property>
    
    <property>
      <name>zookeeper.znode.parent</name>
      <value>/hbase-unsecure</value>
    </property>
    
  </configuration>

+ 35 - 0
svr/svr-iot/src/main/resources/logback.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
    <property name="LOG_HOME" value="D:/software/soft_dev/IdeaWorkSpace/jw2.0-dev/jw2.0/svr/svr-iot/logs" />
    <!-- 控制台输出 -->
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
    </appender>
    <!-- 按照每天生成日志文件 -->
    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!--日志文件输出的文件名-->
            <FileNamePattern>${LOG_HOME}/svr-iot.%d{yyyy-MM-dd}.log</FileNamePattern>
            <!--日志文件保留天数-->
            <MaxHistory>30</MaxHistory>
        </rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
        <!--日志文件最大的大小-->
        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <MaxFileSize>10MB</MaxFileSize>
        </triggeringPolicy>
    </appender>
    <!-- 日志输出级别 -->
    <root level="INFO">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="FILE" />
    </root>
</configuration>