调整
All checks were successful
local-test分支构建docker并发布运行 / Docker-Build (push) Successful in 1m12s

This commit is contained in:
tiger_zhou 2024-10-24 16:10:10 +08:00
parent fa1a3c9f51
commit 4e5c8f0726
11 changed files with 44 additions and 33 deletions

View File

@ -81,6 +81,8 @@ public class SystemEventAspect {
if (Objects.nonNull(commonLogAnno)) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
String uri = request.getRequestURI();
String method = request.getMethod();
Long userId = this.userId(commonLogAnno.subLogType());
GetMapping getMapping = ms.getMethod().getDeclaredAnnotation(GetMapping.class);
PostMapping postMapping = ms.getMethod().getDeclaredAnnotation(PostMapping.class);
DeleteMapping deleteMapping = ms.getMethod().getDeclaredAnnotation(DeleteMapping.class);
@ -95,20 +97,21 @@ public class SystemEventAspect {
} else if (Objects.nonNull(deleteMapping)) {
String requestURI = this.getUri(deleteMapping.value(), uri);
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 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) {
Map<String, Object> params = new HashMap<>();
int argsIndex = 0;

View File

@ -74,7 +74,7 @@ public class AlertRecordController {
this.alertRecordService.failAlarm(List.of(recordId), AlertStatus.FAIL_DO);
}
@PostMapping("/page")
/* @PostMapping("/page")
@SecurityRequirement(name = "jwt")
@Operation(summary = "分页查询报警记录")
@ApiResponse(description = "报警记录")
@ -82,14 +82,14 @@ public class AlertRecordController {
public Page<AlertRecord> pageQuery(@RequestBody AlertRecordQueryDTO queryDTO) {
return alertRecordRepository.newPage(CommonPageRequest.defaultPage(), queryDTO);
}
}*/
@GetMapping("/page/detail")
@SecurityRequirement(name = "jwt")
@Operation(summary = "分页查询报警记录详情")
@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) {
return alertRecordService.pageQueryAlertDetail(queryDTO);
}

View File

@ -1,6 +1,7 @@
package club.joylink.xiannccda.dto.alertTip;
import club.joylink.xiannccda.alert.AlertTipTimeType;
import club.joylink.xiannccda.constants.common.LineTypeEnum;
import club.joylink.xiannccda.dto.CommonPage;
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertLocation;
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
@ -16,6 +17,8 @@ import lombok.Setter;
@NoArgsConstructor
public class AlertTipQueryDTO extends CommonPage {
private Integer lineId;
private LineTypeEnum lineType;
@Schema(description = "告警类型")
private String alertType;
@Schema(description = "时间类型")

View File

@ -1,5 +1,6 @@
package club.joylink.xiannccda.dto.record;
import club.joylink.xiannccda.constants.common.LineTypeEnum;
import club.joylink.xiannccda.dto.CommonPage;
import club.joylink.xiannccda.dto.protos.AlertConstProto.AlertType;
import club.joylink.xiannccda.entity.AlertRecord;
@ -13,6 +14,8 @@ public class AlertRecordQueryDTO extends CommonPage {
private AlertType alertType;
private Integer lineId;
private LineTypeEnum lineType;
private LocalDateTime beginDateTime;
private LocalDateTime endDateTime;

View File

@ -3,6 +3,7 @@ package club.joylink.xiannccda.mapper;
import club.joylink.xiannccda.dto.alertTip.AlertTipInfoDto;
import club.joylink.xiannccda.dto.alertTip.AlertTipQueryDTO;
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.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -20,5 +21,5 @@ import org.apache.ibatis.annotations.Param;
@Mapper
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);
}

View File

@ -3,6 +3,7 @@ package club.joylink.xiannccda.repository;
import club.joylink.xiannccda.dto.alertTip.AlertTipInfoDto;
import club.joylink.xiannccda.dto.alertTip.AlertTipQueryDTO;
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.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@ -22,5 +23,5 @@ public interface IAlertTipRepository extends IService<AlertTip> {
Map<Long, String> findBindAreaConfigId(List<Long> areaConfigList);
IPage<AlertTipInfoDto> leftAreaPage(IPage<AlertTipQueryDTO> page, AlertTipQueryDTO queryDTO);
IPage<AlertTipInfoDto> leftAreaPage(IPage<AlertTipQueryDTO> page, QueryWrapper<AlertTipInfoDto> qw);
}

View File

@ -32,8 +32,9 @@ public class AlertRecordRepository extends ServiceImpl<AlertRecordMapper, AlertR
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(queryDTO.getBeginDateTime().isAfter(queryDTO.getEndDateTime()), "查询开始时间不能小于结束时间");
}
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.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.le(Objects.nonNull(queryDTO.getEndDateTime()), AlertRecord::getAlertTime, queryDTO.getEndDateTime());
queryWrapper.eq(Objects.nonNull(queryDTO.getAlertStatus()), AlertRecord::getAlarmStatus, queryDTO.getAlertStatus());

View File

@ -8,6 +8,7 @@ import club.joylink.xiannccda.entity.AlertTip;
import club.joylink.xiannccda.mapper.AlertTipMapper;
import club.joylink.xiannccda.repository.IAlertTipRepository;
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.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -55,8 +56,8 @@ public class AlertTipRepository extends ServiceImpl<AlertTipMapper, AlertTip> im
}
@Override
public IPage<AlertTipInfoDto> leftAreaPage(IPage page, AlertTipQueryDTO queryDTO) {
return this.baseMapper.selectForPage(page, queryDTO);
public IPage<AlertTipInfoDto> leftAreaPage(IPage<AlertTipQueryDTO> page, QueryWrapper<AlertTipInfoDto> qw) {
return this.baseMapper.selectForPage(page, qw);
}

View File

@ -34,7 +34,7 @@ public class EventLogRepository extends ServiceImpl<EventLogMapper, EventLog> im
QueryWrapper<EventLog> qw = new QueryWrapper<>();
qw.eq("A.event_type", dto.getLogType());
qw.orderByDesc("A.id");
return this.baseMapper.detailPage(dto, qw);
}
}

View File

@ -10,6 +10,7 @@ import club.joylink.xiannccda.entity.DeviceAreaConfig;
import club.joylink.xiannccda.exception.BusinessExceptionAssertEnum;
import club.joylink.xiannccda.repository.IAlertTipRepository;
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.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
@ -94,7 +95,17 @@ public class AlertTipService {
}
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()) {
if (StringUtils.isNotEmpty(record.getTipTimeRef())) {

View File

@ -6,22 +6,9 @@
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
where 1 = 1
<if test="tipQuery.alertType != null and tipQuery.alertType != ''">
and A.alert_type = #{tipQuery.alertType}
<if test="ew.sqlSegment !=null and ew.sqlSegment !=''">
and ${ew.sqlSegment}
</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>
</mapper>