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

This commit is contained in:
tiger_zhou 2024-10-18 17:45:45 +08:00
parent fa9316fcf0
commit 3c138d6e39
8 changed files with 41 additions and 19 deletions

View File

@ -5,6 +5,7 @@ import club.joylink.xiannccda.constants.common.CommonLogTypeEnum;
import club.joylink.xiannccda.constants.common.CommonLogTypeEnum.SubEventType;
import club.joylink.xiannccda.constants.SystemContext;
import club.joylink.xiannccda.event.OperateEvent;
import com.google.common.collect.Maps;
import jakarta.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@ -22,6 +23,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.context.request.RequestContextHolder;
@ -45,8 +47,8 @@ public class SystemEventAspect {
Jwt jwt = jwtDecoder.decode(returnObj.toString());
String userId = jwt.getClaimAsString("sub");
obj.setUserId(Long.parseLong(userId));
SystemContext.publishEvent(obj);
}
SystemContext.publishEvent(obj);
}
}
@ -66,11 +68,15 @@ public class SystemEventAspect {
if (Objects.nonNull(commonLogAnno)) {
GetMapping getMapping = ms.getMethod().getDeclaredAnnotation(GetMapping.class);
PostMapping postMapping = ms.getMethod().getDeclaredAnnotation(PostMapping.class);
Map<String, Object> params = null;
DeleteMapping deleteMapping = ms.getMethod().getDeclaredAnnotation(DeleteMapping.class);
Map<String, Object> params = Map.of();
if (Objects.nonNull(getMapping)) {
params = getRequestParam(getMapping.value(), joinPoint.getArgs());
} else if (Objects.nonNull(postMapping)) {
params = getRequestParam(postMapping.value(), joinPoint.getArgs());
} else if (Objects.nonNull(deleteMapping)) {
params = getRequestParam(deleteMapping.value(), joinPoint.getArgs());
}
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
String uri = request.getRequestURI();

View File

@ -83,12 +83,12 @@ public class AlertRecordController {
}
@PostMapping("/page/detail")
@GetMapping("/page/detail")
@SecurityRequirement(name = "jwt")
@Operation(summary = "分页查询报警记录详情")
@ApiResponse(description = "报警记录详情")
@CommonLogAnno(name = "报警信息-列表数据2", logType = CommonLogTypeEnum.OPERATE, subLogType = SubEventType.QUERY)
public Page<NccAlertInfo> pageQueryAlertDetail(@RequestBody AlertRecordQueryDTO queryDTO) {
public Page<NccAlertInfo> pageQueryAlertDetail(AlertRecordQueryDTO queryDTO) {
return alertRecordService.pageQueryAlertDetail(queryDTO);
}

View File

@ -55,6 +55,7 @@ public class UserController {
@PostMapping("/info")
@Operation(summary = "用户信息")
@SecurityRequirement(name = "jwt")
@ApiResponse(description = "用户信息")
public UserInfoAuthDTO userInfo(Principal user) {
return this.userService.userInfo((JwtAuthenticationToken) user);

View File

@ -1,8 +1,12 @@
package club.joylink.xiannccda.dto.event;
import club.joylink.xiannccda.constants.common.CommonLogTypeEnum;
import club.joylink.xiannccda.entity.EventLog;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import lombok.Data;
@Data
public class EventLogQueryDTO extends PageDTO<EventLog> {
private CommonLogTypeEnum logType;
}

View File

@ -6,9 +6,11 @@ import club.joylink.xiannccda.dto.user.UserDetailDTO;
import club.joylink.xiannccda.dto.user.UserQueryDTO;
import club.joylink.xiannccda.entity.EventLog;
import club.joylink.xiannccda.entity.User;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
@ -21,5 +23,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface EventLogMapper extends BaseMapper<EventLog> {
Page<EventLogPageDTO> detailPage(EventLogQueryDTO dto);
Page<EventLogPageDTO> detailPage(Page page, @Param("ew") QueryWrapper<EventLog> dto);
}

View File

@ -10,6 +10,7 @@ import club.joylink.xiannccda.mapper.LineInfoMapper;
import club.joylink.xiannccda.repository.IEventLogRepository;
import club.joylink.xiannccda.repository.ILineInfoRepository;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -30,6 +31,10 @@ public class EventLogRepository extends ServiceImpl<EventLogMapper, EventLog> im
@Override
public Page<EventLogPageDTO> detailPage(EventLogQueryDTO dto) {
return this.baseMapper.detailPage(dto);
QueryWrapper<EventLog> qw = new QueryWrapper<>();
qw.eq("A.event_type", dto.getLogType());
return this.baseMapper.detailPage(dto, qw);
}
}

View File

@ -79,6 +79,8 @@ public class AlertTipService {
entity.setDrivingInfo(saveDTO.getDrivingInfo());
entity.setSubmissionInfo(saveDTO.getSubmissionInfo());
entity.setId(saveDTO.getId());
entity.setLineId(saveDTO.getLineId());
entity.setLineType(saveDTO.getLineType());
if (CollectionUtils.isNotEmpty(saveDTO.getTipTimeIds())) {
String selectIds = this.timeConfigService.getCache().stream().filter(d -> saveDTO.getTipTimeIds().contains(d.getTimeType())).map(d -> d.getId().toString())
.collect(Collectors.joining(StringPool.COMMA));

View File

@ -17,6 +17,8 @@
from event_log A
left join user B on A.from_user_id = B.id
where 1 = 1
<if test="ew.sqlSegment !=null and ew.sqlSegment !=''">
and ${ew.sqlSegment}
</if>
</select>
</mapper>