Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wj-datacenter-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jinan
wj-datacenter-platform
Commits
a6387e61
Commit
a6387e61
authored
Feb 11, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 策略优化添加字段
parent
877f829b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
CrossStrategyOptConsumerHandler.java
...nji/datacenter/kafka/CrossStrategyOptConsumerHandler.java
+15
-9
ImbalanceAlgorithmDTO.java
.../net/wanji/datacenter/pojo/dto/ImbalanceAlgorithmDTO.java
+1
-2
PhaseEmptyDataDTO.java
...java/net/wanji/datacenter/pojo/dto/PhaseEmptyDataDTO.java
+1
-0
No files found.
wj-datacenter-service/src/main/java/net/wanji/datacenter/kafka/CrossStrategyOptConsumerHandler.java
View file @
a6387e61
...
...
@@ -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
();
}
...
...
wj-datacenter-service/src/main/java/net/wanji/datacenter/pojo/dto/ImbalanceAlgorithmDTO.java
View file @
a6387e61
...
...
@@ -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
;
}
}
wj-datacenter-service/src/main/java/net/wanji/datacenter/pojo/dto/PhaseEmptyDataDTO.java
View file @
a6387e61
...
...
@@ -40,5 +40,6 @@ public class PhaseEmptyDataDTO {
private
Integer
responseCode
;
/** 响应内容 */
private
String
responseContent
;
private
Integer
isSuccessed
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment