Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
项目统一框架
amos-boot-biz
Commits
8cc55d9b
Commit
8cc55d9b
authored
Dec 13, 2023
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工单添加链接业务
parent
fc7d4910
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
2 deletions
+122
-2
AsyncConfig.java
...eejoin/amos/boot/module/jxiop/api/config/AsyncConfig.java
+29
-0
McbWarningFeign.java
...oin/amos/boot/module/jxiop/api/feign/McbWarningFeign.java
+13
-0
JobRawDataUrlMessage.java
...amos/boot/module/jxiop/biz/emqx/JobRawDataUrlMessage.java
+74
-0
application.properties
...odule-jxiop-biz/src/main/resources/application.properties
+6
-2
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/config/AsyncConfig.java
0 → 100644
View file @
8cc55d9b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
api
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Component
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ThreadPoolExecutor
;
@Component
public
class
AsyncConfig
{
@Bean
(
"async"
)
public
Executor
asyncScheduledTask
(){
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
executor
.
setMaxPoolSize
(
50
);
executor
.
setCorePoolSize
(
20
);
executor
.
setQueueCapacity
(
50
);
executor
.
setThreadNamePrefix
(
"async-thread-"
);
executor
.
setKeepAliveSeconds
(
60
);
executor
.
setRejectedExecutionHandler
(
new
ThreadPoolExecutor
.
AbortPolicy
(){});
executor
.
initialize
();
return
executor
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/feign/McbWarningFeign.java
View file @
8cc55d9b
...
@@ -4,6 +4,7 @@ import com.yeejoin.amos.component.feign.config.InnerInvokException;
...
@@ -4,6 +4,7 @@ import com.yeejoin.amos.component.feign.config.InnerInvokException;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.List
;
...
@@ -26,4 +27,16 @@ public interface McbWarningFeign {
...
@@ -26,4 +27,16 @@ public interface McbWarningFeign {
@GetMapping
(
"/task/getWarningInfoCountByObjectId"
)
@GetMapping
(
"/task/getWarningInfoCountByObjectId"
)
FeignClientResult
<
Integer
>
getWarningInfoCountByObjectId
(
@RequestParam
(
value
=
"code"
)
String
code
);
FeignClientResult
<
Integer
>
getWarningInfoCountByObjectId
(
@RequestParam
(
value
=
"code"
)
String
code
);
/**
* 根据风险来源查询人员红黄绿吗信息
*/
@GetMapping
(
"/task/getWarningInfoByTraceId"
)
FeignClientResult
<
String
>
getWarningInfoByTraceId
(
@RequestParam
(
value
=
"traceId"
)
String
traceId
);
/**
* 根据风险来源查询人员红黄绿吗信息
*/
@PostMapping
(
"/task/updateRawDataByTraceId"
)
FeignClientResult
<
Boolean
>
updateRawDataByTraceId
(
@RequestParam
(
value
=
"traceId"
)
String
traceId
,
@RequestParam
(
value
=
"rawData"
)
String
rawData
);
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/emqx/JobRawDataUrlMessage.java
0 → 100644
View file @
8cc55d9b
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
emqx
;
import
cn.hutool.core.text.CharSequenceUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.BizMessage
;
import
com.yeejoin.amos.boot.module.jxiop.api.dto.TableContentVo
;
import
com.yeejoin.amos.boot.module.jxiop.api.feign.McbWarningFeign
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
@Slf4j
public
class
JobRawDataUrlMessage
extends
EmqxListener
{
@Resource
protected
EmqKeeper
emqKeeper
;
@Resource
private
McbWarningFeign
mcbWarningFeign
;
// 江西电建接收红黄绿码主题
private
static
final
String
UPDATE_RAWDATA_JOBURL
=
"update/rawData/jobUrl"
;
@PostConstruct
void
init
()
throws
Exception
{
emqKeeper
.
subscript
(
UPDATE_RAWDATA_JOBURL
,
2
,
this
);
}
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
log
.
info
(
"修改工单url数据{}"
,
new
String
(
message
.
getPayload
()));
JSONObject
ja
=
JSON
.
parseObject
(
new
String
(
message
.
getPayload
()));
jxIopUpdate
(
ja
);
}
@Async
(
"async"
)
public
void
jxIopUpdate
(
JSONObject
analysisResult
)
{
FeignClientResult
<
String
>
sevenEntityMcb
=
null
;
try
{
sevenEntityMcb
=
mcbWarningFeign
.
getWarningInfoByTraceId
(
analysisResult
.
get
(
"traceId"
).
toString
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
sevenEntityMcb
!=
null
&&
200
==
sevenEntityMcb
.
getStatus
()
&&
CharSequenceUtil
.
isNotEmpty
(
sevenEntityMcb
.
getResult
()))
{
String
result
=
sevenEntityMcb
.
getResult
();
BizMessage
alarmEvent
=
JSON
.
parseObject
(
result
,
BizMessage
.
class
);
List
<
Map
<
String
,
String
>>
list
=
new
ArrayList
<>();
Map
<
String
,
String
>
hashMap
=
new
HashMap
<>();
hashMap
.
put
(
"key"
,
"1"
);
hashMap
.
put
(
"name"
,
"工单详情"
);
hashMap
.
put
(
"url"
,
analysisResult
.
get
(
"url"
).
toString
());
list
.
add
(
hashMap
);
TableContentVo
tableContentVo
=
new
TableContentVo
(
"10"
,
"链接跳转"
,
list
,
"jump"
);
alarmEvent
.
getBizInfo
().
getDynamicDetails
().
get
(
0
).
getTabContent
().
add
(
tableContentVo
);
String
rawData
=
JSON
.
toJSONString
(
alarmEvent
);
mcbWarningFeign
.
updateRawDataByTraceId
(
analysisResult
.
get
(
"traceId"
).
toString
(),
rawData
);
log
.
info
(
"预警rawData字段修改完成,rawData数据:{}"
,
rawData
);
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/resources/application.properties
View file @
8cc55d9b
...
@@ -30,8 +30,10 @@ spring.liquibase.enabled=true
...
@@ -30,8 +30,10 @@ spring.liquibase.enabled=true
## eureka properties:
## eureka properties:
#eureka.instance.prefer-ip-address=true
eureka.instance.prefer-ip-address
=
true
#eureka.instance.ip-address=172.16.3.41
eureka.instance.ip-address
=
172.16.3.41
eureka.instance.instance-id
=
${eureka.instance.ip-address}:${server.port}
eureka.client.registry-fetch-interval-seconds
=
5
eureka.client.registry-fetch-interval-seconds
=
5
eureka.instance.health-check-url-path
=
/actuator/health
eureka.instance.health-check-url-path
=
/actuator/health
eureka.instance.lease-expiration-duration-in-seconds
=
10
eureka.instance.lease-expiration-duration-in-seconds
=
10
...
@@ -60,3 +62,5 @@ spring.http.encoding.force=true
...
@@ -60,3 +62,5 @@ spring.http.encoding.force=true
privilege.fegin.name
=
AMOS-API-PRIVILEGE
privilege.fegin.name
=
AMOS-API-PRIVILEGE
feign.client.config.default.connect-timeout
=
20000
feign.client.config.default.connect-timeout
=
20000
feign.client.config.default.read-timeout
=
20000
feign.client.config.default.read-timeout
=
20000
mcb.warning.name
=
MCB-SERVER
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