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
bbd5cd3e
Commit
bbd5cd3e
authored
Aug 12, 2019
by
朱亚洁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
猜谜语
parent
cbc4a913
Show whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
2045 additions
and
9 deletions
+2045
-9
RiddleService.java
...k/src/main/java/com/pcloud/book/riddle/RiddleService.java
+26
-0
RiddleConstant.java
...java/com/pcloud/book/riddle/constants/RiddleConstant.java
+26
-0
RiddleRecordStatusEnum.java
.../com/pcloud/book/riddle/enums/RiddleRecordStatusEnum.java
+37
-0
RiddleReplyTypeEnum.java
...ava/com/pcloud/book/riddle/enums/RiddleReplyTypeEnum.java
+55
-0
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+15
-0
GroupQrcodeBiz.java
...c/main/java/com/pcloud/book/group/biz/GroupQrcodeBiz.java
+11
-0
GroupQrcodeBizImpl.java
...va/com/pcloud/book/group/biz/impl/GroupQrcodeBizImpl.java
+43
-1
GroupQrcodeDao.java
...c/main/java/com/pcloud/book/group/dao/GroupQrcodeDao.java
+8
-0
GroupQrcodeDaoImpl.java
...va/com/pcloud/book/group/dao/impl/GroupQrcodeDaoImpl.java
+9
-0
GroupQrcode.java
...c/main/java/com/pcloud/book/group/entity/GroupQrcode.java
+15
-0
BookGroupClassifyServiceImpl.java
...book/group/service/impl/BookGroupClassifyServiceImpl.java
+1
-4
WxGroupSendTextListener.java
...ava/com/pcloud/book/mq/topic/WxGroupSendTextListener.java
+6
-3
RiddleRecordBiz.java
...main/java/com/pcloud/book/riddle/biz/RiddleRecordBiz.java
+70
-0
RiddleRecordBizImpl.java
.../com/pcloud/book/riddle/biz/impl/RiddleRecordBizImpl.java
+516
-0
RiddleDao.java
...k/src/main/java/com/pcloud/book/riddle/dao/RiddleDao.java
+22
-0
RiddleRecordDao.java
...main/java/com/pcloud/book/riddle/dao/RiddleRecordDao.java
+36
-0
RiddleReplyDao.java
.../main/java/com/pcloud/book/riddle/dao/RiddleReplyDao.java
+22
-0
RiddleDaoImpl.java
...n/java/com/pcloud/book/riddle/dao/impl/RiddleDaoImpl.java
+29
-0
RiddleRecordDaoImpl.java
.../com/pcloud/book/riddle/dao/impl/RiddleRecordDaoImpl.java
+40
-0
RiddleReplyDaoImpl.java
...a/com/pcloud/book/riddle/dao/impl/RiddleReplyDaoImpl.java
+24
-0
GroupRedisDTO.java
...c/main/java/com/pcloud/book/riddle/dto/GroupRedisDTO.java
+58
-0
GroupRiddleDTO.java
.../main/java/com/pcloud/book/riddle/dto/GroupRiddleDTO.java
+258
-0
RiddleOpenDTO.java
...c/main/java/com/pcloud/book/riddle/dto/RiddleOpenDTO.java
+45
-0
Riddle.java
...k/src/main/java/com/pcloud/book/riddle/entity/Riddle.java
+96
-0
RiddleRecord.java
...main/java/com/pcloud/book/riddle/entity/RiddleRecord.java
+106
-0
RiddleReply.java
.../main/java/com/pcloud/book/riddle/entity/RiddleReply.java
+60
-0
RiddleFacade.java
...main/java/com/pcloud/book/riddle/facade/RiddleFacade.java
+82
-0
RiddleRedis.java
...c/main/java/com/pcloud/book/riddle/redis/RiddleRedis.java
+114
-0
RiddleServiceImpl.java
...om/pcloud/book/riddle/service/impl/RiddleServiceImpl.java
+44
-0
GroupQrcode.Mapper.xml
...ok/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
+45
-1
RiddleMapper.xml
...ce-book/src/main/resources/mapper/riddle/RiddleMapper.xml
+38
-0
RiddleRecordMapper.xml
...k/src/main/resources/mapper/riddle/RiddleRecordMapper.xml
+63
-0
RiddleReplyMapper.xml
...ok/src/main/resources/mapper/riddle/RiddleReplyMapper.xml
+25
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/riddle/RiddleService.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
java.util.Map
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* @描述:猜谜语接口
* @作者:zhuyajie
* @创建时间:16:24 2019/8/5
* @版本:1.0
*/
@FeignClient
(
value
=
"pcloud-service-book"
,
qualifier
=
"riddleServiceCloud"
,
path
=
"book/v1.0/riddleService"
)
@Api
(
description
=
"猜谜语接口"
)
public
interface
RiddleService
{
@ApiOperation
(
value
=
"定时器调用游戏结束接口"
,
httpMethod
=
"POST"
)
@RequestMapping
(
value
=
"/riddleEndQuartz"
,
method
=
RequestMethod
.
POST
)
public
void
riddleEndQuartz
(
@RequestBody
Map
<
String
,
Object
>
map
);
}
pcloud-facade-book/src/main/java/com/pcloud/book/riddle/constants/RiddleConstant.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
constants
;
/**
* @描述:猜谜语常量
* @作者:zhuyajie
* @创建时间:17:36 2019/7/29
* @版本:1.0
*/
public
class
RiddleConstant
{
/**
* 10s
*/
public
static
Integer
expire_seconds
=
12
;
/**
* 定时器类型名称
*/
public
static
final
String
JOB_GROUP_RIDDLE
=
"riddle"
;
/**
* 到期定时器方法名
*/
public
static
final
String
JOB_NAME_RIDDLE_EXPIRE
=
"judgeRiddleTime"
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/riddle/enums/RiddleRecordStatusEnum.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
enums
;
/**
* @描述:猜谜进度状态
* @作者:zhuyajie
* @创建时间:10:14 2019/7/25
* @版本:1.0
*/
public
enum
RiddleRecordStatusEnum
{
/**
* 开始
*/
begin
(
0
),
/**
*结束
*/
end
(
1
),
/**
*进行中
*/
underway
(
2
);
private
Integer
code
;
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
RiddleRecordStatusEnum
(
Integer
code
)
{
this
.
code
=
code
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/riddle/enums/RiddleReplyTypeEnum.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
enums
;
/**
* @描述:回复文案类型
* @作者:zhuyajie
* @创建时间:16:56 2019/7/24
* @版本:1.0
*/
public
enum
RiddleReplyTypeEnum
{
/**
* 游戏规则
*/
rule
(
"rule"
),
/**
* 无人回复的结束语
*/
no_reply_end
(
"no_reply_end"
),
/**
* 答完全部题结束语
*/
finish_end
(
"finish_end"
),
/**
* 中途回复关键词
*/
midway_in
(
"midway_in"
),
/**
* 答对
*/
correct
(
"correct"
),
/**
* 答错
*/
incorrect
(
"incorrect"
),
/**
* 部分正确
*/
partly_correct
(
"partly_correct"
);
private
String
code
;
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
RiddleReplyTypeEnum
(
String
code
)
{
this
.
code
=
code
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
bbd5cd3e
...
...
@@ -2,12 +2,14 @@ package com.pcloud.book.consumer.wechatgroup;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.wechatgroup.group.dto.GroupMemberStatisDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.pcloud.wechatgroup.group.dto.RobotReplyDTO
;
import
com.pcloud.wechatgroup.group.service.GroupMemberService
;
import
com.pcloud.wechatgroup.message.dto.GroupChatCountDTO
;
...
...
@@ -15,6 +17,7 @@ import com.pcloud.wechatgroup.message.service.MessageService;
import
com.pcloud.wechatgroup.monitor.service.MonitorService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
...
...
@@ -267,4 +270,16 @@ public class WechatGroupConsr {
}
return
map
;
}
@ParamLog
(
"根据用户微信ID获取用户信息"
)
public
GroupUserDTO
getWxUserInfoByWxUserId
(
String
wxUserId
)
{
GroupUserDTO
dto
=
new
GroupUserDTO
();
try
{
dto
=
ResponseHandleUtil
.
parseResponse
(
groupMemberService
.
getWxUserInfoByWxId
(
wxUserId
),
GroupUserDTO
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"根据用户微信ID获取用户信息.[getWxUserInfoByWxId]:"
+
e
.
getMessage
(),
e
);
}
return
dto
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/GroupQrcodeBiz.java
View file @
bbd5cd3e
...
...
@@ -10,6 +10,7 @@ import com.pcloud.book.group.vo.GroupQrcodeBookVO;
import
com.pcloud.book.group.vo.ListGroupQrcodeResponseVO
;
import
com.pcloud.book.group.vo.ListQrcodeByClassifyParamVO
;
import
com.pcloud.book.group.vo.UpdateGroupQrcodeRequestVO
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
...
...
@@ -130,4 +131,14 @@ public interface GroupQrcodeBiz {
* @return
*/
PageBeanNew
<
GroupQrcodeBookVO
>
listQrcodeByAdviser
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
adviserId
);
/**
* 猜谜语列表
* @param partyId
* @param currentPage
* @param numPerPage
* @param name
* @return
*/
PageBeanNew
<
GroupRiddleDTO
>
listPageRiddle
(
Long
partyId
,
Integer
currentPage
,
Integer
numPerPage
,
String
name
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/GroupQrcodeBizImpl.java
View file @
bbd5cd3e
...
...
@@ -47,7 +47,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
org.apache.commons.collections4.MapUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -491,5 +491,47 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
return
pageBeanNew
;
}
@Override
public
PageBeanNew
<
GroupRiddleDTO
>
listPageRiddle
(
Long
partyId
,
Integer
currentPage
,
Integer
numPerPage
,
String
name
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"partyId"
,
partyId
);
paramMap
.
put
(
"name"
,
name
);
PageBeanNew
<
GroupRiddleDTO
>
pageBeanNew
=
groupQrcodeDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listPageRiddle"
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
//标签
Map
<
Long
,
String
>
labelMap
=
new
HashMap
<>();
List
<
Long
>
labelIds
=
new
ArrayList
<>();
List
<
Long
>
proLabels
=
pageBeanNew
.
getRecordList
().
stream
().
filter
(
s
->
s
.
getProLabelId
()
!=
null
).
map
(
GroupRiddleDTO:
:
getProLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
depLabels
=
pageBeanNew
.
getRecordList
().
stream
().
filter
(
s
->
s
.
getDepLabelId
()
!=
null
).
map
(
GroupRiddleDTO:
:
getDepLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
purLabels
=
pageBeanNew
.
getRecordList
().
stream
().
filter
(
s
->
s
.
getPurLabelId
()
!=
null
).
map
(
GroupRiddleDTO:
:
getPurLabelId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
proLabels
))
{
labelIds
.
addAll
(
proLabels
);
}
if
(!
ListUtils
.
isEmpty
(
depLabels
))
{
labelIds
.
addAll
(
depLabels
);
}
if
(!
ListUtils
.
isEmpty
(
purLabels
))
{
labelIds
.
addAll
(
purLabels
);
}
if
(!
ListUtils
.
isEmpty
(
labelIds
))
{
labelMap
=
labelConsr
.
getLabelName
(
labelIds
);
}
if
(!
MapUtils
.
isEmpty
(
labelMap
))
{
for
(
GroupRiddleDTO
riddleDTO
:
pageBeanNew
.
getRecordList
())
{
if
(
null
!=
riddleDTO
.
getProLabelId
()
&&
labelMap
.
containsKey
(
riddleDTO
.
getProLabelId
()))
{
riddleDTO
.
setProLabelName
(
labelMap
.
get
(
riddleDTO
.
getProLabelId
()));
}
if
(
null
!=
riddleDTO
.
getDepLabelId
()
&&
labelMap
.
containsKey
(
riddleDTO
.
getDepLabelId
()))
{
riddleDTO
.
setDepLabelName
(
labelMap
.
get
(
riddleDTO
.
getDepLabelId
()));
}
if
(
null
!=
riddleDTO
.
getPurLabelId
()
&&
labelMap
.
containsKey
(
riddleDTO
.
getPurLabelId
()))
{
riddleDTO
.
setPurLabelName
(
labelMap
.
get
(
riddleDTO
.
getPurLabelId
()));
}
}
}
return
pageBeanNew
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/GroupQrcodeDao.java
View file @
bbd5cd3e
...
...
@@ -196,4 +196,12 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
* 根据分类id集合查询
*/
List
<
GroupQrcodeFoAdDTO
>
GroupQrcodeFoAdDTOSByClassifyIds
(
List
<
Long
>
classifyIds
);
/**
* 修改猜谜语开启状态
* @param qrcodeId
* @param status
*/
void
updateRiddleOpenStatus
(
Long
qrcodeId
,
Boolean
status
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/GroupQrcodeDaoImpl.java
View file @
bbd5cd3e
...
...
@@ -188,4 +188,13 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
public
List
<
GroupQrcodeFoAdDTO
>
GroupQrcodeFoAdDTOSByClassifyIds
(
List
<
Long
>
classifyIds
)
{
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"GroupQrcodeFoAdDTOSByClassifyIds"
),
classifyIds
);
}
@Override
public
void
updateRiddleOpenStatus
(
Long
qrcodeId
,
Boolean
status
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"qrcodeId"
,
qrcodeId
);
map
.
put
(
"status"
,
status
);
getSessionTemplate
().
update
(
getStatement
(
"updateRiddleOpenStatus"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/GroupQrcode.java
View file @
bbd5cd3e
...
...
@@ -80,6 +80,10 @@ public class GroupQrcode extends BaseEntity {
* 修改用户
*/
private
Long
updateUser
;
/**
* 猜谜语是否开启
*/
private
Boolean
riddleOpen
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
...
...
@@ -231,6 +235,14 @@ public class GroupQrcode extends BaseEntity {
this
.
qrcodeState
=
qrcodeState
;
}
public
Boolean
getRiddleOpen
()
{
return
riddleOpen
;
}
public
void
setRiddleOpen
(
Boolean
riddleOpen
)
{
this
.
riddleOpen
=
riddleOpen
;
}
@Override
public
String
toString
()
{
return
"GroupQrcode{"
+
...
...
@@ -243,12 +255,15 @@ public class GroupQrcode extends BaseEntity {
", weixinGroupId='"
+
weixinGroupId
+
'\''
+
", qrcodeUrl='"
+
qrcodeUrl
+
'\''
+
", useState="
+
useState
+
", qrcodeState="
+
qrcodeState
+
", changeNameState="
+
changeNameState
+
", isDelete="
+
isDelete
+
", createUser="
+
createUser
+
", updateUser="
+
updateUser
+
", riddleOpen="
+
riddleOpen
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", qrcodeHeadUrl='"
+
qrcodeHeadUrl
+
'\''
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/service/impl/BookGroupClassifyServiceImpl.java
View file @
bbd5cd3e
...
...
@@ -2,10 +2,7 @@ package com.pcloud.book.group.service.impl;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupQrcodeBaseDTO
;
import
com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising
;
import
com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO
;
import
com.pcloud.book.group.dto.*
;
import
com.pcloud.book.group.service.BookGroupClassifyService
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WxGroupSendTextListener.java
View file @
bbd5cd3e
...
...
@@ -6,6 +6,7 @@ import com.pcloud.book.clock.dto.BookClockInfoDTO;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
com.pcloud.book.riddle.biz.RiddleRecordBiz
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
...
...
@@ -18,9 +19,7 @@ import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
/**
...
...
@@ -33,7 +32,6 @@ import lombok.extern.slf4j.Slf4j;
public
class
WxGroupSendTextListener
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
WxGroupSendTextListener
.
class
);
@Autowired
private
BookKeywordBiz
bookKeywordBiz
;
@Autowired
...
...
@@ -42,6 +40,8 @@ public class WxGroupSendTextListener {
private
BookClockKeywordBiz
bookClockKeywordBiz
;
@Autowired
private
BookClockCheck
bookClockCheck
;
@Autowired
private
RiddleRecordBiz
riddleRecordBiz
;
/**
* 接收微信用户进群消息
...
...
@@ -64,9 +64,12 @@ public class WxGroupSendTextListener {
bookKeywordBiz
.
sendKeywordMessage
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
(),
wechatUserId
,
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
log
.
info
(
"[接收用户发送文本消息] 总耗时:{}ms "
,
System
.
currentTimeMillis
()
-
l
);
}
//猜谜语
riddleRecordBiz
.
riddleProcess
(
sendTextDTO
);
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"接收用户发送文本消息失败"
+
e
.
getMessage
(),
e
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/biz/RiddleRecordBiz.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
biz
;
import
com.pcloud.book.riddle.dto.GroupRedisDTO
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
/**
* @描述:猜谜过程
* @作者:zhuyajie
* @创建时间:18:20 2019/7/24
* @版本:1.0
*/
public
interface
RiddleRecordBiz
{
/**
* 猜谜过程
* @param sendTextDTO
*/
public
void
riddleProcess
(
SendTextDTO
sendTextDTO
);
/**
* 猜谜语详情列表
* @param partyId
* @param currentPage
* @param numPerPage
* @param name
* @return
*/
PageBeanNew
<
GroupRiddleDTO
>
listPage
(
Long
partyId
,
Integer
currentPage
,
Integer
numPerPage
,
String
name
);
/**
* 修改猜谜语开启状态
* @param qrcodeId
* @param status
*/
void
updateRiddleOpenStatus
(
Long
qrcodeId
,
Boolean
status
);
/**
* 自动结束
* @param wxGroupId
* @param wxId
* @param ip
* @param wxUserId
*/
public
void
autoEnd
(
String
wxGroupId
,
String
wxId
,
String
ip
,
String
wxUserId
);
/**
* 根据类型查回复语
* @param type
* @return
*/
public
String
getRandomReply
(
String
type
);
/**
* 发文本消息
* @param wxId
* @param wxGroupId
* @param content
* @param ip
* @param wxUserId
*/
public
void
sendWeixinTextMessage
(
String
wxId
,
String
wxGroupId
,
String
content
,
String
ip
,
String
wxUserId
);
/**
* 发送答错文案
* @param groupRedisDTO
*/
public
void
sendIncorrectMessage
(
GroupRedisDTO
groupRedisDTO
);
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/biz/impl/RiddleRecordBizImpl.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
biz
.
impl
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.dto.ReplyKeywordDTO
;
import
com.pcloud.book.riddle.biz.RiddleRecordBiz
;
import
com.pcloud.book.riddle.constants.RiddleConstant
;
import
com.pcloud.book.riddle.dao.RiddleDao
;
import
com.pcloud.book.riddle.dao.RiddleRecordDao
;
import
com.pcloud.book.riddle.dao.RiddleReplyDao
;
import
com.pcloud.book.riddle.dto.GroupRedisDTO
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
com.pcloud.book.riddle.entity.Riddle
;
import
com.pcloud.book.riddle.entity.RiddleRecord
;
import
com.pcloud.book.riddle.enums.RiddleRecordStatusEnum
;
import
com.pcloud.book.riddle.enums.RiddleReplyTypeEnum
;
import
com.pcloud.book.riddle.redis.RiddleRedis
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.facade.quartz.entity.CallBackParam
;
import
com.pcloud.facade.quartz.entity.ScheduleJob
;
import
com.pcloud.facade.quartz.service.ScheduleService
;
import
com.pcloud.wechatgroup.group.dto.GroupUserDTO
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.Timer
;
import
java.util.TimerTask
;
/**
* @描述:猜谜记录
* @作者:zhuyajie
* @创建时间:18:20 2019/7/24
* @版本:1.0
*/
@Component
(
"riddleRecordBiz"
)
public
class
RiddleRecordBizImpl
implements
RiddleRecordBiz
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RiddleRecordBizImpl
.
class
);
@Autowired
private
RiddleDao
riddleDao
;
@Autowired
private
RiddleRecordDao
riddleRecordDao
;
@Autowired
private
RiddleReplyDao
riddleReplyDao
;
@Autowired
private
BookGroupClassifyBiz
bookGroupClassifyBiz
;
@Autowired
private
BookKeywordDao
bookKeywordDao
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
RiddleRedis
riddleRedis
;
@Autowired
private
GroupQrcodeBiz
groupQrcodeBiz
;
@Autowired
private
GroupQrcodeDao
groupQrcodeDao
;
@Autowired
private
ScheduleService
scheduleService
;
@Override
@ParamLog
(
"猜谜语游戏过程"
)
public
void
riddleProcess
(
SendTextDTO
sendTextDTO
)
{
if
(
null
==
sendTextDTO
||
StringUtil
.
isEmpty
(
sendTextDTO
.
getTextContent
()))
{
return
;
}
String
textContent
=
sendTextDTO
.
getTextContent
().
trim
();
String
wxGroupId
=
sendTextDTO
.
getWechatGroupId
();
String
wxUserId
=
sendTextDTO
.
getWechatUserId
();
String
wxId
=
sendTextDTO
.
getWxId
();
String
ip
=
sendTextDTO
.
getIp
();
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getGroupQrcodeByGroupId
(
wxGroupId
);
if
(
null
!=
groupQrcode
)
{
if
(!
groupQrcode
.
getRiddleOpen
())
{
logger
.
info
(
"微信群="
+
wxGroupId
+
"没有开启猜谜语游戏权限"
);
return
;
}
}
//历史记录
RiddleRecord
riddleRecord
=
riddleRecordDao
.
getLastRecordByWxGroupId
(
wxGroupId
);
//1该群猜谜语没有记录或已结束
if
(
null
==
riddleRecord
||
(
null
!=
riddleRecord
&&
RiddleRecordStatusEnum
.
end
.
getCode
().
equals
(
riddleRecord
.
getStatus
())))
{
Riddle
currentRiddle
=
null
;
Integer
finishCount
=
0
;
if
(
null
!=
riddleRecord
)
{
currentRiddle
=
riddleDao
.
getById
(
riddleRecord
.
getRiddleId
());
finishCount
=
riddleRecord
.
getFinishCount
()
==
null
?
0
:
riddleRecord
.
getFinishCount
();
Integer
correctCount
=
riddleRecordDao
.
getCorrectCountByGroup
(
wxGroupId
,
finishCount
);
if
(
correctCount
==
180
)
{
//结束前答对180道,通关次数+1
currentRiddle
=
null
;
finishCount
=
finishCount
+
1
;
}
}
//1.1关键词“猜谜语” ,游戏开启,计时
if
(
textContent
.
equals
(
"猜谜语"
))
{
startGame
(
currentRiddle
,
wxGroupId
,
wxId
,
ip
,
finishCount
);
}
}
//2猜谜语进行中
else
if
(
null
!=
riddleRecord
&&
!
RiddleRecordStatusEnum
.
end
.
getCode
().
equals
(
riddleRecord
.
getStatus
()))
{
//2.1是关键词,不处理
Boolean
keyWord
=
false
;
GroupClassifyQrcodeDTO
classifyQrcodeInfo
=
bookGroupClassifyBiz
.
getClassifyQrcodeInfo
(
wxGroupId
);
if
(
null
!=
classifyQrcodeInfo
)
{
ReplyKeywordDTO
replyKeywordDTO
=
bookKeywordDao
.
getKeywordId
(
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
(),
textContent
);
if
(
null
!=
replyKeywordDTO
)
{
keyWord
=
true
;
}
}
if
(
keyWord
)
{
logger
.
info
(
"该条信息为关键词,不处理,textContent="
+
textContent
);
return
;
}
Integer
finishCount
=
riddleRecord
.
getFinishCount
()
==
null
?
0
:
riddleRecord
.
getFinishCount
();
Long
riddleId
=
riddleRecord
.
getRiddleId
();
Riddle
riddle
=
riddleDao
.
getById
(
riddleId
);
if
(
null
==
riddle
)
{
logger
.
info
(
"该条谜语不存在,riddleId+"
+
riddleId
);
return
;
}
RiddleRecord
insertRecord
=
new
RiddleRecord
();
insertRecord
.
setRiddleId
(
riddleId
);
insertRecord
.
setWxGroupId
(
wxGroupId
);
insertRecord
.
setWxUserId
(
wxUserId
);
insertRecord
.
setFinishCount
(
finishCount
);
//2.2包含“结束”、“不想玩”,结束游戏
if
(
textContent
.
contains
(
"结束"
)
||
textContent
.
contains
(
"不想玩"
)
||
textContent
.
contains
(
"不玩了"
))
{
endGame
(
insertRecord
,
wxGroupId
,
wxId
,
ip
,
riddle
.
getGrade
(),
finishCount
);
return
;
}
//2.3中途参与,上一条答对了发送下一题,否则发送当前题目
if
(
textContent
.
equals
(
"猜谜语"
))
{
midwayIn
(
riddle
,
riddleRecord
.
getCorrect
(),
wxGroupId
,
wxId
,
ip
,
wxUserId
,
finishCount
);
return
;
}
//2.4不知道、提示、答案、正确答案,给提示语
if
(
textContent
.
contains
(
"不知道"
)
||
textContent
.
contains
(
"提示"
)
||
textContent
.
contains
(
"答案"
)
||
textContent
.
contains
(
"正确答案"
))
{
String
before
=
"思考是件有趣的事哦,再想想吧。友情提示:可以问问其他人或者上网查询正确答案哦。"
;
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
before
,
ip
,
wxUserId
);
return
;
}
//2.5判断答题对错
judgeCorrcet
(
textContent
,
riddle
,
insertRecord
,
wxGroupId
,
wxId
,
ip
,
wxUserId
,
finishCount
);
}
}
@ParamLog
(
"根据类型随机选取回复语"
)
@Override
public
String
getRandomReply
(
String
type
)
{
String
reply
=
""
;
List
<
String
>
replyList
=
riddleReplyDao
.
getReplyByType
(
type
);
if
(
ListUtils
.
isEmpty
(
replyList
))
{
return
reply
;
}
int
size
=
replyList
.
size
();
if
(
size
==
1
)
{
reply
=
replyList
.
get
(
0
);
}
else
if
(
size
>
1
)
{
Random
random
=
new
Random
();
reply
=
replyList
.
get
(
random
.
nextInt
(
size
));
}
return
reply
;
}
@ParamLog
(
"发送文本消息"
)
public
void
sendWeixinTextMessage
(
String
wxId
,
String
wxGroupId
,
String
content
,
String
ip
,
String
wxUserId
)
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setAltId
(
wxId
);
sendTextMessageVO
.
setWxGroupId
(
wxGroupId
);
if
(!
StringUtil
.
isEmpty
(
wxUserId
))
{
sendTextMessageVO
.
setAtId
(
wxUserId
);
GroupUserDTO
groupUser
=
wechatGroupConsr
.
getWxUserInfoByWxUserId
(
wxUserId
);
if
(
null
!=
groupUser
&&
!
StringUtil
.
isEmpty
(
groupUser
.
getNickName
()))
{
content
=
"@"
+
groupUser
.
getNickName
()
+
"。"
+
content
;
}
}
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setIp
(
ip
);
logger
.
info
(
"发送文本消息,"
+
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
@ParamLog
(
"发送下一题"
)
public
Boolean
sendNextRiddle
(
Integer
grade
,
Integer
seq
,
String
wxGroupId
,
String
wxId
,
String
ip
,
RiddleRecordStatusEnum
statusEnum
,
String
beforeContent
,
String
wxUserId
,
Integer
finishCount
)
{
Riddle
riddle
=
riddleDao
.
getRiddleByGradeAndSeq
(
grade
,
seq
);
if
(
null
!=
riddle
)
{
if
(
StringUtil
.
isEmpty
(
beforeContent
))
{
beforeContent
=
"接下来请听下一题:"
;
}
String
sendText
=
beforeContent
+
riddle
.
getRiddleContent
();
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
sendText
,
ip
,
wxUserId
);
//添加记录
RiddleRecord
insertRecord
=
new
RiddleRecord
();
insertRecord
.
setRiddleId
(
riddle
.
getId
());
insertRecord
.
setMessageContent
(
sendText
);
insertRecord
.
setWxGroupId
(
wxGroupId
);
insertRecord
.
setWxUserId
(
wxId
);
insertRecord
.
setCorrect
(
null
);
insertRecord
.
setStatus
(
statusEnum
.
getCode
());
insertRecord
.
setFinishCount
(
finishCount
);
riddleRecordDao
.
insert
(
insertRecord
);
return
true
;
}
else
{
logger
.
info
(
"本关题目没有下一题"
);
return
false
;
}
}
@Override
public
PageBeanNew
<
GroupRiddleDTO
>
listPage
(
Long
partyId
,
Integer
currentPage
,
Integer
numPerPage
,
String
name
)
{
PageBeanNew
<
GroupRiddleDTO
>
pageBeanNew
=
groupQrcodeBiz
.
listPageRiddle
(
partyId
,
currentPage
,
numPerPage
,
name
);
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
for
(
GroupRiddleDTO
riddleDTO
:
pageBeanNew
.
getRecordList
())
{
GroupRiddleDTO
participateCountDTO
=
riddleRecordDao
.
getParticipateCount
(
riddleDTO
.
getWxGroupId
());
if
(
null
!=
participateCountDTO
)
{
riddleDTO
.
setUserNum
(
participateCountDTO
.
getUserNum
()
==
0
?
0
:
participateCountDTO
.
getUserNum
());
riddleDTO
.
setParticipateCount
(
participateCountDTO
.
getParticipateCount
()
==
0
?
0
:
participateCountDTO
.
getParticipateCount
());
}
RiddleRecord
riddleRecord
=
riddleRecordDao
.
getLastRecordByWxGroupId
(
riddleDTO
.
getWxGroupId
());
if
(
null
!=
riddleRecord
)
{
Riddle
riddle
=
riddleDao
.
getById
(
riddleRecord
.
getRiddleId
());
riddleDTO
.
setGrade
(
riddle
.
getGrade
());
riddleDTO
.
setFinishCount
(
riddleRecord
.
getFinishCount
());
Integer
correctCount
=
riddleRecordDao
.
getCorrectCountByGroup
(
riddleDTO
.
getWxGroupId
(),
riddleRecord
.
getFinishCount
());
riddleDTO
.
setCorrectCount
(
correctCount
);
}
}
return
pageBeanNew
;
}
@Override
public
void
updateRiddleOpenStatus
(
Long
qrcodeId
,
Boolean
status
)
{
groupQrcodeDao
.
updateRiddleOpenStatus
(
qrcodeId
,
status
);
}
/**
* 开启游戏
*/
public
void
startGame
(
Riddle
currentRiddle
,
String
wxGroupId
,
String
wxId
,
String
ip
,
Integer
finishCount
)
{
//发送规则
String
reply
=
getRandomReply
(
RiddleReplyTypeEnum
.
rule
.
getCode
());
Integer
correctCount
=
riddleRecordDao
.
getCorrectCountByGroup
(
wxGroupId
,
finishCount
);
if
(
null
!=
currentRiddle
)
{
reply
=
reply
+
"\n"
+
"目前处于第"
+
currentRiddle
.
getGrade
()
+
"关,已猜对"
+
correctCount
+
"题,大家加油。"
;
}
else
{
reply
=
reply
+
"\n"
+
"目前处于第1关,已猜对0题,大家加油。"
;
}
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
reply
,
ip
,
null
);
//发送题目,保存该题目
if
(
null
!=
currentRiddle
)
{
//发送上次题目
String
content
=
"请听题:"
+
currentRiddle
.
getRiddleContent
();
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
content
,
ip
,
null
);
RiddleRecord
insertRecord
=
new
RiddleRecord
();
insertRecord
.
setRiddleId
(
currentRiddle
.
getId
());
insertRecord
.
setMessageContent
(
content
);
insertRecord
.
setWxGroupId
(
wxGroupId
);
insertRecord
.
setWxUserId
(
wxId
);
insertRecord
.
setCorrect
(
null
);
insertRecord
.
setStatus
(
RiddleRecordStatusEnum
.
begin
.
getCode
());
insertRecord
.
setFinishCount
(
finishCount
);
riddleRecordDao
.
insert
(
insertRecord
);
}
else
{
//从第一题开始
sendNextRiddle
(
1
,
0
,
wxGroupId
,
wxId
,
ip
,
RiddleRecordStatusEnum
.
begin
,
"请听题:"
,
null
,
finishCount
);
}
//开始5分钟/10s计时
deleteJob
(
wxGroupId
);
addEndQuartzJob
(
wxGroupId
,
wxId
,
ip
,
wxId
);
riddleRedis
.
addUnderwayGroup
(
wxGroupId
,
wxId
,
ip
);
}
/**
* 结束游戏
*/
public
void
endGame
(
RiddleRecord
insertRecord
,
String
wxGroupId
,
String
wxId
,
String
ip
,
Integer
grade
,
Integer
finishCount
)
{
Integer
correctCount
=
riddleRecordDao
.
getCorrectCountByGroup
(
wxGroupId
,
finishCount
);
String
text
=
"好嘞,再见,爱你们哦。目前本群猜对谜语数"
+
correctCount
+
"道,处于第"
+
grade
+
"关,大家加油。"
;
//发送结束语
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
text
,
ip
,
null
);
//保存结束记录
insertRecord
.
setMessageContent
(
text
);
insertRecord
.
setStatus
(
RiddleRecordStatusEnum
.
end
.
getCode
());
insertRecord
.
setCorrect
(
null
);
riddleRecordDao
.
insert
(
insertRecord
);
deleteJob
(
wxGroupId
);
riddleRedis
.
deleteUnderwayGroup
(
wxGroupId
);
}
/**
* 中途进入
*/
public
void
midwayIn
(
Riddle
riddle
,
Boolean
correct
,
String
wxGroupId
,
String
wxId
,
String
ip
,
String
wxUserId
,
Integer
finishCount
)
{
String
beforeContent
=
getRandomReply
(
RiddleReplyTypeEnum
.
midway_in
.
getCode
());
if
(
null
!=
correct
&&
correct
)
{
Boolean
sendNext
=
sendNextRiddle
(
riddle
.
getGrade
(),
riddle
.
getSeq
(),
wxGroupId
,
wxId
,
ip
,
RiddleRecordStatusEnum
.
underway
,
beforeContent
,
wxUserId
,
finishCount
);
if
(!
sendNext
)
{
//本关没有下一题
if
(
riddle
.
getGrade
()
<
3
)
{
//从下一关第一题开始
sendNextRiddle
(
riddle
.
getGrade
()
+
1
,
0
,
wxGroupId
,
wxId
,
ip
,
RiddleRecordStatusEnum
.
underway
,
beforeContent
,
wxUserId
,
finishCount
);
}
else
{
//3关都答完,从头开始
sendNextRiddle
(
1
,
0
,
wxGroupId
,
wxId
,
ip
,
RiddleRecordStatusEnum
.
begin
,
beforeContent
,
wxUserId
,
finishCount
+
1
);
}
}
}
else
{
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
beforeContent
+
riddle
.
getRiddleContent
(),
ip
,
wxUserId
);
}
deleteJob
(
wxGroupId
);
addEndQuartzJob
(
wxGroupId
,
wxId
,
ip
,
wxId
);
}
/**
* 判断答题对错
*/
public
void
judgeCorrcet
(
String
textContent
,
Riddle
riddle
,
RiddleRecord
insertRecord
,
String
wxGroupId
,
String
wxId
,
String
ip
,
String
wxUserId
,
Integer
finishCount
)
{
if
(
StringUtil
.
isEmpty
(
textContent
))
{
logger
.
error
(
"回复内容为空"
+
wxGroupId
+
"wxUserId"
+
wxUserId
);
return
;
}
if
(
textContent
.
equals
(
riddle
.
getAnswer
())
||
textContent
.
equals
(
riddle
.
getOtherAnswer
()))
{
//答对
//答对文案
String
beforeContent
=
getRandomReply
(
RiddleReplyTypeEnum
.
correct
.
getCode
());
//保存答题记录
insertRecord
.
setMessageContent
(
textContent
);
insertRecord
.
setCorrect
(
true
);
insertRecord
.
setStatus
(
RiddleRecordStatusEnum
.
underway
.
getCode
());
riddleRecordDao
.
insert
(
insertRecord
);
//发送下一题
Boolean
sendNext
=
sendNextRiddle
(
riddle
.
getGrade
(),
riddle
.
getSeq
(),
wxGroupId
,
wxId
,
ip
,
RiddleRecordStatusEnum
.
underway
,
beforeContent
,
wxUserId
,
finishCount
);
if
(!
sendNext
)
{
//本关没有下一题
if
(
riddle
.
getGrade
()
<
3
)
{
//从下一关第一题开始
sendNextRiddle
(
riddle
.
getGrade
()
+
1
,
0
,
wxGroupId
,
wxId
,
ip
,
RiddleRecordStatusEnum
.
underway
,
beforeContent
,
wxUserId
,
finishCount
);
}
else
{
//3关都答完
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
getRandomReply
(
RiddleReplyTypeEnum
.
finish_end
.
getCode
()),
ip
,
wxUserId
);
}
}
deleteJob
(
wxGroupId
);
addEndQuartzJob
(
wxGroupId
,
wxId
,
ip
,
wxUserId
);
}
else
if
(
riddle
.
getAnswer
().
contains
(
textContent
)
||
textContent
.
contains
(
riddle
.
getAnswer
())
//部分答对
||
(!
StringUtil
.
isEmpty
(
riddle
.
getOtherAnswer
())
&&
textContent
.
contains
(
riddle
.
getOtherAnswer
())))
{
//保存答题记录
insertRecord
.
setMessageContent
(
textContent
);
insertRecord
.
setCorrect
(
false
);
insertRecord
.
setStatus
(
RiddleRecordStatusEnum
.
underway
.
getCode
());
riddleRecordDao
.
insert
(
insertRecord
);
//发送部分答对文案
String
beforeContent
=
getRandomReply
(
RiddleReplyTypeEnum
.
partly_correct
.
getCode
());
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
beforeContent
,
ip
,
null
);
}
else
{
//答错
//保存答题记录
insertRecord
.
setMessageContent
(
textContent
);
insertRecord
.
setCorrect
(
false
);
insertRecord
.
setStatus
(
RiddleRecordStatusEnum
.
underway
.
getCode
());
riddleRecordDao
.
insert
(
insertRecord
);
/* GroupRedisDTO dto = new GroupRedisDTO();
dto.setIp(ip);
dto.setWxId(wxId);
dto.setWxGroupId(wxGroupId);
this.timeSchedule(dto);*/
}
}
/**
* 自动结束
*/
public
void
autoEnd
(
String
wxGroupId
,
String
wxId
,
String
ip
,
String
wxUserId
)
{
RiddleRecord
riddleRecord
=
riddleRecordDao
.
getLastRecordByWxGroupId
(
wxGroupId
);
if
(
null
==
riddleRecord
)
{
logger
.
info
(
"微信群="
+
wxGroupId
+
"没有猜谜语游戏记录"
);
return
;
}
Long
riddleId
=
riddleRecord
.
getRiddleId
();
Riddle
riddle
=
riddleDao
.
getById
(
riddleId
);
if
(
null
==
riddle
)
{
logger
.
info
(
"谜语="
+
riddleId
+
"不存在"
);
return
;
}
Integer
grade
=
riddle
.
getGrade
();
Integer
correctCount
=
riddleRecordDao
.
getCorrectCountByGroup
(
wxGroupId
,
riddleRecord
.
getFinishCount
());
String
reply
=
getRandomReply
(
RiddleReplyTypeEnum
.
no_reply_end
.
getCode
());
String
text
=
reply
+
"目前本群猜对谜语数"
+
correctCount
+
"道,处于第"
+
grade
+
"关。"
+
"\n"
+
"大家想玩记得回复关键词“猜谜语”,我等你们哦。"
;
//发送结束语
sendWeixinTextMessage
(
wxId
,
wxGroupId
,
text
,
ip
,
null
);
//保存结束记录
RiddleRecord
record
=
new
RiddleRecord
();
record
.
setRiddleId
(
riddleId
);
record
.
setWxGroupId
(
wxGroupId
);
record
.
setWxUserId
(
wxUserId
);
record
.
setMessageContent
(
text
);
record
.
setStatus
(
RiddleRecordStatusEnum
.
end
.
getCode
());
record
.
setCorrect
(
null
);
record
.
setFinishCount
(
riddleRecord
.
getFinishCount
());
riddleRecordDao
.
insert
(
record
);
riddleRedis
.
deleteUnderwayGroup
(
wxGroupId
);
}
/**
* 添加定时任务-5分钟游戏自动结束
*/
private
void
addEndQuartzJob
(
String
wxGroupId
,
String
wxId
,
String
ip
,
String
wxUserId
)
{
ScheduleJob
scheduleJob
=
new
ScheduleJob
();
CallBackParam
callBackParam
=
new
CallBackParam
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxGroupId"
,
wxGroupId
);
map
.
put
(
"wxId"
,
wxId
);
map
.
put
(
"ip"
,
ip
);
map
.
put
(
"wxUserId"
,
wxUserId
);
scheduleJob
.
setJobGroup
(
RiddleConstant
.
JOB_GROUP_RIDDLE
);
scheduleJob
.
setJobName
(
RiddleConstant
.
JOB_NAME_RIDDLE_EXPIRE
+
wxGroupId
);
scheduleJob
.
setStartTime
(
5
);
scheduleJob
.
setStartTimeFormat
(
"mm"
);
scheduleJob
.
setRepeatCount
(
0
);
scheduleJob
.
setIntervalTime
(
0
);
scheduleJob
.
setIntervalTimeFormat
(
"mm"
);
callBackParam
.
setBeanName
(
"riddleService"
);
callBackParam
.
setMethodName
(
"riddleEndQuartz"
);
callBackParam
.
setParamMap
(
map
);
Map
<
String
,
Object
>
scheduleMap
=
new
HashMap
<>();
scheduleMap
.
put
(
"scheduleJob"
,
scheduleJob
);
scheduleMap
.
put
(
"callBackParam"
,
callBackParam
);
try
{
scheduleService
.
addSimpleJob
(
scheduleMap
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"【猜谜语】添加定时任务失败"
+
e
.
getMessage
(),
e
);
}
}
/**
* 删除定时任务-5分钟游戏自动结束
*/
private
void
deleteJob
(
String
wxGroupId
)
{
try
{
scheduleService
.
deleteJob
(
RiddleConstant
.
JOB_NAME_RIDDLE_EXPIRE
+
wxGroupId
,
RiddleConstant
.
JOB_GROUP_RIDDLE
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"【猜谜语】删除定时任务失败"
+
e
.
getMessage
(),
e
);
}
}
@Override
@ParamLog
(
"sendIncorrectMessage"
)
public
void
sendIncorrectMessage
(
GroupRedisDTO
groupRedisDTO
)
{
if
(
null
==
groupRedisDTO
)
{
return
;
}
String
wxGroupId
=
groupRedisDTO
.
getWxGroupId
();
RiddleRecord
record
=
riddleRecordDao
.
getLastRecordByWxGroupId
(
wxGroupId
);
if
(
null
==
record
)
{
return
;
}
if
(
null
!=
record
.
getCorrect
()
&&
record
.
getCorrect
()
==
false
)
{
logger
.
info
(
"发送答错文案"
+
groupRedisDTO
);
//发送答错文案
String
beforeContent
=
this
.
getRandomReply
(
RiddleReplyTypeEnum
.
incorrect
.
getCode
());
this
.
sendWeixinTextMessage
(
groupRedisDTO
.
getWxId
(),
wxGroupId
,
beforeContent
,
groupRedisDTO
.
getIp
(),
null
);
//保存记录
RiddleRecord
insertRecord
=
new
RiddleRecord
();
insertRecord
.
setRiddleId
(
record
.
getRiddleId
());
insertRecord
.
setWxGroupId
(
wxGroupId
);
insertRecord
.
setWxUserId
(
groupRedisDTO
.
getWxId
());
insertRecord
.
setMessageContent
(
beforeContent
);
insertRecord
.
setStatus
(
RiddleRecordStatusEnum
.
underway
.
getCode
());
insertRecord
.
setCorrect
(
null
);
insertRecord
.
setFinishCount
(
record
.
getFinishCount
());
riddleRecordDao
.
insert
(
insertRecord
);
}
}
/**
* 10s后发送答错文案
* @param dto
*/
public
void
timeSchedule
(
GroupRedisDTO
dto
)
{
Timer
timer
=
new
Timer
();
timer
.
schedule
(
new
TimerTask
()
{
public
void
run
()
{
sendIncorrectMessage
(
dto
);
}
},
10000
);
try
{
//如果主线程不休眠一段时间,就执行了cancel方法,那么定时器还没来得及执行就会被关闭
Thread
.
sleep
(
60
*
1000
);
timer
.
cancel
();
}
catch
(
InterruptedException
e
)
{
logger
.
error
(
"关闭线程定时器失败"
+
e
.
getMessage
(),
e
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dao/RiddleDao.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dao
;
import
com.pcloud.book.riddle.entity.Riddle
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* @描述:
* @作者:zhuyajie
* @创建时间:16:47 2019/7/24
* @版本:1.0
*/
public
interface
RiddleDao
extends
BaseDao
<
Riddle
>
{
/**
* 根据等级和序号查下一个谜面
* @param grade
* @param seq
* @return
*/
Riddle
getRiddleByGradeAndSeq
(
Integer
grade
,
Integer
seq
);
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dao/RiddleRecordDao.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dao
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
com.pcloud.book.riddle.entity.RiddleRecord
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* @描述:猜谜记录
* @作者:zhuyajie
* @创建时间:18:18 2019/7/24
* @版本:1.0
*/
public
interface
RiddleRecordDao
extends
BaseDao
<
RiddleRecord
>
{
/**
* 获取上一条猜谜记录
* @param wxGroupId
* @return
*/
RiddleRecord
getLastRecordByWxGroupId
(
String
wxGroupId
);
/**
* 获得答对题目数量
* @param wxGroupId
* @return
*/
Integer
getCorrectCountByGroup
(
String
wxGroupId
,
Integer
finishCount
);
/**
* 获取参与次数、人数
* @param wxGroupId
* @return
*/
public
GroupRiddleDTO
getParticipateCount
(
String
wxGroupId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dao/RiddleReplyDao.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dao
;
import
com.pcloud.book.riddle.entity.RiddleReply
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @描述:回复文案
* @作者:zhuyajie
* @创建时间:16:58 2019/7/24
* @版本:1.0
*/
public
interface
RiddleReplyDao
extends
BaseDao
<
RiddleReply
>
{
/**
* 根据类型获取回复语
* @param code
* @return
*/
List
<
String
>
getReplyByType
(
String
code
);
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dao/impl/RiddleDaoImpl.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dao
.
impl
;
import
com.pcloud.book.riddle.dao.RiddleDao
;
import
com.pcloud.book.riddle.entity.Riddle
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @描述:
* @作者:zhuyajie
* @创建时间:16:47 2019/7/24
* @版本:1.0
*/
@Component
(
"riddleDao"
)
public
class
RiddleDaoImpl
extends
BaseDaoImpl
<
Riddle
>
implements
RiddleDao
{
@Override
public
Riddle
getRiddleByGradeAndSeq
(
Integer
grade
,
Integer
seq
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"grade"
,
grade
);
map
.
put
(
"seq"
,
seq
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getRiddleByGradeAndSeq"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dao/impl/RiddleRecordDaoImpl.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dao
.
impl
;
import
com.pcloud.book.riddle.dao.RiddleRecordDao
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
com.pcloud.book.riddle.entity.RiddleRecord
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @描述:猜谜记录
* @作者:zhuyajie
* @创建时间:18:19 2019/7/24
* @版本:1.0
*/
@Component
(
"riddleRecordDao"
)
public
class
RiddleRecordDaoImpl
extends
BaseDaoImpl
<
RiddleRecord
>
implements
RiddleRecordDao
{
@Override
public
RiddleRecord
getLastRecordByWxGroupId
(
String
wxGroupId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getLastRecordByWxGroupId"
),
wxGroupId
);
}
@Override
public
Integer
getCorrectCountByGroup
(
String
wxGroupId
,
Integer
finishCount
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxGroupId"
,
wxGroupId
);
map
.
put
(
"finishCount"
,
finishCount
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getCorrectCountByGroup"
),
map
);
}
@Override
public
GroupRiddleDTO
getParticipateCount
(
String
wxGroupId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getParticipateCount"
),
wxGroupId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dao/impl/RiddleReplyDaoImpl.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dao
.
impl
;
import
com.pcloud.book.riddle.dao.RiddleReplyDao
;
import
com.pcloud.book.riddle.entity.RiddleReply
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @描述:回复文案
* @作者:zhuyajie
* @创建时间:16:58 2019/7/24
* @版本:1.0
*/
@Component
(
"riddleReplyDao"
)
public
class
RiddleReplyDaoImpl
extends
BaseDaoImpl
<
RiddleReply
>
implements
RiddleReplyDao
{
@Override
public
List
<
String
>
getReplyByType
(
String
code
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getReplyByType"
),
code
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dto/GroupRedisDTO.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dto
;
/**
* @描述:
* @作者:zhuyajie
* @创建时间:11:58 2019/8/8
* @版本:1.0
*/
public
class
GroupRedisDTO
{
private
String
wxGroupId
;
private
String
wxId
;
private
String
ip
;
public
String
getWxGroupId
()
{
return
wxGroupId
;
}
public
void
setWxGroupId
(
String
wxGroupId
)
{
this
.
wxGroupId
=
wxGroupId
;
}
public
String
getWxId
()
{
return
wxId
;
}
public
void
setWxId
(
String
wxId
)
{
this
.
wxId
=
wxId
;
}
public
String
getIp
()
{
return
ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
ip
=
ip
;
}
@Override
public
String
toString
()
{
return
"GroupRedisDTO{"
+
"wxGroupId='"
+
wxGroupId
+
'\''
+
", wxId='"
+
wxId
+
'\''
+
", ip='"
+
ip
+
'\''
+
'}'
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
GroupRedisDTO
dto
=
(
GroupRedisDTO
)
o
;
return
wxGroupId
.
equals
(
dto
.
wxGroupId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dto/GroupRiddleDTO.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
/**
* @描述:编辑端猜谜语详情
* @作者:zhuyajie
* @创建时间:20:48 2019/7/31
* @版本:1.0
*/
public
class
GroupRiddleDTO
extends
BaseDto
{
/**
* 微信群名称
*/
private
String
groupName
;
/**
* 群二维码id
*/
private
Long
groupQrcodeId
;
/**
* 微信群id
*/
private
String
wxGroupId
;
/**
* 群分类
*/
private
String
classify
;
/**
*社群码名称
*/
private
String
groupQrcodeName
;
/**
* 图书名
*/
private
String
bookName
;
/**
* 专业标签ID
*/
private
Long
proLabelId
;
/**
* 专业标签名称
*/
private
String
proLabelName
;
/**
* 深度标签ID
*/
private
Long
depLabelId
;
/**
* 深度标签名称
*/
private
String
depLabelName
;
/**
* 目的标签ID
*/
private
Long
purLabelId
;
/**
* 目的标签名称
*/
private
String
purLabelName
;
/**
* 关卡等级
*/
private
Integer
grade
;
/**
* 猜中题数
*/
private
Integer
correctCount
;
/**
* 参与人数
*/
private
Integer
userNum
;
/**
* 参与次数
*/
private
Integer
participateCount
;
/**
* 开启状态
*/
private
Boolean
riddleOpen
;
/**
* 通关次数
*/
private
Integer
finishCount
;
public
String
getGroupName
()
{
return
groupName
;
}
public
void
setGroupName
(
String
groupName
)
{
this
.
groupName
=
groupName
;
}
public
Long
getGroupQrcodeId
()
{
return
groupQrcodeId
;
}
public
void
setGroupQrcodeId
(
Long
groupQrcodeId
)
{
this
.
groupQrcodeId
=
groupQrcodeId
;
}
public
String
getWxGroupId
()
{
return
wxGroupId
;
}
public
void
setWxGroupId
(
String
wxGroupId
)
{
this
.
wxGroupId
=
wxGroupId
;
}
public
String
getClassify
()
{
return
classify
;
}
public
void
setClassify
(
String
classify
)
{
this
.
classify
=
classify
;
}
public
String
getGroupQrcodeName
()
{
return
groupQrcodeName
;
}
public
void
setGroupQrcodeName
(
String
groupQrcodeName
)
{
this
.
groupQrcodeName
=
groupQrcodeName
;
}
public
String
getBookName
()
{
return
bookName
;
}
public
void
setBookName
(
String
bookName
)
{
this
.
bookName
=
bookName
;
}
public
Long
getProLabelId
()
{
return
proLabelId
;
}
public
void
setProLabelId
(
Long
proLabelId
)
{
this
.
proLabelId
=
proLabelId
;
}
public
String
getProLabelName
()
{
return
proLabelName
;
}
public
void
setProLabelName
(
String
proLabelName
)
{
this
.
proLabelName
=
proLabelName
;
}
public
Long
getDepLabelId
()
{
return
depLabelId
;
}
public
void
setDepLabelId
(
Long
depLabelId
)
{
this
.
depLabelId
=
depLabelId
;
}
public
String
getDepLabelName
()
{
return
depLabelName
;
}
public
void
setDepLabelName
(
String
depLabelName
)
{
this
.
depLabelName
=
depLabelName
;
}
public
Long
getPurLabelId
()
{
return
purLabelId
;
}
public
void
setPurLabelId
(
Long
purLabelId
)
{
this
.
purLabelId
=
purLabelId
;
}
public
String
getPurLabelName
()
{
return
purLabelName
;
}
public
void
setPurLabelName
(
String
purLabelName
)
{
this
.
purLabelName
=
purLabelName
;
}
public
Integer
getGrade
()
{
return
grade
;
}
public
void
setGrade
(
Integer
grade
)
{
this
.
grade
=
grade
;
}
public
Integer
getCorrectCount
()
{
return
correctCount
;
}
public
void
setCorrectCount
(
Integer
correctCount
)
{
this
.
correctCount
=
correctCount
;
}
public
Integer
getUserNum
()
{
return
userNum
;
}
public
void
setUserNum
(
Integer
userNum
)
{
this
.
userNum
=
userNum
;
}
public
Integer
getParticipateCount
()
{
return
participateCount
;
}
public
void
setParticipateCount
(
Integer
participateCount
)
{
this
.
participateCount
=
participateCount
;
}
public
Boolean
getRiddleOpen
()
{
return
riddleOpen
;
}
public
void
setRiddleOpen
(
Boolean
riddleOpen
)
{
this
.
riddleOpen
=
riddleOpen
;
}
public
Integer
getFinishCount
()
{
return
finishCount
;
}
public
void
setFinishCount
(
Integer
finishCount
)
{
this
.
finishCount
=
finishCount
;
}
@Override
public
String
toString
()
{
return
"GroupRiddleDTO{"
+
"groupName='"
+
groupName
+
'\''
+
", groupQrcodeId="
+
groupQrcodeId
+
", wxGroupId='"
+
wxGroupId
+
'\''
+
", classify='"
+
classify
+
'\''
+
", groupQrcodeName='"
+
groupQrcodeName
+
'\''
+
", bookName='"
+
bookName
+
'\''
+
", proLabelId="
+
proLabelId
+
", proLabelName='"
+
proLabelName
+
'\''
+
", depLabelId="
+
depLabelId
+
", depLabelName='"
+
depLabelName
+
'\''
+
", purLabelId="
+
purLabelId
+
", purLabelName='"
+
purLabelName
+
'\''
+
", grade="
+
grade
+
", correctCount="
+
correctCount
+
", userNum="
+
userNum
+
", participateCount="
+
participateCount
+
", riddleOpen="
+
riddleOpen
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/dto/RiddleOpenDTO.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
/**
* @描述:猜谜语开启状态
* @作者:zhuyajie
* @创建时间:21:51 2019/7/31
* @版本:1.0
*/
public
class
RiddleOpenDTO
extends
BaseDto
{
/**
* 群id
*/
private
Long
groupQrcodeId
;
/**
* 开启状态
*/
private
Boolean
status
;
public
Long
getGroupQrcodeId
()
{
return
groupQrcodeId
;
}
public
void
setGroupQrcodeId
(
Long
groupQrcodeId
)
{
this
.
groupQrcodeId
=
groupQrcodeId
;
}
public
Boolean
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Boolean
status
)
{
this
.
status
=
status
;
}
@Override
public
String
toString
()
{
return
"RiddleOpenDTO{"
+
"groupQrcodeId="
+
groupQrcodeId
+
", status="
+
status
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/entity/Riddle.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
@ApiModel
(
"谜语"
)
public
class
Riddle
extends
BaseEntity
{
@ApiModelProperty
(
"谜面"
)
private
String
riddleContent
;
@ApiModelProperty
(
"谜底"
)
private
String
answer
;
@ApiModelProperty
(
"备选谜底"
)
private
String
otherAnswer
;
@ApiModelProperty
(
"等级"
)
private
Integer
grade
;
@ApiModelProperty
(
"序号"
)
private
Integer
seq
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
public
String
getRiddleContent
()
{
return
riddleContent
;
}
public
void
setRiddleContent
(
String
riddleContent
)
{
this
.
riddleContent
=
riddleContent
==
null
?
null
:
riddleContent
.
trim
();
}
public
String
getAnswer
()
{
return
answer
;
}
public
void
setAnswer
(
String
answer
)
{
this
.
answer
=
answer
==
null
?
null
:
answer
.
trim
();
}
public
String
getOtherAnswer
()
{
return
otherAnswer
;
}
public
void
setOtherAnswer
(
String
otherAnswer
)
{
this
.
otherAnswer
=
otherAnswer
;
}
public
Integer
getGrade
()
{
return
grade
;
}
public
void
setGrade
(
Integer
grade
)
{
this
.
grade
=
grade
;
}
public
Integer
getSeq
()
{
return
seq
;
}
public
void
setSeq
(
Integer
seq
)
{
this
.
seq
=
seq
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
String
toString
()
{
return
"Riddle{"
+
"riddleContent='"
+
riddleContent
+
'\''
+
", answer='"
+
answer
+
'\''
+
", otherAnswer='"
+
otherAnswer
+
'\''
+
", grade="
+
grade
+
", seq="
+
seq
+
", createTime="
+
createTime
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/riddle/entity/RiddleRecord.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
@ApiModel
(
"猜谜记录"
)
public
class
RiddleRecord
extends
BaseEntity
{
@ApiModelProperty
(
"谜语id"
)
private
Long
riddleId
;
@ApiModelProperty
(
"消息内容"
)
private
String
messageContent
;
@ApiModelProperty
(
"微信群"
)
private
String
wxGroupId
;
@ApiModelProperty
(
"微信用户"
)
private
String
wxUserId
;
@ApiModelProperty
(
"是否正确"
)
private
Boolean
correct
;
@ApiModelProperty
(
"进度状态"
)
private
Integer
status
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
"通关次数"
)
private
Integer
finishCount
;
public
Long
getRiddleId
()
{
return
riddleId
;
}
public
void
setRiddleId
(
Long
riddleId
)
{
this
.
riddleId
=
riddleId
;
}
public
String
getMessageContent
()
{
return
messageContent
;
}
public
void
setMessageContent
(
String
messageContent
)
{
this
.
messageContent
=
messageContent
;
}
public
String
getWxGroupId
()
{
return
wxGroupId
;
}
public
void
setWxGroupId
(
String
wxGroupId
)
{
this
.
wxGroupId
=
wxGroupId
==
null
?
null
:
wxGroupId
.
trim
();
}
public
String
getWxUserId
()
{
return
wxUserId
;
}
public
void
setWxUserId
(
String
wxUserId
)
{
this
.
wxUserId
=
wxUserId
==
null
?
null
:
wxUserId
.
trim
();
}
public
Boolean
getCorrect
()
{
return
correct
;
}
public
void
setCorrect
(
Boolean
correct
)
{
this
.
correct
=
correct
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Integer
getFinishCount
()
{
return
finishCount
;
}
public
void
setFinishCount
(
Integer
finishCount
)
{
this
.
finishCount
=
finishCount
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/riddle/entity/RiddleReply.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
@ApiModel
(
"回复文案"
)
public
class
RiddleReply
extends
BaseEntity
{
@ApiModelProperty
(
"文案内容"
)
private
String
content
;
@ApiModelProperty
(
"文案类型"
)
private
String
type
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
==
null
?
null
:
content
.
trim
();
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
==
null
?
null
:
type
.
trim
();
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
String
toString
()
{
return
"RiddleReply{"
+
"content='"
+
content
+
'\''
+
", type='"
+
type
+
'\''
+
", createTime="
+
createTime
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/riddle/facade/RiddleFacade.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
facade
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.riddle.biz.RiddleRecordBiz
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
com.pcloud.book.riddle.dto.RiddleOpenDTO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
/**
* @描述:猜谜语外部接口
* @作者:zhuyajie
* @创建时间:17:53 2019/7/26
* @版本:1.0
*/
@Api
(
description
=
"猜谜语外部接口"
)
@RequestMapping
(
value
=
"/riddle"
)
@RestController
(
"riddleFacade"
)
public
class
RiddleFacade
{
@Autowired
private
RiddleRecordBiz
riddleRecordBiz
;
@ApiOperation
(
"发送信息"
)
@PostMapping
(
"sendText"
)
public
ResponseDto
<?>
sendText
(
@RequestBody
@ApiParam
SendTextDTO
sendTextDTO
){
riddleRecordBiz
.
riddleProcess
(
sendTextDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"猜谜语详情列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"name"
,
value
=
"name"
,
required
=
false
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
required
=
true
,
dataType
=
"int"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
required
=
true
,
dataType
=
"int"
,
paramType
=
"query"
),
})
@GetMapping
(
"listPage"
)
public
ResponseDto
<
PageBeanNew
<
GroupRiddleDTO
>>
listPage
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"name"
,
required
=
false
)
String
name
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
)
throws
PermissionException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
if
(
null
==
numPerPage
||
null
==
currentPage
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"分页参数缺失"
);
}
PageBeanNew
<
GroupRiddleDTO
>
pageBean
=
riddleRecordBiz
.
listPage
(
partyId
,
currentPage
,
numPerPage
,
name
);
return
new
ResponseDto
<>(
pageBean
);
}
@ApiOperation
(
"更新猜谜语状态"
)
@PostMapping
(
"updateRiddleOpenStatus"
)
public
ResponseDto
<?>
updateRiddleOpenStatus
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@ApiParam
RiddleOpenDTO
riddleOpenDTO
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
if
(
null
==
riddleOpenDTO
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失"
);
}
Long
qrcodeId
=
riddleOpenDTO
.
getGroupQrcodeId
();
Boolean
status
=
riddleOpenDTO
.
getStatus
();
if
(
null
==
qrcodeId
||
null
==
status
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失"
);
}
riddleRecordBiz
.
updateRiddleOpenStatus
(
qrcodeId
,
status
);
return
new
ResponseDto
<>();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/redis/RiddleRedis.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
redis
;
import
com.pcloud.book.riddle.constants.RiddleConstant
;
import
com.pcloud.book.riddle.dto.GroupRedisDTO
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @描述:猜谜语缓存
* @作者:zhuyajie
* @创建时间:10:55 2019/7/30
* @版本:1.0
*/
@Component
(
"riddleRedis"
)
public
class
RiddleRedis
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RiddleRedis
.
class
);
public
static
final
String
prefix
=
"BOOK_RIDDLE"
;
public
static
final
String
wait_time
=
prefix
+
"_wait_time"
;
//到时间回复信息
public
static
final
String
underway_group
=
prefix
+
"_underway_group"
;
//答题中的群
/**
* 添加等待时间
* @param wxGroupId
* @param value
*/
public
void
addWaitTime
(
String
wxGroupId
,
String
value
)
{
String
key
=
wait_time
+
wxGroupId
;
JedisClusterUtils
.
set
(
key
,
value
);
JedisClusterUtils
.
expire
(
key
,
RiddleConstant
.
expire_seconds
);
}
/**
* 获取等待时间
* @param wxGroupId
* @return
*/
public
String
getWaitTime
(
String
wxGroupId
)
{
String
key
=
wait_time
+
wxGroupId
;
return
JedisClusterUtils
.
get
(
key
);
}
/**
* 添加答题中的群
* @param wxGroupId
*/
public
void
addUnderwayGroup
(
String
wxGroupId
,
String
wxId
,
String
ip
)
{
GroupRedisDTO
dto
=
new
GroupRedisDTO
();
dto
.
setWxGroupId
(
wxGroupId
);
dto
.
setWxId
(
wxId
);
dto
.
setIp
(
ip
);
List
<
GroupRedisDTO
>
list
=
getUnderwayGroup
();
if
(
ListUtils
.
isEmpty
(
list
))
{
list
=
new
ArrayList
<>();
list
.
add
(
dto
);
}
else
{
if
(!
list
.
contains
(
dto
))
{
list
.
add
(
dto
);
}
}
JedisClusterUtils
.
setJsonList
(
underway_group
,
list
);
}
/**
* 获取答题中的群
* @return
*/
public
List
<
GroupRedisDTO
>
getUnderwayGroup
()
{
List
<
GroupRedisDTO
>
list
=
JedisClusterUtils
.
getJsonList
(
underway_group
,
GroupRedisDTO
.
class
);
if
(
ListUtils
.
isEmpty
(
list
))
{
list
=
new
ArrayList
<>();
GroupRedisDTO
dto
=
new
GroupRedisDTO
();
dto
.
setWxGroupId
(
"1"
);
dto
.
setWxId
(
"1"
);
dto
.
setIp
(
"1"
);
list
.
add
(
dto
);
JedisClusterUtils
.
setJsonList
(
underway_group
,
list
);
}
return
list
;
}
/**
* 删除答题中的群
* @param wxGroupId
*/
public
void
deleteUnderwayGroup
(
String
wxGroupId
)
{
List
<
GroupRedisDTO
>
list
=
getUnderwayGroup
();
if
(!
ListUtils
.
isEmpty
(
list
))
{
for
(
int
i
=
0
;
i
<
list
.
size
()
&&
null
!=
list
;
i
++)
{
GroupRedisDTO
dto
=
list
.
get
(
i
);
if
(
null
!=
dto
&&
dto
.
getWxGroupId
().
equals
(
wxGroupId
))
{
list
.
remove
(
dto
);
}
}
}
if
(
ListUtils
.
isEmpty
(
list
))
{
list
=
new
ArrayList
<>();
GroupRedisDTO
dto
=
new
GroupRedisDTO
();
dto
.
setWxGroupId
(
"1"
);
dto
.
setWxId
(
"1"
);
dto
.
setIp
(
"1"
);
list
.
add
(
dto
);
}
JedisClusterUtils
.
setJsonList
(
underway_group
,
list
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/riddle/service/impl/RiddleServiceImpl.java
0 → 100644
View file @
bbd5cd3e
package
com
.
pcloud
.
book
.
riddle
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.pcloud.book.riddle.RiddleService
;
import
com.pcloud.book.riddle.biz.RiddleRecordBiz
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Map
;
/**
* @描述:猜谜语
* @作者:zhuyajie
* @创建时间:16:26 2019/8/5
* @版本:1.0
*/
@RestController
(
"riddleService"
)
@RequestMapping
(
"riddleService"
)
public
class
RiddleServiceImpl
implements
RiddleService
{
@Autowired
private
RiddleRecordBiz
riddleRecordBiz
;
@RequestMapping
(
value
=
"/riddleEndQuartz"
,
method
=
RequestMethod
.
POST
)
@Override
@ParamLog
(
"定时器调用游戏结束接口"
)
public
void
riddleEndQuartz
(
@RequestBody
Map
<
String
,
Object
>
map
)
{
String
wxGroupId
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
.
get
(
"wxGroupId"
)),
new
TypeReference
<
String
>()
{});
String
wxId
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
.
get
(
"wxId"
)),
new
TypeReference
<
String
>()
{});
String
ip
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
.
get
(
"ip"
)),
new
TypeReference
<
String
>()
{});
String
wxUserId
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
.
get
(
"wxUserId"
)),
new
TypeReference
<
String
>()
{});
if
(
StringUtil
.
isEmpty
(
wxGroupId
))
{
return
;
}
riddleRecordBiz
.
autoEnd
(
wxGroupId
,
wxId
,
ip
,
wxUserId
);
}
}
pcloud-service-book/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
View file @
bbd5cd3e
...
...
@@ -18,11 +18,12 @@
<result
column=
"update_user"
property=
"updateUser"
jdbcType=
"BIGINT"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BIT"
/>
<result
column=
"riddle_open"
property=
"riddleOpen"
jdbcType=
"BIT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,classify_id,group_name,group_seq,user_number,weixin_qrcode_id,weixin_group_id,qrcode_url,use_state,qrcode_state,
create_user,create_time,update_time,is_delete
create_user,create_time,update_time,is_delete
,riddle_open
</sql>
<update
id=
"updateGroupQrcode"
parameterType=
"map"
>
...
...
@@ -498,4 +499,46 @@
#{item}
</foreach>
</select>
<select
id=
"listPageRiddle"
parameterType=
"map"
resultType=
"com.pcloud.book.riddle.dto.GroupRiddleDTO"
>
SELECT
q.group_name AS groupName,
q.id AS groupQrcodeId,
q.weixin_group_id AS wxGroupId,
c.classify AS classify,
g.group_qrcode_name AS groupQrcodeName,
b.BOOK_NAME AS bookName,
g.pro_label_id AS proLabelId,
g.dep_label_id AS depLabelId,
g.pur_label_id AS purLabelId,
q.riddle_open AS riddleOpen
FROM
book_group_qrcode q
LEFT JOIN book_group_classify c ON q.classify_id = c.id
LEFT JOIN book_group g ON c.book_group_id = g.id
LEFT JOIN book b ON g.book_id = b.BOOK_ID
LEFT JOIN book_adviser a ON g.book_id = a.BOOK_ID
WHERE
a.ADVISER_ID = #{partyId}
AND a.IS_DELETE = 0
AND g.is_delete = 0
AND c.is_delete = 0
AND q.is_delete = 0
<if
test=
"name != null"
>
AND (
q.group_name LIKE CONCAT('%', #{name}, '%')
OR c.classify LIKE CONCAT('%', #{name}, '%')
OR g.group_qrcode_name LIKE CONCAT('%', #{name}, '%')
OR b.BOOK_NAME LIKE CONCAT('%', #{name}, '%')
)
</if>
</select>
<update
id=
"updateRiddleOpenStatus"
parameterType=
"map"
>
UPDATE book_group_qrcode
SET riddle_open = #{status}
WHERE
id = #{qrcodeId}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/riddle/RiddleMapper.xml
0 → 100644
View file @
bbd5cd3e
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.riddle.dao.impl.RiddleDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.riddle.entity.Riddle"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"riddle_content"
property=
"riddleContent"
jdbcType=
"VARCHAR"
/>
<result
column=
"answer"
property=
"answer"
jdbcType=
"VARCHAR"
/>
<result
column=
"other_answer"
property=
"otherAnswer"
jdbcType=
"VARCHAR"
/>
<result
column=
"grade"
property=
"grade"
jdbcType=
"TINYINT"
/>
<result
column=
"seq"
property=
"seq"
jdbcType=
"TINYINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, riddle_content, answer, other_answer, grade, seq, create_time
</sql>
<select
id=
"getRiddleByGradeAndSeq"
resultMap=
"BaseResultMap"
parameterType=
"map"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM
riddle
WHERE
grade = #{grade}
AND seq > #{seq}
LIMIT 1
</select>
<select
id=
"getById"
parameterType=
"Long"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM riddle
WHERE id = #{id}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/riddle/RiddleRecordMapper.xml
0 → 100644
View file @
bbd5cd3e
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.riddle.dao.impl.RiddleRecordDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.riddle.entity.RiddleRecord"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"riddle_id"
property=
"riddleId"
jdbcType=
"BIGINT"
/>
<result
column=
"message_content"
property=
"messageContent"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_group_id"
property=
"wxGroupId"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_user_id"
property=
"wxUserId"
jdbcType=
"VARCHAR"
/>
<result
column=
"correct"
property=
"correct"
jdbcType=
"BIT"
/>
<result
column=
"status"
property=
"status"
jdbcType=
"TINYINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"finish_count"
property=
"finishCount"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, riddle_id, message_content, wx_group_id, wx_user_id, correct, status, create_time, finish_count
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.riddle.entity.RiddleRecord"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into riddle_record (id, riddle_id, message_content,
wx_group_id, wx_user_id, correct, status,
create_time, finish_count)
values (#{id,jdbcType=BIGINT}, #{riddleId,jdbcType=BIGINT}, #{messageContent,jdbcType=VARCHAR},
#{wxGroupId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{correct,jdbcType=BIT}, #{status},
NOW(), #{finishCount})
</insert>
<select
id=
"getLastRecordByWxGroupId"
resultMap=
"BaseResultMap"
parameterType=
"String"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM riddle_record
WHERE wx_group_id = #{wxGroupId}
ORDER BY
create_time DESC, id DESC
LIMIT 1
</select>
<select
id=
"getCorrectCountByGroup"
parameterType=
"map"
resultType=
"Integer"
>
SELECT
COUNT(DISTINCT riddle_id)
FROM
riddle_record
WHERE
wx_group_id = #{wxGroupId}
AND finish_count = #{finishCount}
AND correct = 1
</select>
<select
id=
"getParticipateCount"
parameterType=
"String"
resultType=
"com.pcloud.book.riddle.dto.GroupRiddleDTO"
>
SELECT
COUNT(DISTINCT wx_user_id) userNum,
COUNT(1) participateCount
FROM
riddle_record
WHERE
wx_group_id = #{wxGroupId}
AND correct IS NOT NULL
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/riddle/RiddleReplyMapper.xml
0 → 100644
View file @
bbd5cd3e
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.riddle.dao.impl.RiddleReplyDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.riddle.entity.RiddleReply"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"content"
property=
"content"
jdbcType=
"VARCHAR"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, content, type, create_time
</sql>
<select
id=
"getReplyByType"
parameterType=
"String"
resultType=
"String"
>
SELECT
content
FROM
riddle_reply
WHERE
type = #{type}
</select>
</mapper>
\ 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