bug修复
This commit is contained in:
parent
01b830579e
commit
c8a795899a
6
pom.xml
6
pom.xml
@ -58,6 +58,12 @@
|
|||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!--验证码-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.whvcse</groupId>
|
||||||
|
<artifactId>easy-captcha</artifactId>
|
||||||
|
<version>1.6.2</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.activemq</groupId>
|
<groupId>org.apache.activemq</groupId>
|
||||||
<artifactId>activemq-client</artifactId>
|
<artifactId>activemq-client</artifactId>
|
||||||
|
|||||||
@ -15,6 +15,8 @@ import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
|
|||||||
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.websocket.*;
|
import javax.websocket.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -24,7 +26,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
@ClientEndpoint
|
@ClientEndpoint
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@RestController
|
||||||
|
@RequestMapping("xmgl/task")
|
||||||
public class SafetyHatWSClient {
|
public class SafetyHatWSClient {
|
||||||
public static final ConcurrentHashMap<String, SafetyHatWSClient> clientMap = new ConcurrentHashMap<>();
|
public static final ConcurrentHashMap<String, SafetyHatWSClient> clientMap = new ConcurrentHashMap<>();
|
||||||
private Session session;
|
private Session session;
|
||||||
@ -42,9 +45,10 @@ public class SafetyHatWSClient {
|
|||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
@OnMessage
|
@OnMessage
|
||||||
|
@RequestMapping("onMessage")
|
||||||
public void onMessage(String message) {
|
public void onMessage(String message) {
|
||||||
if (CharSequenceUtil.isNotBlank(message)) {
|
if (CharSequenceUtil.isNotBlank(message)) {
|
||||||
log.info("SafetyHatWSClient报文:" + message);
|
log.info("SafetyHatWSClient接收报文:" + message);
|
||||||
JSONObject jo = JSON.parseObject(message);
|
JSONObject jo = JSON.parseObject(message);
|
||||||
String cmd = jo.getString("cmd");
|
String cmd = jo.getString("cmd");
|
||||||
if (Objects.equals(cmd, "ma_login")) {
|
if (Objects.equals(cmd, "ma_login")) {
|
||||||
@ -95,7 +99,7 @@ public class SafetyHatWSClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Objects.equals(cmd, "server_push_sos")) {
|
} else if (Objects.equals(cmd, "server_push_sos")) {
|
||||||
log.info("SafetyHatWSClient接受报警数据");
|
log.info("SafetyHatWSClient接收报警数据");
|
||||||
//接受报警数据
|
//接受报警数据
|
||||||
JSONObject joData = jo.getJSONObject("data");
|
JSONObject joData = jo.getJSONObject("data");
|
||||||
if (joData != null) {
|
if (joData != null) {
|
||||||
@ -104,10 +108,10 @@ public class SafetyHatWSClient {
|
|||||||
.eq(SafetyHatDev::getDevSn, deviceId));
|
.eq(SafetyHatDev::getDevSn, deviceId));
|
||||||
if (dev != null) {
|
if (dev != null) {
|
||||||
//纬度(坐标系:高德地图 GCJ-02)
|
//纬度(坐标系:高德地图 GCJ-02)
|
||||||
Double xPoint = joData.getDouble("x_point");
|
Double xPoint = jo.getDouble("x_point");
|
||||||
Double yPoint = joData.getDouble("y_point");
|
Double yPoint = jo.getDouble("y_point");
|
||||||
Long ctime = joData.getLong("c_time");
|
Long ctime = joData.getLong("c_time");
|
||||||
Integer sosType = joData.getInteger("sos_type");
|
Integer sosType = jo.getInteger("sos_type");
|
||||||
SafetyHatAlarm alarm = new SafetyHatAlarm();
|
SafetyHatAlarm alarm = new SafetyHatAlarm();
|
||||||
alarm.setWorkerInfoId(dev.getWorkerInfoId());
|
alarm.setWorkerInfoId(dev.getWorkerInfoId());
|
||||||
alarm.setDevSn(dev.getDevSn());
|
alarm.setDevSn(dev.getDevSn());
|
||||||
|
|||||||
@ -153,3 +153,23 @@ tianqiAppid=21845649
|
|||||||
tianqiAppsecret=uX7zXSJA
|
tianqiAppsecret=uX7zXSJA
|
||||||
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
|
||||||
spring.jackson.time-zone=GMT+8
|
spring.jackson.time-zone=GMT+8
|
||||||
|
#邮箱配置
|
||||||
|
#平台地址,这里用的是qq邮箱,使用其他邮箱请更换
|
||||||
|
spring.mail.host=smtp.qq.com
|
||||||
|
#端口号
|
||||||
|
spring.mail.port=465
|
||||||
|
#发送邮件的邮箱地址:改成自己的邮箱
|
||||||
|
spring.mail.username=1923636941@qq.com
|
||||||
|
#发送短信后它给你的授权码 填写到这里
|
||||||
|
spring.mail.password=qssvvjzacogsdica
|
||||||
|
#与发件邮箱一致
|
||||||
|
spring.mail.from=1923636941@qq.com
|
||||||
|
spring.mail.default-encoding=utf-8
|
||||||
|
spring.mail.properties.mail.smtp.auth=true
|
||||||
|
spring.mail.properties.mail.smtp.starttls.enable=true
|
||||||
|
spring.mail.properties.mail.smtp.starttls.required=true
|
||||||
|
# SSL 配置
|
||||||
|
spring.mail.protocol=smtp
|
||||||
|
spring.mail.properties.mail.smtp.ssl.enable=true
|
||||||
|
spring.mail.properties.mail.smtp.socketFactory.port=465
|
||||||
|
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user