首页接口
This commit is contained in:
parent
20d3b877e1
commit
4c23282495
|
|
@ -2,11 +2,15 @@ package com.bonus.aqd.base.controller;
|
||||||
|
|
||||||
import com.bonus.aqd.base.entity.dto.ParamsDto;
|
import com.bonus.aqd.base.entity.dto.ParamsDto;
|
||||||
import com.bonus.aqd.base.entity.vo.DeviceInfoVo;
|
import com.bonus.aqd.base.entity.vo.DeviceInfoVo;
|
||||||
|
import com.bonus.aqd.base.entity.vo.WarnInfoVo;
|
||||||
import com.bonus.aqd.base.service.IndexService;
|
import com.bonus.aqd.base.service.IndexService;
|
||||||
import com.bonus.aqd.manager.annotation.DecryptAndVerify;
|
import com.bonus.aqd.manager.annotation.DecryptAndVerify;
|
||||||
import com.bonus.aqd.manager.core.entity.EncryptedReq;
|
import com.bonus.aqd.manager.core.entity.EncryptedReq;
|
||||||
import com.bonus.aqd.manager.webResult.ServerResponse;
|
import com.bonus.aqd.manager.webResult.ServerResponse;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
@ -111,4 +115,19 @@ public class IndexController {
|
||||||
public ServerResponse deviceAnalysis(EncryptedReq<ParamsDto> dto) {
|
public ServerResponse deviceAnalysis(EncryptedReq<ParamsDto> dto) {
|
||||||
return service.deviceAnalysis(dto.getData());
|
return service.deviceAnalysis(dto.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警记录
|
||||||
|
* @param dto
|
||||||
|
* @return PageInfo
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/7/30 11:06
|
||||||
|
*/
|
||||||
|
@GetMapping("getWarns")
|
||||||
|
@DecryptAndVerify(decryptedClass = ParamsDto.class)
|
||||||
|
public PageInfo getWarns(EncryptedReq<ParamsDto> dto) {
|
||||||
|
PageHelper.startPage(dto.getData().getPageNum(),dto.getData().getPageSize());
|
||||||
|
PageInfo<WarnInfoVo> pageInfo = service.getWarns(dto.getData());;
|
||||||
|
return pageInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.aqd.base.dao;
|
||||||
|
|
||||||
import com.bonus.aqd.base.entity.dto.ParamsDto;
|
import com.bonus.aqd.base.entity.dto.ParamsDto;
|
||||||
import com.bonus.aqd.base.entity.vo.DeviceInfoVo;
|
import com.bonus.aqd.base.entity.vo.DeviceInfoVo;
|
||||||
|
import com.bonus.aqd.base.entity.vo.WarnInfoVo;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -93,4 +94,13 @@ public interface IndexMapper {
|
||||||
* @date 2024/7/29 17:45
|
* @date 2024/7/29 17:45
|
||||||
*/
|
*/
|
||||||
List<Integer> getWarnNum(ParamsDto dto);
|
List<Integer> getWarnNum(ParamsDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警列表
|
||||||
|
* @param dto
|
||||||
|
* @return List<WarnInfoVo>
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/7/30 9:57
|
||||||
|
*/
|
||||||
|
List<WarnInfoVo> getWarns(ParamsDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,16 @@ public class ParamsDto {
|
||||||
private String startMonthTime;
|
private String startMonthTime;
|
||||||
|
|
||||||
private String endMonthTime;
|
private String endMonthTime;
|
||||||
|
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
private String devCode;
|
||||||
|
|
||||||
|
private String warnReason;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package com.bonus.aqd.base.entity.vo;
|
package com.bonus.aqd.base.entity.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className:WarnInfoVo
|
* @className:WarnInfoVo
|
||||||
* @author:cwchen
|
* @author:cwchen
|
||||||
|
|
@ -11,4 +14,26 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class WarnInfoVo {
|
public class WarnInfoVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编码
|
||||||
|
*/
|
||||||
|
private String devCode;
|
||||||
|
/**
|
||||||
|
* 告警内容
|
||||||
|
*/
|
||||||
|
private String warnContent;
|
||||||
|
/**
|
||||||
|
* 告警时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date warnTime;
|
||||||
|
/**
|
||||||
|
* 告警原因
|
||||||
|
*/
|
||||||
|
private String warnReason;
|
||||||
|
/**
|
||||||
|
* 单双钩
|
||||||
|
*/
|
||||||
|
private String devModule;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ package com.bonus.aqd.base.service;
|
||||||
|
|
||||||
import com.bonus.aqd.base.entity.dto.ParamsDto;
|
import com.bonus.aqd.base.entity.dto.ParamsDto;
|
||||||
import com.bonus.aqd.base.entity.vo.DeviceInfoVo;
|
import com.bonus.aqd.base.entity.vo.DeviceInfoVo;
|
||||||
|
import com.bonus.aqd.base.entity.vo.WarnInfoVo;
|
||||||
import com.bonus.aqd.manager.webResult.ServerResponse;
|
import com.bonus.aqd.manager.webResult.ServerResponse;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @className:IndexService
|
* @className:IndexService
|
||||||
|
|
@ -70,4 +72,14 @@ public interface IndexService {
|
||||||
* @date 2024/7/29 16:41
|
* @date 2024/7/29 16:41
|
||||||
*/
|
*/
|
||||||
ServerResponse deviceAnalysis(ParamsDto data);
|
ServerResponse deviceAnalysis(ParamsDto data);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询告警列表
|
||||||
|
* @param data
|
||||||
|
* @return PageInfo<WarnInfoVo>
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/7/30 9:55
|
||||||
|
*/
|
||||||
|
PageInfo<WarnInfoVo> getWarns(ParamsDto data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,13 @@ import com.bonus.aqd.base.dao.IndexMapper;
|
||||||
import com.bonus.aqd.base.entity.dto.ParamsDto;
|
import com.bonus.aqd.base.entity.dto.ParamsDto;
|
||||||
import com.bonus.aqd.base.entity.vo.DeviceAnalysisVo;
|
import com.bonus.aqd.base.entity.vo.DeviceAnalysisVo;
|
||||||
import com.bonus.aqd.base.entity.vo.DeviceInfoVo;
|
import com.bonus.aqd.base.entity.vo.DeviceInfoVo;
|
||||||
|
import com.bonus.aqd.base.entity.vo.WarnInfoVo;
|
||||||
import com.bonus.aqd.base.service.IndexService;
|
import com.bonus.aqd.base.service.IndexService;
|
||||||
import com.bonus.aqd.manager.advice.ValidatorsUtils;
|
import com.bonus.aqd.manager.advice.ValidatorsUtils;
|
||||||
import com.bonus.aqd.manager.common.util.DateTimeHelper;
|
import com.bonus.aqd.manager.common.util.DateTimeHelper;
|
||||||
import com.bonus.aqd.manager.webResult.HttpStatus;
|
import com.bonus.aqd.manager.webResult.HttpStatus;
|
||||||
import com.bonus.aqd.manager.webResult.ServerResponse;
|
import com.bonus.aqd.manager.webResult.ServerResponse;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
@ -151,7 +153,15 @@ public class IndexServiceImpl implements IndexService {
|
||||||
return ServerResponse.createSuccess("查询成功",vo);
|
return ServerResponse.createSuccess("查询成功",vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
@Override
|
||||||
System.err.println(DateTimeHelper.getCurrentWeekTime());
|
public PageInfo<WarnInfoVo> getWarns(ParamsDto dto) {
|
||||||
|
List<WarnInfoVo> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = mapper.getWarns(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
PageInfo<WarnInfoVo> pageInfo = new PageInfo<>(list);
|
||||||
|
return pageInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
dev_time AS devTime
|
dev_time AS devTime
|
||||||
FROM tb_device
|
FROM tb_device
|
||||||
WHERE del_flag = 0
|
WHERE del_flag = 0
|
||||||
ORDER BY dev_time DESC
|
ORDER BY id DESC
|
||||||
</select>
|
</select>
|
||||||
<!--设备编码是否重复-->
|
<!--设备编码是否重复-->
|
||||||
<select id="devCodeIsExist" resultType="java.lang.Integer">
|
<select id="devCodeIsExist" resultType="java.lang.Integer">
|
||||||
|
|
@ -114,5 +114,28 @@
|
||||||
LEFT JOIN tb_device td ON tw.dev_code = td.dev_code
|
LEFT JOIN tb_device td ON tw.dev_code = td.dev_code
|
||||||
WHERE DATE_FORMAT(tw.warn_time, '%Y-%m-%d') BETWEEN #{startMonthTime} AND #{endMonthTime} AND INSTR(dev_module,'双钩') > 0
|
WHERE DATE_FORMAT(tw.warn_time, '%Y-%m-%d') BETWEEN #{startMonthTime} AND #{endMonthTime} AND INSTR(dev_module,'双钩') > 0
|
||||||
</select>
|
</select>
|
||||||
|
<!--告警列表-->
|
||||||
|
<select id="getWarns" resultType="com.bonus.aqd.base.entity.vo.WarnInfoVo">
|
||||||
|
SELECT tw.warn_content AS warnContent,
|
||||||
|
tw.warn_time AS warnTime,
|
||||||
|
tw.dev_code AS devCode,
|
||||||
|
tw.warn_reason AS warnReason,
|
||||||
|
tw.dev_module AS devModule,
|
||||||
|
td.dev_name AS devName
|
||||||
|
FROM tb_warn tw
|
||||||
|
LEFT JOIN tb_device td ON tw.dev_code = td.dev_code
|
||||||
|
<where>
|
||||||
|
<if test="startTime!=null and startTime!=''">
|
||||||
|
AND DATE_FORMAT(tw.warn_time, '%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="devCode!=null and devCode!=''">
|
||||||
|
AND INSTR(td.dev_code,#{devCode}) > 0
|
||||||
|
</if>
|
||||||
|
<if test="warnReason!=null and warnReason!=''">
|
||||||
|
AND INSTR(tw.warn_reason,#{warnReason}) > 0
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY tw.warn_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue