Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fbf257e5
authored
Sep 26, 2023
by
谢海旭
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
更新旅程客户阶段接口增加发mq事件上报cdp
1 parent
73643ab9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
9 deletions
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/MsgProducer.java
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/RabbitConfig.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/MsgProducer.java
View file @
fbf257e
...
...
@@ -35,8 +35,9 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
*/
public
void
topicSend
(
String
exchange
,
String
routingKey
,
Object
content
)
{
CorrelationData
correlationId
=
new
CorrelationData
(
UUID
.
randomUUID
().
toString
());
log
.
info
(
"消息id:{},推送数据到mq:{}"
,
correlationId
,
JSON
.
toJSONString
(
content
));
rabbitTemplate
.
convertAndSend
(
exchange
,
routingKey
,
content
,
correlationId
);
String
contentJson
=
JSON
.
toJSONString
(
content
);
log
.
info
(
"消息id:{},推送数据到mq:{}"
,
correlationId
,
contentJson
);
rabbitTemplate
.
convertAndSend
(
exchange
,
routingKey
,
contentJson
,
correlationId
);
}
/**
...
...
@@ -47,8 +48,9 @@ public class MsgProducer implements RabbitTemplate.ConfirmCallback {
*/
public
void
topicSend
(
String
routingKey
,
Object
content
)
{
CorrelationData
correlationId
=
new
CorrelationData
(
UUID
.
randomUUID
().
toString
());
log
.
info
(
"消息id:{},推送数据到mq:{}"
,
correlationId
,
JSON
.
toJSONString
(
content
));
rabbitTemplate
.
convertAndSend
(
RabbitMQConstants
.
TOPIC_EXCHANGE_PLATFORM_PROCESS
,
routingKey
,
content
,
correlationId
);
String
contentJson
=
JSON
.
toJSONString
(
content
);
log
.
info
(
"消息id:{},推送数据到mq:{}"
,
correlationId
,
contentJson
);
rabbitTemplate
.
convertAndSend
(
RabbitMQConstants
.
TOPIC_EXCHANGE_PLATFORM_PROCESS
,
routingKey
,
contentJson
,
correlationId
);
}
/**
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/rabbitmq/RabbitConfig.java
View file @
fbf257e
...
...
@@ -2,6 +2,7 @@ package cn.com.glsx.process.modules.rabbitmq;
import
org.springframework.amqp.core.*
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -9,13 +10,34 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public
class
RabbitConfig
{
public
static
final
String
DATA_REPORT_QUEUE_NAME
=
"dataReport_queue"
;
public
static
final
String
DATA_REPORT_EXCHANGE_NAME
=
"dataReport_exchange"
;
public
static
final
String
DATA_REPORT_TOPIC
=
"dataReport.#"
;
//声明topic交换机
@Bean
public
TopicExchange
topicExchange
(){
public
TopicExchange
topicExchange
()
{
//durable(true) 持久化,mq重启之后交换机还在
return
ExchangeBuilder
.
topicExchange
(
RabbitMQConstants
.
TOPIC_EXCHANGE_PLATFORM_PROCESS
).
durable
(
true
).
build
();
}
@Bean
(
name
=
"dataReportQueue"
)
public
Queue
dataReportQueue
()
{
return
new
Queue
(
DATA_REPORT_QUEUE_NAME
,
true
);
}
@Bean
(
name
=
"dataReportTopicExchange"
)
public
TopicExchange
dataReportTopicExchange
()
{
return
new
TopicExchange
(
DATA_REPORT_EXCHANGE_NAME
);
}
@Bean
public
Binding
bindingDataReport
(
@Qualifier
(
"dataReportQueue"
)
Queue
dataReportQueue
,
@Qualifier
(
"dataReportTopicExchange"
)
TopicExchange
dataReportTopicExchange
)
{
return
BindingBuilder
.
bind
(
dataReportQueue
).
to
(
dataReportTopicExchange
).
with
(
DATA_REPORT_TOPIC
);
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
View file @
fbf257e
...
...
@@ -15,6 +15,7 @@ import cn.com.glsx.process.modules.mapper.*;
import
cn.com.glsx.process.modules.model.*
;
import
cn.com.glsx.process.modules.model.enums.SopInstStatusEnum
;
import
cn.com.glsx.process.modules.rabbitmq.MsgProducer
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitConfig
;
import
cn.com.glsx.process.modules.rabbitmq.RabbitMQConstants
;
import
cn.com.glsx.process.util.FileUploadServerData
;
import
cn.com.glsx.process.util.FileUploadUtil
;
...
...
@@ -34,6 +35,7 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.StringUtils
;
import
java.io.ByteArrayOutputStream
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -393,13 +395,41 @@ public class SopInstService {
* @return
*/
public
Result
<
Boolean
>
stageUpdate
(
SopJourneyStageUpdate
body
)
{
String
orgId
=
body
.
getOrgId
();
String
sopJourneyId
=
body
.
getSopJourneyId
();
String
oneId
=
body
.
getOneId
();
Result
<
CustomerSopJourneyDetailDTO
>
detail
=
customerSopJourneyFeignClientT
.
detail
(
orgId
,
sopJourneyId
,
oneId
);
if
(!
SysConstants
.
ResultStatus
.
success
.
getCode
().
equals
(
detail
.
getCode
()))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS_ERROR
.
getCode
(),
"查询客户信息异常"
);
}
CustomerSopJourneyDetailDTO
customerDetail
=
detail
.
getData
();
if
(
Objects
.
isNull
(
customerDetail
))
{
throw
ResultException
.
create
(
SystemMessage
.
ARGS_ERROR
.
getCode
(),
"客户信息不存在"
);
}
ModifySopJourneyStageRequest
request
=
new
ModifySopJourneyStageRequest
();
request
.
setOrgId
(
body
.
getOrgId
()
);
request
.
setSopJourneyId
(
body
.
getSopJourneyId
()
);
request
.
setOneIds
(
Lists
.
newArrayList
(
body
.
getOneId
()
));
request
.
setOrgId
(
orgId
);
request
.
setSopJourneyId
(
sopJourneyId
);
request
.
setOneIds
(
Lists
.
newArrayList
(
oneId
));
request
.
setSopJourneyStage
(
body
.
getSopJourneyStage
());
request
.
setOprBy
(
body
.
getOprBy
());
return
customerSopJourneyFeignClientT
.
modifyStage
(
request
);
Result
<
Boolean
>
booleanResult
=
customerSopJourneyFeignClientT
.
modifyStage
(
request
);
Date
now
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
HashMap
<
String
,
Object
>
mqMap
=
new
HashMap
<>();
mqMap
.
put
(
"org_id"
,
orgId
);
mqMap
.
put
(
"add_way"
,
"SOP"
);
mqMap
.
put
(
"customer_phone"
,
customerDetail
.
getCustomerPhone
());
mqMap
.
put
(
"event_time"
,
sdf
.
format
(
now
));
mqMap
.
put
(
"event_type"
,
"MODIFY_SOP_JOURNEY_STAGE"
);
mqMap
.
put
(
"platform"
,
"WebPage"
);
mqMap
.
put
(
"extra"
,
body
);
msgProducer
.
topicSend
(
RabbitConfig
.
DATA_REPORT_EXCHANGE_NAME
,
"dataReport.customer.event"
,
Lists
.
newArrayList
(
mqMap
));
return
booleanResult
;
}
public
FileUploadServerData
customersExport
(
SopCustomerSearch
search
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment