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
bd990199
Commit
bd990199
authored
Jun 07, 2024
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(jg):监管报错处理
parent
67ce2001
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
46 deletions
+61
-46
CommonController.java
.../amos/boot/module/jg/biz/controller/CommonController.java
+6
-6
PlatformUserTopicMessage.java
...boot/module/jg/biz/listener/PlatformUserTopicMessage.java
+46
-26
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+7
-13
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+1
-1
file.conf
...e-jg/amos-boot-module-jg-biz/src/main/resources/file.conf
+1
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/CommonController.java
View file @
bd990199
...
...
@@ -65,7 +65,7 @@ public class CommonController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getChildren"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"通过设备种类code获取设备类别"
,
notes
=
"通过设备种类code获取设备类别"
)
public
ResponseModel
<
List
<
EquipmentCategory
>>
getChildren
(
@RequestParam
(
value
=
"code"
)
String
code
,
public
ResponseModel
<
List
<
EquipmentCategory
>>
getChildren
(
@RequestParam
(
value
=
"code"
,
required
=
false
)
String
code
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
return
ResponseHelper
.
buildResponse
(
commonService
.
getEquipmentCategoryList
(
code
,
type
));
}
...
...
@@ -193,11 +193,11 @@ public class CommonController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getUserInfoSplit"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询安全管理员的基本信息"
,
notes
=
"查询安全管理员的基本信息"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getUserInfoSplit
(
@RequestParam
(
value
=
"sequenceNbr"
)
String
sequenceNbr
)
{
if
(
sequenceNbr
.
contains
(
"_"
))
{
sequenceNbr
=
sequenceNbr
.
split
(
"_"
)[
0
];
}
return
ResponseHelper
.
buildResponse
(
commonService
.
getUserInfo
(
sequenceNbr
)
);
public
ResponseModel
<
Map
<
String
,
Object
>>
getUserInfoSplit
(
@RequestParam
(
value
=
"sequenceNbr"
,
required
=
false
)
String
sequenceNbr
)
{
return
Optional
.
ofNullable
(
sequenceNbr
)
.
filter
(
s
->
s
.
contains
(
"_"
))
.
map
(
s
->
ResponseHelper
.
buildResponse
(
commonService
.
getUserInfo
(
s
.
split
(
"_"
)[
0
])))
.
orElse
(
null
);
}
/**
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/listener/PlatformUserTopicMessage.java
View file @
bd990199
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
listener
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.service.ICommonService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.StartPlatformTokenService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -13,59 +13,79 @@ import org.springframework.beans.factory.annotation.Value;
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.stream.Stream
;
@Component
@Slf4j
public
class
PlatformUserTopicMessage
extends
EmqxListener
{
private
final
String
companyType
=
"行政审批局"
;
@Resource
protected
EmqKeeper
emqKeeper
;
@Value
(
"${amos.operation.log}"
)
private
String
amosOperationLog
;
@PostConstruct
void
init
()
throws
Exception
{
emqKeeper
.
subscript
(
amosOperationLog
,
2
,
this
);
}
@Value
(
"${amos.agency.code}"
)
String
amosAgencyCode
;
private
String
amosAgencyCode
;
@Autowired
RedisUtils
redisUtil
;
private
StartPlatformTokenService
platformTokenService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Autowired
ICommonService
commonService
;
private
ICommonService
commonService
;
@PostConstruct
void
init
()
throws
Exception
{
emqKeeper
.
subscript
(
amosOperationLog
,
2
,
this
);
}
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
platformTokenService
.
getToken
();
parseMessage
(
message
)
.
filter
(
jsonObject
->
amosAgencyCode
.
equals
(
jsonObject
.
getString
(
"agencyCode"
)))
.
map
(
jsonObject
->
jsonObject
.
getJSONObject
(
"result"
))
.
filter
(
result
->
StringUtils
.
isNotEmpty
(
result
.
getString
(
"path"
)))
.
map
(
result
->
result
.
get
(
"result"
))
.
flatMap
(
this
::
streamDataResult
)
.
forEach
(
this
::
processDataResult
);
log
.
info
(
"平台推送消息同步完成"
);
}
private
Stream
<
JSONObject
>
streamDataResult
(
Object
dataResult
)
{
if
(
dataResult
instanceof
JSONObject
)
{
return
Stream
.
of
((
JSONObject
)
dataResult
);
}
else
if
(
dataResult
instanceof
JSONArray
)
{
JSONArray
dataResultArray
=
(
JSONArray
)
dataResult
;
return
dataResultArray
.
stream
()
.
map
(
JSONObject
.
class
::
cast
);
}
else
{
log
.
warn
(
"未知的数据类型: {}"
,
dataResult
.
getClass
().
getName
());
return
Stream
.
empty
();
}
}
private
Stream
<
JSONObject
>
parseMessage
(
MqttMessage
message
)
{
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
message
.
toString
());
JSONObject
result
=
jsonObject
.
getJSONObject
(
"result"
);
JSONObject
dataResult
=
result
.
getJSONObject
(
"result"
);
String
path
=
result
.
getString
(
"path"
);
String
agencyCode
=
jsonObject
.
getString
(
"agencyCode"
);
if
(!
amosAgencyCode
.
equals
(
agencyCode
))
{
return
;
return
Stream
.
of
(
jsonObject
);
}
catch
(
Exception
e
)
{
log
.
error
(
"消息解析失败: {}"
,
message
.
toString
(),
e
);
return
Stream
.
empty
();
}
}
private
void
processDataResult
(
JSONObject
dataResultObject
)
{
try
{
if
(
StringUtils
.
isNotEmpty
(
path
))
{
if
(
dataResult
.
get
(
"companyType"
).
toString
().
contains
(
companyType
))
{
String
companyType
=
"行政审批局"
;
String
companyTypeValue
=
dataResultObject
.
getString
(
"companyType"
);
if
(
StringUtils
.
isNotEmpty
(
companyTypeValue
)
&&
companyTypeValue
.
contains
(
companyType
))
{
commonService
.
creatApproveTree
();
}
}
}
catch
(
Exception
e
)
{
log
.
info
(
"平台同步消息失败:{}"
,
e
.
getMessage
()
);
log
.
error
(
"平台同步消息处理失败: {}"
,
dataResultObject
,
e
);
}
log
.
info
(
"平台推送消息同步完成"
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/CommonServiceImpl.java
View file @
bd990199
...
...
@@ -322,24 +322,18 @@ public class CommonServiceImpl implements ICommonService {
@Override
public
List
<
EquipmentCategory
>
getEquipmentCategoryList
(
String
code
,
String
type
)
{
List
<
EquipmentCategory
>
result
=
new
ArrayList
<>();
if
(
StringUtils
.
isEmpty
(
code
))
{
return
Collections
.
emptyList
();
}
LambdaQueryWrapper
<
EquipmentCategory
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
EquipmentCategory:
:
getCode
,
code
);
EquipmentCategory
equipmentCategory
=
equipmentCategoryMapper
.
selectOne
(
wrapper
);
if
(
ObjectUtils
.
isEmpty
(
type
))
{
if
(!
ValidationUtil
.
isEmpty
(
equipmentCategory
))
{
result
.
add
(
equipmentCategory
);
if
(
equipmentCategory
==
null
)
{
return
Collections
.
emptyList
();
}
}
else
{
LambdaQueryWrapper
<
EquipmentCategory
>
wrapper2
=
new
LambdaQueryWrapper
<>();
wrapper2
.
eq
(
EquipmentCategory:
:
getParentId
,
equipmentCategory
.
getId
());
List
<
EquipmentCategory
>
equipmentCategories
=
equipmentCategoryMapper
.
selectList
(
wrapper2
);
if
(!
ValidationUtil
.
isEmpty
(
equipmentCategories
))
{
result
=
equipmentCategories
;
}
}
return
result
;
wrapper2
.
eq
(!
StringUtils
.
isEmpty
(
type
),
EquipmentCategory:
:
getParentId
,
equipmentCategory
.
getId
());
return
equipmentCategoryMapper
.
selectList
(
wrapper2
);
}
@Override
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
View file @
bd990199
...
...
@@ -1127,7 +1127,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
)
@GlobalTransactional
(
rollbackFor
=
Exception
.
class
,
timeoutMills
=
600000
)
public
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
,
String
carNumber
,
String
manageType
,
String
nextTaskId
)
{
String
lockKey
=
CommonServiceImpl
.
buildJgExecuteLockKey
(
instanceId
);
RLock
lock
=
redissonClient
.
getLock
(
lockKey
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/resources/file.conf
View file @
bd990199
...
...
@@ -54,6 +54,7 @@ client {
tm
{
commitRetryCount
=
5
rollbackRetryCount
=
5
default
-
global
-
transaction
-
timeout
=
600
# 600秒
}
undo
{
dataValidation
=
true
...
...
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