fix bug about log4j and add dingding notice type
This commit is contained in:
parent
03f5bf4548
commit
e1b2717e20
|
@ -20,6 +20,14 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<!-- 排除自带的logback依赖 -->
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -29,6 +37,13 @@
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>2.2.2</version>
|
<version>2.2.2</version>
|
||||||
|
<exclusions>
|
||||||
|
<!-- 排除自带的logback依赖 -->
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,4 +1,76 @@
|
||||||
package com.aiit.xiuos.Utils;
|
package com.aiit.xiuos.Utils;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
@Slf4j
|
||||||
|
public class DingUtil {
|
||||||
|
//发起POST请求时,必须将字符集编码设置成UTF-8。
|
||||||
|
//每个机器人每分钟最多发送20条。消息发送太频繁会严重影响群成员的使用体验,大量发消息的场景 (譬如系统监控报警) 可以将这些信息进行整合,通过markdown消息以摘要的形式发送到群里。
|
||||||
|
public static String sendMsg(String url,String content) {
|
||||||
|
|
||||||
public class DINGUtils {
|
//群机器人复制到的秘钥secret
|
||||||
|
//String secret = "SEC..........................";
|
||||||
|
|
||||||
|
//获取系统时间戳
|
||||||
|
//Long timestamp = System.currentTimeMillis();
|
||||||
|
//拼接
|
||||||
|
// String stringToSign = timestamp + "\n" + secret;
|
||||||
|
//使用HmacSHA256算法计算签名
|
||||||
|
//Mac mac = Mac.getInstance("HmacSHA256");
|
||||||
|
// mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256"));
|
||||||
|
//byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8"));
|
||||||
|
//进行Base64 encode 得到最后的sign,可以拼接进url里
|
||||||
|
//String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8");
|
||||||
|
//钉钉机器人地址(配置机器人的webhook)
|
||||||
|
//String dingUrl = "https://oapi.dingtalk.com/robot/send?access_token=61ce597fca7c9f............×tamp=" + timestamp + "&sign=" + sign;
|
||||||
|
String result =null;
|
||||||
|
try {
|
||||||
|
//String url ="https://oapi.dingtalk.com/robot/send?access_token=01590254dff564e8ef9045c3970ea8c8dc5e69a0d05a40b2f9ad62c600226db3";
|
||||||
|
//是否通知所有人
|
||||||
|
boolean isAtAll = true;
|
||||||
|
//通知具体人的手机号码列表
|
||||||
|
List<String> mobileList = Lists.newArrayList();
|
||||||
|
//String userUrl = url;
|
||||||
|
//钉钉机器人消息内容
|
||||||
|
//String content = "收到新的设备告警,请及时登录泛在计算平台进行处理";
|
||||||
|
//组装请求内容
|
||||||
|
JSONObject reqBody = buildReqStr(content, isAtAll, mobileList);
|
||||||
|
log.info("ding request=="+reqBody);
|
||||||
|
//推送消息(http请求)
|
||||||
|
result = HttpClientUtil.doPost(url, reqBody.toJSONString(),null);
|
||||||
|
// String result = HttpClientUtil.sendPostDataByJson(sign, reqStr,"utf8");
|
||||||
|
log.info("result == " + result);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组装请求报文
|
||||||
|
* @param content
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static JSONObject buildReqStr(String content, boolean isAtAll, List<String> mobileList) {
|
||||||
|
//消息内容
|
||||||
|
Map<String, String> contentMap = Maps.newHashMap();
|
||||||
|
contentMap.put("content", content);
|
||||||
|
//通知人
|
||||||
|
Map<String, Object> atMap = Maps.newHashMap();
|
||||||
|
//1.是否通知所有人
|
||||||
|
atMap.put("isAtAll", isAtAll);
|
||||||
|
//2.通知具体人的手机号码列表
|
||||||
|
atMap.put("atMobiles", mobileList);
|
||||||
|
|
||||||
|
Map<String, Object> reqMap = Maps.newHashMap();
|
||||||
|
reqMap.put("msgtype", "text");
|
||||||
|
reqMap.put("text", contentMap);
|
||||||
|
reqMap.put("at", atMap);
|
||||||
|
|
||||||
|
return new JSONObject(reqMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,12 +48,12 @@ public class DataForwardController {
|
||||||
flag =true;
|
flag =true;
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
log.error(e.getMessage());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
log.error(e.getMessage());
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
log.error(e.getMessage());
|
||||||
log.info("邮件发送失败");
|
log.info("邮件发送失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class DataForwardController {
|
||||||
try {
|
try {
|
||||||
resultData = TDengineJDBCUtil.executeSql(sql);
|
resultData = TDengineJDBCUtil.executeSql(sql);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
if(resultData!=null){
|
if(resultData!=null){
|
||||||
return new ResultRespons(Constant.SUCCESS_CODE,"数据查询成功",resultData);
|
return new ResultRespons(Constant.SUCCESS_CODE,"数据查询成功",resultData);
|
||||||
|
|
|
@ -4,11 +4,11 @@ import com.aiit.xiuos.Utils.*;
|
||||||
import com.aiit.xiuos.model.DeviceInfo;
|
import com.aiit.xiuos.model.DeviceInfo;
|
||||||
import com.aiit.xiuos.model.UserInfo;
|
import com.aiit.xiuos.model.UserInfo;
|
||||||
import com.aiit.xiuos.service.DeviceInfoService;
|
import com.aiit.xiuos.service.DeviceInfoService;
|
||||||
|
import com.aiit.xiuos.tdengine.TDengineJDBCUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.sql.Connection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
package com.aiit.xiuos.controller;
|
package com.aiit.xiuos.controller;
|
||||||
|
|
||||||
|
import com.aiit.xiuos.Utils.BeanUtil;
|
||||||
import com.aiit.xiuos.Utils.Constant;
|
import com.aiit.xiuos.Utils.Constant;
|
||||||
import com.aiit.xiuos.Utils.HttpClientUtil;
|
import com.aiit.xiuos.Utils.HttpClientUtil;
|
||||||
import com.aiit.xiuos.Utils.ResultRespons;
|
import com.aiit.xiuos.Utils.ResultRespons;
|
||||||
import com.aiit.xiuos.model.AvgDayData;
|
import com.aiit.xiuos.model.AvgDayData;
|
||||||
|
import com.aiit.xiuos.model.QjdqElectric;
|
||||||
import com.aiit.xiuos.mqtt.MqttConfiguration;
|
import com.aiit.xiuos.mqtt.MqttConfiguration;
|
||||||
import com.aiit.xiuos.mqtt.MyMqttClient;
|
import com.aiit.xiuos.mqtt.MyMqttClient;
|
||||||
import com.aiit.xiuos.service.AvgDayDataService;
|
import com.aiit.xiuos.service.AvgDayDataService;
|
||||||
|
import com.aiit.xiuos.service.QjdqElectricService;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -22,6 +27,8 @@ public class DeviceDataController {
|
||||||
AvgDayDataService avgDayDataService;
|
AvgDayDataService avgDayDataService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MyMqttClient myMqttClient;
|
private MyMqttClient myMqttClient;
|
||||||
|
@Autowired
|
||||||
|
private QjdqElectricService qjdqElectricService;
|
||||||
|
|
||||||
@GetMapping("/getAll")
|
@GetMapping("/getAll")
|
||||||
public ResultRespons getAllDataFromDSD(HttpServletRequest request){
|
public ResultRespons getAllDataFromDSD(HttpServletRequest request){
|
||||||
|
@ -46,7 +53,19 @@ public class DeviceDataController {
|
||||||
myMqttClient=new MqttConfiguration().getMqttPushClient();
|
myMqttClient=new MqttConfiguration().getMqttPushClient();
|
||||||
}
|
}
|
||||||
myMqttClient.publish("xiuosiot/"+jsonMap.get("deviceno"), JSONObject.toJSONString(jsonMap));
|
myMqttClient.publish("xiuosiot/"+jsonMap.get("deviceno"), JSONObject.toJSONString(jsonMap));
|
||||||
return new ResultRespons(Constant.ERROR_CODE,"数据发送成功");
|
return new ResultRespons(Constant.SUCCESS_CODE,"数据发送成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getQJDQ")
|
||||||
|
public ResultRespons getQJDQ(){
|
||||||
|
QjdqElectric qjdqElectric = qjdqElectricService.selectElectric(1);
|
||||||
|
if(qjdqElectric!=null){
|
||||||
|
BeanUtil beanUtil =new BeanUtil();
|
||||||
|
Object[] value= beanUtil.getFiledValues(qjdqElectric);
|
||||||
|
return new ResultRespons(Constant.SUCCESS_CODE,"查询数据成功!",value);
|
||||||
|
}
|
||||||
|
return new ResultRespons(Constant.ERROR_CODE,"查询数据失败");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,10 @@ public class ExcludeController {
|
||||||
WebSocketServer webSocketServer;
|
WebSocketServer webSocketServer;
|
||||||
@PostMapping("/addjxsd")
|
@PostMapping("/addjxsd")
|
||||||
public void addJXSD(@RequestBody String jsonString, HttpServletRequest request) throws ParseException {
|
public void addJXSD(@RequestBody String jsonString, HttpServletRequest request) throws ParseException {
|
||||||
System.out.println("收到的jsonString:"+jsonString);
|
|
||||||
JSONObject jsonObject = MyUtils.StringToJson(jsonString);
|
JSONObject jsonObject = MyUtils.StringToJson(jsonString);
|
||||||
int valueNum = jsonObject.getInteger("valueNum");
|
|
||||||
String client =jsonObject.getString("org");
|
String client =jsonObject.getString("org");
|
||||||
webSocketServer.sendToMessageById(client,jsonString);
|
webSocketServer.sendInfo(jsonString);
|
||||||
String deviceId= jsonObject.getString("deviceId");
|
String deviceId= jsonObject.getString("deviceId");
|
||||||
if(valueNum==72){
|
|
||||||
JSONArray jsonArray =jsonObject.getJSONArray("readItemList");
|
JSONArray jsonArray =jsonObject.getJSONArray("readItemList");
|
||||||
StringBuilder sql =new StringBuilder("insert into jxsd_1500 values(now");
|
StringBuilder sql =new StringBuilder("insert into jxsd_1500 values(now");
|
||||||
for(int i=0;i<jsonArray.size();i++){
|
for(int i=0;i<jsonArray.size();i++){
|
||||||
|
@ -40,7 +37,6 @@ public class ExcludeController {
|
||||||
}
|
}
|
||||||
sql.append(")");
|
sql.append(")");
|
||||||
TDengineJDBCUtil.executeInsertSql(sql.toString());
|
TDengineJDBCUtil.executeInsertSql(sql.toString());
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,75 @@
|
||||||
package com.aiit.xiuos.controller;
|
package com.aiit.xiuos.controller;
|
||||||
|
|
||||||
public class EmailController {
|
import com.aiit.xiuos.Utils.Constant;
|
||||||
|
import com.aiit.xiuos.Utils.DingUtil;
|
||||||
|
import com.aiit.xiuos.Utils.EmailUtil;
|
||||||
|
import com.aiit.xiuos.Utils.ResultRespons;
|
||||||
|
import com.aiit.xiuos.scheduled.TaskScheduled;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/notice")
|
||||||
|
@Slf4j
|
||||||
|
public class NoticeController {
|
||||||
|
@Autowired
|
||||||
|
EmailUtil emailUtil;
|
||||||
|
|
||||||
|
@RequestMapping("/sendEmail")
|
||||||
|
public ResultRespons sendEmail(){
|
||||||
|
Boolean flag = false;
|
||||||
|
List<String> dataList =new ArrayList<>();
|
||||||
|
dataList.add("11111111111");
|
||||||
|
dataList.add("222222222");
|
||||||
|
dataList.add("33333333344");
|
||||||
|
try {
|
||||||
|
BufferedWriter bufferedWriter = new BufferedWriter(
|
||||||
|
new OutputStreamWriter(new FileOutputStream("F:\\email\\data.txt"), "UTF-8"));
|
||||||
|
for (String s : dataList) {
|
||||||
|
bufferedWriter.write(s);
|
||||||
|
bufferedWriter.newLine();
|
||||||
|
bufferedWriter.flush();
|
||||||
|
}
|
||||||
|
emailUtil.sendMessageCarryFile("419034340@qq.com","test","11111testtest",new File("/email/data.txt"));
|
||||||
|
flag =true;
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error(e.getMessage());
|
||||||
|
}catch (Exception e){
|
||||||
|
log.info("邮件发送失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(flag){
|
||||||
|
return new ResultRespons(Constant.SUCCESS_CODE,"发送成功");
|
||||||
|
}else {
|
||||||
|
return new ResultRespons(Constant.ERROR_CODE,"发送失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@RequestMapping("/sendDingDing")
|
||||||
|
public ResultRespons sendDingDing(@RequestBody Map<String, String> jsonMap) {
|
||||||
|
String res=DingUtil.sendMsg(jsonMap.get("url"),jsonMap.get("content"));
|
||||||
|
if(StringUtils.isNotEmpty(res)){
|
||||||
|
return new ResultRespons(Constant.SUCCESS_CODE,"发送成功");
|
||||||
|
}else{
|
||||||
|
return new ResultRespons(Constant.ERROR_CODE,"发送失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ import java.util.Map;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface AlarmInfoMapper {
|
public interface AlarmInfoMapper {
|
||||||
int deleteByPrimaryKey(@Param("deviceNo") String deviceNo, @Param("alarmName") String alarmName);
|
int deleteByPrimaryKey(@Param("deviceNo") String deviceNo, @Param("alarmName") String alarmName, @Param("alarmLevel") Integer alarmLevel);
|
||||||
|
|
||||||
int insert(AlarmInfo record);
|
int insert(AlarmInfo record);
|
||||||
|
|
||||||
int insertSelective(AlarmInfo record);
|
int insertSelective(AlarmInfo record);
|
||||||
|
|
||||||
AlarmInfo selectByPrimaryKey(@Param("deviceNo") String deviceNo, @Param("alarmName") String alarmName);
|
AlarmInfo selectByPrimaryKey(@Param("deviceNo") String deviceNo, @Param("alarmName") String alarmName, @Param("alarmLevel") Integer alarmLevel);
|
||||||
|
|
||||||
int updateByPrimaryKeySelective(AlarmInfo record);
|
int updateByPrimaryKeySelective(AlarmInfo record);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ public class AlarmInfo {
|
||||||
private String deviceNo;
|
private String deviceNo;
|
||||||
|
|
||||||
private String alarmName;
|
private String alarmName;
|
||||||
|
|
||||||
|
private Integer alarmLevel;
|
||||||
@JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
@JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
private Date alarmTime;
|
private Date alarmTime;
|
||||||
|
|
||||||
|
@ -19,19 +21,17 @@ public class AlarmInfo {
|
||||||
|
|
||||||
private Integer alarmStatus;
|
private Integer alarmStatus;
|
||||||
|
|
||||||
private Integer alarmLevel;
|
|
||||||
|
|
||||||
private String alarmRes;
|
private String alarmRes;
|
||||||
|
|
||||||
private String org;
|
private String org;
|
||||||
|
|
||||||
public AlarmInfo(String deviceNo, String alarmName, Date alarmTime, String deviceType, Integer alarmStatus, Integer alarmLevel, String alarmRes, String org) {
|
public AlarmInfo(String deviceNo, String alarmName, Integer alarmLevel, Date alarmTime, String deviceType, Integer alarmStatus, String alarmRes, String org) {
|
||||||
this.deviceNo = deviceNo;
|
this.deviceNo = deviceNo;
|
||||||
this.alarmName = alarmName;
|
this.alarmName = alarmName;
|
||||||
|
this.alarmLevel = alarmLevel;
|
||||||
this.alarmTime = alarmTime;
|
this.alarmTime = alarmTime;
|
||||||
this.deviceType = deviceType;
|
this.deviceType = deviceType;
|
||||||
this.alarmStatus = alarmStatus;
|
this.alarmStatus = alarmStatus;
|
||||||
this.alarmLevel = alarmLevel;
|
|
||||||
this.alarmRes = alarmRes;
|
this.alarmRes = alarmRes;
|
||||||
this.org = org;
|
this.org = org;
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,12 @@ public class TaskScheduled {
|
||||||
alarmInfo.setAlarmLevel(alarmRule.getAlarmLevel());
|
alarmInfo.setAlarmLevel(alarmRule.getAlarmLevel());
|
||||||
alarmInfo.setOrg(alarmRule.getOrg());
|
alarmInfo.setOrg(alarmRule.getOrg());
|
||||||
//保存告警信息。若已存在,执行更新。
|
//保存告警信息。若已存在,执行更新。
|
||||||
|
try{
|
||||||
alarmInfoService.addAlarmInfo(alarmInfo);
|
alarmInfoService.addAlarmInfo(alarmInfo);
|
||||||
|
}catch(Exception e){
|
||||||
|
alarmInfo.setAlarmRes("");
|
||||||
|
alarmInfoService.updateAlarmInfo(alarmInfo);
|
||||||
|
}
|
||||||
if (alarmRule.getNoticeType().equals("email")) {
|
if (alarmRule.getNoticeType().equals("email")) {
|
||||||
emailUtil.sendMessage(alarmRule.getNoticeAddress(), "设备告警", alarmRule.getNoticeContent());
|
emailUtil.sendMessage(alarmRule.getNoticeAddress(), "设备告警", alarmRule.getNoticeContent());
|
||||||
log.info("邮件发送成功");
|
log.info("邮件发送成功");
|
||||||
|
@ -236,7 +241,6 @@ public class TaskScheduled {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
alarmInfoService.updateAlarmInfo(alarmInfo);
|
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ server:
|
||||||
timeout: 43200s
|
timeout: 43200s
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: local
|
active: {spring.profiles.active}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,153 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.aiit.xiuos.dao.mappers.AlarmInfoMapper">
|
|
||||||
<resultMap id="BaseResultMap" type="com.aiit.xiuos.model.AlarmInfo">
|
|
||||||
<constructor>
|
|
||||||
<idArg column="device_no" javaType="java.lang.String" jdbcType="VARCHAR" />
|
|
||||||
<idArg column="alarm_name" javaType="java.lang.String" jdbcType="VARCHAR" />
|
|
||||||
<arg column="alarm_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
|
|
||||||
<arg column="device_type" javaType="java.lang.String" jdbcType="VARCHAR" />
|
|
||||||
<arg column="alarm_status" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
|
||||||
<arg column="alarm_level" javaType="java.lang.Integer" jdbcType="INTEGER" />
|
|
||||||
<arg column="alarm_res" javaType="java.lang.String" jdbcType="VARCHAR" />
|
|
||||||
<arg column="org" javaType="java.lang.String" jdbcType="VARCHAR" />
|
|
||||||
</constructor>
|
|
||||||
</resultMap>
|
|
||||||
<sql id="Base_Column_List">
|
|
||||||
device_no, alarm_name, alarm_time, device_type, alarm_status, alarm_level, alarm_res,
|
|
||||||
org
|
|
||||||
</sql>
|
|
||||||
<select id="selectByPrimaryKey" parameterType="map" resultMap="BaseResultMap">
|
|
||||||
select
|
|
||||||
<include refid="Base_Column_List" />
|
|
||||||
from alarm_info
|
|
||||||
where device_no = #{deviceNo,jdbcType=VARCHAR}
|
|
||||||
and alarm_name = #{alarmName,jdbcType=VARCHAR}
|
|
||||||
</select>
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="map">
|
|
||||||
delete from alarm_info
|
|
||||||
where device_no = #{deviceNo,jdbcType=VARCHAR}
|
|
||||||
and alarm_name = #{alarmName,jdbcType=VARCHAR}
|
|
||||||
</delete>
|
|
||||||
<insert id="insert" parameterType="com.aiit.xiuos.model.AlarmInfo">
|
|
||||||
insert into alarm_info (device_no, alarm_name, alarm_time,
|
|
||||||
device_type, alarm_status, alarm_level,
|
|
||||||
alarm_res, org)
|
|
||||||
values (#{deviceNo,jdbcType=VARCHAR}, #{alarmName,jdbcType=VARCHAR}, #{alarmTime,jdbcType=TIMESTAMP},
|
|
||||||
#{deviceType,jdbcType=VARCHAR}, #{alarmStatus,jdbcType=INTEGER}, #{alarmLevel,jdbcType=INTEGER},
|
|
||||||
#{alarmRes,jdbcType=VARCHAR}, #{org,jdbcType=VARCHAR})
|
|
||||||
</insert>
|
|
||||||
<insert id="insertSelective" parameterType="com.aiit.xiuos.model.AlarmInfo">
|
|
||||||
insert into alarm_info
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="deviceNo != null">
|
|
||||||
device_no,
|
|
||||||
</if>
|
|
||||||
<if test="alarmName != null">
|
|
||||||
alarm_name,
|
|
||||||
</if>
|
|
||||||
<if test="alarmTime != null">
|
|
||||||
alarm_time,
|
|
||||||
</if>
|
|
||||||
<if test="deviceType != null">
|
|
||||||
device_type,
|
|
||||||
</if>
|
|
||||||
<if test="alarmStatus != null">
|
|
||||||
alarm_status,
|
|
||||||
</if>
|
|
||||||
<if test="alarmLevel != null">
|
|
||||||
alarm_level,
|
|
||||||
</if>
|
|
||||||
<if test="alarmRes != null">
|
|
||||||
alarm_res,
|
|
||||||
</if>
|
|
||||||
<if test="org != null">
|
|
||||||
org,
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="deviceNo != null">
|
|
||||||
#{deviceNo,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="alarmName != null">
|
|
||||||
#{alarmName,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="alarmTime != null">
|
|
||||||
#{alarmTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="deviceType != null">
|
|
||||||
#{deviceType,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="alarmStatus != null">
|
|
||||||
#{alarmStatus,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="alarmLevel != null">
|
|
||||||
#{alarmLevel,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="alarmRes != null">
|
|
||||||
#{alarmRes,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="org != null">
|
|
||||||
#{org,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="com.aiit.xiuos.model.AlarmInfo">
|
|
||||||
update alarm_info
|
|
||||||
<set>
|
|
||||||
<if test="alarmTime != null">
|
|
||||||
alarm_time = #{alarmTime,jdbcType=TIMESTAMP},
|
|
||||||
</if>
|
|
||||||
<if test="deviceType != null">
|
|
||||||
device_type = #{deviceType,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="alarmStatus != null">
|
|
||||||
alarm_status = #{alarmStatus,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="alarmLevel != null">
|
|
||||||
alarm_level = #{alarmLevel,jdbcType=INTEGER},
|
|
||||||
</if>
|
|
||||||
<if test="alarmRes != null">
|
|
||||||
alarm_res = #{alarmRes,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="org != null">
|
|
||||||
org = #{org,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
</set>
|
|
||||||
where device_no = #{deviceNo,jdbcType=VARCHAR}
|
|
||||||
and alarm_name = #{alarmName,jdbcType=VARCHAR}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="com.aiit.xiuos.model.AlarmInfo">
|
|
||||||
update alarm_info
|
|
||||||
set alarm_time = #{alarmTime,jdbcType=TIMESTAMP},
|
|
||||||
device_type = #{deviceType,jdbcType=VARCHAR},
|
|
||||||
alarm_status = #{alarmStatus,jdbcType=INTEGER},
|
|
||||||
alarm_level = #{alarmLevel,jdbcType=INTEGER},
|
|
||||||
alarm_res = #{alarmRes,jdbcType=VARCHAR},
|
|
||||||
org = #{org,jdbcType=VARCHAR}
|
|
||||||
where device_no = #{deviceNo,jdbcType=VARCHAR}
|
|
||||||
and alarm_name = #{alarmName,jdbcType=VARCHAR}
|
|
||||||
</update>
|
|
||||||
<select id="selectByParam" parameterType="com.aiit.xiuos.model.AlarmInfo" resultMap="BaseResultMap">
|
|
||||||
select * from alarm_info where org= #{org,jdbcType=VARCHAR}
|
|
||||||
<if test="deviceNo != null">
|
|
||||||
and device_no = #{deviceNo,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
<if test="alarmName != null">
|
|
||||||
and alarm_name = #{alarmName,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
<if test="alarmTime != null">
|
|
||||||
and alarm_time = #{alarmTime,jdbcType=TIMESTAMP}
|
|
||||||
</if>
|
|
||||||
<if test="deviceType != null">
|
|
||||||
and device_type = #{deviceType,jdbcType=VARCHAR}
|
|
||||||
</if>
|
|
||||||
<if test="alarmStatus != null">
|
|
||||||
and alarm_status = #{alarmStatus,jdbcType=INTEGER}
|
|
||||||
</if>
|
|
||||||
<if test="alarmLevel != null">
|
|
||||||
and alarm_level = #{alarmLevel,jdbcType=INTEGER}
|
|
||||||
</if>
|
|
||||||
order by alarm_time desc;
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
Loading…
Reference in New Issue