1、推送打印改为debug级别
2、增加中南院MQTT推送
This commit is contained in:
parent
528003e39e
commit
e33ff7aa71
@ -0,0 +1,19 @@
|
|||||||
|
package com.imdroid.beidou_fwd.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MQTT数据推送 api
|
||||||
|
*
|
||||||
|
* @author LiGang
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ZNYMQTTData {
|
||||||
|
private String timestamp;
|
||||||
|
// gnss数据
|
||||||
|
private double rpose;
|
||||||
|
private double rposn;
|
||||||
|
private double rposu;
|
||||||
|
}
|
||||||
@ -266,11 +266,11 @@ public class Forwarder {
|
|||||||
updateWrapper.ge("createtime", LocalDateTime.now().minusDays(30));
|
updateWrapper.ge("createtime", LocalDateTime.now().minusDays(30));
|
||||||
updateWrapper.set("state",ResendRecord.STATE_FWDING);
|
updateWrapper.set("state",ResendRecord.STATE_FWDING);
|
||||||
int updateNum = resendRecordMapper.update(null, updateWrapper);
|
int updateNum = resendRecordMapper.update(null, updateWrapper);
|
||||||
logger.info("{} forward history records: {}, update {}",fwdGroupId, resendRecordsList.size(),updateNum);
|
logger.debug("{} forward history records: {}, update {}",fwdGroupId, resendRecordsList.size(),updateNum);
|
||||||
// 2.检索这个这个时间段的解算结果,如果有数据则单个终端转发,标志记录为已补传
|
// 2.检索这个这个时间段的解算结果,如果有数据则单个终端转发,标志记录为已补传
|
||||||
for(ResendRecord record:resendRecordsList){
|
for(ResendRecord record:resendRecordsList){
|
||||||
if(record.getProjectid()!=null)
|
if(record.getProjectid()!=null)
|
||||||
logger.info("{} forward history {}",fwdGroupId, record.getProjectid());
|
logger.debug("{} forward history {}",fwdGroupId, record.getProjectid());
|
||||||
forwardBatchGnssRecords(record);
|
forwardBatchGnssRecords(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,7 +404,7 @@ public class Forwarder {
|
|||||||
tranData.setDeviceType(2);
|
tranData.setDeviceType(2);
|
||||||
tranData.setDeviceSn(locationRecord.getDeviceid());
|
tranData.setDeviceSn(locationRecord.getDeviceid());
|
||||||
String json = GsonUtil.toJson(tranData);
|
String json = GsonUtil.toJson(tranData);
|
||||||
logger.info("forward to GZY mqtt: {}",json);
|
logger.debug("forward to GZY mqtt: {}",json);
|
||||||
|
|
||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class GXJKForwarder extends Forwarder {
|
|||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0/10 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/10 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.info("gxjk forwardGnss");
|
logger.debug("gxjk forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,8 @@ public class GXJKForwarder extends Forwarder {
|
|||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
String json = "#" + GsonUtil.toJson(sendData) + "!";
|
String json = "#" + GsonUtil.toJson(sendData) + "!";
|
||||||
logger.info("project " + projectId + ": push calculation result to GXJK");
|
logger.debug("project " + projectId + ": push calculation result to GXJK");
|
||||||
logger.info(json);
|
logger.debug(json);
|
||||||
// /slope/项目号-all/gnss/all/publish
|
// /slope/项目号-all/gnss/all/publish
|
||||||
String topic = "/slope/"+projectId+"-all/gnss/all/publish";
|
String topic = "/slope/"+projectId+"-all/gnss/all/publish";
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import java.util.List;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
public class GXXfzForwarder extends Forwarder{
|
public class GXXfzForwarder extends Forwarder{
|
||||||
private String FORWARDER_NAME = "广西新发展";
|
private final String FORWARDER_NAME = "广西新发展";
|
||||||
@Value("${xfz.server.host}")
|
@Value("${xfz.server.host}")
|
||||||
private String host;
|
private String host;
|
||||||
|
|
||||||
@ -69,13 +69,13 @@ public class GXXfzForwarder extends Forwarder{
|
|||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.info("xfz forwardGnss");
|
logger.debug("xfz forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@Scheduled(cron = "0 0/10 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/10 * * * ?") // 每30分钟执行一次
|
||||||
private void checkDevice() {
|
private void checkDevice() {
|
||||||
//logger.info("zny checkDevice");
|
//logger.debug("zny checkDevice");
|
||||||
checkOfflineDevice("2345053","2350106","2350124");
|
checkOfflineDevice("2345053","2350106","2350124");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
@ -107,8 +107,8 @@ public class GXXfzForwarder extends Forwarder{
|
|||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
String json = "#" + GsonUtil.toJson(xfzTcpMessage) + "!";
|
String json = "#" + GsonUtil.toJson(xfzTcpMessage) + "!";
|
||||||
logger.info("project " + projectId + ": push calculation result to XFZ");
|
logger.debug("project " + projectId + ": push calculation result to XFZ");
|
||||||
logger.info(json);
|
logger.debug(json);
|
||||||
try {
|
try {
|
||||||
listener.clear();
|
listener.clear();
|
||||||
xfzTcpClient.writeAndFlush(json);
|
xfzTcpClient.writeAndFlush(json);
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public class GZYForwarder extends Forwarder{
|
|||||||
@Scheduled(cron = "0 0 0/1 * * ?") // 每小时执行一次
|
@Scheduled(cron = "0 0 0/1 * * ?") // 每小时执行一次
|
||||||
// @Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
// @Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.info("gzy UDP forwardGnss");
|
logger.debug("gzy UDP forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,8 +62,8 @@ public class GZYForwarder extends Forwarder{
|
|||||||
tranData.setZ(d);
|
tranData.setZ(d);
|
||||||
gzyData.setTranData(tranData);
|
gzyData.setTranData(tranData);
|
||||||
String msg = "JGKJ" + GsonUtil.toJson(gzyData) + "#!";
|
String msg = "JGKJ" + GsonUtil.toJson(gzyData) + "#!";
|
||||||
logger.info("forward to GZY");
|
logger.debug("forward to GZY");
|
||||||
logger.info(msg);
|
logger.debug(msg);
|
||||||
udpClient.sendMessage(msg);
|
udpClient.sendMessage(msg);
|
||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class GZYMQTTForwarder extends Forwarder {
|
|||||||
@Scheduled(cron = "0 0 0/1 * * ?") // 每小时执行一次
|
@Scheduled(cron = "0 0 0/1 * * ?") // 每小时执行一次
|
||||||
//@Scheduled(cron = "0 0/5 * * * ?") // 每30分钟执行一次
|
//@Scheduled(cron = "0 0/5 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.info("gzy mqtt forwardGnss");
|
logger.debug("gzy mqtt forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
//forwardAngleData();
|
//forwardAngleData();
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ public class GZYMQTTForwarder extends Forwarder {
|
|||||||
tranData.setDeviceType(2);
|
tranData.setDeviceType(2);
|
||||||
tranData.setDeviceSn(locationRecord.getDeviceid());
|
tranData.setDeviceSn(locationRecord.getDeviceid());
|
||||||
String json = GsonUtil.toJson(tranData);
|
String json = GsonUtil.toJson(tranData);
|
||||||
logger.info("forward to GZY mqtt: {}",json);
|
logger.debug("forward to GZY mqtt: {}",json);
|
||||||
try {
|
try {
|
||||||
if(!mqttClient.publish(topic, json)) break;
|
if(!mqttClient.publish(topic, json)) break;
|
||||||
Thread.sleep(50);
|
Thread.sleep(50);
|
||||||
@ -116,7 +116,7 @@ public class GZYMQTTForwarder extends Forwarder {
|
|||||||
tranData.setAngleAz(NumberUtils.scale((double) az,2));
|
tranData.setAngleAz(NumberUtils.scale((double) az,2));
|
||||||
|
|
||||||
String json = GsonUtil.toJson(tranData);
|
String json = GsonUtil.toJson(tranData);
|
||||||
logger.info("forward to GZY mqtt angles: {}",json);
|
logger.debug("forward to GZY mqtt angles: {}",json);
|
||||||
try {
|
try {
|
||||||
if(!mqttClient.publish(topic, json)) break;
|
if(!mqttClient.publish(topic, json)) break;
|
||||||
Thread.sleep(10);
|
Thread.sleep(10);
|
||||||
@ -125,7 +125,7 @@ public class GZYMQTTForwarder extends Forwarder {
|
|||||||
}
|
}
|
||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
logger.info("total number of angles sent to GZY: {}",sendNum);
|
logger.debug("total number of angles sent to GZY: {}",sendNum);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ public class KingMaForwarder extends Forwarder{
|
|||||||
@Scheduled(cron = "0 0 0/1 * * ?") // 每小时执行一次
|
@Scheduled(cron = "0 0 0/1 * * ?") // 每小时执行一次
|
||||||
//@Scheduled(cron = "0 0/5 * * * ?") // 每30分钟执行一次
|
//@Scheduled(cron = "0 0/5 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.info("kingma forwardGnss");
|
logger.debug("kingma forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,12 +88,12 @@ public class KingMaForwarder extends Forwarder{
|
|||||||
if(header == null || nowTime.isAfter(lastTokenTime.plusMinutes(59))){
|
if(header == null || nowTime.isAfter(lastTokenTime.plusMinutes(59))){
|
||||||
try {
|
try {
|
||||||
if (!updateToken()) {
|
if (!updateToken()) {
|
||||||
logger.info("update token failed!");
|
logger.debug("update token failed!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
logger.info("update token failed!");
|
logger.debug("update token failed!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
lastTokenTime = nowTime;
|
lastTokenTime = nowTime;
|
||||||
@ -135,10 +135,10 @@ public class KingMaForwarder extends Forwarder{
|
|||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
String json = GsonUtil.toJson(dataList);
|
String json = GsonUtil.toJson(dataList);
|
||||||
logger.info(json);
|
logger.debug(json);
|
||||||
String result = HttpUtils.postJson(data_host,header,json);
|
String result = HttpUtils.postJson(data_host,header,json);
|
||||||
logger.info("project " + projectId + ": push calculation result to Kingma");
|
logger.debug("project " + projectId + ": push calculation result to Kingma");
|
||||||
logger.info("result: "+result);
|
logger.debug("result: "+result);
|
||||||
JSONObject obj = (JSONObject) JSONObject.parse(result);
|
JSONObject obj = (JSONObject) JSONObject.parse(result);
|
||||||
String msg = obj.getString("message");
|
String msg = obj.getString("message");
|
||||||
if(msg.equals("Success")) return sendNum;
|
if(msg.equals("Success")) return sendNum;
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class SaasForwarder extends Forwarder{
|
|||||||
@Scheduled(cron = "0 20,50 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 20,50 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
if(enabled) {
|
if(enabled) {
|
||||||
logger.info("saas forwardGnss");
|
logger.debug("saas forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,8 +107,8 @@ public class SaasForwarder extends Forwarder{
|
|||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
String json = "#" + GsonUtil.toJson(tcpMessage) + "!";
|
String json = "#" + GsonUtil.toJson(tcpMessage) + "!";
|
||||||
logger.info("project " + projectId + ": push calculation result to SAAS");
|
logger.debug("project " + projectId + ": push calculation result to SAAS");
|
||||||
logger.info(json);
|
logger.debug(json);
|
||||||
try {
|
try {
|
||||||
listener.clear();
|
listener.clear();
|
||||||
tcpClient.writeAndFlush(json);
|
tcpClient.writeAndFlush(json);
|
||||||
|
|||||||
@ -34,14 +34,14 @@ public class ZNYForwarder extends Forwarder{
|
|||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0/10 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/10 * * * ?") // 每30分钟执行一次
|
||||||
private void checkDevice() {
|
private void checkDevice() {
|
||||||
//logger.info("zny checkDevice");
|
//logger.debug("zny checkDevice");
|
||||||
//checkNoDataDevice("2345078","2345065","2345073");
|
//checkNoDataDevice("2345078","2345065","2345073");
|
||||||
//checkNoDataDevice("2345085","2345068","2345075");
|
//checkNoDataDevice("2345085","2345068","2345075");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.info("zny forwardGnss");
|
logger.debug("zny forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,12 +60,12 @@ public class ZNYForwarder extends Forwarder{
|
|||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
String json = GsonUtil.toJson(defoData);
|
String json = GsonUtil.toJson(defoData);
|
||||||
logger.info("发送数据到武汉中南设计院平台:{}", json);
|
logger.debug("发送数据到武汉中南设计院平台:{}", json);
|
||||||
//return sendNum;
|
//return sendNum;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String result = HttpUtils.postJson(data_host, json);
|
String result = HttpUtils.postJson(data_host, json);
|
||||||
logger.info("发送数据到武汉中南设计院平台返回结果:{}", result);
|
logger.debug("发送数据到武汉中南设计院平台返回结果:{}", result);
|
||||||
JSONObject obj = (JSONObject) JSONObject.parse(result);
|
JSONObject obj = (JSONObject) JSONObject.parse(result);
|
||||||
String msg = obj.getString("msg");
|
String msg = obj.getString("msg");
|
||||||
if (msg.contains("成功")) return sendNum;
|
if (msg.contains("成功")) return sendNum;
|
||||||
|
|||||||
@ -34,12 +34,12 @@ public class ZNYForwarder2 extends Forwarder{
|
|||||||
*/
|
*/
|
||||||
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.info("zny2 forwardGnss");
|
logger.debug("zny2 forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
}
|
}
|
||||||
@Scheduled(cron = "0 0/10 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/10 * * * ?") // 每30分钟执行一次
|
||||||
private void checkDevice() {
|
private void checkDevice() {
|
||||||
//logger.info("zny checkDevice");
|
//logger.debug("zny checkDevice");
|
||||||
//checkOfflineDevice("2419374","2410188","2410194");
|
//checkOfflineDevice("2419374","2410188","2410194");
|
||||||
//checkOfflineDevice("2419350","2410232","2410232");
|
//checkOfflineDevice("2419350","2410232","2410232");
|
||||||
//checkOfflineDevice("2345074","2345065","2345089");
|
//checkOfflineDevice("2345074","2345065","2345089");
|
||||||
@ -59,12 +59,12 @@ public class ZNYForwarder2 extends Forwarder{
|
|||||||
sendNum++;
|
sendNum++;
|
||||||
}
|
}
|
||||||
String json = GsonUtil.toJson(defoData);
|
String json = GsonUtil.toJson(defoData);
|
||||||
logger.info("发送数据到武汉中南设计院2.0平台:{}", json);
|
logger.debug("发送数据到武汉中南设计院2.0平台:{}", json);
|
||||||
//return sendNum;
|
//return sendNum;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String result = HttpUtils.postJson(data_host, json);
|
String result = HttpUtils.postJson(data_host, json);
|
||||||
logger.info("武汉中南设计院2.0平台返回结果:{}", result);
|
logger.debug("武汉中南设计院2.0平台返回结果:{}", result);
|
||||||
JSONObject obj = (JSONObject) JSONObject.parse(result);
|
JSONObject obj = (JSONObject) JSONObject.parse(result);
|
||||||
String msg = obj.getString("msg");
|
String msg = obj.getString("msg");
|
||||||
if (msg.contains("成功")) return sendNum;
|
if (msg.contains("成功")) return sendNum;
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
package com.imdroid.beidou_fwd.task;
|
package com.imdroid.beidou_fwd.task;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.imdroid.beidou_fwd.entity.ZNYMQTTData;
|
||||||
import com.imdroid.beidou_fwd.entity.GZYMQTTAngle;
|
|
||||||
import com.imdroid.beidou_fwd.entity.GZYMQTTData;
|
|
||||||
import com.imdroid.beidou_fwd.service.MQTTClient;
|
import com.imdroid.beidou_fwd.service.MQTTClient;
|
||||||
|
import com.imdroid.common.util.Des3Utils;
|
||||||
import com.imdroid.common.util.GsonUtil;
|
import com.imdroid.common.util.GsonUtil;
|
||||||
import com.imdroid.common.util.NumberUtils;
|
import com.imdroid.common.util.NumberUtils;
|
||||||
import com.imdroid.secapi.dto.GnssCalcData;
|
import com.imdroid.secapi.dto.GnssCalcData;
|
||||||
import com.imdroid.secapi.dto.GnssStatusMsg;
|
|
||||||
import com.imdroid.secapi.dto.GnssStatusMsgMapper;
|
import com.imdroid.secapi.dto.GnssStatusMsgMapper;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -20,7 +18,6 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -28,6 +25,10 @@ import java.util.List;
|
|||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
public class ZNYMQTTForwarder extends Forwarder {
|
public class ZNYMQTTForwarder extends Forwarder {
|
||||||
static final String FORWARDER_NAME = "中南院MQTT";
|
static final String FORWARDER_NAME = "中南院MQTT";
|
||||||
|
static byte[] key = new byte[] { (byte) 0x8c, (byte) 0xc7, 0x2b, 0x05, 0x70, 0x5d, 0x5c, 0x46, (byte) 0xf4, 0x12, (byte) 0xaf, (byte) 0x8c, (byte) 0xbe,
|
||||||
|
(byte) 0xd5, 0x5a, (byte) 0xad, (byte) 0x8c, (byte) 0xc7, 0x2b, 0x05, 0x70, 0x5d, 0x5c, 0x46 };
|
||||||
|
static byte[] iv = new byte[] { 0x66, 0x7b, 0x02, (byte) 0xa8, 0x5c, 0x61, (byte) 0xc7, (byte) 0x86 };
|
||||||
|
|
||||||
@Value("${zny.mqtt.brokerUrl}")
|
@Value("${zny.mqtt.brokerUrl}")
|
||||||
private String brokerUrl;
|
private String brokerUrl;
|
||||||
@Value("${zny.mqtt.username}")
|
@Value("${zny.mqtt.username}")
|
||||||
@ -36,8 +37,6 @@ public class ZNYMQTTForwarder extends Forwarder {
|
|||||||
private String password;
|
private String password;
|
||||||
@Value("${zny.mqtt.clientid}")
|
@Value("${zny.mqtt.clientid}")
|
||||||
private String clientid;
|
private String clientid;
|
||||||
@Value("${mqtt.server.topic}")
|
|
||||||
private String topic;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
GnssStatusMsgMapper statusMsgMapper;
|
GnssStatusMsgMapper statusMsgMapper;
|
||||||
@ -45,7 +44,7 @@ public class ZNYMQTTForwarder extends Forwarder {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
void registerMe() throws MqttException {
|
void registerMe() throws MqttException {
|
||||||
//init(FORWARDER_NAME, "MQTT "+brokerUrl,4,FWD_DEVICE_ALIAS_NAME,30);
|
init(FORWARDER_NAME, "MQTT "+brokerUrl,4,FWD_DEVICE_ALIAS_NAME,30);
|
||||||
mqttClient = new MQTTClient(brokerUrl, username, password,clientid);
|
mqttClient = new MQTTClient(brokerUrl, username, password,clientid);
|
||||||
//mqttClient.connect();
|
//mqttClient.connect();
|
||||||
}
|
}
|
||||||
@ -54,9 +53,9 @@ public class ZNYMQTTForwarder extends Forwarder {
|
|||||||
* 每半小时转发GNSS解算结果
|
* 每半小时转发GNSS解算结果
|
||||||
*/
|
*/
|
||||||
//@Scheduled(cron = "0 0 0/1 * * ?") // 每小时执行一次
|
//@Scheduled(cron = "0 0 0/1 * * ?") // 每小时执行一次
|
||||||
//@Scheduled(cron = "0 0/5 * * * ?") // 每30分钟执行一次
|
@Scheduled(cron = "0 0/30 * * * ?") // 每30分钟执行一次
|
||||||
private void forwardGnss() {
|
private void forwardGnss() {
|
||||||
logger.info("gzy mqtt forwardGnss");
|
logger.debug("zny mqtt forwardGnss");
|
||||||
forwardCurrentGnss();
|
forwardCurrentGnss();
|
||||||
//forwardAngleData();
|
//forwardAngleData();
|
||||||
}
|
}
|
||||||
@ -66,20 +65,20 @@ public class ZNYMQTTForwarder extends Forwarder {
|
|||||||
int sendNum = 0;
|
int sendNum = 0;
|
||||||
|
|
||||||
for (GnssCalcData locationRecord : records) {
|
for (GnssCalcData locationRecord : records) {
|
||||||
GZYMQTTData tranData = new GZYMQTTData();
|
ZNYMQTTData tranData = new ZNYMQTTData();
|
||||||
tranData.setCollectTime(locationRecord.getCreatetime().format(formatter));
|
tranData.setTimestamp(locationRecord.getCreatetime().format(formatter));
|
||||||
double n = NumberUtils.scale(locationRecord.getRposn(), 2);
|
double n = NumberUtils.scale(locationRecord.getRposn(), 2);
|
||||||
double e = NumberUtils.scale(locationRecord.getRpose(), 2);
|
double e = NumberUtils.scale(locationRecord.getRpose(), 2);
|
||||||
double d = NumberUtils.scale(locationRecord.getRposd(), 2);
|
double d = NumberUtils.scale(locationRecord.getRposd(), 2);
|
||||||
tranData.setX(n);
|
tranData.setRposn(n);
|
||||||
tranData.setY(e);
|
tranData.setRpose(e);
|
||||||
tranData.setZ(d);
|
tranData.setRposu(d);
|
||||||
tranData.setDeviceType(2);
|
|
||||||
tranData.setDeviceSn(locationRecord.getDeviceid());
|
|
||||||
String json = GsonUtil.toJson(tranData);
|
String json = GsonUtil.toJson(tranData);
|
||||||
logger.info("forward to GZY mqtt: {}",json);
|
String cryptJson = Des3Utils.encrypt(json,key,iv);
|
||||||
|
logger.debug("forward to ZNY mqtt: {}, {}",json, cryptJson);
|
||||||
|
String topic = "/GnssData/"+locationRecord.getDeviceid()+"/Increment";
|
||||||
try {
|
try {
|
||||||
if(!mqttClient.publish(topic, json)) break;
|
if(!mqttClient.publish(topic, cryptJson)) break;
|
||||||
Thread.sleep(20);
|
Thread.sleep(20);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
@ -90,43 +89,5 @@ public class ZNYMQTTForwarder extends Forwarder {
|
|||||||
return sendNum;
|
return sendNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void forwardAngleData() {
|
|
||||||
// 获取最近半小时的状态消息
|
|
||||||
LocalDateTime sentTime = LocalDateTime.now();
|
|
||||||
QueryWrapper<GnssStatusMsg> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.eq("tenantid",tenantId);
|
|
||||||
queryWrapper.le("createtime",sentTime);
|
|
||||||
queryWrapper.ge("createtime",sentTime.minusMinutes(fwdCycleMinutes));
|
|
||||||
queryWrapper.orderByDesc("createtime");
|
|
||||||
HashMap<String,String> sendDeviceMap = new HashMap<>();
|
|
||||||
List<GnssStatusMsg> statusMsgs = statusMsgMapper.selectList(queryWrapper);
|
|
||||||
int sendNum = 0;
|
|
||||||
for(GnssStatusMsg msg:statusMsgs){
|
|
||||||
if(sendDeviceMap.get(msg.getDeviceid())!=null) continue;
|
|
||||||
sendDeviceMap.put(msg.getDeviceid(),msg.getDeviceid());
|
|
||||||
|
|
||||||
GZYMQTTAngle tranData = new GZYMQTTAngle();
|
|
||||||
tranData.setDeviceSn(msg.getDeviceid());
|
|
||||||
tranData.setCollectTime(msg.getCreatetime().format(formatter));
|
|
||||||
float x = msg.getRoll()==null?0:msg.getRoll();
|
|
||||||
float y = msg.getPitch()==null?0:msg.getPitch();
|
|
||||||
float az = msg.getYaw()==null?0:msg.getYaw();
|
|
||||||
tranData.setAngleX(NumberUtils.scale((double) x,2));
|
|
||||||
tranData.setAngleY(NumberUtils.scale((double) y,2));
|
|
||||||
tranData.setAngleAz(NumberUtils.scale((double) az,2));
|
|
||||||
|
|
||||||
String json = GsonUtil.toJson(tranData);
|
|
||||||
logger.info("forward to GZY mqtt angles: {}",json);
|
|
||||||
try {
|
|
||||||
if(!mqttClient.publish(topic, json)) break;
|
|
||||||
Thread.sleep(20);
|
|
||||||
} catch (Exception e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
sendNum++;
|
|
||||||
}
|
|
||||||
logger.info("total number of angles sent to GZY: {}",sendNum);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,4 +59,10 @@ gxjk.mqtt.server.clientid = GXJK_client
|
|||||||
|
|
||||||
sass.server.host = 127.0.0.1
|
sass.server.host = 127.0.0.1
|
||||||
sass.server.port = 9933
|
sass.server.port = 9933
|
||||||
sass.server.enabled = false
|
sass.server.enabled = false
|
||||||
|
|
||||||
|
zny.mqtt.brokerUrl=42.194.196.91:51883
|
||||||
|
zny.mqtt.username=testuser
|
||||||
|
zny.mqtt.password=Test@20b39#
|
||||||
|
zny.mqtt.clientid = ZNY_client
|
||||||
|
zny.mqtt.topic = /GnssData/testgnss/Increment
|
||||||
|
|||||||
@ -2,9 +2,11 @@ package com.imdroid.beidou.controller;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.imdroid.beidou.common.HttpResult;
|
import com.imdroid.beidou.common.HttpResult;
|
||||||
|
import com.imdroid.common.util.HexUtil;
|
||||||
import com.imdroid.secapi.client.HttpResp;
|
import com.imdroid.secapi.client.HttpResp;
|
||||||
import com.imdroid.secapi.client.RtcmClient;
|
import com.imdroid.secapi.client.RtcmClient;
|
||||||
import com.imdroid.secapi.client.VersionClient;
|
import com.imdroid.secapi.client.VersionClient;
|
||||||
@ -17,6 +19,7 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -39,6 +42,8 @@ public class VersionController extends BasicController{
|
|||||||
TenantMapper tenantMapper;
|
TenantMapper tenantMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
VersionClient versionClient;
|
VersionClient versionClient;
|
||||||
|
@Value("${ver_server.connect.cmd}")
|
||||||
|
String verServerConnectCmd;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FirmwareInfo{
|
public class FirmwareInfo{
|
||||||
@ -54,8 +59,33 @@ public class VersionController extends BasicController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 正在升级的设备map,deviceId <-> UpgradeInfo(高字节:升级结果;低字节:进度)
|
// 正在升级的设备map,deviceId <-> UpgradeInfo(高字节:升级结果;低字节:进度)
|
||||||
final ConcurrentHashMap<String, Short> upgradingDeviceList = new ConcurrentHashMap<>();
|
final Map<String, Short> upgradingDeviceList = new ConcurrentHashMap<>();
|
||||||
|
final Map<String, String> deviceSNtoFirmwareMap=new HashMap<>();
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init(){
|
||||||
|
deviceSNtoFirmwareMap.put("2353","2353");
|
||||||
|
deviceSNtoFirmwareMap.put("2410","2410");
|
||||||
|
deviceSNtoFirmwareMap.put("2412","2410");
|
||||||
|
deviceSNtoFirmwareMap.put("2415","2415");
|
||||||
|
deviceSNtoFirmwareMap.put("2419","2415");
|
||||||
|
deviceSNtoFirmwareMap.put("2421","2421");
|
||||||
|
deviceSNtoFirmwareMap.put("2435","2421");
|
||||||
|
deviceSNtoFirmwareMap.put("2439","2439");
|
||||||
|
deviceSNtoFirmwareMap.put("2445","2439");
|
||||||
|
deviceSNtoFirmwareMap.put("8450","8450");
|
||||||
|
deviceSNtoFirmwareMap.put("8507","8450");
|
||||||
|
deviceSNtoFirmwareMap.put("8512","8450");
|
||||||
|
deviceSNtoFirmwareMap.put("8513","8450");
|
||||||
|
deviceSNtoFirmwareMap.put("8516","8515");
|
||||||
|
deviceSNtoFirmwareMap.put("8522","8515");
|
||||||
|
deviceSNtoFirmwareMap.put("9450","9450");
|
||||||
|
deviceSNtoFirmwareMap.put("9513","9450");
|
||||||
|
deviceSNtoFirmwareMap.put("9522","9515");
|
||||||
|
deviceSNtoFirmwareMap.put("6516","6515");
|
||||||
|
deviceSNtoFirmwareMap.put("6521","6515");
|
||||||
|
deviceSNtoFirmwareMap.put("6522","6515");
|
||||||
|
}
|
||||||
/**** 推送页面 *****/
|
/**** 推送页面 *****/
|
||||||
@RequestMapping("/sys/ver_mgr")
|
@RequestMapping("/sys/ver_mgr")
|
||||||
public String gnssDevCfg(Model m, HttpSession session) {
|
public String gnssDevCfg(Model m, HttpSession session) {
|
||||||
@ -150,17 +180,22 @@ public class VersionController extends BasicController{
|
|||||||
public HttpResult upgradeApp(@RequestParam String firmware, @RequestParam String id_list) throws Exception {
|
public HttpResult upgradeApp(@RequestParam String firmware, @RequestParam String id_list) throws Exception {
|
||||||
HttpResp rsp;
|
HttpResp rsp;
|
||||||
if(firmware!=null && !firmware.equals("undefined")) {
|
if(firmware!=null && !firmware.equals("undefined")) {
|
||||||
|
String[] deviceList = id_list.split(";");
|
||||||
//请求版本服务升级
|
//请求版本服务升级
|
||||||
try {
|
try {
|
||||||
rsp = versionClient.upgrade(id_list, firmware);
|
String invalidId = checkUpgradeList(deviceList, firmware);
|
||||||
System.out.println(id_list);
|
if(invalidId==null) {
|
||||||
|
rsp = versionClient.upgrade(id_list, firmware);
|
||||||
|
}
|
||||||
|
else return HttpResult.fail("设备型号和固件不匹配:"+invalidId);
|
||||||
|
//System.out.println(id_list);
|
||||||
}
|
}
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
return HttpResult.fail("版本服务未启动");
|
return HttpResult.fail("版本服务未启动");
|
||||||
}
|
}
|
||||||
if(rsp.getCode() == HttpResp.HTTP_RSP_OK){
|
if(rsp.getCode() == HttpResp.HTTP_RSP_OK){
|
||||||
//设置设备的使用状态为升级,下发连接版本服务器指令
|
//设置设备的使用状态为升级,下发连接版本服务器指令
|
||||||
|
startUpgrade(deviceList);
|
||||||
return HttpResult.success("开始升级");
|
return HttpResult.success("开始升级");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -204,11 +239,29 @@ public class VersionController extends BasicController{
|
|||||||
return files.length;
|
return files.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
void startUpgrade(String id_list){
|
String checkUpgradeList(String[] deviceList, String firmware){
|
||||||
String[] deviceList = id_list.split(",");
|
|
||||||
for(String deviceId:deviceList){
|
for(String deviceId:deviceList){
|
||||||
|
String snHigh = deviceId.substring(0,4);
|
||||||
|
if(!firmware.contains(deviceSNtoFirmwareMap.get(snHigh))){
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
void startUpgrade(String[] deviceList){
|
||||||
|
for(String deviceId:deviceList){
|
||||||
|
UpdateWrapper<GnssDevice> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.eq("deviceid",deviceId).set("opmode",GnssDevice.OP_MODE_UPGRADING);
|
||||||
|
gnssDeviceMapper.update(null, updateWrapper);
|
||||||
|
rtcmClient.config(deviceId,getConnectVerServerCmd(deviceId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getConnectVerServerCmd(String deviceId){
|
||||||
|
short len = (short) (verServerConnectCmd.length() + 5);
|
||||||
|
return "d31a" + HexUtil.Short2HexString(len)+
|
||||||
|
HexUtil.Int2HexString(Integer.parseInt(deviceId))+
|
||||||
|
"01"+HexUtil.String2HexString(verServerConnectCmd);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
109
sec-common/src/main/java/com/imdroid/common/util/Des3Utils.java
Normal file
109
sec-common/src/main/java/com/imdroid/common/util/Des3Utils.java
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
package com.imdroid.common.util;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.buffer.Unpooled;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.SecretKeyFactory;
|
||||||
|
import javax.crypto.spec.DESedeKeySpec;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.Key;
|
||||||
|
|
||||||
|
public class Des3Utils {
|
||||||
|
private static final String KEY_ALGORITHM = "DESede";
|
||||||
|
private static final String CIPHER_ALGORITHM_CBC = "DESede/CBC/PKCS5Padding";
|
||||||
|
private static final String CIPHER_ALGORITHM_ECB = "DESede/ECB/PKCS5Padding";
|
||||||
|
|
||||||
|
|
||||||
|
static String mode = "DESede/CFB/NoPadding";
|
||||||
|
|
||||||
|
public static byte[] encrypt(Key deskey, IvParameterSpec desiv, String mode, byte[] data) {
|
||||||
|
byte[] res = null;
|
||||||
|
|
||||||
|
Cipher cipher;
|
||||||
|
try {
|
||||||
|
cipher = Cipher.getInstance(mode);
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, deskey, desiv);
|
||||||
|
res = cipher.doFinal(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String encrypt(String data, byte[] key, byte[] iv) {
|
||||||
|
String res = "";
|
||||||
|
|
||||||
|
ByteBuf buf = Unpooled.buffer(256);
|
||||||
|
byte[] databyte = data.getBytes(StandardCharsets.UTF_8);
|
||||||
|
buf.writeBytes(databyte);
|
||||||
|
int a = (8 - databyte.length % 8);
|
||||||
|
for (int c = 0; c < a; c++) {
|
||||||
|
buf.writeByte(0x00);
|
||||||
|
}
|
||||||
|
databyte = new byte[buf.readableBytes()];
|
||||||
|
buf.readBytes(databyte);
|
||||||
|
|
||||||
|
DESedeKeySpec spec;
|
||||||
|
SecretKeyFactory keyfactory;
|
||||||
|
Key deskey;
|
||||||
|
try {
|
||||||
|
keyfactory = SecretKeyFactory.getInstance("DESede");
|
||||||
|
spec = new DESedeKeySpec(key);
|
||||||
|
deskey = keyfactory.generateSecret(spec);
|
||||||
|
IvParameterSpec desiv = new IvParameterSpec(iv);
|
||||||
|
|
||||||
|
byte[] encryptbyte = encrypt(deskey, desiv, mode, databyte);
|
||||||
|
res = Base64.encodeBase64String(encryptbyte);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String encryptCBC(byte[] key, byte[] iv, String data) throws Exception {
|
||||||
|
DESedeKeySpec spec = new DESedeKeySpec(key);
|
||||||
|
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(KEY_ALGORITHM);
|
||||||
|
Key desKey = keyFactory.generateSecret(spec);
|
||||||
|
Cipher cipher = Cipher.getInstance(mode);
|
||||||
|
IvParameterSpec ips = new IvParameterSpec(iv);
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, desKey, ips);
|
||||||
|
byte[] encryptedData = cipher.doFinal(data.getBytes(StandardCharsets.UTF_8));
|
||||||
|
return Base64.encodeBase64String(encryptedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String decryptCBC(byte[] key, byte[] iv, String data) throws Exception {
|
||||||
|
DESedeKeySpec spec = new DESedeKeySpec(key);
|
||||||
|
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(KEY_ALGORITHM);
|
||||||
|
Key desKey = keyFactory.generateSecret(spec);
|
||||||
|
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM_CBC);
|
||||||
|
IvParameterSpec ips = new IvParameterSpec(iv);
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, desKey, ips);
|
||||||
|
byte[] decryptedData = cipher.doFinal(Base64.decodeBase64(data));
|
||||||
|
return new String(decryptedData, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String encryptECB(byte[] key, String data) throws Exception {
|
||||||
|
DESedeKeySpec spec = new DESedeKeySpec(key);
|
||||||
|
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(KEY_ALGORITHM);
|
||||||
|
Key desKey = keyFactory.generateSecret(spec);
|
||||||
|
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM_ECB);
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, desKey);
|
||||||
|
byte[] encryptedData = cipher.doFinal(data.getBytes(StandardCharsets.UTF_8));
|
||||||
|
return Base64.encodeBase64String(encryptedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String decryptECB(byte[] key, String data) throws Exception {
|
||||||
|
DESedeKeySpec spec = new DESedeKeySpec(key);
|
||||||
|
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(KEY_ALGORITHM);
|
||||||
|
Key desKey = keyFactory.generateSecret(spec);
|
||||||
|
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM_ECB);
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, desKey);
|
||||||
|
byte[] decryptedData = cipher.doFinal(Base64.decodeBase64(data));
|
||||||
|
return new String(decryptedData, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
sec-vermgr/src/main/java/com/imdroid/vermgr/VerMgrApp.java
Normal file
25
sec-vermgr/src/main/java/com/imdroid/vermgr/VerMgrApp.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.imdroid.vermgr;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Layton
|
||||||
|
* @date 2023/1/31 20:33
|
||||||
|
*/
|
||||||
|
@SpringBootApplication(scanBasePackages = {"com.imdroid"})
|
||||||
|
@MapperScan({"com.imdroid.secapi","com.imdroid.beidou.entity"})
|
||||||
|
@ComponentScan({"com.imdroid.*"})
|
||||||
|
@EntityScan({"com.imdroid.*"})
|
||||||
|
@EnableFeignClients(basePackages = "com.imdroid.*")
|
||||||
|
public class VerMgrApp {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(VerMgrApp.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -56,7 +56,7 @@ public class UpgradeManager {
|
|||||||
@PostMapping("/upgrade_cmd")
|
@PostMapping("/upgrade_cmd")
|
||||||
HttpResp upgrade(@RequestParam(name = "deviceList") String deviceList, @RequestParam(name = "verFile") String verFile){
|
HttpResp upgrade(@RequestParam(name = "deviceList") String deviceList, @RequestParam(name = "verFile") String verFile){
|
||||||
HttpResp resp = new HttpResp();
|
HttpResp resp = new HttpResp();
|
||||||
if(onRxUpgradeDeviceList(deviceList.split(","),verFile)){
|
if(onRxUpgradeDeviceList(deviceList.split(";"),verFile)){
|
||||||
resp.setCode(HttpResp.HTTP_RSP_OK);
|
resp.setCode(HttpResp.HTTP_RSP_OK);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|||||||
@ -127,7 +127,7 @@ public class UpgradeSession {
|
|||||||
else {
|
else {
|
||||||
long sn = deviceApp.getDevice_sn();
|
long sn = deviceApp.getDevice_sn();
|
||||||
byte[] ind_msg = new byte[5];
|
byte[] ind_msg = new byte[5];
|
||||||
ind_msg[0] = VerManager.UPGRADE_IND;
|
ind_msg[0] = UpgradeManager.UPGRADE_IND;
|
||||||
ind_msg[1] = (byte) (sn >> 24);
|
ind_msg[1] = (byte) (sn >> 24);
|
||||||
ind_msg[2] = (byte) (sn >> 16);
|
ind_msg[2] = (byte) (sn >> 16);
|
||||||
ind_msg[3] = (byte) (sn >> 8);
|
ind_msg[3] = (byte) (sn >> 8);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user