Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张云鹏
/
uc-consumer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
ca54709d
...
ca54709d0e4f3ef32c344570694d2c7ff0b4d002
authored
2022-06-19 19:11:29 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.同步master,优化任务处理过程
1 parent
f4ad8dc9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
164 additions
and
26 deletions
src/main/java/com/topdraw/business/module/task/template/constant/TaskEventName.java
src/main/java/com/topdraw/business/module/task/template/constant/TaskEventType.java
src/main/java/com/topdraw/business/module/user/iptv/repository/UserTvRepository.java
src/main/java/com/topdraw/business/module/user/iptv/service/UserTvService.java
src/main/java/com/topdraw/business/module/user/iptv/service/impl/UserTvServiceImpl.java
src/main/java/com/topdraw/business/process/service/impl/ExpOperationServiceImpl.java
src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
src/main/java/com/topdraw/config/redis/RedisKeyConstant.java
src/main/java/com/topdraw/mq/consumer/UcEventBusIptv2ManagementUcEngine.java
src/main/java/com/topdraw/resttemplate/ResponseStatusConstant.java
src/main/java/com/topdraw/resttemplate/RestTemplateClient.java
src/main/resources/config/application-dev.yml
src/main/resources/logback.xml
src/main/java/com/topdraw/business/module/task/template/constant/TaskEventName.java
0 → 100644
View file @
ca54709
package
com
.
topdraw
.
business
.
module
.
task
.
template
.
constant
;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/6/18 14:30
* @version: :
* @modified By:
* @since : modified in 2022/6/18 14:30
*/
public
interface
TaskEventName
{
//类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置;
// 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他
String
LOGIN
=
"LOGIN"
;
String
VIEW
=
"VIEW"
;
String
ACTIVITY
=
"ACTIVITY"
;
String
ORDER
=
"ORDER"
;
String
MEMBER_PRIORITY
=
"MEMBER_PRIORITY"
;
String
SIGN
=
"SIGN"
;
String
COMPLETE_INFO
=
"COMPLETE_INFO"
;
String
PLAY
=
"PLAY"
;
String
BINDING
=
"BINDING"
;
String
POINTS_TRANS
=
"POINTS_TRANS"
;
String
POINTS_EXCHANGE_GOODS
=
"POINTS_EXCHANGE_GOODS"
;
String
SYSTEM_OPERATE
=
"SYSTEM_OPERATE"
;
String
OTHER
=
"OHHER"
;
}
src/main/java/com/topdraw/business/module/task/template/constant/TaskEventType.java
0 → 100644
View file @
ca54709
package
com
.
topdraw
.
business
.
module
.
task
.
template
.
constant
;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/6/18 14:30
* @version: :
* @modified By:
* @since : modified in 2022/6/18 14:30
*/
public
interface
TaskEventType
{
//类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置;
// 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他
int
LOGIN
=
1
;
int
VIEW
=
2
;
int
ACTIVITY
=
3
;
int
ORDER
=
4
;
int
MEMBER_PRIORITY
=
5
;
int
SIGN
=
6
;
int
COMPLETE_INFO
=
7
;
int
PLAY
=
8
;
int
BINDING
=
10
;
int
POINTS_TRANS
=
11
;
int
POINTS_EXCHANGE_GOODS
=
30
;
int
SYSTEM_OPERATE
=
98
;
int
OHHER
=
99
;
}
src/main/java/com/topdraw/business/module/user/iptv/repository/UserTvRepository.java
View file @
ca54709
...
...
@@ -56,4 +56,11 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif
" `vis_user_id` = :#{#resources.visUserId}, "
+
" `update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}"
,
nativeQuery
=
true
)
void
updateUserTvByPlatformAccount
(
@Param
(
"resources"
)
UserTv
userTv
);
Long
countByPlatformAccount
(
String
platformAccount
);
@Modifying
@Query
(
value
=
"UPDATE `uc_user_tv` SET `priority_member_code` = :#{#resources.priorityMemberCode}, "
+
"`update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}"
,
nativeQuery
=
true
)
void
updatePriorityMemberCode
(
@Param
(
"resources"
)
UserTv
userTv
);
}
...
...
src/main/java/com/topdraw/business/module/user/iptv/service/UserTvService.java
View file @
ca54709
...
...
@@ -108,4 +108,17 @@ public interface UserTvService {
* @param userTv
*/
void
updateUserTvByPlatformAccount
(
UserTv
userTv
);
/**
*
* @param platformAccount
* @return
*/
Long
countByPlatformAccount
(
String
platformAccount
);
/**
*
* @param userTv
*/
void
doUpdatePriorityMemberCode
(
UserTv
userTv
);
}
...
...
src/main/java/com/topdraw/business/module/user/iptv/service/impl/UserTvServiceImpl.java
View file @
ca54709
...
...
@@ -62,6 +62,16 @@ public class UserTvServiceImpl implements UserTvService {
this
.
userTvRepository
.
updateUserTvByPlatformAccount
(
userTv
);
}
@Override
public
Long
countByPlatformAccount
(
String
platformAccount
)
{
return
this
.
userTvRepository
.
countByPlatformAccount
(
platformAccount
);
}
@Override
public
void
doUpdatePriorityMemberCode
(
UserTv
userTv
)
{
this
.
userTvRepository
.
updatePriorityMemberCode
(
userTv
);
}
/**
* 获取大屏账户对应的会员
...
...
src/main/java/com/topdraw/business/process/service/impl/ExpOperationServiceImpl.java
View file @
ca54709
...
...
@@ -21,13 +21,7 @@ public class ExpOperationServiceImpl implements ExpOperationService {
@Autowired
private
ExpDetailService
expDetailService
;
@Autowired
private
MemberOperationService
memberOperationService
;
@Autowired
private
MemberLevelService
memberLevelService
;
@Autowired
private
MemberService
memberService
;
@Autowired
ThreadPoolTaskExecutor
threadPoolTaskExecutor
;
public
void
asyncMemberExpAndLevel
(
Member
member
)
{
String
code
=
member
.
getCode
();
...
...
src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
ca54709
...
...
@@ -349,6 +349,31 @@ public class UserOperationServiceImpl implements UserOperationService {
}
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
rollbackFor
=
Exception
.
class
)
public
void
asyncUserTvChangeMainAccount
(
UserTvDTO
userTvDTO
)
{
log
.
info
(
"asyncUserTv ==>> userTvDTO ==>> {}"
,
userTvDTO
);
String
priorityMemberCode
=
userTvDTO
.
getPriorityMemberCode
();
if
(
StringUtils
.
isBlank
(
priorityMemberCode
))
{
log
.
error
(
"大屏账号设置主会员异常,主会员code不存在"
);
return
;
}
String
platformAccount
=
userTvDTO
.
getPlatformAccount
();
UserTvDTO
_userTvDTO
=
this
.
userTvService
.
findByPlatformAccount
(
platformAccount
);
log
.
info
(
"从数据库中获取大屏信息, _userTvDTO ==>> {}"
,
_userTvDTO
);
if
(
Objects
.
isNull
(
_userTvDTO
.
getId
()))
{
log
.
error
(
"大屏账号设置主会员异常,大屏账号不存在"
);
return
;
}
UserTv
userTv
=
new
UserTv
();
userTv
.
setId
(
_userTvDTO
.
getId
());
userTv
.
setPriorityMemberCode
(
priorityMemberCode
);
log
.
info
(
"开始修改大屏数据,userTv ==>>{}"
,
userTv
);
this
.
userTvService
.
doUpdatePriorityMemberCode
(
userTv
);
}
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
rollbackFor
=
Exception
.
class
)
public
void
asyncUserTv
(
UserTvDTO
userTvDTO
)
{
log
.
info
(
"asyncUserTv ==>> userTvDTO ==>> {}"
,
userTvDTO
);
String
platformAccount
=
userTvDTO
.
getPlatformAccount
();
...
...
src/main/java/com/topdraw/config/redis/RedisKeyConstant.java
0 → 100644
View file @
ca54709
package
com
.
topdraw
.
config
.
redis
;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/6/18 17:22
* @version: :
* @modified By:
* @since : modified in 2022/6/18 17:22
*/
public
class
RedisKeyConstant
{
public
static
final
String
CACHE_PLATFROMACCOUNT_PLAYDURATION
=
"ucc::play::playduration::"
;
}
src/main/java/com/topdraw/mq/consumer/UcEventBusIptv2ManagementUcEngine.java
View file @
ca54709
This diff is collapsed.
Click to expand it.
src/main/java/com/topdraw/resttemplate/ResponseStatusConstant.java
0 → 100644
View file @
ca54709
package
com
.
topdraw
.
resttemplate
;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/6/18 17:45
* @version: :
* @modified By:
* @since : modified in 2022/6/18 17:45
*/
public
interface
ResponseStatusConstant
{
String
OK
=
"00000"
;
}
src/main/java/com/topdraw/resttemplate/RestTemplateClient.java
View file @
ca54709
...
...
@@ -42,24 +42,23 @@ public class RestTemplateClient {
}
public
JSONObject
dealTask
(
DataSyncMsg
dataSyncMsg
)
{
JSONObject
resultSet
=
null
;
String
url
=
BASE_URL
+
"/uce/taskOperation/dealTask"
;
log
.
info
(
"request uc : url is "
+
url
+
", dataSyncMsg is "
+
dataSyncMsg
);
String
content
=
JSON
.
toJSONString
(
dataSyncMsg
);
HashMap
<
Object
,
Object
>
objectObjectHashMap
=
new
HashMap
<>();
objectObjectHashMap
.
put
(
"content"
,
content
);
log
.
info
(
"===>>>"
+
content
);
restTemplate
.
postForEntity
(
url
,
objectObjectHashMap
,
String
.
class
);
/*
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
url
,
objectObjectHashMap
,
String
.
class
);
if
(
responseEntity
.
getStatusCode
().
is2xxSuccessful
())
{
String entityBody = responseEntity.getBody();
444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444被44444444444444 444444 44444 44444 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
String
entityBody
=
responseEntity
.
getBody
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
entityBody
);
if (jsonObject.getInteger("businessCode").equals(
200
)) {
if
(
jsonObject
.
getInteger
(
"businessCode"
).
equals
(
ResponseStatusConstant
.
OK
))
{
resultSet
=
jsonObject
.
getJSONArray
(
"resultSet"
).
getJSONObject
(
0
);
}
}
log
.
info
(
"uc response: "
+
resultSet
.
toJSONString
());
return resultSet;*/
return
null
;
return
resultSet
;
}
public
JSONObject
getMemberInfo
(
Long
memberId
)
{
...
...
src/main/resources/config/application-dev.yml
View file @
ca54709
...
...
@@ -99,12 +99,12 @@ mutil-mq:
service
:
mq
:
list
:
#
- source: event
#
exchange: event.exchange
#
queue: event.queue
#
exchange-type: direct
#
routing-key:
#
active: service
-
source
:
event
exchange
:
event.exchange
queue
:
event.queue
exchange-type
:
direct
routing-key
:
active
:
service
-
source
:
collection
exchange
:
exchange.collection
queue
:
collection.queue
...
...
@@ -136,12 +136,12 @@ service:
# exchange-type: direct
# routing-key:
# active: service
#
- source: eventBus
#
exchange: uc.eventbus
#
queue: uc.eventbus
#
exchange-type: topic
#
routing-key: uc.eventbus.*.topic
#
active: service
-
source
:
eventBus
exchange
:
uc.eventbus
queue
:
uc.eventbus
exchange-type
:
topic
routing-key
:
uc.eventbus.*.topic
active
:
service
-
source
:
uce
exchange
:
uce.exchange
queue
:
uce.queue
...
...
src/main/resources/logback.xml
View file @
ca54709
...
...
@@ -64,12 +64,12 @@
<!--监控sql日志输出 -->
<logger
name=
"jdbc.sqlonly"
level=
"
INFO
"
additivity=
"false"
>
<logger
name=
"jdbc.sqlonly"
level=
"
OFF
"
additivity=
"false"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"info"
/>
</logger>
<logger
name=
"jdbc.resultset"
level=
"
ERROR
"
additivity=
"false"
>
<logger
name=
"jdbc.resultset"
level=
"
OFF
"
additivity=
"false"
>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"info"
/>
</logger>
...
...
Please
register
or
sign in
to post a comment