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
b5c414d2
Commit
b5c414d2
authored
Jun 20, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
15003967
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
36 deletions
+35
-36
EquipmentSpecificController.java
...n/equipmanage/controller/EquipmentSpecificController.java
+29
-16
MqttReceiveServiceImpl.java
...join/equipmanage/service/impl/MqttReceiveServiceImpl.java
+6
-0
AmosBootUtilsMessageApplicationTests.java
...om/yeejoin/amos/AmosBootUtilsMessageApplicationTests.java
+0
-20
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentSpecificController.java
View file @
b5c414d2
...
...
@@ -28,6 +28,7 @@ import com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -421,19 +422,19 @@ public class EquipmentSpecificController extends AbstractBaseController {
EquipmentSpecific
spec
=
equipmentSpecificSerivce
.
getBaseMapper
().
selectById
(
id
);
int
oldStatus
=
Integer
.
valueOf
(
spec
.
getEquipStatus
());
int
newStatus
=
Integer
.
valueOf
(
status
);
if
(
oldStatus
>=
newStatus
){
//保存 wl_equip_qrcode_record 二维码记录
EquipQrcodeRecord
equipQrcodeRecord
=
new
EquipQrcodeRecord
();
equipQrcodeRecord
.
setEquipid
(
Long
.
valueOf
(
id
));
equipQrcodeRecord
.
setSource
(
source
);
equipQrcodeRecord
.
setAlarmTime
(
new
Date
());
equipQrcodeRecord
.
setStatus
(
status
);
equipQrcodeRecord
.
setSourceId
(
Long
.
valueOf
(
sourceId
));
equipQrcodeRecord
.
setBizOrgCode
(
spec
.
getBizOrgCode
());
equipQrcodeRecord
.
setBizOrgName
(
spec
.
getBizOrgName
());
equipQrcodeRecord
.
setSystemCode
(
spec
.
getSystemId
());
equipQrcodeRecordMapper
.
insert
(
equipQrcodeRecord
);
}
else
{
//保存 wl_equip_qrcode_record 二维码记录
EquipQrcodeRecord
equipQrcodeRecord
=
new
EquipQrcodeRecord
();
equipQrcodeRecord
.
setEquipid
(
Long
.
valueOf
(
id
));
equipQrcodeRecord
.
setSource
(
source
);
equipQrcodeRecord
.
setAlarmTime
(
new
Date
());
equipQrcodeRecord
.
setStatus
(
status
);
equipQrcodeRecord
.
setSourceId
(
Long
.
valueOf
(
sourceId
));
equipQrcodeRecord
.
setBizOrgCode
(
spec
.
getBizOrgCode
());
equipQrcodeRecord
.
setBizOrgName
(
spec
.
getBizOrgName
());
equipQrcodeRecord
.
setSystemCode
(
spec
.
getSystemId
());
equipQrcodeRecordMapper
.
insert
(
equipQrcodeRecord
);
if
(
oldStatus
<
newStatus
){
//当前状态小于事件状态时 取更高级别状态赋码
equipmentSpecificSerivce
.
updateEquipSpecificStatus
(
status
,
id
);
}
return
CommonResponseUtil
.
success
();
...
...
@@ -441,17 +442,29 @@ public class EquipmentSpecificController extends AbstractBaseController {
@GetMapping
(
value
=
"/status/checkInput"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"idx修改
巡检项对应装备二维码状态"
,
notes
=
"idx修改巡检项
对应装备二维码状态"
)
public
ResponseModel
updateEquipSpecificStatusByCheckInput
(
String
id
){
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"idx修改
对应装备二维码状态"
,
notes
=
"idx修改
对应装备二维码状态"
)
public
ResponseModel
updateEquipSpecificStatusByCheckInput
(
@RequestParam
(
value
=
"id"
)
String
id
,
@RequestParam
(
value
=
"equipId"
,
required
=
false
)
String
equipId
){
//查询 巡检项所绑定装备
String
equipId
=
equipmentSpecificSerivce
.
updateEquipSpecificStatusByCheckInput
(
id
);
if
(
StringUtils
.
isEmpty
(
equipId
)){
equipId
=
equipmentSpecificSerivce
.
updateEquipSpecificStatusByCheckInput
(
id
);
}
LambdaQueryWrapper
<
EquipQrcodeRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
EquipQrcodeRecord:
:
getEquipid
,
equipId
);
query
.
notIn
(
EquipQrcodeRecord:
:
getSourceId
,
id
);
query
.
isNull
(
EquipQrcodeRecord:
:
getCleanTime
);
List
<
EquipQrcodeRecord
>
equipQrcodeRecords
=
equipQrcodeRecordMapper
.
selectList
(
query
);
if
(
equipQrcodeRecords
.
size
()
==
0
)
{
//如果记录表中此装备无未消除的故障等 则恢复绿码
//修改装备二维码状态为合格 此处为0代表绿色 是idx只有在合格是才会触发此接口
equipmentSpecificSerivce
.
updateEquipSpecificStatus
(
"0"
,
equipId
);
}
else
{
//先修改本次清除的装备事件
EquipQrcodeRecord
equipQrcodeRecord
=
equipQrcodeRecords
.
stream
().
filter
(
e
->
e
.
getSourceId
().
equals
(
id
)).
findFirst
().
get
();
equipQrcodeRecords
.
remove
(
equipQrcodeRecord
);
equipQrcodeRecord
.
setCleanTime
(
new
Date
());
equipQrcodeRecordMapper
.
updateById
(
equipQrcodeRecord
);
//然后取结果集中剩余状态最高的颜色赋码
String
status
=
equipQrcodeRecords
.
stream
().
sorted
(
Comparator
.
comparing
(
EquipQrcodeRecord:
:
getStatus
)).
findFirst
().
get
().
getStatus
();
equipmentSpecificSerivce
.
updateEquipSpecificStatus
(
status
,
equipId
);
}
return
CommonResponseUtil
.
success
();
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/MqttReceiveServiceImpl.java
View file @
b5c414d2
...
...
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm
;
import
com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm
;
...
...
@@ -28,7 +29,9 @@ import com.yeejoin.equipmanage.quartz.QuartzManager;
import
com.yeejoin.equipmanage.remote.RemoteSecurityService
;
import
com.yeejoin.equipmanage.service.*
;
import
com.yeejoin.equipmanage.utils.BeanUtil
;
import
javafx.scene.control.Tab
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.compress.utils.Lists
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -49,6 +52,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.math.RoundingMode
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -963,10 +967,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
mqttSendGateway
.
sendToMqtt
(
TopicEnum
.
EQYQR
.
getTopic
(),
JSONArray
.
toJSON
(
action
).
toString
());
bool
=
Boolean
.
TRUE
;
//查询二维码事件记录表中该设备的历史数据
LambdaQueryWrapper
<
EquipQrcodeRecord
>
query
=
new
LambdaQueryWrapper
<>();
query
.
eq
(
EquipQrcodeRecord:
:
getEquipid
,
action
.
getEquipmentSpecificId
());
query
.
isNull
(
EquipQrcodeRecord:
:
getCleanTime
);
List
<
EquipQrcodeRecord
>
equipQrcodeRecords
=
equipQrcodeRecordMapper
.
selectList
(
query
);
String
status
=
equipQrcodeRecords
.
stream
().
sorted
(
Comparator
.
comparing
(
EquipQrcodeRecord:
:
getStatus
)).
findFirst
().
get
().
getStatus
();
if
(
equipQrcodeRecords
.
size
()
>
0
)
{
//如果记录表中还存在未消除的巡检故障 则先修改为黄码
iEquipmentSpecificSerivce
.
updateEquipSpecificStatus
(
equipQrcodeRecords
.
get
(
0
).
getStatus
(),
String
.
valueOf
(
specific
.
getId
()));
}
else
{
...
...
amos-boot-utils/amos-boot-utils-message/src/test/java/com/yeejoin/amos/AmosBootUtilsMessageApplicationTests.java
deleted
100644 → 0
View file @
15003967
package
com
.
yeejoin
.
amos
;
import
com.yeejoin.amos.message.kafka.KafkaProducerService
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
@SpringBootTest
class
AmosBootUtilsMessageApplicationTests
{
@Autowired
private
KafkaProducerService
kafkaProducerService
;
@Test
void
contextLoads
()
{
String
msg
=
"hello"
;
kafkaProducerService
.
sendMessageAsync
(
"akka.iot.created"
,
msg
);
}
}
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