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
68a7706e
Commit
68a7706e
authored
Aug 15, 2023
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
场站红黄码规则部分代码提交
parent
04c57b16
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
0 deletions
+106
-0
StationBasicMapper.java
...amos/boot/module/jxiop/api/mapper/StationBasicMapper.java
+7
-0
StationBasicMapper.xml
...xiop-api/src/main/resources/mapper/StationBasicMapper.xml
+11
-0
pom.xml
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/pom.xml
+6
-0
StationYardMessage.java
...n/amos/boot/module/jxiop/biz/emqx/StationYardMessage.java
+82
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/mapper/StationBasicMapper.java
View file @
68a7706e
...
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 场站基础信息表 Mapper 接口
...
...
@@ -57,4 +58,10 @@ public interface StationBasicMapper extends BaseMapper<StationBasic> {
*/
List
<
TreeDto
>
getStationListByRegionCode
(
@Param
(
"regionCode"
)
String
regionCode
);
/**
* 根据ProjectOrgCode更新红黄绿码
* @param analysisResult 更新数据信息
*/
int
updateYardByProjectOrgCode
(
@Param
(
"list"
)
List
<
Map
<
String
,
String
>>
analysisResult
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/resources/mapper/StationBasicMapper.xml
View file @
68a7706e
...
...
@@ -168,4 +168,15 @@
</if>
</where>
</select>
<update
id=
"updateYardByProjectOrgCode"
>
<foreach
collection=
"list"
item=
"item"
separator=
";"
>
update
`station_basic`
set
`qrcode_color` = #{item.qrcodeColor}
where
project_org_code = #{item.code}
</foreach>
</update>
</mapper>
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/pom.xml
View file @
68a7706e
...
...
@@ -41,6 +41,12 @@
<artifactId>
spring-boot-starter-activemq
</artifactId>
<version>
2.5.4
</version>
</dependency>
<dependency>
<groupId>
net.sf.json-lib
</groupId>
<artifactId>
json-lib
</artifactId>
<version>
2.4
</version>
<classifier>
jdk15
</classifier>
</dependency>
</dependencies>
<build>
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/emqx/StationYardMessage.java
0 → 100644
View file @
68a7706e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
emqx
;
import
com.alibaba.fastjson.JSONArray
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.LinkedBlockingQueue
;
@Component
@EnableScheduling
@Slf4j
public
class
StationYardMessage
extends
EmqxListener
{
@Autowired
private
AmosRequestContext
amosAuth
;
@Autowired
protected
EmqKeeper
emqKeeper
;
@Autowired
private
StationBasicMapper
stationBasicMapper
;
// 江西电建接收红黄绿码主题
private
static
final
String
JXIOP_STATION_YARD
=
"jxIop/station/yard"
;
private
static
final
BlockingQueue
<
List
<
Map
<
String
,
String
>>>
blockingQueue
=
new
LinkedBlockingQueue
<
List
<
Map
<
String
,
String
>>>();
@PostConstruct
void
init
()
throws
Exception
{
new
Thread
(
taskRunnable
).
start
();
emqKeeper
.
subscript
(
JXIOP_STATION_YARD
,
2
,
this
);
}
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
JSONArray
ja
=
JSONArray
.
parseArray
(
new
String
(
message
.
getPayload
()));
List
<
Map
<
String
,
String
>>
liMap
=
JSONArray
.
toJavaObject
(
ja
,
List
.
class
);
blockingQueue
.
add
(
liMap
);
}
Runnable
taskRunnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
boolean
isRun
=
true
;
int
k
=
0
;
while
(
isRun
)
{
k
++;
isRun
=
k
<
Integer
.
MAX_VALUE
;
try
{
List
<
Map
<
String
,
String
>>
analysisResult
=
blockingQueue
.
take
();
RequestContext
.
setAppKey
(
amosAuth
.
getAppKey
());
RequestContext
.
setProduct
(
amosAuth
.
getProduct
());
RequestContext
.
setToken
(
amosAuth
.
getToken
());
jxIopUpdate
(
analysisResult
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
};
public
void
jxIopUpdate
(
List
<
Map
<
String
,
String
>>
analysisResult
)
{
log
.
info
(
"场站红黄绿码数据:{}"
,
analysisResult
);
stationBasicMapper
.
updateYardByProjectOrgCode
(
analysisResult
);
}
}
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