diff --git a/pom.xml b/pom.xml index d1af7e9da..ce0ff556c 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,12 @@ + + + com.github.whvcse + easy-captcha + 1.6.2 + org.apache.activemq activemq-client diff --git a/src/main/java/com/zhgd/xmgl/config/SafetyHatWSClient.java b/src/main/java/com/zhgd/xmgl/config/SafetyHatWSClient.java index 3625cb44e..9773e57a9 100644 --- a/src/main/java/com/zhgd/xmgl/config/SafetyHatWSClient.java +++ b/src/main/java/com/zhgd/xmgl/config/SafetyHatWSClient.java @@ -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 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()); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 181f88c3a..63a45adf4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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