Commit 00976702 by YANGYANG

公安部标注平台项目初始化提交

parent d65cc84b
package com.founder.commonutils.ZdryAndZdryApiVo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="UsersAndOnlineAndTasksVo对象", description="UsersAndOnlineAndTasksVo对象")
public class UsersAndOnlineAndTasksVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "姓名")
private String xm;
@ApiModelProperty(value = "性别 1男 2女 0未知")
private Integer xb;
@ApiModelProperty(value = "家庭住址")
private String jtZz;
@ApiModelProperty(value = "是否有前科 1是 0否")
private Integer sfyQk;
@ApiModelProperty(value = "现住址")
private String xzz;
@ApiModelProperty(value = "病史")
private String bs;
@ApiModelProperty(value = "病情等级 1低 2中 3高 4极高")
private Integer bqDj;
@ApiModelProperty(value = "监护人1姓名")
private String jhr1Xm;
@ApiModelProperty(value = "监护人1关系")
private String jhr1Gx;
@ApiModelProperty(value = "监护人1联系电话")
private String jhr1Lxdh;
@ApiModelProperty(value = "监护人1紧急电话")
private String jhr1Jjdh;
@ApiModelProperty(value = "监护人2姓名")
private String jhr2Xm;
@ApiModelProperty(value = "监护人2关系")
private String jhr2Gx;
@ApiModelProperty(value = "监护人2联系电话")
private String jhr2Lxdh;
@ApiModelProperty(value = "监护人2紧急电话")
private String jhr2Jjdh;
@ApiModelProperty(value = "设备IMEI")
private String sbImei;
@ApiModelProperty(value = "设备型号")
private String sbXh;
@ApiModelProperty(value = "身份证号码")
private String sfzhm;
@ApiModelProperty(value = "是否在线 1在线 0离线")
private String online;
@ApiModelProperty(value = "是否佩戴 1佩戴 0位佩戴")
private String WearFlag;
@ApiModelProperty(value = "最新发生时间")
private String locationUpdatedAt;
@ApiModelProperty(value = "最新位置经度")
private String lastLocationX;
@ApiModelProperty(value = "最新位置纬度")
private String lastLocationY;
@ApiModelProperty(value = "最新位置地址")
private String lastAddress;
@ApiModelProperty(value = "电子围栏名称")
@TableField(value = "name")
private String name;
@ApiModelProperty(value = "开始时间例早上八点:8")
@TableField(value = "time_begin")
private String timeBegin;
@ApiModelProperty(value = "结束时间例下午六点:18")
@TableField(value = "time_end")
private String timeEnd;
@ApiModelProperty(value = "A;B;C;D;A")
@TableField(value = "safe_area")
private String safeArea;
@ApiModelProperty(value = "任务类型")
@TableField(value = "task_type")
private String taskType;
@ApiModelProperty(value = "预警")
@TableField(value = "warn")
private int warn;
@ApiModelProperty(value = "1进入区域 2离开区域 3异常预警")
@TableField(value = "gklx")
private int gklx;
}
package com.founder.commonutils.ZdryAndZdryApiVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="UsersAndOnlineVo对象", description="UsersAndOnlineVo对象")
public class UsersAndOnlineVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "姓名")
private String xm;
@ApiModelProperty(value = "性别 1男 2女 0未知")
private Integer xb;
@ApiModelProperty(value = "家庭住址")
private String jtZz;
@ApiModelProperty(value = "是否有前科 1是 0否")
private Integer sfyQk;
@ApiModelProperty(value = "现住址")
private String xzz;
@ApiModelProperty(value = "病史")
private String bs;
@ApiModelProperty(value = "病情等级 1低 2中 3高 4极高")
private Integer bqDj;
@ApiModelProperty(value = "监护人1姓名")
private String jhr1Xm;
@ApiModelProperty(value = "监护人1关系")
private String jhr1Gx;
@ApiModelProperty(value = "监护人1联系电话")
private String jhr1Lxdh;
@ApiModelProperty(value = "监护人1紧急电话")
private String jhr1Jjdh;
@ApiModelProperty(value = "监护人2姓名")
private String jhr2Xm;
@ApiModelProperty(value = "监护人2关系")
private String jhr2Gx;
@ApiModelProperty(value = "监护人2联系电话")
private String jhr2Lxdh;
@ApiModelProperty(value = "监护人2紧急电话")
private String jhr2Jjdh;
@ApiModelProperty(value = "设备IMEI")
private String sbImei;
@ApiModelProperty(value = "设备型号")
private String sbXh;
@ApiModelProperty(value = "身份证号码")
private String sfzhm;
@ApiModelProperty(value = "是否在线 1在线 0离线")
private String online;
@ApiModelProperty(value = "是否佩戴 1佩戴 0位佩戴")
private String WearFlag;
@ApiModelProperty(value = "最新发生时间")
private String locationUpdatedAt;
@ApiModelProperty(value = "最新位置经度")
private String lastLocationX;
@ApiModelProperty(value = "最新位置纬度")
private String lastLocationY;
@ApiModelProperty(value = "最新位置地址")
private String lastAddress;
@ApiModelProperty(value = "1本人佩戴 0不是本人")
private Integer ismeWearFlag;
}
package com.founder.commonutils.ZdryApiEntity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-16
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="BloodMessage对象", description="BloodMessage对象")
@TableName("gk_blood")
public class BloodMessage implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "信息主键编号自增长")
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "设备Imei")
@TableField(value = "sb_imei")
private String sbImei;
@ApiModelProperty(value = "发生时间YYYY-MM-DD HH:mm:SS")
@TableField(value = "time_begin")
private String timeBegin;
@ApiModelProperty(value = "血氧百分比")
@TableField(value = "bloodoxygen")
private int bloodoxygen;
@ApiModelProperty(value = "血氧报警上限")
@TableField(value = "bloodoxygen_h")
private int bloodoxygenH;
@ApiModelProperty(value = "血氧报警下限")
@TableField(value = "bloodoxygen_l")
private int bloodoxygenL;
@ApiModelProperty(value = "登记时间")
@TableField(fill = FieldFill.INSERT)
private Date djsj;
@ApiModelProperty(value = "改写时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gxsj;
}
package com.founder.commonutils.ZdryApiEntity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-13
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="DbpMessage对象", description="DbpMessage对象")
@TableName("gk_dbp")
public class DbpMessage implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "信息主键编号自增长")
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "设备Imei")
@TableField(value = "sb_imei")
private String sbImei;
@ApiModelProperty(value = "发生时间YYYY-MM-DD HH:mm:SS")
@TableField(value = "time_begin")
private String timeBegin;
@ApiModelProperty(value = "舒张压")
@TableField(value = "dbp")
private int dbp;
@ApiModelProperty(value = "舒张压报警下限")
@TableField(value = "dbp_l")
private int dbp_l;
@ApiModelProperty(value = "收缩压")
@TableField(value = "sbp")
private int sbp;
@ApiModelProperty(value = "收缩压报警上限")
@TableField(value = "sbp_h")
private int sbp_h;
@ApiModelProperty(value = "登记时间")
@TableField(fill = FieldFill.INSERT)
private Date djsj;
@ApiModelProperty(value = "改写时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gxsj;
}
package com.founder.commonutils.ZdryApiEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-05-31
*/
@Data
@ApiModel(value="device对象", description="device对象")
public class Device implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " 计步数据开关")
int pedometer_enable ;
@ApiModelProperty(value = "睡眠数据开关")
int sleep_enable;
@ApiModelProperty(value = "轨迹开关")
int track_enable;
@ApiModelProperty(value = "心率、血氧、血压定时测量开关")
int heartrate_enable;
@ApiModelProperty(value = "IMEI")
String sbImei;
}
package com.founder.commonutils.ZdryApiEntity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="fence对象", description="fence对象")
@TableName("gk_fencetask")
public class FenceTask implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "信息主键编号自增长")
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "设备Imei")
@TableField(value = "sb_imei")
private String sbImei;
@ApiModelProperty(value = "电子围栏名称")
@TableField(value = "name")
private String name;
@ApiModelProperty(value = "开始时间例早上八点:8")
@TableField(value = "time_begin")
private String timeBegin;
@ApiModelProperty(value = "结束时间例下午六点:18")
@TableField(value = "time_end")
private String timeEnd;
@ApiModelProperty(value = "A;B;C;D;A")
@TableField(value = "safe_area")
private String safeArea;
@ApiModelProperty(value = "登记时间")
@TableField(fill = FieldFill.INSERT)
private Date djsj;
@ApiModelProperty(value = "改写时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gxsj;
@ApiModelProperty(value = "信息删除判断标志")
@TableField(value = "xxsc_pdbz")
private int xxscPdbz;
@ApiModelProperty(value = "任务类型")
@TableField(value = "task_type")
private String taskType;
@ApiModelProperty(value = "预警")
@TableField(value = "warn")
private int warn;
@ApiModelProperty(value = "1进入区域 2离开区域 3异常预警")
@TableField(value = "gklx")
private int gklx;
@ApiModelProperty(value = "信息登记单位公安机关机构代码")
private String xxdjdwGajgjgdm;
@ApiModelProperty(value = "信息登记单位公安机关机构名称")
private String xxdjdwGajgjgmc;
}
package com.founder.commonutils.ZdryApiEntity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-13
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="HeartrateMessage对象", description="HeartrateMessage对象")
@TableName("gk_heartrate")
public class HeartrateMessage implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "信息主键编号自增长")
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "设备Imei")
@TableField(value = "sb_imei")
private String sbImei;
@ApiModelProperty(value = "发生时间YYYY-MM-DD HH:mm:SS")
@TableField(value = "time_begin")
private String timeBegin;
@ApiModelProperty(value = "心率")
@TableField(value = "heartrate")
private int heartrate;
@ApiModelProperty(value = "心率阈值上限")
@TableField(value = "theshold_heartrate_h")
private int theshold_heartrate_h;
@ApiModelProperty(value = "心率阈值下限")
@TableField(value = "theshold_heartrate_l")
private int theshold_heartrate_l;
@ApiModelProperty(value = "登记时间")
@TableField(fill = FieldFill.INSERT)
private Date djsj;
@ApiModelProperty(value = "改写时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gxsj;
}
package com.founder.commonutils.ZdryApiEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-05-31
*/
@Data
@ApiModel(value="locationData对象", description="locationData对象")
public class LocationData implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = " 设备")
private String device ;
@ApiModelProperty(value = "记录时间")
private String created_at;
@ApiModelProperty(value = "发生时间")
private String time_begin;
@ApiModelProperty(value = "0:Gps定位; 1:基站定位")
private String type;
@ApiModelProperty(value = "城市")
private String city;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "x经度")
private String x;
@ApiModelProperty(value = "y纬度")
private String y;
}
package com.founder.commonutils.ZdryApiEntity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="LocationMessage对象", description="LocationMessage对象")
@TableName("gk_LocationMessage")
public class LocationMessage implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "信息主键编号自增长")
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "设备Imei")
@TableField(value = "sb_imei")
private String sbImei;
@ApiModelProperty(value = "类型 0:Gps定位; 1:基站定位(移动/联通版定位) 2:电信基站版定位")
@TableField(value = "type")
private int type;
@ApiModelProperty(value = "发生时间YYYY-MM-DD HH:mm:SS")
@TableField(value = "time_begin")
private String timeBegin;
@ApiModelProperty(value = "是否为响应")
@TableField(value = "is_reply")
private int isReply;
@ApiModelProperty(value = "是否轨迹")
@TableField(value = "is_track")
private int isTrack;
@ApiModelProperty(value = "城市")
@TableField(value = "city")
private String city;
@ApiModelProperty(value = "地址")
@TableField(value = "address")
private String address;
@ApiModelProperty(value = "经度")
@TableField(value = "x")
private String x;
@ApiModelProperty(value = "经度")
@TableField(value = "y")
private String y;
@ApiModelProperty(value = "登记时间")
@TableField(fill = FieldFill.INSERT)
private Date djsj;
@ApiModelProperty(value = "改写时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gxsj;
}
package com.founder.commonutils.ZdryApiEntity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="message对象", description="message对象")
@TableName("gk_message")
public class Message implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "信息主键编号自增长")
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "设备Imei")
@TableField(value = "sb_imei")
private String sbImei;
@ApiModelProperty(value = "type=1 SOS,type=2 fall,type=3 new 新成员加入 ,type=4 电子围栏触发, type=5 设备低电,type=6 环境音")
@TableField(value = "type")
private int type;
@ApiModelProperty(value = "机构ID")
@TableField(value = "communityid")
private String communityId;
@ApiModelProperty(value = "只有环境音(type=6)为必填,其他type都为非必填")
@TableField(value = "url")
private String url;
@ApiModelProperty(value = "设备名称")
@TableField(value = "name")
private String name;
@ApiModelProperty(value = "登记时间")
@TableField(fill = FieldFill.INSERT)
private Date djsj;
@ApiModelProperty(value = "改写时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gxsj;
}
package com.founder.commonutils.ZdryApiEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="gk_online对象", description="gk_online对象")
@TableName("gk_online")
public class OnlineAndWear implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "信息主键编号")
@TableId(type = IdType.AUTO)
private String id;
@ApiModelProperty(value = "设备Imei")
@TableField(value = "sb_imei")
private String sbImei;
@ApiModelProperty(value = "是否在线 1在线 0离线")
@TableField(value = "online")
private String online;
@ApiModelProperty(value = "是否佩戴 1佩戴 0位佩戴")
@TableField(value = "wear_flag")
private String WearFlag;
@ApiModelProperty(value = "最新发生时间")
@TableField(value = "location_updated_at")
private String locationUpdatedAt;
@ApiModelProperty(value = "最新位置经度")
@TableField(value = "last_location_x")
private String lastLocationX;
@ApiModelProperty(value = "最新位置纬度")
@TableField(value = "last_location_y")
private String lastLocationY;
@ApiModelProperty(value = "最新位置地址")
@TableField(value = "last_address")
private String lastAddress;
@ApiModelProperty(value = "姓名")
@TableField(value = "xm")
private String xm;
}
package com.founder.commonutils.ZdryApiEntity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-16
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="StepMessage对象", description="StepMessage对象")
@TableName("gk_stepNumber")
public class StepMessage implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "信息主键编号自增长")
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "设备Imei")
@TableField(value = "sb_imei")
private String sbImei;
@ApiModelProperty(value = "发生时间YYYY-MM-DD HH:mm:SS")
@TableField(value = "time_begin")
private String timeBegin;
@ApiModelProperty(value = "步数")
@TableField(value = "value")
private int value;
@ApiModelProperty(value = "登记时间")
@TableField(fill = FieldFill.INSERT)
private Date djsj;
@ApiModelProperty(value = "改写时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date gxsj;
}
package com.founder.commonutils.zdryEntity;
import com.founder.commonutils.ZdryApiEntity.Device;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-05-31
*/
@Data
@ApiModel(value="UsersAndDevice对象", description="UsersAndDevice对象")
public class UsersAndDevice implements Serializable {
private Users users;
private Device device;
public Users getUsers() {
return users;
}
public void setUsers(Users users) {
this.users = users;
}
public Device getDevice() {
return device;
}
public void setDevice(Device device) {
this.device = device;
}
}
......@@ -15,38 +15,27 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration//配置类
@EnableSwagger2 //swagger注解
public class SwaggerConfig {
public static final String zdry = "com.founder.zdry";
public static final String zdryApi = "com.founder.zdryapi";
public static final String bz = "com.founder.bz";
@Bean
public Docket asjApi(){
return new Docket(DocumentationType.SWAGGER_2)
.groupName("zdry")
.groupName("bz")
.apiInfo(webApiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage(zdry))
.apis(RequestHandlerSelectors.basePackage(bz))
.paths(Predicates.not(PathSelectors.regex("/admin/.*")))
.paths(Predicates.not(PathSelectors.regex("/error.*")))
.build();
}
@Bean
public Docket esApi(){
return new Docket(DocumentationType.SWAGGER_2)
.groupName("zdryApi")
.apiInfo(webApiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage(zdryApi))
.paths(Predicates.not(PathSelectors.regex("/admin/.*")))
.paths(Predicates.not(PathSelectors.regex("/error.*")))
.build();
}
private ApiInfo webApiInfo(){
return new ApiInfoBuilder()
.title("重点人员API文档")
.description("本文档描述了时空大数据微服务接口定义")
.title("公安部标注平台API文档")
.description("本文档描述了公安部微服务接口定义")
.version("1.0")
.contact(new Contact("java", "http://atguigu.com", "chang_chao@founder.com"))
.contact(new Contact("java", "http://atguigu.com", "yang_yang5@founder.com"))
.build();
}
}
......@@ -9,9 +9,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>zdry</artifactId>
<artifactId>bz</artifactId>
<build>
<finalName>zdry</finalName>
<finalName>bz</finalName>
</build>
</project>
\ No newline at end of file
package com.founder.zdry;
package com.founder.bz;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
......@@ -10,11 +10,11 @@ import org.springframework.context.annotation.ComponentScan;
@ComponentScan(basePackages = {"com.founder"})
@EnableDiscoveryClient
@EnableFeignClients
public class ZdryApplication {
public class BzApplication {
public static void main(String[] args) {
SpringApplication.run(ZdryApplication.class, args);
SpringApplication.run(BzApplication.class, args);
}
}
package com.founder.zdry.controller;
package com.founder.bz.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -6,7 +6,7 @@ import com.founder.commonutils.constant.CommonCodeConstant;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.publicEntity.ResultCode;
import com.founder.commonutils.zdryEntity.DlUsers;
import com.founder.zdry.service.DlUserService;
import com.founder.bz.service.DlUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......
package com.founder.zdry.mapper;
package com.founder.bz.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.zdryEntity.DlUsers;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdry.mapper.DlUserMapper">
<mapper namespace="com.founder.bz.mapper.DlUserMapper">
</mapper>
package com.founder.zdry.service;
package com.founder.bz.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.zdryEntity.DlUsers;
......
package com.founder.zdry.service.impl;
package com.founder.bz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.commonutils.constant.CommonCodeConstant;
import com.founder.commonutils.zdryEntity.DlUsers;
import com.founder.zdry.mapper.DlUserMapper;
import com.founder.zdry.service.DlUserService;
import com.founder.bz.mapper.DlUserMapper;
import com.founder.bz.service.DlUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -8,13 +8,13 @@ spring.cloud.nacos.discovery.server-addr=47.92.48.137:9949
spring.profiles.active=dev
# 该配置影响统一配置中心中的dataId
spring.application.name=zdry
spring.application.name=bz
spring.cloud.nacos.config.namespace=f1160b5f-cef5-4e86-bddc-c55e28c2d8b0
#spring.cloud.nacos.config.ext-config[0].data-id=image.properties
# 开启动态刷新配置,否则配置文件修改,工程无法感知
#spring.cloud.nacos.config.ext-config[0].refresh=true
spring.cloud.nacos.config.shared-dataids=zdrypz.properties
spring.cloud.nacos.config.refreshable-dataids=zdrypz.properties
#spring.cloud.nacos.config.shared-dataids=bzpz.properties
#spring.cloud.nacos.config.refreshable-dataids=bzpz.properties
management.health.elasticsearch.enabled: false
\ No newline at end of file
......@@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>zdry</module>
<module>bz</module>
</modules>
<artifactId>service</artifactId>
<dependencies>
......@@ -97,8 +97,7 @@
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
-->
<!-- <dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.4.3</version>
......@@ -107,8 +106,7 @@
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>6.4.3</version>
</dependency>-->
</dependency>
<!--spring切面aop依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
......
package com.founder.zdry.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import com.founder.commonutils.constant.CommonCodeConstant;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.publicEntity.ResultCode;
import com.founder.commonutils.zdryEntity.DlUsers;
import com.founder.zdry.fegin.ServerZdryApi;
import com.founder.zdry.service.FenceTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 前端控制器
* </p>
*
* @author yangyang
* @since 2021-06-05
*/
@RestController
@Api(tags = "任务管理")
@RequestMapping("/fence")
public class FenceTaskController {
@Autowired
private FenceTaskService fenceTaskService;
@Autowired
private ServerZdryApi serverZdryApi;
@ApiOperation(value = "分页围栏任务列表")
@GetMapping("fenceTaskList/{page}/{limit}")
public MapRestResult fenceTaskList(
@ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Long page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Long limit,
@ApiParam(name = "gklx", value = "任务类型")
@RequestParam(required = false) String gklx,
@ApiParam(name = "sbimei", value = "设备IMEI")
@RequestParam(required = false) String sbimei,
@ApiParam(name = "name", value = "任务名称")
@RequestParam(required = false) String name,
HttpServletRequest httpServletRequest
){
// 登陆者信息
DlUsers user=(DlUsers)httpServletRequest.getSession().getAttribute(CommonCodeConstant.LOGIN_USER_KEY);
Page<FenceTask> pageParam = new Page<>(page, limit);
QueryWrapper<FenceTask> wrapper = new QueryWrapper<>();
if(null != user){// 市局 分局 派出所
String code = "";
if(user.getUnitCode().endsWith("00000000")){
code = user.getUnitCode().substring(0,4);
}else if(user.getUnitCode().endsWith("000000")){
code = user.getUnitCode().substring(0,6);
}else if(user.getUnitCode().endsWith("0000")){
code = user.getUnitCode().substring(0,8);
}else{
code = user.getUnitCode();
}
wrapper.like("xxdjdw_gajgjgdm", code);
}
if(StringUtils.isNotBlank(gklx)){
wrapper.eq("gklx", gklx);
}
if(StringUtils.isNotBlank(sbimei)){
wrapper.like("sb_imei", sbimei);
}
if(StringUtils.isNotBlank(name)){
wrapper.like("name", name);
}
wrapper.eq("xxsc_pdbz", "0");
wrapper.orderByAsc("djsj");
fenceTaskService.page(pageParam, wrapper);
List<FenceTask> records = pageParam.getRecords();
long total = pageParam.getTotal();
return MapRestResult.build(ResultCode.SUCCESS,"成功获取任务列表信息",total,records);
}
@ApiOperation(value = "分页任务关联人列表")
@GetMapping("fenceTaskPeopleList/{page}/{limit}")
public MapRestResult fenceTaskPeopleList(
@ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Long page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Long limit,
@ApiParam(name = "xm", value = "姓名")
@RequestParam(required = false) String xm,
@ApiParam(name = "bs", value = "病史")
@RequestParam(required = false) String bs,
@ApiParam(name = "sbimei", value = "设备IMEI")
@RequestParam(required = false) String sbimei,
@ApiParam(name = "bqdj", value = "病情等级")
@RequestParam(required = false) String bqdj,
@ApiParam(name = "sfzhm", value = "身份证号码")
@RequestParam(required = false) String sfzhm,
HttpServletRequest httpServletRequest
){
DlUsers user=(DlUsers)httpServletRequest.getSession().getAttribute(CommonCodeConstant.LOGIN_USER_KEY);
Map map = new HashMap();
map.put("page",page * limit);
map.put("limit",limit);
map.put("sbimei",sbimei);
map.put("xm",xm);
map.put("bs",bs);
map.put("bqdj",bqdj);
map.put("sfzhm",sfzhm);
if(null != user){// 市局 分局 派出所
String code = "";
if(user.getUnitCode().endsWith("00000000")){
code = user.getUnitCode().substring(0,4);
}else if(user.getUnitCode().endsWith("000000")){
code = user.getUnitCode().substring(0,6);
}else if(user.getUnitCode().endsWith("0000")){
code = user.getUnitCode().substring(0,8);
}else{
code = user.getUnitCode();
}
map.put("xxdjdwGajgjgdm",code);
}
List<UsersAndOnlineAndTasksVo> list = fenceTaskService.fenceTaskPeopleList(map);
Integer total = fenceTaskService.fenceTaskPeopleListCount(map);
return MapRestResult.build(ResultCode.SUCCESS,"分页任务关联人列表",total,list);
}
@ApiOperation(value = "设置电子围栏")
@PostMapping(value = "/deviceFenceTask")
public MapRestResult deviceFenceTask(@ApiParam(name = "sbImei", value = "设备IMEI", required = true)
@RequestParam(value = "sbImei") String sbImei,
@ApiParam(name = "name", value = "电子围栏名称", required = true)
@RequestParam(value = "name") String name,
@ApiParam(name = "time_begin", value = "开始时间例早上八点:08:00", required = true)
@RequestParam(value = "time_begin") String time_begin,
@ApiParam(name = "time_end", value = "结束时间例下午六点:18:00", required = true)
@RequestParam(value = "time_end") String time_end,
@ApiParam(name = "safe_area", value = "A;B;C;D;A", required = true)
@RequestParam(value = "safe_area") String safe_area,
@ApiParam(name = "gklx", value = "1进入区域 2离开区域 3异常预警", required = true)
@RequestParam(value = "gklx") int gklx,
HttpServletRequest httpServletRequest
) {
// 登陆者信息
DlUsers user=(DlUsers)httpServletRequest.getSession().getAttribute(CommonCodeConstant.LOGIN_USER_KEY);
return serverZdryApi.deviceFenceTask(sbImei,name,time_begin,time_end,safe_area,gklx,user.getUnitCode(),user.getTrueName());
}
}
package com.founder.zdry.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo;
import com.founder.commonutils.constant.CommonCodeConstant;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.publicEntity.ResultCode;
import com.founder.commonutils.zdryEntity.DlUsers;
import com.founder.commonutils.zdryEntity.Users;
import com.founder.commonutils.zdryEntity.UsersAndDevice;
import com.founder.zdry.fegin.ServerZdryApi;
import com.founder.zdry.service.UsersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 前端控制器
* </p>
*
* @author yangyang
* @since 2021-05-30
*/
@RestController
@Api(tags = "用户管理")
@RequestMapping("/users")
public class UsersController {
@Autowired
private UsersService usersService;
@Autowired
private ServerZdryApi serverZdryApi;
@ApiOperation(value = "分页用户列表")
@GetMapping("userPageList/{page}/{limit}")
public MapRestResult userPageList(
@ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Long page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Long limit,
@ApiParam(name = "xm", value = "姓名")
@RequestParam(required = false) String xm,
@ApiParam(name = "bs", value = "病史")
@RequestParam(required = false) String bs,
@ApiParam(name = "sbimei", value = "设备IMEI")
@RequestParam(required = false) String sbimei,
@ApiParam(name = "bqdj", value = "病情等级")
@RequestParam(required = false) String bqdj,
@ApiParam(name = "sfzhm", value = "身份证号码")
@RequestParam(required = false) String sfzhm,
HttpServletRequest httpServletRequest){
// 登陆者信息
DlUsers user=(DlUsers)httpServletRequest.getSession().getAttribute(CommonCodeConstant.LOGIN_USER_KEY);
Page<Users> pageParam = new Page<>(page - 1, limit);
QueryWrapper<Users> wrapper = new QueryWrapper<>();
if(null != user){// 市局 分局 派出所
String code = "";
if(user.getUnitCode().endsWith("00000000")){
code = user.getUnitCode().substring(0,4);
}else if(user.getUnitCode().endsWith("000000")){
code = user.getUnitCode().substring(0,6);
}else if(user.getUnitCode().endsWith("0000")){
code = user.getUnitCode().substring(0,8);
}
wrapper.like("xxdjdw_gajgjgdm", code);
}
if(StringUtils.isNotBlank(xm)){
wrapper.like("xm", xm);
}
if(StringUtils.isNotBlank(bs)){
wrapper.like("bs", bs);
}
if(StringUtils.isNotBlank(sbimei)){
wrapper.like("sb_imei", sbimei);
}
if(StringUtils.isNotBlank(bqdj)){
wrapper.eq("bq_dj", bqdj);
}
if(StringUtils.isNotBlank(sfzhm)){
wrapper.like("sfzhm", sfzhm);
}
wrapper.eq("xxsc_pdbz", "0");
wrapper.orderByAsc("djsj");
usersService.page(pageParam, wrapper);
List<Users> records = pageParam.getRecords();
long total = pageParam.getTotal();
return MapRestResult.build(ResultCode.SUCCESS,"成功获取用户列表信息",total,records);
}
@ApiOperation(value = "根据身份证号码查询用户信息")
@GetMapping("getUserBySfzhm/{sfzhm}")
public MapRestResult getById(
@ApiParam(name = "sfzhm", value = "身份证号码", required = true)
@PathVariable String sfzhm){
UsersAndDevice usersAndDevice = new UsersAndDevice();
QueryWrapper<Users> wrapper = new QueryWrapper<>();
wrapper.like("sfzhm", sfzhm);
wrapper.eq("xxsc_pdbz", "0");
Users users = usersService.getOne(wrapper);
if(null != users){
usersAndDevice.setUsers(users);
if(StringUtils.isNotEmpty(users.getSbImei())){
usersAndDevice.setDevice(serverZdryApi.getDevice(users.getSbImei()));
}
}
return MapRestResult.build(ResultCode.SUCCESS,"成功获取用户信息","1",usersAndDevice);
}
@ApiOperation(value = "新增用户")
@PostMapping("/saveUsers")
public MapRestResult saveUsers(@ApiParam(name = "UsersAndDevice", value = "用户对象", required = true)
@RequestBody UsersAndDevice usersAndDevice, HttpServletRequest httpServletRequest) {
try{
// 登陆者信息
DlUsers user=(DlUsers)httpServletRequest.getSession().getAttribute(CommonCodeConstant.LOGIN_USER_KEY);
if(null != user){
usersAndDevice.getUsers().setXxdjdwGajgjgdm(user.getUnitCode());
usersAndDevice.getUsers().setXxdjdwGajgjgmc(user.getTrueName());
}else{
return MapRestResult.build(ResultCode.ERROR,"保存用户信息失败","登陆超时请重新登录!");
}
// 先查询是否有该用户 存在提示 该用户已存在 不存在插入
QueryWrapper<Users> wrapper = new QueryWrapper<>();
if(StringUtils.isNotBlank(usersAndDevice.getUsers().getSfzhm())){
wrapper.like("sfzhm", usersAndDevice.getUsers().getSfzhm());
wrapper.eq("xxsc_pdbz", "0");
Users users = usersService.getOne(wrapper);
if(null != users){
return MapRestResult.build(ResultCode.ERROR,"保存用户信息失败","1","该用户已存在!");
}else{
boolean flag = usersService.save(usersAndDevice.getUsers());
if(flag){
if(StringUtils.isNotBlank(usersAndDevice.getDevice().getSbImei())) {
// 调用开关接口
String result = serverZdryApi.updateDevice(usersAndDevice.getDevice());
if(result.equals("success")) {
return MapRestResult.build(ResultCode.SUCCESS, "成功保存用户信息", "1","1");
}else{
return MapRestResult.build(ResultCode.ERROR,"保存用户开关信息失败",result,"1");
}
}else{
return MapRestResult.build(ResultCode.SUCCESS, "成功保存用户信息", "1","1");
}
}else{
return MapRestResult.build(ResultCode.ERROR,"保存用户信息失败","1","1");
}
}
}else{
boolean flag = usersService.save(usersAndDevice.getUsers());
if(flag){
return MapRestResult.build(ResultCode.SUCCESS,"成功保存用户信息","1","1");
}else{
return MapRestResult.build(ResultCode.ERROR,"保存用户信息失败","1","1");
}
}
}catch (Exception e){
e.printStackTrace();
return MapRestResult.build(ResultCode.ERROR,"保存用户信息失败",e.getMessage(),"1");
}
}
@ApiOperation(value = "修改用户信息")
@PostMapping("/updateUsersBySfzhm")
public MapRestResult savePermission(@ApiParam(name = "UsersAndDevice", value = "用户对象", required = true)
@RequestBody UsersAndDevice usersAndDevice) {
try{
boolean flag = usersService.updateById(usersAndDevice.getUsers());
if(flag){
if(StringUtils.isNotBlank(usersAndDevice.getDevice().getSbImei())) {
// 调用开关接口
String result = serverZdryApi.updateDevice(usersAndDevice.getDevice());
if(result.equals("success")) {
return MapRestResult.build(ResultCode.SUCCESS, "成功修改用户信息", "1");
}else{
return MapRestResult.build(ResultCode.ERROR,"修改用户开关信息失败",result);
}
}else{
return MapRestResult.build(ResultCode.SUCCESS, "成功修改用户信息", "1");
}
}else {
return MapRestResult.build(ResultCode.ERROR, "修改用户信息失败", "1");
}
}catch (Exception e){
e.printStackTrace();
return MapRestResult.build(ResultCode.ERROR,"修改用户信息失败",e.getMessage());
}
}
@ApiOperation(value = "批量删除用户")
@PostMapping("/deleteUsersBySfzhms")
public MapRestResult deleteUsersByIds(@RequestBody String[] Sfzhms) {
boolean result = false;
for (String sfzhm : Sfzhms) {
QueryWrapper<Users> wrapper = new QueryWrapper<>();
wrapper.eq("sfzhm",sfzhm);
// 查询
Users user = usersService.getOne(wrapper);
// 修改数据
user.setXxscPdbz(1);
// 执行更新
result = usersService.updateById(user);
}
if(result){
return MapRestResult.build(ResultCode.SUCCESS,"成功删除用户信息","1");
}else{
return MapRestResult.build(ResultCode.ERROR,"删除用户信息失败","1");
}
}
@ApiOperation(value = "分页用户是否在线列表")
@GetMapping("userPageOnlineList/{page}/{limit}")
public MapRestResult userPageOnlineList(
@ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Integer page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Integer limit,
@ApiParam(name = "xm", value = "姓名")
@RequestParam(required = false) String xm,
@ApiParam(name = "sbimei", value = "设备IMEI")
@RequestParam(required = false) String sbimei,
@ApiParam(name = "online", value = "1在线 0离线")
@RequestParam(required = false) String online,
@ApiParam(name = "ismeWearFlag", value = "1是 0否")
@RequestParam(required = false) String ismeWearFlag,
@ApiParam(name = "wearFlag", value = "1佩戴 0未佩戴")
@RequestParam(required = false) String wearFlag,
HttpServletRequest httpServletRequest){
Map map = new HashMap();
map.put("page",page * limit);
map.put("limit",limit);
map.put("xm",xm);
map.put("sbimei",sbimei);
map.put("online",online);
map.put("wearFlag",wearFlag);
map.put("ismeWearFlag",ismeWearFlag);
DlUsers user=(DlUsers)httpServletRequest.getSession().getAttribute(CommonCodeConstant.LOGIN_USER_KEY);
if(null != user){// 市局 分局 派出所
String code = "";
if(user.getUnitCode().endsWith("00000000")){
code = user.getUnitCode().substring(0,4);
}else if(user.getUnitCode().endsWith("000000")){
code = user.getUnitCode().substring(0,6);
}else if(user.getUnitCode().endsWith("0000")){
code = user.getUnitCode().substring(0,8);
}else{
code = user.getUnitCode();
}
map.put("xxdjdwGajgjgdm",code);
}
List<UsersAndOnlineVo> list = usersService.userPageOnlineList(map);
Integer total = usersService.userPageOnlineListCount(map);
return MapRestResult.build(ResultCode.SUCCESS,"成功获取用户列表信息",total,list);
}
@ApiOperation(value = "用户血压列表")
@GetMapping("userDbpList/{page}/{limit}")
public MapRestResult userDbpList( @ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Integer page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Integer limit,
@ApiParam(name = "sbimei", value = "设备IMEI", required = true)
@RequestParam String sbimei){
Map map = new HashMap();
map.put("page",page * limit);
map.put("limit",limit);
map.put("sbimei",sbimei);
List<Map<String,Object>> list = usersService.userDbpList(map);
Integer total = usersService.userDbpListCount(map);
return MapRestResult.build(ResultCode.SUCCESS,"成功获取用户血压列表信息",total,list);
}
@ApiOperation(value = "用户心率列表")
@GetMapping("userHeartrateList/{page}/{limit}")
public MapRestResult userHeartrateList( @ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Integer page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Integer limit,
@ApiParam(name = "sbimei", value = "设备IMEI", required = true)
@RequestParam String sbimei){
Map map = new HashMap();
map.put("page",page * limit);
map.put("limit",limit);
map.put("sbimei",sbimei);
List<Map<String,Object>> list = usersService.userHeartrateList(map);
Integer total = usersService.userHeartrateListCount(map);
return MapRestResult.build(ResultCode.SUCCESS,"成功获取用户心率列表信息",total,list);
}
@ApiOperation(value = "用户步数列表")
@GetMapping("userStepList/{page}/{limit}")
public MapRestResult userStepList( @ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Integer page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Integer limit,
@ApiParam(name = "sbimei", value = "设备IMEI", required = true)
@RequestParam String sbimei){
Map map = new HashMap();
map.put("page",page * limit);
map.put("limit",limit);
map.put("sbimei",sbimei);
List<Map<String,Object>> list = usersService.userStepList(map);
Integer total = usersService.userStepListCount(map);
return MapRestResult.build(ResultCode.SUCCESS,"成功获取用户步数列表信息",total,list);
}
}
package com.founder.zdry.fegin;
import com.founder.commonutils.ZdryApiEntity.Device;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.zdry.fegin.fallback.FallBackZdryApi;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
/**
* Created by yyon 2021/05/31
* 调用zdryapi子系统
**/
@FeignClient(value = "zdryapi", fallback = FallBackZdryApi.class)
public interface ServerZdryApi {
@PostMapping("/zdryapi/getDevice")
Device getDevice(@RequestParam(value = "deviceId") String deviceId);
@PostMapping("/zdryapi/updateDevice")
String updateDevice(@RequestBody Device deviceParam);
@PostMapping("/zdryapi/deviceFenceTask")
MapRestResult deviceFenceTask(
@RequestParam(value = "sbImei") String sbImei,
@RequestParam(value = "name") String name,
@RequestParam(value = "time_begin") String time_begin,
@RequestParam(value = "time_end") String time_end,
@RequestParam(value = "safe_area") String safe_area,
@RequestParam(value = "gklx") int gklx,
@RequestParam(value = "xxdjdw_gajgjgdm") String xxdjdw_gajgjgdm,
@RequestParam(value = "xxdjdw_gajgjgmc") String xxdjdw_gajgjgmc
);
}
package com.founder.zdry.fegin.fallback;
import com.founder.commonutils.ZdryApiEntity.Device;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.zdry.fegin.ServerZdryApi;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
/**
* Created by yangyang on 2021/05/31
* 调用ZdryApi子系统异常反馈
**/
@Component
public class FallBackZdryApi implements ServerZdryApi {
@Override
public Device getDevice(@RequestParam(value = "deviceId") String deviceId) {
return null;
}
@Override
public String updateDevice(@RequestBody Device deviceParam) {
return "zdryapi服务器发生异常,断路器进行反馈";
}
@Override
public MapRestResult deviceFenceTask(String sbImei, String name, String time_begin, String time_end, String safe_area, int gklx, String xxdjdw_gajgjgdm,
String xxdjdw_gajgjgmc) {
return MapRestResult.build(201,"zdryapi服务器发生异常,断路器进行反馈","1","1");
}
}
\ No newline at end of file
package com.founder.zdry.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-05
*/
@Mapper
@Component
public interface FenceTaskMapper extends BaseMapper<FenceTask> {
List<UsersAndOnlineAndTasksVo> fenceTaskPeopleList(Map map);
Integer fenceTaskPeopleListCount(Map map);
}
package com.founder.zdry.mapper;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo;
import com.founder.commonutils.zdryEntity.Users;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-05-30
*/
@Mapper
@Component
public interface UsersMapper extends BaseMapper<Users> {
List<UsersAndOnlineVo> userPageOnlineList(Map map);
Integer userPageOnlineListCount(Map map);
List<Map<String,Object>> userDbpList(Map map);
Integer userDbpListCount(Map map);
List<Map<String,Object>> userHeartrateList(Map map);
Integer userHeartrateListCount(Map map);
List<Map<String,Object>> userStepList(Map map);
Integer userStepListCount(Map map);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdry.mapper.FenceTaskMapper">
<sql id="queryTlWhere">
<if test="xxdjdwGajgjgdm!= null and xxdjdwGajgjgdm!=''">
AND task.xxdjdw_gajgjgdm LIKE concat(#{xxdjdwGajgjgdm,jdbcType=VARCHAR}, '%')
</if>
<if test="xm!= null and xm!=''">
AND users.xm LIKE concat('%', #{xm,jdbcType=VARCHAR}, '%')
</if>
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei , jdbcType=INTEGER }
</if>
<if test="bs!= null and bs != ''">
AND users.bs LIKE concat('%', #{bs,jdbcType=VARCHAR}, '%')
</if>
<if test="sfzhm!= null and sfzhm != ''">
AND users.sfzhm LIKE concat('%', #{sfzhm,jdbcType=VARCHAR}, '%')
</if>
<if test="bq_dj!= null and bq_dj != ''">
AND users.bq_dj= #{ bq_dj , jdbcType=INTEGER }
</if>
<if test="online!= null and online != ''">
AND online.online= #{ online , jdbcType=INTEGER }
</if>
<if test="wearFlag!= null and wearFlag != ''">
AND online.wear_flag= #{ wearFlag , jdbcType=INTEGER }
</if>
</sql>
<select id="fenceTaskPeopleList" parameterType="java.util.Map" resultType="com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo">
select
users.xm as xm,
users.xb as xb,
users. jt_zz as jtZz,
users.sfy_qk as sfyQk,
users.xzz as xzz,
users.bs as bs,
users.bq_dj as bqDj,
users.jhr1_xm as jhr1Xm,
users.jhr1_gx as jhr1Gx,
users.jhr1_lxdh as jhr1Lxdh,
users.jhr1_jjdh as jhr1Jjdh,
users.jhr2_xm as jhr2Xm,
users. jhr2_gx as jhr2Gx,
users.jhr2_lxdh as jhr2Lxdh,
users. jhr2_jjdh as jhr2Jjdh,
users. sb_imei as sbImei,
users. sb_xh as sbXh,
users.sfzhm as sfzhm,
online.online as online,
online.Wear_flag as WearFlag,
online.location_updated_at as locationUpdatedAt,
online.last_location_x as lastLocationX,
online.last_location_y as lastLocationY,
online.last_address as lastAddress,
task.name as name,
task.time_begin as timeBegin,
task.time_end as timeEnd,
task.safe_area as safeArea,
task.task_type as taskType,
task.warn as warn,
task.gklx as gklx
from gk_users users,gk_online online,gk_fencetask task
where users.sb_imei = online.sb_imei
and users.sb_imei = task.sb_imei
and users.xxsc_pdbz = 0
<include refid="queryTlWhere"/>
limit #{ page },#{ limit}
</select>
<select id="fenceTaskPeopleListCount" parameterType="java.util.Map" resultType="java.lang.Integer">
select
count(*)
from gk_users users,gk_online online,gk_fencetask task
where users.sb_imei = online.sb_imei
and users.sb_imei = task.sb_imei
and users.xxsc_pdbz = 0
<include refid="queryTlWhere"/>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdry.mapper.UsersMapper">
<sql id="queryWhere">
<if test="xxdjdwGajgjgdm!= null and xxdjdwGajgjgdm!=''">
AND users.xxdjdw_gajgjgdm LIKE concat(#{xxdjdwGajgjgdm,jdbcType=VARCHAR}, '%')
</if>
<if test="xm!= null and xm!=''">
AND users.xm LIKE concat('%', #{xm,jdbcType=VARCHAR}, '%')
</if>
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei, jdbcType=INTEGER }
</if>
<if test="online!= null and online != ''">
AND online.online= #{ online, jdbcType=INTEGER }
</if>
<if test="wearFlag!= null and wearFlag != ''">
AND users.wear_flag= #{ wearFlag, jdbcType=INTEGER }
</if>
<if test="ismeWearFlag!= null and ismeWearFlag != ''">
AND users.isme_wear_flag= #{ ismeWearFlag, jdbcType=INTEGER }
</if>
</sql>
<select id="userPageOnlineList" parameterType="Map" resultType="com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo">
select
users.xm as xm,
users.xb as xb,
users. jt_zz as jtZz,
users.sfy_qk as sfyQk,
users.xzz as xzz,
users.bs as bs,
users.bq_dj as bqDj,
users.jhr1_xm as jhr1Xm,
users.jhr1_gx as jhr1Gx,
users.jhr1_lxdh as jhr1Lxdh,
users.jhr1_jjdh as jhr1Jjdh,
users.jhr2_xm as jhr2Xm,
users. jhr2_gx as jhr2Gx,
users.jhr2_lxdh as jhr2Lxdh,
users. jhr2_jjdh as jhr2Jjdh,
users. sb_imei as sbImei,
users. sb_xh as sbXh,
users.sfzhm as sfzhm,
online.online as online,
users.Wear_flag as WearFlag,
users.isme_wear_flag as ismeWearFlag,
online.location_updated_at as locationUpdatedAt,
online.last_location_x as lastLocationX,
online.last_location_y as lastLocationY,
online.last_address as lastAddress
from gk_users users,gk_online online
where users.sb_imei = online.sb_imei
and users.xxsc_pdbz = 0
<include refid="queryWhere"/>
limit #{ page },#{ limit}
</select>
<select id="userPageOnlineListCount" parameterType="java.util.Map" resultType="java.lang.Integer">
select
count(*)
from gk_users users,gk_online online
where users.sb_imei = online.sb_imei
and users.xxsc_pdbz = 0
<include refid="queryWhere"/>
</select>
<select id="userDbpList" parameterType="Map" resultType="Map">
select
users.xm as xm,
users.xb as xb,
users. sb_imei as sbImei,
users.sfzhm as sfzhm,
dbp.time_begin as timeBegin,
dbp.dbp as dbp,
dbp.dbp_l as dbpL,
dbp.sbp as sbp,
dbp.sbp_h as sbpH
from gk_users users,gk_dbp dbp
where users.sb_imei = dbp.sb_imei
and users.xxsc_pdbz = 0
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei, jdbcType=INTEGER }
</if>
order by dbp.time_begin desc
limit #{ page },#{ limit}
</select>
<select id="userDbpListCount" parameterType="java.util.Map" resultType="java.lang.Integer">
select
count(*)
from gk_users users,gk_dbp dbp
where users.sb_imei = dbp.sb_imei
and users.xxsc_pdbz = 0
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei, jdbcType=INTEGER }
</if>
</select>
<select id="userHeartrateList" parameterType="Map" resultType="Map">
select
users.xm as xm,
users.xb as xb,
users.sfzhm as sfzhm,
heart.time_begin as timeBegin,
heart.heartrate as heartrate,
heart.theshold_heartrate_h as thesholdHeartrateH,
heart.theshold_heartrate_l as thesholdHeartrateL
from gk_users users,gk_heartrate heart
where users.sb_imei = heart.sb_imei
and users.xxsc_pdbz = 0
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei, jdbcType=INTEGER }
</if>
order by heart.time_begin desc
limit #{ page },#{ limit}
</select>
<select id="userHeartrateListCount" parameterType="java.util.Map" resultType="java.lang.Integer">
select
count(*)
from gk_users users,gk_heartrate heart
where users.sb_imei = heart.sb_imei
and users.xxsc_pdbz = 0
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei, jdbcType=INTEGER }
</if>
</select>
<select id="userStepList" parameterType="Map" resultType="Map">
select
users.xm as xm,
users.xb as xb,
users.sfzhm as sfzhm,
step.value as value,
step.time_begin as timeBegin
from gk_users users,gk_stepNumber step
where users.sb_imei = step.sb_imei
and users.xxsc_pdbz = 0
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei, jdbcType=INTEGER }
</if>
order by step.time_begin desc
limit #{ page },#{ limit}
</select>
<select id="userStepListCount" parameterType="java.util.Map" resultType="java.lang.Integer">
select
count(*)
from gk_users users,gk_stepNumber step
where users.sb_imei = step.sb_imei
and users.xxsc_pdbz = 0
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei, jdbcType=INTEGER }
</if>
</select>
</mapper>
package com.founder.zdry.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务类
* </p>
*
* @author yangyang
* @since 2021-06-05
*/
public interface FenceTaskService extends IService<FenceTask> {
List<UsersAndOnlineAndTasksVo> fenceTaskPeopleList(Map map);
Integer fenceTaskPeopleListCount(Map map);
}
package com.founder.zdry.service;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo;
import com.founder.commonutils.zdryEntity.Users;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务类
* </p>
*
* @author yangyang
* @since 2021-05-30
*/
public interface UsersService extends IService<Users> {
List<UsersAndOnlineVo> userPageOnlineList(Map map);
Integer userPageOnlineListCount(Map map);
List<Map<String,Object>> userDbpList(Map map);
Integer userDbpListCount(Map map);
List<Map<String,Object>> userHeartrateList(Map map);
Integer userHeartrateListCount(Map map);
List<Map<String,Object>> userStepList(Map map);
Integer userStepListCount(Map map);
}
package com.founder.zdry.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import com.founder.zdry.mapper.FenceTaskMapper;
import com.founder.zdry.service.FenceTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务实现类
* </p>
*
* @author yangyang
* @since 2021-06-05
*/
@Service
public class FenceTaskServiceImpl extends ServiceImpl<FenceTaskMapper, FenceTask> implements FenceTaskService {
@Autowired
private FenceTaskMapper fenceTaskMapper;
@Override
public List<UsersAndOnlineAndTasksVo> fenceTaskPeopleList(Map map) {
return fenceTaskMapper.fenceTaskPeopleList(map);
}
@Override
public Integer fenceTaskPeopleListCount(Map map) {
return fenceTaskMapper.fenceTaskPeopleListCount(map);
}
}
package com.founder.zdry.service.impl;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo;
import com.founder.commonutils.zdryEntity.Users;
import com.founder.zdry.mapper.UsersMapper;
import com.founder.zdry.service.UsersService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务实现类
* </p>
*
* @author yangyang
* @since 2021-05-30
*/
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements UsersService {
@Autowired
private UsersMapper usersMapper;
@Override
public List<UsersAndOnlineVo> userPageOnlineList(Map map) {
return usersMapper.userPageOnlineList(map);
}
@Override
public Integer userPageOnlineListCount(Map map) {
return usersMapper.userPageOnlineListCount(map);
}
@Override
public List<Map<String, Object>> userDbpList(Map map) {
return usersMapper.userDbpList(map);
}
@Override
public Integer userDbpListCount(Map map) {
return usersMapper.userDbpListCount(map);
}
@Override
public List<Map<String, Object>> userHeartrateList(Map map) {
return usersMapper.userHeartrateList(map);
}
@Override
public Integer userHeartrateListCount(Map map) {
return usersMapper.userHeartrateListCount(map);
}
@Override
public List<Map<String, Object>> userStepList(Map map) {
return usersMapper.userStepList(map);
}
@Override
public Integer userStepListCount(Map map) {
return usersMapper.userStepListCount(map);
}
}
......@@ -10,7 +10,6 @@
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
<module>zdryapi</module>
</modules>
<artifactId>serviceapi</artifactId>
<dependencies>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>serviceapi</artifactId>
<groupId>com.founder</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>zdryapi</artifactId>
<build>
<finalName>zdryapi</finalName>
</build>
</project>
\ No newline at end of file
package com.founder.zdryapi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
@ComponentScan(basePackages = {"com.founder"})
@EnableDiscoveryClient
@EnableScheduling
public class ZdryApiApplication {
@Autowired
private RestTemplateBuilder restTemplateBuilder;
public static void main(String[] args) {
SpringApplication.run(ZdryApiApplication.class, args);
}
@Bean
public RestTemplate restTemplate(){return restTemplateBuilder.build();}
}
package com.founder.zdryapi.controller;
import com.founder.commonutils.ZdryApiEntity.Device;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.zdryapi.service.ZdryApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
/**
* <p>
* 第三方爱牵挂接口管理 前端控制器
* </p>
*
* @author yangyang
* @since 2021-05-31
*/
@Api(description = "第三方接口管理-爱牵挂")
@RestController
@RequestMapping("/zdryapi")
@Component
public class ZdryApiController {
@Autowired
private ZdryApiService zdryApiService;
//获取token
@ApiOperation(value = "token获取")
@PostMapping("/token")
public MapRestResult getToken() {
String accessToken = zdryApiService.getToken();
return MapRestResult.build(202,"成功获取token信息",accessToken);
}
@ApiOperation(value = "查看指定设备接口")
@PostMapping(value = "/getDevice")
public Device getDevice(@ApiParam(name = "deviceId", value = "设备IMEI", required = true)
@RequestParam(value = "deviceId") String deviceId) {
long startTime=new Date().getTime();
Device result=zdryApiService.getDevice(deviceId);
long endTime=new Date().getTime();
long timeDiffer=endTime-startTime;
System.out.println("查看指定设备接口**请求时长**********"+timeDiffer+"毫秒");
return result;
}
@ApiOperation(value = "修改指定设备接口")
@PostMapping(value = "/updateDevice")
public String updateDevice(@RequestBody Device deviceParam) {
return zdryApiService.updateDevice(deviceParam);
}
@ApiOperation(value = "查看设备定位数据")
@PostMapping(value = "/locationdata")
public MapRestResult locationdata(@ApiParam(name = "deviceId", value = "设备IMEI", required = true)
@RequestParam(value = "deviceId") String deviceId,
@ApiParam(name = "time_begin", value = "YYYYMMDD,查询指定日期的数据")
@RequestParam(required = false) String time_begin
) {
return zdryApiService.locationdata(deviceId,time_begin);
}
@ApiOperation(value = "批量获取设备离线在线状态数据")
@GetMapping(value = "/onlineAndWeardata")
//每隔5秒执行一次:*/5 * * * * ?
//每隔5分执行一次:0 */5 * * * ?
//每个整点执行一次:0 0 0/1 * * ?
//每天凌晨2点执行一次:0 0 2 * * ?
@Scheduled(cron = "0 0 0/1 * * ?")
public MapRestResult onlineAndWeardata() {
return zdryApiService.onlineAndWeardata();
}
@ApiOperation(value = "设置电子围栏")
@PostMapping(value = "/deviceFenceTask")
public MapRestResult deviceFenceTask(@ApiParam(name = "sbImei", value = "设备IMEI", required = true)
@RequestParam(value = "sbImei") String sbImei,
@ApiParam(name = "name", value = "电子围栏名称", required = true)
@RequestParam(value = "name") String name,
@ApiParam(name = "time_begin", value = "开始时间例早上八点:08:00", required = true)
@RequestParam(value = "time_begin") String time_begin,
@ApiParam(name = "time_end", value = "结束时间例下午六点:18:00", required = true)
@RequestParam(value = "time_end") String time_end,
@ApiParam(name = "safe_area", value = "A;B;C;D;A", required = true)
@RequestParam(value = "safe_area") String safe_area,
@ApiParam(name = "gklx", value = "1进入区域 2离开区域 3异常预警", required = true)
@RequestParam(value = "gklx") int gklx,
@ApiParam(name = "xxdjdw_gajgjgdm", value = "信息登记单位公安机关机构代码", required = true)
@RequestParam(value = "xxdjdw_gajgjgdm") String xxdjdw_gajgjgdm,
@ApiParam(name = "xxdjdw_gajgjgmc", value = "信息登记单位公安机关名称", required = true)
@RequestParam(value = "xxdjdw_gajgjgmc") String xxdjdw_gajgjgmc
) {
return zdryApiService.deviceFenceTask(sbImei,name,time_begin,time_end,safe_area,gklx,xxdjdw_gajgjgdm,xxdjdw_gajgjgmc);
}
@ApiOperation(value = "电子围栏预警")
@GetMapping(value = "/FenceWarning")
//每隔5秒执行一次:*/5 * * * * ?
//每隔5分执行一次:0 */5 * * * ?
//每个整点执行一次:0 0 0/1 * * ?
//每天凌晨2点执行一次:0 0 2 * * ?
@Scheduled(cron = "0 */10 * * * ?")
public MapRestResult FenceWarning()
{
return zdryApiService.FenceWarning();
}
@ApiOperation(value = "是否佩戴是否本人佩戴定时")
@GetMapping(value = "/wearFlag")
//每隔5秒执行一次:*/5 * * * * ?
//每隔5分执行一次:0 */5 * * * ?
//每个整点执行一次:0 0 0/1 * * ?
//每天凌晨2点执行一次:0 0 2 * * ?
@Scheduled(cron = "0 */10 * * * ?")
public MapRestResult wearFlag()
{
return zdryApiService.wearFlag();
}
@ApiOperation(value = "批量获取设备最新位置")
@PostMapping("/newLocationdataList")
public MapRestResult newLocationdataList(@RequestBody String[] imeis) {
return zdryApiService.newLocationdataList(imeis);
}
}
package com.founder.zdryapi.controller;
import com.founder.zdryapi.service.ZdryPushDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 第三方爱牵挂接口管理 前端控制器
* </p>
*
* @author yangyang
* @since 2021-05-31
*/
@Api(description = "第三方接口管理-爱牵挂数据推送接口调用")
@RestController
@RequestMapping("/aqgPushData")
@Component
public class ZdryPushDataController {
@Autowired
private ZdryPushDataService zdryPushDataService;
@ApiOperation(value = "消息通知推送接口")
@GetMapping(value = "/message")
public void message(@ApiParam(name = "type", value = "type=1 SOS,type=2 fall,type=3 new 新成员加入 ,type=4 电子围栏触发, type=5 设备低电,type=6 环境音", required = true)
@RequestParam(value = "type") Integer type,
@ApiParam(name = "deviceid", value = "设备Imei", required = true)
@RequestParam(value = "deviceid") String deviceid,
@ApiParam(name = "communityid", value = "机构ID", required = true)
@RequestParam(value = "communityid") String communityid,
@ApiParam(name = "url", value = " url")
@RequestParam(value = "url", required = false) String url,
@ApiParam(name = "name", value = "设备名称", required = true)
@RequestParam(value = "name") String name
) {
zdryPushDataService.message(type,deviceid,communityid,url,name);
}
@ApiOperation(value = "位置数据发送接口")
@PostMapping(value = "/locationMessage")
public void locationMessage(@ApiParam(name = "imei", value = "设备IMEI", required = true)
@RequestParam(value = "imei") String imei,
@ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS", required = true)
@RequestParam(value = "time_begin") String time_begin,
@ApiParam(name = "is_reply", value = "是否为响应", required = true)
@RequestParam(value = "is_reply") boolean is_reply,
@ApiParam(name = "is_track", value = "是否轨迹", required = true)
@RequestParam(value = "is_track") boolean is_track,
@ApiParam(name = "city", value = "城市", required = true)
@RequestParam(value = "city") String city,
@ApiParam(name = "address", value = "地址", required = true)
@RequestParam(value = "address") String address,
@ApiParam(name = "lon", value = "经度", required = true)
@RequestParam(value = "lon") double lon,
@ApiParam(name = "lat", value = "经度", required = true)
@RequestParam(value = "lat") double lat,
@ApiParam(name = "type", value = "类型 0:Gps定位; 1:基站定位(移动/联通版定位) 2:电信基站版定位", required = true)
@RequestParam(value = "type") int type
) {
zdryPushDataService.locationMessage(imei,time_begin,is_reply,is_track,city,address,lon,lat,type);
}
@ApiOperation(value = "心率数据发送接口")
@PostMapping(value = "/heartrateMessage")
public void heartrateMessage(@ApiParam(name = "imei", value = "设备IMEI", required = true)
@RequestParam(value = "imei") String imei,
@ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS", required = true)
@RequestParam(value = "time_begin") String time_begin,
@ApiParam(name = "heartrate", value = "心率", required = true)
@RequestParam(value = "heartrate") int heartrate,
@ApiParam(name = "theshold_heartrate_h", value = "心率阈值上限")
@RequestParam(required = false) int theshold_heartrate_h,
@ApiParam(name = "theshold_heartrate_l", value = "心率阈值下限")
@RequestParam(required = false) int theshold_heartrate_l
) {
zdryPushDataService.heartrateMessage(imei,time_begin,heartrate,theshold_heartrate_h,theshold_heartrate_l);
}
@ApiOperation(value = "血压数据发送接口")
@PostMapping(value = "/dbpMessage")
public void dbpMessage(@ApiParam(name = "imei", value = "设备IMEI", required = true)
@RequestParam(value = "imei") String imei,
@ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS", required = true)
@RequestParam(value = "time_begin") String time_begin,
@ApiParam(name = "dbp", value = "舒张压", required = true)
@RequestParam(value = "dbp") int dbp,
@ApiParam(name = "dbp_l", value = "舒张压报警下限", required = true)
@RequestParam(value = "dbp_l") int dbp_l,
@ApiParam(name = "sbp", value = "收缩压", required = true)
@RequestParam(value = "sbp") int sbp,
@ApiParam(name = "sbp_h", value = "收缩压报警上限", required = true)
@RequestParam(value = "sbp_h") int sbp_h
) {
zdryPushDataService.dbpMessage(imei,time_begin,dbp,dbp_l,sbp,sbp_h);
}
@ApiOperation(value = "血氧数据发送接口")
@PostMapping(value = "/bloodMessage")
public void bloodMessage(@ApiParam(name = "imei", value = "设备IMEI", required = true)
@RequestParam(value = "imei") String imei,
@ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS", required = true)
@RequestParam(value = "time_begin") String time_begin,
@ApiParam(name = "bloodoxygen", value = "血氧百分比", required = true)
@RequestParam(value = "bloodoxygen") int bloodoxygen,
@ApiParam(name = "bloodoxygen_h", value = "血氧报警上限")
@RequestParam(required = false) int bloodoxygen_h,
@ApiParam(name = "bloodoxygen_l", value = "血氧报警下限")
@RequestParam(required = false) int bloodoxygen_l
) {
zdryPushDataService.bloodMessage(imei,time_begin,bloodoxygen,bloodoxygen_h,bloodoxygen_l);
}
@ApiOperation(value = "计步数据发送接口")
@PostMapping(value = "/stepMessage")
public void stepMessage(@ApiParam(name = "imei", value = "设备IMEI", required = true)
@RequestParam(value = "imei") String imei,
@ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS", required = true)
@RequestParam(value = "time_begin") String time_begin,
@ApiParam(name = "value", value = "步数", required = true)
@RequestParam(value = "value") int value){
zdryPushDataService.stepMessage(imei,time_begin,value);
}
}
package com.founder.zdryapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo;
import com.founder.commonutils.zdryEntity.Users;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-14
*/
@Mapper
@Component
public interface UsersMapper extends BaseMapper<Users> {
}
package com.founder.zdryapi.mapper;
import com.founder.commonutils.ZdryApiEntity.OnlineAndWear;
import com.founder.commonutils.zdryEntity.Users;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-02
*/
@Mapper
@Component
public interface ZdryApiMapper extends BaseMapper<OnlineAndWear> {
}
package com.founder.zdryapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryApiEntity.BloodMessage;
import com.founder.commonutils.ZdryApiEntity.StepMessage;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-16
*/
@Mapper
@Component
public interface ZdryBloodMessageMapper extends BaseMapper<BloodMessage> {
}
package com.founder.zdryapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryApiEntity.DbpMessage;
import com.founder.commonutils.ZdryApiEntity.HeartrateMessage;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-13
*/
@Mapper
@Component
public interface ZdryDbpMessageMapper extends BaseMapper<DbpMessage> {
}
package com.founder.zdryapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-04
*/
@Mapper
@Component
public interface ZdryFenceTaskMapper extends BaseMapper<FenceTask> {
}
package com.founder.zdryapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryApiEntity.HeartrateMessage;
import com.founder.commonutils.ZdryApiEntity.LocationMessage;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-13
*/
@Mapper
@Component
public interface ZdryHeartrateMessageMapper extends BaseMapper<HeartrateMessage> {
}
package com.founder.zdryapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryApiEntity.LocationMessage;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-04
*/
@Mapper
@Component
public interface ZdryLocationMessageMapper extends BaseMapper<LocationMessage> {
}
package com.founder.zdryapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import com.founder.commonutils.ZdryApiEntity.Message;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-04
*/
@Mapper
@Component
public interface ZdryMessageMapper extends BaseMapper<Message> {
}
package com.founder.zdryapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryApiEntity.BloodMessage;
import com.founder.commonutils.ZdryApiEntity.StepMessage;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-06-16
*/
@Mapper
@Component
public interface ZdryStepMessageMapper extends BaseMapper<StepMessage> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.UsersMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.ZdryApiMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.ZdryBloodMessageMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.ZdryDbpMessageMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.ZdryFenceTaskMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.ZdryHeartrateMessageMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.ZdryLocationMessageMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.ZdryMessageMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdryapi.mapper.ZdryStepMessageMapper">
</mapper>
package com.founder.zdryapi.service;
import com.founder.commonutils.ZdryApiEntity.Device;
import com.founder.commonutils.publicEntity.MapRestResult;
import javax.servlet.http.HttpServletRequest;
/**
* <p>
* 接口 服务类
* </p>
*
* @author yangyang
* @since 2021-05-31
*/
public interface ZdryApiService {
String getToken();
Device getDevice(String deviceId);
String updateDevice(Device deviceParam);
MapRestResult locationdata(String deviceId,String time_begin);
MapRestResult onlineAndWeardata();
MapRestResult deviceFenceTask(String sbImei,String name,String time_begin, String time_end, String safe_area,int gklx, String xxdjdw_gajgjgdm,String xxdjdw_gajgjgmc);
MapRestResult FenceWarning();
MapRestResult wearFlag();
MapRestResult newLocationdataList(String[] imeis);
}
package com.founder.zdryapi.service;
import java.util.Date;
/**
* <p>
* 接口 服务类
* </p>
*
* @author yangyang
* @since 2021-06-04
*/
public interface ZdryPushDataService {
void message(int type,String deviceid, String communityid, String url, String name);
void locationMessage(String imei, String time_begin,boolean is_reply,boolean is_track,String city,String address,double lon,double lat,int type);
void heartrateMessage(String imei, String time_begin, int heartrate, int theshold_heartrate_h, int theshold_heartrate_l);
void dbpMessage(String imei, String time_begin,int dbp,int dbp_l, int sbp,int sbp_h);
void bloodMessage(String imei,String time_begin,int bloodoxygen, int bloodoxygen_h,int bloodoxygen_l);
void stepMessage(String imei, String time_begin, int value);
}
package com.founder.zdryapi.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.founder.commonutils.ZdryApiEntity.*;
import com.founder.commonutils.constant.CommonCodeConstant;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.publicEntity.ResultCode;
import com.founder.commonutils.zdryEntity.DlUsers;
import com.founder.commonutils.zdryEntity.Users;
import com.founder.zdryapi.mapper.*;
import com.founder.zdryapi.service.ZdryApiService;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
/*
*
* <p>
* 爱牵挂接口 服务实现类
* </p>
*
* @author yangyang
* @since 2021-05-31
*/
@Service
public class ZdryApiServiceImpl implements ZdryApiService {
@Value("${zdryUrl}")
private String zdryUrl;
@Value("${loginUrl}")
private String loginUrl;
@Value("${sbxxUrl}")
private String sbxxUrl;
@Value("${updateSbxxUrl}")
private String updateSbxxUrl;
@Value("${locationUrl}")
private String locationUrl;
@Value("${communityUrl}")
private String communityUrl;
@Autowired
private RestTemplate restTemplate;
@Autowired
private ZdryApiMapper zdryApiMapper;
@Autowired
private ZdryFenceTaskMapper zdryFenceTaskMapper;
@Autowired
private ZdryMessageMapper zdryMessageMapper;
@Autowired
private ZdryLocationMessageMapper zdryLocationMessageMapper;
@Autowired
private UsersMapper usersMapper;
@Autowired
private ZdryDbpMessageMapper zdryDbpMessageMapper;
@Autowired
private ZdryHeartrateMessageMapper zdryHeartrateMessageMapper;
public Device getDevice(String deviceId){
Device device = new Device();
try {
String resultString = restTemplate.getForEntity(zdryUrl+sbxxUrl+deviceId,String.class).getBody();
if (StringUtils.isNotEmpty(resultString)) {
JSONObject result = JSONObject.parseObject(resultString);
// 查看是否登录{"error_desc": "\u60a8\u7684\u767b\u5f55\u72b6\u6001\u5df2\u7ecf\u5931\u6548\uff0c\u8bf7\u91cd\u65b0\u767b\u9646", "error_code": 101, "error_url": "/api/device/868221001088478", "success": false}
if (result.getString("success").equals("false")) {
if(getToken().equals("success")){
resultString = restTemplate.getForEntity(zdryUrl+sbxxUrl+deviceId,String.class).getBody();
JSONObject result1 = JSONObject.parseObject(resultString);
if (result1.getString("success").equals("true")) {
JSONObject dataObject = result1.getJSONObject("obj");
String pedometer_enable = dataObject.getString("pedometer_enable");
String sleep_enable = dataObject.getString("sleep_enable");
String track_enable = dataObject.getString("track_enable");
String heartrate_enable = dataObject.getString("heartrate_enable");
if(pedometer_enable.equals("true")){
device.setPedometer_enable(1);
}else{
device.setPedometer_enable(0);
}
if(sleep_enable.equals("true")){
device.setSleep_enable(1);
}else{
device.setSleep_enable(0);
}
if(track_enable.equals("true")){
device.setTrack_enable(1);
}else{
device.setTrack_enable(0);
}
if(heartrate_enable.equals("true")){
device.setHeartrate_enable(1);
}else{
device.setHeartrate_enable(0);
}
device.setSbImei(deviceId);
}
}else{
return device;
};
}else{
if (result.getString("success").equals("true")) {
JSONObject dataObject = result.getJSONObject("obj");
String pedometer_enable = dataObject.getString("pedometer_enable");
String sleep_enable = dataObject.getString("sleep_enable");
String track_enable = dataObject.getString("track_enable");
String heartrate_enable = dataObject.getString("heartrate_enable");
if(pedometer_enable.equals("true")){
device.setPedometer_enable(1);
}else{
device.setPedometer_enable(0);
}
if(sleep_enable.equals("true")){
device.setSleep_enable(1);
}else{
device.setSleep_enable(0);
}
if(track_enable.equals("true")){
device.setTrack_enable(1);
}else{
device.setTrack_enable(0);
}
if(heartrate_enable.equals("true")){
device.setHeartrate_enable(1);
}else{
device.setHeartrate_enable(0);
}
device.setSbImei(deviceId);
}
}
}
}catch (Exception e){
e.printStackTrace();
}
return device;
}
public String updateDevice(Device deviceParam){
try {
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json");
// 设置请求的格式类型
headers.setContentType(type);
JSONObject json = new JSONObject();
json.put("heartrate_enable",deviceParam.getHeartrate_enable());
json.put("pedometer_enable",deviceParam.getPedometer_enable());
json.put("sleep_enable",deviceParam.getSleep_enable());
json.put("track_enable",deviceParam.getTrack_enable());
json.put("frequency_heartrate","15");// 心率、血压、血氧上报频率 单位分钟
HttpEntity<JSONObject> params = new HttpEntity<>(json, headers);
String resultString = restTemplate.postForEntity(zdryUrl+updateSbxxUrl+deviceParam.getSbImei()+"/4g/edit/", params, String.class).getBody();
JSONObject result = JSONObject.parseObject(resultString);
// 查看是否登录
if (result.getString("success").equals("false")) {
if(getToken().equals("success")){
String resultStringAll = restTemplate.postForEntity(zdryUrl+updateSbxxUrl+deviceParam.getSbImei()+"/4g/edit/", params, String.class).getBody();
JSONObject resultAll = JSONObject.parseObject(resultStringAll);
if (resultAll.getString("success").equals("false")) {
return "无效设备!";
}else if(resultAll.getString("success").equals("true")){
return "success";
}
}else{
return "登录错误!";
};
}else{
if (result.getString("success").equals("false")) {
return "无效设备!";
}else if(result.getString("success").equals("true")){
return "success";
}
}
}catch (Exception e){
e.printStackTrace();
}
return "success";
}
@Override
public MapRestResult locationdata(String deviceId, String time_begin) {
List<LocationData> listResult = new ArrayList<>();
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String url = "";
if(StringUtils.isNotEmpty(time_begin)){
url = zdryUrl+locationUrl+"?device="+deviceId+"&time_begin="+time_begin;
}else{
url = zdryUrl+locationUrl+"?device="+deviceId;
}
try {
String resultString = restTemplate.getForEntity(url,String.class).getBody();
if (StringUtils.isNotEmpty(resultString)) {
JSONObject result = JSONObject.parseObject(resultString);
// 查看是否登录
if (result.getString("success").equals("false")) {
if(getToken().equals("success")){
resultString = restTemplate.getForEntity(url,String.class).getBody();
}else{
return MapRestResult.build(200,"获取轨迹信息失败","1");
};
}
JSONObject resultLast = JSONObject.parseObject(resultString);
if (resultLast.containsKey("objs")) {
JSONArray jsonArray = resultLast.getJSONArray("objs");
for(int i = 0;i<jsonArray.size();i++){
JSONObject obj = jsonArray.getJSONObject(i);
LocationData locationData = new LocationData();
String device = obj.getString("device");
JSONObject time = obj.getJSONObject("created_at");
JSONObject time1 = obj.getJSONObject("time_begin");
String created_at = time.getString("$date");
String time_begins = time1.getString("$date");
String type = obj.getString("type");
String city = obj.getString("city");
String address = obj.getString("address");
JSONObject point = obj.getJSONObject("point");
JSONArray jsonArrayPoint = point.getJSONArray("coordinates");
String x = jsonArrayPoint.get(0).toString();
String y = jsonArrayPoint.get(1).toString();
locationData.setDevice(device);
locationData.setCreated_at(sf.format(new Date(Long.parseLong(created_at) - TimeZone.getDefault().getRawOffset())));
locationData.setTime_begin(sf.format(new Date(Long.parseLong(time_begins)- TimeZone.getDefault().getRawOffset())));
if(type.equals("1")){
locationData.setType("基站定位");
}else{
locationData.setType("Gps定位");
}
locationData.setCity(city);
locationData.setAddress(address);
locationData.setX(x);
locationData.setY(y);
listResult.add(locationData);
}
return MapRestResult.build(200,"获取轨迹信息成功",listResult,listResult.size());
}
}
}catch (Exception e){
e.printStackTrace();
}
return MapRestResult.build(200,"获取轨迹信息成功",listResult,listResult.size());
}
@Override
public MapRestResult onlineAndWeardata() {
List<OnlineAndWear> OnlineAndWearList=new ArrayList<>();
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 循环请求
Boolean flag=true;
int page=1;
int pageSize=5000;
int currentPageTotal=0;//当前页返回的结果总数
try {
while (flag) {
String url = zdryUrl+communityUrl+"?rows_per_page="+pageSize+"&page="+page;
String resultString = restTemplate.getForEntity(url,String.class).getBody();
if (StringUtils.isNotEmpty(resultString)) {
JSONObject result = JSONObject.parseObject(resultString);
// 查看是否登录
if (result.containsKey("error_code")) {
if(getToken().equals("success")){
resultString = restTemplate.getForEntity(url,String.class).getBody();
}else{
return MapRestResult.build(201,"登陆失败",1);
};
}
JSONObject resultLast = JSONObject.parseObject(StringEscapeUtils.unescapeJava(resultString));
if (resultLast.getString("success").equals("true")) {
JSONArray jsonArray = resultLast.getJSONArray("objs");//当前页返回的结果总数
if(null!=jsonArray&&jsonArray.size()>0) {
currentPageTotal = jsonArray.size();
for (Object obj : jsonArray) {
OnlineAndWear onlineAndWear = new OnlineAndWear();
JSONObject jsonObject = (JSONObject) obj;
String id = jsonObject.getString("_id");
String name = jsonObject.getString("name");
JSONObject time = jsonObject.getJSONObject("location_updated_at");
String locationUpdatedAt = time.getString("$date");
String lastAddress = jsonObject.getString("last_address");
String onlines = jsonObject.getString("online");
String wearFlags = jsonObject.getString("wear_flag");
JSONObject point = jsonObject.getJSONObject("last_location");
JSONArray jsonArrayPoint = point.getJSONArray("coordinates");
String x = jsonArrayPoint.get(0).toString();
String y = jsonArrayPoint.get(1).toString();
onlineAndWear.setSbImei(id);
onlineAndWear.setLocationUpdatedAt(sf.format(new Date(Long.parseLong(locationUpdatedAt))));
onlineAndWear.setWearFlag(wearFlags);
if(onlines.equals("true")){
onlineAndWear.setOnline("1");
}else{
onlineAndWear.setOnline("0");
}
onlineAndWear.setLastAddress(lastAddress);
onlineAndWear.setLastLocationX(x);
onlineAndWear.setLastLocationY(y);
onlineAndWear.setXm(name);
OnlineAndWearList.add(onlineAndWear);
}
if(OnlineAndWearList.size()>0){
OnlineAndWearList.stream().forEach(p->{
// 先查看是否存在 不存在插入 存在更新
QueryWrapper<OnlineAndWear> wrapper = new QueryWrapper<>();
wrapper.eq("sb_imei",p.getSbImei());
// 查询
OnlineAndWear onlineAndWear = zdryApiMapper.selectOne(wrapper);
if(null != onlineAndWear){
onlineAndWear.setSbImei(p.getSbImei());
onlineAndWear.setXm(p.getXm());
onlineAndWear.setLastLocationX(p.getLastLocationX());
onlineAndWear.setLastLocationY(p.getLastLocationY());
onlineAndWear.setWearFlag(p.getWearFlag());
onlineAndWear.setOnline(p.getOnline());
onlineAndWear.setLocationUpdatedAt(p.getLocationUpdatedAt());
onlineAndWear.setLastAddress(p.getLastAddress());
// 执行更新
zdryApiMapper.updateById(onlineAndWear);
}else{
// 插入数据
zdryApiMapper.insert(p);
}
});
}
}
}
}
if (currentPageTotal < pageSize || currentPageTotal > pageSize) {//每页的总数大于当前页返回的总数,退出循环,d当期页的总数大于分页数,说明其接口无分页
flag = false;
} else if (currentPageTotal == pageSize) {//当前页等于总页数,则循环请求
++page;
}
}
}catch (Exception e){
e.printStackTrace();
}
return MapRestResult.build(200,"批量获取设备离线在线状态数据",OnlineAndWearList.size());
}
@Override
public MapRestResult deviceFenceTask(String sbImei,String name, String time_begin, String time_end, String safe_area,int gklx, String xxdjdw_gajgjgdm,String xxdjdw_gajgjgmc) {
SimpleDateFormat sf = new SimpleDateFormat("HH");
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/x-www-form-urlencoded");
// 设置请求的格式类型
headers.setContentType(type);
MultiValueMap<String, Object> form = new LinkedMultiValueMap<>();
form.add("name",name);
try {
form.add("time_begin",Integer.valueOf(sf.format(sf.parse(time_begin))) * 60 *60);
form.add("time_end",Integer.valueOf(sf.format(sf.parse(time_end))) * 60 *60);
} catch (ParseException e) {
e.printStackTrace();
return MapRestResult.build(ResultCode.ERROR, "时间转换异常!", e.getMessage());
}
form.add("safe_area",safe_area);
form.add("enable","1");
form.add("freq","1");// 0,触发一天;1,每日触发
HttpEntity<MultiValueMap<String, Object>> params = new HttpEntity<>(form, headers);
String resultString = restTemplate.postForEntity(zdryUrl + "/api/device/"+sbImei+"/4g/fences/1/", params, String.class).getBody();
JSONObject result = JSONObject.parseObject(resultString);
if (result.getString("success").equals("true")) {
// 先查看是否存在 不存在插入 存在更新
QueryWrapper<FenceTask> wrapper = new QueryWrapper<>();
wrapper.eq("sb_imei",sbImei);
// 查询
FenceTask fenceTask = zdryFenceTaskMapper.selectOne(wrapper);
if(null != fenceTask){
fenceTask.setName(name);
fenceTask.setTimeBegin(time_begin);
fenceTask.setTimeEnd(time_end);
fenceTask.setSafeArea(safe_area);
fenceTask.setSbImei(sbImei);
fenceTask.setTaskType("dzwl");
fenceTask.setGklx(gklx);
fenceTask.setXxdjdwGajgjgdm(xxdjdw_gajgjgdm);
fenceTask.setXxdjdwGajgjgmc(xxdjdw_gajgjgmc);
// 执行更新
zdryFenceTaskMapper.updateById(fenceTask);
}else{
FenceTask fenceTasks = new FenceTask();
fenceTasks.setName(name);
fenceTasks.setTimeBegin(time_begin);
fenceTasks.setTimeEnd(time_end);
fenceTasks.setSafeArea(safe_area);
fenceTasks.setSbImei(sbImei);
fenceTasks.setTaskType("dzwl");
fenceTasks.setGklx(gklx);
fenceTasks.setXxdjdwGajgjgdm(xxdjdw_gajgjgdm);
fenceTasks.setXxdjdwGajgjgmc(xxdjdw_gajgjgmc);
// 插入数据
int flag = zdryFenceTaskMapper.insert(fenceTasks);
if(flag > 0) {
return MapRestResult.build(ResultCode.SUCCESS, "设置电子围栏成功", "1");
}else{
return MapRestResult.build(ResultCode.ERROR, "设置电子围栏失败", "插入数据失败");
}
}
}else {
if(getToken().equals("success")) {
resultString = restTemplate.postForEntity(zdryUrl + "/api/device/" + sbImei + "/4g/fences/1/", params, String.class).getBody();
// 先查看是否存在 不存在插入 存在更新
QueryWrapper<FenceTask> wrapper = new QueryWrapper<>();
wrapper.eq("sb_imei", sbImei);
// 查询
FenceTask fenceTask = zdryFenceTaskMapper.selectOne(wrapper);
if (null != fenceTask) {
fenceTask.setName(name);
fenceTask.setTimeBegin(time_begin);
fenceTask.setTimeEnd(time_end);
fenceTask.setSafeArea(safe_area);
fenceTask.setSbImei(sbImei);
fenceTask.setTaskType("dzwl");
fenceTask.setGklx(gklx);
fenceTask.setXxdjdwGajgjgdm(xxdjdw_gajgjgdm);
fenceTask.setXxdjdwGajgjgmc(xxdjdw_gajgjgmc);
// 执行更新
zdryFenceTaskMapper.updateById(fenceTask);
} else {
FenceTask fenceTasks = new FenceTask();
fenceTasks.setName(name);
fenceTasks.setTimeBegin(time_begin);
fenceTasks.setTimeEnd(time_end);
fenceTasks.setSafeArea(safe_area);
fenceTasks.setSbImei(sbImei);
fenceTasks.setTaskType("dzwl");
fenceTasks.setGklx(gklx);
fenceTasks.setXxdjdwGajgjgdm(xxdjdw_gajgjgdm);
fenceTasks.setXxdjdwGajgjgmc(xxdjdw_gajgjgmc);
// 插入数据
int flag = zdryFenceTaskMapper.insert(fenceTasks);
if (flag > 0) {
return MapRestResult.build(ResultCode.SUCCESS, "设置电子围栏成功", "1");
} else {
return MapRestResult.build(ResultCode.ERROR, "设置电子围栏失败", "插入数据失败");
}
}
}else{
return MapRestResult.build(ResultCode.ERROR, "登录失败", "登录失败");
}
}
return MapRestResult.build(ResultCode.SUCCESS, "设置电子围栏成功", "1");
}
@Override
public MapRestResult FenceWarning() {
QueryWrapper<FenceTask> wrapperTask = new QueryWrapper<>();
wrapperTask.eq("xxsc_pdbz","0");
// 先查询出所有围栏任务中设备编号
List<FenceTask> listImei = zdryFenceTaskMapper.selectList(wrapperTask);
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
LocalDateTime thirtyLater = now.minusMinutes(30);
System.out.println("30分钟前的时间:"+thirtyLater);
// gk_message修改时间大于 当前时间减去30分钟认为出圈 围栏触发才推送数据 不触发不推送频率30分钟
List<Map<String,Object>> listResult = new ArrayList<>();
if(listImei.size()>0){
for(FenceTask data:listImei){
QueryWrapper<Message> wrapper = new QueryWrapper<>();
wrapper.ge("gxsj",thirtyLater);
wrapper.eq("sb_imei",data.getSbImei());
Message message = zdryMessageMapper.selectOne(wrapper);
if(null != message){
Map<String,Object> map = new HashMap<>();
// 查询对应任务
QueryWrapper<FenceTask> wrapper1 = new QueryWrapper<>();
wrapper1.eq("sb_imei",data.getSbImei());
FenceTask fenceTask = zdryFenceTaskMapper.selectOne(wrapper1);
map.put("任务名称",fenceTask.getName());
map.put("设备编号",data.getSbImei());
map.put("任务类型",fenceTask.getTaskType());
map.put("时间段",fenceTask.getTimeBegin()+"-"+fenceTask.getTimeEnd());
// 同时更新fencetasks 围栏任务表 warn预警 1预警 0未预警
fenceTask.setWarn(1);
zdryFenceTaskMapper.updateById(fenceTask);
// 查询最新位置
QueryWrapper<LocationMessage> wrapper2 = new QueryWrapper<>();
wrapper2.eq("sb_imei",data.getSbImei());
LocationMessage locationMessage = zdryLocationMessageMapper.selectOne(wrapper2);
map.put("最新位置",locationMessage.getAddress());
map.put("经度",locationMessage.getX());
map.put("纬度",locationMessage.getY());
map.put("开始时间",locationMessage.getTimeBegin());
listResult.add(map);
}else{
// 查询对应任务
QueryWrapper<FenceTask> wrapper1 = new QueryWrapper<>();
wrapper1.eq("sb_imei",data.getSbImei());
FenceTask fenceTask = zdryFenceTaskMapper.selectOne(wrapper1);
// 同时更新fencetasks 围栏任务表 warn预警 1预警 0未预警
fenceTask.setWarn(0);
zdryFenceTaskMapper.updateById(fenceTask);
}
}
}else{
return MapRestResult.build(201,"参数不能为空","1","1");
}
if(listResult.size()>0){
return MapRestResult.build(200,"预警",listResult,listResult.size());
}else{
return MapRestResult.build(200,"无预警","无","1");
}
}
@Override
public MapRestResult wearFlag() {
QueryWrapper<Users> wrapper = new QueryWrapper<>();
wrapper.eq("xxsc_pdbz","0");
// 先查询出所有围栏任务中设备编号
List<Users> listImei = usersMapper.selectList(wrapper);
LocalDateTime now = LocalDateTime.now();
LocalDateTime thirtyLater = now.minusMinutes(30);
System.out.println("30分钟前的时间:"+thirtyLater);
// gk_heartrate心率和gk_dbp血压修改时间大于 当前时间减去30分钟则任务佩戴 不触发不推送 频率30分钟
if(listImei.size()>0){
for(Users data:listImei){
QueryWrapper<DbpMessage> wrapper1 = new QueryWrapper<>();
wrapper1.ge("time_begin",thirtyLater);
wrapper1.eq("sb_imei",data.getSbImei());
wrapper1.orderByDesc(true, "time_begin");
List<DbpMessage> dbpMessageList = zdryDbpMessageMapper.selectList(wrapper1);
QueryWrapper<HeartrateMessage> wrapper2 = new QueryWrapper<>();
wrapper2.ge("gxsj",thirtyLater);
wrapper2.eq("sb_imei",data.getSbImei());
wrapper2.orderByDesc(true, "time_begin");
List<HeartrateMessage> heartrateMessageList = zdryHeartrateMessageMapper.selectList(wrapper2);
if(dbpMessageList.size()>0 && heartrateMessageList.size()>0){
// 查询对应用户
QueryWrapper<Users> wrapper3 = new QueryWrapper<>();
wrapper3.eq("sb_imei",data.getSbImei());
wrapper3.eq("xxsc_pdbz","0");
Users users = usersMapper.selectOne(wrapper3);
// 根棍gk_users 是否佩戴
users.setWearFlag(1);
usersMapper.updateById(users);
// 根据血压和心率 是否在用户设定的范围内判定是否本人佩戴
if(dbpMessageList.get(0).getSbp()<data.getSbpH()&&dbpMessageList.get(0).getDbp()>data.getDbpL()
&&data.getThesholdHeartrateL()<heartrateMessageList.get(0).getHeartrate()&&heartrateMessageList.get(0).getHeartrate()<data.getThesholdHeartrateH()){
// 查询对应用户
QueryWrapper<Users> wrapper4 = new QueryWrapper<>();
wrapper4.eq("sb_imei",data.getSbImei());
wrapper4.eq("xxsc_pdbz","0");
Users users4 = usersMapper.selectOne(wrapper4);
// 根棍gk_users 是否本人佩戴 1是 0否
users4.setIsmeWearFlag(1);
usersMapper.updateById(users4);
}else{
// 查询对应用户
QueryWrapper<Users> wrapper4 = new QueryWrapper<>();
wrapper4.eq("sb_imei",data.getSbImei());
wrapper4.eq("xxsc_pdbz","0");
Users users4 = usersMapper.selectOne(wrapper4);
// 根棍gk_users 是否本人佩戴 1是 0否
users4.setIsmeWearFlag(0);
usersMapper.updateById(users4);
}
}else{
// 查询对应用户
QueryWrapper<Users> wrapper3 = new QueryWrapper<>();
wrapper3.eq("sb_imei",data.getSbImei());
wrapper3.eq("xxsc_pdbz","0");
Users users = usersMapper.selectOne(wrapper3);
// 根棍gk_users 是否佩戴 1佩戴 0未佩戴 是否本人佩戴 1是 0否
users.setIsmeWearFlag(0);
users.setWearFlag(0);
usersMapper.updateById(users);
}
}
}else{
return MapRestResult.build(201,"参数不能为空","1","1");
}
return MapRestResult.build(200,"是否佩戴是否本人佩戴定时任务完成","1","1");
}
@Override
public MapRestResult newLocationdataList(String[] imeis) {
List<Map<String,Object>> resultList=new ArrayList<>();
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
for (String imei : imeis) {
String url = zdryUrl + "/api/device/" + imei + "/data/locationdata/";
String resultString = restTemplate.getForEntity(url, String.class).getBody();
if (StringUtils.isNotEmpty(resultString)) {
JSONObject result = JSONObject.parseObject(resultString);
// 查看是否登录
if (result.containsKey("error_code")) {
if (getToken().equals("success")) {
resultString = restTemplate.getForEntity(url, String.class).getBody();
} else {
return MapRestResult.build(201, "登陆失败", 1);
}
;
}
JSONObject resultLast = JSONObject.parseObject(StringEscapeUtils.unescapeJava(resultString));
if (resultLast.getString("success").equals("true")) {
JSONObject jsonObject = resultLast.getJSONObject("obj");//当前页返回的结果总数
if (null != jsonObject) {
Map<String, Object> map = new HashMap<>();
JSONObject lastJsonObject = jsonObject.getJSONObject("locationdata");
String city = lastJsonObject.getString("city");
String address = lastJsonObject.getString("address");
JSONObject time_beginJson = lastJsonObject.getJSONObject("time_begin");
JSONObject point = lastJsonObject.getJSONObject("point");
JSONArray jsonArrayPoint = point.getJSONArray("coordinates");
String time_begin = time_beginJson.getString("$date");
String x = jsonArrayPoint.get(0).toString();
String y = jsonArrayPoint.get(1).toString();
map.put("设备编号", imei);
map.put("城市", city);
map.put("详细地址", address);
map.put("经度", x);
map.put("纬度", y);
map.put("最新时间",sf.format(new Date(Long.parseLong(time_begin) - TimeZone.getDefault().getRawOffset()))
);
resultList.add(map);
}
}
}
}
}catch (Exception e){
e.printStackTrace();
return MapRestResult.build(200,"批量获取设备最新位置失败",resultList.size(),e.getMessage());
}
return MapRestResult.build(200,"批量获取设备最新位置",resultList.size(),resultList);
}
public String getToken() {
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json");
// 设置请求的格式类型
headers.setContentType(type);
JSONObject json = new JSONObject();
json.put("username", "18234077206");
json.put("password", "cc150520");
HttpEntity<JSONObject> params = new HttpEntity<>(json, headers);
String resultString = restTemplate.postForEntity(zdryUrl + loginUrl, params, String.class).getBody();
JSONObject result = JSONObject.parseObject(resultString);
// 查看是否登录
if (result.containsKey("error_code")) {
return "error";
}else {
return "success";
}
}
}
package com.founder.zdryapi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.founder.commonutils.ZdryApiEntity.*;
import com.founder.zdryapi.mapper.*;
import com.founder.zdryapi.service.ZdryPushDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/*
*
* <p>
* 爱牵挂接口 服务实现类
* </p>
*
* @author yangyang
* @since 2021-06-04
*/
@Service
public class ZdryPushDataServiceImpl implements ZdryPushDataService {
@Autowired
private ZdryMessageMapper zdryMessageMapper;
@Autowired
private ZdryLocationMessageMapper zdryLocationMessageMapper;
@Autowired
private ZdryHeartrateMessageMapper zdryHeartrateMessageMapper;
@Autowired
private ZdryDbpMessageMapper zdryDbpMessageMapper;
@Autowired
private ZdryBloodMessageMapper zdryBloodMessageMapper;
@Autowired
private ZdryStepMessageMapper zdryStepMessageMapper;
@Override
public void message(int type, String deviceid, String communityid, String url, String name) {
if(type == 4){
QueryWrapper<Message> wrapper = new QueryWrapper<>();
wrapper.eq("sb_imei",deviceid);
Message message = zdryMessageMapper.selectOne(wrapper);
if(null != message){
message.setName(name);
message.setType(type);
message.setSbImei(deviceid);
message.setCommunityId(communityid);
message.setUrl(url);
zdryMessageMapper.updateById(message);
}else{
Message message1 = new Message();
message1.setName(name);
message1.setType(type);
message1.setSbImei(deviceid);
message1.setCommunityId(communityid);
message1.setUrl(url);
zdryMessageMapper.insert(message1);
}
}
}
@Override
public void locationMessage(String imei, String time_begin, boolean is_reply, boolean is_track, String city, String address, double lon, double lat, int type) {
QueryWrapper<LocationMessage> wrapper = new QueryWrapper<>();
wrapper.eq("sb_imei",imei);
// 查询
LocationMessage locationMessage = zdryLocationMessageMapper.selectOne(wrapper);
if(null != locationMessage){
locationMessage.setSbImei(imei);
locationMessage.setTimeBegin(time_begin);
locationMessage.setCity(city);
locationMessage.setAddress(address);
locationMessage.setX(String.valueOf(lon));
locationMessage.setY(String.valueOf(lat));
locationMessage.setType(type);
if(is_reply){
locationMessage.setIsReply(1);
}else{
locationMessage.setIsReply(0);
}
if(is_track){
locationMessage.setIsTrack(1);
}else{
locationMessage.setIsTrack(0);
}
// 执行更新
zdryLocationMessageMapper.updateById(locationMessage);
}else{
LocationMessage locationMessage1 = new LocationMessage();
locationMessage1.setSbImei(imei);
locationMessage1.setTimeBegin(time_begin);
locationMessage1.setCity(city);
locationMessage1.setAddress(address);
locationMessage1.setX(String.valueOf(lon));
locationMessage1.setY(String.valueOf(lat));
locationMessage1.setType(type);
if(is_reply){
locationMessage1.setIsReply(1);
}else{
locationMessage1.setIsReply(0);
}
if(is_track){
locationMessage1.setIsTrack(1);
}else {
locationMessage1.setIsTrack(0);
}
// 插入数据
zdryLocationMessageMapper.insert(locationMessage1);
}
}
@Override
public void heartrateMessage(String imei, String time_begin, int heartrate, int theshold_heartrate_h, int theshold_heartrate_l) {
HeartrateMessage HeartrateMessage1 = new HeartrateMessage();
HeartrateMessage1.setSbImei(imei);
HeartrateMessage1.setTimeBegin(time_begin);
HeartrateMessage1.setHeartrate(heartrate);
HeartrateMessage1.setTheshold_heartrate_h(theshold_heartrate_h);
HeartrateMessage1.setTheshold_heartrate_l(theshold_heartrate_l);
zdryHeartrateMessageMapper.insert(HeartrateMessage1);
}
@Override
public void dbpMessage(String imei, String time_begin, int dbp, int dbp_l, int sbp, int sbp_h) {
DbpMessage dbpMessage = new DbpMessage();
dbpMessage.setSbImei(imei);
dbpMessage.setTimeBegin(time_begin);
dbpMessage.setDbp(dbp);
dbpMessage.setDbp_l(dbp_l);
dbpMessage.setSbp(sbp);
dbpMessage.setSbp_h(sbp_h);
zdryDbpMessageMapper.insert(dbpMessage);
}
@Override
public void bloodMessage(String imei, String time_begin, int bloodoxygen, int bloodoxygen_h, int bloodoxygen_l) {
BloodMessage bloodMessage = new BloodMessage();
bloodMessage.setSbImei(imei);
bloodMessage.setTimeBegin(time_begin);
bloodMessage.setBloodoxygen(bloodoxygen);
bloodMessage.setBloodoxygenH(bloodoxygen_h);
bloodMessage.setBloodoxygenL(bloodoxygen_l);
zdryBloodMessageMapper.insert(bloodMessage);
}
@Override
public void stepMessage(String imei, String time_begin, int value) {
QueryWrapper<StepMessage> wrapper = new QueryWrapper<>();
wrapper.eq("sb_imei",imei);
wrapper.apply("STR_TO_DATE(time_begin,'%Y-%m-%d') = STR_TO_DATE('"+time_begin+"','%Y-%m-%d')");
// 查询
StepMessage stepMessage = zdryStepMessageMapper.selectOne(wrapper);
if(null != stepMessage){
stepMessage.setValue(value);
stepMessage.setTimeBegin(time_begin);
zdryStepMessageMapper.updateById(stepMessage);
}else{
StepMessage stepMessage1 = new StepMessage();
stepMessage1.setSbImei(imei);
stepMessage1.setTimeBegin(time_begin);
stepMessage1.setValue(value);
zdryStepMessageMapper.insert(stepMessage1);
}
}
}
#配置中心地址
spring.cloud.nacos.config.server-addr=47.92.48.137:9949
spring.cloud.nacos.discovery.server-addr=47.92.48.137:9949
#spring.cloud.nacos.config.server-addr=26.3.13.184:8848
#spring.cloud.nacos.discovery.server-addr=26.3.13.184:8848
spring.profiles.active=dev
# 该配置影响统一配置中心中的dataId
spring.application.name=zdryapi
spring.cloud.nacos.config.namespace=f1160b5f-cef5-4e86-bddc-c55e28c2d8b0
#spring.cloud.nacos.config.ext-config[0].data-id=image.properties
# 开启动态刷新配置,否则配置文件修改,工程无法感知
#spring.cloud.nacos.config.ext-config[0].refresh=true
spring.cloud.nacos.config.shared-dataids=zdryapipz.properties
spring.cloud.nacos.config.refreshable-dataids=zdryapipz.properties
management.health.elasticsearch.enabled: false
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment