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
674eb84e
Commit
674eb84e
authored
Aug 25, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refeat(96333): 警情报送
1.警情重复问题处理,,一个工单号有多个警情,数据一样,增加校验,数据库已有数据时不再插入而是更新
parent
f4b258a3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
23 deletions
+30
-23
AlertCalledController.java
...module/elevator/biz/controller/AlertCalledController.java
+6
-7
AlertCalledServiceImpl.java
...ule/elevator/biz/service/impl/AlertCalledServiceImpl.java
+20
-14
application.properties
...odule-96333-biz/src/main/resources/application.properties
+4
-2
No files found.
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/controller/AlertCalledController.java
View file @
674eb84e
...
@@ -57,6 +57,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
...
@@ -57,6 +57,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.StandardCharsets
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -162,20 +163,18 @@ public class AlertCalledController extends BaseController {
...
@@ -162,20 +163,18 @@ public class AlertCalledController extends BaseController {
jsonObject
.
put
(
"alertId"
,
String
.
valueOf
(
alertCalledObjsDto
.
getAlertCalledDto
().
getSequenceNbr
()));
jsonObject
.
put
(
"alertId"
,
String
.
valueOf
(
alertCalledObjsDto
.
getAlertCalledDto
().
getSequenceNbr
()));
JSONObject
jsonObject1
=
new
JSONObject
();
JSONObject
jsonObject1
=
new
JSONObject
();
jsonObject
.
put
(
"alertId"
,
String
.
valueOf
(
alertCalledObjsDto
.
getAlertCalledDto
().
getSequenceNbr
()));
jsonObject
1
.
put
(
"alertId"
,
String
.
valueOf
(
alertCalledObjsDto
.
getAlertCalledDto
().
getSequenceNbr
()));
try
{
try
{
emqKeeper
.
getMqttClient
().
publish
(
alertReportpushTopic
,
jsonObject
.
toString
().
getBytes
(
"UTF-8"
),
1
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
alertReportpushTopic
,
jsonObject
.
toString
().
getBytes
(
StandardCharsets
.
UTF_8
),
1
,
false
);
// 跑马灯消息提醒
// 跑马灯消息提醒
if
(
null
!=
alertCalledObjsDto
.
getAlertCalledDto
().
getFatherAlert
())
{
if
(
null
!=
alertCalledObjsDto
.
getAlertCalledDto
().
getFatherAlert
())
{
emqKeeper
.
getMqttClient
().
publish
(
alertInfopushTopic
,
jsonObject1
.
toString
().
getBytes
(
"UTF-8"
),
1
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
alertInfopushTopic
,
jsonObject1
.
toString
().
getBytes
(
StandardCharsets
.
UTF_8
),
1
,
false
);
}
}
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
logger
.
error
(
"mqtt发送失败"
+
jsonObject
);
logger
.
error
(
"mqtt发送失败:{}"
,
jsonObject
);
}
catch
(
UnsupportedEncodingException
e
)
{
logger
.
error
(
"mqtt发送失败"
+
jsonObject
);
}
}
return
ResponseHelper
.
buildResponse
(
alertCalledObjsDto
.
getAlertCalledDto
());
return
ResponseHelper
.
buildResponse
(
alertCalledObjsDto
.
getAlertCalledDto
());
}
}
private
void
saveAlertCallRecord
(
AlertCalledObjsDto
alertCalledObjsDto
)
{
private
void
saveAlertCallRecord
(
AlertCalledObjsDto
alertCalledObjsDto
)
{
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/AlertCalledServiceImpl.java
View file @
674eb84e
...
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.SystemClock;
...
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.SystemClock;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
...
@@ -57,6 +58,7 @@ import java.time.ZoneId;
...
@@ -57,6 +58,7 @@ import java.time.ZoneId;
import
java.time.temporal.ChronoUnit
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ExecutionException
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
parseArray
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
parseArray
;
...
@@ -155,6 +157,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -155,6 +157,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Value
(
"classpath:/json/repairFollow.json"
)
@Value
(
"classpath:/json/repairFollow.json"
)
private
Resource
repairFollowJson
;
private
Resource
repairFollowJson
;
@Value
(
"${global-config.worker-id:1}"
)
private
int
workId
;
public
AlertCalledServiceImpl
(
RedissonClient
client
){
public
AlertCalledServiceImpl
(
RedissonClient
client
){
this
.
redissonClient
=
client
;
this
.
redissonClient
=
client
;
...
@@ -567,11 +572,16 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -567,11 +572,16 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
AlertCalled
alertCalled
=
BeanDtoVoUtils
.
convert
(
alertCalledObjsDto
.
getAlertCalledDto
(),
AlertCalled
.
class
);
AlertCalled
alertCalled
=
BeanDtoVoUtils
.
convert
(
alertCalledObjsDto
.
getAlertCalledDto
(),
AlertCalled
.
class
);
alertCalled
.
setEquipmentClassification
(
alertCalledObjsDto
.
getAlertCalledDto
().
getEquipment
());
alertCalled
.
setEquipmentClassification
(
alertCalledObjsDto
.
getAlertCalledDto
().
getEquipment
());
Map
<
String
,
String
>
getCode
=
EquipmentClassifityEnum
.
getCode
;
Map
<
String
,
String
>
getCode
=
EquipmentClassifityEnum
.
getCode
;
String
code
=
getCode
.
get
(
alertCalledObjsDto
.
getAlertCalledDto
().
getEquipment
()
.
toString
()
);
String
code
=
getCode
.
get
(
alertCalledObjsDto
.
getAlertCalledDto
().
getEquipment
());
alertCalled
.
setEquipmentClassificationCode
(
code
);
alertCalled
.
setEquipmentClassificationCode
(
code
);
alertCalled
.
setCallTime
(
DateUtils
.
longStr2Date
(
alertCalled
.
getCallTimeStr
()));
alertCalled
.
setCallTime
(
DateUtils
.
longStr2Date
(
alertCalled
.
getCallTimeStr
()));
String
groupCode
=
ctiService
.
getSkillGroup
(
user
.
getUserId
());
String
groupCode
=
ctiService
.
getSkillGroup
(
user
.
getUserId
());
alertCalled
.
setSkillGroup
(
groupCode
);
alertCalled
.
setSkillGroup
(
groupCode
);
// 重复填报使用覆盖原有最新(按照主键倒叙排列)且非删除状态的警情,工单号唯一,正常不会出现一个工单号有两条数据
AlertCalled
existAlertCalled
=
this
.
getOne
(
new
LambdaQueryWrapper
<
AlertCalled
>().
eq
(
AlertCalled:
:
getWorkOrderNumber
,
alertCalled
.
getWorkOrderNumber
()).
eq
(
BaseEntity:
:
getIsDelete
,
false
).
orderByDesc
(
AlertCalled:
:
getSequenceNbr
).
last
(
"limit 1"
));
if
(
existAlertCalled
!=
null
){
alertCalled
.
setSequenceNbr
(
existAlertCalled
.
getSequenceNbr
());
}
// 判断是否归并警情
// 判断是否归并警情
if
(
alertCalled
.
getFatherAlert
()
!=
null
)
{
if
(
alertCalled
.
getFatherAlert
()
!=
null
)
{
// 警情归并,设置当前警情状态为结束。
// 警情归并,设置当前警情状态为结束。
...
@@ -580,17 +590,16 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -580,17 +590,16 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalled
.
setAlertStageCode
(
DispatchPaperEnums
.
receivedAlert
.
getId
());
alertCalled
.
setAlertStageCode
(
DispatchPaperEnums
.
receivedAlert
.
getId
());
alertCalled
.
setType
(
AlertStageEnums
.
JQGB
.
getValue
());
alertCalled
.
setType
(
AlertStageEnums
.
JQGB
.
getValue
());
alertCalled
.
setTypeCode
(
AlertStageEnums
.
JQGB
.
getId
());
alertCalled
.
setTypeCode
(
AlertStageEnums
.
JQGB
.
getId
());
this
.
save
(
alertCalled
);
this
.
save
OrUpdate
(
alertCalled
);
// 动态表单
// 动态表单
List
<
AlertFormValue
>
alertFormValuelist
=
alertCalledObjsDto
.
getAlertFormValue
();
List
<
AlertFormValue
>
alertFormValuelist
=
alertCalledObjsDto
.
getAlertFormValue
();
// 填充警情主键
// 填充警情主键
alertFormValuelist
.
stream
().
forEach
(
alertFormValue
->
{
alertFormValuelist
.
forEach
(
alertFormValue
->
{
alertFormValue
.
setAlertCalledId
(
alertCalled
.
getSequenceNbr
());
alertFormValue
.
setAlertCalledId
(
alertCalled
.
getSequenceNbr
());
alertFormValue
.
setAlertTypeCode
(
alertCalled
.
getAlarmTypeCode
());
alertFormValue
.
setAlertTypeCode
(
alertCalled
.
getAlarmTypeCode
());
});
});
// 保存动态表单数据
// 保存动态表单数据
iAlertFormValueService
.
saveBatch
(
alertFormValuelist
);
iAlertFormValueService
.
saveBatch
(
alertFormValuelist
);
// 返回父警情基本信息和自身alertID
// 返回父警情基本信息和自身alertID
AlertCalled
alertCalledFather
=
this
.
getById
(
alertCalled
.
getFatherAlert
());
AlertCalled
alertCalledFather
=
this
.
getById
(
alertCalled
.
getFatherAlert
());
AlertCalledDto
alertCalledDto
=
BeanDtoVoUtils
.
convert
(
alertCalledFather
,
AlertCalledDto
.
class
);
AlertCalledDto
alertCalledDto
=
BeanDtoVoUtils
.
convert
(
alertCalledFather
,
AlertCalledDto
.
class
);
...
@@ -615,14 +624,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -615,14 +624,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalled
.
setRegionCode
(
map
.
get
(
"regionCode"
).
toString
());
alertCalled
.
setRegionCode
(
map
.
get
(
"regionCode"
).
toString
());
alertCalled
.
setBizOrgCode
(
map
.
get
(
"orgCode"
)
+
""
);
alertCalled
.
setBizOrgCode
(
map
.
get
(
"orgCode"
)
+
""
);
}
}
this
.
saveOrUpdate
(
alertCalled
);
this
.
save
(
alertCalled
);
// 动态表单
// 动态表单
List
<
AlertFormValue
>
alertFormValuelist
=
alertCalledObjsDto
.
getAlertFormValue
();
List
<
AlertFormValue
>
alertFormValuelist
=
alertCalledObjsDto
.
getAlertFormValue
();
// 填充警情主键
// 填充警情主键
alertFormValuelist
.
stream
().
forEach
(
alertFormValue
->
{
alertFormValuelist
.
forEach
(
alertFormValue
->
{
alertFormValue
.
setAlertCalledId
(
alertCalled
.
getSequenceNbr
());
alertFormValue
.
setAlertCalledId
(
alertCalled
.
getSequenceNbr
());
alertFormValue
.
setAlertTypeCode
(
alertCalled
.
getAlarmTypeCode
());
alertFormValue
.
setAlertTypeCode
(
alertCalled
.
getAlarmTypeCode
());
});
});
...
@@ -630,7 +636,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -630,7 +636,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
//困人救援创建警情时创建救援过程信息
//困人救援创建警情时创建救援过程信息
rescueProcessServiceImpl
.
getProcessByAlertId
(
alertCalled
.
getSequenceNbr
());
rescueProcessServiceImpl
.
getProcessByAlertId
(
alertCalled
.
getSequenceNbr
());
}
}
// 保存动态表单数据
// 保存动态表单数据
iAlertFormValueService
.
saveBatch
(
alertFormValuelist
);
iAlertFormValueService
.
saveBatch
(
alertFormValuelist
);
alertCalledObjsDto
.
setAlertCalledDto
(
BeanDtoVoUtils
.
convert
(
alertCalled
,
AlertCalledDto
.
class
));
alertCalledObjsDto
.
setAlertCalledDto
(
BeanDtoVoUtils
.
convert
(
alertCalled
,
AlertCalledDto
.
class
));
...
@@ -640,7 +645,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -640,7 +645,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
//同步保存ES
//同步保存ES
eSAlertCalledService
.
saveAlertCalledToES
(
alertCalled
);
eSAlertCalledService
.
saveAlertCalledToES
(
alertCalled
);
}
}
return
alertCalledObjsDto
;
return
alertCalledObjsDto
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"报送失败"
,
e
);
logger
.
error
(
"报送失败"
,
e
);
...
@@ -853,9 +857,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -853,9 +857,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
if
(
remainTimeToLive
<=
0
)
{
if
(
remainTimeToLive
<=
0
)
{
resetCounterAndExpire
();
resetCounterAndExpire
();
}
}
long
seq
=
rAtomicLong
.
incrementAndG
et
();
long
seq
=
rAtomicLong
.
addAndGetAsync
(
1
).
g
et
();
String
number
=
DateUtils
.
stampToDate
(
SystemClock
.
now
(),
"yyyyMMddHHmmss"
);
String
number
=
DateUtils
.
stampToDate
(
SystemClock
.
now
(),
"yyyyMMddHHmmss"
);
workOrderNumber
=
number
+
seq
;
workOrderNumber
=
number
+
workId
+
seq
;
}
catch
(
ExecutionException
|
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
finally
{
}
finally
{
if
(
lock
.
isHeldByCurrentThread
())
{
if
(
lock
.
isHeldByCurrentThread
())
{
lock
.
unlock
();
lock
.
unlock
();
...
@@ -948,7 +954,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
...
@@ -948,7 +954,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
private
long
calculateExpirationTime
()
{
private
long
calculateExpirationTime
()
{
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
nextDay
=
now
.
plus
(
1
,
ChronoUnit
.
DAYS
).
withHour
(
0
).
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
);
LocalDateTime
nextDay
=
now
.
plus
Days
(
1
).
withHour
(
0
).
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
);
return
nextDay
.
atZone
(
ZoneId
.
systemDefault
()).
toInstant
().
toEpochMilli
();
return
nextDay
.
atZone
(
ZoneId
.
systemDefault
()).
toInstant
().
toEpochMilli
();
}
}
...
...
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/resources/application.properties
View file @
674eb84e
...
@@ -162,4 +162,6 @@ tzs.auth.user.photo=/public/common/userPic.png
...
@@ -162,4 +162,6 @@ tzs.auth.user.photo=/public/common/userPic.png
tzs.WxApp.appId
=
wx48a1b1915b10d14b
tzs.WxApp.appId
=
wx48a1b1915b10d14b
tzs.WxApp.secret
=
ac4f4a9d3c97676badb70c19a2f37b16
tzs.WxApp.secret
=
ac4f4a9d3c97676badb70c19a2f37b16
tzs.WxApp.grant-type
=
authorization_code
tzs.WxApp.grant-type
=
authorization_code
\ No newline at end of file
global-config.worker-id
=
2
\ No newline at end of file
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