This commit is contained in:
parent
fa1a3c9f51
commit
4e5c8f0726
@ -81,6 +81,8 @@ public class SystemEventAspect {
|
|||||||
if (Objects.nonNull(commonLogAnno)) {
|
if (Objects.nonNull(commonLogAnno)) {
|
||||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||||
String uri = request.getRequestURI();
|
String uri = request.getRequestURI();
|
||||||
|
String method = request.getMethod();
|
||||||
|
Long userId = this.userId(commonLogAnno.subLogType());
|
||||||
GetMapping getMapping = ms.getMethod().getDeclaredAnnotation(GetMapping.class);
|
GetMapping getMapping = ms.getMethod().getDeclaredAnnotation(GetMapping.class);
|
||||||
PostMapping postMapping = ms.getMethod().getDeclaredAnnotation(PostMapping.class);
|
PostMapping postMapping = ms.getMethod().getDeclaredAnnotation(PostMapping.class);
|
||||||
DeleteMapping deleteMapping = ms.getMethod().getDeclaredAnnotation(DeleteMapping.class);
|
DeleteMapping deleteMapping = ms.getMethod().getDeclaredAnnotation(DeleteMapping.class);
|
||||||
@ -95,20 +97,21 @@ public class SystemEventAspect {
|
|||||||
} else if (Objects.nonNull(deleteMapping)) {
|
} else if (Objects.nonNull(deleteMapping)) {
|
||||||
String requestURI = this.getUri(deleteMapping.value(), uri);
|
String requestURI = this.getUri(deleteMapping.value(), uri);
|
||||||
params = getRequestParam(requestURI, joinPoint.getArgs());
|
params = getRequestParam(requestURI, joinPoint.getArgs());
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
String method = request.getMethod();
|
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
|
||||||
Long userId = null;
|
|
||||||
if (commonLogAnno.logType() != CommonLogTypeEnum.LOGIN) {
|
|
||||||
userId = Long.valueOf(authentication.getName());
|
|
||||||
}
|
}
|
||||||
return new OperateEvent(commonLogAnno.name(), commonLogAnno.logType(), commonLogAnno.subLogType(), uri, method, params, userId);
|
return new OperateEvent(commonLogAnno.name(), commonLogAnno.logType(), commonLogAnno.subLogType(), uri, method, params, userId);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Long userId(SubEventType subEventType) {
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
Long userId = null;
|
||||||
|
if (subEventType != SubEventType.LOGIN) {
|
||||||
|
userId = Long.valueOf(authentication.getName());
|
||||||
|
}
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, Object> getRequestParam(String uriMap, Object[] args) {
|
private Map<String, Object> getRequestParam(String uriMap, Object[] args) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
int argsIndex = 0;
|
int argsIndex = 0;
|
||||||
|
@ -74,7 +74,7 @@ public class AlertRecordController {
|
|||||||
this.alertRecordService.failAlarm(List.of(recordId), AlertStatus.FAIL_DO);
|
this.alertRecordService.failAlarm(List.of(recordId), AlertStatus.FAIL_DO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
/* @PostMapping("/page")
|
||||||
@SecurityRequirement(name = "jwt")
|
@SecurityRequirement(name = "jwt")
|
||||||
@Operation(summary = "分页查询报警记录")
|
@Operation(summary = "分页查询报警记录")
|
||||||
@ApiResponse(description = "报警记录")
|
@ApiResponse(description = "报警记录")
|
||||||
@ -82,14 +82,14 @@ public class AlertRecordController {
|
|||||||
public Page<AlertRecord> pageQuery(@RequestBody AlertRecordQueryDTO queryDTO) {
|
public Page<AlertRecord> pageQuery(@RequestBody AlertRecordQueryDTO queryDTO) {
|
||||||
|
|
||||||
return alertRecordRepository.newPage(CommonPageRequest.defaultPage(), queryDTO);
|
return alertRecordRepository.newPage(CommonPageRequest.defaultPage(), queryDTO);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/page/detail")
|
@GetMapping("/page/detail")
|
||||||
@SecurityRequirement(name = "jwt")
|
@SecurityRequirement(name = "jwt")
|
||||||
@Operation(summary = "分页查询报警记录详情")
|
@Operation(summary = "分页查询报警记录详情")
|
||||||
@ApiResponse(description = "报警记录详情")
|
@ApiResponse(description = "报警记录详情")
|
||||||
@CommonLogAnno(name = "报警信息-列表数据2", logType = CommonLogTypeEnum.OPERATE, subLogType = SubEventType.QUERY)
|
@CommonLogAnno(name = "报警信息-列表数据", logType = CommonLogTypeEnum.OPERATE, subLogType = SubEventType.QUERY)
|
||||||
public Page<NccAlertInfo> pageQueryAlertDetail(AlertRecordQueryDTO queryDTO) {
|
public Page<NccAlertInfo> pageQueryAlertDetail(AlertRecordQueryDTO queryDTO) {
|
||||||
return alertRecordService.pageQueryAlertDetail(queryDTO);
|
return alertRecordService.pageQueryAlertDetail(queryDTO);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.xiannccda.dto.alertTip;
|
package club.joylink.xiannccda.dto.alertTip;
|
||||||
|
|
||||||
import club.joylink.xiannccda.alert.AlertTipTimeType;
|
import club.joylink.xiannccda.alert.AlertTipTimeType;
|
||||||
|
import club.joylink.xiannccda.constants.common.LineTypeEnum;
|
||||||
import club.joylink.xiannccda.dto.CommonPage;
|
import club.joylink.xiannccda.dto.CommonPage;
|
||||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertLocation;
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertLocation;
|
||||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||||
@ -16,6 +17,8 @@ import lombok.Setter;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class AlertTipQueryDTO extends CommonPage {
|
public class AlertTipQueryDTO extends CommonPage {
|
||||||
|
|
||||||
|
private Integer lineId;
|
||||||
|
private LineTypeEnum lineType;
|
||||||
@Schema(description = "告警类型")
|
@Schema(description = "告警类型")
|
||||||
private String alertType;
|
private String alertType;
|
||||||
@Schema(description = "时间类型")
|
@Schema(description = "时间类型")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.xiannccda.dto.record;
|
package club.joylink.xiannccda.dto.record;
|
||||||
|
|
||||||
|
import club.joylink.xiannccda.constants.common.LineTypeEnum;
|
||||||
import club.joylink.xiannccda.dto.CommonPage;
|
import club.joylink.xiannccda.dto.CommonPage;
|
||||||
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
|
||||||
import club.joylink.xiannccda.entity.AlertRecord;
|
import club.joylink.xiannccda.entity.AlertRecord;
|
||||||
@ -13,6 +14,8 @@ public class AlertRecordQueryDTO extends CommonPage {
|
|||||||
private AlertType alertType;
|
private AlertType alertType;
|
||||||
|
|
||||||
private Integer lineId;
|
private Integer lineId;
|
||||||
|
|
||||||
|
private LineTypeEnum lineType;
|
||||||
private LocalDateTime beginDateTime;
|
private LocalDateTime beginDateTime;
|
||||||
private LocalDateTime endDateTime;
|
private LocalDateTime endDateTime;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.xiannccda.mapper;
|
|||||||
import club.joylink.xiannccda.dto.alertTip.AlertTipInfoDto;
|
import club.joylink.xiannccda.dto.alertTip.AlertTipInfoDto;
|
||||||
import club.joylink.xiannccda.dto.alertTip.AlertTipQueryDTO;
|
import club.joylink.xiannccda.dto.alertTip.AlertTipQueryDTO;
|
||||||
import club.joylink.xiannccda.entity.AlertTip;
|
import club.joylink.xiannccda.entity.AlertTip;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -20,5 +21,5 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface AlertTipMapper extends BaseMapper<AlertTip> {
|
public interface AlertTipMapper extends BaseMapper<AlertTip> {
|
||||||
|
|
||||||
IPage<AlertTipInfoDto> selectForPage(IPage page, @Param("tipQuery") AlertTipQueryDTO dto);
|
IPage<AlertTipInfoDto> selectForPage(IPage page, @Param("ew") QueryWrapper<AlertTipInfoDto> qw);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package club.joylink.xiannccda.repository;
|
|||||||
import club.joylink.xiannccda.dto.alertTip.AlertTipInfoDto;
|
import club.joylink.xiannccda.dto.alertTip.AlertTipInfoDto;
|
||||||
import club.joylink.xiannccda.dto.alertTip.AlertTipQueryDTO;
|
import club.joylink.xiannccda.dto.alertTip.AlertTipQueryDTO;
|
||||||
import club.joylink.xiannccda.entity.AlertTip;
|
import club.joylink.xiannccda.entity.AlertTip;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@ -22,5 +23,5 @@ public interface IAlertTipRepository extends IService<AlertTip> {
|
|||||||
|
|
||||||
Map<Long, String> findBindAreaConfigId(List<Long> areaConfigList);
|
Map<Long, String> findBindAreaConfigId(List<Long> areaConfigList);
|
||||||
|
|
||||||
IPage<AlertTipInfoDto> leftAreaPage(IPage<AlertTipQueryDTO> page, AlertTipQueryDTO queryDTO);
|
IPage<AlertTipInfoDto> leftAreaPage(IPage<AlertTipQueryDTO> page, QueryWrapper<AlertTipInfoDto> qw);
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,9 @@ public class AlertRecordRepository extends ServiceImpl<AlertRecordMapper, AlertR
|
|||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(queryDTO.getBeginDateTime().isAfter(queryDTO.getEndDateTime()), "查询开始时间不能小于结束时间");
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(queryDTO.getBeginDateTime().isAfter(queryDTO.getEndDateTime()), "查询开始时间不能小于结束时间");
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<AlertRecord> queryWrapper = Wrappers.lambdaQuery(AlertRecord.class);
|
LambdaQueryWrapper<AlertRecord> queryWrapper = Wrappers.lambdaQuery(AlertRecord.class);
|
||||||
queryWrapper.eq(Objects.nonNull(queryDTO.getAlertType()), AlertRecord::getAlertType, queryDTO.getAlertType());
|
|
||||||
queryWrapper.eq(Objects.nonNull(queryDTO.getLineId()), AlertRecord::getLineId, queryDTO.getLineId());
|
queryWrapper.eq(Objects.nonNull(queryDTO.getLineId()), AlertRecord::getLineId, queryDTO.getLineId());
|
||||||
|
queryWrapper.eq(Objects.nonNull(queryDTO.getLineType()), AlertRecord::getLineType, queryDTO.getLineType());
|
||||||
|
queryWrapper.eq(Objects.nonNull(queryDTO.getAlertType()), AlertRecord::getAlertType, queryDTO.getAlertType());
|
||||||
queryWrapper.ge(Objects.nonNull(queryDTO.getBeginDateTime()), AlertRecord::getAlertTime, queryDTO.getBeginDateTime());
|
queryWrapper.ge(Objects.nonNull(queryDTO.getBeginDateTime()), AlertRecord::getAlertTime, queryDTO.getBeginDateTime());
|
||||||
queryWrapper.le(Objects.nonNull(queryDTO.getEndDateTime()), AlertRecord::getAlertTime, queryDTO.getEndDateTime());
|
queryWrapper.le(Objects.nonNull(queryDTO.getEndDateTime()), AlertRecord::getAlertTime, queryDTO.getEndDateTime());
|
||||||
queryWrapper.eq(Objects.nonNull(queryDTO.getAlertStatus()), AlertRecord::getAlarmStatus, queryDTO.getAlertStatus());
|
queryWrapper.eq(Objects.nonNull(queryDTO.getAlertStatus()), AlertRecord::getAlarmStatus, queryDTO.getAlertStatus());
|
||||||
|
@ -8,6 +8,7 @@ import club.joylink.xiannccda.entity.AlertTip;
|
|||||||
import club.joylink.xiannccda.mapper.AlertTipMapper;
|
import club.joylink.xiannccda.mapper.AlertTipMapper;
|
||||||
import club.joylink.xiannccda.repository.IAlertTipRepository;
|
import club.joylink.xiannccda.repository.IAlertTipRepository;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@ -55,8 +56,8 @@ public class AlertTipRepository extends ServiceImpl<AlertTipMapper, AlertTip> im
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<AlertTipInfoDto> leftAreaPage(IPage page, AlertTipQueryDTO queryDTO) {
|
public IPage<AlertTipInfoDto> leftAreaPage(IPage<AlertTipQueryDTO> page, QueryWrapper<AlertTipInfoDto> qw) {
|
||||||
return this.baseMapper.selectForPage(page, queryDTO);
|
return this.baseMapper.selectForPage(page, qw);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public class EventLogRepository extends ServiceImpl<EventLogMapper, EventLog> im
|
|||||||
QueryWrapper<EventLog> qw = new QueryWrapper<>();
|
QueryWrapper<EventLog> qw = new QueryWrapper<>();
|
||||||
|
|
||||||
qw.eq("A.event_type", dto.getLogType());
|
qw.eq("A.event_type", dto.getLogType());
|
||||||
|
qw.orderByDesc("A.id");
|
||||||
return this.baseMapper.detailPage(dto, qw);
|
return this.baseMapper.detailPage(dto, qw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import club.joylink.xiannccda.entity.DeviceAreaConfig;
|
|||||||
import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum;
|
import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.xiannccda.repository.IAlertTipRepository;
|
import club.joylink.xiannccda.repository.IAlertTipRepository;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
@ -94,7 +95,17 @@ public class AlertTipService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IPage<AlertTipInfoDto> page(AlertTipQueryDTO queryDTO) {
|
public IPage<AlertTipInfoDto> page(AlertTipQueryDTO queryDTO) {
|
||||||
IPage<AlertTipInfoDto> page = this.alertTipRepository.leftAreaPage(CommonPageRequest.defaultPage(), queryDTO);
|
|
||||||
|
QueryWrapper<AlertTipInfoDto> qw = new QueryWrapper<>();
|
||||||
|
qw.eq(Objects.nonNull(queryDTO.getLineId()), "A.line_id", queryDTO.getLineId());
|
||||||
|
qw.eq(Objects.nonNull(queryDTO.getLineType()), "A.line_type", queryDTO.getLineType());
|
||||||
|
qw.eq(StringUtils.isNotEmpty(queryDTO.getAlertType()), "A.alert_type", queryDTO.getAlertType());
|
||||||
|
qw.eq(StringUtils.isNotEmpty(queryDTO.getTimeType()), "A.time_type", queryDTO.getTimeType());
|
||||||
|
qw.eq(StringUtils.isNotEmpty(queryDTO.getLocationType()), "A.location_type", queryDTO.getLocationType());
|
||||||
|
qw.eq(Objects.nonNull(queryDTO.getAreaConfigId()), "A.area_config_id", queryDTO.getAreaConfigId());
|
||||||
|
qw.like(StringUtils.isNotEmpty(queryDTO.getAreaConfigName()), "B.area_name", queryDTO.getAreaConfigName());
|
||||||
|
|
||||||
|
IPage<AlertTipInfoDto> page = this.alertTipRepository.leftAreaPage(CommonPageRequest.defaultPage(), qw);
|
||||||
|
|
||||||
for (AlertTipInfoDto record : page.getRecords()) {
|
for (AlertTipInfoDto record : page.getRecords()) {
|
||||||
if (StringUtils.isNotEmpty(record.getTipTimeRef())) {
|
if (StringUtils.isNotEmpty(record.getTipTimeRef())) {
|
||||||
|
@ -6,22 +6,9 @@
|
|||||||
select A.*, B.area_name as areaConfigName,A.tip_time_ref
|
select A.*, B.area_name as areaConfigName,A.tip_time_ref
|
||||||
from alert_tip A left join device_area_config B on A.area_config_id = B.id
|
from alert_tip A left join device_area_config B on A.area_config_id = B.id
|
||||||
where 1 = 1
|
where 1 = 1
|
||||||
<if test="tipQuery.alertType != null and tipQuery.alertType != ''">
|
<if test="ew.sqlSegment !=null and ew.sqlSegment !=''">
|
||||||
and A.alert_type = #{tipQuery.alertType}
|
and ${ew.sqlSegment}
|
||||||
</if>
|
</if>
|
||||||
<if test="tipQuery.timeType != null and tipQuery.timeType != ''">
|
|
||||||
and A.time_type = #{timeType}
|
|
||||||
</if>
|
|
||||||
<if test="tipQuery.locationType != null and tipQuery.locationType != ''">
|
|
||||||
and A.location_type = #{locationType}
|
|
||||||
</if>
|
|
||||||
<if test="tipQuery.areaConfigId != null and tipQuery.areaConfigId >= 0">
|
|
||||||
and A.area_config_id = #{areaConfigId}
|
|
||||||
</if>
|
|
||||||
<if test="tipQuery.areaConfigName != null and tipQuery.areaConfigName != ''">
|
|
||||||
AND B.area_name Like CONCAT('%',#{tipQuery.areaConfigName},'%')
|
|
||||||
</if>
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user