bug修复

This commit is contained in:
guo 2024-03-22 19:18:22 +08:00
parent 01b830579e
commit c8a795899a
3 changed files with 36 additions and 6 deletions

View File

@ -58,6 +58,12 @@
</repositories>
<dependencies>
<!--验证码-->
<dependency>
<groupId>com.github.whvcse</groupId>
<artifactId>easy-captcha</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>

View File

@ -15,6 +15,8 @@ import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatAlarmService;
import com.zhgd.xmgl.modules.safetyhat.service.ISafetyHatDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.websocket.*;
import java.util.Date;
@ -24,7 +26,8 @@ import java.util.concurrent.ConcurrentHashMap;
@ClientEndpoint
@Slf4j
@Component
@RestController
@RequestMapping("xmgl/task")
public class SafetyHatWSClient {
public static final ConcurrentHashMap<String, SafetyHatWSClient> clientMap = new ConcurrentHashMap<>();
private Session session;
@ -42,9 +45,10 @@ public class SafetyHatWSClient {
* @param message
*/
@OnMessage
@RequestMapping("onMessage")
public void onMessage(String message) {
if (CharSequenceUtil.isNotBlank(message)) {
log.info("SafetyHatWSClient报文:" + message);
log.info("SafetyHatWSClient接收报文:" + message);
JSONObject jo = JSON.parseObject(message);
String cmd = jo.getString("cmd");
if (Objects.equals(cmd, "ma_login")) {
@ -95,7 +99,7 @@ public class SafetyHatWSClient {
}
}
} else if (Objects.equals(cmd, "server_push_sos")) {
log.info("SafetyHatWSClient接报警数据");
log.info("SafetyHatWSClient接报警数据");
//接受报警数据
JSONObject joData = jo.getJSONObject("data");
if (joData != null) {
@ -104,10 +108,10 @@ public class SafetyHatWSClient {
.eq(SafetyHatDev::getDevSn, deviceId));
if (dev != null) {
//纬度(坐标系高德地图 GCJ-02)
Double xPoint = joData.getDouble("x_point");
Double yPoint = joData.getDouble("y_point");
Double xPoint = jo.getDouble("x_point");
Double yPoint = jo.getDouble("y_point");
Long ctime = joData.getLong("c_time");
Integer sosType = joData.getInteger("sos_type");
Integer sosType = jo.getInteger("sos_type");
SafetyHatAlarm alarm = new SafetyHatAlarm();
alarm.setWorkerInfoId(dev.getWorkerInfoId());
alarm.setDevSn(dev.getDevSn());

View File

@ -153,3 +153,23 @@ tianqiAppid=21845649
tianqiAppsecret=uX7zXSJA
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
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