Commit a6387e61 authored by duanruiming's avatar duanruiming

[update] 策略优化添加字段

parent 877f829b
......@@ -70,22 +70,28 @@ public class CrossStrategyOptConsumerHandler implements KafkaListenerErrorHandle
crossStrategyOptService.save(imbalanceAlgorithmDTO);
}
} catch (Exception e) {
log.error("当前数据处理异常:{}", message);
log.error("当前失衡策略数据处理异常:{}", message);
throw new Exception(e);
}
acknowledgment.acknowledge();
}
@KafkaListener(topics = {"${kafka-consumer.overflowAlgorithmResultTopic}"}, groupId = "group")
public void receiveOverFlowData(ConsumerRecord<Object, Object> record, Acknowledgment acknowledgment) throws Exception {
String message = String.valueOf(record.value());
if (StringUtils.isNotBlank(message)) {
ObjectMapper mapper = JacksonUtils.getInstance();
ImbalanceAlgorithmDTO imbalanceAlgorithmDTO = mapper.readValue(message, ImbalanceAlgorithmDTO.class);
// 未操作的不存
// 溢出 rtnType=0 不操作
if (0 != imbalanceAlgorithmDTO.getRtnType()) {
crossStrategyOptService.save(imbalanceAlgorithmDTO);
try {
String message = String.valueOf(record.value());
if (StringUtils.isNotBlank(message)) {
ObjectMapper mapper = JacksonUtils.getInstance();
ImbalanceAlgorithmDTO imbalanceAlgorithmDTO = mapper.readValue(message, ImbalanceAlgorithmDTO.class);
// 未操作的不存
// 溢出 rtnType=0 不操作
if (0 != imbalanceAlgorithmDTO.getRtnType()) {
crossStrategyOptService.save(imbalanceAlgorithmDTO);
}
}
} catch (Exception e) {
log.error("当前溢出策略数据处理异常:{}", e);
throw new RuntimeException(e);
}
acknowledgment.acknowledge();
}
......
......@@ -58,6 +58,7 @@ public class ImbalanceAlgorithmDTO {
private String msg;
// 方案具体信息
private SchemeData data;
private Integer isSuccessed;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
......@@ -98,7 +99,5 @@ public class ImbalanceAlgorithmDTO {
private List<Integer> max_green;
@JsonProperty("direction")
private List<Integer[][]> direction;
}
}
......@@ -40,5 +40,6 @@ public class PhaseEmptyDataDTO {
private Integer responseCode;
/** 响应内容 */
private String responseContent;
private Integer isSuccessed;
}
}
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