diff --git a/pom.xml b/pom.xml index 3bf9de5..e9856ed 100644 --- a/pom.xml +++ b/pom.xml @@ -170,6 +170,30 @@ + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + + false + + + + + mysql + mysql-connector-java + 8.0.18 + + + org.mybatis.generator + mybatis-generator-core + 1.3.7 + + + + diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/controller/IotController.java b/src/main/java/com/ssjl/zhaobiao/guizhou/controller/IotController.java index 8549d4c..436c853 100644 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/controller/IotController.java +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/controller/IotController.java @@ -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)); diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/entity/DianxinGzDeviceConfig.java b/src/main/java/com/ssjl/zhaobiao/guizhou/entity/DianxinGzDeviceConfig.java deleted file mode 100644 index a1680a7..0000000 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/entity/DianxinGzDeviceConfig.java +++ /dev/null @@ -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(); - } -} \ No newline at end of file diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/entity/GZMessage/GZLocation.java b/src/main/java/com/ssjl/zhaobiao/guizhou/entity/GZMessage/GZLocation.java index 79dd678..8e6650a 100644 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/entity/GZMessage/GZLocation.java +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/entity/GZMessage/GZLocation.java @@ -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; + } } diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZHeartJob.java b/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZHeartJob.java index a6455a4..d3f9b9c 100644 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZHeartJob.java +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZHeartJob.java @@ -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; diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZLocationSend.java b/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZLocationSend.java new file mode 100644 index 0000000..b4cc072 --- /dev/null +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/quartz/job/GZLocationSend.java @@ -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 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(); + } + } + } +} diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/repository/DianxinGzDeviceConfigMapper.java b/src/main/java/com/ssjl/zhaobiao/guizhou/repository/DianxinGzDeviceConfigMapper.java deleted file mode 100644 index 690036d..0000000 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/repository/DianxinGzDeviceConfigMapper.java +++ /dev/null @@ -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); -} \ No newline at end of file diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformCmdService.java b/src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformCmdService.java index 1c6874b..be0e658 100644 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformCmdService.java +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformCmdService.java @@ -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; diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformSettingService.java b/src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformSettingService.java index 9b5a9b8..a56da3a 100644 --- a/src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformSettingService.java +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/service/impl/GZPlatformSettingService.java @@ -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; diff --git a/src/main/java/com/ssjl/zhaobiao/guizhou/utils/LocationUtil.java b/src/main/java/com/ssjl/zhaobiao/guizhou/utils/LocationUtil.java new file mode 100644 index 0000000..6490546 --- /dev/null +++ b/src/main/java/com/ssjl/zhaobiao/guizhou/utils/LocationUtil.java @@ -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 timeMap; + + private Map 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; + } + + + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index e9db67d..6a0e00d 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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 diff --git a/src/main/resources/generatorConfig.xml b/src/main/resources/generatorConfig.xml index 5248f10..f189d82 100644 --- a/src/main/resources/generatorConfig.xml +++ b/src/main/resources/generatorConfig.xml @@ -35,15 +35,15 @@ - - +
-
+ + \ No newline at end of file diff --git a/src/main/resources/mapper/DianxinGzDeviceConfigMapper.xml b/src/main/resources/mapper/DianxinGzDeviceConfigMapper.xml deleted file mode 100644 index f4eabb7..0000000 --- a/src/main/resources/mapper/DianxinGzDeviceConfigMapper.xml +++ /dev/null @@ -1,313 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - delete from dianxin_gz_device_config - where id = #{id,jdbcType=INTEGER} - - - 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 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, - - - - - #{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}, - - - - - update dianxin_gz_device_config - - - 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 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} - - - - - \ No newline at end of file diff --git a/src/test/java/com/ssjl/zhaobiao/guizhou/CenterApplicationTests.java b/src/test/java/com/ssjl/zhaobiao/guizhou/CenterApplicationTests.java index 7dd4747..576887d 100644 --- a/src/test/java/com/ssjl/zhaobiao/guizhou/CenterApplicationTests.java +++ b/src/test/java/com/ssjl/zhaobiao/guizhou/CenterApplicationTests.java @@ -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 map = new HashMap<>(); + map.put("abc", 2); + map.put("abc", 3); } }