Commit 4d9a0baf authored by ma's avatar ma

修复报警bug

parent f7f2a3e9
......@@ -184,7 +184,7 @@ public class DeviceServerHandler extends SimpleChannelInboundHandler<Object> {
UserInfoVO user = userMapper.getUserBySn(sn);
Report report = Report.builder().category(0).type(6).sn(sn).userName(user.getUserName())
.userCompany(user.getCompany()).createTime(new Date()).updateTime(new Date()).build();
reportService.reportToEmail(report);
reportService.reportToEmail(report, user.getNotify());
}
return license;
}
......
......@@ -63,7 +63,7 @@ public class OperateSAMStatusResponseEventHandler {
UserInfoVO user = userMapper.getRootAccount();
Report report = Report.builder().category(1).type(1).userName(user.getUserName())
.userCompany(user.getCompany()).createTime(new Date()).updateTime(new Date()).build();
reportService.reportToEmail(report);
reportService.reportToEmail(report, user.getNotify());
}
}
SamMonitor samMonitor = new SamMonitor();
......@@ -79,7 +79,7 @@ public class OperateSAMStatusResponseEventHandler {
UserInfoVO user = userMapper.getRootAccount();
Report report = Report.builder().category(1).type(2).userName(user.getUserName())
.userCompany(user.getCompany()).createTime(new Date()).updateTime(new Date()).build();
reportService.reportToEmail(report);
reportService.reportToEmail(report, user.getNotify());
}
}
}
......@@ -46,7 +46,7 @@ public class ForwardConnectionListener extends BaseConnectionListener {
Report report = Report.builder().category(1).type(3).userName(user.getUserName())
.description("桥接客户端,连接服务器" + this.host + ":" + this.port + "失败")
.userCompany(user.getCompany()).createTime(new Date()).updateTime(new Date()).build();
reportService.reportToEmail(report);
reportService.reportToEmail(report, user.getNotify());
// forward client连接失败,则强制踢掉设备客户端
DeviceClientBeForcedOfflineEvent deviceClientBeForcedOfflineEvent = new DeviceClientBeForcedOfflineEvent();
deviceClientBeForcedOfflineEvent.setSn(this.sn);
......
......@@ -10,10 +10,12 @@ import lombok.Data;
*/
@Data
public class UserInfoVO {
@ApiModelProperty("用户")
@ApiModelProperty("用户")
private String userName;
@ApiModelProperty("公司名")
private String company;
@ApiModelProperty("通知邮箱")
private String notify;
}
......@@ -37,7 +37,7 @@ public class OperateConnectionListener extends BaseConnectionListener {
Report report = Report.builder().category(1).type(3).userName(user.getUserName())
.description("运维客户端,连接服务器" + this.host + ":" + this.port + "失败")
.userCompany(user.getCompany()).createTime(new Date()).updateTime(new Date()).build();
reportService.reportToEmail(report);
reportService.reportToEmail(report, user.getNotify());
} else {
log.info("运维客户端,连接服务器成功:{},{}", this.host, this.port);
//TODO 查询SAM状态
......
......@@ -15,5 +15,5 @@ public interface ReportService {
PageResult<ReportVO> getReportList(ReportDTO reportDTO);
void reportToEmail(Report report);
void reportToEmail(Report report, String notify);
}
......@@ -72,8 +72,8 @@ public class ReportServiceImpl implements ReportService {
@Async("mailExecutor")
@Override
public void reportToEmail(Report report) {
if (!Validator.isEmail(report.getUserName())) {
public void reportToEmail(Report report, String notify) {
if (!Validator.isEmail(notify)) {
throw new IotLicenseException(403, "报警失败,无效的邮箱账号");
}
reportMapper.insert(report);
......@@ -94,6 +94,6 @@ public class ReportServiceImpl implements ReportService {
} else {
throw new IotLicenseException(403, "报警失败,无效的报警大类");
}
emailUtils.sendSimpleMail(report.getUserName(), "实名制身份验证云平台", content);
emailUtils.sendSimpleMail(notify, "实名制身份验证云平台", content);
}
}
......@@ -98,7 +98,7 @@ public class TerminalDeviceServiceImpl implements TerminalDeviceService {
}
Report report = Report.builder().category(0).type(type).sn(pmsUseLog.getSn()).userName(user.getUserName())
.userCompany(user.getCompany()).createTime(new Date()).updateTime(new Date()).build();
reportService.reportToEmail(report);
reportService.reportToEmail(report, user.getNotify());
boolean res = pmsUseService.reportErrorMsg(reportErrorMsgDTO);
if (!res) {
return BaseResult.failed();
......
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