Commit 03b922d2 authored by 李成龙's avatar 李成龙

气瓶预警消息

parent 50e06241
......@@ -13,7 +13,7 @@ public class CylWarningMsgDto implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = -5835716804355474954L;
@Label("企业名称")
private String companyName;
@Label("企业联系人")
......
......@@ -24,8 +24,11 @@ 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;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
@Component
@RuleActionBean(beanLabel = "气瓶预警消息")
public class CylWarningMsgAction{
private final Logger logger = LoggerFactory.getLogger(CylWarningMsgAction.class);
@Value("${tzs.wechat.tempId.warning}")
......@@ -45,10 +48,12 @@ public class CylWarningMsgAction{
private String cylpushTopic;
// @ExposeAction("气瓶预警消息")
@RuleMethod(methodLabel = "气瓶预警消息方法", project = "气瓶监管")
public void sendCylWebMessageTip(Object bizobj, String level,String orgUserName,String phone ,String text)
{
CylWarningMsgDto cylWarningMsgDto = (CylWarningMsgDto)bizobj;
//更新气瓶等级
logger.info("更新气瓶等级:"+level);
cylinderInfoServiceImpl.updateEarlyWarningLevel(cylWarningMsgDto.getCylSeq(), level);
//增加消息日志数据
MsgLog msgLog = new MsgLog();
......@@ -61,9 +66,11 @@ public class CylWarningMsgAction{
msgLog.setTerminalType("WEB");
msgLog.setSendTime(new Date());
msgLogServiceImpl.save(msgLog);
logger.info("增加消息日志数据:"+msgLog.toString());
//发送web消息
try {
emqKeeper.getMqttClient().publish(cylpushTopic, text.getBytes("UTF-8"), 1, false);
emqKeeper.getMqttClient().publish(cylpushTopic, text.getBytes("UTF-8"), 2, false);
logger.info("气瓶预警消息发送成功:");
} catch (MqttException e) {
e.printStackTrace();
logger.error("mqtt发送失败" +text );
......@@ -72,6 +79,7 @@ public class CylWarningMsgAction{
logger.error("mqtt发送失败" +text );
}
}
@RuleMethod(methodLabel = "气瓶公众号", project = "气瓶监管")
public void sendCylWechatMessageTip(Object bizobj, String level,String orgUserName,String phone ,String text)
{
//增加消息日志数据
......@@ -87,8 +95,10 @@ public class CylWarningMsgAction{
msgLog.setSendTime(new Date());
msgLogServiceImpl.save(msgLog);
//发送公众号消息
logger.info("气瓶预警消息发送开始:"+phone);
WechatRelation wechatRelation =wechatRelationService.getOne(new LambdaQueryWrapper<WechatRelation>().eq(WechatRelation::getPhone,phone));
if(null == wechatRelation) {
logger.info("气瓶预警消息发送OpenId:"+wechatRelation.toString());
if(null != wechatRelation) {
WechatMessageDto wechatMessageDto1 = new WechatMessageDto();
wechatMessageDto1.setTemplateId(templateId_Warning);
Map<String, String> data1 = Maps.newHashMap();
......@@ -97,6 +107,7 @@ public class CylWarningMsgAction{
data1.put("keyword2", DateUtils.date2LongStr(new Date()));
wechatMessageDto1.setData(data1);
wechatServiceImpl.sendWechatModelMessage(wechatRelation.getOpenId(), wechatMessageDto1);
logger.info("公众号消息发送成功:");
}
}
}
......@@ -5,13 +5,18 @@ spring.datasource.url=jdbc:mysql://113.134.211.174:3306/xiy_amos_tzs_biz?allowMu
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
#eureka properties:
eureka.instance.hostname=113.134.211.174
##eureka properties:
eureka.client.service-url.defaultZone =http://172.16.3.28:10001/eureka/
eureka.instance.prefer-ip-address=true
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:10001/eureka/
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url=http://172.16.3.39:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url=http://172.16.3.39:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs=http://172.16.3.39:${server.port}${server.servlet.context-path}/swagger-ui.html
## ES properties:
biz.elasticsearch.address=113.134.211.174
biz.elasticsearch.address=36.46.151.113
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
......@@ -22,7 +27,7 @@ alertcall.es.synchrony.time=48
#redis properties:
spring.redis.database=1
spring.redis.host=113.134.211.174
spring.redis.host=172.16.3.28
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
......@@ -34,8 +39,13 @@ spring.redis.expire.time=300
## emqx properties:
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://113.134.211.174:1883
emqx.user-name=super
emqx.password=a123456
emqx.broker=tcp://172.16.3.28:1883
emqx.user-name=admin
emqx.password=public
tzs.cti.url=http://113.134.211.174:8000
rule.definition.load=false
rule.definition.model-package=com.yeejoin.amos.boot.module.tzs.api.dto
rule.definition.default-agency=tzs
rule.definition.localIp=172.16.3.39
\ 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