Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
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
徐少华
midjourney-proxy
Commits
9ad206cc
Commit
9ad206cc
authored
Nov 05, 2018
by
lili
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
topic 修改
parent
63694a3e
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
50 additions
and
310 deletions
+50
-310
BookApplication.java
...e-book/src/main/java/com/pcloud/book/BookApplication.java
+9
-14
IsbnConsr.java
...rc/main/java/com/pcloud/book/consumer/isbn/IsbnConsr.java
+13
-19
MessageConsr.java
...n/java/com/pcloud/book/consumer/message/MessageConsr.java
+2
-25
ChannelConsr.java
...main/java/com/pcloud/book/consumer/user/ChannelConsr.java
+7
-8
MQTopicConumer.java
...c/main/java/com/pcloud/book/mq/config/MQTopicConumer.java
+1
-2
MqConfig.java
...ook/src/main/java/com/pcloud/book/mq/config/MqConfig.java
+0
-139
ChooseDefaultChannelListener.java
...om/pcloud/book/mq/topic/ChooseDefaultChannelListener.java
+9
-3
RegisterPartyListener.java
.../java/com/pcloud/book/mq/topic/RegisterPartyListener.java
+9
-17
BookProps.java
.../main/java/com/pcloud/book/util/properties/BookProps.java
+0
-68
book.properties
...ervice-book/src/main/resources/properties/book.properties
+0
-15
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/BookApplication.java
View file @
9ad206cc
...
@@ -4,12 +4,9 @@ import com.alibaba.druid.pool.DruidDataSource;
...
@@ -4,12 +4,9 @@ import com.alibaba.druid.pool.DruidDataSource;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
com.pcloud.common.core.constant.MQTopicProducer
;
import
com.pcloud.common.core.constant.MQTopicProducer
;
import
com.pcloud.common.core.mq.RabbitMQFactory
;
import
com.pcloud.common.core.mq.RabbitMQFactory
;
import
feign.Request
;
import
org.apache.activemq.ActiveMQConnectionFactory
;
import
org.springframework.amqp.core.Binding
;
import
org.springframework.amqp.core.Binding
;
import
org.springframework.amqp.core.Queue
;
import
org.springframework.amqp.core.Queue
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
...
@@ -74,14 +71,6 @@ public class BookApplication {
...
@@ -74,14 +71,6 @@ public class BookApplication {
}
}
@Bean
@Bean
public
ActiveMQConnectionFactory
activeMQConnectionFactory
(
@Value
(
"${mq.brokerURL}"
)
String
url
)
{
ActiveMQConnectionFactory
activeMQConnectionFactory
=
new
ActiveMQConnectionFactory
();
activeMQConnectionFactory
.
setBrokerURL
(
url
);
activeMQConnectionFactory
.
setTrustAllPackages
(
true
);
return
activeMQConnectionFactory
;
}
@Bean
public
Queue
deleteVideoQueue
(){
public
Queue
deleteVideoQueue
(){
return
RabbitMQFactory
.
queueBuilder
(
MQTopicConumer
.
DELETE_VIDEO
);
return
RabbitMQFactory
.
queueBuilder
(
MQTopicConumer
.
DELETE_VIDEO
);
}
}
...
@@ -101,9 +90,15 @@ public class BookApplication {
...
@@ -101,9 +90,15 @@ public class BookApplication {
return
RabbitMQFactory
.
bindingExchange
(
chooseDefaultChannelQueue
(),
MQTopicProducer
.
CHOOSE_DEFAULT_CHANNEL
);
return
RabbitMQFactory
.
bindingExchange
(
chooseDefaultChannelQueue
(),
MQTopicProducer
.
CHOOSE_DEFAULT_CHANNEL
);
}
}
//调用超时设置
@Bean
public
Queue
registerPartyQueue
(){
return
RabbitMQFactory
.
queueBuilder
(
MQTopicConumer
.
REGISTER_PARTY
);
}
@Bean
@Bean
Request
.
Options
feignOptions
()
{
public
Binding
registerPartyBind
()
{
return
new
Request
.
Options
(
300
*
1000
,
300
*
1000
);
return
RabbitMQFactory
.
bindingExchange
(
registerPartyQueue
(),
MQTopicProducer
.
REGISTER_PARTY
);
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/isbn/IsbnConsr.java
View file @
9ad206cc
...
@@ -55,24 +55,25 @@ public class IsbnConsr {
...
@@ -55,24 +55,25 @@ public class IsbnConsr {
*/
*/
public
Book
getBook
(
String
isbn
)
throws
IOException
{
public
Book
getBook
(
String
isbn
)
throws
IOException
{
LOGGER
.
info
(
"【外部】根据isbn获取书籍信息,<START>.[isbn]="
+
isbn
);
LOGGER
.
info
(
"【外部】根据isbn获取书籍信息,<START>.[isbn]="
+
isbn
);
/*
Book book = null;
//
Book book = null;
try {
//
try {
String result = getBookInfo4jisu(isbn);
/*
String result = getBookInfo4jisu(isbn);
book = setBook4jisu(result, isbn);
book = setBook4jisu(result, isbn);
if (book == null || book.getIsbn() == null) {
if (book == null || book.getIsbn() == null) {
// 调用聚合查询书籍
// 调用聚合查询书籍
String juheBook = getBookInfo(isbn);
String juheBook = getBookInfo(isbn);
book = setBook(juheBook, isbn);
book = setBook(juheBook, isbn);
}
}
*/
//if (book == null || book.getIsbn() == null) {
//if (book == null || book.getIsbn() == null) {
// 调用阿里查询书籍
// 调用阿里查询书籍
String aliBook = getBookInfo4Ali(isbn);
// String aliBook = getBookInfo4Ali(isbn);
book = setBook4Ali(aliBook, isbn);
// book = setBook4Ali(aliBook, isbn);
// }
// // }
} catch (Exception e) {
// } catch (Exception e) {
LOGGER.warn("【外部】根据isbn获取书籍信息,<ERROR>", e);
// LOGGER.warn("【外部】根据isbn获取书籍信息,<ERROR>", e);
}
// }
LOGGER.info("【外部】根据isbn获取书籍信息,<END>");*/
// LOGGER.info("【外部】根据isbn获取书籍信息,<END>");
// return book;
return
null
;
return
null
;
}
}
...
@@ -82,11 +83,7 @@ public class IsbnConsr {
...
@@ -82,11 +83,7 @@ public class IsbnConsr {
* @param result
* @param result
* @param isbn
* @param isbn
* @return
* @return
* @ @throws
* JsonMappingException
* @throws JsonParseException
*/
*/
@SuppressWarnings
(
"unchecked"
)
private
Book
setBook4Ali
(
String
result
,
String
isbn
)
{
private
Book
setBook4Ali
(
String
result
,
String
isbn
)
{
Map
<
String
,
Object
>
temp
=
JSONObject
.
parseObject
(
result
);
Map
<
String
,
Object
>
temp
=
JSONObject
.
parseObject
(
result
);
Book
book
=
new
Book
();
Book
book
=
new
Book
();
...
@@ -118,9 +115,6 @@ public class IsbnConsr {
...
@@ -118,9 +115,6 @@ public class IsbnConsr {
* @param result
* @param result
* @param isbn
* @param isbn
* @return
* @return
* @ @throws
* JsonMappingException
* @throws JsonParseException
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
private
Book
setBook4jisu
(
String
result
,
String
isbn
)
{
private
Book
setBook4jisu
(
String
result
,
String
isbn
)
{
...
@@ -155,7 +149,7 @@ public class IsbnConsr {
...
@@ -155,7 +149,7 @@ public class IsbnConsr {
/**
/**
* 修改图片地址
* 修改图片地址
*
*
* @param
string
* @param
picUrl
* @return
* @return
*/
*/
private
String
changePic
(
String
picUrl
)
{
private
String
changePic
(
String
picUrl
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/message/MessageConsr.java
View file @
9ad206cc
...
@@ -6,12 +6,12 @@ package com.pcloud.book.consumer.message;
...
@@ -6,12 +6,12 @@ package com.pcloud.book.consumer.message;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
import
com.pcloud.book.base.exception.BookBizException
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.pcloud.appcenter.base.exception.AppBizException
;
import
com.pcloud.common.core.biz.MessageBiz
;
import
com.pcloud.common.core.biz.MessageBiz
;
import
com.pcloud.common.core.dto.SendMessageDto
;
import
com.pcloud.common.core.dto.SendMessageDto
;
import
com.pcloud.common.core.dto.SendNotifyDto
;
import
com.pcloud.common.core.dto.SendNotifyDto
;
...
@@ -40,7 +40,7 @@ public class MessageConsr {
...
@@ -40,7 +40,7 @@ public class MessageConsr {
public
void
sendLetter
(
Long
fromId
,
Long
toId
,
String
content
,
String
sysCode
,
String
typeCode
,
String
resourceId
,
String
fileName
)
public
void
sendLetter
(
Long
fromId
,
Long
toId
,
String
content
,
String
sysCode
,
String
typeCode
,
String
resourceId
,
String
fileName
)
throws
BizException
{
throws
BizException
{
LOGGER
.
info
(
"【站内信-消息(消)】发送站内信,<START>.[fromId]="
+
fromId
+
",[toId]="
+
toId
+
",[content]="
+
content
LOGGER
.
info
(
"【站内信-消息(消)】发送站内信,<START>.[fromId]="
+
fromId
+
",[toId]="
+
toId
+
",[content]="
+
content
+
",[sysCode]="
+
sysCode
+
",[typeCode]="
+
typeCode
+
",[resourceId]="
+
resourceId
+
"[fileName]
="
+
fileName
);
+
",[sysCode]="
+
sysCode
+
",[typeCode]="
+
typeCode
+
",[resourceId]="
+
resourceId
+
",fileName
="
+
fileName
);
if
(
fromId
==
null
||
toId
==
null
||
StringUtil
.
isEmpty
(
content
)
||
StringUtil
.
isEmpty
(
sysCode
)
if
(
fromId
==
null
||
toId
==
null
||
StringUtil
.
isEmpty
(
content
)
||
StringUtil
.
isEmpty
(
sysCode
)
||
StringUtil
.
isEmpty
(
typeCode
)
||
resourceId
==
null
)
{
||
StringUtil
.
isEmpty
(
typeCode
)
||
resourceId
==
null
)
{
return
;
return
;
...
@@ -63,27 +63,4 @@ public class MessageConsr {
...
@@ -63,27 +63,4 @@ public class MessageConsr {
LOGGER
.
info
(
"【站内信(消)】发送站内信,<END>"
);
LOGGER
.
info
(
"【站内信(消)】发送站内信,<END>"
);
}
}
/**
* 发送手机消息
*/
public
void
sendSMS
(
String
phone
,
Map
<
String
,
String
>
paramMap
,
String
templateCode
)
throws
BizException
{
LOGGER
.
info
(
"【短信消息(消)】发送手机消息.<START>.[phone]="
+
phone
);
if
(
StringUtil
.
isEmpty
(
phone
))
{
throw
new
AppBizException
(
AppBizException
.
PARAM_IS_NULL
,
"手机消息参数为空"
);
}
// 组装参数
SendMessageDto
smsParam
=
new
SendMessageDto
();
smsParam
.
setSmsTemplateCode
(
templateCode
);
smsParam
.
setParamKeyMap
(
paramMap
);
smsParam
.
setPhoneNumber
(
phone
);
try
{
messageBiz
.
sendSMS
(
smsParam
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【短信消息(消)】发送手机消息.[sendSMS]:"
+
e
.
getMessage
(),
e
);
throw
new
AppBizException
(
AppBizException
.
INVOKE_MESSAGE_ERROR
,
"发送手机消息失败"
);
}
LOGGER
.
info
(
"【短信消息(消)】发送手机消息.<END>"
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/user/ChannelConsr.java
View file @
9ad206cc
...
@@ -3,19 +3,18 @@
...
@@ -3,19 +3,18 @@
*/
*/
package
com
.
pcloud
.
book
.
consumer
.
user
;
package
com
.
pcloud
.
book
.
consumer
.
user
;
import
java.util.List
;
import
java.util.Map
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.channelcenter.base.exceptions.ChannelBizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.usercenter.party.channel.service.ChannelService
;
import
com.pcloud.usercenter.party.channel.service.ChannelService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @描述:渠道用户中间类
* @描述:渠道用户中间类
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/config/MQTopicConumer.java
View file @
9ad206cc
...
@@ -18,8 +18,7 @@ public class MQTopicConumer {
...
@@ -18,8 +18,7 @@ public class MQTopicConumer {
/**
/**
* 注册当事人Topic监听
* 注册当事人Topic监听
*/
*/
//public static final String REGISTER_PARTY = PREFIX + MQTopicProducer.REGISTER_PARTY;
public
static
final
String
REGISTER_PARTY
=
PREFIX
+
MQTopicProducer
.
REGISTER_PARTY
;
/**
/**
* 选择默认运营
* 选择默认运营
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/config/MqConfig.java
deleted
100644 → 0
View file @
63694a3e
/**
*
*/
package
com
.
pcloud
.
book
.
mq
.
config
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.mq.topic.ChooseDefaultChannelListener
;
import
com.pcloud.book.mq.topic.RegisterPartyListener
;
import
com.pcloud.book.mq.topic.DeleteVideoListener
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.common.exceptions.BizException
;
import
org.apache.activemq.ActiveMQConnection
;
import
org.apache.activemq.ActiveMQConnectionFactory
;
import
org.apache.activemq.command.ActiveMQQueue
;
import
org.apache.activemq.command.ActiveMQTopic
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.event.ContextRefreshedEvent
;
import
org.springframework.stereotype.Component
;
import
javax.jms.*
;
import
java.io.Serializable
;
/**
* @描述:
*
* @作者:songx
* @创建时间:2017年2月13日,上午11:28:54 @版本:1.0
*/
@Component
(
"mqConfig"
)
public
class
MqConfig
implements
ApplicationListener
<
ContextRefreshedEvent
>
{
/**
*
*/
private
final
static
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
MqConfig
.
class
);
private
static
Session
session
;
// 消息上下文
@Autowired
private
ActiveMQConnectionFactory
connectionFactory
;
private
static
MessageProducer
bookDeleteMsgProducer
;
// 书籍删除消息生产者
@Autowired
private
RegisterPartyListener
registerPartyListener
;
// 注册当事人Topic监听
private
static
MessageProducer
bookThawProducer
;
// 书籍解冻消息生产者
private
Boolean
bool
=
false
;
/**
* 初始化
*/
@Override
public
void
onApplicationEvent
(
ContextRefreshedEvent
arg0
)
{
if
(!
bool
&&
arg0
.
getSource
()
instanceof
AnnotationConfigEmbeddedWebApplicationContext
)
{
LOGGER
.
info
(
"【消息队列】初始化消息发送队列,<START>"
);
bool
=
true
;
try
{
ActiveMQConnection
conn
=
(
ActiveMQConnection
)
connectionFactory
.
createConnection
();
conn
.
start
();
session
=
conn
.
createSession
(
false
,
Session
.
AUTO_ACKNOWLEDGE
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【消息队列】初始化消息发送队列,<ERROR>:"
+
e
.
getMessage
(),
e
);
throw
new
BookBizException
(
BookBizException
.
SEND_TOPIC_ERROR
,
"初始化消息发送队列失败"
);
}
// 创建生产者
bookDeleteMsgProducer
=
this
.
createProducer
(
BookProps
.
getBookDeleteProducer
());
bookThawProducer
=
this
.
createProducer
(
BookProps
.
getBookThawProducer
());
// 创建消费者,开始监听
// this.createConsumer(deleteVideoListener, BookProps.getDeleteVideoConsumer());
this
.
createConsumer
(
registerPartyListener
,
BookProps
.
getRegisterPartyConsumer
());
LOGGER
.
info
(
"【消息队列】初始化消息发送队列,<END>"
);
}
}
/**
* 创建生产者
*/
private
MessageProducer
createProducer
(
String
producerName
)
throws
BizException
{
try
{
return
session
.
createProducer
(
new
ActiveMQTopic
(
producerName
));
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【消息队列】初始化生产者Topic,<ERROR>.["
+
producerName
+
"]:"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 创建消费者监听
*/
private
void
createConsumer
(
MessageListener
messageListener
,
String
consumerName
)
throws
BizException
{
try
{
Queue
queue
=
new
ActiveMQQueue
(
consumerName
);
MessageConsumer
consumer
=
session
.
createConsumer
(
queue
);
consumer
.
setMessageListener
(
messageListener
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【消息队列】初始化消费者监听,<ERROR>.["
+
consumerName
+
"]:"
+
e
.
getMessage
(),
e
);
}
}
/**
* 发送书籍删除Topic
*
* @param object
*/
public
static
void
sendBookDeleteTopic
(
Serializable
object
)
throws
BizException
{
sendMsg
(
bookDeleteMsgProducer
,
object
,
BookProps
.
getBookDeleteProducer
());
}
/**
* 发送图书解冻Topic
*
* @param object
*/
public
static
void
sendBookThawTopic
(
Serializable
object
)
throws
BizException
{
sendMsg
(
bookThawProducer
,
object
,
BookProps
.
getBookThawProducer
());
}
/**
* 发送消息
*
* @param producer
* @param object
*/
private
static
void
sendMsg
(
MessageProducer
producer
,
Serializable
object
,
String
producerName
)
throws
BizException
{
LOGGER
.
info
(
"【消息队列】发送Topic消息,<START>.[producerName]="
+
producerName
);
try
{
ObjectMessage
message
=
session
.
createObjectMessage
(
object
);
producer
.
send
(
message
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【消息队列】发送Topic消息["
+
producerName
+
"],<ERROR>:"
+
e
.
getMessage
(),
e
);
}
LOGGER
.
info
(
"【消息队列】发送Topic消息,<END>"
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/ChooseDefaultChannelListener.java
View file @
9ad206cc
package
com
.
pcloud
.
book
.
mq
.
topic
;
package
com
.
pcloud
.
book
.
mq
.
topic
;
import
com.pcloud.book.book.biz.BookAdviserBiz
;
import
javax.jms.Message
;
import
javax.jms.MessageListener
;
import
javax.jms.ObjectMessage
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.usercenter.common.enums.ResourceEnum
;
import
com.pcloud.usercenter.common.enums.ResourceEnum
;
import
com.pcloud.usercenter.system.entity.ExtraSetting
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
...
@@ -13,6 +14,11 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
...
@@ -13,6 +14,11 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookAdviserBiz
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.usercenter.system.entity.ExtraSetting
;
/**
/**
* @描述: 选择默认渠道
* @描述: 选择默认渠道
*/
*/
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/RegisterPartyListener.java
View file @
9ad206cc
...
@@ -4,9 +4,13 @@ import javax.jms.Message;
...
@@ -4,9 +4,13 @@ import javax.jms.Message;
import
javax.jms.MessageListener
;
import
javax.jms.MessageListener
;
import
javax.jms.ObjectMessage
;
import
javax.jms.ObjectMessage
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.usercenter.common.enums.ResourceEnum
;
import
com.pcloud.usercenter.common.enums.ResourceEnum
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -16,34 +20,22 @@ import com.pcloud.common.core.constant.SystemCode;
...
@@ -16,34 +20,22 @@ import com.pcloud.common.core.constant.SystemCode;
import
com.pcloud.usercenter.party.common.entity.Party
;
import
com.pcloud.usercenter.party.common.entity.Party
;
@Component
(
"registerPartyListener"
)
@Component
(
"registerPartyListener"
)
public
class
RegisterPartyListener
implements
MessageListener
{
@RabbitListener
(
queues
=
MQTopicConumer
.
REGISTER_PARTY
)
public
class
RegisterPartyListener
{
@Autowired
@Autowired
private
BookAdviserBiz
bookAdviserBiz
;
private
BookAdviserBiz
bookAdviserBiz
;
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
RegisterPartyListener
.
class
);
/**
/**
* 用户注册Topic
* 用户注册Topic
*/
*/
@Override
@ParamLog
(
"用户注册topic"
)
public
void
onMessage
(
Message
message
)
{
@RabbitHandler
if
(!(
message
instanceof
ObjectMessage
))
{
public
void
process
(
Party
party
)
{
throw
new
AppBizException
(
AppBizException
.
CONSUMER_TOPIC_ERROR
,
"【注册用户】类型转换错误"
);
}
// 转换消息实体
Party
party
=
null
;
try
{
ObjectMessage
om
=
(
ObjectMessage
)
message
;
party
=
(
Party
)
om
.
getObject
();
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"【注册用户】消费topic,<ERROR>:"
+
e
.
getMessage
(),
e
);
return
;
}
if
(
party
==
null
)
{
if
(
party
==
null
)
{
return
;
return
;
}
}
if
(
SystemCode
.
adviser
.
code
.
equalsIgnoreCase
(
party
.
getPartyRole
())
&&
ResourceEnum
.
APP
.
code
.
equals
(
party
.
getResourceId
()))
{
if
(
SystemCode
.
adviser
.
code
.
equalsIgnoreCase
(
party
.
getPartyRole
())
&&
ResourceEnum
.
APP
.
code
.
equals
(
party
.
getResourceId
()))
{
bookAdviserBiz
.
createDefaultBook
(
party
.
getAgentId
(),
party
.
getId
());
bookAdviserBiz
.
createDefaultBook
(
party
.
getAgentId
(),
party
.
getId
());
}
}
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/util/properties/BookProps.java
View file @
9ad206cc
...
@@ -34,48 +34,6 @@ public class BookProps {
...
@@ -34,48 +34,6 @@ public class BookProps {
*/
*/
private
static
String
jisuAppKey
;
private
static
String
jisuAppKey
;
/**
* 书籍删除
*/
private
static
String
bookDeleteProducer
;
/**
* 录音删除
*/
private
static
String
deleteVideoConsumer
;
/**
* 用户注册
*/
private
static
String
registerPartyConsumer
;
/**
* 默认运营选择
*/
private
static
String
chooseDefaultChannelConsumer
;
/**
* 图书解冻
*/
private
static
String
bookThawProducer
;
public
static
String
getBookThawProducer
()
{
return
bookThawProducer
;
}
@Value
(
"${book.thaw.producer}"
)
public
void
setBookThawProducer
(
String
bookThawProducer
)
{
BookProps
.
bookThawProducer
=
bookThawProducer
;
}
public
static
String
getBookDeleteProducer
()
{
return
bookDeleteProducer
;
}
@Value
(
"${book.delete.producer}"
)
public
void
setBookDeleteProducer
(
String
bookDeleteProducer
)
{
BookProps
.
bookDeleteProducer
=
bookDeleteProducer
;
}
public
static
String
getJisuAppKey
()
{
public
static
String
getJisuAppKey
()
{
return
jisuAppKey
;
return
jisuAppKey
;
}
}
...
@@ -111,30 +69,4 @@ public class BookProps {
...
@@ -111,30 +69,4 @@ public class BookProps {
public
void
setAppCode
(
String
appCode
)
{
public
void
setAppCode
(
String
appCode
)
{
BookProps
.
appCode
=
appCode
;
BookProps
.
appCode
=
appCode
;
}
}
public
static
String
getDeleteVideoConsumer
()
{
return
deleteVideoConsumer
;
}
@Value
(
"${delete.video.consumer}"
)
public
void
setDeleteVideoConsumer
(
String
deleteVideoConsumer
)
{
BookProps
.
deleteVideoConsumer
=
deleteVideoConsumer
;
}
@Value
(
"${register.party.consumer}"
)
public
void
setRegisterPartyConsumer
(
String
registerPartyConsumer
)
{
BookProps
.
registerPartyConsumer
=
registerPartyConsumer
;
}
public
static
String
getRegisterPartyConsumer
()
{
return
registerPartyConsumer
;
}
public
static
String
getChooseDefaultChannelConsumer
()
{
return
chooseDefaultChannelConsumer
;
}
@Value
(
"${choose.default.channel.consumer}"
)
public
void
setChooseDefaultChannelConsumer
(
String
chooseDefaultChannelConsumer
)
{
BookProps
.
chooseDefaultChannelConsumer
=
chooseDefaultChannelConsumer
;
}
}
}
pcloud-service-book/src/main/resources/properties/book.properties
View file @
9ad206cc
# \u4e66\u7c4d\u5220\u9664topic
book.delete.producer
=
VirtualTopic.BOOKDELETE
# \u5f55\u97f3\u5220\u9664topic
delete.video.consumer
=
Consumer.BOOK.VirtualTopic.DELETEVIDEO
# bookUrl
# bookUrl
book.cover.img
=
http://file.5rs.me/group1/M00/00/94/Ch7HtljQxEuASX6kAACvt6pHb2s229.jpg
book.cover.img
=
http://file.5rs.me/group1/M00/00/94/Ch7HtljQxEuASX6kAACvt6pHb2s229.jpg
...
@@ -15,11 +9,3 @@ isbn.appCode = 26ddebd7827448b798bdc6c4738be0ff
...
@@ -15,11 +9,3 @@ isbn.appCode = 26ddebd7827448b798bdc6c4738be0ff
# isbn\u5bc6\u94a5
# isbn\u5bc6\u94a5
isbn.jisu.appkey
=
37c80a8116e3349e
isbn.jisu.appkey
=
37c80a8116e3349e
# \u5f53\u4e8b\u4eba\u6ce8\u518c
register.party.consumer
=
Consumer.BOOK.VirtualTopic.REGISTERPARTY
book.thaw.producer
=
VirtualTopic.BOOKTHAW
#\u9ED8\u8BA4\u8FD0\u8425\u9009\u62E9
choose.default.channel.consumer
=
Consumer.BOOK.VirtualTopic.chooseDefaultChannel
\ 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