Commit 37c06824 by gdj

ai信息新增算法类型algorithmType

parent eb464233
...@@ -27,4 +27,6 @@ public class AiInfoSearchParam { ...@@ -27,4 +27,6 @@ public class AiInfoSearchParam {
@JsonProperty("algorithm_type") @JsonProperty("algorithm_type")
private String algorithmType; private String algorithmType;
@JsonProperty("order_by")
private String orderBy;
} }
...@@ -52,6 +52,14 @@ public class AiInfoServiceImpl extends ServiceImpl<IAiInfoMapper, AiInfoEntity> ...@@ -52,6 +52,14 @@ public class AiInfoServiceImpl extends ServiceImpl<IAiInfoMapper, AiInfoEntity>
if (!ObjectUtils.isEmpty(param.getEndWarnTime())) { if (!ObjectUtils.isEmpty(param.getEndWarnTime())) {
wrapper.le(AiInfoEntity::getWarnTime, param.getEndWarnTime()); wrapper.le(AiInfoEntity::getWarnTime, param.getEndWarnTime());
} }
if (StringUtils.hasText(param.getOrderBy())) {
String[] arr = param.getOrderBy().split(" ");
String column = arr[0];
String desc = arr.length > 1 ? arr[1] : "desc";
wrapper.last(Objects.nonNull(param.getOrderBy()), " order by " + column + " " + desc);
}
Page<AiInfoEntity> pagination = this.page(new Page<>(page, pageSize), wrapper); Page<AiInfoEntity> pagination = this.page(new Page<>(page, pageSize), wrapper);
List<AiInfoDTO> aiInfoDTOList = pagination.getRecords().stream().map(this::AiInfoEntityToDTO) List<AiInfoDTO> aiInfoDTOList = pagination.getRecords().stream().map(this::AiInfoEntityToDTO)
...@@ -76,6 +84,7 @@ public class AiInfoServiceImpl extends ServiceImpl<IAiInfoMapper, AiInfoEntity> ...@@ -76,6 +84,7 @@ public class AiInfoServiceImpl extends ServiceImpl<IAiInfoMapper, AiInfoEntity>
aiInfoDTO.setWarnTime(Objects.nonNull(aiInfoEntity.getWarnTime()) ? aiInfoDTO.setWarnTime(Objects.nonNull(aiInfoEntity.getWarnTime()) ?
LocalDateTime.ofInstant(Instant.ofEpochMilli(aiInfoEntity.getWarnTime()), ZoneId.systemDefault()) : null); LocalDateTime.ofInstant(Instant.ofEpochMilli(aiInfoEntity.getWarnTime()), ZoneId.systemDefault()) : null);
aiInfoDTO.setJson(aiInfoEntity.getJson()); aiInfoDTO.setJson(aiInfoEntity.getJson());
aiInfoDTO.setAlgorithmType(aiInfoEntity.getAlgorithmType());
return aiInfoDTO; return aiInfoDTO;
...@@ -99,6 +108,7 @@ public class AiInfoServiceImpl extends ServiceImpl<IAiInfoMapper, AiInfoEntity> ...@@ -99,6 +108,7 @@ public class AiInfoServiceImpl extends ServiceImpl<IAiInfoMapper, AiInfoEntity>
aiInfoEntity.setWarnTime(aiInfoDTO.getWarnTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()); aiInfoEntity.setWarnTime(aiInfoDTO.getWarnTime().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
} }
aiInfoEntity.setJson(aiInfoDTO.getJson()); aiInfoEntity.setJson(aiInfoDTO.getJson());
aiInfoEntity.setAlgorithmType(aiInfoDTO.getAlgorithmType());
return aiInfoEntity; return aiInfoEntity;
} }
......
...@@ -51,6 +51,7 @@ public class SdkAiInfoServiceImpl extends AbstractAiInfoService { ...@@ -51,6 +51,7 @@ public class SdkAiInfoServiceImpl extends AbstractAiInfoService {
aiInfoEntity.setWarnTime(jsonData.get("warn_time").asLong()); aiInfoEntity.setWarnTime(jsonData.get("warn_time").asLong());
aiInfoEntity.setImageUrl(jsonData.get("image_url").asText()); aiInfoEntity.setImageUrl(jsonData.get("image_url").asText());
aiInfoEntity.setWarnLocation(jsonData.get("warn_location").asText()); aiInfoEntity.setWarnLocation(jsonData.get("warn_location").asText());
aiInfoEntity.setAlgorithmType(jsonData.get("algorithm_type").asText());
JsonNode obj = jsonData.get("obj"); JsonNode obj = jsonData.get("obj");
if (obj != null) { if (obj != null) {
aiInfoEntity.setJson(obj.toString()); aiInfoEntity.setJson(obj.toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment