Commit 21fa1a57 authored by 赵啸非's avatar 赵啸非

添加设备上线和下线的业务日志记录

parent d45e0e9e
...@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil; ...@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.model.BizLogPdu; import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.ErrorLogPdu;
import com.mortals.framework.service.IMessageProduceService; import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
...@@ -107,6 +108,26 @@ public class CustomerKeyExpirationListener implements MessageListener { ...@@ -107,6 +108,26 @@ public class CustomerKeyExpirationListener implements MessageListener {
bizLogPdu.setLogTime(new Date()); bizLogPdu.setLogTime(new Date());
messageProducer.syncBizSend(bizLogPdu); messageProducer.syncBizSend(bizLogPdu);
ErrorLogPdu errorLogPdu = new ErrorLogPdu();
errorLogPdu.initAttrValue();
errorLogPdu.setTraceID(IdUtil.objectId());
errorLogPdu.setAppName(productEntity.getProductCode());
errorLogPdu.setMessage(deviceEntity.getDeviceName()+"设备下线!");
errorLogPdu.setPlatform("android");
errorLogPdu.setCulprit("");
errorLogPdu.setTags("");
errorLogPdu.setLevel("INFO");
errorLogPdu.setEnvironment("");
errorLogPdu.setReleaseVersion("");
errorLogPdu.setFingerprint("");
errorLogPdu.setThreadNo(Thread.currentThread().toString());
errorLogPdu.setErrorStack("");
errorLogPdu.setContext("");
errorLogPdu.setExtra("");
errorLogPdu.setLogTime(new Date());
messageProducer.syncErrorSend(errorLogPdu);
//生成异常日志
} }
//保存离线告警消息 //保存离线告警消息
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
public enum ProductToAppNameEnum {
数字化样表系统("ybj", "sample-form-manager"),
数字化填单系统("tdj", "fill-manager"),
窗口评价交互升级服务系统("ckp", "log_pjdevice"),
自助存取件系统("qjg", "log_pickup"),
导视机("dsj", "log_guide"),
智能排队叫号系统("pdj", "智能排队叫号系统");
private String value;
private String desc;
ProductToAppNameEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static ProductToAppNameEnum getByValue(String value) {
for (ProductToAppNameEnum goveServiceCenterShowEnum : ProductToAppNameEnum.values()) {
if (goveServiceCenterShowEnum.getValue() == value) {
return goveServiceCenterShowEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(String... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (ProductToAppNameEnum item : ProductToAppNameEnum.values()) {
try {
boolean hasE = false;
for (String e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ 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