Commit 40d9e5ca by 春觉晓

添加思享驾接口

1 parent 6a744f67
Showing 34 changed files with 1955 additions and 0 deletions
...@@ -104,5 +104,16 @@ ...@@ -104,5 +104,16 @@
<artifactId>ne-shield-standard-interfaces-api</artifactId> <artifactId>ne-shield-standard-interfaces-api</artifactId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.glsx</groupId>
<artifactId>ne-shield-alarmcenter-api</artifactId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.glsx</groupId>
<artifactId>ne-shield-devicemonitor-api</artifactId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import static javax.persistence.GenerationType.IDENTITY;
/**
* 大数据研判实体类
*
* @author yll
*/
@Data
@Table(name = "t_track_stujudge_alarm")
public class StuJudgeAlarm {
@Id
@GeneratedValue(strategy = IDENTITY)
private Integer id;
/**
* 黑区或者异常聚集编号
*/
@Column(name = "geo_code")
private String geoCode;
/**
* 设备号
*/
@Column(name = "sn")
private String sn;
/**
* 开始报警时间
*/
@Column(name = "begintime")
private Date begintime;
/**
* 1.黑区报警 2.异常聚集报警
*/
@Column(name = "alarm_type")
private Integer alarmType;
/**
* 报警位置
*/
@Column(name = "alarm_address")
private String alarmAddress;
/**
* 1.已恢复 2.未恢复
*/
@Column(name = "delflag")
private Integer delflag;
/**
* 最后预警时间
*/
@Column(name = "lasttime")
private Date lasttime;
/**
* 最后的经度
*/
@Column(name = "lastlng")
private String lastlng;
/**
* 最后的纬度
*/
@Column(name = "lastlat")
private String lastlat;
/**
* 报警次数
*/
@Column(name = "alarmNo")
private Integer alarmNo;
/**
* 更新时间
*/
@Column(name = "updateTime")
private Date updateTime;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.mapper;
import cn.com.glsx.alarm.services.model.StuJudgeAlarmBo;
import cn.com.glsx.alarm.services.model.StuJudgeAlarmDto;
import cn.com.glsx.schedulerjob.entity.StuJudgeAlarm;
import cn.com.glsx.schedulerjob.model.StuAlarmCountDto;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author yll
*/
@Mapper
public interface StuJudgeAlarmMapper extends CommonBaseMapper<StuJudgeAlarm> {
Integer getStuJudgeAlarmCount(StuJudgeAlarmBo stujudgeAlarmBo);
List<StuJudgeAlarmDto> getStuJudgeAlarmDataList(StuJudgeAlarmBo stujudgeAlarmBo);
/**
* 统计 黑区报警次数
* @param snList
* @param stujudgeAlarmBo
* @return
*/
List<StuAlarmCountDto> statisticJudgeAlarmCount(@Param("snList") List<String> snList, @Param("stuJudgeAlarm") StuJudgeAlarmBo stujudgeAlarmBo);
/**
* 统计 二押报警次数
* @param snList
* @param stujudgeAlarmBo
* @return
*/
List<StuAlarmCountDto> statisticSecondDataAlarmCount(@Param("snList") List<String> snList, @Param("stuJudgeAlarm") StuJudgeAlarmBo stujudgeAlarmBo);
}
package cn.com.glsx.schedulerjob.model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
/**
* 异常聚集报警接口 - 报警列表项(alarmList数组元素)
* 对应文档3.10.2 alarmList[]下的字段
*/
import lombok.Data;
import lombok.ToString;
@ToString
@Data
public class AbnormalGatherAlarmItem implements Serializable {
/**
* 事件Id
*/
private String Id;
/**
* 设备号
*/
private String Imei;
/**
* 预警类型:固定值48
*/
private String MessDataType;
/**
* 事件时间
*/
private Date Time;
/**
* 车架号
*/
private String VinNumber;
/**
* 有线无线属性:1-无线 2-有线
*/
private String DeviceType;
/**
* 事件纬度
*/
private String lat;
/**
* 事件经度
*/
private String lng;
// 无参构造(JSON反序列化必备)
public AbnormalGatherAlarmItem() {
}
}
package cn.com.glsx.schedulerjob.model;
import java.io.Serializable;
import java.util.List;
/**
* 异常聚集报警接口请求参数对象
* 对应文档3.10节:设备上报指定日期的异常聚集报警数据(含报警次数、位置、站点等)
*/
public class AbnormalGatherAlarmRequest implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 数据所属日期
* 必填:是
* 格式:yyyy-MM-dd
* 对应文档3.10.2 currentDay字段
*/
private String currentDay;
/**
* 异常聚集报警列表
* 必填:是
* 类型:Array(List)
* 对应文档3.10.2 alarmList字段
*/
private List<AbnormalGatherAlarmItem> alarmList;
// 无参构造
public AbnormalGatherAlarmRequest() {
}
// 全参构造
public AbnormalGatherAlarmRequest(String currentDay, List<AbnormalGatherAlarmItem> alarmList) {
this.currentDay = currentDay;
this.alarmList = alarmList;
}
// Getter & Setter
public String getCurrentDay() {
return currentDay;
}
public void setCurrentDay(String currentDay) {
this.currentDay = currentDay;
}
public List<AbnormalGatherAlarmItem> getAlarmList() {
return alarmList;
}
public void setAlarmList(List<AbnormalGatherAlarmItem> alarmList) {
this.alarmList = alarmList;
}
// toString
@Override
public String toString() {
return "AbnormalGatherAlarmRequest{" +
"currentDay='" + currentDay + '\'' +
", alarmList=" + alarmList +
'}';
}
}
package cn.com.glsx.schedulerjob.model;
import java.io.Serializable;
/**
* 黑区数据消息队列请求实体类
* 对应文档:黑区数据消息队列格式(字段名/大小写/数据类型严格匹配)
*/
public class BlackAreaWarnRequest implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 黑区预警id,自动生成
*/
private String Id;
/**
* 设备号
*/
private String DeviceNumber;
/**
* 预警类型:黑区(固定值44)
*/
private Integer MessDataType;
/**
* 有线无线属性:1-无线 2-有线
*/
private String DeviceType;
/**
* 车架号
*/
private String VinNumber;
/**
* 纬度
*/
private double inDeviceLat;
/**
* 经度
*/
private double inDeviceLng;
/**
* 风险等级:1-低级 2-中级 3-高级
*/
private Integer riskPlaceLevel;
// 无参构造:JSON反序列化、消息队列消费/框架实例化必备
public BlackAreaWarnRequest() {
}
// 全参构造:测试/业务手动构建对象时快速赋值
public BlackAreaWarnRequest(String Id, String DeviceNumber, Integer MessDataType, String DeviceType,
String VinNumber, double inDeviceLat, double inDeviceLng, Integer riskPlaceLevel) {
this.Id = Id;
this.DeviceNumber = DeviceNumber;
this.MessDataType = MessDataType;
this.DeviceType = DeviceType;
this.VinNumber = VinNumber;
this.inDeviceLat = inDeviceLat;
this.inDeviceLng = inDeviceLng;
this.riskPlaceLevel = riskPlaceLevel;
}
// Getter & Setter:JSON序列化/反序列化、消息队列解析、业务取值必备
public String getId() {
return Id;
}
public void setId(String Id) {
this.Id = Id;
}
public String getDeviceNumber() {
return DeviceNumber;
}
public void setDeviceNumber(String DeviceNumber) {
this.DeviceNumber = DeviceNumber;
}
public Integer getMessDataType() {
return MessDataType;
}
public void setMessDataType(Integer MessDataType) {
this.MessDataType = MessDataType;
}
public String getDeviceType() {
return DeviceType;
}
public void setDeviceType(String DeviceType) {
this.DeviceType = DeviceType;
}
public String getVinNumber() {
return VinNumber;
}
public void setVinNumber(String VinNumber) {
this.VinNumber = VinNumber;
}
public double getInDeviceLat() {
return inDeviceLat;
}
public void setInDeviceLat(double inDeviceLat) {
this.inDeviceLat = inDeviceLat;
}
public double getInDeviceLng() {
return inDeviceLng;
}
public void setInDeviceLng(double inDeviceLng) {
this.inDeviceLng = inDeviceLng;
}
public Integer getRiskPlaceLevel() {
return riskPlaceLevel;
}
public void setRiskPlaceLevel(Integer riskPlaceLevel) {
this.riskPlaceLevel = riskPlaceLevel;
}
// toString:日志打印、消息队列调试必备,直观展示对象完整数据
@Override
public String toString() {
return "BlackAreaWarnRequest{" +
"Id='" + Id + '\'' +
", DeviceNumber='" + DeviceNumber + '\'' +
", MessDataType=" + MessDataType +
", DeviceType='" + DeviceType + '\'' +
", VinNumber='" + VinNumber + '\'' +
", inDeviceLat=" + inDeviceLat +
", inDeviceLng=" + inDeviceLng +
", riskPlaceLevel=" + riskPlaceLevel +
'}';
}
// 业务常量:避免魔法值,提升代码可读性和可维护性(与文档固定值完全一致)
/**
* 预警类型-黑区预警固定值
*/
public static final Integer MESS_DATA_TYPE_BLACK_AREA = 44;
/**
* 设备属性-无线
*/
public static final String DEVICE_TYPE_WIRELESS = "1";
/**
* 设备属性-有线
*/
public static final String DEVICE_TYPE_WIRED = "2";
/**
* 风险等级-低级
*/
public static final Integer RISK_LEVEL_LOW = 1;
/**
* 风险等级-中级
*/
public static final Integer RISK_LEVEL_MIDDLE = 2;
/**
* 风险等级-高级
*/
public static final Integer RISK_LEVEL_HIGH = 3;
}
package cn.com.glsx.schedulerjob.model;
import java.io.Serializable;
public class DeviceDataItem implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 包类型:0-定位包,1-心跳包
*/
private int pktype;
/**
* 设备类型(int):0-有线,1-无线
*/
private int wiretype;
/**
* 设备号
*/
private String imei;
/**
* 设备类型(string)
*/
private String devtype;
/**
* 定位类型:0-GPS,1-基站,2-WIFI,3-北斗,4-GPS/北斗混合
* 【规则】pktype==1(心跳包)时该值无效
*/
private int loctype;
/**
* 经度(float)
* 【规则】pktype==1(心跳包)时该值无效
*/
private float lng;
/**
* 纬度(float)
* 【规则】pktype==1(心跳包)时该值无效
*/
private float lat;
/**
* 速度(int)
* 【规则】pktype==1(心跳包)时该值无效
*/
private int spd;
/**
* 方向(int)
* 【规则】pktype==1(心跳包)时该值无效
*/
private int dir;
/**
* 电量(int)
* 【规则】pktype==1(心跳包)时该值无效
*/
private int bat;
/**
* 定位时间(long)
* 【规则】pktype==1(心跳包)时该值无效
*/
private long t;
// 无参构造:JSON反序列化必备(数组子项必须有无参构造)
public DeviceDataItem() {
}
// 全参构造:测试/业务手动构建对象(快速赋值所有字段)
public DeviceDataItem(int pktype, int wiretype, String imei, String devtype, int loctype,
float lng, float lat, int spd, int dir, int bat, long t) {
this.pktype = pktype;
this.wiretype = wiretype;
this.imei = imei;
this.devtype = devtype;
this.loctype = loctype;
this.lng = lng;
this.lat = lat;
this.spd = spd;
this.dir = dir;
this.bat = bat;
this.t = t;
}
// 全字段Getter & Setter:JSON序列化/反序列化、业务取值必备
public int getPktype() {
return pktype;
}
public void setPktype(int pktype) {
this.pktype = pktype;
}
public int getWiretype() {
return wiretype;
}
public void setWiretype(int wiretype) {
this.wiretype = wiretype;
}
public String getImei() {
return imei;
}
public void setImei(String imei) {
this.imei = imei;
}
public String getDevtype() {
return devtype;
}
public void setDevtype(String devtype) {
this.devtype = devtype;
}
public int getLoctype() {
return loctype;
}
public void setLoctype(int loctype) {
this.loctype = loctype;
}
public float getLng() {
return lng;
}
public void setLng(float lng) {
this.lng = lng;
}
public float getLat() {
return lat;
}
public void setLat(float lat) {
this.lat = lat;
}
public int getSpd() {
return spd;
}
public void setSpd(int spd) {
this.spd = spd;
}
public int getDir() {
return dir;
}
public void setDir(int dir) {
this.dir = dir;
}
public int getBat() {
return bat;
}
public void setBat(int bat) {
this.bat = bat;
}
public long getT() {
return t;
}
public void setT(long t) {
this.t = t;
}
@Override
public String toString() {
return "DeviceDataItem{" +
"pktype=" + pktype +
", wiretype=" + wiretype +
", imei='" + imei + '\'' +
", devtype='" + devtype + '\'' +
", loctype=" + loctype +
", lng=" + lng +
", lat=" + lat +
", spd=" + spd +
", dir=" + dir +
", bat=" + bat +
", t=" + t +
'}';
}
// -------------------------- 业务常量:避免魔法值,提升可读性 --------------------------
/**
* 包类型 - 定位包
*/
public static final int PKTYPE_LOCATION = 0;
/**
* 包类型 - 心跳包
*/
public static final int PKTYPE_HEARTBEAT = 1;
/**
* 设备类型(int) - 有线
*/
public static final int WIRETYPE_WIRED = 0;
/**
* 设备类型(int) - 无线
*/
public static final int WIRETYPE_WIRELESS = 1;
/**
* 定位类型 - GPS
*/
public static final int LOCTYPE_GPS = 0;
/**
* 定位类型 - 基站
*/
public static final int LOCTYPE_BASE_STATION = 1;
/**
* 定位类型 - WIFI
*/
public static final int LOCTYPE_WIFI = 2;
/**
* 定位类型 - 北斗
*/
public static final int LOCTYPE_BEIDOU = 3;
/**
* 定位类型 - GPS/北斗混合
*/
public static final int LOCTYPE_GPS_BEIDOU = 4;
}
package cn.com.glsx.schedulerjob.model;
import java.io.Serializable;
/**
* 设备位置基础信息实体类
* 对应文档:包含设备号、车架号、地址字段(imei允许为空)
*/
public class DeviceLocationInfo implements Serializable {
/**
* 设备号,可能空(如新增车辆场景)
*/
private String imei;
/**
* 车架号
*/
private String vin_number;
/**
* 地址
*/
private String address;
// 无参构造:JSON反序列化、框架实例化必备(imei为空时也能正常实例化)
public DeviceLocationInfo() {
}
// 全参构造:测试/业务手动构建对象时快速赋值
public DeviceLocationInfo(String imei, String vin_number, String address) {
this.imei = imei;
this.vin_number = vin_number;
this.address = address;
}
// Getter & Setter:JSON序列化/反序列化、业务取值必备(imei为空时不影响读写)
public String getImei() {
return imei;
}
public void setImei(String imei) {
this.imei = imei;
}
public String getVin_number() {
return vin_number;
}
public void setVin_number(String vin_number) {
this.vin_number = vin_number;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
// toString:日志打印、调试必备,imei为空时也能正常输出
@Override
public String toString() {
return "DeviceLocationInfo{" +
"imei='" + imei + '\'' +
", vin_number='" + vin_number + '\'' +
", address='" + address + '\'' +
'}';
}
}
package cn.com.glsx.schedulerjob.model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
/**
* 设备经纬度接口 - 位置列表项(locationList数组元素)
* 对应文档3.11.2 locationList[]下的字段
*/
public class DeviceLocationItem implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 设备序列号
* 必填:是
* 类型:String
* 对应文档3.11.2 locationList[].sn字段
*/
private String sn;
/**
* 位置采集时间
* 必填:是
* 格式:yyyy-MM-dd HH:mm:ss
* 对应文档3.11.2 locationList[].locationTime字段
*/
private String locationTime;
/**
* 设备纬度
* 必填:是
* 类型:Double
* 约束:保留6位小数,范围[-90, 90](有效地理纬度范围)
* 对应文档3.11.2 locationList[].lat字段
*/
private Double lat;
/**
* 设备经度
* 必填:是
* 类型:Double
* 约束:保留6位小数,范围[-180, 180](有效地理经度范围)
* 对应文档3.11.2 locationList[].lng字段
*/
private Double lng;
// 无参构造(JSON反序列化必备)
public DeviceLocationItem() {
}
// 全参构造(自动处理经纬度小数位数)
public DeviceLocationItem(String sn, String locationTime, Double lat, Double lng) {
this.sn = sn;
this.locationTime = locationTime;
this.lat = roundTo6Decimals(lat);
this.lng = roundTo6Decimals(lng);
}
// 辅助方法:Double保留6位小数(符合文档格式要求)
private Double roundTo6Decimals(Double value) {
if (value == null) {
return null;
}
return BigDecimal.valueOf(value).setScale(6, RoundingMode.HALF_UP).doubleValue();
}
// Getter & Setter(Setter中补充经纬度小数位数约束)
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getLocationTime() {
return locationTime;
}
public void setLocationTime(String locationTime) {
this.locationTime = locationTime;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = roundTo6Decimals(lat);
}
public Double getLng() {
return lng;
}
public void setLng(Double lng) {
this.lng = roundTo6Decimals(lng);
}
// toString(方便日志打印/调试)
@Override
public String toString() {
return "DeviceLocationItem{" +
"sn='" + sn + '\'' +
", locationTime='" + locationTime + '\'' +
", lat=" + lat +
", lng=" + lng +
'}';
}
}
package cn.com.glsx.schedulerjob.model;
import java.io.Serializable;
import java.util.List;
/**
* 设备经纬度接口请求参数对象
* 对应文档3.11节:设备上报指定日期的各设备经纬度位置数据
*/
public class DeviceLocationRequest implements Serializable {
/**
* 数据所属日期
* 必填:是
* 格式:yyyy-MM-dd
* 对应文档3.11.2 currentDay字段
*/
private String currentDay;
/**
* 设备位置列表
* 必填:是
* 类型:Array(List)
* 对应文档3.11.2 locationList字段
*/
private List<DeviceLocationItem> locationList;
// 无参构造
public DeviceLocationRequest() {
}
// 全参构造
public DeviceLocationRequest(String currentDay, List<DeviceLocationItem> locationList) {
this.currentDay = currentDay;
this.locationList = locationList;
}
// Getter & Setter
public String getCurrentDay() {
return currentDay;
}
public void setCurrentDay(String currentDay) {
this.currentDay = currentDay;
}
public List<DeviceLocationItem> getLocationList() {
return locationList;
}
public void setLocationList(List<DeviceLocationItem> locationList) {
this.locationList = locationList;
}
// toString
@Override
public String toString() {
return "DeviceLocationRequest{" +
"currentDay='" + currentDay + '\'' +
", locationList=" + locationList +
'}';
}
}
package cn.com.glsx.schedulerjob.model;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import static org.bouncycastle.asn1.x500.style.RFC4519Style.sn;
/**
* 光敏报警接口 - 报警列表项(alarmList数组元素)
* 对应文档3.7.2 alarmList[]下的字段
*/
@Data
public class LightSensorAlarmItem implements Serializable {
/**
* 光敏预警id,自动生成
*/
private String Id;
/**
* 预警类型:光敏预警(1)、低电量预警(13)
*/
private Integer MessDataType;
/**
* 设备号
*/
private String Imei;
/**
* 车架号
*/
private String VinNumber;
/**
* 预警时间戳(ms)
* 注:文档标注为int,毫秒级时间戳易超出int最大值(2147483647),实际业务建议替换为Long,此处严格按文档定义
*/
private Integer Time;
/**
* 预警地址
*/
private String MsgAddress;
/**
* 报警时设备纬度
* 必填:是
* 类型:Double
* 约束:保留6位小数,范围[-90, 90]
* 对应文档3.7.2 alarmList[].lat字段
*/
private Double lat;
/**
* 报警时设备经度
* 必填:是
* 类型:Double
* 约束:保留6位小数,范围[-180, 180]
* 对应文档3.7.2 alarmList[].lng字段
*/
private Double lng;
// 无参构造(JSON反序列化必备)
public LightSensorAlarmItem() {
}
}
package cn.com.glsx.schedulerjob.model;
import java.io.Serializable;
import java.util.List;
/**
* 光敏报警接口请求参数对象
* 对应文档3.7节:设备上报指定日期的光敏报警数据(含报警次数、位置等)
*/
public class LightSensorAlarmRequest implements Serializable {
/**
* 数据所属日期
* 必填:是
* 格式:yyyy-MM-dd
* 对应文档3.7.2 currentDay字段
*/
private String currentDay;
/**
* 光敏报警列表
* 必填:是
* 类型:Array(List)
* 注:文档原数组无key,规范新增alarmList作为数组key,设备侧需按此调整
* 对应文档3.7.2 alarmList字段
*/
private List<LightSensorAlarmItem> alarmList;
// 无参构造
public LightSensorAlarmRequest() {
}
// 全参构造
public LightSensorAlarmRequest(String currentDay, List<LightSensorAlarmItem> alarmList) {
this.currentDay = currentDay;
this.alarmList = alarmList;
}
// Getter & Setter
public String getCurrentDay() {
return currentDay;
}
public void setCurrentDay(String currentDay) {
this.currentDay = currentDay;
}
public List<LightSensorAlarmItem> getAlarmList() {
return alarmList;
}
public void setAlarmList(List<LightSensorAlarmItem> alarmList) {
this.alarmList = alarmList;
}
// toString
@Override
public String toString() {
return "LightSensorAlarmRequest{" +
"currentDay='" + currentDay + '\'' +
", alarmList=" + alarmList +
'}';
}
}
package cn.com.glsx.schedulerjob.model;
import lombok.Data;
@Data
public class StuAlarmCountDto {
/**
* 设备号
*/
private String sn;
/**
* 报警次数
*/
private Integer alarmCount;
}
package cn.com.glsx.schedulerjob.model;
import lombok.Data;
/**
* 大数据研判实体类
*
* @author yll
*/
@Data
public class StuJudgeAlarmDto {
private Integer id;
/**
* 设备号
*/
private String sn;
/**
* 黑区或者异常聚集编号
*/
private String geoCode;
/**
* 1.黑区报警 2.异常聚集报警 3.二押报警
*/
private Integer alarmType;
/**
* 1.生效 2.失效
*/
private Integer alarmStatus;
/**
* 报警位置
*/
private String alarmAddress;
/**
* 报警生效时间
*/
private String alarmBeginTime;
/**
* 报警失效时间
*/
private String alarmEndTime;
/**
* 报警的经度
*/
private String alarmLng;
/**
* 报警的纬度
*/
private String alarmLat;
/**
* 报警次数
*/
private Integer alarmCount;
/**
* 风险等级
*/
private String alarmLevel;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.common.enums;
import com.glsx.plat.exception.SystemMessage;
/**
* 数据部门 - 租户ID
*
* @author wangxw
*/
public enum StuAlarmStatusEnum {
UN_DEL(1, "生效"),
DEL(2, "失效")
;
private final Integer code;
private final String message;
StuAlarmStatusEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
StuAlarmStatusEnum(SystemMessage systemMessage) {
this.code = systemMessage.getCode();
this.message = systemMessage.getMsg();
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}
package cn.com.glsx.schedulerjob.task.common.enums;
import com.glsx.plat.exception.SystemMessage;
/**
* 数据部门 - 租户ID
*
* @author wangxw
*/
public enum StuAlarmTypeEnum {
UNDEFINE(1, "未定义"),
ABNORMAL_AGGREGATION(2, "异常聚集"),
BLACK_AREA(3, "黑区报警"),
SECOND_DATA(4, "二押报警")
;
private final Integer code;
private final String message;
StuAlarmTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
StuAlarmTypeEnum(SystemMessage systemMessage) {
this.code = systemMessage.getCode();
this.message = systemMessage.getMsg();
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}
package cn.com.glsx.schedulerjob.task.taskscheduler;
import cn.com.glsx.schedulerjob.task.modules.service.AlarmJobService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@ElasticSimpleJob(jobName = "AbnormalClusteringJob", cron = "0 15 4 * * ?")
public class AbnormalClusteringJob implements SimpleJob {
@Autowired
private AlarmJobService alarmJobService;
@Override
public void execute(ShardingContext shardingContext) {
try {
log.info("开始推送异常聚集报警,参数:{}", shardingContext.getJobParameter());
// 处理数据
alarmJobService.sendAggregateAlarmMsg(shardingContext.getJobParameter(), 2);
log.info("推送异常聚集报警完成,参数:{}", shardingContext.getJobParameter());
} catch (Exception e) {
log.error("推送异常聚集报警异常,参数:{}", shardingContext.getJobParameter(), e);
}
}
}
package cn.com.glsx.schedulerjob.task.taskscheduler;
import cn.com.glsx.stdinterface.api.VehicleDeviceClient;
import com.alibaba.fastjson.JSONObject;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 思享驾设备分离报警定时任务
*/
@Slf4j
@Component
@ElasticSimpleJob(jobName = "AlarmDeviceSeparationJob", cron = "0 15 4 * * ?")
public class AlarmDeviceSeparationJob implements SimpleJob {
@Autowired
private VehicleDeviceClient vehicleDeviceService;
@Override
public void execute(ShardingContext shardingContext) {
try {
log.info("开始推送设备分离报警,参数:{}", JSONObject.toJSONString(shardingContext.getJobParameter()));
// 处理数据
R<Boolean> booleanR = vehicleDeviceService.pushSXJDeviceSeparationAlarmData(null);
log.info("推送设备分离报警结果:{}", booleanR);
log.info("推送设备分离报警完成,参数:{}", JSONObject.toJSONString(shardingContext.getJobParameter()));
} catch (Exception e) {
log.error("推送设备分离报警异常,参数:{}", JSONObject.toJSONString(shardingContext.getJobParameter()), e);
}
}
}
package cn.com.glsx.schedulerjob.task.taskscheduler;
import cn.com.glsx.stdinterface.api.VehicleDeviceClient;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 思享驾围栏报警定时任务
*/
@Slf4j
@Component
@ElasticSimpleJob(jobName = "AlarmElectricFenceJob", cron = "0 15 4 * * ?")
public class AlarmElectricFenceJob implements SimpleJob {
@Autowired
private VehicleDeviceClient vehicleDeviceClient;
@Override
public void execute(ShardingContext shardingContext) {
log.info("Thread ID: {}, 作业分片总数: {}, " +
"当前分片项: {}.当前参数: {}," +
"作业名称: {}.作业自定义参数: {}",
shardingContext.getShardingItem(),
shardingContext.getShardingParameter(),
shardingContext.getJobName(),
shardingContext.getJobParameter());
try {
log.info("开始推送围栏报警,参数:{}", shardingContext.getJobParameter());
// 处理数据
vehicleDeviceClient.pushSXJAlarmElectricFence(shardingContext.getJobParameter());
log.info("推送围栏报警完成,参数:{}", shardingContext.getJobParameter());
} catch (Exception e) {
log.error("推送围栏报警异常,参数:{}", shardingContext.getJobParameter(), e);
}
}
}
package cn.com.glsx.schedulerjob.task.taskscheduler;
import cn.com.glsx.schedulerjob.task.modules.service.AlarmJobService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 光敏报警定时任务
*/
@Slf4j
@Component
@ElasticSimpleJob(jobName = "AlarmMsgJob", cron = "0 15 4 * * ?")
public class AlarmMsgJob implements SimpleJob {
@Autowired
private AlarmJobService alarmJobService;
@Override
public void execute(ShardingContext shardingContext) {
log.info("Thread ID: {}, 作业分片总数: {}, " +
"当前分片项: {}.当前参数: {}," +
"作业名称: {}.作业自定义参数: {}",
Thread.currentThread().getId(),
shardingContext.getShardingTotalCount(),
shardingContext.getShardingItem(),
shardingContext.getShardingParameter(),
shardingContext.getJobName(),
shardingContext.getJobParameter()
);
try {
log.info("开始发送光敏报警,参数:{}", shardingContext.getJobParameter());
// 处理数据
alarmJobService.sendAlarmMsg(null);
log.info("发送光敏报警完成,参数:{}", shardingContext.getJobParameter());
} catch (Exception e) {
log.error("发送光敏报警异常,参数:{}", shardingContext.getJobParameter(), e);
}
}
}
package cn.com.glsx.schedulerjob.task.taskscheduler;
import cn.com.glsx.schedulerjob.task.modules.service.AlarmJobService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 黑区预警定时任务
*/
@Slf4j
@Component
@ElasticSimpleJob(jobName = "BlackZoneWarningJob", cron = "0 15 4 * * ?")
public class BlackZoneWarningJob implements SimpleJob {
@Autowired
private AlarmJobService alarmJobService;
@Override
public void execute(ShardingContext shardingContext) {
try {
log.info("开始推送黑区预警报警,参数:{}", shardingContext.getJobParameter());
// 处理数据
alarmJobService.sendAggregateAlarmMsg(shardingContext.getJobParameter(), 3);
log.info("推送黑区预警报警完成,参数:{}", shardingContext.getJobParameter());
} catch (Exception e) {
log.error("推送黑区预警报警异常,参数:{}", shardingContext.getJobParameter(), e);
}
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.taskscheduler;
import cn.com.glsx.schedulerjob.task.modules.service.AlarmJobService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@ElasticSimpleJob(jobName = "DeviceLocationJob", cron = "0 15 4 * * ?")
public class DeviceLocationJob implements SimpleJob {
@Autowired
private AlarmJobService alarmJobService;
@Override
public void execute(ShardingContext shardingContext) {
try {
log.info("开始推送设备位置,参数:{}", shardingContext.getJobParameter());
// 处理数据
alarmJobService.sendDeviceLocation(shardingContext.getJobParameter());
log.info("推送设备位置完成,参数:{}", shardingContext.getJobParameter());
} catch (Exception e) {
log.error("推送设备位置异常,参数:{}", shardingContext.getJobParameter(), e);
}
}
}
package cn.com.glsx.schedulerjob.task.taskscheduler;
import cn.com.glsx.stdinterface.api.VehicleDeviceClient;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 离线报警定时任务
*/
@Slf4j
@Component
@ElasticSimpleJob(jobName = "OfflineAlarmJob", cron = "0 15 4 * * ?")
public class OfflineAlarmJob implements SimpleJob {
@Autowired
private VehicleDeviceClient vehicleDeviceService;
@Override
public void execute(ShardingContext shardingContext) {
try {
log.info("开始推送离线报警,参数:{}", shardingContext.getJobParameter());
// 处理数据
vehicleDeviceService.pushSXJOfflineAlarmData(shardingContext.getJobParameter());
log.info("推送离线报警完成,参数:{}", shardingContext.getJobParameter());
} catch (Exception e) {
log.error("推送离线报警异常,参数:{}", shardingContext.getJobParameter(), e);
}
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.taskscheduler;
import cn.com.glsx.schedulerjob.task.modules.service.AlarmJobService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.dangdang.elasticjob.lite.annotation.ElasticSimpleJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 车辆常停地定时任务
*/
@Slf4j
@Component
@ElasticSimpleJob(jobName = "ResidentJob", cron = "0 15 4 * * ?")
public class RegularStopoverPointJob implements SimpleJob {
@Autowired
private AlarmJobService alarmJobService;
@Override
public void execute(ShardingContext shardingContext) {
try {
log.info("开始推送车辆常停地,参数:{}", shardingContext.getJobParameter());
// 处理数据
alarmJobService.sendRegularStopoverPointData();
log.info("推送车辆常停地完成,参数:{}", shardingContext.getJobParameter());
} catch (Exception e) {
log.error("推送车辆常停地异常,参数:{}", shardingContext.getJobParameter(), e);
}
}
}
<?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="cn.com.glsx.schedulerjob.mapper.StuJudgeAlarmMapper">
<sql id="BaseColumns">
a.id, a.geo_code, a.sn, a.begintime, a.alarm_type, a.alarm_address, a.delflag, a.lasttime,
a.alarmNo, a.updateTime
</sql>
<select id="getStuJudgeAlarmCount" resultType="Integer">
select
count(temp.id)
from (
SELECT
ttsa.id
FROM t_track_stujudge_alarm ttsa
where ttsa.delflag = 2 and ttsa.alarm_type in (2,3)
<if test="snStrs != null and snStrs != ''">
and ttsa.sn in (${snStrs})
</if>
<if test="startTime != null and startTime != ''">
and ttsa.begintime &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and ttsa.begintime &lt;= #{endTime}
</if>
<!--
union all
SELECT
dasd.id
FROM d_alarm_second_data dasd
where dasd.del_flag = 1
<if test="snStrs != null and snStrs != ''">
and dasd.sn in (${snStrs})
</if>
<if test="startTime != null and startTime != ''">
and dasd.alarm_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and dasd.alarm_time &lt;= #{endTime}
</if> -->
) temp
</select>
<select id="getStuJudgeAlarmDataList" resultType="cn.com.glsx.alarm.services.model.StuJudgeAlarmDto">
select
temp.id as id,
temp.sn as sn,
temp.geo_code as geoCode,
temp.begintime as alarmBeginTime,
temp.alarm_type as alarmType,
temp.alarm_address as alarmAddress,
temp.lasttime as alarmEndTime,
temp.alarmStatus as alarmStatus,
temp.alarmLng as alarmLng,
temp.alarmLat as alarmLat,
temp.alarmLevel as alarmLevel
from (
SELECT
ttsa.id,
ttsa.sn,
ttsa.geo_code,
ttsa.begintime,
ttsa.alarm_type,
ttsa.alarm_address,
ttsa.lasttime,
IF(ttsa.delflag = 2,1,2) as alarmStatus,
ttsa.lastlng as alarmLng,
ttsa.lastlat as alarmLat,
(CASE ttsa.alarm_type WHEN 2 THEN 'S2'
WHEN 3 THEN 'S1' END) AS alarmLevel
FROM t_track_stujudge_alarm ttsa
where 1 = 1 and ttsa.alarm_type in (2,3)
<if test="snStrs != null and snStrs !=''">
and ttsa.sn in (${snStrs})
</if>
<if test="alarmType != null ">
and ttsa.alarm_type = #{alarmType}
</if>
<if test="alarmStatus != null ">
<!-- 生效-->
<if test="alarmStatus == 1">
and ttsa.delflag = 2
</if>
<!-- 失效-->
<if test="alarmStatus == 2">
and ttsa.delflag = 1
</if>
</if>
<if test="startTime != null and startTime != ''">
and ttsa.begintime &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
and ttsa.begintime &lt;= #{endTime}
</if>
) temp order by temp.id
</select>
<select id="statisticJudgeAlarmCount" resultType="cn.com.glsx.schedulerjob.model.StuAlarmCountDto">
SELECT
COUNT(*) AS alarmCount,concat(ttsa.sn,'-',ttsa.alarm_type) as sn
FROM t_track_stujudge_alarm ttsa
where 1 = 1 and ttsa.alarm_type in (2,3)
<if test="snList!=null and snList.size()>0">
and ttsa.sn in
<foreach item="item" index="index" collection="snList" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
<if test="stuJudgeAlarm.alarmType != null ">
and ttsa.alarm_type = #{stuJudgeAlarm.alarmType}
</if>
GROUP BY ttsa.sn,ttsa.alarm_type
</select>
<select id="statisticSecondDataAlarmCount" resultType="cn.com.glsx.schedulerjob.model.StuAlarmCountDto">
SELECT
COUNT(*) AS alarmCount,concat(dasd.sn,'-',4) as sn
FROM d_alarm_second_data dasd
where 1 = 1
<if test="snList!=null and snList.size()>0">
and dasd.sn in
<foreach item="item" index="index" collection="snList" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY dasd.sn
</select>
<select id="selectLatestAlarmOfEachType" resultType="cn.com.glsx.alarm.services.model.StuJudgeAlarmDto">
SELECT
t1.id,
t1.sn,
t1.geo_code geoCode,
t1.begintime alarmBeginTime,
t1.alarm_type alarmType,
t1.alarm_address alarmAddress,
t1.lasttime alarmEndTime,
t1.lastlng alarmLng,
t1.lastlat alarmLat
FROM t_track_stujudge_alarm t1
INNER JOIN (
SELECT alarm_type, max(begintime) begintime
FROM t_track_stujudge_alarm
where alarm_type in (2,3) and delflag = 2 and sn in
<foreach item="item" index="index" collection="snList" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY alarm_type
) t2 ON t2.alarm_type = t1.alarm_type AND t2.begintime = t1.begintime
<where>
t1.delflag = 2
and t1.alarm_type in (2,3)
and t1.sn in
<foreach item="item" index="index" collection="snList" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
package cn.com.glsx;
import com.glsx.plat.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DemoApplicationTests {
@Test
public void test01() {
Date date = DateUtils.addDays(new Date(), -1);
System.out.println("date = " + date.getDate());
}
@Test
public void test02() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
System.out.println("cal = " + new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()));
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.modules.service;
import cn.com.glsx.Application;
import cn.com.glsx.schedulerjob.task.taskscheduler.AlarmDeviceSeparationJob;
import cn.com.glsx.stdinterface.dto.VehicleDto;
import com.dangdang.ddframe.job.api.ShardingContext;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class AlarmJobServiceTest {
@Autowired
private AlarmJobService alarmJobService;
@Autowired
private AlarmDeviceSeparationJob alarmDeviceSeparationJob;
@Autowired
public void setAlarmJobService(AlarmJobService alarmJobService) {
this.alarmJobService = alarmJobService;
}
@Test
public void testSendAlarmMsg() {
alarmJobService.sendAlarmMsg(null);
}
@Test
public void testSendAggregateAlarmMsg() {
alarmJobService.sendAggregateAlarmMsg(null, 2);
}
@Test
public void testListStuJudgeAlarm() {
List<VehicleDto> vehicleDtoList = new ArrayList<>();
VehicleDto v1 = new VehicleDto();
v1.setSn("96210200001");
vehicleDtoList.add(v1);
try {
alarmJobService.listStuJudgeAlarm(vehicleDtoList, null, 3);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Test
public void testSendDeviceLocation() {
String date = "2025-12-01";
alarmJobService.sendDeviceLocation(date);
}
@Test
public void testSendResidentData() {
alarmJobService.sendRegularStopoverPointData();
}
@Test
public void testAlarmDeviceSeparationJob() {
alarmDeviceSeparationJob.execute(null);
}
}
package cn.com.glsx.schedulerjob.task.modules.service;
import cn.com.glsx.Application;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DeleteStayOftenServiceTest {
@Autowired
private DeleteStayOftenService deleteStayOftenService;
@Test
public void deleteStayOftenByPredictDate() {
deleteStayOftenService.deleteStayOftenByPredictDate();
System.out.println("end===");
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.modules.service;
import cn.com.glsx.Application;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DeviceActiveSchedulerJobServiceTest {
@Autowired
private DeviceActiveSchedulerJobService deviceActiveSchedulerJobService;
@Test
public void updateDeviceActiveInfoEveryDay() {
System.out.println("start===");
deviceActiveSchedulerJobService.updateDeviceActiveInfoEveryDay();
System.out.println("end===");
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.modules.service;
import cn.com.glsx.Application;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DeviceFreqServiceTest {
@Autowired
private DeviceFreqService deviceFreqService;
@Test
public void closeDeviceFreq() {
deviceFreqService.closeDeviceFreq();
}
@Test
public void closeDeviceFreqFromDB() {
deviceFreqService.closeDeviceFreqFromDB();
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.modules.service;
import cn.com.glsx.Application;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class InStoreSchedulerJobServiceTest {
@Autowired
InStoreSchedulerJobService inStoreSchedulerJobService;
@Test
void calculateInStoreDateEveryDay() {
System.out.println("inStoreSchedulerJobService start===");
inStoreSchedulerJobService.calculateInStoreDateEveryDay();
System.out.println("inStoreSchedulerJobService end===");
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.modules.service;
import cn.com.glsx.Application;
import cn.com.glsx.stdinterface.api.StatisticsDriveClient;
import com.alibaba.fastjson.JSON;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class MySimpleJobServiceTest {
@Autowired
private MySimpleJobService mySimpleJobService;
@Autowired
private StatisticsDriveClient statisticsDriveClient;
@Test
void statisticsDriveDataEveryDay() {
mySimpleJobService.statisticsDriveDataEveryDay();
System.out.println("结束 ==== ");
}
@Test
public void test01() {
System.out.println("开始调用 ==== " + JSON.toJSONString(statisticsDriveClient));
R statisticsDriveR = statisticsDriveClient.statisticsDriveDataEveryDay();
System.out.println("statisticsDriveR = " + JSON.toJSONString(statisticsDriveR));
}
@Test
public void test02() {
int size = 623 / 100;
System.out.println("size = " + size);
}
@Test
public void test03() {
System.out.println("开始调用 ==== " + JSON.toJSONString(statisticsDriveClient));
R statisticsDriveR = statisticsDriveClient.statisticsAndInsertDriveDataEveryDay();
System.out.println("statisticsDriveR = " + JSON.toJSONString(statisticsDriveR));
}
@Test
public void test04() {
System.out.println("开始调用 ==== " + JSON.toJSONString(statisticsDriveClient));
mySimpleJobService.statisticsDriveDataEveryDay();
}
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.schedulerjob.task.modules.service;
import cn.com.glsx.Application;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
class StatisticsInStoreSchedulerJobServiceTest {
@Autowired
StatisticsInStoreSchedulerJobService statisticsInStoreSchedulerJobService;
@Test
public void calculateInStoreDateEveryDay() {
System.out.println("statisticsInStoreSchedulerJobService start===");
statisticsInStoreSchedulerJobService.calculateStatisticsInStoreDateEveryDay();
System.out.println("statisticsInStoreSchedulerJobService end===");
}
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!