@@ -170,6 +170,30 @@ | |||
</execution> | |||
</executions> | |||
</plugin> | |||
<!--mybatis自动生成代码插件--> | |||
<plugin> | |||
<groupId>org.mybatis.generator</groupId> | |||
<artifactId>mybatis-generator-maven-plugin</artifactId> | |||
<version>1.3.7</version> | |||
<configuration> | |||
<!-- 是否覆盖,true表示会替换生成的JAVA文件,false则不覆盖 --> | |||
<overwrite>false</overwrite> | |||
</configuration> | |||
<dependencies> | |||
<!--mysql驱动包--> | |||
<dependency> | |||
<groupId>mysql</groupId> | |||
<artifactId>mysql-connector-java</artifactId> | |||
<version>8.0.18</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.mybatis.generator</groupId> | |||
<artifactId>mybatis-generator-core</artifactId> | |||
<version>1.3.7</version> | |||
</dependency> | |||
</dependencies> | |||
</plugin> | |||
</plugins> | |||
</build> | |||
@@ -14,7 +14,6 @@ import com.ssjl.zhaobiao.guizhou.repository.GpsDeviceStatusMapper; | |||
import com.ssjl.zhaobiao.guizhou.service.IGZPlatformCmdService; | |||
import com.ssjl.zhaobiao.guizhou.utils.*; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.checkerframework.checker.units.qual.A; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
@@ -45,6 +44,10 @@ public class IotController { | |||
OkHttpUtil okHttpUtil; | |||
@Autowired | |||
IOTApiUtil iotApiUtil; | |||
@Autowired | |||
LocationUtil locationUtil; | |||
@Value("${guizhou.device.zhizhong}") | |||
String zhizhongDevices; | |||
@Value("${guizhou.device.zhanneng}") | |||
@@ -87,16 +90,10 @@ public class IotController { | |||
if(!checkImei(imei, "/online", "")){ | |||
return "success"; | |||
} | |||
GZLocationCDMA cdma = new GZLocationCDMA(); | |||
GZLocationExtend extend = new GZLocationExtend(); | |||
extend.setNetType(GZNetType.CDMA); | |||
extend.setData1(cdma); | |||
byte[] bid = { 0x00, 0x02 }; | |||
cdma.setBID(bid); | |||
byte[] sid = {0x22, 0x41}; | |||
cdma.setSID(sid); | |||
byte[] nid = { 0x36, 0x14}; | |||
cdma.setNID(nid); | |||
// 有缓存则取缓存,没有才取默认值 | |||
GZLocation gzLocation = locationUtil.getLocation(imei); | |||
LocalDateTime time = LocalDateTime.now(); | |||
int power = 50; | |||
GpsDeviceStatus gpsDeviceStatus = gpsDeviceStatusMapper.selectByImei(imei); | |||
@@ -105,15 +102,42 @@ public class IotController { | |||
IOTDeviceStatus status = IOTDeviceStatus.build(statusStr); | |||
power = status.getBattery(); | |||
} | |||
GZDeviceStatus deviceStatus = new GZDeviceStatus(); | |||
deviceStatus.setOpenFirst(true); | |||
GZDevicePower devicePower = new GZDevicePower(); | |||
devicePower.setCharge(false); | |||
devicePower.setPower(power); | |||
LocalDateTime time = LocalDateTime.now(); | |||
GZAskLocation askLocation = new GZAskLocation(imei, time.getHour(),time.getMinute(),time.getSecond(),time.getDayOfMonth(),15976140,0, | |||
63968668,0,0,0, deviceStatus, devicePower, 0, 0, true, extend); | |||
GZAskLocation askLocation; | |||
if(gzLocation == null){ | |||
GZLocationCDMA cdma = new GZLocationCDMA(); | |||
GZLocationExtend extend = new GZLocationExtend(); | |||
extend.setNetType(GZNetType.CDMA); | |||
extend.setData1(cdma); | |||
byte[] bid = { 0x00, 0x02 }; | |||
cdma.setBID(bid); | |||
byte[] sid = {0x22, 0x41}; | |||
cdma.setSID(sid); | |||
byte[] nid = { 0x36, 0x14}; | |||
cdma.setNID(nid); | |||
int lat = 15976140; | |||
int lon = 63968668; | |||
DianxinGzDeviceConfig dianxinGzDeviceConfig = dianxinGzDeviceConfigMapper.selectByImei(imei); | |||
if(dianxinGzDeviceConfig != null && (dianxinGzDeviceConfig.getLat() > 0 || dianxinGzDeviceConfig.getLon() > 0) ){ | |||
lat = dianxinGzDeviceConfig.getLat(); | |||
lon = dianxinGzDeviceConfig.getLon(); | |||
} | |||
askLocation = new GZAskLocation(imei, time.getHour(),time.getMinute(),time.getSecond(),time.getDayOfMonth(),lat,0, | |||
lon,0,0,0, deviceStatus, devicePower, 0, 0, true, extend); | |||
}else{ | |||
askLocation = new GZAskLocation(imei, time.getHour(),time.getMinute(),time.getSecond(),time.getDayOfMonth(),gzLocation.getLatitude(),0, | |||
gzLocation.getLongitude(),0,0,0, deviceStatus, devicePower, gzLocation.getSignalIntensity(), gzLocation.getGpsAmount(), gzLocation.isGpsRough(), gzLocation.getExtend()); | |||
} | |||
GZRequest req = new GZRequest(); | |||
req.setImei(imei); | |||
@@ -175,13 +199,23 @@ public class IotController { | |||
power.setCharge(false); | |||
power.setPower(iotDeviceStatus.getBattery()); | |||
// 更新历史定位 | |||
int lat = GZUtil.convertLocation(gps.getLatitude()); | |||
int lon = GZUtil.convertLocation(gps.getLongitude()); | |||
gzDeviceConfig.setLat(lat); | |||
gzDeviceConfig.setLon(lon); | |||
dianxinGzDeviceConfigMapper.updateByPrimaryKey(gzDeviceConfig); | |||
LocalDateTime time = LocalDateTime.now(); | |||
GZLocation location = new GZLocation(time.getHour(), time.getMinute(),time.getSecond(), time.getDayOfMonth(), | |||
GZUtil.convertLocation(gps.getLatitude()), 0, GZUtil.convertLocation(gps.getLongitude()), 0, 0, 0, | |||
lat, 0, lon, 0, 0, 0, | |||
deviceStatus, power, 70, 3, false, extend); | |||
req.setContent(location); | |||
locationUtil.saveLocation(imei, location); | |||
byte[] b = req.toByte(); | |||
System.out.println(ByteUtil.bytesToHexString(b)); | |||
String phone = gzDeviceConfig == null ? "" : gzDeviceConfig.getPhone(); | |||
@@ -221,6 +255,7 @@ public class IotController { | |||
location = new GZLocation(time.getHour(), time.getMinute(),time.getSecond(), time.getDayOfMonth(), | |||
0, 0, 0, 0, 0, 0, | |||
deviceStatus, power, 70, 0, true, extend); | |||
locationUtil.saveLocation(imei, location); | |||
}else{ | |||
// CDMA | |||
String[] bts = lbs.getBts().split(","); | |||
@@ -236,6 +271,7 @@ public class IotController { | |||
location = new GZLocation(time.getHour(), time.getMinute(),time.getSecond(), time.getDayOfMonth(), | |||
GZUtil.convertLocation(lat), 0, GZUtil.convertLocation(lon), 0, 0, 0, | |||
deviceStatus, power, signal, 0, true, extend); | |||
locationUtil.saveLocation(imei, location); | |||
} | |||
byte[] res = httpUtil.send(imei, gzDeviceConfig.getPhone(), location); | |||
@@ -279,6 +315,7 @@ public class IotController { | |||
GZLocation location = new GZLocation(time.getHour(), time.getMinute(),time.getSecond(), time.getDayOfMonth(), | |||
0, 0, 0, 0, 0, 0, | |||
deviceStatus, power, 0, 0, true, extend); | |||
locationUtil.saveLocation(imei, location); | |||
byte[] res = httpUtil.send(imei, gzDeviceConfig.getPhone(), location); | |||
System.out.println(ByteUtil.bytesToHexString(res)); | |||
log.info(imei + ",wifi 电信返回:" + ByteUtil.bytesToHexString(res)); | |||
@@ -1,233 +0,0 @@ | |||
package com.ssjl.zhaobiao.guizhou.entity; | |||
public class DianxinGzDeviceConfig { | |||
private Integer id; | |||
private String deviceImei; | |||
private String httpIp; | |||
private String httpUrl; | |||
private String smsNumber; | |||
private String locationInterval; | |||
private String sleepTime; | |||
private String affectionPhone; | |||
private String sosPhone; | |||
private String whitePhone; | |||
private String smsWhitePhone; | |||
private String phone; | |||
private String clockTime; | |||
private String smsSet; | |||
private String addressBook; | |||
private String syncTime; | |||
private String tcpAddress; | |||
private String autoShutdown; | |||
private String callTime; | |||
private String locationMode; | |||
private String connectType; | |||
private String phoneType; | |||
private String rfid; | |||
public Integer getId() { | |||
return id; | |||
} | |||
public void setId(Integer id) { | |||
this.id = id; | |||
} | |||
public String getDeviceImei() { | |||
return deviceImei; | |||
} | |||
public void setDeviceImei(String deviceImei) { | |||
this.deviceImei = deviceImei == null ? null : deviceImei.trim(); | |||
} | |||
public String getHttpIp() { | |||
return httpIp; | |||
} | |||
public void setHttpIp(String httpIp) { | |||
this.httpIp = httpIp == null ? null : httpIp.trim(); | |||
} | |||
public String getHttpUrl() { | |||
return httpUrl; | |||
} | |||
public void setHttpUrl(String httpUrl) { | |||
this.httpUrl = httpUrl == null ? null : httpUrl.trim(); | |||
} | |||
public String getSmsNumber() { | |||
return smsNumber; | |||
} | |||
public void setSmsNumber(String smsNumber) { | |||
this.smsNumber = smsNumber == null ? null : smsNumber.trim(); | |||
} | |||
public String getLocationInterval() { | |||
return locationInterval; | |||
} | |||
public void setLocationInterval(String locationInterval) { | |||
this.locationInterval = locationInterval == null ? null : locationInterval.trim(); | |||
} | |||
public String getSleepTime() { | |||
return sleepTime; | |||
} | |||
public void setSleepTime(String sleepTime) { | |||
this.sleepTime = sleepTime == null ? null : sleepTime.trim(); | |||
} | |||
public String getAffectionPhone() { | |||
return affectionPhone; | |||
} | |||
public void setAffectionPhone(String affectionPhone) { | |||
this.affectionPhone = affectionPhone == null ? null : affectionPhone.trim(); | |||
} | |||
public String getSosPhone() { | |||
return sosPhone; | |||
} | |||
public void setSosPhone(String sosPhone) { | |||
this.sosPhone = sosPhone == null ? null : sosPhone.trim(); | |||
} | |||
public String getWhitePhone() { | |||
return whitePhone; | |||
} | |||
public void setWhitePhone(String whitePhone) { | |||
this.whitePhone = whitePhone == null ? null : whitePhone.trim(); | |||
} | |||
public String getSmsWhitePhone() { | |||
return smsWhitePhone; | |||
} | |||
public void setSmsWhitePhone(String smsWhitePhone) { | |||
this.smsWhitePhone = smsWhitePhone == null ? null : smsWhitePhone.trim(); | |||
} | |||
public String getPhone() { | |||
return phone; | |||
} | |||
public void setPhone(String phone) { | |||
this.phone = phone == null ? null : phone.trim(); | |||
} | |||
public String getClockTime() { | |||
return clockTime; | |||
} | |||
public void setClockTime(String clockTime) { | |||
this.clockTime = clockTime == null ? null : clockTime.trim(); | |||
} | |||
public String getSmsSet() { | |||
return smsSet; | |||
} | |||
public void setSmsSet(String smsSet) { | |||
this.smsSet = smsSet == null ? null : smsSet.trim(); | |||
} | |||
public String getAddressBook() { | |||
return addressBook; | |||
} | |||
public void setAddressBook(String addressBook) { | |||
this.addressBook = addressBook == null ? null : addressBook.trim(); | |||
} | |||
public String getSyncTime() { | |||
return syncTime; | |||
} | |||
public void setSyncTime(String syncTime) { | |||
this.syncTime = syncTime == null ? null : syncTime.trim(); | |||
} | |||
public String getTcpAddress() { | |||
return tcpAddress; | |||
} | |||
public void setTcpAddress(String tcpAddress) { | |||
this.tcpAddress = tcpAddress == null ? null : tcpAddress.trim(); | |||
} | |||
public String getAutoShutdown() { | |||
return autoShutdown; | |||
} | |||
public void setAutoShutdown(String autoShutdown) { | |||
this.autoShutdown = autoShutdown == null ? null : autoShutdown.trim(); | |||
} | |||
public String getCallTime() { | |||
return callTime; | |||
} | |||
public void setCallTime(String callTime) { | |||
this.callTime = callTime == null ? null : callTime.trim(); | |||
} | |||
public String getLocationMode() { | |||
return locationMode; | |||
} | |||
public void setLocationMode(String locationMode) { | |||
this.locationMode = locationMode == null ? null : locationMode.trim(); | |||
} | |||
public String getConnectType() { | |||
return connectType; | |||
} | |||
public void setConnectType(String connectType) { | |||
this.connectType = connectType == null ? null : connectType.trim(); | |||
} | |||
public String getPhoneType() { | |||
return phoneType; | |||
} | |||
public void setPhoneType(String phoneType) { | |||
this.phoneType = phoneType == null ? null : phoneType.trim(); | |||
} | |||
public String getRfid() { | |||
return rfid; | |||
} | |||
public void setRfid(String rfid) { | |||
this.rfid = rfid == null ? null : rfid.trim(); | |||
} | |||
} |
@@ -121,4 +121,133 @@ public class GZLocation implements IMessageContent { | |||
// i += cellBytes.length; | |||
return list; | |||
} | |||
public int getHour() { | |||
return hour; | |||
} | |||
public void setHour(int hour) { | |||
this.hour = hour; | |||
} | |||
public int getMinute() { | |||
return minute; | |||
} | |||
public void setMinute(int minute) { | |||
this.minute = minute; | |||
} | |||
public int getSecond() { | |||
return second; | |||
} | |||
public void setSecond(int second) { | |||
this.second = second; | |||
} | |||
public int getDay() { | |||
return day; | |||
} | |||
public void setDay(int day) { | |||
this.day = day; | |||
} | |||
public int getLatitude() { | |||
return latitude; | |||
} | |||
public void setLatitude(int latitude) { | |||
this.latitude = latitude; | |||
} | |||
public int getLatitudeDirect() { | |||
return latitudeDirect; | |||
} | |||
public void setLatitudeDirect(int latitudeDirect) { | |||
this.latitudeDirect = latitudeDirect; | |||
} | |||
public int getLongitude() { | |||
return longitude; | |||
} | |||
public void setLongitude(int longitude) { | |||
this.longitude = longitude; | |||
} | |||
public int getLongitudeDirect() { | |||
return longitudeDirect; | |||
} | |||
public void setLongitudeDirect(int longitudeDirect) { | |||
this.longitudeDirect = longitudeDirect; | |||
} | |||
public int getSpeed() { | |||
return speed; | |||
} | |||
public void setSpeed(int speed) { | |||
this.speed = speed; | |||
} | |||
public int getDirect() { | |||
return direct; | |||
} | |||
public void setDirect(int direct) { | |||
this.direct = direct; | |||
} | |||
public GZDeviceStatus getStatus() { | |||
return status; | |||
} | |||
public void setStatus(GZDeviceStatus status) { | |||
this.status = status; | |||
} | |||
public GZDevicePower getPower() { | |||
return power; | |||
} | |||
public void setPower(GZDevicePower power) { | |||
this.power = power; | |||
} | |||
public int getSignalIntensity() { | |||
return signalIntensity; | |||
} | |||
public void setSignalIntensity(int signalIntensity) { | |||
this.signalIntensity = signalIntensity; | |||
} | |||
public int getGpsAmount() { | |||
return gpsAmount; | |||
} | |||
public void setGpsAmount(int gpsAmount) { | |||
this.gpsAmount = gpsAmount; | |||
} | |||
public boolean isGpsRough() { | |||
return gpsRough; | |||
} | |||
public void setGpsRough(boolean gpsRough) { | |||
this.gpsRough = gpsRough; | |||
} | |||
public GZLocationExtend getExtend() { | |||
return extend; | |||
} | |||
public void setExtend(GZLocationExtend extend) { | |||
this.extend = extend; | |||
} | |||
} |
@@ -7,7 +7,6 @@ import com.ssjl.zhaobiao.guizhou.entity.GZMessage.GZHeart; | |||
import com.ssjl.zhaobiao.guizhou.entity.IOT.IOTDeviceStatus; | |||
import com.ssjl.zhaobiao.guizhou.repository.DianxinGzDeviceConfigMapper; | |||
import com.ssjl.zhaobiao.guizhou.repository.GpsDeviceStatusMapper; | |||
import com.ssjl.zhaobiao.guizhou.utils.ByteUtil; | |||
import com.ssjl.zhaobiao.guizhou.utils.GZHttpUtil; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.quartz.DisallowConcurrentExecution; | |||
@@ -0,0 +1,41 @@ | |||
package com.ssjl.zhaobiao.guizhou.quartz.job; | |||
import com.alibaba.fastjson.JSON; | |||
import com.ssjl.zhaobiao.guizhou.entity.DianxinGzDeviceConfig; | |||
import com.ssjl.zhaobiao.guizhou.entity.IOTDevice; | |||
import com.ssjl.zhaobiao.guizhou.repository.DianxinGzDeviceConfigMapper; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.quartz.DisallowConcurrentExecution; | |||
import org.quartz.JobExecutionContext; | |||
import org.quartz.JobExecutionException; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.quartz.QuartzJobBean; | |||
import java.util.List; | |||
//此注解标记任务不并发,任务执行完后才开始下一次任务 | |||
@DisallowConcurrentExecution | |||
@Slf4j | |||
public class GZLocationSend extends QuartzJobBean { | |||
@Autowired | |||
DianxinGzDeviceConfigMapper dianxinGzDeviceConfigMapper; | |||
@Value("${guizhou.device.testList}") | |||
String testList; | |||
@Override | |||
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException { | |||
List<IOTDevice> deviceList = JSON.parseArray(testList, IOTDevice.class); | |||
for (int i = 0; i < deviceList.size(); i++) { | |||
IOTDevice device = deviceList.get(i); | |||
try{ | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
} | |||
} | |||
} | |||
} |
@@ -1,21 +0,0 @@ | |||
package com.ssjl.zhaobiao.guizhou.repository; | |||
import com.ssjl.zhaobiao.guizhou.entity.DianxinGzDeviceConfig; | |||
public interface DianxinGzDeviceConfigMapper { | |||
int deleteByPrimaryKey(Integer id); | |||
int insert(DianxinGzDeviceConfig record); | |||
int insertSelective(DianxinGzDeviceConfig record); | |||
DianxinGzDeviceConfig selectByPrimaryKey(Integer id); | |||
int updateByPrimaryKeySelective(DianxinGzDeviceConfig record); | |||
int updateByPrimaryKey(DianxinGzDeviceConfig record); | |||
DianxinGzDeviceConfig selectByImei(String imei); | |||
DianxinGzDeviceConfig selectByPhone(String phone); | |||
} |
@@ -7,10 +7,8 @@ import com.ssjl.zhaobiao.guizhou.entity.GZMessage.GZUpDeviceConfig; | |||
import com.ssjl.zhaobiao.guizhou.repository.DianxinGzDeviceConfigMapper; | |||
import com.ssjl.zhaobiao.guizhou.repository.GpsDeviceConfigMapper; | |||
import com.ssjl.zhaobiao.guizhou.service.IGZPlatformCmdService; | |||
import com.ssjl.zhaobiao.guizhou.service.IGZPlatformService; | |||
import com.ssjl.zhaobiao.guizhou.utils.ByteUtil; | |||
import com.ssjl.zhaobiao.guizhou.utils.GZHttpUtil; | |||
import org.checkerframework.checker.units.qual.A; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Service; | |||
@@ -3,7 +3,6 @@ package com.ssjl.zhaobiao.guizhou.service.impl; | |||
import com.alibaba.fastjson.JSON; | |||
import com.google.common.base.Strings; | |||
import com.ssjl.zhaobiao.guizhou.entity.DianxinGzDeviceConfig; | |||
import com.ssjl.zhaobiao.guizhou.entity.GZDeviceFlagType; | |||
import com.ssjl.zhaobiao.guizhou.entity.GZMessage.GZLocationInterval; | |||
import com.ssjl.zhaobiao.guizhou.entity.GZMessage.GZPlatformDeviceConfig; | |||
import com.ssjl.zhaobiao.guizhou.entity.GZRequestStatus; | |||
@@ -0,0 +1,45 @@ | |||
package com.ssjl.zhaobiao.guizhou.utils; | |||
import com.ssjl.zhaobiao.guizhou.entity.GZMessage.GZLocation; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
@Component | |||
public class LocationUtil { | |||
private Map<String, LocalDateTime> timeMap; | |||
private Map<String, GZLocation> gzLocationMap; | |||
public LocationUtil(){ | |||
timeMap = new HashMap<>(); | |||
gzLocationMap = new HashMap<>(); | |||
} | |||
public void saveLocation(String imei, GZLocation location){ | |||
gzLocationMap.put(imei, location); | |||
} | |||
public GZLocation getLocation(String imei){ | |||
if(gzLocationMap.containsKey(imei)){ | |||
return gzLocationMap.get(imei); | |||
} | |||
return null; | |||
} | |||
public void saveTime(String imei, LocalDateTime time){ | |||
timeMap.put(imei, time); | |||
} | |||
public LocalDateTime getTime(String imei){ | |||
if(timeMap.containsKey(imei)){ | |||
return timeMap.get(imei); | |||
} | |||
return null; | |||
} | |||
} |
@@ -40,20 +40,20 @@ netty.port=8888 | |||
# \u8D35\u5DDE\u7535\u4FE1\u53C2\u6570 | |||
guizhou.protocol=T01.4 | |||
#guizhou.factory=telpo | |||
#guizhou.device.model=TPS401 | |||
#guizhou.device.version=ACB_1001 | |||
#guizhou.device.testList= [{ "imei": "862622050253671","phone": "" },{ "imei": "862622050253358","phone": "" },{ "imei": "800115470000678","phone": "" }] | |||
guizhou.factory=telpo | |||
guizhou.device.model=TPS401 | |||
guizhou.device.version=ACB_1001 | |||
guizhou.device.testList= [{ "imei": "862622050253671","phone": "" },{ "imei": "862622050253358","phone": "" },{ "imei": "800115470000678","phone": "" }] | |||
#guizhou.factory=zhizhong | |||
#guizhou.device.model=RZL600 | |||
#guizhou.device.version=RZL_2021 | |||
#guizhou.device.testList= [{ "imei": "862622050654340","phone": "" },{ "imei": "862622050317740","phone": "" }] | |||
guizhou.factory=zhanneng | |||
guizhou.device.model=TPE390 | |||
guizhou.device.version=TPE_0056 | |||
guizhou.device.testList= [{ "imei": "862622050925104","phone": "" },{ "imei": "862622050927027","phone": "" }] | |||
#guizhou.factory=zhanneng | |||
#guizhou.device.model=TPE390 | |||
#guizhou.device.version=TPE_0056 | |||
#guizhou.device.testList= [{ "imei": "862622050925104","phone": "" },{ "imei": "862622050927027","phone": "" }] | |||
guizhou.http.url=http://120.24.195.54:24183 | |||
@@ -35,15 +35,15 @@ | |||
</javaClientGenerator> | |||
<!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> | |||
<!--<table tableName="dianxin_gz_device_config" enableCountByExample="false" enableUpdateByExample="false"--> | |||
<!--enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>--> | |||
<table tableName="dianxin_gz_device_config" enableCountByExample="false" enableUpdateByExample="false" | |||
enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> | |||
<!--<table tableName="gps_device" enableCountByExample="false" enableUpdateByExample="false"--> | |||
<!--enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>--> | |||
<!--<table tableName="gps_device_commandvalue" enableCountByExample="false" enableUpdateByExample="false"--> | |||
<!--enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>--> | |||
<!--<table tableName="gps_device_config" enableCountByExample="false" enableUpdateByExample="false"--> | |||
<!--enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>--> | |||
<table tableName="gps_device_status" enableCountByExample="false" enableUpdateByExample="false" | |||
enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table> | |||
<!--<table tableName="gps_device_status" enableCountByExample="false" enableUpdateByExample="false"--> | |||
<!--enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>--> | |||
</context> | |||
</generatorConfiguration> |
@@ -1,313 +0,0 @@ | |||
<?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.ssjl.zhaobiao.guizhou.repository.DianxinGzDeviceConfigMapper"> | |||
<resultMap id="BaseResultMap" type="com.ssjl.zhaobiao.guizhou.entity.DianxinGzDeviceConfig"> | |||
<id column="id" jdbcType="INTEGER" property="id" /> | |||
<result column="device_imei" jdbcType="VARCHAR" property="deviceImei" /> | |||
<result column="http_ip" jdbcType="VARCHAR" property="httpIp" /> | |||
<result column="http_url" jdbcType="VARCHAR" property="httpUrl" /> | |||
<result column="sms_number" jdbcType="VARCHAR" property="smsNumber" /> | |||
<result column="location_interval" jdbcType="VARCHAR" property="locationInterval" /> | |||
<result column="sleep_time" jdbcType="VARCHAR" property="sleepTime" /> | |||
<result column="affection_phone" jdbcType="VARCHAR" property="affectionPhone" /> | |||
<result column="sos_phone" jdbcType="VARCHAR" property="sosPhone" /> | |||
<result column="white_phone" jdbcType="VARCHAR" property="whitePhone" /> | |||
<result column="sms_white_phone" jdbcType="VARCHAR" property="smsWhitePhone" /> | |||
<result column="phone" jdbcType="VARCHAR" property="phone" /> | |||
<result column="clock_time" jdbcType="VARCHAR" property="clockTime" /> | |||
<result column="sms_set" jdbcType="VARCHAR" property="smsSet" /> | |||
<result column="address_book" jdbcType="VARCHAR" property="addressBook" /> | |||
<result column="sync_time" jdbcType="VARCHAR" property="syncTime" /> | |||
<result column="tcp_address" jdbcType="VARCHAR" property="tcpAddress" /> | |||
<result column="auto_shutdown" jdbcType="VARCHAR" property="autoShutdown" /> | |||
<result column="call_time" jdbcType="VARCHAR" property="callTime" /> | |||
<result column="location_mode" jdbcType="VARCHAR" property="locationMode" /> | |||
<result column="connect_type" jdbcType="VARCHAR" property="connectType" /> | |||
<result column="phone_type" jdbcType="VARCHAR" property="phoneType" /> | |||
<result column="rfid" jdbcType="VARCHAR" property="rfid" /> | |||
</resultMap> | |||
<sql id="Base_Column_List"> | |||
id, device_imei, http_ip, http_url, sms_number, location_interval, sleep_time, affection_phone, | |||
sos_phone, white_phone, sms_white_phone, phone, clock_time, sms_set, address_book, | |||
sync_time, tcp_address, auto_shutdown, call_time, location_mode, connect_type, phone_type, | |||
rfid | |||
</sql> | |||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | |||
select | |||
<include refid="Base_Column_List" /> | |||
from dianxin_gz_device_config | |||
where id = #{id,jdbcType=INTEGER} | |||
</select> | |||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |||
delete from dianxin_gz_device_config | |||
where id = #{id,jdbcType=INTEGER} | |||
</delete> | |||
<insert id="insert" parameterType="com.ssjl.zhaobiao.guizhou.entity.DianxinGzDeviceConfig"> | |||
insert into dianxin_gz_device_config (id, device_imei, http_ip, | |||
http_url, sms_number, location_interval, | |||
sleep_time, affection_phone, sos_phone, | |||
white_phone, sms_white_phone, phone, | |||
clock_time, sms_set, address_book, | |||
sync_time, tcp_address, auto_shutdown, | |||
call_time, location_mode, connect_type, | |||
phone_type, rfid) | |||
values (#{id,jdbcType=INTEGER}, #{deviceImei,jdbcType=VARCHAR}, #{httpIp,jdbcType=VARCHAR}, | |||
#{httpUrl,jdbcType=VARCHAR}, #{smsNumber,jdbcType=VARCHAR}, #{locationInterval,jdbcType=VARCHAR}, | |||
#{sleepTime,jdbcType=VARCHAR}, #{affectionPhone,jdbcType=VARCHAR}, #{sosPhone,jdbcType=VARCHAR}, | |||
#{whitePhone,jdbcType=VARCHAR}, #{smsWhitePhone,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, | |||
#{clockTime,jdbcType=VARCHAR}, #{smsSet,jdbcType=VARCHAR}, #{addressBook,jdbcType=VARCHAR}, | |||
#{syncTime,jdbcType=VARCHAR}, #{tcpAddress,jdbcType=VARCHAR}, #{autoShutdown,jdbcType=VARCHAR}, | |||
#{callTime,jdbcType=VARCHAR}, #{locationMode,jdbcType=VARCHAR}, #{connectType,jdbcType=VARCHAR}, | |||
#{phoneType,jdbcType=VARCHAR}, #{rfid,jdbcType=VARCHAR}) | |||
</insert> | |||
<insert id="insertSelective" parameterType="com.ssjl.zhaobiao.guizhou.entity.DianxinGzDeviceConfig"> | |||
insert into dianxin_gz_device_config | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
<if test="id != null"> | |||
id, | |||
</if> | |||
<if test="deviceImei != null"> | |||
device_imei, | |||
</if> | |||
<if test="httpIp != null"> | |||
http_ip, | |||
</if> | |||
<if test="httpUrl != null"> | |||
http_url, | |||
</if> | |||
<if test="smsNumber != null"> | |||
sms_number, | |||
</if> | |||
<if test="locationInterval != null"> | |||
location_interval, | |||
</if> | |||
<if test="sleepTime != null"> | |||
sleep_time, | |||
</if> | |||
<if test="affectionPhone != null"> | |||
affection_phone, | |||
</if> | |||
<if test="sosPhone != null"> | |||
sos_phone, | |||
</if> | |||
<if test="whitePhone != null"> | |||
white_phone, | |||
</if> | |||
<if test="smsWhitePhone != null"> | |||
sms_white_phone, | |||
</if> | |||
<if test="phone != null"> | |||
phone, | |||
</if> | |||
<if test="clockTime != null"> | |||
clock_time, | |||
</if> | |||
<if test="smsSet != null"> | |||
sms_set, | |||
</if> | |||
<if test="addressBook != null"> | |||
address_book, | |||
</if> | |||
<if test="syncTime != null"> | |||
sync_time, | |||
</if> | |||
<if test="tcpAddress != null"> | |||
tcp_address, | |||
</if> | |||
<if test="autoShutdown != null"> | |||
auto_shutdown, | |||
</if> | |||
<if test="callTime != null"> | |||
call_time, | |||
</if> | |||
<if test="locationMode != null"> | |||
location_mode, | |||
</if> | |||
<if test="connectType != null"> | |||
connect_type, | |||
</if> | |||
<if test="phoneType != null"> | |||
phone_type, | |||
</if> | |||
<if test="rfid != null"> | |||
rfid, | |||
</if> | |||
</trim> | |||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||
<if test="id != null"> | |||
#{id,jdbcType=INTEGER}, | |||
</if> | |||
<if test="deviceImei != null"> | |||
#{deviceImei,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="httpIp != null"> | |||
#{httpIp,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="httpUrl != null"> | |||
#{httpUrl,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="smsNumber != null"> | |||
#{smsNumber,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="locationInterval != null"> | |||
#{locationInterval,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="sleepTime != null"> | |||
#{sleepTime,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="affectionPhone != null"> | |||
#{affectionPhone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="sosPhone != null"> | |||
#{sosPhone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="whitePhone != null"> | |||
#{whitePhone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="smsWhitePhone != null"> | |||
#{smsWhitePhone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="phone != null"> | |||
#{phone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="clockTime != null"> | |||
#{clockTime,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="smsSet != null"> | |||
#{smsSet,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="addressBook != null"> | |||
#{addressBook,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="syncTime != null"> | |||
#{syncTime,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="tcpAddress != null"> | |||
#{tcpAddress,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="autoShutdown != null"> | |||
#{autoShutdown,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="callTime != null"> | |||
#{callTime,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="locationMode != null"> | |||
#{locationMode,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="connectType != null"> | |||
#{connectType,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="phoneType != null"> | |||
#{phoneType,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="rfid != null"> | |||
#{rfid,jdbcType=VARCHAR}, | |||
</if> | |||
</trim> | |||
</insert> | |||
<update id="updateByPrimaryKeySelective" parameterType="com.ssjl.zhaobiao.guizhou.entity.DianxinGzDeviceConfig"> | |||
update dianxin_gz_device_config | |||
<set> | |||
<if test="deviceImei != null"> | |||
device_imei = #{deviceImei,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="httpIp != null"> | |||
http_ip = #{httpIp,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="httpUrl != null"> | |||
http_url = #{httpUrl,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="smsNumber != null"> | |||
sms_number = #{smsNumber,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="locationInterval != null"> | |||
location_interval = #{locationInterval,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="sleepTime != null"> | |||
sleep_time = #{sleepTime,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="affectionPhone != null"> | |||
affection_phone = #{affectionPhone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="sosPhone != null"> | |||
sos_phone = #{sosPhone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="whitePhone != null"> | |||
white_phone = #{whitePhone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="smsWhitePhone != null"> | |||
sms_white_phone = #{smsWhitePhone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="phone != null"> | |||
phone = #{phone,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="clockTime != null"> | |||
clock_time = #{clockTime,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="smsSet != null"> | |||
sms_set = #{smsSet,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="addressBook != null"> | |||
address_book = #{addressBook,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="syncTime != null"> | |||
sync_time = #{syncTime,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="tcpAddress != null"> | |||
tcp_address = #{tcpAddress,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="autoShutdown != null"> | |||
auto_shutdown = #{autoShutdown,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="callTime != null"> | |||
call_time = #{callTime,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="locationMode != null"> | |||
location_mode = #{locationMode,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="connectType != null"> | |||
connect_type = #{connectType,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="phoneType != null"> | |||
phone_type = #{phoneType,jdbcType=VARCHAR}, | |||
</if> | |||
<if test="rfid != null"> | |||
rfid = #{rfid,jdbcType=VARCHAR}, | |||
</if> | |||
</set> | |||
where id = #{id,jdbcType=INTEGER} | |||
</update> | |||
<update id="updateByPrimaryKey" parameterType="com.ssjl.zhaobiao.guizhou.entity.DianxinGzDeviceConfig"> | |||
update dianxin_gz_device_config | |||
set device_imei = #{deviceImei,jdbcType=VARCHAR}, | |||
http_ip = #{httpIp,jdbcType=VARCHAR}, | |||
http_url = #{httpUrl,jdbcType=VARCHAR}, | |||
sms_number = #{smsNumber,jdbcType=VARCHAR}, | |||
location_interval = #{locationInterval,jdbcType=VARCHAR}, | |||
sleep_time = #{sleepTime,jdbcType=VARCHAR}, | |||
affection_phone = #{affectionPhone,jdbcType=VARCHAR}, | |||
sos_phone = #{sosPhone,jdbcType=VARCHAR}, | |||
white_phone = #{whitePhone,jdbcType=VARCHAR}, | |||
sms_white_phone = #{smsWhitePhone,jdbcType=VARCHAR}, | |||
phone = #{phone,jdbcType=VARCHAR}, | |||
clock_time = #{clockTime,jdbcType=VARCHAR}, | |||
sms_set = #{smsSet,jdbcType=VARCHAR}, | |||
address_book = #{addressBook,jdbcType=VARCHAR}, | |||
sync_time = #{syncTime,jdbcType=VARCHAR}, | |||
tcp_address = #{tcpAddress,jdbcType=VARCHAR}, | |||
auto_shutdown = #{autoShutdown,jdbcType=VARCHAR}, | |||
call_time = #{callTime,jdbcType=VARCHAR}, | |||
location_mode = #{locationMode,jdbcType=VARCHAR}, | |||
connect_type = #{connectType,jdbcType=VARCHAR}, | |||
phone_type = #{phoneType,jdbcType=VARCHAR}, | |||
rfid = #{rfid,jdbcType=VARCHAR} | |||
where id = #{id,jdbcType=INTEGER} | |||
</update> | |||
<select id="selectByImei" resultMap="BaseResultMap"> | |||
SELECT * FROM dianxin_gz_device_config WHERE device_imei=#{imei}; | |||
</select> | |||
<select id="selectByPhone" resultMap="BaseResultMap"> | |||
SELECT * FROM dianxin_gz_device_config WHERE phone = #{phone}; | |||
</select> | |||
</mapper> |
@@ -17,7 +17,9 @@ import org.springframework.boot.test.context.SpringBootTest; | |||
import java.io.IOException; | |||
import java.time.LocalDateTime; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
@SpringBootTest | |||
class CenterApplicationTests { | |||
@@ -199,41 +201,9 @@ class CenterApplicationTests { | |||
@Test | |||
public void test4(){ | |||
int tag=0x21; | |||
String PhoneNumber="13439301795"; | |||
int CallFlag=1; | |||
int Duration=30; | |||
String DateTime="2101141805"; | |||
//1 CallOut 0 CallIn | |||
byte[] list = new byte[18]; | |||
int i=0; | |||
list[i++] = (byte)tag; | |||
byte[] phone=GZUtil.phoneToByte(PhoneNumber); | |||
System.arraycopy(phone, 0, list, i, phone.length); | |||
i+=phone.length; | |||
if(CallFlag==1&&Duration>0){ | |||
list[i++] = (byte)0x00; | |||
} | |||
else if(CallFlag==1&&Duration==0){ | |||
list[i++] = (byte)0x01; | |||
} | |||
else if(CallFlag==0&&Duration>0){ | |||
list[i++] = (byte)0x02; | |||
} | |||
else if(CallFlag==0&&Duration==0){ | |||
list[i++] = (byte)0x03; | |||
} | |||
else { | |||
list[i++] = (byte)0x04; | |||
} | |||
byte[] duration= ByteUtil.toByte(Duration, 2); | |||
System.arraycopy(duration, 0, list, i, duration.length); | |||
i+=duration.length; | |||
byte[] time=ByteUtil.hexToByteArray(DateTime); | |||
System.arraycopy(time, 0, list, i, time.length); | |||
System.out.println(ByteUtil.bytesToHexString(list)); | |||
Map<String, Integer> map = new HashMap<>(); | |||
map.put("abc", 2); | |||
map.put("abc", 3); | |||
} | |||
} |