Commit 1a87b195 authored by 李成龙's avatar 李成龙

气瓶预警消息

parent 680e971b
......@@ -20,6 +20,16 @@
<artifactId>amos-boot-module-common-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
......@@ -32,4 +32,6 @@ public class CylWarningMsgDto implements Serializable{
private String num;
@Label("气瓶seq")
private String cylSeq;
@Label("预警发生时间")
private String currentTime;
}
package com.yeejoin.amos.boot.module.tzs.biz.action;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Map;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.CylWarningMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMessageDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation;
import com.yeejoin.amos.boot.module.tzs.api.enums.EarlyWarningLevelEnum;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatRelationServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl;
@Component
public class CylWarningMsgAction{
private final Logger logger = LoggerFactory.getLogger(CylWarningMsgAction.class);
@Value("${tzs.wechat.tempId.warning}")
private String templateId_Warning;
@Autowired
WechatRelationServiceImpl wechatRelationService;
@Autowired
WechatServiceImpl wechatServiceImpl;
@Autowired
CylinderInfoServiceImpl cylinderInfoServiceImpl;
@Autowired
MsgLogServiceImpl msgLogServiceImpl;
@Autowired
private EmqKeeper emqKeeper;
@Value("${mqtt.topic.cyl.warning.push}")
private String cylpushTopic;
// @ExposeAction("气瓶预警消息")
public void sendCylWebMessageTip(Object bizobj, String level,String orgUserName,String phone ,String text)
{
CylWarningMsgDto cylWarningMsgDto = (CylWarningMsgDto)bizobj;
//更新气瓶等级
cylinderInfoServiceImpl.updateEarlyWarningLevel(cylWarningMsgDto.getCylSeq(), level);
//增加消息日志数据
MsgLog msgLog = new MsgLog();
msgLog.setRelationCode(cylWarningMsgDto.getCylSeq());
msgLog.setMsgType(EarlyWarningLevelEnum.getEumByLevel(level).getCode());
msgLog.setMsgTypeName(EarlyWarningLevelEnum.getEumByLevel(level).getName());
msgLog.setBody(text);
msgLog.setTargetCode(phone);
msgLog.setTargetName(orgUserName);
msgLog.setTerminalType("WEB");
msgLog.setSendTime(new Date());
msgLogServiceImpl.save(msgLog);
//发送web消息
try {
emqKeeper.getMqttClient().publish(cylpushTopic, text.getBytes("UTF-8"), 1, false);
} catch (MqttException e) {
e.printStackTrace();
logger.error("mqtt发送失败" +text );
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
logger.error("mqtt发送失败" +text );
}
}
public void sendCylWechatMessageTip(Object bizobj, String level,String orgUserName,String phone ,String text)
{
//增加消息日志数据
CylWarningMsgDto cylWarningMsgDto = (CylWarningMsgDto)bizobj;
MsgLog msgLog = new MsgLog();
msgLog.setRelationCode(cylWarningMsgDto.getCylSeq());
msgLog.setMsgType(EarlyWarningLevelEnum.getEumByLevel(level).getCode());
msgLog.setMsgTypeName(EarlyWarningLevelEnum.getEumByLevel(level).getName());
msgLog.setBody(text);
msgLog.setTargetCode(phone);
msgLog.setTargetName(orgUserName);
msgLog.setTerminalType("APP");
msgLog.setSendTime(new Date());
msgLogServiceImpl.save(msgLog);
//发送公众号消息
WechatRelation wechatRelation =wechatRelationService.getOne(new LambdaQueryWrapper<WechatRelation>().eq(WechatRelation::getPhone,phone));
if(null == wechatRelation) {
WechatMessageDto wechatMessageDto1 = new WechatMessageDto();
wechatMessageDto1.setTemplateId(templateId_Warning);
Map<String, String> data1 = Maps.newHashMap();
data1.put("first", "【陕西特种设备安全监察局】风险预警提醒");
data1.put("keyword1", text);
data1.put("keyword2", DateUtils.date2LongStr(new Date()));
wechatMessageDto1.setData(data1);
wechatServiceImpl.sendWechatModelMessage(wechatRelation.getOpenId(), wechatMessageDto1);
}
}
}
......@@ -364,8 +364,10 @@ public class WechatController extends BaseController {
@GetMapping(value = "/getOpenIdTel/{code}")
@ApiOperation(httpMethod = "GET", value = "根据微信code获取openId和手机号接口", notes = "根据微信code获取openId和手机号接口")
public ResponseModel<WechatAccessDto> getOpenIdTel(@PathVariable String code) {
logger.info("公众号登录"+code);
WechatAccessDto wechatAccessDto = new WechatAccessDto();
String openId = wechatService.getOpenId(code);
logger.info("公众号登录openId"+openId);
if(StringUtils.isNotEmpty(openId)) {
JSONObject userInfo = wechatService.getUserInfo(openId);
wechatAccessDto.setOpenId(openId);
......@@ -383,6 +385,7 @@ public class WechatController extends BaseController {
}
}
}
logger.info("公众号登录wechatAccessDto"+wechatAccessDto);
return ResponseHelper.buildResponse(wechatAccessDto);
}
......
......@@ -38,56 +38,4 @@ emqx.broker=tcp://113.134.211.174:1883
emqx.user-name=super
emqx.password=a123456
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://113.134.211.174:8000
#tzs.wechat.url=https://api.weixin.qq.com
#tzs.wechat.appid=wx8918c1aaad956617
#tzs.wechat.secret=337c3d8f3e749140d4f9aedc8311033b
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=ofBIZS8Bup9s0zKbrGa8BfhVhS18H_hyC_OYXuBN6hI
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
## 预警通知模板id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##督查整改通知
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## 公众号测试用户id(平台userId)
tzs.wechat.test.userId=3393279
#DB properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://172.16.3.28:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8&rewriteBatchedStatement=true
spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMultiQueries=true&serverTimezone=GMT%2B8\
&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
......@@ -43,56 +43,4 @@ emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000
#tzs.wechat.url=https://api.weixin.qq.com
#tzs.wechat.appid=wx8918c1aaad956617
#tzs.wechat.secret=337c3d8f3e749140d4f9aedc8311033b
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=ofBIZS8Bup9s0zKbrGa8BfhVhS18H_hyC_OYXuBN6hI
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
## 预警通知模板id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##督查整改通知
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## 公众号测试用户id(平台userId)
tzs.wechat.test.userId=3413513,3427644
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
tzs.cti.url=http://113.134.211.174:8000
......@@ -42,52 +42,4 @@ emqx.broker=tcp://36.46.151.113:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.cti.url=http://36.46.151.113:8000
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=bxchKYhYW7aHbGKM2pVyR_yY2-bG4sRMNU3ZRQbMKYM
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=rags-expfNSBB-h2WenuBI2c6pCEndH4uwTtOqlHqDM
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
## 预警通知模板id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##督查整改通知
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## 公众号测试用户id(平台userId)
tzs.wechat.test.userId=3413513,3427644
\ No newline at end of file
tzs.cti.url=http://113.134.211.174:8000
spring.application.name=TZS-kfm
spring.application.name=TZS
server.servlet.context-path=/tzs
server.port=11000
spring.profiles.active=jd
......@@ -52,9 +52,9 @@ security.systemctl.name=AMOS-API-SYSTEMCTL
jcs.company.topic.add=jcs/company/topic/add
jcs.company.topic.delete=jcs/company/topic/delete
## 设备联动服务(车库门、广播、警铃
## �豸�������񣨳����š��㲥�����壩
control.fegin.name=JCS-API-CONTROL
## redis超时时间
## redis��ʱʱ��
redis.cache.failure.time=10800
failure.work.flow.processDefinitionKey=malfunction_repair
video.fegin.name=video
......@@ -62,8 +62,61 @@ latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 设备告知流程v1
## �豸��֪����v1
inform.work.flow.processDefinitionKey=equipment_inform_process_v1
## 消防救援保障部ID
fire-rescue=1432549862557130753
\ No newline at end of file
## ������Ԯ���ϲ�ID
fire-rescue=1432549862557130753
tzs.cti.appkey=4e805006-3fef-ae43-3915-a153731007c4
tzs.cti.secretkey=7bd29115-99ee-4f7d-1fb1-7c4719d5f43a
tzs.wechat.url=https://api.weixin.qq.com
tzs.wechat.appid=wx79aca5bb1cb4af92
tzs.wechat.secret=f3a12323ba731d282c3d4698c27c3e97
##wechatToken
tzs.wechat.token=yeejoin_2021
##wechatTicketUrl
tzs.wechat.ticketurl=https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=
tzs.wechat.tempId.kr=rjW8x9rRitIpa21Jekyx2nzBzpJy7tycssCXSN4YhWw
tzs.wechat.url.kr=tzs.yeeamos.com/persondetail.html
tzs.wechat.tempId.wx=ofBIZS8Bup9s0zKbrGa8BfhVhS18H_hyC_OYXuBN6hI
tzs.wechat.url.wx=tzs.yeeamos.com/repairPersondetail.html
tzs.wechat.tempId.ts=Kr7lcV8g4g_lgyW_RpwnNgw_HDxxRuVx759EoFWrIfU
tzs.wechat.url.ts=tzs.yeeamos.com/taskComplaintDetail.html
mqtt.topic.task.newtask=tzs-task-newtask
mqtt.topic.task.personinfo=tzs-task-personinfo
mqtt.topic.elevator.push=/tzs/tcb_elevator
mqtt.topic.alertInfo.push=/tzs/tcb_alertInfo
mqtt.topic.alertReport.push=/tzs/tcb_alertReport
mqtt.topic.alertHeart.push=/tzs/tcb_alertHeart
mqtt.topic.alertMatrix.push=/tzs/tcb_alertMatrix
mqtt.topic.cti.push=/cti/record
mqtt.topic.cyl.warning.push=/tzs/cyl_cyl_warning
cti.user.name=tzs_cti
cti.user.pwd=a1234567
flc.sms.tempCode=SMS_TZS_0001
## Ԥ��֪ͨģ��id
tzs.wechat.tempId.warning=-pHsHLIjW8j-_AemoZycf6Dmu6iYc-YWWaJ0cAPGeUY
##��������֪ͨ
tzs.wechat.tempId.supervise=P5XGbszS2Pc6kynvGjzPpZ--ikAwDZo6O7WdJ2EUxtE
## ���ںŲ����û�id��ƽ̨userId��
tzs.wechat.test.userId=3393279
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment