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
99d83fb1
Commit
99d83fb1
authored
Jan 09, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.任务下发
parent
ee365a0f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
180 additions
and
34 deletions
+180
-34
FeignAuthRequestInterceptor.java
...os/boot/biz/common/feign/FeignAuthRequestInterceptor.java
+6
-0
JgInstallationNotice.java
.../amos/boot/module/jg/api/entity/JgInstallationNotice.java
+5
-0
PublicWorkFlowMessage.java
...os/boot/module/jg/biz/listener/PublicWorkFlowMessage.java
+48
-34
InstallationNoticeMsgListener.java
.../module/jg/biz/message/InstallationNoticeMsgListener.java
+45
-0
WorkFlowMessageListener.java
...s/boot/module/jg/biz/message/WorkFlowMessageListener.java
+76
-0
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+0
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/feign/FeignAuthRequestInterceptor.java
View file @
99d83fb1
...
...
@@ -5,6 +5,7 @@ import feign.RequestTemplate;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -39,6 +40,11 @@ public class FeignAuthRequestInterceptor implements RequestInterceptor {
template
.
header
(
"token"
,
authToken
);
template
.
header
(
"appKey"
,
appKey
);
template
.
header
(
"product"
,
product
);
}
else
{
template
.
header
(
"X-Access-Token"
,
RequestContext
.
getToken
());
template
.
header
(
"token"
,
RequestContext
.
getToken
());
template
.
header
(
"appKey"
,
RequestContext
.
getAppKey
());
template
.
header
(
"product"
,
RequestContext
.
getProduct
());
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/entity/JgInstallationNotice.java
View file @
99d83fb1
...
...
@@ -395,4 +395,9 @@ public class JgInstallationNotice extends BaseEntity {
@JsonSerialize
(
using
=
BizCustomDateSerializer
.
class
)
private
Date
handleDate
;
/**
* 流程任务状态(来源工作流)
*/
private
String
approvalStatus
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/listener/PublicWorkFlowMessage.java
View file @
99d83fb1
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
listener
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.biz.
service.impl.JgInstallationNoticeServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.
message.WorkFlowMessageListener
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.model.TaskV2Model
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -31,60 +26,79 @@ public class PublicWorkFlowMessage extends EmqxListener {
@Autowired
AmosRequestContext
amosAuth
;
private
List
<
WorkFlowMessageListener
>
workFlowMessageListeners
;
public
PublicWorkFlowMessage
(
List
<
WorkFlowMessageListener
>
workFlowMessageListeners
)
{
this
.
workFlowMessageListeners
=
workFlowMessageListeners
;
}
/**
* 创建任务主题
*/
p
ublic
static
final
String
WORKFLOW_TASK_CREATED
=
"workflow/task/created"
;
p
rivate
static
final
String
WORKFLOW_TASK_CREATED
=
"workflow/task/created"
;
/**
* 执行完成任务主题
*/
p
ublic
static
final
String
WORKFLOW_TASK_COMPLETED
=
"workflow/task/completed"
;
p
rivate
static
final
String
WORKFLOW_TASK_COMPLETED
=
"workflow/task/completed"
;
/**
* 流程执行结束主题
*/
p
ublic
static
final
String
WORKFLOW_PROCESS_COMPLETE
=
"workflow/process/complete"
;
p
rivate
static
final
String
WORKFLOW_PROCESS_COMPLETE
=
"workflow/process/complete"
;
@Autowired
private
JgInstallationNoticeServiceImpl
jgInstallationNoticeService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@Autowired
AmosRequestContext
amosRequestContext
;
@PostConstruct
void
init
()
throws
Exception
{
emqKeeper
.
subscript
(
WORKFLOW_TASK_CREATED
,
2
,
this
);
emqKeeper
.
subscript
(
WORKFLOW_TASK_COMPLETED
,
2
,
this
);
//
emqKeeper.subscript(WORKFLOW_PROCESS_COMPLETE, 2, this);
emqKeeper
.
subscript
(
WORKFLOW_PROCESS_COMPLETE
,
2
,
this
);
}
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
// RequestContext.setAppKey(amosAuth.getAppKey());
// RequestContext.setProduct(amosAuth.getProduct());
// RequestContext.setToken(amosAuth.getToken());
// RequestContext.setAgencyCode(amosAuth.getUserId());
// platformTokenService.getToken();
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
JSONObject
messageObject
=
JSON
.
parseObject
(
new
String
(
message
.
getPayload
()));
String
businessKey
=
messageObject
.
get
(
"businessKey"
).
toString
();
String
[]
s
=
businessKey
.
split
(
"_"
);
String
businessId
=
s
[
0
];
String
type
=
s
[
1
];
messageObject
.
put
(
"businessId"
,
businessId
);
if
(
topic
.
equals
(
WORKFLOW_TASK_CREATED
))
{
if
(
"installationNotice"
.
equals
(
type
))
{
jgInstallationNoticeService
.
updateByWorkFlow
(
messageObject
);
}
}
else
if
(
topic
.
equals
(
WORKFLOW_TASK_COMPLETED
))
{
if
(
"installationNotice"
.
equals
(
type
))
{
jgInstallationNoticeService
.
completeWorkFlow
(
messageObject
);
}
}
else
if
(
topic
.
equals
(
WORKFLOW_PROCESS_COMPLETE
))
{
if
(
"installationNotice"
.
equals
(
type
))
{
// jgInstallationNoticeService.completeWorkFlow(messageObject);
log
.
info
(
"收到工作流消息,主题:{},内容:{}"
,
topic
,
messageObject
);
String
processDefinitionKey
=
messageObject
.
get
(
"processDefinitionKey"
).
toString
();
String
type
=
getApprovalStatusStr
(
messageObject
);
WorkFlowMessageListener
.
BizTypeEnum
bizTypeEnum
=
WorkFlowMessageListener
.
getEnum
(
processDefinitionKey
);
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
workFlowMessageListeners
.
forEach
(
h
->
{
if
(
h
.
canHandlerType
().
equals
(
bizTypeEnum
))
{
switch
(
topic
)
{
case
WORKFLOW_TASK_CREATED:
h
.
afterCreate
(
messageObject
);
break
;
case
WORKFLOW_TASK_COMPLETED:
h
.
afterComplete
(
type
,
messageObject
);
break
;
case
WORKFLOW_PROCESS_COMPLETE:
h
.
afterFinish
(
messageObject
);
break
;
default
:
break
;
}
}
});
}
private
String
getApprovalStatusStr
(
JSONObject
messageObject
)
{
String
type
=
""
;
JSONObject
variables
=
messageObject
.
getJSONObject
(
"variables"
);
if
(
variables
!=
null
)
{
type
=
variables
.
getString
(
"approvalStatus"
);
}
return
type
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/message/InstallationNoticeMsgListener.java
0 → 100644
View file @
99d83fb1
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
message
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
/**
* @author Administrator
*/
@Component
public
class
InstallationNoticeMsgListener
implements
WorkFlowMessageListener
{
@Autowired
JgInstallationNoticeServiceImpl
jgInstallationNoticeService
;
/**
* 处理消息方法-Create
* 1.更新业务数据【instanceId、nextExecutedIds、status、instanceStatus(所有执行过的加下一步待执行角色)】
* 2.创建待办(初始未完成状态)
* @param message message 消息内容
*/
@Override
public
void
afterCreate
(
JSONObject
message
)
{
jgInstallationNoticeService
.
updateByWorkFlow
(
message
);
}
@Override
public
void
afterComplete
(
String
type
,
JSONObject
message
)
{
jgInstallationNoticeService
.
completeWorkFlow
(
type
,
message
);
}
@Override
public
void
afterFinish
(
JSONObject
message
)
{
String
businessKey
=
message
.
getString
(
"businessKey"
);
JgInstallationNotice
jgInstallationNotice
=
jgInstallationNoticeService
.
getBaseMapper
().
selectById
(
businessKey
);
jgInstallationNoticeService
.
finishTask
(
jgInstallationNotice
);
}
@Override
public
BizTypeEnum
canHandlerType
()
{
return
BizTypeEnum
.
installationNotificationNew
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/message/WorkFlowMessageListener.java
0 → 100644
View file @
99d83fb1
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
message
;
import
com.alibaba.fastjson.JSONObject
;
/**
* @author Administrator
*/
public
interface
WorkFlowMessageListener
{
/**
* 处理消息方法-Create
* 1.更新业务数据【instanceId、nextExecutedIds、status、instanceStatus(所有执行过的加下一步待执行角色)】
* 2.创建待办(初始未完成状态)
* @param message message 消息内容
*/
void
afterCreate
(
JSONObject
message
);
/**
* 处理消息方法-完成
* 1.更新代办(更新为已完成状态)
* 2.更新业务数据【status、instanceStatus(所有执行过的加下一步待执行角色)、新增字段-taskResult(工作流节点执行结果)】
* @param approvalStatus 工作流任务状态
* @param message message 消息内容
*/
void
afterComplete
(
String
approvalStatus
,
JSONObject
message
);
/**
* 处理消息方法-流程结束
* 1.业务处理
* @param message message 消息内容
*/
void
afterFinish
(
JSONObject
message
);
/**
* 可处理的消息类型
* @return BizTypeEnum
*/
BizTypeEnum
canHandlerType
();
enum
BizTypeEnum
{
// 更名变更登记
unitRename
,
// 单位变更
unitChange
,
// 移装变更登记
changeRegistrationTransfer
,
// 使用登记审核
useRegistration
,
// 安装告知
installationNotificationNew
,
// 维保备案
maintenanceFiling
,
// 电梯注销
scrapCancel
,
// 改造变更登记
renovationRegistrationReview
,
// 维修告知
maintainNotice
,
// 改造告知
renovationNoticeNew
,
// 电梯停用启用
deactivateEnable
,
// 移装告知
transferNotice
,
// 设备移交
equipmentHandover
}
static
BizTypeEnum
getEnum
(
String
name
){
return
BizTypeEnum
.
valueOf
(
name
);
}
}
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/JgInstallationNoticeServiceImpl.java
View file @
99d83fb1
This diff is collapsed.
Click to expand it.
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