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
87e609e6
Commit
87e609e6
authored
Aug 20, 2019
by
杨涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 必要参数校验
parent
d5f2c25d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
26 deletions
+108
-26
BookClockInfoServiceImpl.java
...oud/book/clock/service/impl/BookClockInfoServiceImpl.java
+2
-1
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+2
-3
WxGroupSendTextListener.java
...ava/com/pcloud/book/mq/topic/WxGroupSendTextListener.java
+3
-8
WeixinClockBizImpl.java
.../pcloud/book/weixinclock/biz/impl/WeixinClockBizImpl.java
+46
-14
WeixinClockCheck.java
...a/com/pcloud/book/weixinclock/check/WeixinClockCheck.java
+14
-0
WeixinClockCheckImpl.java
...oud/book/weixinclock/check/impl/WeixinClockCheckImpl.java
+41
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/clock/service/impl/BookClockInfoServiceImpl.java
View file @
87e609e6
...
...
@@ -60,7 +60,8 @@ public class BookClockInfoServiceImpl implements BookClockInfoService {
@RequestMapping
(
value
=
"sendBookClockGroupMessage"
,
method
=
RequestMethod
.
POST
)
public
void
sendBookClockGroupMessage
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
BizException
{
LOGGER
.
info
(
"内部接口群发消息被调用"
+
map
.
toString
());
bookClockBiz
.
sendBookClockGroupMessage
(
map
);
return
;
// bookClockBiz.sendBookClockGroupMessage(map);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
87e609e6
...
...
@@ -39,7 +39,6 @@ import com.pcloud.book.keywords.vo.SetGuideVO;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao
;
import
com.pcloud.book.weixinclock.dto.WeixinClockDto
;
import
com.pcloud.book.weixinclock.entity.WeixinClockGroupClassify
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.ListUtils
;
...
...
@@ -391,7 +390,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
SendWeixinRequestTools
.
sendAccountMessage
(
weixinGroupId
,
bookGuide
.
getRecommendLanguage
(),
robotId
,
wechatInfo
,
pushAddUserMessageDTO
.
getIp
());
}
//校验该群是否与微信群打卡有关
List
<
Long
>
bookClockInfoIdList
=
bookClockCheck
.
checkGroupIsClock
(
classifyQrcodeInfo
);
/*
List<Long> bookClockInfoIdList = bookClockCheck.checkGroupIsClock(classifyQrcodeInfo);
if(!ListUtils.isEmpty(bookClockInfoIdList)){
Map<String,Object> paramMap = new HashMap<>();
int i = 0;
...
...
@@ -414,7 +413,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
}
}
}
*/
}
@ParamLog
(
"推关学习报告/猜谜语关键词消息"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WxGroupSendTextListener.java
View file @
87e609e6
...
...
@@ -63,14 +63,9 @@ public class WxGroupSendTextListener {
if
(
flag
&&
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
sendTextDTO
.
getCode
())){
weixinClockBiz
.
sendKeywordMessage
(
sendTextDTO
.
getTextContent
().
trim
(),
wechatUserId
,
sendTextDTO
.
getWechatGroupId
(),
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
}
else
{
BookClockInfoDTO
bookClockInfoDTO
=
bookClockCheck
.
checkKeywordIsClock
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
());
if
(
null
!=
bookClockInfoDTO
&&
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
sendTextDTO
.
getCode
()))
{
bookClockKeywordBiz
.
sendKeywordMessage
(
bookClockInfoDTO
,
wechatUserId
,
sendTextDTO
.
getWechatGroupId
(),
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
}
else
{
final
long
l
=
System
.
currentTimeMillis
();
bookKeywordBiz
.
sendKeywordMessage
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
(),
wechatUserId
,
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
(),
sendTextDTO
.
getCode
());
log
.
info
(
"[接收用户发送文本消息] 总耗时:{}ms "
,
System
.
currentTimeMillis
()
-
l
);
}
final
long
l
=
System
.
currentTimeMillis
();
bookKeywordBiz
.
sendKeywordMessage
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
(),
wechatUserId
,
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
(),
sendTextDTO
.
getCode
());
log
.
info
(
"[接收用户发送文本消息] 总耗时:{}ms "
,
System
.
currentTimeMillis
()
-
l
);
}
//猜谜语
riddleRecordBiz
.
riddleProcess
(
sendTextDTO
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/biz/impl/WeixinClockBizImpl.java
View file @
87e609e6
package
com
.
pcloud
.
book
.
weixinclock
.
biz
.
impl
;
import
com.google.common.collect.Lists
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
...
...
@@ -15,6 +16,7 @@ import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import
com.pcloud.book.group.vo.BookGroupClassifyVO
;
import
com.pcloud.book.group.vo.ListGroupClassifyParam
;
import
com.pcloud.book.weixinclock.biz.WeixinClockBiz
;
import
com.pcloud.book.weixinclock.check.WeixinClockCheck
;
import
com.pcloud.book.weixinclock.dao.WeixinClockDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao
;
import
com.pcloud.book.weixinclock.dao.WeixinClockMemberDao
;
...
...
@@ -70,6 +72,11 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.ThreadFactory
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -108,6 +115,14 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
private
AmqpTemplate
amqpTemplate
;
@Autowired
private
ReaderConsr
readerConsr
;
@Autowired
private
WeixinClockCheck
weixinClockCheck
;
private
static
final
ThreadFactory
NAMED_THREAD_FACTORY
=
new
ThreadFactoryBuilder
()
.
setNameFormat
(
"weixinclock-pool-%d"
).
build
();
private
static
final
ExecutorService
EXECUTOR_SERVICE
=
new
ThreadPoolExecutor
(
5
,
10
,
0L
,
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<>(
1024
),
NAMED_THREAD_FACTORY
,
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
@Value
(
"${wechat.group.link.prefix}"
)
private
String
wechatGroupLinkPrefix
;
...
...
@@ -124,6 +139,7 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
if
(
null
==
weixinClockDto
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少必要参数!"
);
}
weixinClockCheck
.
checkParam4CreateWeixinClock
(
weixinClockDto
);
WeixinClock
weixinClock
=
new
WeixinClock
();
BeanUtils
.
copyProperties
(
weixinClockDto
,
weixinClock
);
weixinClockDao
.
insert
(
weixinClock
);
...
...
@@ -219,6 +235,9 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
@ParamLog
(
"删除微信群签到打卡"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteWeixinClock
(
Long
weixinClockId
,
Long
adviserId
)
throws
BizException
{
if
(
null
==
weixinClockId
){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少删除的必要参数"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"weixinClockId"
,
weixinClockId
);
//删除对应的群分类
...
...
@@ -238,6 +257,13 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
@ParamLog
(
"修改微信群签到打卡"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateWeixinClock
(
WeixinClockDto
weixinClockDto
)
throws
BizException
{
if
(
null
==
weixinClockDto
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少必要参数!"
);
}
if
(
null
==
weixinClockDto
.
getWeixinClockId
()){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少修改的必要参数"
);
}
weixinClockCheck
.
checkParam4CreateWeixinClock
(
weixinClockDto
);
Long
weixinClockId
=
weixinClockDto
.
getWeixinClockId
();
WeixinClock
weixinClock
=
new
WeixinClock
();
BeanUtils
.
copyProperties
(
weixinClockDto
,
weixinClock
);
...
...
@@ -306,6 +332,9 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
@Override
@ParamLog
(
"获取某个微信群签到打卡的所有群分类详情"
)
public
PageBeanNew
<
BookGroupClassifyVO
>
listGroupClassifyDetail4Clock
(
Long
weixinClockId
,
Integer
currentPage
,
Integer
numPerPage
)
throws
BizException
{
if
(
null
==
weixinClockId
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少微信打卡标识的必要参数!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"weixinClockId"
,
weixinClockId
);
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
...
...
@@ -438,20 +467,23 @@ public class WeixinClockBizImpl implements WeixinClockBiz {
//发topic,增加抽奖次数
//发送抽奖的TOPIC
Long
clockDays
=
weixinClockTopicDao
.
getClockCountByUser
(
wechatGroupId
,
userWxId
);
PromotionOrderDto
promotionOrderDto
=
new
PromotionOrderDto
();
List
<
PromotionGiftDto
>
promotionGiftDtoList
=
new
ArrayList
<>();
PromotionGiftDto
promotionGiftDto
=
new
PromotionGiftDto
();
promotionGiftDto
.
setTargetClass
(
PromotionOrderEnum
.
TARGET_CLASS_APP
.
getCode
());
promotionGiftDto
.
setTargetType
(
AppTypeEnum
.
DRAW
.
value
);
promotionGiftDto
.
setTargetId
(
weixinClockDto
.
getClockPrizeId
());
Integer
grantNum
=
weixinClockRewardDao
.
getGrantNumFromReward
(
weixinClockDto
.
getWeixinClockId
(),
clockDays
);
promotionGiftDto
.
setGrantNum
(
grantNum
==
null
?
"0"
:
grantNum
.
toString
());
promotionGiftDtoList
.
add
(
promotionGiftDto
);
promotionOrderDto
.
setGifts
(
promotionGiftDtoList
);
AppDto
appDto
=
appConsr
.
getBaseById
(
weixinClockDto
.
getClockPrizeId
());
promotionOrderDto
.
setUserId
(
readerConsr
.
getWechatUserId
(
userWxId
,
appDto
.
getChannelId
()));
LOGGER
.
info
(
"发送抽奖规则,参数:promotionOrderDto="
+
promotionOrderDto
);
amqpTemplate
.
convertAndSend
(
MQTopicProducer
.
EXCHAGE
,
MQTopicProducer
.
GIVE_GIFT
,
promotionOrderDto
);
EXECUTOR_SERVICE
.
execute
(()
->
{
LOGGER
.
info
(
"异步校验是否满足抽奖要求,clockDays="
+
clockDays
);
PromotionOrderDto
promotionOrderDto
=
new
PromotionOrderDto
();
List
<
PromotionGiftDto
>
promotionGiftDtoList
=
new
ArrayList
<>();
PromotionGiftDto
promotionGiftDto
=
new
PromotionGiftDto
();
promotionGiftDto
.
setTargetClass
(
PromotionOrderEnum
.
TARGET_CLASS_APP
.
getCode
());
promotionGiftDto
.
setTargetType
(
AppTypeEnum
.
DRAW
.
value
);
promotionGiftDto
.
setTargetId
(
weixinClockDto
.
getClockPrizeId
());
Integer
grantNum
=
weixinClockRewardDao
.
getGrantNumFromReward
(
weixinClockDto
.
getWeixinClockId
(),
clockDays
);
promotionGiftDto
.
setGrantNum
(
grantNum
==
null
?
"0"
:
grantNum
.
toString
());
promotionGiftDtoList
.
add
(
promotionGiftDto
);
promotionOrderDto
.
setGifts
(
promotionGiftDtoList
);
AppDto
appDto
=
appConsr
.
getBaseById
(
weixinClockDto
.
getClockPrizeId
());
promotionOrderDto
.
setUserId
(
readerConsr
.
getWechatUserId
(
userWxId
,
appDto
.
getChannelId
()));
LOGGER
.
info
(
"发送抽奖规则,参数:promotionOrderDto="
+
promotionOrderDto
);
amqpTemplate
.
convertAndSend
(
MQTopicProducer
.
EXCHAGE
,
MQTopicProducer
.
GIVE_GIFT
,
promotionOrderDto
);
});
//获取我的新排名
Integer
newOrder
=
weixinClockMemberDao
.
getMyNewOrder
(
wechatGroupId
,
userWxId
);
String
clockRewardUrl
=
getClockRewardUrl
(
weixinClockDto
.
getClockPrizeId
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/check/WeixinClockCheck.java
0 → 100644
View file @
87e609e6
package
com
.
pcloud
.
book
.
weixinclock
.
check
;
import
com.pcloud.book.weixinclock.dto.WeixinClockDto
;
/**
* @author 杨涛
* @description 检查
* @date 2019/8/20 10:03
*/
public
interface
WeixinClockCheck
{
void
checkParam4CreateWeixinClock
(
WeixinClockDto
weixinClockDto
);
}
pcloud-service-book/src/main/java/com/pcloud/book/weixinclock/check/impl/WeixinClockCheckImpl.java
0 → 100644
View file @
87e609e6
package
com
.
pcloud
.
book
.
weixinclock
.
check
.
impl
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.clock.entity.BookClockInfo
;
import
com.pcloud.book.weixinclock.check.WeixinClockCheck
;
import
com.pcloud.book.weixinclock.dto.WeixinClockDto
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @author 杨涛
* @description 检查
* @date 2019/8/20 10:19
*/
@Component
(
"weixinClockCheck"
)
public
class
WeixinClockCheckImpl
implements
WeixinClockCheck
{
/**
* 创建微信签到打卡时的参数校验
* @param weixinClockDto
*/
@Override
public
void
checkParam4CreateWeixinClock
(
WeixinClockDto
weixinClockDto
)
{
if
(
StringUtil
.
isEmpty
(
weixinClockDto
.
getClockKeyword
())){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少打卡关键词!"
);
}
if
(
StringUtil
.
isEmpty
(
weixinClockDto
.
getClockGuide
())){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少打卡引导语!"
);
}
if
(
StringUtil
.
isEmpty
(
weixinClockDto
.
getClockIntroduction
())){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少打卡简介!"
);
}
if
(
null
==
weixinClockDto
.
getClockPrizeId
()){
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"缺少打卡的奖励应用ID!"
);
}
}
}
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