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
ab5f9095
Commit
ab5f9095
authored
Aug 20, 2019
by
郑永强
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zhengyongqiang' of
http://begitlab.chubanyun.me/rays/pcloud-book
into zhengyongqiang
parents
f6cda6d8
094c905c
Show whitespace changes
Inline
Side-by-side
Showing
104 changed files
with
5298 additions
and
224 deletions
+5298
-224
BookConstant.java
...main/java/com/pcloud/book/book/constant/BookConstant.java
+5
-0
GroupCipherDTO.java
...c/main/java/com/pcloud/book/group/dto/GroupCipherDTO.java
+93
-0
GroupClassifyQrcodeDTO.java
...ava/com/pcloud/book/group/dto/GroupClassifyQrcodeDTO.java
+13
-0
GroupUseDTO.java
.../src/main/java/com/pcloud/book/group/dto/GroupUseDTO.java
+45
-0
LargeTempletDTO.java
.../main/java/com/pcloud/book/group/dto/LargeTempletDTO.java
+44
-0
BookGroupClassifyService.java
...m/pcloud/book/group/service/BookGroupClassifyService.java
+5
-0
BookGroupService.java
.../java/com/pcloud/book/group/service/BookGroupService.java
+36
-4
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
BookApplication.java
...e-book/src/main/java/com/pcloud/book/BookApplication.java
+13
-0
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+67
-44
AdvertisingDetailFileDao.java
...pcloud/book/advertising/dao/AdvertisingDetailFileDao.java
+28
-0
AdvertisingDetailFileDaoImpl.java
...ok/advertising/dao/impl/AdvertisingDetailFileDaoImpl.java
+29
-0
AdvertisingSpaceDTO.java
.../com/pcloud/book/advertising/dto/AdvertisingSpaceDTO.java
+15
-0
AdvertisingDetailFile.java
...pcloud/book/advertising/entity/AdvertisingDetailFile.java
+209
-0
AdvertisingSpace.java
.../com/pcloud/book/advertising/entity/AdvertisingSpace.java
+14
-0
BookSet.java
...-book/src/main/java/com/pcloud/book/book/set/BookSet.java
+2
-0
BookClockBizImpl.java
...java/com/pcloud/book/clock/biz/impl/BookClockBizImpl.java
+1
-1
TradeConsr.java
.../main/java/com/pcloud/book/consumer/trade/TradeConsr.java
+12
-0
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+66
-0
BookGroupBiz.java
...src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
+65
-0
BookGroupClassifyBiz.java
.../java/com/pcloud/book/group/biz/BookGroupClassifyBiz.java
+47
-2
GroupQrcodeBiz.java
...c/main/java/com/pcloud/book/group/biz/GroupQrcodeBiz.java
+11
-0
BookGroupBizImpl.java
...java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
+372
-12
BookGroupClassifyBizImpl.java
.../pcloud/book/group/biz/impl/BookGroupClassifyBizImpl.java
+91
-10
GroupQrcodeBizImpl.java
...va/com/pcloud/book/group/biz/impl/GroupQrcodeBizImpl.java
+135
-6
BookBusinessConstants.java
...om/pcloud/book/group/constants/BookBusinessConstants.java
+18
-0
BookGroupClassifyDao.java
.../java/com/pcloud/book/group/dao/BookGroupClassifyDao.java
+9
-0
GroupQrcodeDao.java
...c/main/java/com/pcloud/book/group/dao/GroupQrcodeDao.java
+8
-0
JoinGroupCipherDao.java
...in/java/com/pcloud/book/group/dao/JoinGroupCipherDao.java
+30
-0
TempletRelevanceDao.java
...n/java/com/pcloud/book/group/dao/TempletRelevanceDao.java
+8
-0
WeixinQrcodeDao.java
.../main/java/com/pcloud/book/group/dao/WeixinQrcodeDao.java
+5
-0
BookGroupClassifyDaoImpl.java
.../pcloud/book/group/dao/impl/BookGroupClassifyDaoImpl.java
+12
-0
GroupQrcodeDaoImpl.java
...va/com/pcloud/book/group/dao/impl/GroupQrcodeDaoImpl.java
+9
-0
JoinGroupCipherDaoImpl.java
...om/pcloud/book/group/dao/impl/JoinGroupCipherDaoImpl.java
+72
-0
TempletRelevanceDaoImpl.java
...m/pcloud/book/group/dao/impl/TempletRelevanceDaoImpl.java
+19
-0
WeixinQrcodeDaoImpl.java
...a/com/pcloud/book/group/dao/impl/WeixinQrcodeDaoImpl.java
+8
-0
AutoUpdateGroupNumDTO.java
...java/com/pcloud/book/group/dto/AutoUpdateGroupNumDTO.java
+47
-0
BookGroupDTO.java
...src/main/java/com/pcloud/book/group/dto/BookGroupDTO.java
+16
-1
ClassifyDTO.java
.../src/main/java/com/pcloud/book/group/dto/ClassifyDTO.java
+11
-0
GroupStoreMyPayDto.java
...in/java/com/pcloud/book/group/dto/GroupStoreMyPayDto.java
+98
-0
JoinGroupCipherDTO.java
...in/java/com/pcloud/book/group/dto/JoinGroupCipherDTO.java
+22
-0
OwnAltQrcodeInfoDTO.java
...n/java/com/pcloud/book/group/dto/OwnAltQrcodeInfoDTO.java
+81
-0
BookGroup.java
...src/main/java/com/pcloud/book/group/entity/BookGroup.java
+15
-0
GroupQrcode.java
...c/main/java/com/pcloud/book/group/entity/GroupQrcode.java
+15
-0
JoinGroupCipher.java
...in/java/com/pcloud/book/group/entity/JoinGroupCipher.java
+103
-0
TempletRelevance.java
...n/java/com/pcloud/book/group/entity/TempletRelevance.java
+43
-0
LargTempletEnum.java
...ain/java/com/pcloud/book/group/enums/LargTempletEnum.java
+31
-0
BookGroupClassifyFacade.java
...com/pcloud/book/group/facade/BookGroupClassifyFacade.java
+7
-0
BookGroupFacade.java
...in/java/com/pcloud/book/group/facade/BookGroupFacade.java
+37
-0
BookGroupClassifyFacadeImpl.java
...d/book/group/facade/impl/BookGroupClassifyFacadeImpl.java
+12
-0
BookGroupFacadeImpl.java
...om/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
+52
-1
BookGroupClassifyServiceImpl.java
...book/group/service/impl/BookGroupClassifyServiceImpl.java
+13
-5
BookGroupServiceImpl.java
.../pcloud/book/group/service/impl/BookGroupServiceImpl.java
+73
-5
SendWeixinRequestTools.java
...a/com/pcloud/book/group/tools/SendWeixinRequestTools.java
+41
-24
GroupQrcodeBaseInfoVO.java
.../java/com/pcloud/book/group/vo/GroupQrcodeBaseInfoVO.java
+5
-32
ListBook4ChannelVO.java
...ain/java/com/pcloud/book/group/vo/ListBook4ChannelVO.java
+118
-0
ListBookGroup4ChannelParamVO.java
...om/pcloud/book/group/vo/ListBookGroup4ChannelParamVO.java
+96
-0
BookGuideBiz.java
.../main/java/com/pcloud/book/keywords/biz/BookGuideBiz.java
+6
-0
BookKeywordBiz.java
...ain/java/com/pcloud/book/keywords/biz/BookKeywordBiz.java
+2
-1
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+150
-35
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+152
-8
BookKeywordDao.java
...ain/java/com/pcloud/book/keywords/dao/BookKeywordDao.java
+5
-0
BookKeywordDaoImpl.java
...com/pcloud/book/keywords/dao/impl/BookKeywordDaoImpl.java
+17
-0
ReplyKeywordDTO.java
...in/java/com/pcloud/book/keywords/dto/ReplyKeywordDTO.java
+6
-0
BookGuideFacadeImpl.java
...pcloud/book/keywords/facade/impl/BookGuideFacadeImpl.java
+21
-0
MQTopicConumer.java
...c/main/java/com/pcloud/book/mq/config/MQTopicConumer.java
+5
-0
UpdateWXGroupNameListener.java
...a/com/pcloud/book/mq/topic/UpdateWXGroupNameListener.java
+3
-3
WXGroupLearningReportListener.java
...m/pcloud/book/mq/topic/WXGroupLearningReportListener.java
+7
-5
WxAgreeAddUserListener.java
...java/com/pcloud/book/mq/topic/WxAgreeAddUserListener.java
+40
-0
WxGroupSendTextListener.java
...ava/com/pcloud/book/mq/topic/WxGroupSendTextListener.java
+10
-6
PushBizImpl.java
.../main/java/com/pcloud/book/push/biz/impl/PushBizImpl.java
+6
-6
RiddleRecordBiz.java
...main/java/com/pcloud/book/riddle/biz/RiddleRecordBiz.java
+70
-0
RiddleRecordBizImpl.java
.../com/pcloud/book/riddle/biz/impl/RiddleRecordBizImpl.java
+520
-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
BookProps.java
.../main/java/com/pcloud/book/util/properties/BookProps.java
+7
-6
AdvertisingDetailFileMapper.xml
...ources/mapper/advertising/AdvertisingDetailFileMapper.xml
+100
-0
Book.Mapper.xml
...rvice-book/src/main/resources/mapper/book/Book.Mapper.xml
+44
-0
BookGroupClassify.Mapper.xml
.../main/resources/mapper/group/BookGroupClassify.Mapper.xml
+41
-4
BookGroupMapper.xml
...-book/src/main/resources/mapper/group/BookGroupMapper.xml
+7
-1
GroupQrcode.Mapper.xml
...ok/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
+46
-2
JoinGroupCipher.xml
...-book/src/main/resources/mapper/group/JoinGroupCipher.xml
+106
-0
TempletRelevance.xml
...book/src/main/resources/mapper/group/TempletRelevance.xml
+33
-0
WeixinQrcode.Mapper.xml
...k/src/main/resources/mapper/group/WeixinQrcode.Mapper.xml
+9
-0
BookKeyword.Mapper.xml
...src/main/resources/mapper/keywords/BookKeyword.Mapper.xml
+27
-0
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/book/constant/BookConstant.java
View file @
ab5f9095
...
@@ -17,6 +17,11 @@ import java.util.Map;
...
@@ -17,6 +17,11 @@ import java.util.Map;
public
class
BookConstant
{
public
class
BookConstant
{
/**
/**
* 微信小号每天拉人次数缓存前缀
*/
public
static
final
String
WXGROUP_ADD_USER_NUM
=
CacheConstant
.
BOOK
+
"WXGROUP_ADD_USER_NUM:"
;
/**
* 图书基础缓存前缀名称
* 图书基础缓存前缀名称
*/
*/
public
static
final
String
BOOK_CACHE
=
CacheConstant
.
BOOK
+
"BOOK:"
;
public
static
final
String
BOOK_CACHE
=
CacheConstant
.
BOOK
+
"BOOK:"
;
...
...
pcloud-facade-book/src/main/java/com/pcloud/book/group/dto/GroupCipherDTO.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/12 14:57
**/
public
class
GroupCipherDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
4254978072223600943L
;
@ApiModelProperty
(
"密码"
)
private
String
cipher
;
@ApiModelProperty
(
"分类id"
)
private
Long
classifyId
;
@ApiModelProperty
(
"创建人"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"使用人微信id"
)
private
String
wxId
;
@ApiModelProperty
(
"是否使用"
)
private
Boolean
hasUsed
;
@ApiModelProperty
(
"机器人id"
)
private
String
altId
;
public
String
getCipher
()
{
return
cipher
;
}
public
void
setCipher
(
String
cipher
)
{
this
.
cipher
=
cipher
;
}
public
Long
getClassifyId
()
{
return
classifyId
;
}
public
void
setClassifyId
(
Long
classifyId
)
{
this
.
classifyId
=
classifyId
;
}
public
Long
getWechatUserId
()
{
return
wechatUserId
;
}
public
void
setWechatUserId
(
Long
wechatUserId
)
{
this
.
wechatUserId
=
wechatUserId
;
}
public
String
getWxId
()
{
return
wxId
;
}
public
void
setWxId
(
String
wxId
)
{
this
.
wxId
=
wxId
;
}
public
Boolean
getHasUsed
()
{
return
hasUsed
;
}
public
void
setHasUsed
(
Boolean
hasUsed
)
{
this
.
hasUsed
=
hasUsed
;
}
public
String
getAltId
()
{
return
altId
;
}
public
void
setAltId
(
String
altId
)
{
this
.
altId
=
altId
;
}
@Override
public
String
toString
()
{
return
"GroupCipherDTO{"
+
"cipher='"
+
cipher
+
'\''
+
", classifyId="
+
classifyId
+
", wechatUserId="
+
wechatUserId
+
", wxId='"
+
wxId
+
'\''
+
", hasUsed="
+
hasUsed
+
", altId='"
+
altId
+
'\''
+
'}'
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/dto/GroupClassifyQrcodeDTO.java
View file @
ab5f9095
...
@@ -54,6 +54,10 @@ public class GroupClassifyQrcodeDTO implements Serializable {
...
@@ -54,6 +54,10 @@ public class GroupClassifyQrcodeDTO implements Serializable {
* 是否开启群学习报告
* 是否开启群学习报告
*/
*/
private
Boolean
hasOpenLearningReport
;
private
Boolean
hasOpenLearningReport
;
/**
* 进群方式:1群二维码,2客服机器人
*/
private
Integer
joinGroupType
;
public
Long
getBookId
()
{
public
Long
getBookId
()
{
return
bookId
;
return
bookId
;
...
@@ -135,6 +139,14 @@ public class GroupClassifyQrcodeDTO implements Serializable {
...
@@ -135,6 +139,14 @@ public class GroupClassifyQrcodeDTO implements Serializable {
this
.
hasOpenLearningReport
=
hasOpenLearningReport
;
this
.
hasOpenLearningReport
=
hasOpenLearningReport
;
}
}
public
Integer
getJoinGroupType
()
{
return
joinGroupType
;
}
public
void
setJoinGroupType
(
Integer
joinGroupType
)
{
this
.
joinGroupType
=
joinGroupType
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"GroupClassifyQrcodeDTO{"
+
return
"GroupClassifyQrcodeDTO{"
+
...
@@ -148,6 +160,7 @@ public class GroupClassifyQrcodeDTO implements Serializable {
...
@@ -148,6 +160,7 @@ public class GroupClassifyQrcodeDTO implements Serializable {
", price="
+
price
+
", price="
+
price
+
", qrCodeUrl='"
+
qrCodeUrl
+
'\''
+
", qrCodeUrl='"
+
qrCodeUrl
+
'\''
+
", hasOpenLearningReport="
+
hasOpenLearningReport
+
", hasOpenLearningReport="
+
hasOpenLearningReport
+
", joinGroupType="
+
joinGroupType
+
'}'
;
'}'
;
}
}
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/dto/GroupUseDTO.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/7 9:26
**/
@ApiModel
(
"群使用情况模型"
)
public
class
GroupUseDTO
implements
Serializable
{
@ApiModelProperty
(
"已使用"
)
private
Integer
hasUsed
;
@ApiModelProperty
(
"未使用"
)
private
Integer
notUsed
;
public
Integer
getHasUsed
()
{
return
hasUsed
;
}
public
void
setHasUsed
(
Integer
hasUsed
)
{
this
.
hasUsed
=
hasUsed
;
}
public
Integer
getNotUsed
()
{
return
notUsed
;
}
public
void
setNotUsed
(
Integer
notUsed
)
{
this
.
notUsed
=
notUsed
;
}
@Override
public
String
toString
()
{
return
"GroupUseDTO{"
+
"hasUsed="
+
hasUsed
+
", notUsed="
+
notUsed
+
'}'
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/dto/LargeTempletDTO.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/7 11:23
**/
public
class
LargeTempletDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
5982946901202138966L
;
@ApiModelProperty
(
"大类"
)
private
Integer
largeTemplet
;
@ApiModelProperty
(
"名称"
)
private
String
name
;
public
Integer
getLargeTemplet
()
{
return
largeTemplet
;
}
public
void
setLargeTemplet
(
Integer
largeTemplet
)
{
this
.
largeTemplet
=
largeTemplet
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
@Override
public
String
toString
()
{
return
"LargeTempletDTO{"
+
"largeTemplet="
+
largeTemplet
+
", name='"
+
name
+
'\''
+
'}'
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/service/BookGroupClassifyService.java
View file @
ab5f9095
...
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping;
...
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -54,4 +55,8 @@ public interface BookGroupClassifyService {
...
@@ -54,4 +55,8 @@ public interface BookGroupClassifyService {
@ApiOperation
(
"过滤被删除的群分类、群二维码"
)
@ApiOperation
(
"过滤被删除的群分类、群二维码"
)
@PostMapping
(
"filterDeleteId"
)
@PostMapping
(
"filterDeleteId"
)
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
filterDeleteId
(
@RequestBody
List
<
String
>
wxGroupIdList
);
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
filterDeleteId
(
@RequestBody
List
<
String
>
wxGroupIdList
);
@ApiOperation
(
"获取用户支付金额"
)
@GetMapping
(
"getPayPrice"
)
ResponseEntity
<
ResponseDto
<
BigDecimal
>>
getPayPrice
(
@RequestParam
(
"qrcodeId"
)
Long
qrcodeId
,
@RequestParam
(
"wxUserId"
)
String
wxUserId
);
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/service/BookGroupService.java
View file @
ab5f9095
...
@@ -2,15 +2,18 @@ package com.pcloud.book.group.service;
...
@@ -2,15 +2,18 @@ package com.pcloud.book.group.service;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.pcloud.book.group.dto.GroupCipherDTO
;
import
com.pcloud.book.group.dto.GroupUseDTO
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.StoreFlowInfoDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -30,8 +33,37 @@ public interface BookGroupService {
...
@@ -30,8 +33,37 @@ public interface BookGroupService {
@RequestMapping
(
value
=
"getBookGroupInfoByIds"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"getBookGroupInfoByIds"
,
method
=
RequestMethod
.
POST
)
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BookGroupDTO
>>>
getBookGroupInfoByIds
(
@RequestBody
List
<
Long
>
bookGroupIds
)
throws
BizException
;
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
BookGroupDTO
>>>
getBookGroupInfoByIds
(
@RequestBody
List
<
Long
>
bookGroupIds
)
throws
BizException
;
@ApiOperation
(
"为信息流批量获取社群书基本信息"
)
@RequestMapping
(
value
=
"getFlowInfoByBookGroupIds"
,
method
=
RequestMethod
.
POST
)
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
StoreFlowInfoDto
>>>
getFlowInfoByBookGroupIds
(
@RequestBody
List
<
Long
>
bookGroupIds
)
throws
BizException
;
@ApiOperation
(
"获取指定条数社群书基本信息"
)
@RequestMapping
(
value
=
"getBookGroupInfoByChannelId"
,
method
=
RequestMethod
.
GET
)
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
StoreFlowInfoDto
>>>
getBookGroupInfoByChannelId
(
@RequestParam
(
"channelId"
)
Long
channelId
,
@RequestParam
(
"itemNum"
)
Integer
itemNum
)
throws
BizException
;
@ApiOperation
(
value
=
"知识商城获取社群书信息"
)
@RequestMapping
(
value
=
"listBookGroup4KnowledgeMall"
,
method
=
RequestMethod
.
GET
)
ResponseEntity
<
ResponseDto
<
PageBeanNew
<
StoreFlowInfoDto
>>>
listBookGroup4KnowledgeMall
(
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
"currentPage"
)
int
currentPage
,
@RequestParam
(
"numPerPage"
)
int
numPerPage
)
throws
BizException
;
@ApiOperation
(
"获取社群书基本信息"
)
@ApiOperation
(
"获取社群书基本信息"
)
@RequestMapping
(
value
=
"getBaseInfoBySceneId"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"getBaseInfoBySceneId"
,
method
=
RequestMethod
.
GET
)
ResponseEntity
<
ResponseDto
<
BookGroupDTO
>>
getBaseInfoBySceneId
(
@RequestParam
(
"sceneId"
)
Long
sceneId
)
throws
BizException
;
ResponseEntity
<
ResponseDto
<
BookGroupDTO
>>
getBaseInfoBySceneId
(
@RequestParam
(
"sceneId"
)
Long
sceneId
)
throws
BizException
;
@ApiOperation
(
"获取暗号状态"
)
@GetMapping
(
"/getCipherState"
)
ResponseEntity
<
ResponseDto
<
Integer
>>
getCipherState
(
@RequestParam
(
"cipher"
)
String
cipher
)
throws
BizException
;
@ApiOperation
(
"更新暗号状态为已使用"
)
@GetMapping
(
"/updateCipherStateToUsed"
)
void
updateCipherStateToUsed
(
@RequestParam
(
"cipher"
)
String
cipher
,
@RequestParam
(
"wxId"
)
String
wxId
)
throws
BizException
;
@ApiOperation
(
"获取个人二维码方式群已使用和未使用数量"
)
@PostMapping
(
"/getGroupUse"
)
ResponseEntity
<
ResponseDto
<
GroupUseDTO
>>
getGroupUse
(
@RequestBody
List
<
String
>
altIds
)
throws
BizException
;
@ApiOperation
(
"获取暗号基本信息"
)
@GetMapping
(
"/getJoinGroupCipher"
)
ResponseEntity
<
ResponseDto
<
GroupCipherDTO
>>
getJoinGroupCipher
(
@RequestParam
(
"cipher"
)
String
cipher
)
throws
BizException
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/riddle/RiddleService.java
0 → 100644
View file @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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/BookApplication.java
View file @
ab5f9095
...
@@ -198,4 +198,17 @@ public class BookApplication {
...
@@ -198,4 +198,17 @@ public class BookApplication {
public
Binding
wxGroupLearningReportBind
()
{
public
Binding
wxGroupLearningReportBind
()
{
return
RabbitMQFactory
.
bindingExchange
(
wxGroupLearningReportQueue
(),
MQTopicProducer
.
WXGROUP_LEARNING_REPORT
);
return
RabbitMQFactory
.
bindingExchange
(
wxGroupLearningReportQueue
(),
MQTopicProducer
.
WXGROUP_LEARNING_REPORT
);
}
}
/**
* 微信个人机器人同意加好友
*/
@Bean
public
Queue
wxGroupAgreeAddUserQueue
()
{
return
RabbitMQFactory
.
queueBuilder
(
MQTopicConumer
.
WX_AGREE_ADD_USER
);
}
@Bean
public
Binding
wxGroupAgreeAddUserBind
()
{
return
RabbitMQFactory
.
bindingExchange
(
wxGroupAgreeAddUserQueue
(),
MQTopicProducer
.
WX_AGREE_ADD_USER
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
ab5f9095
...
@@ -174,6 +174,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -174,6 +174,8 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
private
AdvertisingDistributionBookDao
distributionBookDao
;
private
AdvertisingDistributionBookDao
distributionBookDao
;
@Autowired
@Autowired
private
ConvertConsr
convertConsr
;
private
ConvertConsr
convertConsr
;
@Autowired
private
AdvertisingDetailFileDao
detailFileDao
;
private
static
final
String
ADVERTISING_PUT_PLAN_SCHEDULE_PRE
=
"ADVERTISING_PUT_PALN_"
;
private
static
final
String
ADVERTISING_PUT_PLAN_SCHEDULE_PRE
=
"ADVERTISING_PUT_PALN_"
;
...
@@ -199,6 +201,10 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -199,6 +201,10 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
if
(
SettlementMethodEnum
.
CPA
.
code
.
equals
(
settlementMethod
)
&&
if
(
SettlementMethodEnum
.
CPA
.
code
.
equals
(
settlementMethod
)
&&
!
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
!
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
bmBiz
.
addOptionList
(
advertisingSpace
.
getAdvertisingBmOptionList
(),
adId
);
bmBiz
.
addOptionList
(
advertisingSpace
.
getAdvertisingBmOptionList
(),
adId
);
//音视频保存
if
(!
AdDetailModeEnum
.
IMG_TEXT
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
()))
{
addAdvertisingDetailFile
(
adId
,
advertisingSpace
.
getAdvertisingDetailFileList
());
}
}
}
AdvertisingSettlementMethod
method
=
new
AdvertisingSettlementMethod
();
AdvertisingSettlementMethod
method
=
new
AdvertisingSettlementMethod
();
method
.
setMasterId
(
advertisingSpace
.
getMasterId
());
method
.
setMasterId
(
advertisingSpace
.
getMasterId
());
...
@@ -210,16 +216,36 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -210,16 +216,36 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
/**
/**
* 新增广告详情文件
* @param adId
* @param fileList
*/
private
void
addAdvertisingDetailFile
(
Long
adId
,
List
<
AdvertisingDetailFile
>
fileList
)
{
if
(
ListUtils
.
isEmpty
(
fileList
))
{
return
;
}
for
(
AdvertisingDetailFile
file
:
fileList
)
{
file
.
setAdId
(
adId
);
}
detailFileDao
.
insert
(
fileList
);
}
/**
* cpa广告详情参数配置
* cpa广告详情参数配置
* @param advertisingSpace
* @param advertisingSpace
* @return
* @return
*/
*/
private
AdvertisingSpace
equipCPA
(
AdvertisingSpace
advertisingSpace
)
{
private
AdvertisingSpace
equipCPA
(
AdvertisingSpace
advertisingSpace
)
{
if
(
AdDetailModeEnum
.
AUDIO
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
())
||
AdDetailModeEnum
.
VIDEO
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
()))
{
if
(
AdDetailModeEnum
.
AUDIO
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
())
||
AdDetailModeEnum
.
VIDEO
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
()))
{
String
fileId
=
advertisingSpace
.
getAdDetailFileId
();
List
<
AdvertisingDetailFile
>
fileList
=
advertisingSpace
.
getAdvertisingDetailFileList
();
String
fileUrl
=
advertisingSpace
.
getAdDetailFileUrl
();
if
(
ListUtils
.
isEmpty
(
fileList
))
{
String
title
=
advertisingSpace
.
getAdDetailFileName
();
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"请上传文件"
);
Long
seconds
=
advertisingSpace
.
getAdDetailFilePilotSecond
();
}
for
(
AdvertisingDetailFile
detailFile
:
fileList
)
{
String
fileId
=
detailFile
.
getFileId
();
String
fileUrl
=
detailFile
.
getFileUrl
();
Long
seconds
=
detailFile
.
getFilePilotSecond
();
String
title
=
detailFile
.
getTitle
();
//总时长
//总时长
Integer
duration
=
null
;
Integer
duration
=
null
;
if
(!
StringUtil
.
isEmpty
(
fileId
))
{
if
(!
StringUtil
.
isEmpty
(
fileId
))
{
...
@@ -230,9 +256,9 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -230,9 +256,9 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
fileUrl
=
fileUploadInfo
.
getUrl
();
fileUrl
=
fileUploadInfo
.
getUrl
();
duration
=
fileUploadInfo
.
getDuration
();
duration
=
fileUploadInfo
.
getDuration
();
advertisingSpace
.
setAdDetail
FileUrl
(
fileUrl
);
detailFile
.
set
FileUrl
(
fileUrl
);
if
(
null
!=
duration
)
{
if
(
null
!=
duration
)
{
advertisingSpace
.
setAdDetail
FileDuration
(
duration
.
longValue
());
detailFile
.
set
FileDuration
(
duration
.
longValue
());
}
}
}
}
/* if (StringUtil.isEmpty(fileUrl) && !StringUtil.isEmpty(fileId)) {
/* if (StringUtil.isEmpty(fileUrl) && !StringUtil.isEmpty(fileId)) {
...
@@ -242,16 +268,17 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -242,16 +268,17 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
return advertisingSpace;
return advertisingSpace;
}*/
}*/
if
(
null
!=
duration
&&
null
!=
seconds
&&
seconds
>=
duration
)
{
if
(
null
!=
duration
&&
null
!=
seconds
&&
seconds
>=
duration
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"资源
时长"
+
duration
+
"s,试听/试看时长超过该时长,请重新设置"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"资源"
+
title
+
"
时长"
+
duration
+
"s,试听/试看时长超过该时长,请重新设置"
);
}
}
if
(!
StringUtil
.
isEmpty
(
fileUrl
))
{
//剪切文件
if
(!
StringUtil
.
isEmpty
(
fileUrl
))
{
//剪切文件
advertisingSpace
.
setAdDetail
FileConvertState
(
1
);
detailFile
.
set
FileConvertState
(
1
);
if
(
null
==
seconds
)
{
//试播秒数为null,播放全部
if
(
null
==
seconds
)
{
//试播秒数为null,播放全部
advertisingSpace
.
setAdDetail
FilePilotUrl
(
fileUrl
);
detailFile
.
set
FilePilotUrl
(
fileUrl
);
advertisingSpace
.
setAdDetail
FilePilotSecond
(
0L
);
detailFile
.
set
FilePilotSecond
(
0L
);
}
else
if
(
seconds
>
0
)
{
}
else
if
(
seconds
>
0
)
{
String
cutUrl
=
getCutUrl
(
fileUrl
,
title
,
0
d
,
seconds
.
doubleValue
(),
seconds
.
doubleValue
());
String
cutUrl
=
getCutUrl
(
fileUrl
,
title
,
0
d
,
seconds
.
doubleValue
(),
seconds
.
doubleValue
());
advertisingSpace
.
setAdDetailFilePilotUrl
(
cutUrl
);
detailFile
.
setFilePilotUrl
(
cutUrl
);
}
}
}
}
}
}
}
...
@@ -318,6 +345,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -318,6 +345,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
* @param advertisingSpace
* @param advertisingSpace
*/
*/
private
void
checkCPAParam
(
AdvertisingSpace
advertisingSpace
)
{
private
void
checkCPAParam
(
AdvertisingSpace
advertisingSpace
)
{
List
<
AdvertisingDetailFile
>
fileList
=
advertisingSpace
.
getAdvertisingDetailFileList
();
if
(
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdDetailInfo
()))
{
if
(
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdDetailInfo
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"产品介绍不能为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"产品介绍不能为空!"
);
}
}
...
@@ -332,32 +360,34 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -332,32 +360,34 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
//2音频试听
//2音频试听
else
if
(
AdDetailModeEnum
.
AUDIO
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
()))
{
else
if
(
AdDetailModeEnum
.
AUDIO
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
()))
{
if
(
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdDetailFileId
()))
{
if
(
ListUtils
.
isEmpty
(
fileList
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"请上传音频资源!"
);
}
for
(
AdvertisingDetailFile
file
:
fileList
)
{
if
(
StringUtil
.
isEmpty
(
file
.
getFileId
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"请上传音频资源!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"请上传音频资源!"
);
}
}
if
(
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdDetail
Title
()))
{
if
(
StringUtil
.
isEmpty
(
file
.
get
Title
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"标题不能为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"标题不能为空!"
);
}
}
/*if (null != advertisingSpace.getAdDetailFileDuration() && null != advertisingSpace.getAdDetailFilePilotSecond()
}
&& advertisingSpace.getAdDetailFilePilotSecond() >= advertisingSpace.getAdDetailFileDuration()) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "试听时长超过音频时长,请重新设置");
}*/
}
}
//3视频试看
//3视频试看
else
if
(
AdDetailModeEnum
.
VIDEO
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
()))
{
else
if
(
AdDetailModeEnum
.
VIDEO
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
()))
{
if
(
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdDetailCoverPic
()))
{
if
(
ListUtils
.
isEmpty
(
fileList
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"请上传视频资源!"
);
}
for
(
AdvertisingDetailFile
file
:
fileList
)
{
if
(
StringUtil
.
isEmpty
(
file
.
getCoverPic
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"封面不能为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"封面不能为空!"
);
}
}
if
(
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdDetail
FileId
()))
{
if
(
StringUtil
.
isEmpty
(
file
.
get
FileId
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"请上传视频资源!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"请上传视频资源!"
);
}
}
if
(
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdDetail
Title
()))
{
if
(
StringUtil
.
isEmpty
(
file
.
get
Title
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"标题不能为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"标题不能为空!"
);
}
}
/* if (null != advertisingSpace.getAdDetailFileDuration() && null != advertisingSpace.getAdDetailFilePilotSecond()
}
&& advertisingSpace.getAdDetailFilePilotSecond() >= advertisingSpace.getAdDetailFileDuration()) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "试看时长超过视频时长,请重新设置");
}*/
}
}
//报名设置
//报名设置
if
(
null
==
advertisingSpace
.
getAdFormMobileCheck
())
{
if
(
null
==
advertisingSpace
.
getAdFormMobileCheck
())
{
...
@@ -427,6 +457,11 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -427,6 +457,11 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
//CPA、非纯图片广告详情,报名表单选项新增
//CPA、非纯图片广告详情,报名表单选项新增
if
(
isCPA
&&
!
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
if
(
isCPA
&&
!
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
bmBiz
.
addOptionList
(
advertisingSpace
.
getAdvertisingBmOptionList
(),
advertisingSpace
.
getId
());
bmBiz
.
addOptionList
(
advertisingSpace
.
getAdvertisingBmOptionList
(),
advertisingSpace
.
getId
());
//音视频保存
detailFileDao
.
deleteByAdId
(
advertisingSpace
.
getId
());
if
(!
AdDetailModeEnum
.
IMG_TEXT
.
code
.
equals
(
advertisingSpace
.
getAdDetailMode
()))
{
addAdvertisingDetailFile
(
advertisingSpace
.
getId
(),
advertisingSpace
.
getAdvertisingDetailFileList
());
}
}
else
{
//删除可能有的报名信息
}
else
{
//删除可能有的报名信息
bmBiz
.
deleteByAdId
(
advertisingSpace
.
getId
());
bmBiz
.
deleteByAdId
(
advertisingSpace
.
getId
());
}
}
...
@@ -482,9 +517,13 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -482,9 +517,13 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
spaceDTO
.
setSettlementMethod
(
methodDTO
.
getSettlementMethod
());
spaceDTO
.
setSettlementMethod
(
methodDTO
.
getSettlementMethod
());
spaceDTO
.
setSettlementMethodName
(
SettlementMethodEnum
.
getNameByCode
(
methodDTO
.
getSettlementMethod
()));
spaceDTO
.
setSettlementMethodName
(
SettlementMethodEnum
.
getNameByCode
(
methodDTO
.
getSettlementMethod
()));
spaceDTO
.
setPriceEachTime
(
methodDTO
.
getPriceEachTime
());
spaceDTO
.
setPriceEachTime
(
methodDTO
.
getPriceEachTime
());
//CPA方式填充报名表单
//CPA方式填充报名表单
,多个上传文件
if
(
SettlementMethodEnum
.
CPA
.
code
.
equals
(
methodDTO
.
getSettlementMethod
()))
{
if
(
SettlementMethodEnum
.
CPA
.
code
.
equals
(
methodDTO
.
getSettlementMethod
()))
{
spaceDTO
.
setAdvertisingBmOptionList
(
bmBiz
.
getByAdId
(
adId
));
spaceDTO
.
setAdvertisingBmOptionList
(
bmBiz
.
getByAdId
(
adId
));
List
<
AdvertisingDetailFile
>
fileList
=
detailFileDao
.
getByAdId
(
adId
);
if
(!
ListUtils
.
isEmpty
(
fileList
))
{
spaceDTO
.
setAdvertisingDetailFileList
(
fileList
);
}
}
}
}
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
...
@@ -719,7 +758,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -719,7 +758,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
}
}
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
groupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
groupId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setContent
(
adTitle
);
sendTextMessageVO
.
setContent
(
adTitle
);
sendTextMessageVO
.
setIp
(
findIp
(
groupId
));
sendTextMessageVO
.
setIp
(
findIp
(
groupId
));
...
@@ -730,7 +769,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -730,7 +769,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setTitle
(
advertisingSpace
.
getAdTitle
());
sendArticleMessageVO
.
setTitle
(
advertisingSpace
.
getAdTitle
());
sendArticleMessageVO
.
setDescription
(
advertisingSpace
.
getAdSlogan
());
sendArticleMessageVO
.
setDescription
(
advertisingSpace
.
getAdSlogan
());
sendArticleMessageVO
.
setGroupId
(
groupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
groupId
);
String
adLink
=
""
;
String
adLink
=
""
;
if
(!
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdLink
()))
{
if
(!
StringUtil
.
isEmpty
(
advertisingSpace
.
getAdLink
()))
{
if
(
advertisingSpace
.
getAdLink
().
contains
(
"?"
))
{
if
(
advertisingSpace
.
getAdLink
().
contains
(
"?"
))
{
...
@@ -752,7 +791,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -752,7 +791,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
else
if
(
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
}
else
if
(
AdPositionModeEnum
.
JUST_PIC
.
modeCode
.
equals
(
advertisingSpace
.
getAdPositionMode
()))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setGroupId
(
groupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
groupId
);
sendPicMessageVO
.
setPicUrl
(
advertisingSpace
.
getAdPic
());
sendPicMessageVO
.
setPicUrl
(
advertisingSpace
.
getAdPic
());
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
LOGGER
.
info
(
"发送微信消息-纯图片"
+
sendPicMessageVO
.
toString
());
LOGGER
.
info
(
"发送微信消息-纯图片"
+
sendPicMessageVO
.
toString
());
...
@@ -2135,22 +2174,6 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
...
@@ -2135,22 +2174,6 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
/**
/**
* 填充CPA结算方式参数
* @param adId
* @param masterId
*/
public
AdvertisingSpaceDTO
fillCPAInfo
(
Long
adId
,
Long
masterId
,
AdvertisingSpaceDTO
spaceDTO
)
{
AdvertisingSettlementMethodDTO
methodDTO
=
advertisingSettlementMethodDao
.
getByMasterIdAndAdId
(
masterId
,
adId
);
if
(
null
!=
methodDTO
)
{
//CPA方式填充报名表单
if
(
SettlementMethodEnum
.
CPA
.
code
.
equals
(
methodDTO
.
getSettlementMethod
()))
{
spaceDTO
.
setAdvertisingBmOptionList
(
bmBiz
.
getByAdId
(
adId
));
}
}
return
spaceDTO
;
}
/**
* 曝光量埋点
* 曝光量埋点
*/
*/
@Override
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingDetailFileDao.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
advertising
.
dao
;
import
com.pcloud.book.advertising.entity.AdvertisingDetailFile
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @描述:广告详情上传文件
* @作者:zhuyajie
* @创建时间:21:16 2019/8/2
* @版本:1.0
*/
public
interface
AdvertisingDetailFileDao
extends
BaseDao
<
AdvertisingDetailFile
>
{
/**
* 根据广告id查询
* @param adId
* @return
*/
public
List
<
AdvertisingDetailFile
>
getByAdId
(
Long
adId
);
/**
* 删除文件
* @param adId
*/
void
deleteByAdId
(
Long
adId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingDetailFileDaoImpl.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
advertising
.
dao
.
impl
;
import
com.pcloud.book.advertising.dao.AdvertisingDetailFileDao
;
import
com.pcloud.book.advertising.entity.AdvertisingDetailFile
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @描述:广告详情上传文件
* @作者:zhuyajie
* @创建时间:21:17 2019/8/2
* @版本:1.0
*/
@Component
(
"advertisingDetailFileDao"
)
public
class
AdvertisingDetailFileDaoImpl
extends
BaseDaoImpl
<
AdvertisingDetailFile
>
implements
AdvertisingDetailFileDao
{
@Override
public
List
<
AdvertisingDetailFile
>
getByAdId
(
Long
adId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getByAdId"
),
adId
);
}
@Override
public
void
deleteByAdId
(
Long
adId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByAdId"
),
adId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dto/AdvertisingSpaceDTO.java
View file @
ab5f9095
...
@@ -6,6 +6,7 @@ import java.util.List;
...
@@ -6,6 +6,7 @@ import java.util.List;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.advertising.entity.AdvertisingBmOption
;
import
com.pcloud.book.advertising.entity.AdvertisingBmOption
;
import
com.pcloud.book.advertising.entity.AdvertisingDetailFile
;
import
com.pcloud.common.dto.BaseDto
;
import
com.pcloud.common.dto.BaseDto
;
/**
/**
...
@@ -311,6 +312,10 @@ public class AdvertisingSpaceDTO extends BaseDto {
...
@@ -311,6 +312,10 @@ public class AdvertisingSpaceDTO extends BaseDto {
* 投放次数
* 投放次数
*/
*/
private
Integer
distributionNum
;
private
Integer
distributionNum
;
/**
* 多个上传文件
*/
private
List
<
AdvertisingDetailFile
>
advertisingDetailFileList
;
public
Long
getId
()
{
public
Long
getId
()
{
return
id
;
return
id
;
...
@@ -819,6 +824,14 @@ public class AdvertisingSpaceDTO extends BaseDto {
...
@@ -819,6 +824,14 @@ public class AdvertisingSpaceDTO extends BaseDto {
this
.
distributionNum
=
distributionNum
;
this
.
distributionNum
=
distributionNum
;
}
}
public
List
<
AdvertisingDetailFile
>
getAdvertisingDetailFileList
()
{
return
advertisingDetailFileList
;
}
public
void
setAdvertisingDetailFileList
(
List
<
AdvertisingDetailFile
>
advertisingDetailFileList
)
{
this
.
advertisingDetailFileList
=
advertisingDetailFileList
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"AdvertisingSpaceDTO{"
+
return
"AdvertisingSpaceDTO{"
+
...
@@ -885,6 +898,7 @@ public class AdvertisingSpaceDTO extends BaseDto {
...
@@ -885,6 +898,7 @@ public class AdvertisingSpaceDTO extends BaseDto {
", outNum="
+
outNum
+
", outNum="
+
outNum
+
", outRate="
+
outRate
+
", outRate="
+
outRate
+
", distributionNum="
+
distributionNum
+
", distributionNum="
+
distributionNum
+
", advertisingDetailFileList="
+
advertisingDetailFileList
+
'}'
;
'}'
;
}
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingDetailFile.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
advertising
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
/**
* 广告详情文件
*/
public
class
AdvertisingDetailFile
extends
BaseEntity
{
/**
* 广告id
*/
private
Long
adId
;
/**
* 文件ID
*/
private
String
fileId
;
/**
* 文件转码状态
*/
private
Integer
fileConvertState
;
/**
*文件大小
*/
private
Long
fileSize
;
/**
*文件名称
*/
private
String
fileName
;
/**
*文件时长
*/
private
Long
fileDuration
;
/**
*文件路径
*/
private
String
fileUrl
;
/**
*文件试播秒数
*/
private
Long
filePilotSecond
;
/**
*文件试播路径
*/
private
String
filePilotUrl
;
/**
*文件试播结束提示
*/
private
String
filePilotFinishTip
;
/**
*文件标题
*/
private
String
title
;
/**
*封面
*/
private
String
coverPic
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* 修改时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
public
Long
getAdId
()
{
return
adId
;
}
public
void
setAdId
(
Long
adId
)
{
this
.
adId
=
adId
;
}
public
String
getFileId
()
{
return
fileId
;
}
public
void
setFileId
(
String
fileId
)
{
this
.
fileId
=
fileId
==
null
?
null
:
fileId
.
trim
();
}
public
Integer
getFileConvertState
()
{
return
fileConvertState
;
}
public
void
setFileConvertState
(
Integer
fileConvertState
)
{
this
.
fileConvertState
=
fileConvertState
;
}
public
Long
getFileSize
()
{
return
fileSize
;
}
public
void
setFileSize
(
Long
fileSize
)
{
this
.
fileSize
=
fileSize
;
}
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
==
null
?
null
:
fileName
.
trim
();
}
public
Long
getFileDuration
()
{
return
fileDuration
;
}
public
void
setFileDuration
(
Long
fileDuration
)
{
this
.
fileDuration
=
fileDuration
;
}
public
String
getFileUrl
()
{
return
fileUrl
;
}
public
void
setFileUrl
(
String
fileUrl
)
{
this
.
fileUrl
=
fileUrl
==
null
?
null
:
fileUrl
.
trim
();
}
public
Long
getFilePilotSecond
()
{
return
filePilotSecond
;
}
public
void
setFilePilotSecond
(
Long
filePilotSecond
)
{
this
.
filePilotSecond
=
filePilotSecond
;
}
public
String
getFilePilotUrl
()
{
return
filePilotUrl
;
}
public
void
setFilePilotUrl
(
String
filePilotUrl
)
{
this
.
filePilotUrl
=
filePilotUrl
==
null
?
null
:
filePilotUrl
.
trim
();
}
public
String
getFilePilotFinishTip
()
{
return
filePilotFinishTip
;
}
public
void
setFilePilotFinishTip
(
String
filePilotFinishTip
)
{
this
.
filePilotFinishTip
=
filePilotFinishTip
==
null
?
null
:
filePilotFinishTip
.
trim
();
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
==
null
?
null
:
title
.
trim
();
}
public
String
getCoverPic
()
{
return
coverPic
;
}
public
void
setCoverPic
(
String
coverPic
)
{
this
.
coverPic
=
coverPic
==
null
?
null
:
coverPic
.
trim
();
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
@Override
public
Date
getUpdateTime
()
{
return
updateTime
;
}
@Override
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
@Override
public
String
toString
()
{
return
"AdvertisingDetailFile{"
+
"adId="
+
adId
+
", fileId='"
+
fileId
+
'\''
+
", fileConvertState="
+
fileConvertState
+
", fileSize="
+
fileSize
+
", fileName='"
+
fileName
+
'\''
+
", fileDuration="
+
fileDuration
+
", fileUrl='"
+
fileUrl
+
'\''
+
", filePilotSecond="
+
filePilotSecond
+
", filePilotUrl='"
+
filePilotUrl
+
'\''
+
", filePilotFinishTip='"
+
filePilotFinishTip
+
'\''
+
", title='"
+
title
+
'\''
+
", coverPic='"
+
coverPic
+
'\''
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/advertising/entity/AdvertisingSpace.java
View file @
ab5f9095
...
@@ -176,6 +176,10 @@ public class AdvertisingSpace extends BaseEntity {
...
@@ -176,6 +176,10 @@ public class AdvertisingSpace extends BaseEntity {
* 广告详情文件时长
* 广告详情文件时长
*/
*/
private
Long
adDetailFileDuration
;
private
Long
adDetailFileDuration
;
/**
* 多个上传文件
*/
private
List
<
AdvertisingDetailFile
>
advertisingDetailFileList
;
@Override
@Override
public
Long
getId
()
{
public
Long
getId
()
{
...
@@ -471,6 +475,14 @@ public class AdvertisingSpace extends BaseEntity {
...
@@ -471,6 +475,14 @@ public class AdvertisingSpace extends BaseEntity {
this
.
adDetailFileDuration
=
adDetailFileDuration
;
this
.
adDetailFileDuration
=
adDetailFileDuration
;
}
}
public
List
<
AdvertisingDetailFile
>
getAdvertisingDetailFileList
()
{
return
advertisingDetailFileList
;
}
public
void
setAdvertisingDetailFileList
(
List
<
AdvertisingDetailFile
>
advertisingDetailFileList
)
{
this
.
advertisingDetailFileList
=
advertisingDetailFileList
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"AdvertisingSpace{"
+
return
"AdvertisingSpace{"
+
...
@@ -510,6 +522,7 @@ public class AdvertisingSpace extends BaseEntity {
...
@@ -510,6 +522,7 @@ public class AdvertisingSpace extends BaseEntity {
", adDetailFileSize="
+
adDetailFileSize
+
", adDetailFileSize="
+
adDetailFileSize
+
", adDetailFileName='"
+
adDetailFileName
+
'\''
+
", adDetailFileName='"
+
adDetailFileName
+
'\''
+
", adDetailFileDuration="
+
adDetailFileDuration
+
", adDetailFileDuration="
+
adDetailFileDuration
+
", advertisingDetailFileList="
+
advertisingDetailFileList
+
'}'
;
'}'
;
}
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/book/set/BookSet.java
View file @
ab5f9095
...
@@ -1317,8 +1317,10 @@ public class BookSet {
...
@@ -1317,8 +1317,10 @@ public class BookSet {
Map
<
Long
,
Long
>
bookIdsMap
=
new
HashMap
<>();
Map
<
Long
,
Long
>
bookIdsMap
=
new
HashMap
<>();
for
(
Object
object
:
bookList
)
{
for
(
Object
object
:
bookList
)
{
BookDto
bookDto
=
(
BookDto
)
object
;
BookDto
bookDto
=
(
BookDto
)
object
;
if
(
bookDto
!=
null
&&
bookDto
.
getBookId
()
!=
null
)
{
bookIdsMap
.
put
(
bookDto
.
getBookId
(),
bookDto
.
getBookId
());
bookIdsMap
.
put
(
bookDto
.
getBookId
(),
bookDto
.
getBookId
());
}
}
}
List
<
Long
>
bookIds
=
Lists
.
newArrayList
(
bookIdsMap
.
values
());
List
<
Long
>
bookIds
=
Lists
.
newArrayList
(
bookIdsMap
.
values
());
if
(
CollectionUtils
.
isEmpty
(
bookIds
))
{
if
(
CollectionUtils
.
isEmpty
(
bookIds
))
{
return
;
return
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/clock/biz/impl/BookClockBizImpl.java
View file @
ab5f9095
...
@@ -377,7 +377,7 @@ public class BookClockBizImpl implements BookClockBiz {
...
@@ -377,7 +377,7 @@ public class BookClockBizImpl implements BookClockBiz {
//获取机器人微信号
//获取机器人微信号
String
altId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
String
altId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setContent
(
bookClockInfoDTO
.
getNoticeContent
());
sendTextMessageVO
.
setContent
(
bookClockInfoDTO
.
getNoticeContent
());
if
(!
MapUtils
.
isEmpty
(
wxQrcodeDTOMap
)
&&
wxQrcodeDTOMap
.
containsKey
(
weixinGroupId
)){
if
(!
MapUtils
.
isEmpty
(
wxQrcodeDTOMap
)
&&
wxQrcodeDTOMap
.
containsKey
(
weixinGroupId
)){
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/trade/TradeConsr.java
View file @
ab5f9095
...
@@ -126,4 +126,16 @@ public class TradeConsr {
...
@@ -126,4 +126,16 @@ public class TradeConsr {
return
amount
;
return
amount
;
}
}
@ParamLog
(
"获取用户购买或者参与过的社群码ID"
)
public
List
<
Long
>
getBuyBookGroupIdList
(
Long
channelId
,
Long
wechatUserId
)
throws
BizException
{
List
<
Long
>
results
=
new
ArrayList
<>();
try
{
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
responseEntity
=
orderFormService
.
getBuyBookGroupIdList
(
wechatUserId
,
channelId
);
results
=
ResponseHandleUtil
.
parseListResponse
(
responseEntity
,
Long
.
class
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"获取用户购买或者参与过的社群码ID详情:"
+
e
.
getMessage
(),
e
);
}
return
results
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
ab5f9095
...
@@ -2,19 +2,25 @@ package com.pcloud.book.consumer.wechatgroup;
...
@@ -2,19 +2,25 @@ package com.pcloud.book.consumer.wechatgroup;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.wechatgroup.group.dto.GroupMemberStatisDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupMemberStatisDTO
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
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.dto.RobotReplyDTO
;
import
com.pcloud.wechatgroup.group.service.GroupMemberService
;
import
com.pcloud.wechatgroup.group.service.GroupMemberService
;
import
com.pcloud.wechatgroup.message.dto.GroupChatCountDTO
;
import
com.pcloud.wechatgroup.message.dto.GroupChatCountDTO
;
import
com.pcloud.wechatgroup.message.service.MessageService
;
import
com.pcloud.wechatgroup.message.service.MessageService
;
import
com.pcloud.wechatgroup.monitor.service.MonitorService
;
import
com.pcloud.wechatgroup.monitor.service.MonitorService
;
import
com.pcloud.wechatgroup.selfrobot.service.SelfRobotService
;
import
com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO
;
import
com.pcloud.wechatgroup.selfrobot.service.SelfRobotService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -35,6 +41,44 @@ public class WechatGroupConsr {
...
@@ -35,6 +41,44 @@ public class WechatGroupConsr {
private
MessageService
messageService
;
private
MessageService
messageService
;
@Autowired
@Autowired
private
MonitorService
monitorService
;
private
MonitorService
monitorService
;
@Autowired
private
SelfRobotService
selfRobotService
;
@ParamLog
(
"根据机器人id和用户微信id获取最新暗号"
)
public
String
getCipherByRobotAndUserWxId
(
String
robotWxId
,
String
userWxId
)
{
if
(
StringUtil
.
isBlank
(
robotWxId
)
||
StringUtil
.
isBlank
(
userWxId
))
{
return
null
;
}
try
{
return
ResponseHandleUtil
.
parseResponse
(
selfRobotService
.
getCipherByRobotAndUserWxId
(
robotWxId
,
userWxId
),
String
.
class
);
}
catch
(
BizException
e
)
{
log
.
warn
(
"根据机器人id和用户微信id获取最新暗号失败:"
+
e
.
getMessage
(),
e
);
throw
new
BizException
(
e
.
getCode
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"根据机器人id和用户微信id获取最新暗号.[getCipherByRobotAndUserWxId]:"
+
e
.
getMessage
(),
e
);
throw
new
BookBizException
(
BookBizException
.
INVOKE_RES_ERROR
,
"服务内部错误,请稍后重试"
);
}
finally
{
log
.
info
(
"【根据机器人id和用户微信id获取最新暗号,<END>"
);
}
}
@ParamLog
(
"是否群机器人"
)
public
Boolean
isGroupRobot
(
String
robotWxId
)
{
if
(
StringUtil
.
isBlank
(
robotWxId
))
{
return
null
;
}
try
{
return
ResponseHandleUtil
.
parseResponse
(
selfRobotService
.
isGroupRobot
(
robotWxId
),
Boolean
.
class
);
}
catch
(
BizException
e
)
{
log
.
warn
(
"是否群机器人失败:"
+
e
.
getMessage
(),
e
);
throw
new
BizException
(
e
.
getCode
(),
e
.
getMessage
());
}
catch
(
Exception
e
)
{
log
.
error
(
"是否群机器人.[isGroupRobot]:"
+
e
.
getMessage
(),
e
);
throw
new
BookBizException
(
BookBizException
.
INVOKE_RES_ERROR
,
"服务内部错误,请稍后重试"
);
}
finally
{
log
.
info
(
"【是否群机器人,<END>"
);
}
}
/**
/**
* 是否黑名单
* 是否黑名单
...
@@ -267,4 +311,26 @@ public class WechatGroupConsr {
...
@@ -267,4 +311,26 @@ public class WechatGroupConsr {
}
}
return
map
;
return
map
;
}
}
@ParamLog
(
value
=
"获取可用机器人"
)
public
SelfRobotDTO
getAvailableRobot
(
Long
wechatUserId
,
Integer
largeTemplet
,
Long
classifyId
)
{
SelfRobotDTO
selfRobotDTO
=
null
;
try
{
selfRobotDTO
=
ResponseHandleUtil
.
parseResponse
(
selfRobotService
.
getAvailableRobot
(
wechatUserId
,
largeTemplet
,
classifyId
),
SelfRobotDTO
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取可用机器人.[getAvailableRobot]:"
+
e
.
getMessage
(),
e
);
}
return
selfRobotDTO
;
}
@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/BookGroupBiz.java
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
biz
;
package
com
.
pcloud
.
book
.
group
.
biz
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.group.dto.*
;
import
com.pcloud.book.group.dto.AppStatisticsDTO
;
import
com.pcloud.book.group.dto.AppStatisticsDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.ClassifyKeywordDTO
;
import
com.pcloud.book.group.dto.ClassifyKeywordDTO
;
import
com.pcloud.book.group.dto.GroupStoreMyPayDto
;
import
com.pcloud.book.group.dto.QrcodeNameAndProIdDTO
;
import
com.pcloud.book.group.dto.QrcodeNameAndProIdDTO
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.vo.*
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.common.dto.StoreFlowInfoDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
...
@@ -126,6 +130,13 @@ public interface BookGroupBiz {
...
@@ -126,6 +130,13 @@ public interface BookGroupBiz {
PageBean
listBookGroup4Adviser
(
Map
<
String
,
Object
>
paramMap
,
PageParam
pageParam
,
Long
adviserId
)
throws
BizException
;
PageBean
listBookGroup4Adviser
(
Map
<
String
,
Object
>
paramMap
,
PageParam
pageParam
,
Long
adviserId
)
throws
BizException
;
/**
/**
* @description 获取社群书列表(运营)
* @author 戴兴
* @date 2019/7/23 15:39
*/
PageBean
listBookGroup4Channel
(
Long
channelId
,
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
);
/**
* 获取社群书列表(编辑)
* 获取社群书列表(编辑)
* @param paramMap 参数Map
* @param paramMap 参数Map
* @return
* @return
...
@@ -245,4 +256,58 @@ public interface BookGroupBiz {
...
@@ -245,4 +256,58 @@ public interface BookGroupBiz {
* 获取是否显示书名
* 获取是否显示书名
*/
*/
Boolean
getIsShowBookName
(
Long
partyId
);
Boolean
getIsShowBookName
(
Long
partyId
);
/**
* 根据分类id获取个人二维码信息
*/
OwnAltQrcodeInfoDTO
getOwnAltQrcodeInfoDTOByClassifyId
(
Long
wechatUserId
,
Long
classifyId
);
/**
* 获取暗号状态
*/
Integer
getCipherState
(
String
cipher
);
/**
* 更新状态为已使用
*/
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
);
/**
* 获取个人二维码方式群已使用和未使用数量
*/
GroupUseDTO
getGroupUse
(
List
<
String
>
altIds
);
/**
* 获取所有的大类分类
*/
List
<
LargeTempletDTO
>
getAllLargTemplet
();
/**
* 根据微信id和机器人id获取分类集合
*/
List
<
JoinGroupCipherDTO
>
getClassifyIdsByWxIdAndAltId
(
String
wxId
,
String
altId
);
/**
* 获取暗号基本信息
*/
GroupCipherDTO
getJoinGroupCipher
(
String
cipher
);
/**
* 为信息流批量获取社群书基本信息
*/
Map
<
Long
,
StoreFlowInfoDto
>
getFlowInfoByBookGroupIds
(
List
<
Long
>
bookGroupIds
);
/**
* 获取指定条数社群书基本信息
*/
Map
<
Long
,
StoreFlowInfoDto
>
getBookGroupInfoByChannelId
(
Long
channelId
,
Integer
itemNum
);
/**
* 知识商城获取社群书信息
*/
PageBeanNew
<
StoreFlowInfoDto
>
listBookGroup4KnowledgeMall
(
Long
channelId
,
int
currentPage
,
int
numPerPage
);
/**
* 获取用户购买或者参与过的社群书信息
*/
PageBeanNew
<
GroupStoreMyPayDto
>
getUserBrowseGroup4KnowLedgeMall
(
Long
channelId
,
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/BookGroupClassifyBiz.java
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
biz
;
package
com
.
pcloud
.
book
.
group
.
biz
;
import
com.pcloud.book.group.dto.*
;
import
com.pcloud.book.group.dto.BookGroupStatisticDTO
;
import
com.pcloud.book.group.dto.ClassifyDTO
;
import
com.pcloud.book.group.dto.ClassifyLearningReportDto
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO
;
import
com.pcloud.book.group.dto.GroupQrcodeBaseDTO
;
import
com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.vo.*
;
import
com.pcloud.book.group.vo.AddClassifyVO
;
import
com.pcloud.book.group.vo.AdviserClassifyParam
;
import
com.pcloud.book.group.vo.AdviserClassifyVO
;
import
com.pcloud.book.group.vo.BookGroupClassifyVO
;
import
com.pcloud.book.group.vo.BookGroupQrcodeStatisticVO
;
import
com.pcloud.book.group.vo.ClassifyAndGroupCountVO
;
import
com.pcloud.book.group.vo.ClassifyAndUserCountVO
;
import
com.pcloud.book.group.vo.ClassifyNameVO
;
import
com.pcloud.book.group.vo.ClassifyVO
;
import
com.pcloud.book.group.vo.GroupQrcode4ClassifyVO
;
import
com.pcloud.book.group.vo.ListBookGroupQrcodeParamVO
;
import
com.pcloud.book.group.vo.ListClassify4WechatVO
;
import
com.pcloud.book.group.vo.ListClassifyVO
;
import
com.pcloud.book.group.vo.ListGroupClassifyParam
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.book.group.vo.UpdateClassifyVO
;
import
com.pcloud.book.group.vo.UpdateRankVO
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -106,6 +129,11 @@ public interface BookGroupClassifyBiz {
...
@@ -106,6 +129,11 @@ public interface BookGroupClassifyBiz {
List
<
ListClassify4WechatVO
>
listClassify4Wechat
(
Long
bookGroupId
,
Long
wechatUserId
);
List
<
ListClassify4WechatVO
>
listClassify4Wechat
(
Long
bookGroupId
,
Long
wechatUserId
);
/**
/**
* 批量获取分类信息
*/
List
<
GroupClassifyQrcodeDTO
>
listClassifyQrcodeInfo
(
List
<
Long
>
classifyIds
);
/**
* @Author:lili
* @Author:lili
* @Desr:客户端根据群分类获取二维码
* @Desr:客户端根据群分类获取二维码
* @Date:2019/4/29 17:21
* @Date:2019/4/29 17:21
...
@@ -113,6 +141,11 @@ public interface BookGroupClassifyBiz {
...
@@ -113,6 +141,11 @@ public interface BookGroupClassifyBiz {
GroupQrcode4ClassifyVO
getGroupQrcode4ClassifyWechat
(
Long
classifyId
,
Long
wechatUserId
);
GroupQrcode4ClassifyVO
getGroupQrcode4ClassifyWechat
(
Long
classifyId
,
Long
wechatUserId
);
/**
/**
* 用户获取具体进群id
*/
String
getWxGroupIdByClassifyIdAndWechatId
(
Long
classifyId
,
Long
wechatUserId
);
/**
* @Author:lili
* @Author:lili
* @Desr:获取编辑所有的分类
* @Desr:获取编辑所有的分类
* @Date:2019/4/30 15:33
* @Date:2019/4/30 15:33
...
@@ -179,4 +212,16 @@ public interface BookGroupClassifyBiz {
...
@@ -179,4 +212,16 @@ public interface BookGroupClassifyBiz {
*/
*/
PageBeanNew
<
ClassifyLearningReportDto
>
listClassifyForLearningReport
(
Integer
currentPage
,
Integer
numPerPage
,
String
keyword
,
Long
partyId
);
PageBeanNew
<
ClassifyLearningReportDto
>
listClassifyForLearningReport
(
Integer
currentPage
,
Integer
numPerPage
,
String
keyword
,
Long
partyId
);
/**
* 用户支付金额
* @param qrcodeId
* @param wxId
* @return
*/
public
BigDecimal
getPayPrice
(
Long
qrcodeId
,
String
wxId
);
/**
* 拖动排序
*/
void
dragSortClassify
(
List
<
Long
>
classifyIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/GroupQrcodeBiz.java
View file @
ab5f9095
...
@@ -10,6 +10,7 @@ import com.pcloud.book.group.vo.GroupQrcodeBookVO;
...
@@ -10,6 +10,7 @@ import com.pcloud.book.group.vo.GroupQrcodeBookVO;
import
com.pcloud.book.group.vo.ListGroupQrcodeResponseVO
;
import
com.pcloud.book.group.vo.ListGroupQrcodeResponseVO
;
import
com.pcloud.book.group.vo.ListQrcodeByClassifyParamVO
;
import
com.pcloud.book.group.vo.ListQrcodeByClassifyParamVO
;
import
com.pcloud.book.group.vo.UpdateGroupQrcodeRequestVO
;
import
com.pcloud.book.group.vo.UpdateGroupQrcodeRequestVO
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
import
java.util.List
;
...
@@ -130,4 +131,14 @@ public interface GroupQrcodeBiz {
...
@@ -130,4 +131,14 @@ public interface GroupQrcodeBiz {
* @return
* @return
*/
*/
PageBeanNew
<
GroupQrcodeBookVO
>
listQrcodeByAdviser
(
Integer
currentPage
,
Integer
numPerPage
,
String
name
,
Long
adviserId
);
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/BookGroupBizImpl.java
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
group
.
biz
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.base.dto.AppPriceCacheDTO
;
import
com.pcloud.appcenter.base.dto.AppPriceCacheDTO
;
import
com.pcloud.appcenter.cache.service.AppPriceCacheService
;
import
com.pcloud.appcenter.cache.service.AppPriceCacheService
;
...
@@ -17,8 +20,16 @@ import com.pcloud.book.consumer.resource.ProductConsr;
...
@@ -17,8 +20,16 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import
com.pcloud.book.consumer.settlement.SettlementConsr
;
import
com.pcloud.book.consumer.settlement.SettlementConsr
;
import
com.pcloud.book.consumer.trade.TradeConsr
;
import
com.pcloud.book.consumer.trade.TradeConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.dao.*
;
import
com.pcloud.book.group.dto.*
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.book.group.entity.TempletRelevance
;
import
com.pcloud.book.group.enums.LargTempletEnum
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.book.group.dao.AppClickRecordDao
;
import
com.pcloud.book.group.dao.AppClickRecordDao
;
import
com.pcloud.book.group.dao.AppTouchRecordDao
;
import
com.pcloud.book.group.dao.AppTouchRecordDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
...
@@ -27,9 +38,10 @@ import com.pcloud.book.group.dto.AppStatisticsDTO;
...
@@ -27,9 +38,10 @@ import com.pcloud.book.group.dto.AppStatisticsDTO;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupStatisticDTO
;
import
com.pcloud.book.group.dto.BookGroupStatisticDTO
;
import
com.pcloud.book.group.dto.ClassifyKeywordDTO
;
import
com.pcloud.book.group.dto.ClassifyKeywordDTO
;
import
com.pcloud.book.group.dto.GroupStoreMyPayDto
;
import
com.pcloud.book.group.dto.QrcodeNameAndProIdDTO
;
import
com.pcloud.book.group.dto.QrcodeNameAndProIdDTO
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.vo.
StatisticVO
;
import
com.pcloud.book.group.vo.
*
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.vo.ListKeywordVO
;
import
com.pcloud.book.keywords.vo.ListKeywordVO
;
...
@@ -42,16 +54,14 @@ import com.pcloud.common.core.constant.SystemCode;
...
@@ -42,16 +54,14 @@ import com.pcloud.common.core.constant.SystemCode;
import
com.pcloud.common.core.dto.SendNotifyDto
;
import
com.pcloud.common.core.dto.SendNotifyDto
;
import
com.pcloud.common.core.enums.NotifyOriginTypeEnum
;
import
com.pcloud.common.core.enums.NotifyOriginTypeEnum
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.StoreFlowInfoDto
;
import
com.pcloud.common.entity.UploadResultInfo
;
import
com.pcloud.common.entity.UploadResultInfo
;
import
com.pcloud.common.enums.AppTypeEnum
;
import
com.pcloud.common.enums.AppTypeEnum
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.*
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.QrcodeUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.zip.CompressUtils
;
import
com.pcloud.common.utils.zip.CompressUtils
;
import
com.pcloud.facade.tradecenter.dto.GroupMoneyDto
;
import
com.pcloud.facade.tradecenter.dto.GroupMoneyDto
;
...
@@ -67,10 +77,12 @@ import com.pcloud.resourcecenter.product.dto.SpecificationDto;
...
@@ -67,10 +77,12 @@ import com.pcloud.resourcecenter.product.dto.SpecificationDto;
import
com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO
;
import
com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO
;
import
com.pcloud.resourcecenter.product.entity.Product
;
import
com.pcloud.resourcecenter.product.entity.Product
;
import
com.pcloud.resourcecenter.product.service.ProductService
;
import
com.pcloud.resourcecenter.product.service.ProductService
;
import
com.pcloud.resourcecenter.store.constants.StoreCons
;
import
com.pcloud.settlementcenter.record.service.SettlementService
;
import
com.pcloud.settlementcenter.record.service.SettlementService
;
import
com.pcloud.videolesson.schedule.service.ScheduleService
;
import
com.pcloud.videolesson.schedule.service.ScheduleService
;
import
com.pcloud.wechatgroup.group.service.GroupMemberService
;
import
com.pcloud.wechatgroup.group.service.GroupMemberService
;
import
com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -79,6 +91,7 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -79,6 +91,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -154,6 +167,14 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -154,6 +167,14 @@ public class BookGroupBizImpl implements BookGroupBiz {
private
TimeTableService
timeTableService
;
private
TimeTableService
timeTableService
;
@Autowired
@Autowired
private
AppPriceCacheService
appPriceCacheService
;
private
AppPriceCacheService
appPriceCacheService
;
@Autowired
private
TempletRelevanceDao
templetRelevanceDao
;
@Autowired
private
JoinGroupCipherDao
joinGroupCipherDao
;
@Autowired
private
WechatGroupConsr
wechatGroupConsr
;
@Autowired
private
WeixinQrcodeDao
weixinQrcodeDao
;
@Override
@Override
...
@@ -367,7 +388,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -367,7 +388,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
public
void
updateBookGroup
(
BookGroup
bookGroup
)
throws
BizException
{
public
void
updateBookGroup
(
BookGroup
bookGroup
)
throws
BizException
{
if
(
null
==
bookGroup
.
getId
()
||
StringUtil
.
isEmpty
(
bookGroup
.
getGroupQrcodeName
())
||
null
==
bookGroup
.
getProLabelId
()
if
(
null
==
bookGroup
.
getId
()
||
StringUtil
.
isEmpty
(
bookGroup
.
getGroupQrcodeName
())
||
null
==
bookGroup
.
getProLabelId
()
||
null
==
bookGroup
.
getDepLabelId
()
||
null
==
bookGroup
.
getPurLabelId
()
||
StringUtil
.
isEmpty
(
bookGroup
.
getJoinTitle
())
||
null
==
bookGroup
.
getDepLabelId
()
||
null
==
bookGroup
.
getPurLabelId
()
||
StringUtil
.
isEmpty
(
bookGroup
.
getJoinTitle
())
||
StringUtil
.
isEmpty
(
bookGroup
.
getJoinSlogan
())
||
StringUtil
.
isEmpty
(
bookGroup
.
getPersonalQrcodeUrl
())
)
{
||
StringUtil
.
isEmpty
(
bookGroup
.
getJoinSlogan
())
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
}
BookGroup
group
=
bookGroupDao
.
getById
(
bookGroup
.
getId
());
BookGroup
group
=
bookGroupDao
.
getById
(
bookGroup
.
getId
());
...
@@ -512,6 +533,51 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -512,6 +533,51 @@ public class BookGroupBizImpl implements BookGroupBiz {
return
pageBean
;
return
pageBean
;
}
}
@Override
public
PageBean
listBookGroup4Channel
(
Long
channelId
,
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
{
Integer
currentPage
=
listBookGroup4ChannelParamVO
.
getCurrentPage
();
Integer
numPerPage
=
listBookGroup4ChannelParamVO
.
getNumPerPage
();
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"channelId"
,
channelId
);
paramMap
.
put
(
"keywords"
,
listBookGroup4ChannelParamVO
.
getKeywords
());
paramMap
.
put
(
"isFundBook"
,
listBookGroup4ChannelParamVO
.
getIsFundBook
());
String
startTime
=
listBookGroup4ChannelParamVO
.
getStartTime
();
String
endTime
=
listBookGroup4ChannelParamVO
.
getEndTime
();
if
(
startTime
!=
null
){
paramMap
.
put
(
"startTime"
,
startTime
+
" 00:00:00"
);
}
if
(
endTime
!=
null
){
paramMap
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
}
PageBean
listBookGroup4Channel
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"listBookGroup4Channel"
);
List
<
Long
>
bookGroupIds
=
new
ArrayList
<>();
listBookGroup4Channel
.
getRecordList
().
forEach
(
e
->
{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
bookGroupIds
.
add
(
listBook4ChannelVO
.
getBookGroupId
());
});
if
(
ListUtils
.
isEmpty
(
bookGroupIds
)){
return
new
PageBean
(
0
,
0
,
new
ArrayList
<>());
}
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
bookGroupIds
);
listBookGroup4Channel
.
getRecordList
().
forEach
(
e
->{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
if
(!
MapUtils
.
isEmpty
(
statisMap
)
&&
statisMap
.
containsKey
(
listBook4ChannelVO
.
getBookGroupId
()))
{
BookGroupStatisticDTO
dto
=
statisMap
.
get
(
listBook4ChannelVO
.
getBookGroupId
());
listBook4ChannelVO
.
setClassifyNum
(
null
!=
dto
.
getClassifyCount
()
?
dto
.
getClassifyCount
().
longValue
()
:
0L
);
listBook4ChannelVO
.
setTotalNum
(
null
!=
dto
.
getUserNumber
()
?
dto
.
getUserNumber
().
longValue
()
:
0L
);
}
else
{
listBook4ChannelVO
.
setClassifyNum
(
0L
);
listBook4ChannelVO
.
setTotalNum
(
0L
);
}
});
return
listBookGroup4Channel
;
}
/**
/**
* 获取社群书列表(编辑)
* 获取社群书列表(编辑)
*/
*/
...
@@ -789,6 +855,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -789,6 +855,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
wechatGroupDtoP
.
setType
(
"PRODUCT"
);
wechatGroupDtoP
.
setType
(
"PRODUCT"
);
wechatGroupDtoP
.
setQrcodeId
(
qrcodeId
);
wechatGroupDtoP
.
setQrcodeId
(
qrcodeId
);
Map
<
Long
,
GroupMoneyDto
>
productSaleMap
=
tradeConsr
.
getQrGroupSaleMoney
(
wechatGroupDtoP
);
Map
<
Long
,
GroupMoneyDto
>
productSaleMap
=
tradeConsr
.
getQrGroupSaleMoney
(
wechatGroupDtoP
);
Map
<
Long
,
BigDecimal
>
productIncomeMap
=
settlementConsr
.
getAdviserIncomeByCondition
(
valProductIds
,
"PRODUCT"
,
partyId
,
qrcodeId
,
bookGroupId
);
SpeWechatGroupDto
speWechatGroupDto
=
new
SpeWechatGroupDto
();
SpeWechatGroupDto
speWechatGroupDto
=
new
SpeWechatGroupDto
();
speWechatGroupDto
.
setBookGroupId
(
bookGroupId
);
speWechatGroupDto
.
setBookGroupId
(
bookGroupId
);
speWechatGroupDto
.
setPartyId
(
partyId
);
speWechatGroupDto
.
setPartyId
(
partyId
);
...
@@ -800,10 +867,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -800,10 +867,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
speWechatGroupDto
.
setProductIdMap
(
map
);
speWechatGroupDto
.
setProductIdMap
(
map
);
Map
<
Long
,
GroupMoneyDto
>
forBuyCountMap
=
tradeConsr
.
getSpeQrGroupSaleMoney
(
speWechatGroupDto
);
Map
<
Long
,
GroupMoneyDto
>
forBuyCountMap
=
tradeConsr
.
getSpeQrGroupSaleMoney
(
speWechatGroupDto
);
Map
<
Long
,
Double
>
proSaleMap
=
new
HashMap
<>();
Map
<
Long
,
Double
>
proSaleMap
=
new
HashMap
<>();
Map
<
Long
,
Double
>
proIncomeMap
=
new
HashMap
<>();
if
(
productSaleMap
.
values
()
!=
null
&&
!
productSaleMap
.
values
().
isEmpty
())
{
if
(
productSaleMap
.
values
()
!=
null
&&
!
productSaleMap
.
values
().
isEmpty
())
{
dealSale
(
videoProductIds
,
videoPProductMapIds
,
productSaleMap
,
proSaleMap
);
dealSale
(
videoProductIds
,
videoPProductMapIds
,
productSaleMap
,
proSaleMap
,
productIncomeMap
,
proIncomeMap
);
dealSale
(
audioProductIds
,
audioPProductMapIds
,
productSaleMap
,
proSaleMap
);
dealSale
(
audioProductIds
,
audioPProductMapIds
,
productSaleMap
,
proSaleMap
,
productIncomeMap
,
proIncomeMap
);
dealSale
(
liveProductIds
,
livePProductMapIds
,
productSaleMap
,
proSaleMap
);
dealSale
(
liveProductIds
,
livePProductMapIds
,
productSaleMap
,
proSaleMap
,
productIncomeMap
,
proIncomeMap
);
for
(
AppStatisticsDTO
appStatisticsDTO
:
appStatisticsDTOS
)
{
for
(
AppStatisticsDTO
appStatisticsDTO
:
appStatisticsDTOS
)
{
Long
id
=
appStatisticsDTO
.
getServeId
();
Long
id
=
appStatisticsDTO
.
getServeId
();
String
type
=
appStatisticsDTO
.
getServeType
();
String
type
=
appStatisticsDTO
.
getServeType
();
...
@@ -813,14 +881,14 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -813,14 +881,14 @@ public class BookGroupBizImpl implements BookGroupBiz {
if
(
groupMoneyDto
!=
null
&&
groupMoneyDto
.
getSaleCount
()
!=
null
)
{
if
(
groupMoneyDto
!=
null
&&
groupMoneyDto
.
getSaleCount
()
!=
null
)
{
toAddCount
=
groupMoneyDto
.
getSaleCount
().
intValue
();
toAddCount
=
groupMoneyDto
.
getSaleCount
().
intValue
();
}
}
addProductSale
(
id
,
productDtoMap
,
proSaleMap
,
toAddCount
,
appStatisticsDTO
);
addProductSale
(
id
,
productDtoMap
,
proSaleMap
,
proIncomeMap
,
toAddCount
,
appStatisticsDTO
);
}
}
}
}
}
}
}
}
}
}
private
void
addProductSale
(
Long
id
,
Map
<
Long
,
ProductDto
>
productDtoMap
,
Map
<
Long
,
Double
>
proSaleMap
,
Integer
toAddCount
,
AppStatisticsDTO
appStatisticsDTO
)
{
private
void
addProductSale
(
Long
id
,
Map
<
Long
,
ProductDto
>
productDtoMap
,
Map
<
Long
,
Double
>
proSaleMap
,
Map
<
Long
,
Double
>
proIncomeMap
,
Integer
toAddCount
,
AppStatisticsDTO
appStatisticsDTO
)
{
ProductDto
productDto
=
productDtoMap
.
get
(
id
);
ProductDto
productDto
=
productDtoMap
.
get
(
id
);
String
[]
videoTypes
=
{
"VIDEO_COURSE"
,
"VIDEO_SCHEDULE"
};
String
[]
videoTypes
=
{
"VIDEO_COURSE"
,
"VIDEO_SCHEDULE"
};
String
[]
audioTypes
=
{
"AUDIOAPP"
,
"AUDIO_RESOURCE"
,
"AUDIO_SCHEDULE"
,
"AUDIO_COURSE"
};
String
[]
audioTypes
=
{
"AUDIOAPP"
,
"AUDIO_RESOURCE"
,
"AUDIO_SCHEDULE"
,
"AUDIO_COURSE"
};
...
@@ -833,6 +901,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -833,6 +901,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
||
Arrays
.
asList
(
audioTypes
).
contains
(
typeCode
)
||
Arrays
.
asList
(
audioTypes
).
contains
(
typeCode
)
||
Arrays
.
asList
(
liveTypes
).
contains
(
typeCode
)))
{
||
Arrays
.
asList
(
liveTypes
).
contains
(
typeCode
)))
{
Double
toAdd
=
proSaleMap
.
get
(
id
);
Double
toAdd
=
proSaleMap
.
get
(
id
);
Double
incomeToAdd
=
proIncomeMap
.
get
(
id
);
if
(
toAdd
!=
null
)
{
if
(
toAdd
!=
null
)
{
Double
oldSale
=
appStatisticsDTO
.
getSaleAmount
();
Double
oldSale
=
appStatisticsDTO
.
getSaleAmount
();
if
(
oldSale
==
null
)
{
if
(
oldSale
==
null
)
{
...
@@ -840,6 +909,13 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -840,6 +909,13 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
}
appStatisticsDTO
.
setSaleAmount
(
oldSale
+
toAdd
);
appStatisticsDTO
.
setSaleAmount
(
oldSale
+
toAdd
);
}
}
if
(
incomeToAdd
!=
null
)
{
Double
oldIncome
=
appStatisticsDTO
.
getIncomeAmount
();
if
(
oldIncome
==
null
)
{
oldIncome
=
0
D
;
}
appStatisticsDTO
.
setIncomeAmount
(
oldIncome
+
incomeToAdd
);
}
if
(
toAddCount
!=
null
)
{
if
(
toAddCount
!=
null
)
{
Integer
oldBuy
=
appStatisticsDTO
.
getBuyCount
();
Integer
oldBuy
=
appStatisticsDTO
.
getBuyCount
();
if
(
oldBuy
==
null
)
{
if
(
oldBuy
==
null
)
{
...
@@ -858,13 +934,14 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -858,13 +934,14 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
}
}
}
private
void
dealSale
(
List
<
Long
>
ids
,
Map
<
Long
,
List
<
Long
>>
productMapIds
,
Map
<
Long
,
GroupMoneyDto
>
productSaleMap
,
Map
<
Long
,
Double
>
saleMap
)
{
private
void
dealSale
(
List
<
Long
>
ids
,
Map
<
Long
,
List
<
Long
>>
productMapIds
,
Map
<
Long
,
GroupMoneyDto
>
productSaleMap
,
Map
<
Long
,
Double
>
saleMap
,
Map
<
Long
,
BigDecimal
>
productIncomeMap
,
Map
<
Long
,
Double
>
incomeMap
)
{
if
(!
ListUtils
.
isEmpty
(
ids
))
{
if
(!
ListUtils
.
isEmpty
(
ids
))
{
for
(
Long
id
:
ids
)
{
for
(
Long
id
:
ids
)
{
List
<
Long
>
productIds
=
productMapIds
.
get
(
id
);
List
<
Long
>
productIds
=
productMapIds
.
get
(
id
);
if
(!
ListUtils
.
isEmpty
(
productIds
))
{
if
(!
ListUtils
.
isEmpty
(
productIds
))
{
Double
saleMoney
=
0
D
;
Double
saleMoney
=
0
D
;
Long
saleCount
=
0L
;
Long
saleCount
=
0L
;
Double
incomeMoney
=
0
D
;
for
(
Long
productId
:
productIds
)
{
for
(
Long
productId
:
productIds
)
{
GroupMoneyDto
groupMoneyDto
=
productSaleMap
.
get
(
productId
);
GroupMoneyDto
groupMoneyDto
=
productSaleMap
.
get
(
productId
);
if
(
groupMoneyDto
!=
null
)
{
if
(
groupMoneyDto
!=
null
)
{
...
@@ -875,8 +952,12 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -875,8 +952,12 @@ public class BookGroupBizImpl implements BookGroupBiz {
saleCount
=
saleCount
+
groupMoneyDto
.
getSaleCount
();
saleCount
=
saleCount
+
groupMoneyDto
.
getSaleCount
();
}
}
}
}
if
(
productIncomeMap
!=
null
&&
productIncomeMap
.
get
(
productId
)
!=
null
)
{
incomeMoney
=
incomeMoney
+
productIncomeMap
.
get
(
productId
).
doubleValue
();
}
}
}
saleMap
.
put
(
id
,
saleMoney
);
saleMap
.
put
(
id
,
saleMoney
);
incomeMap
.
put
(
id
,
incomeMoney
);
}
}
}
}
}
}
...
@@ -1058,4 +1139,283 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -1058,4 +1139,283 @@ public class BookGroupBizImpl implements BookGroupBiz {
return
bookGroupDao
.
getIsShowBookName
(
partyId
);
return
bookGroupDao
.
getIsShowBookName
(
partyId
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"根据分类id获取个人二维码信息"
)
@Override
public
OwnAltQrcodeInfoDTO
getOwnAltQrcodeInfoDTOByClassifyId
(
Long
wechatUserId
,
Long
classifyId
)
{
OwnAltQrcodeInfoDTO
ownAltQrcodeInfoDTO
=
new
OwnAltQrcodeInfoDTO
();
//根据分类id查询社群码信息
ClassifyDTO
classifyDTO
=
bookGroupClassifyDao
.
getById
(
classifyId
);
if
(
classifyDTO
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"没有该分类"
);
}
Long
bookId
=
classifyDTO
.
getBookId
();
Map
<
String
,
Object
>
paramMap
=
Maps
.
newHashMap
();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"adviserId"
,
classifyDTO
.
getCreateUser
());
paramMap
.
put
(
"channelId"
,
classifyDTO
.
getChannelId
());
BookDto
bookDto
=
bookDao
.
getById
(
paramMap
);
Long
templetId
=
bookDto
.
getTempletId
();
//根据分类id获取大类
TempletRelevance
templetRelevance
=
templetRelevanceDao
.
getByTempletId
(
templetId
);
LOGGER
.
info
(
"根据分类id获取大类templetRelevance"
+
templetRelevance
.
toString
());
Integer
largeTemplet
=
templetRelevance
.
getLargeTemplet
();
SelfRobotDTO
selfRobotDTO
=
wechatGroupConsr
.
getAvailableRobot
(
wechatUserId
,
largeTemplet
,
classifyId
);
if
(
selfRobotDTO
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"未找到机器人!"
);
}
ownAltQrcodeInfoDTO
.
setAltHeadUrl
(
selfRobotDTO
.
getHeadPic
());
ownAltQrcodeInfoDTO
.
setAltId
(
selfRobotDTO
.
getWxId
());
ownAltQrcodeInfoDTO
.
setAltNickName
(
selfRobotDTO
.
getNickName
());
ownAltQrcodeInfoDTO
.
setAltQrcodeUrl
(
selfRobotDTO
.
getQrcodeUrl
());
ownAltQrcodeInfoDTO
.
setAltHeadUrl
(
selfRobotDTO
.
getHeadPic
());
//获取之前是否有没有使用的暗号
JoinGroupCipher
joinGroupCipher
=
joinGroupCipherDao
.
getByWechatUserId
(
wechatUserId
,
classifyId
);
String
cipher
;
if
(
joinGroupCipher
!=
null
)
{
cipher
=
joinGroupCipher
.
getCipher
();
}
else
{
//新增暗号
cipher
=
UUIDUitl
.
generateShort
();
//查重,如果有重复,再次生成
JoinGroupCipher
joinGroupCipherHas
=
joinGroupCipherDao
.
getByCipher
(
cipher
);
if
(
joinGroupCipherHas
!=
null
)
{
cipher
=
UUIDUitl
.
generateShort
();
}
cipher
=
"RAYS_"
+
cipher
;
JoinGroupCipher
joinGroupCipherNew
=
new
JoinGroupCipher
();
joinGroupCipherNew
.
setCipher
(
cipher
);
joinGroupCipherNew
.
setWechatUserId
(
wechatUserId
);
joinGroupCipherNew
.
setClassifyId
(
classifyId
);
joinGroupCipherNew
.
setAltId
(
selfRobotDTO
.
getWxId
());
joinGroupCipherDao
.
insert
(
joinGroupCipherNew
);
}
ownAltQrcodeInfoDTO
.
setCipher
(
cipher
);
return
ownAltQrcodeInfoDTO
;
}
@ParamLog
(
"获取暗号状态"
)
@Override
public
Integer
getCipherState
(
String
cipher
)
{
Integer
state
;
if
(
StringUtil
.
isEmpty
(
cipher
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数不能为空!"
);
}
JoinGroupCipher
joinGroupCipher
=
joinGroupCipherDao
.
getByCipher
(
cipher
);
if
(
joinGroupCipher
==
null
)
{
//暗号错误
state
=
2
;
}
else
if
(
joinGroupCipher
.
getHasUsed
()
!=
null
&&
joinGroupCipher
.
getHasUsed
())
{
//已使用
state
=
1
;
}
else
{
//未使用
state
=
0
;
}
return
state
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"获取暗号状态为已使用"
)
@Override
public
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
)
{
if
(
StringUtil
.
isEmpty
(
cipher
)
||
StringUtil
.
isEmpty
(
wxId
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数不能为空!"
);
}
joinGroupCipherDao
.
updateCipherStateToUsed
(
cipher
,
wxId
);
}
@ParamLog
(
"获取个人二维码方式群已使用和未使用数量"
)
@Override
public
GroupUseDTO
getGroupUse
(
List
<
String
>
altIds
)
{
if
(
ListUtils
.
isEmpty
(
altIds
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数不能为空!"
);
}
GroupUseDTO
groupUseDTO
=
new
GroupUseDTO
();
Integer
notUsed
=
weixinQrcodeDao
.
countByState
(
0
,
altIds
);
Integer
hasUsed
=
weixinQrcodeDao
.
countByState
(
1
,
altIds
);
Integer
full
=
weixinQrcodeDao
.
countByState
(
2
,
altIds
);
groupUseDTO
.
setHasUsed
(
hasUsed
+
full
);
groupUseDTO
.
setNotUsed
(
notUsed
);
return
groupUseDTO
;
}
@ParamLog
(
"获取所有的大类分类"
)
@Override
public
List
<
LargeTempletDTO
>
getAllLargTemplet
()
{
List
<
LargeTempletDTO
>
list
=
new
ArrayList
<>();
for
(
LargTempletEnum
largTempletEnum
:
LargTempletEnum
.
values
())
{
LargeTempletDTO
largeTempletDTO
=
new
LargeTempletDTO
();
largeTempletDTO
.
setLargeTemplet
(
largTempletEnum
.
code
);
largeTempletDTO
.
setName
(
largTempletEnum
.
name
);
list
.
add
(
largeTempletDTO
);
}
return
list
;
}
@ParamLog
(
"根据微信id和机器人id获取分类集合"
)
@Override
public
List
<
JoinGroupCipherDTO
>
getClassifyIdsByWxIdAndAltId
(
String
wxId
,
String
altId
)
{
if
(
StringUtil
.
isEmpty
(
wxId
)
||
StringUtil
.
isEmpty
(
altId
))
{
return
new
ArrayList
<>();
}
List
<
JoinGroupCipherDTO
>
list
=
joinGroupCipherDao
.
getClassifyIdsByWxIdAndAltId
(
wxId
,
altId
);
return
CollectionUtils
.
isEmpty
(
list
)
?
Lists
.
newArrayList
()
:
list
;
}
@ParamLog
(
"获取暗号基本信息"
)
@Override
public
GroupCipherDTO
getJoinGroupCipher
(
String
cipher
)
{
if
(
StringUtil
.
isEmpty
(
cipher
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数不能为空!"
);
}
JoinGroupCipher
joinGroupCipher
=
joinGroupCipherDao
.
getByCipher
(
cipher
);
if
(
joinGroupCipher
!=
null
)
{
GroupCipherDTO
groupCipherDTO
=
new
GroupCipherDTO
();
BeanUtils
.
copyProperties
(
joinGroupCipher
,
groupCipherDTO
);
return
groupCipherDTO
;
}
return
null
;
}
@ParamLog
(
"为信息流批量获取社群书基本信息"
)
@Override
public
Map
<
Long
,
StoreFlowInfoDto
>
getFlowInfoByBookGroupIds
(
List
<
Long
>
bookGroupIds
)
{
Map
<
Long
,
StoreFlowInfoDto
>
result
=
new
HashMap
<>();
if
(
ListUtils
.
isEmpty
(
bookGroupIds
))
{
return
null
;
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookGroupIds"
,
bookGroupIds
);
List
<
Object
>
listBook4ChannelVOS
=
bookDao
.
listBy
(
paramMap
,
"getBookGroupInfo4Channel"
);
if
(
ListUtils
.
isEmpty
(
bookGroupIds
)){
return
new
HashMap
<>();
}
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
bookGroupIds
);
listBook4ChannelVOS
.
forEach
(
e
->{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
StoreFlowInfoDto
storeFlowInfoDto
=
new
StoreFlowInfoDto
();
storeFlowInfoDto
.
setOriginId
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setOriginType
(
StoreCons
.
OriginTypeEnum
.
BOOK_GROUP
.
getCode
());
storeFlowInfoDto
.
setCoverImg
(
listBook4ChannelVO
.
getCoverImg
());
storeFlowInfoDto
.
setTitle
(
listBook4ChannelVO
.
getBookName
());
if
(!
MapUtils
.
isEmpty
(
statisMap
)
&&
statisMap
.
containsKey
(
listBook4ChannelVO
.
getBookGroupId
()))
{
BookGroupStatisticDTO
dto
=
statisMap
.
get
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setResourceNum
(
null
!=
dto
.
getClassifyCount
()
?
dto
.
getClassifyCount
()
:
0
);
storeFlowInfoDto
.
setResourceItemNum
(
null
!=
dto
.
getUserNumber
()
?
dto
.
getUserNumber
()
:
0
);
}
else
{
storeFlowInfoDto
.
setResourceNum
(
0
);
storeFlowInfoDto
.
setResourceItemNum
(
0
);
}
result
.
put
(
listBook4ChannelVO
.
getBookGroupId
(),
storeFlowInfoDto
);
});
return
result
;
}
@ParamLog
(
"获取指定条数社群书基本信息"
)
@Override
public
Map
<
Long
,
StoreFlowInfoDto
>
getBookGroupInfoByChannelId
(
Long
channelId
,
Integer
itemNum
)
{
Map
<
Long
,
StoreFlowInfoDto
>
result
=
new
HashMap
<>();
PageParam
pageParam
=
new
PageParam
(
0
,
itemNum
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"channelId"
,
channelId
);
PageBean
listBookGroup4Channel
=
bookDao
.
listPage
(
pageParam
,
paramMap
,
"listBookGroup4Channel"
);
List
<
Long
>
bookGroupIds
=
new
ArrayList
<>();
listBookGroup4Channel
.
getRecordList
().
forEach
(
e
->
{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
bookGroupIds
.
add
(
listBook4ChannelVO
.
getBookGroupId
());
});
if
(
ListUtils
.
isEmpty
(
bookGroupIds
)){
return
new
HashMap
<>();
}
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
bookGroupIds
);
listBookGroup4Channel
.
getRecordList
().
forEach
(
e
->{
ListBook4ChannelVO
listBook4ChannelVO
=
(
ListBook4ChannelVO
)
e
;
StoreFlowInfoDto
storeFlowInfoDto
=
new
StoreFlowInfoDto
();
storeFlowInfoDto
.
setOriginId
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setOriginType
(
StoreCons
.
OriginTypeEnum
.
BOOK_GROUP
.
getCode
());
storeFlowInfoDto
.
setCoverImg
(
listBook4ChannelVO
.
getCoverImg
());
storeFlowInfoDto
.
setTitle
(
listBook4ChannelVO
.
getBookName
());
if
(!
MapUtils
.
isEmpty
(
statisMap
)
&&
statisMap
.
containsKey
(
listBook4ChannelVO
.
getBookGroupId
()))
{
BookGroupStatisticDTO
dto
=
statisMap
.
get
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setResourceNum
(
null
!=
dto
.
getClassifyCount
()
?
dto
.
getClassifyCount
()
:
0
);
storeFlowInfoDto
.
setResourceItemNum
(
null
!=
dto
.
getUserNumber
()
?
dto
.
getUserNumber
()
:
0
);
}
else
{
storeFlowInfoDto
.
setResourceNum
(
0
);
storeFlowInfoDto
.
setResourceItemNum
(
0
);
}
result
.
put
(
listBook4ChannelVO
.
getBookGroupId
(),
storeFlowInfoDto
);
});
return
result
;
}
@Override
@ParamLog
(
"知识商城获取社群书信息"
)
public
PageBeanNew
<
StoreFlowInfoDto
>
listBookGroup4KnowledgeMall
(
Long
channelId
,
int
currentPage
,
int
numPerPage
)
{
List
<
StoreFlowInfoDto
>
results
=
new
ArrayList
<>();
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"channelId"
,
channelId
);
PageBeanNew
<
ListBook4ChannelVO
>
resultInfos
=
bookDao
.
listPageNew
(
pageParam
,
paramMap
,
"listBookGroup4Channel"
);
List
<
Long
>
bookGroupIds
=
resultInfos
.
getRecordList
().
stream
().
map
(
ListBook4ChannelVO:
:
getBookGroupId
).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
bookGroupIds
)){
return
new
PageBeanNew
(
0
,
0
,
0
,
new
ArrayList
<>());
}
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
bookGroupIds
);
for
(
ListBook4ChannelVO
listBook4ChannelVO
:
resultInfos
.
getRecordList
())
{
StoreFlowInfoDto
storeFlowInfoDto
=
new
StoreFlowInfoDto
();
storeFlowInfoDto
.
setOriginId
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setOriginType
(
StoreCons
.
OriginTypeEnum
.
BOOK_GROUP
.
getCode
());
storeFlowInfoDto
.
setCoverImg
(
listBook4ChannelVO
.
getCoverImg
());
storeFlowInfoDto
.
setTitle
(
listBook4ChannelVO
.
getBookName
());
if
(!
MapUtils
.
isEmpty
(
statisMap
)
&&
statisMap
.
containsKey
(
listBook4ChannelVO
.
getBookGroupId
()))
{
BookGroupStatisticDTO
dto
=
statisMap
.
get
(
listBook4ChannelVO
.
getBookGroupId
());
storeFlowInfoDto
.
setResourceNum
(
null
!=
dto
.
getClassifyCount
()
?
dto
.
getClassifyCount
()
:
0
);
storeFlowInfoDto
.
setResourceItemNum
(
null
!=
dto
.
getUserNumber
()
?
dto
.
getUserNumber
()
:
0
);
}
else
{
storeFlowInfoDto
.
setResourceNum
(
0
);
storeFlowInfoDto
.
setResourceItemNum
(
0
);
}
results
.
add
(
storeFlowInfoDto
);
}
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
resultInfos
.
getTotalCount
(),
results
);
}
@ParamLog
(
"获取用户购买或者参与过的社群书信息"
)
@Override
public
PageBeanNew
<
GroupStoreMyPayDto
>
getUserBrowseGroup4KnowLedgeMall
(
Long
channelId
,
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
)
{
List
<
GroupStoreMyPayDto
>
results
=
new
ArrayList
<>();
PageParam
pageParam
=
new
PageParam
(
currentPage
,
numPerPage
);
List
<
Long
>
bookGroupIds
=
Lists
.
newArrayList
();
bookGroupIds
=
tradeConsr
.
getBuyBookGroupIdList
(
channelId
,
wechatUserId
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(
ListUtils
.
isEmpty
(
bookGroupIds
)){
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
paramMap
.
put
(
"bookGroupIds"
,
bookGroupIds
);
PageBeanNew
<
ListBook4ChannelVO
>
resultInfos
=
bookDao
.
listPageNew
(
pageParam
,
paramMap
,
"getBookGroupInfo4Channel"
);
List
<
Long
>
groupIds
=
resultInfos
.
getRecordList
().
stream
().
map
(
ListBook4ChannelVO:
:
getBookGroupId
).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
bookGroupIds
)){
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
Map
<
Long
,
BookGroupStatisticDTO
>
statisMap
=
bookGroupClassifyBiz
.
getBookGroupStatistic
(
groupIds
);
for
(
ListBook4ChannelVO
listBook4ChannelVO
:
resultInfos
.
getRecordList
())
{
GroupStoreMyPayDto
groupStoreMyPayDto
=
new
GroupStoreMyPayDto
();
groupStoreMyPayDto
.
setOriginId
(
listBook4ChannelVO
.
getBookGroupId
());
groupStoreMyPayDto
.
setOriginType
(
StoreCons
.
OriginTypeEnum
.
BOOK_GROUP
.
getCode
());
groupStoreMyPayDto
.
setCoverImg
(
listBook4ChannelVO
.
getCoverImg
());
groupStoreMyPayDto
.
setOriginName
(
listBook4ChannelVO
.
getBookName
());
if
(!
MapUtils
.
isEmpty
(
statisMap
)
&&
statisMap
.
containsKey
(
listBook4ChannelVO
.
getBookGroupId
()))
{
BookGroupStatisticDTO
dto
=
statisMap
.
get
(
listBook4ChannelVO
.
getBookGroupId
());
groupStoreMyPayDto
.
setResourceNum
(
null
!=
dto
.
getClassifyCount
()
?
dto
.
getClassifyCount
()
:
0
);
groupStoreMyPayDto
.
setResourceItemNum
(
null
!=
dto
.
getUserNumber
()
?
dto
.
getUserNumber
()
:
0
);
}
else
{
groupStoreMyPayDto
.
setResourceNum
(
0
);
groupStoreMyPayDto
.
setResourceItemNum
(
0
);
}
results
.
add
(
groupStoreMyPayDto
);
}
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
resultInfos
.
getTotalCount
(),
results
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/BookGroupClassifyBizImpl.java
View file @
ab5f9095
...
@@ -10,25 +10,59 @@ import com.pcloud.book.consumer.resource.ProductConsr;
...
@@ -10,25 +10,59 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import
com.pcloud.book.consumer.settlement.SettlementConsr
;
import
com.pcloud.book.consumer.settlement.SettlementConsr
;
import
com.pcloud.book.consumer.trade.TradeConsr
;
import
com.pcloud.book.consumer.trade.TradeConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.*
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.GroupAnnouncementBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.dao.BookClassifyBuyRecordDao
;
import
com.pcloud.book.group.dao.BookClassifyBuyRecordDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookQrcodeUserDao
;
import
com.pcloud.book.group.dao.BookQrcodeUserDao
;
import
com.pcloud.book.group.dao.JoinGroupCipherDao
;
import
com.pcloud.book.group.dao.*
;
import
com.pcloud.book.group.dao.LearningReportBrowseRecordDao
;
import
com.pcloud.book.group.dao.LearningReportTouchRecordDao
;
import
com.pcloud.book.group.dto.*
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupStatisticDTO
;
import
com.pcloud.book.group.dto.ClassifyDTO
;
import
com.pcloud.book.group.dto.ClassifyLearningCountDto
;
import
com.pcloud.book.group.dto.ClassifyLearningReportDto
;
import
com.pcloud.book.group.dto.GroupAndUserNumberDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO
;
import
com.pcloud.book.group.dto.GroupQrcodeBaseDTO
;
import
com.pcloud.book.group.dto.GroupQrcodeInfoDTO
;
import
com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO
;
import
com.pcloud.book.group.dto.QrcodeNameAndProIdDTO
;
import
com.pcloud.book.group.dto.WeixinQrcodeDTO
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.entity.BookQrcodeUser
;
import
com.pcloud.book.group.entity.BookQrcodeUser
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.enums.RankTypeEnum
;
import
com.pcloud.book.group.enums.RankTypeEnum
;
import
com.pcloud.book.group.set.GroupSet
;
import
com.pcloud.book.group.set.GroupSet
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.vo.*
;
import
com.pcloud.book.group.vo.AddClassifyVO
;
import
com.pcloud.book.group.vo.AdviserClassifyParam
;
import
com.pcloud.book.group.vo.AdviserClassifyVO
;
import
com.pcloud.book.group.vo.BookGroupClassifyVO
;
import
com.pcloud.book.group.vo.BookGroupQrcodeStatisticVO
;
import
com.pcloud.book.group.vo.ClassifyAndGroupCountVO
;
import
com.pcloud.book.group.vo.ClassifyAndUserCountVO
;
import
com.pcloud.book.group.vo.ClassifyNameVO
;
import
com.pcloud.book.group.vo.ClassifyVO
;
import
com.pcloud.book.group.vo.GroupQrcode4ClassifyVO
;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.group.vo.ListBookGroupQrcodeParamVO
;
import
com.pcloud.book.group.vo.ListClassify4WechatVO
;
import
com.pcloud.book.group.vo.ListClassifyVO
;
import
com.pcloud.book.group.vo.ListGroupClassifyParam
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.book.group.vo.SyncKeyworsVO
;
import
com.pcloud.book.group.vo.UpdateClassifyVO
;
import
com.pcloud.book.group.vo.UpdateRankVO
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.entity.BookKeyword
;
import
com.pcloud.book.keywords.entity.BookKeyword
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.core.constant.SystemCode
;
import
com.pcloud.common.core.enums.NotifyOriginTypeEnum
;
import
com.pcloud.common.core.enums.NotifyOriginTypeEnum
;
...
@@ -120,6 +154,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
...
@@ -120,6 +154,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
private
LearningReportBrowseRecordDao
learningReportBrowseRecordDao
;
private
LearningReportBrowseRecordDao
learningReportBrowseRecordDao
;
@Autowired
@Autowired
private
LearningReportTouchRecordDao
learningReportTouchRecordDao
;
private
LearningReportTouchRecordDao
learningReportTouchRecordDao
;
@Autowired
private
JoinGroupCipherDao
joinGroupCipherDao
;
@Override
@Override
...
@@ -132,7 +168,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
...
@@ -132,7 +168,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
if
(!
CollectionUtils
.
isEmpty
(
statistic
)
&&
null
!=
statistic
.
get
(
addClassifyVO
.
getBookGroupId
()))
{
if
(!
CollectionUtils
.
isEmpty
(
statistic
)
&&
null
!=
statistic
.
get
(
addClassifyVO
.
getBookGroupId
()))
{
classifyCount
=
statistic
.
get
(
addClassifyVO
.
getBookGroupId
()).
getClassifyCount
();
classifyCount
=
statistic
.
get
(
addClassifyVO
.
getBookGroupId
()).
getClassifyCount
();
}
}
if
(
classifyCount
>=
1
0
)
{
if
(
classifyCount
>=
4
0
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"分类数量超出限制"
);
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"分类数量超出限制"
);
}
}
if
(
addClassifyVO
.
getPrice
()
==
null
)
{
if
(
addClassifyVO
.
getPrice
()
==
null
)
{
...
@@ -144,17 +180,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
...
@@ -144,17 +180,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
if
(
qrcodeNameAndProId
==
null
)
{
if
(
qrcodeNameAndProId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"请先填写社群码信息!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"请先填写社群码信息!"
);
}
}
String
groupName
=
qrcodeNameAndProId
.
getGroupQrcodeName
();
bookGroupClassify
.
setProductId
(
qrcodeNameAndProId
.
getProductId
());
bookGroupClassify
.
setProductId
(
qrcodeNameAndProId
.
getProductId
());
bookGroupClassify
.
setCreateUser
(
partyId
);
bookGroupClassify
.
setCreateUser
(
partyId
);
Integer
rank
=
bookGroupClassifyDao
.
getMaxRank
(
addClassifyVO
.
getBookGroupId
());
Integer
rank
=
bookGroupClassifyDao
.
getMaxRank
(
addClassifyVO
.
getBookGroupId
());
bookGroupClassify
.
setRank
(
rank
);
bookGroupClassify
.
setRank
(
rank
);
bookGroupClassifyDao
.
insert
(
bookGroupClassify
);
bookGroupClassifyDao
.
insert
(
bookGroupClassify
);
final
Long
wechatGroupNum
=
weixinQrcodeBiz
.
countWechatGroup
();
final
Long
wechatGroupNum
=
weixinQrcodeBiz
.
countWechatGroup
();
// 只有生产环境才有30个限制
if
(
"pro"
.
equalsIgnoreCase
(
BookProps
.
getSystemEnv
()))
{
if
(
null
==
wechatGroupNum
||
wechatGroupNum
<=
30
)
{
if
(
null
==
wechatGroupNum
||
wechatGroupNum
<=
30
)
{
log
.
info
(
"[新增分类] : 可用微信群数量:{}个"
,
wechatGroupNum
);
log
.
info
(
"[新增分类] : 可用微信群数量:{}个"
,
wechatGroupNum
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"群二维码数量不足,您可以明天再创建群。"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"群二维码数量不足,您可以明天再创建群。"
);
}
}
}
WeixinQrcodeDTO
oneQrcode
=
weixinQrcodeBiz
.
getOneQrcode
();
WeixinQrcodeDTO
oneQrcode
=
weixinQrcodeBiz
.
getOneQrcode
();
if
(
oneQrcode
==
null
)
{
if
(
oneQrcode
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"系统二维码数量不足,请联系客服人员补充二维码数量!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"系统二维码数量不足,请联系客服人员补充二维码数量!"
);
...
@@ -166,7 +204,16 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
...
@@ -166,7 +204,16 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
groupQrcode
.
setWeixinQrcodeId
(
oneQrcode
.
getId
());
groupQrcode
.
setWeixinQrcodeId
(
oneQrcode
.
getId
());
groupQrcode
.
setUserNumber
(
oneQrcode
.
getUserNumber
());
groupQrcode
.
setUserNumber
(
oneQrcode
.
getUserNumber
());
groupQrcode
.
setGroupSeq
(
1
);
groupQrcode
.
setGroupSeq
(
1
);
groupQrcode
.
setGroupName
(
groupName
+
addClassifyVO
.
getClassify
()
+
"1群"
);
// 群长度超过16部分会被截取,导致群名称重复
final
String
s
=
"1群"
;
String
groupName
=
qrcodeNameAndProId
.
getGroupQrcodeName
()
+
addClassifyVO
.
getClassify
()
+
s
;
if
(
groupName
.
length
()
>
15
)
{
groupName
=
addClassifyVO
.
getClassify
()
+
s
;
if
(
groupName
.
length
()
>
15
)
{
groupName
=
addClassifyVO
.
getClassify
().
substring
(
0
,
16
-
s
.
length
())
+
s
;
}
}
groupQrcode
.
setGroupName
(
groupName
);
groupQrcode
.
setClassifyId
(
bookGroupClassify
.
getId
());
groupQrcode
.
setClassifyId
(
bookGroupClassify
.
getId
());
groupQrcode
.
setQrcodeHeadUrl
(
readerConsr
.
getNineHeadUrl
());
groupQrcode
.
setQrcodeHeadUrl
(
readerConsr
.
getNineHeadUrl
());
groupQrcodeBiz
.
insert
(
groupQrcode
);
groupQrcodeBiz
.
insert
(
groupQrcode
);
...
@@ -430,6 +477,12 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
...
@@ -430,6 +477,12 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
}
@Override
@Override
@ParamLog
(
"获取分类二维码相关标识"
)
public
List
<
GroupClassifyQrcodeDTO
>
listClassifyQrcodeInfo
(
List
<
Long
>
classifyIds
)
{
return
bookGroupClassifyDao
.
listClassifyQrcodeInfo
(
classifyIds
);
}
@Override
@ParamLog
(
"客户端获取分类信息"
)
@ParamLog
(
"客户端获取分类信息"
)
public
List
<
ListClassify4WechatVO
>
listClassify4Wechat
(
Long
bookGroupId
,
Long
wechatUserId
)
{
public
List
<
ListClassify4WechatVO
>
listClassify4Wechat
(
Long
bookGroupId
,
Long
wechatUserId
)
{
//获取排序方式
//获取排序方式
...
@@ -511,6 +564,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
...
@@ -511,6 +564,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return
groupQrcode4ClassifyVO
;
return
groupQrcode4ClassifyVO
;
}
}
@Override
public
String
getWxGroupIdByClassifyIdAndWechatId
(
Long
classifyId
,
Long
wechatUserId
)
{
if
(
null
==
classifyId
||
null
==
wechatUserId
)
{
return
null
;
}
final
GroupQrcode4ClassifyVO
wechat
=
this
.
getGroupQrcode4ClassifyWechat
(
classifyId
,
wechatUserId
);
if
(
null
==
wechat
)
{
return
null
;
}
final
GroupQrcodeBaseInfoVO
baseById
=
this
.
groupQrcodeBiz
.
getBaseById
(
wechat
.
getGroupQrcodeId
());
return
(
null
==
baseById
)
?
null
:
baseById
.
getWeixinGroupId
();
}
@ParamLog
(
"获取备用二维码"
)
@ParamLog
(
"获取备用二维码"
)
private
String
getSpareQr
(
Long
bookGroupId
)
{
private
String
getSpareQr
(
Long
bookGroupId
)
{
//获取备用二维码
//获取备用二维码
...
@@ -964,4 +1030,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
...
@@ -964,4 +1030,19 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
}
@Override
public
BigDecimal
getPayPrice
(
Long
qrcodeId
,
String
wxId
)
{
return
joinGroupCipherDao
.
getPayPrice
(
wxId
,
qrcodeId
);
}
@ParamLog
(
"拖动排序"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
dragSortClassify
(
List
<
Long
>
classifyIds
)
{
if
(
ListUtils
.
isEmpty
(
classifyIds
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数为空!"
);
}
bookGroupClassifyDao
.
dragSortClassify
(
classifyIds
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/GroupQrcodeBizImpl.java
View file @
ab5f9095
...
@@ -13,7 +13,9 @@ import com.pcloud.book.group.biz.BookGroupClassifyBiz;
...
@@ -13,7 +13,9 @@ import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import
com.pcloud.book.group.biz.GroupAnnouncementBiz
;
import
com.pcloud.book.group.biz.GroupAnnouncementBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.constants.BookBusinessConstants
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dto.AutoUpdateGroupNumDTO
;
import
com.pcloud.book.group.dto.BookWxQrcodeDTO
;
import
com.pcloud.book.group.dto.BookWxQrcodeDTO
;
import
com.pcloud.book.group.dto.ChangeGroupNameDTO
;
import
com.pcloud.book.group.dto.ChangeGroupNameDTO
;
import
com.pcloud.book.group.dto.GroupAndUserNumberDTO
;
import
com.pcloud.book.group.dto.GroupAndUserNumberDTO
;
...
@@ -47,7 +49,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
...
@@ -47,7 +49,7 @@ import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.pcloud.book.riddle.dto.GroupRiddleDTO
;
import
org.apache.commons.collections4.MapUtils
;
import
org.apache.commons.collections4.MapUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -65,6 +67,9 @@ import java.util.HashMap;
...
@@ -65,6 +67,9 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -103,6 +108,72 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
...
@@ -103,6 +108,72 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
private
LabelConsr
labelConsr
;
private
LabelConsr
labelConsr
;
/**
* 自动更新群人数线程是否开始执行
*/
private
static
final
AtomicBoolean
IS_START
=
new
AtomicBoolean
(
false
);
/**
* 处理群人数线程池
*/
private
static
final
ExecutorService
SINGLE_THREAD_EXECUTOR
=
Executors
.
newSingleThreadExecutor
();
/**
* 更新群人数线程
*/
private
void
updateGroupNum
()
{
// 若已开始则无需再启动
if
(
IS_START
.
get
())
{
return
;
}
// 若设置时已经为true则代表已经有线程执行成功
final
boolean
andSet
=
IS_START
.
getAndSet
(
true
);
if
(
andSet
)
{
return
;
}
SINGLE_THREAD_EXECUTOR
.
execute
(()
->
{
while
(
true
)
{
try
{
if
(
BookBusinessConstants
.
GROUP_NUM_DTO_MAP
.
size
()
<
1
)
{
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"[updateGroupNum] InterruptedException:{}"
,
e
);
}
continue
;
}
log
.
info
(
"[更新群人数] start GROUP_NUM_DTO_MAP:{}"
,
BookBusinessConstants
.
GROUP_NUM_DTO_MAP
);
for
(
Map
.
Entry
<
String
,
AutoUpdateGroupNumDTO
>
entry
:
BookBusinessConstants
.
GROUP_NUM_DTO_MAP
.
entrySet
())
{
final
AutoUpdateGroupNumDTO
value
=
entry
.
getValue
();
// 没到时间不执行(小于30s并且小于3个人不执行)
final
boolean
b
=
null
==
value
||
((
System
.
currentTimeMillis
()
+
10
)
<
value
.
getStartTime
().
getTime
()
&&
value
.
getNum
().
get
()
<
3
);
if
(
b
)
{
log
.
info
(
"[更新群人数] null == value:{}"
,
entry
);
continue
;
}
Integer
peopleCounts
=
WxGroupSDK
.
getPeopleCounts
(
value
.
getWxGroupId
(),
value
.
getRobotId
(),
value
.
getIp
());
if
(
null
==
peopleCounts
||
peopleCounts
<
1
)
{
log
.
info
(
"[更新群人数] null == peopleCounts || peopleCounts < 1 entry:{}; peopleCounts:{}"
,
entry
,
peopleCounts
);
continue
;
}
log
.
info
(
"[更新群人数] entry:{}, peopleCounts:{}"
,
entry
,
peopleCounts
);
groupQrcodeDao
.
updateUserNumber
(
value
.
getWxGroupId
(),
peopleCounts
);
BookBusinessConstants
.
GROUP_NUM_DTO_MAP
.
remove
(
entry
.
getKey
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"[updateGroupNum] : Exception:{}"
,
e
);
}
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"[updateGroupNum] InterruptedException:{}"
,
e
);
}
}
});
}
@Override
@Override
@ParamLog
(
"updateGroupQrcode"
)
@ParamLog
(
"updateGroupQrcode"
)
public
void
updateGroupQrcode
(
UpdateGroupQrcodeRequestVO
vo
)
{
public
void
updateGroupQrcode
(
UpdateGroupQrcodeRequestVO
vo
)
{
...
@@ -240,11 +311,23 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
...
@@ -240,11 +311,23 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
}
}
//获取群基本信息
//获取群基本信息
GroupQrcodeDTO
groupQrcodeDTO
=
groupQrcodeDao
.
getGroupQrcodeInfo
(
weixinGroupId
);
GroupQrcodeDTO
groupQrcodeDTO
=
groupQrcodeDao
.
getGroupQrcodeInfo
(
weixinGroupId
);
log
.
info
(
"[新增一个用户] groupQrcodeDTO:{}"
,
groupQrcodeDTO
);
if
(
groupQrcodeDTO
==
null
)
{
if
(
groupQrcodeDTO
==
null
)
{
return
;
return
;
}
}
//更新用户数
//更新用户数(由于微信有延迟及时更新可能会数据对不上,所以调用方法延迟30s,统一处理)
groupQrcodeDao
.
updateUserNumber
(
weixinGroupId
,
memberCount
);
AutoUpdateGroupNumDTO
numDTO
=
BookBusinessConstants
.
GROUP_NUM_DTO_MAP
.
get
(
weixinGroupId
);
if
(
null
==
numDTO
){
numDTO
=
new
AutoUpdateGroupNumDTO
(
weixinGroupId
,
robotId
,
ip
,
new
Date
());
}
else
{
numDTO
.
getNum
().
incrementAndGet
();
numDTO
.
setStartTime
(
new
Date
());
}
BookBusinessConstants
.
GROUP_NUM_DTO_MAP
.
put
(
weixinGroupId
,
numDTO
);
// 启动更新群人数线程
if
(!
IS_START
.
get
())
{
this
.
updateGroupNum
();
}
//如果人数超过限制,重新分配群
//如果人数超过限制,重新分配群
if
(
memberCount
>=
groupQrcodeDTO
.
getChangeNumber
()
&&
QrcodeStatusEnum
.
ON_USE
.
value
.
equals
(
groupQrcodeDTO
.
getQrcodeState
()))
{
if
(
memberCount
>=
groupQrcodeDTO
.
getChangeNumber
()
&&
QrcodeStatusEnum
.
ON_USE
.
value
.
equals
(
groupQrcodeDTO
.
getQrcodeState
()))
{
//修改状态,重新分配一个群
//修改状态,重新分配一个群
...
@@ -397,24 +480,28 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
...
@@ -397,24 +480,28 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
/**
/**
* 重新分配一个群
* 重新分配一个群
*/
*/
@ParamLog
(
"重新分配一个群"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addWechatGroup
(
Long
classifyId
,
Long
groupQrcodeId
)
{
public
void
addWechatGroup
(
Long
classifyId
,
Long
groupQrcodeId
)
{
WeixinQrcodeDTO
oneQrcode
=
weixinQrcodeBiz
.
getOneQrcode
();
WeixinQrcodeDTO
oneQrcode
=
weixinQrcodeBiz
.
getOneQrcode
();
log
.
info
(
"[重新分配一个群] : oneQrcode:{}"
,
oneQrcode
);
if
(
oneQrcode
!=
null
)
{
if
(
oneQrcode
!=
null
)
{
//将二维码改为已满群状态
//将二维码改为已满群状态
Integer
number
=
groupQrcodeDao
.
changeQrcodeState
(
groupQrcodeId
,
QrcodeStatusEnum
.
OVER_NUMBER
.
value
);
Integer
number
=
groupQrcodeDao
.
changeQrcodeState
(
groupQrcodeId
,
QrcodeStatusEnum
.
OVER_NUMBER
.
value
);
log
.
info
(
"[重新分配一个群] : groupQrcodeDao.changeQrcodeState number:{}"
,
number
);
if
(
number
>
0
){
if
(
number
>
0
){
//获取标签对应基本信息
//获取标签对应基本信息
GroupNameAndMaxSeqDTO
groupNameAndMaxSeqDTO
=
bookGroupClassifyBiz
.
getGroupNameAndMaxSeq
(
classifyId
);
GroupNameAndMaxSeqDTO
groupNameAndMaxSeqDTO
=
bookGroupClassifyBiz
.
getGroupNameAndMaxSeq
(
classifyId
);
log
.
info
(
"[重新分配一个群] : groupNameAndMaxSeqDTO:{}"
,
groupNameAndMaxSeqDTO
);
if
(
groupNameAndMaxSeqDTO
!=
null
)
{
if
(
groupNameAndMaxSeqDTO
!=
null
)
{
Integer
maxSeq
=
groupNameAndMaxSeqDTO
.
getMaxSeq
()
+
1
;
Integer
maxSeq
=
groupNameAndMaxSeqDTO
.
getMaxSeq
()
+
1
;
String
groupName
=
groupNameAndMaxSeqDTO
.
getGroupQrcodeName
()
+
groupNameAndMaxSeqDTO
.
getClassify
()
+
maxSeq
+
"群"
;
String
groupName
=
groupNameAndMaxSeqDTO
.
getGroupQrcodeName
()
+
groupNameAndMaxSeqDTO
.
getClassify
()
+
maxSeq
+
"群"
;
// 群长度超过16部分会被截取,导致群名称重复
// 群长度超过16部分会被截取,导致群名称重复
if
(
groupName
.
length
()
>
1
6
)
{
if
(
groupName
.
length
()
>
1
5
)
{
final
String
s
=
maxSeq
+
"群"
;
final
String
s
=
maxSeq
+
"群"
;
groupName
=
groupNameAndMaxSeqDTO
.
getClassify
()
+
s
;
groupName
=
groupNameAndMaxSeqDTO
.
getClassify
()
+
s
;
if
(
groupName
.
length
()
>
1
6
)
{
if
(
groupName
.
length
()
>
1
5
)
{
groupName
=
groupNameAndMaxSeqDTO
.
getClassify
().
substring
(
0
,
1
6
-
s
.
length
())
+
s
;
groupName
=
groupNameAndMaxSeqDTO
.
getClassify
().
substring
(
0
,
1
5
-
s
.
length
())
+
s
;
}
}
}
}
GroupQrcode
groupQrcode
=
new
GroupQrcode
();
GroupQrcode
groupQrcode
=
new
GroupQrcode
();
...
@@ -491,5 +578,47 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
...
@@ -491,5 +578,47 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
return
pageBeanNew
;
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/constants/BookBusinessConstants.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
constants
;
import
com.pcloud.book.group.dto.AutoUpdateGroupNumDTO
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* book业务常量类
*/
public
class
BookBusinessConstants
{
/**
* 需更新微信群信息
*/
public
static
final
Map
<
String
,
AutoUpdateGroupNumDTO
>
GROUP_NUM_DTO_MAP
=
new
ConcurrentHashMap
<>(
128
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/BookGroupClassifyDao.java
View file @
ab5f9095
...
@@ -132,6 +132,11 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
...
@@ -132,6 +132,11 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
GroupClassifyQrcodeDTO
getClassifyQrcodeInfo
(
String
weixinGroupId
);
GroupClassifyQrcodeDTO
getClassifyQrcodeInfo
(
String
weixinGroupId
);
/**
/**
* 批量获取分类信息
*/
List
<
GroupClassifyQrcodeDTO
>
listClassifyQrcodeInfo
(
List
<
Long
>
classifyIds
);
/**
* @Author:lili
* @Author:lili
* @Desr:获取所有的分类
* @Desr:获取所有的分类
* @Date:2019/4/29 11:23
* @Date:2019/4/29 11:23
...
@@ -236,4 +241,8 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
...
@@ -236,4 +241,8 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
*/
*/
void
updateHasOpenLearningReport
(
Long
classifyId
,
Boolean
hasOpenLearningReport
,
Long
partyId
);
void
updateHasOpenLearningReport
(
Long
classifyId
,
Boolean
hasOpenLearningReport
,
Long
partyId
);
/**
* 拖动排序
*/
void
dragSortClassify
(
List
<
Long
>
classifyIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/GroupQrcodeDao.java
View file @
ab5f9095
...
@@ -196,4 +196,12 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
...
@@ -196,4 +196,12 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
* 根据分类id集合查询
* 根据分类id集合查询
*/
*/
List
<
GroupQrcodeFoAdDTO
>
GroupQrcodeFoAdDTOSByClassifyIds
(
List
<
Long
>
classifyIds
);
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/JoinGroupCipherDao.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.dto.JoinGroupCipherDTO
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
interface
JoinGroupCipherDao
extends
BaseDao
<
JoinGroupCipher
>
{
JoinGroupCipher
getByWechatUserId
(
Long
wechatUserId
,
Long
classifyId
);
JoinGroupCipher
getByCipher
(
String
cipher
);
JoinGroupCipherDTO
getDTOByCipher
(
String
cipher
);
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
);
List
<
JoinGroupCipherDTO
>
getClassifyIdsByWxIdAndAltId
(
String
wxId
,
String
altId
);
void
updateQrcodeId
(
String
cipher
,
String
wxId
,
Long
qrcodeId
);
/**
* 用户支付金额
* @param wxId
* @param qrcodeId
* @return
*/
BigDecimal
getPayPrice
(
String
wxId
,
Long
qrcodeId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/TempletRelevanceDao.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.entity.TempletRelevance
;
import
com.pcloud.common.core.dao.BaseDao
;
public
interface
TempletRelevanceDao
extends
BaseDao
<
TempletRelevance
>
{
TempletRelevance
getByTempletId
(
Long
templetId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/WeixinQrcodeDao.java
View file @
ab5f9095
...
@@ -155,4 +155,9 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
...
@@ -155,4 +155,9 @@ public interface WeixinQrcodeDao extends BaseDao<WeixinQrcode> {
Map
<
String
,
BookWxQrcodeDTO
>
listByWxGroupIds
(
List
<
String
>
wxGroupIds
);
Map
<
String
,
BookWxQrcodeDTO
>
listByWxGroupIds
(
List
<
String
>
wxGroupIds
);
String
getVirtualIp
(
Integer
generation
);
String
getVirtualIp
(
Integer
generation
);
/**
* 根据状态获取群数量
*/
Integer
countByState
(
Integer
state
,
List
<
String
>
altIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/BookGroupClassifyDaoImpl.java
View file @
ab5f9095
...
@@ -110,6 +110,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
...
@@ -110,6 +110,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
}
}
@Override
@Override
public
List
<
GroupClassifyQrcodeDTO
>
listClassifyQrcodeInfo
(
List
<
Long
>
classifyIds
)
{
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"listClassifyQrcodeInfo"
),
classifyIds
);
}
@Override
public
List
<
ListClassify4WechatVO
>
listClassify4Wechat
(
Long
bookGroupId
,
Integer
rankType
)
{
public
List
<
ListClassify4WechatVO
>
listClassify4Wechat
(
Long
bookGroupId
,
Integer
rankType
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"bookGroupId"
,
bookGroupId
);
paramMap
.
put
(
"bookGroupId"
,
bookGroupId
);
...
@@ -206,4 +211,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
...
@@ -206,4 +211,11 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"updateHasOpenLearningReport"
),
paramMap
);
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"updateHasOpenLearningReport"
),
paramMap
);
}
}
@Override
public
void
dragSortClassify
(
List
<
Long
>
classifyIds
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"classifyIds"
,
classifyIds
);
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"dragSortClassify"
),
paramMap
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/GroupQrcodeDaoImpl.java
View file @
ab5f9095
...
@@ -188,4 +188,13 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
...
@@ -188,4 +188,13 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
public
List
<
GroupQrcodeFoAdDTO
>
GroupQrcodeFoAdDTOSByClassifyIds
(
List
<
Long
>
classifyIds
)
{
public
List
<
GroupQrcodeFoAdDTO
>
GroupQrcodeFoAdDTOSByClassifyIds
(
List
<
Long
>
classifyIds
)
{
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"GroupQrcodeFoAdDTOSByClassifyIds"
),
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/dao/impl/JoinGroupCipherDaoImpl.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.JoinGroupCipherDao
;
import
com.pcloud.book.group.dto.JoinGroupCipherDTO
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 16:18
**/
@Component
(
"joinGroupCipherDao"
)
public
class
JoinGroupCipherDaoImpl
extends
BaseDaoImpl
<
JoinGroupCipher
>
implements
JoinGroupCipherDao
{
@Override
public
JoinGroupCipher
getByWechatUserId
(
Long
wechatUserId
,
Long
classifyId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"classifyId"
,
classifyId
);
return
this
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getByWechatUserId"
),
map
);
}
@Override
public
JoinGroupCipher
getByCipher
(
String
cipher
)
{
return
this
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getByCipher"
),
cipher
);
}
@Override
public
JoinGroupCipherDTO
getDTOByCipher
(
String
cipher
)
{
return
this
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getDTOByCipher"
),
cipher
);
}
@Override
public
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cipher"
,
cipher
);
map
.
put
(
"wxId"
,
wxId
);
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"updateCipherStateToUsed"
),
map
);
}
@Override
public
List
<
JoinGroupCipherDTO
>
getClassifyIdsByWxIdAndAltId
(
String
wxId
,
String
altId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxId"
,
wxId
);
map
.
put
(
"altId"
,
altId
);
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getClassifyIdsByWxIdAndAltId"
),
map
);
}
@Override
public
void
updateQrcodeId
(
String
cipher
,
String
wxId
,
Long
qrcodeId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cipher"
,
cipher
);
map
.
put
(
"wxId"
,
wxId
);
map
.
put
(
"qrcodeId"
,
qrcodeId
);
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"updateQrcodeId"
),
map
);
}
@Override
public
BigDecimal
getPayPrice
(
String
wxId
,
Long
qrcodeId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wxId"
,
wxId
);
map
.
put
(
"qrcodeId"
,
qrcodeId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getPayPrice"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/TempletRelevanceDaoImpl.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.TempletRelevanceDao
;
import
com.pcloud.book.group.entity.TempletRelevance
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 16:19
**/
@Component
(
"templetRelevanceDao"
)
public
class
TempletRelevanceDaoImpl
extends
BaseDaoImpl
<
TempletRelevance
>
implements
TempletRelevanceDao
{
@Override
public
TempletRelevance
getByTempletId
(
Long
templetId
)
{
return
this
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getByTempletId"
),
templetId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/WeixinQrcodeDaoImpl.java
View file @
ab5f9095
...
@@ -154,4 +154,12 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We
...
@@ -154,4 +154,12 @@ public class WeixinQrcodeDaoImpl extends BaseDaoImpl<WeixinQrcode> implements We
public
String
getVirtualIp
(
Integer
generation
)
{
public
String
getVirtualIp
(
Integer
generation
)
{
return
this
.
getSessionTemplate
().
selectOne
(
"getVirtualIp"
,
generation
);
return
this
.
getSessionTemplate
().
selectOne
(
"getVirtualIp"
,
generation
);
}
}
@Override
public
Integer
countByState
(
Integer
state
,
List
<
String
>
altIds
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"state"
,
state
);
paramMap
.
put
(
"altIds"
,
altIds
);
return
this
.
getSessionTemplate
().
selectOne
(
"countByState"
,
paramMap
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/AutoUpdateGroupNumDTO.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dto
;
import
java.util.Date
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
lombok.Data
;
/**
* 自动更新群人数DTO
*/
@Data
public
class
AutoUpdateGroupNumDTO
{
/**
* 群id
*/
private
String
wxGroupId
;
/**
* 机器人id
*/
private
String
robotId
;
/**
* wxGroupIp
*/
private
String
ip
;
/**
* 当前触发次数
*/
private
AtomicInteger
num
=
new
AtomicInteger
(
1
);
/**
* 开始更新时间(犹豫微信有延迟,所以新用户进群之后30s再次更新群人数)
*/
private
Date
startTime
;
public
AutoUpdateGroupNumDTO
()
{
}
public
AutoUpdateGroupNumDTO
(
String
wxGroupId
,
String
robotId
,
String
ip
,
Date
startTime
)
{
this
.
wxGroupId
=
wxGroupId
;
this
.
robotId
=
robotId
;
this
.
ip
=
ip
;
this
.
num
=
new
AtomicInteger
(
1
);
this
.
startTime
=
startTime
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/BookGroupDTO.java
View file @
ab5f9095
...
@@ -142,6 +142,11 @@ public class BookGroupDTO extends BaseDto {
...
@@ -142,6 +142,11 @@ public class BookGroupDTO extends BaseDto {
*/
*/
private
Boolean
isShowBookName
;
private
Boolean
isShowBookName
;
/**
* 进群方式:1群二维码,2客服机器人
*/
private
Integer
joinGroupType
;
public
String
getUrl
()
{
public
String
getUrl
()
{
return
url
;
return
url
;
}
}
...
@@ -359,6 +364,14 @@ public class BookGroupDTO extends BaseDto {
...
@@ -359,6 +364,14 @@ public class BookGroupDTO extends BaseDto {
this
.
isShowBookName
=
isShowBookName
;
this
.
isShowBookName
=
isShowBookName
;
}
}
public
Integer
getJoinGroupType
()
{
return
joinGroupType
;
}
public
void
setJoinGroupType
(
Integer
joinGroupType
)
{
this
.
joinGroupType
=
joinGroupType
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"BookGroupDTO{"
+
return
"BookGroupDTO{"
+
...
@@ -388,7 +401,8 @@ public class BookGroupDTO extends BaseDto {
...
@@ -388,7 +401,8 @@ public class BookGroupDTO extends BaseDto {
", bookName='"
+
bookName
+
'\''
+
", bookName='"
+
bookName
+
'\''
+
", url='"
+
url
+
'\''
+
", url='"
+
url
+
'\''
+
", bookClockInfoId="
+
bookClockInfoId
+
", bookClockInfoId="
+
bookClockInfoId
+
", isShowBookName='"
+
isShowBookName
+
'\''
+
", isShowBookName="
+
isShowBookName
+
", joinGroupType="
+
joinGroupType
+
"} "
+
super
.
toString
();
"} "
+
super
.
toString
();
}
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/ClassifyDTO.java
View file @
ab5f9095
...
@@ -82,6 +82,8 @@ public class ClassifyDTO implements Serializable {
...
@@ -82,6 +82,8 @@ public class ClassifyDTO implements Serializable {
private
Long
bookClockInfoId
;
private
Long
bookClockInfoId
;
private
Long
createUser
;
public
Integer
getRank
()
{
public
Integer
getRank
()
{
return
rank
;
return
rank
;
}
}
...
@@ -194,6 +196,14 @@ public class ClassifyDTO implements Serializable {
...
@@ -194,6 +196,14 @@ public class ClassifyDTO implements Serializable {
this
.
bookClockInfoId
=
bookClockInfoId
;
this
.
bookClockInfoId
=
bookClockInfoId
;
}
}
public
Long
getCreateUser
()
{
return
createUser
;
}
public
void
setCreateUser
(
Long
createUser
)
{
this
.
createUser
=
createUser
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"ClassifyDTO{"
+
return
"ClassifyDTO{"
+
...
@@ -211,6 +221,7 @@ public class ClassifyDTO implements Serializable {
...
@@ -211,6 +221,7 @@ public class ClassifyDTO implements Serializable {
", changeNumber="
+
changeNumber
+
", changeNumber="
+
changeNumber
+
", rank="
+
rank
+
", rank="
+
rank
+
", bookClockInfoId="
+
bookClockInfoId
+
", bookClockInfoId="
+
bookClockInfoId
+
", createUser="
+
createUser
+
'}'
;
'}'
;
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/GroupStoreMyPayDto.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @author 杨涛
* @description 商城用户已购买的社群码dto
* @date 2019/8/9 10:30
*/
@ApiModel
(
"商城用户已购买的社群码dto"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
GroupStoreMyPayDto
{
@ApiModelProperty
(
"标识(appId/productId/bookGroupId)"
)
private
Long
originId
;
@ApiModelProperty
(
"类型(APP/PRODUCT/BOOK_GROUP)"
)
private
String
originType
;
@ApiModelProperty
(
"标题"
)
private
String
originName
;
@ApiModelProperty
(
"封面图片"
)
private
String
coverImg
;
@ApiModelProperty
(
"已经购买的资源数量"
)
private
Integer
resourceNum
;
@ApiModelProperty
(
"已经购买的资源数量"
)
private
Integer
resourceItemNum
;
public
Long
getOriginId
()
{
return
originId
;
}
public
void
setOriginId
(
Long
originId
)
{
this
.
originId
=
originId
;
}
public
String
getOriginType
()
{
return
originType
;
}
public
void
setOriginType
(
String
originType
)
{
this
.
originType
=
originType
;
}
public
String
getOriginName
()
{
return
originName
;
}
public
void
setOriginName
(
String
originName
)
{
this
.
originName
=
originName
;
}
public
String
getCoverImg
()
{
return
coverImg
;
}
public
void
setCoverImg
(
String
coverImg
)
{
this
.
coverImg
=
coverImg
;
}
public
Integer
getResourceNum
()
{
return
resourceNum
;
}
public
void
setResourceNum
(
Integer
resourceNum
)
{
this
.
resourceNum
=
resourceNum
;
}
public
Integer
getResourceItemNum
()
{
return
resourceItemNum
;
}
public
void
setResourceItemNum
(
Integer
resourceItemNum
)
{
this
.
resourceItemNum
=
resourceItemNum
;
}
@Override
public
String
toString
()
{
return
"GroupStoreMyPayDto{"
+
"originId="
+
originId
+
", originType='"
+
originType
+
'\''
+
", originName='"
+
originName
+
'\''
+
", coverImg='"
+
coverImg
+
'\''
+
", resourceNum="
+
resourceNum
+
", resourceItemNum="
+
resourceItemNum
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/JoinGroupCipherDTO.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dto
;
import
lombok.Data
;
@Data
public
class
JoinGroupCipherDTO
{
private
String
cipher
;
private
Long
classifyId
;
private
Long
qrcodeId
;
private
Long
wechatUserId
;
private
String
wxId
;
private
Boolean
hasUsed
;
private
Long
bookGroupId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/OwnAltQrcodeInfoDTO.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
dto
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 17:14
**/
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
OwnAltQrcodeInfoDTO
implements
Serializable
{
@ApiModelProperty
(
"小号id"
)
private
String
altId
;
@ApiModelProperty
(
"小号昵称"
)
private
String
altNickName
;
@ApiModelProperty
(
"小号头像"
)
private
String
altHeadUrl
;
@ApiModelProperty
(
"小号二维码地址"
)
private
String
altQrcodeUrl
;
@ApiModelProperty
(
"暗号"
)
private
String
cipher
;
public
String
getAltId
()
{
return
altId
;
}
public
void
setAltId
(
String
altId
)
{
this
.
altId
=
altId
;
}
public
String
getAltNickName
()
{
return
altNickName
;
}
public
void
setAltNickName
(
String
altNickName
)
{
this
.
altNickName
=
altNickName
;
}
public
String
getAltHeadUrl
()
{
return
altHeadUrl
;
}
public
void
setAltHeadUrl
(
String
altHeadUrl
)
{
this
.
altHeadUrl
=
altHeadUrl
;
}
public
String
getAltQrcodeUrl
()
{
return
altQrcodeUrl
;
}
public
void
setAltQrcodeUrl
(
String
altQrcodeUrl
)
{
this
.
altQrcodeUrl
=
altQrcodeUrl
;
}
public
String
getCipher
()
{
return
cipher
;
}
public
void
setCipher
(
String
cipher
)
{
this
.
cipher
=
cipher
;
}
@Override
public
String
toString
()
{
return
"OwnAltQrcodeInfoDTO{"
+
"altId='"
+
altId
+
'\''
+
", altNickName='"
+
altNickName
+
'\''
+
", altHeadUrl='"
+
altHeadUrl
+
'\''
+
", altQrcodeUrl='"
+
altQrcodeUrl
+
'\''
+
", cipher='"
+
cipher
+
'\''
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/BookGroup.java
View file @
ab5f9095
...
@@ -102,6 +102,11 @@ public class BookGroup extends BaseEntity {
...
@@ -102,6 +102,11 @@ public class BookGroup extends BaseEntity {
*/
*/
private
Boolean
isShowBookName
;
private
Boolean
isShowBookName
;
/**
* 进群方式:1群二维码,2客服机器人
*/
private
Integer
joinGroupType
;
public
Long
getId
()
{
public
Long
getId
()
{
return
id
;
return
id
;
}
}
...
@@ -246,6 +251,14 @@ public class BookGroup extends BaseEntity {
...
@@ -246,6 +251,14 @@ public class BookGroup extends BaseEntity {
this
.
isShowBookName
=
isShowBookName
;
this
.
isShowBookName
=
isShowBookName
;
}
}
public
Integer
getJoinGroupType
()
{
return
joinGroupType
;
}
public
void
setJoinGroupType
(
Integer
joinGroupType
)
{
this
.
joinGroupType
=
joinGroupType
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"BookGroup{"
+
return
"BookGroup{"
+
...
@@ -267,6 +280,7 @@ public class BookGroup extends BaseEntity {
...
@@ -267,6 +280,7 @@ public class BookGroup extends BaseEntity {
", updateTime="
+
updateTime
+
", updateTime="
+
updateTime
+
", isDelete="
+
isDelete
+
", isDelete="
+
isDelete
+
", isShowBookName="
+
isShowBookName
+
", isShowBookName="
+
isShowBookName
+
", joinGroupType="
+
joinGroupType
+
"} "
+
super
.
toString
();
"} "
+
super
.
toString
();
}
}
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/GroupQrcode.java
View file @
ab5f9095
...
@@ -80,6 +80,10 @@ public class GroupQrcode extends BaseEntity {
...
@@ -80,6 +80,10 @@ public class GroupQrcode extends BaseEntity {
* 修改用户
* 修改用户
*/
*/
private
Long
updateUser
;
private
Long
updateUser
;
/**
* 猜谜语是否开启
*/
private
Boolean
riddleOpen
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
private
Date
createTime
;
...
@@ -231,6 +235,14 @@ public class GroupQrcode extends BaseEntity {
...
@@ -231,6 +235,14 @@ public class GroupQrcode extends BaseEntity {
this
.
qrcodeState
=
qrcodeState
;
this
.
qrcodeState
=
qrcodeState
;
}
}
public
Boolean
getRiddleOpen
()
{
return
riddleOpen
;
}
public
void
setRiddleOpen
(
Boolean
riddleOpen
)
{
this
.
riddleOpen
=
riddleOpen
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"GroupQrcode{"
+
return
"GroupQrcode{"
+
...
@@ -243,12 +255,15 @@ public class GroupQrcode extends BaseEntity {
...
@@ -243,12 +255,15 @@ public class GroupQrcode extends BaseEntity {
", weixinGroupId='"
+
weixinGroupId
+
'\''
+
", weixinGroupId='"
+
weixinGroupId
+
'\''
+
", qrcodeUrl='"
+
qrcodeUrl
+
'\''
+
", qrcodeUrl='"
+
qrcodeUrl
+
'\''
+
", useState="
+
useState
+
", useState="
+
useState
+
", qrcodeState="
+
qrcodeState
+
", changeNameState="
+
changeNameState
+
", changeNameState="
+
changeNameState
+
", isDelete="
+
isDelete
+
", isDelete="
+
isDelete
+
", createUser="
+
createUser
+
", createUser="
+
createUser
+
", updateUser="
+
updateUser
+
", updateUser="
+
updateUser
+
", riddleOpen="
+
riddleOpen
+
", createTime="
+
createTime
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", updateTime="
+
updateTime
+
", qrcodeHeadUrl='"
+
qrcodeHeadUrl
+
'\''
+
'}'
;
'}'
;
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/JoinGroupCipher.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/5 15:59
**/
public
class
JoinGroupCipher
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
8724831387632496417L
;
@ApiModelProperty
(
"密码"
)
private
String
cipher
;
@ApiModelProperty
(
"分类id"
)
private
Long
classifyId
;
@ApiModelProperty
(
"群id"
)
private
Long
qrcodeId
;
@ApiModelProperty
(
"创建人"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"使用人微信id"
)
private
String
wxId
;
@ApiModelProperty
(
"是否使用"
)
private
Boolean
hasUsed
;
@ApiModelProperty
(
"机器人id"
)
private
String
altId
;
public
String
getCipher
()
{
return
cipher
;
}
public
void
setCipher
(
String
cipher
)
{
this
.
cipher
=
cipher
;
}
public
Long
getClassifyId
()
{
return
classifyId
;
}
public
void
setClassifyId
(
Long
classifyId
)
{
this
.
classifyId
=
classifyId
;
}
public
Long
getQrcodeId
()
{
return
qrcodeId
;
}
public
void
setQrcodeId
(
Long
qrcodeId
)
{
this
.
qrcodeId
=
qrcodeId
;
}
public
Long
getWechatUserId
()
{
return
wechatUserId
;
}
public
void
setWechatUserId
(
Long
wechatUserId
)
{
this
.
wechatUserId
=
wechatUserId
;
}
public
String
getWxId
()
{
return
wxId
;
}
public
void
setWxId
(
String
wxId
)
{
this
.
wxId
=
wxId
;
}
public
Boolean
getHasUsed
()
{
return
hasUsed
;
}
public
void
setHasUsed
(
Boolean
hasUsed
)
{
this
.
hasUsed
=
hasUsed
;
}
public
String
getAltId
()
{
return
altId
;
}
public
void
setAltId
(
String
altId
)
{
this
.
altId
=
altId
;
}
@Override
public
String
toString
()
{
return
"JoinGroupCipher{"
+
"cipher='"
+
cipher
+
'\''
+
", classifyId="
+
classifyId
+
", qrcodeId="
+
qrcodeId
+
", wechatUserId="
+
wechatUserId
+
", wxId='"
+
wxId
+
'\''
+
", hasUsed="
+
hasUsed
+
", altId='"
+
altId
+
'\''
+
"} "
+
super
.
toString
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/TempletRelevance.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @Description 分类关联表
* @Author ruansiyuan
* @Date 2019/8/5 15:47
**/
public
class
TempletRelevance
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
5014986282950538055L
;
@ApiModelProperty
(
"分类id"
)
private
Long
templetId
;
@ApiModelProperty
(
"大类id"
)
private
Integer
largeTemplet
;
public
Long
getTempletId
()
{
return
templetId
;
}
public
void
setTempletId
(
Long
templetId
)
{
this
.
templetId
=
templetId
;
}
public
Integer
getLargeTemplet
()
{
return
largeTemplet
;
}
public
void
setLargeTemplet
(
Integer
largeTemplet
)
{
this
.
largeTemplet
=
largeTemplet
;
}
@Override
public
String
toString
()
{
return
"TempletRelevance{"
+
"templetId="
+
templetId
+
", largeTemplet="
+
largeTemplet
+
"} "
+
super
.
toString
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/enums/LargTempletEnum.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
enums
;
public
enum
LargTempletEnum
{
/**
* K12类
*/
K12
(
1
,
"K12类"
),
/**
* 少儿类
*/
CHILD
(
2
,
"少儿类"
),
/**
* 高等/职教
*/
HIGH
(
3
,
"高等/职教"
),
/**
* 大众类
*/
GENERAL
(
4
,
"大众类"
);
public
final
Integer
code
;
public
final
String
name
;
LargTempletEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/BookGroupClassifyFacade.java
View file @
ab5f9095
...
@@ -172,4 +172,11 @@ public interface BookGroupClassifyFacade {
...
@@ -172,4 +172,11 @@ public interface BookGroupClassifyFacade {
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
@ApiParam
(
"关键词"
)
String
keyword
@RequestParam
(
value
=
"keyword"
,
required
=
false
)
@ApiParam
(
"关键词"
)
String
keyword
)
throws
BizException
,
PermissionException
;
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"拖动排序"
)
@PostMapping
(
"dragSortClassify"
)
ResponseDto
<?>
dragSortClassify
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
List
<
Long
>
classifyIds
)
throws
BizException
,
PermissionException
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/BookGroupFacade.java
View file @
ab5f9095
...
@@ -3,6 +3,8 @@ package com.pcloud.book.group.facade;
...
@@ -3,6 +3,8 @@ package com.pcloud.book.group.facade;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
org.codehaus.jackson.JsonParseException
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -11,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.UpdateRankTypeVO
;
import
com.pcloud.book.group.vo.UpdateRankTypeVO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
...
@@ -118,6 +121,28 @@ public interface BookGroupFacade {
...
@@ -118,6 +121,28 @@ public interface BookGroupFacade {
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endDate
)
@RequestParam
(
value
=
"endDate"
,
required
=
false
)
String
endDate
)
throws
BizException
,
PermissionException
;
throws
BizException
,
PermissionException
;
@ApiOperation
(
value
=
"获取社群书列表(运营)"
,
httpMethod
=
"POST"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"listBookGroup4ChannelParamVO"
,
value
=
"ListBookGroup4ChannelParamVO"
,
dataType
=
"ListBookGroup4ChannelParamVO"
,
paramType
=
"body"
)
})
@RequestMapping
(
value
=
"listBookGroup4Channel"
,
method
=
RequestMethod
.
POST
)
ResponseDto
<
PageBean
>
listBookGroup4Channel
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
value
=
"获取用户购买或者参与过的社群书信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userInfo"
,
value
=
"Cookie"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"当前页"
,
dataType
=
"Integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"每页条数"
,
dataType
=
"Integer"
,
paramType
=
"query"
)
})
@RequestMapping
(
value
=
"getUserBrowseGroup4KnowLedgeMall"
,
method
=
RequestMethod
.
GET
)
ResponseDto
<?>
getUserBrowseGroup4KnowLedgeMall
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
value
=
"获取社群书列表(编辑)"
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取社群书列表(编辑)"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
@ApiImplicitParam
(
name
=
"token"
,
value
=
"token"
,
dataType
=
"string"
,
paramType
=
"header"
),
...
@@ -251,4 +276,16 @@ public interface BookGroupFacade {
...
@@ -251,4 +276,16 @@ public interface BookGroupFacade {
@RequestHeader
(
"token"
)
String
token
@RequestHeader
(
"token"
)
String
token
)
throws
BizException
,
PermissionException
,
JsonParseException
;
)
throws
BizException
,
PermissionException
,
JsonParseException
;
@ApiOperation
(
"根据分类id获取个人二维码"
)
@GetMapping
(
"getOwnAltQrcodeInfoDTOByClassifyId"
)
ResponseDto
<?>
getOwnAltQrcodeInfoDTOByClassifyId
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"classifyId"
)
Long
classifyId
)
throws
BizException
,
PermissionException
,
JsonParseException
;
@ApiOperation
(
"获取所有的大类"
)
@GetMapping
(
"getAllLargeTemplet"
)
ResponseDto
<?>
getAllLargeTemplet
(
@RequestHeader
(
"token"
)
String
token
)
throws
BizException
,
PermissionException
,
JsonParseException
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/BookGroupClassifyFacadeImpl.java
View file @
ab5f9095
...
@@ -184,4 +184,16 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
...
@@ -184,4 +184,16 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
return
new
ResponseDto
<>(
bookGroupClassifyBiz
.
listClassifyForLearningReport
(
currentPage
,
numPerPage
,
keyword
,
partyId
));
return
new
ResponseDto
<>(
bookGroupClassifyBiz
.
listClassifyForLearningReport
(
currentPage
,
numPerPage
,
keyword
,
partyId
));
}
}
@ApiOperation
(
"拖动排序"
)
@PostMapping
(
"dragSortClassify"
)
@Override
public
ResponseDto
<?>
dragSortClassify
(
@RequestHeader
(
"token"
)
@ApiParam
(
"token信息"
)
String
token
,
@RequestBody
List
<
Long
>
classifyIds
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
bookGroupClassifyBiz
.
dragSortClassify
(
classifyIds
);
return
new
ResponseDto
<>();
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
View file @
ab5f9095
...
@@ -3,20 +3,25 @@ package com.pcloud.book.group.facade.impl;
...
@@ -3,20 +3,25 @@ package com.pcloud.book.group.facade.impl;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.dto.GroupStoreMyPayDto
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.facade.BookGroupFacade
;
import
com.pcloud.book.group.facade.BookGroupFacade
;
import
com.pcloud.book.group.vo.
UpdateRankTypeVO
;
import
com.pcloud.book.group.vo.
*
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.codehaus.jackson.JsonParseException
;
import
org.codehaus.jackson.JsonParseException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -170,6 +175,26 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
...
@@ -170,6 +175,26 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return
new
ResponseDto
<>(
pageBean
);
return
new
ResponseDto
<>(
pageBean
);
}
}
@Override
@RequestMapping
(
value
=
"listBookGroup4Channel"
,
method
=
RequestMethod
.
POST
)
public
ResponseDto
<
PageBean
>
listBookGroup4Channel
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
ListBookGroup4ChannelParamVO
listBookGroup4ChannelParamVO
)
throws
BizException
,
PermissionException
{
Long
channelId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
PageBean
pageBean
=
bookGroupBiz
.
listBookGroup4Channel
(
channelId
,
listBookGroup4ChannelParamVO
);
return
new
ResponseDto
<>(
pageBean
);
}
@Override
@RequestMapping
(
value
=
"getUserBrowseGroup4KnowLedgeMall"
,
method
=
RequestMethod
.
GET
)
public
ResponseDto
<?>
getUserBrowseGroup4KnowLedgeMall
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
Long
channelId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_CHANNEL_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
PageBeanNew
<
GroupStoreMyPayDto
>
resultInfos
=
bookGroupBiz
.
getUserBrowseGroup4KnowLedgeMall
(
channelId
,
wechatUserId
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
resultInfos
);
}
/**
/**
* 获取社群书列表(编辑)
* 获取社群书列表(编辑)
*/
*/
...
@@ -371,4 +396,30 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
...
@@ -371,4 +396,30 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
bookGroupBiz
.
getIsShowBookName
(
partyId
));
return
new
ResponseDto
<>(
bookGroupBiz
.
getIsShowBookName
(
partyId
));
}
}
@ApiOperation
(
"根据分类id获取个人二维码"
)
@GetMapping
(
"getOwnAltQrcodeInfoDTOByClassifyId"
)
@Override
public
ResponseDto
<?>
getOwnAltQrcodeInfoDTOByClassifyId
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"classifyId"
)
Long
classifyId
)
throws
BizException
,
PermissionException
,
JsonParseException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
classifyId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"分类不能为空!"
);
}
return
new
ResponseDto
<>(
bookGroupBiz
.
getOwnAltQrcodeInfoDTOByClassifyId
(
wechatUserId
,
classifyId
));
}
@ApiOperation
(
"获取所有的大类"
)
@GetMapping
(
"getAllLargeTemplet"
)
@Override
public
ResponseDto
<?>
getAllLargeTemplet
(
@RequestHeader
(
"token"
)
String
token
)
throws
BizException
,
PermissionException
,
JsonParseException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
bookGroupBiz
.
getAllLargTemplet
());
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/service/impl/BookGroupClassifyServiceImpl.java
View file @
ab5f9095
...
@@ -2,10 +2,7 @@ package com.pcloud.book.group.service.impl;
...
@@ -2,10 +2,7 @@ package com.pcloud.book.group.service.impl;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.*
;
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.service.BookGroupClassifyService
;
import
com.pcloud.book.group.service.BookGroupClassifyService
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
...
@@ -19,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -19,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -70,7 +68,7 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService {
...
@@ -70,7 +68,7 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService {
@ApiImplicitParam
(
name
=
"query"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"query"
,
value
=
"书籍名称"
,
dataType
=
"string"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"proLabelId"
,
value
=
"专业标签id"
,
dataType
=
"long"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"proLabelId"
,
value
=
"专业标签id"
,
dataType
=
"long"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"depLabelId"
,
value
=
"深度标签id"
,
dataType
=
"long"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"depLabelId"
,
value
=
"深度标签id"
,
dataType
=
"long"
,
required
=
false
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"purLabelId"
,
value
=
"目的标签id"
,
dataType
=
"
stri
ng"
,
required
=
false
,
paramType
=
"query"
)
@ApiImplicitParam
(
name
=
"purLabelId"
,
value
=
"目的标签id"
,
dataType
=
"
lo
ng"
,
required
=
false
,
paramType
=
"query"
)
})
})
@GetMapping
(
"listQrcodeIdsByLabelQuery"
)
@GetMapping
(
"listQrcodeIdsByLabelQuery"
)
public
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
listQrcodeIdsByLabelQuery
(
public
ResponseEntity
<
ResponseDto
<
List
<
Long
>>>
listQrcodeIdsByLabelQuery
(
...
@@ -88,4 +86,14 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService {
...
@@ -88,4 +86,14 @@ public class BookGroupClassifyServiceImpl implements BookGroupClassifyService {
List
<
Long
>
qrcodeIds
=
groupQrcodeBiz
.
filterDeleteId
(
wxGroupIdList
);
List
<
Long
>
qrcodeIds
=
groupQrcodeBiz
.
filterDeleteId
(
wxGroupIdList
);
return
ResponseHandleUtil
.
toResponse
(
qrcodeIds
);
return
ResponseHandleUtil
.
toResponse
(
qrcodeIds
);
}
}
@Override
@GetMapping
(
"getPayPrice"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"qrcodeId"
,
value
=
"qrcodeId"
,
dataType
=
"long"
,
required
=
true
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"wxUserId"
,
value
=
"wxUserId"
,
dataType
=
"string"
,
required
=
true
,
paramType
=
"query"
)
})
public
ResponseEntity
<
ResponseDto
<
BigDecimal
>>
getPayPrice
(
@RequestParam
(
"qrcodeId"
)
Long
qrcodeId
,
@RequestParam
(
"wxUserId"
)
String
wxUserId
)
{
return
ResponseHandleUtil
.
toResponse
(
bookGroupClassifyBiz
.
getPayPrice
(
qrcodeId
,
wxUserId
));
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/service/impl/BookGroupServiceImpl.java
View file @
ab5f9095
...
@@ -2,18 +2,20 @@ package com.pcloud.book.group.service.impl;
...
@@ -2,18 +2,20 @@ package com.pcloud.book.group.service.impl;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
com.pcloud.book.group.dto.GroupCipherDTO
;
import
com.pcloud.book.group.dto.GroupUseDTO
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.service.BookGroupService
;
import
com.pcloud.book.group.service.BookGroupService
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.StoreFlowInfoDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
/**
/**
...
@@ -46,6 +48,35 @@ public class BookGroupServiceImpl implements BookGroupService {
...
@@ -46,6 +48,35 @@ public class BookGroupServiceImpl implements BookGroupService {
}
}
/**
/**
* 为信息流批量获取社群书基本信息
*/
@Override
@RequestMapping
(
value
=
"getFlowInfoByBookGroupIds"
,
method
=
RequestMethod
.
POST
)
public
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
StoreFlowInfoDto
>>>
getFlowInfoByBookGroupIds
(
@RequestBody
List
<
Long
>
bookGroupIds
)
throws
BizException
{
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getFlowInfoByBookGroupIds
(
bookGroupIds
));
}
/**
* 获取指定条数社群书基本信息
*/
@Override
@RequestMapping
(
value
=
"getBookGroupInfoByChannelId"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
StoreFlowInfoDto
>>>
getBookGroupInfoByChannelId
(
@RequestParam
(
"channelId"
)
Long
channelId
,
@RequestParam
(
"itemNum"
)
Integer
itemNum
)
throws
BizException
{
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getBookGroupInfoByChannelId
(
channelId
,
itemNum
));
}
/**
* 知识商城获取社群书信息
*/
@Override
@RequestMapping
(
value
=
"listBookGroup4KnowledgeMall"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
ResponseDto
<
PageBeanNew
<
StoreFlowInfoDto
>>>
listBookGroup4KnowledgeMall
(
@RequestParam
(
value
=
"channelId"
,
required
=
false
)
Long
channelId
,
@RequestParam
(
"currentPage"
)
int
currentPage
,
@RequestParam
(
"numPerPage"
)
int
numPerPage
)
throws
BizException
{
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
listBookGroup4KnowledgeMall
(
channelId
,
currentPage
,
numPerPage
));
}
/**
* 获取社群书基本信息
* 获取社群书基本信息
*/
*/
@Override
@Override
...
@@ -54,4 +85,41 @@ public class BookGroupServiceImpl implements BookGroupService {
...
@@ -54,4 +85,41 @@ public class BookGroupServiceImpl implements BookGroupService {
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getBaseInfoBySceneId
(
sceneId
));
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getBaseInfoBySceneId
(
sceneId
));
}
}
/**
* 获取暗号状态
*/
@ApiOperation
(
"获取暗号状态"
)
@GetMapping
(
"/getCipherState"
)
@Override
public
ResponseEntity
<
ResponseDto
<
Integer
>>
getCipherState
(
String
cipher
)
throws
BizException
{
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getCipherState
(
cipher
));
}
/**
* 更新密码状态为已使用
*/
@ApiOperation
(
"更新暗号状态为已使用"
)
@GetMapping
(
"/updateCipherStateToUsed"
)
@Override
public
void
updateCipherStateToUsed
(
String
cipher
,
String
wxId
)
throws
BizException
{
bookGroupBiz
.
updateCipherStateToUsed
(
cipher
,
wxId
);
}
/**
* 获取个人二维码方式群已使用和未使用数量
*/
@ApiOperation
(
"获取个人二维码方式群已使用和未使用数量"
)
@PostMapping
(
"/getGroupUse"
)
@Override
public
ResponseEntity
<
ResponseDto
<
GroupUseDTO
>>
getGroupUse
(
@RequestBody
List
<
String
>
altIds
)
throws
BizException
{
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getGroupUse
(
altIds
));
}
@ApiOperation
(
"获取暗号基本信息"
)
@GetMapping
(
"/getJoinGroupCipher"
)
@Override
public
ResponseEntity
<
ResponseDto
<
GroupCipherDTO
>>
getJoinGroupCipher
(
@RequestParam
(
"cipher"
)
String
cipher
)
throws
BizException
{
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getJoinGroupCipher
(
cipher
));
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/tools/SendWeixinRequestTools.java
View file @
ab5f9095
...
@@ -18,6 +18,7 @@ import com.pcloud.common.utils.string.StringUtil;
...
@@ -18,6 +18,7 @@ import com.pcloud.common.utils.string.StringUtil;
import
com.sdk.wxgroup.ChangeNameVO
;
import
com.sdk.wxgroup.ChangeNameVO
;
import
com.sdk.wxgroup.QrcodeVO
;
import
com.sdk.wxgroup.QrcodeVO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.WxGroupSDK
;
...
@@ -127,8 +128,8 @@ public class SendWeixinRequestTools {
...
@@ -127,8 +128,8 @@ public class SendWeixinRequestTools {
}*/
}*/
}
}
@ParamLog
(
"
修改微信群名称
"
)
@ParamLog
(
"
发送欢迎语消息
"
)
public
static
void
sendGuideMessage
(
List
<
ReplyMessageVO
>
replyMessages
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
public
static
void
sendGuideMessage
(
List
<
ReplyMessageVO
>
replyMessages
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
//JedisClusterUtils.del("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId);
//JedisClusterUtils.del("BOOK:WEIXINGROUP:GUIDEUSER" + weixinGroupId);
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
return
;
return
;
...
@@ -148,37 +149,40 @@ public class SendWeixinRequestTools {
...
@@ -148,37 +149,40 @@ public class SendWeixinRequestTools {
}
}
}
}
}
}
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
);
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
i
++;
i
++;
}
}
}
}
@ParamLog
(
"推送消息"
)
@ParamLog
(
"推送消息"
)
private
static
void
sendMessage
(
SendMessageDTO
sendMessageDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
private
static
void
sendMessage
(
SendMessageDTO
sendMessageDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
sendMessageDTO
.
getContent
());
sendTextMessageVO
.
setContent
(
sendMessageDTO
.
getContent
());
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setGroupId
(
weixinGroupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendPicMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
sendMessageDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
sendMessageDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
sendMessageDTO
.
getReplyType
()))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setAltId
(
robotId
);
sendArticleMessageVO
.
setAltId
(
robotId
);
sendArticleMessageVO
.
setDescription
(
sendMessageDTO
.
getDescription
());
sendArticleMessageVO
.
setDescription
(
sendMessageDTO
.
getDescription
());
sendArticleMessageVO
.
setLinkUrl
(
sendMessageDTO
.
getLinkUrl
());
sendArticleMessageVO
.
setLinkUrl
(
sendMessageDTO
.
getLinkUrl
());
sendArticleMessageVO
.
setGroupId
(
weixinGroupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendArticleMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendArticleMessageVO
.
setPicUrl
(
sendMessageDTO
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
sendMessageDTO
.
getContent
());
sendArticleMessageVO
.
setTitle
(
sendMessageDTO
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setIp
(
ip
);
sendArticleMessageVO
.
setCode
(
code
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
}
}
}
...
@@ -188,7 +192,7 @@ public class SendWeixinRequestTools {
...
@@ -188,7 +192,7 @@ public class SendWeixinRequestTools {
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
nickNameStr
);
sendTextMessageVO
.
setContent
(
nickNameStr
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
...
@@ -198,10 +202,11 @@ public class SendWeixinRequestTools {
...
@@ -198,10 +202,11 @@ public class SendWeixinRequestTools {
if
(
StringUtil
.
isEmpty
(
url
))
{
if
(
StringUtil
.
isEmpty
(
url
))
{
return
url
;
return
url
;
}
}
final
String
s
=
"qrcode_id="
+
groupQrcodeId
+
"&classify_id="
+
classifyId
+
(
null
==
bookGroupId
?
""
:
"&book_group_id="
+
bookGroupId
);
if
(
url
.
contains
(
"?"
))
{
if
(
url
.
contains
(
"?"
))
{
url
=
url
+
"&
qrcode_id="
+
groupQrcodeId
+
"&classify_id="
+
classifyId
+
"&book_group_id="
+
bookGroupId
;
url
=
url
+
"&
"
+
s
;
}
else
{
}
else
{
url
=
url
+
"?
qrcode_id="
+
groupQrcodeId
+
"&classify_id="
+
classifyId
+
"&book_group_id="
+
bookGroupId
;
url
=
url
+
"?
"
+
s
;
}
}
return
url
;
return
url
;
}
}
...
@@ -216,11 +221,11 @@ public class SendWeixinRequestTools {
...
@@ -216,11 +221,11 @@ public class SendWeixinRequestTools {
}
}
sendTextMessageVO
.
setContent
(
recommendLanguage
);
sendTextMessageVO
.
setContent
(
recommendLanguage
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setGroupId
(
weixinGroupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setAltId
(
robotId
);
sendPicMessageVO
.
setPicUrl
(
accountSettingDto
.
getQrcodeUrl
());
sendPicMessageVO
.
setPicUrl
(
accountSettingDto
.
getQrcodeUrl
());
sendPicMessageVO
.
setIp
(
ip
);
sendPicMessageVO
.
setIp
(
ip
);
...
@@ -228,10 +233,10 @@ public class SendWeixinRequestTools {
...
@@ -228,10 +233,10 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"推送关键词回复消息"
)
@ParamLog
(
"推送关键词回复消息"
)
public
static
void
sendKeywordMessage
(
ReplyKeywordDTO
replyKeywordDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
public
static
void
sendKeywordMessage
(
ReplyKeywordDTO
replyKeywordDTO
,
String
robotId
,
String
weixinGroupId
,
String
ip
,
Integer
code
)
{
SendMessageDTO
sendMessageDTO
=
new
SendMessageDTO
();
SendMessageDTO
sendMessageDTO
=
new
SendMessageDTO
();
BeanUtils
.
copyProperties
(
replyKeywordDTO
,
sendMessageDTO
);
BeanUtils
.
copyProperties
(
replyKeywordDTO
,
sendMessageDTO
);
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
);
sendMessage
(
sendMessageDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
}
}
@ParamLog
(
"补充域名"
)
@ParamLog
(
"补充域名"
)
...
@@ -269,32 +274,44 @@ public class SendWeixinRequestTools {
...
@@ -269,32 +274,44 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"欢迎语中推送关键词信息"
)
@ParamLog
(
"欢迎语中推送关键词信息"
)
public
static
void
sendKeywordsInfo
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroup
Id
,
String
ip
){
public
static
void
sendKeywordsInfo
(
List
<
KeywordDTO
>
keywords
,
String
robotId
,
String
toWx
Id
,
String
ip
){
if
(
ListUtils
.
isEmpty
(
keywords
))
{
if
(
ListUtils
.
isEmpty
(
keywords
))
{
return
;
return
;
}
}
String
content
=
""
;
String
Builder
content
=
new
StringBuilder
()
;
for
(
int
i
=
0
;
i
<
keywords
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
keywords
.
size
();
i
++)
{
KeywordDTO
keywordDTO
=
keywords
.
get
(
i
);
KeywordDTO
keywordDTO
=
keywords
.
get
(
i
);
String
keyword
=
"关键词【"
+
keywordDTO
.
getKeywords
()
+
"】\n"
+
" "
+
keywordDTO
.
getGuide
();
String
keyword
=
"关键词【"
+
keywordDTO
.
getKeywords
()
+
"】\n"
+
" "
+
keywordDTO
.
getGuide
();
if
(
content
.
length
()
+
keyword
.
length
()
>
300
)
{
if
(
content
.
length
()
+
keyword
.
length
()
>
300
)
{
sendTextMessage
(
content
,
robotId
,
weixinGroup
Id
,
ip
);
sendTextMessage
ToSelf
(
content
.
toString
(),
robotId
,
toWx
Id
,
ip
);
content
=
keyword
;
content
=
new
StringBuilder
(
keyword
)
;
}
else
{
}
else
{
content
=
content
+
keyword
;
content
.
append
(
keyword
)
;
}
}
if
(
i
!=
keywords
.
size
()
-
1
)
{
if
(
i
!=
keywords
.
size
()
-
1
)
{
content
=
content
+
"\n"
;
content
.
append
(
"\n"
)
;
}
}
}
}
sendTextMessage
(
content
,
robotId
,
weixinGroupId
,
ip
);
// 1001282-施总需求,群不推送关键词,个人欢迎语推送关键词
// sendTextMessage(content, robotId, weixinGroupId, ip);
sendTextMessageToSelf
(
content
.
toString
(),
robotId
,
toWxId
,
ip
);
}
private
static
void
sendTextMessageToSelf
(
String
content
,
String
robotId
,
String
toWxId
,
String
ip
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxGroupId
(
toWxId
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
}
public
static
void
sendTextMessage
(
String
content
,
String
robotId
,
String
weixinGroupId
,
String
ip
){
public
static
void
sendTextMessage
(
String
content
,
String
robotId
,
String
weixinGroupId
,
String
ip
){
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
}
...
@@ -303,7 +320,7 @@ public class SendWeixinRequestTools {
...
@@ -303,7 +320,7 @@ public class SendWeixinRequestTools {
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
// sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
// sendTextMessageVO.setAltId("wxid_qj200bf0key022");
// sendTextMessageVO.setAltId("wxid_qj200bf0key022");
// sendTextMessageVO.setGroupId("14108963419@chatroom");
// sendTextMessageVO.set
Wx
GroupId("14108963419@chatroom");
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
}
...
@@ -349,7 +366,7 @@ public class SendWeixinRequestTools {
...
@@ -349,7 +366,7 @@ public class SendWeixinRequestTools {
public
static
void
sendClockKeywordsInfo
(
List
<
BookClockKeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
public
static
void
sendClockKeywordsInfo
(
List
<
BookClockKeywordDTO
>
keywords
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
ip
);
sendTextMessageVO
.
setIp
(
ip
);
if
(
ListUtils
.
isEmpty
(
keywords
))
{
if
(
ListUtils
.
isEmpty
(
keywords
))
{
return
;
return
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/GroupQrcodeBaseInfoVO.java
View file @
ab5f9095
...
@@ -5,11 +5,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
...
@@ -5,11 +5,13 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
/**
* @author lily
* @author lily
* @date 2019/5/6 16:08
* @date 2019/5/6 16:08
*/
*/
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
GroupQrcodeBaseInfoVO
implements
Serializable
{
public
class
GroupQrcodeBaseInfoVO
implements
Serializable
{
...
@@ -22,36 +24,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable {
...
@@ -22,36 +24,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable {
@ApiModelProperty
(
"二维码地址"
)
@ApiModelProperty
(
"二维码地址"
)
private
String
qrcodeUrl
;
private
String
qrcodeUrl
;
public
Long
getGroupQrcodeId
()
{
@ApiModelProperty
(
value
=
"二维码地址"
,
hidden
=
true
)
return
groupQrcodeId
;
private
String
weixinGroupId
;
}
public
void
setGroupQrcodeId
(
Long
groupQrcodeId
)
{
this
.
groupQrcodeId
=
groupQrcodeId
;
}
public
String
getGroupName
()
{
return
groupName
;
}
public
void
setGroupName
(
String
groupName
)
{
this
.
groupName
=
groupName
;
}
public
String
getQrcodeUrl
()
{
return
qrcodeUrl
;
}
public
void
setQrcodeUrl
(
String
qrcodeUrl
)
{
this
.
qrcodeUrl
=
qrcodeUrl
;
}
@Override
public
String
toString
()
{
return
"GroupQrcodeBaseInfoVO{"
+
"groupQrcodeId="
+
groupQrcodeId
+
", groupName='"
+
groupName
+
'\''
+
", qrcodeUrl='"
+
qrcodeUrl
+
'\''
+
'}'
;
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/ListBook4ChannelVO.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
vo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/23 15:53
*/
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
ListBook4ChannelVO
implements
Serializable
{
@ApiModelProperty
(
"书唯一标识"
)
private
Long
bookId
;
@ApiModelProperty
(
"书群唯一标识"
)
private
Long
bookGroupId
;
@ApiModelProperty
(
"书名"
)
private
String
bookName
;
@ApiModelProperty
(
"ISBN"
)
private
String
isbn
;
@ApiModelProperty
(
"书编号"
)
private
String
bookNumber
;
@ApiModelProperty
(
"群分类数"
)
private
Long
classifyNum
;
@ApiModelProperty
(
"群总人数"
)
private
Long
totalNum
;
@ApiModelProperty
(
"书封面图"
)
private
String
coverImg
;
public
String
getBookName
()
{
return
bookName
;
}
public
void
setBookName
(
String
bookName
)
{
this
.
bookName
=
bookName
;
}
public
String
getIsbn
()
{
return
isbn
;
}
public
void
setIsbn
(
String
isbn
)
{
this
.
isbn
=
isbn
;
}
public
String
getBookNumber
()
{
return
bookNumber
;
}
public
void
setBookNumber
(
String
bookNumber
)
{
this
.
bookNumber
=
bookNumber
;
}
public
Long
getClassifyNum
()
{
return
classifyNum
;
}
public
void
setClassifyNum
(
Long
classifyNum
)
{
this
.
classifyNum
=
classifyNum
;
}
public
Long
getTotalNum
()
{
return
totalNum
;
}
public
void
setTotalNum
(
Long
totalNum
)
{
this
.
totalNum
=
totalNum
;
}
public
Long
getBookId
()
{
return
bookId
;
}
public
void
setBookId
(
Long
bookId
)
{
this
.
bookId
=
bookId
;
}
public
Long
getBookGroupId
()
{
return
bookGroupId
;
}
public
void
setBookGroupId
(
Long
bookGroupId
)
{
this
.
bookGroupId
=
bookGroupId
;
}
public
String
getCoverImg
()
{
return
coverImg
;
}
public
void
setCoverImg
(
String
coverImg
)
{
this
.
coverImg
=
coverImg
;
}
@Override
public
String
toString
()
{
return
"ListBook4ChannelVO{"
+
"bookId="
+
bookId
+
", bookGroupId="
+
bookGroupId
+
", bookName='"
+
bookName
+
'\''
+
", isbn='"
+
isbn
+
'\''
+
", bookNumber='"
+
bookNumber
+
'\''
+
", classifyNum="
+
classifyNum
+
", totalNum="
+
totalNum
+
", coverImg='"
+
coverImg
+
'\''
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/ListBookGroup4ChannelParamVO.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
group
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/23 15:28
*/
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
ListBookGroup4ChannelParamVO
implements
Serializable
{
@ApiModelProperty
(
"当前页"
)
private
Integer
currentPage
;
@ApiModelProperty
(
"每页条数"
)
private
Integer
numPerPage
;
@ApiModelProperty
(
"搜索的关键词"
)
private
String
keywords
;
@ApiModelProperty
(
"开始时间"
)
private
String
startTime
;
@ApiModelProperty
(
"结束时间"
)
private
String
endTime
;
@ApiModelProperty
(
"是否是基金书 0-否,1-是"
)
private
Integer
isFundBook
;
public
Integer
getCurrentPage
()
{
return
currentPage
;
}
public
void
setCurrentPage
(
Integer
currentPage
)
{
this
.
currentPage
=
currentPage
;
}
public
Integer
getNumPerPage
()
{
return
numPerPage
;
}
public
void
setNumPerPage
(
Integer
numPerPage
)
{
this
.
numPerPage
=
numPerPage
;
}
public
String
getKeywords
()
{
return
keywords
;
}
public
void
setKeywords
(
String
keywords
)
{
this
.
keywords
=
keywords
;
}
public
String
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
String
startTime
)
{
this
.
startTime
=
startTime
;
}
public
String
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
String
endTime
)
{
this
.
endTime
=
endTime
;
}
public
Integer
getIsFundBook
()
{
return
isFundBook
;
}
public
void
setIsFundBook
(
Integer
isFundBook
)
{
this
.
isFundBook
=
isFundBook
;
}
@Override
public
String
toString
()
{
return
"ListBookGroup4ChannelParamVO{"
+
"currentPage="
+
currentPage
+
", numPerPage="
+
numPerPage
+
", keywords='"
+
keywords
+
'\''
+
", startTime="
+
startTime
+
", endTime="
+
endTime
+
", isFundBook="
+
isFundBook
+
'}'
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/BookGuideBiz.java
View file @
ab5f9095
...
@@ -5,6 +5,7 @@ import com.pcloud.book.keywords.vo.GuideVO;
...
@@ -5,6 +5,7 @@ import com.pcloud.book.keywords.vo.GuideVO;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -14,6 +15,11 @@ import java.util.Map;
...
@@ -14,6 +15,11 @@ import java.util.Map;
* @date 2019/4/23 15:46
* @date 2019/4/23 15:46
*/
*/
public
interface
BookGuideBiz
{
public
interface
BookGuideBiz
{
/**
* 同意加好友发送欢迎语
*/
void
sendGuide
(
AgreeAddUserDTO
agreeAddUserDTO
);
/**
/**
* @Author:lili
* @Author:lili
* @Desr:新增欢迎语
* @Desr:新增欢迎语
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/BookKeywordBiz.java
View file @
ab5f9095
...
@@ -6,6 +6,7 @@ import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
...
@@ -6,6 +6,7 @@ import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import
com.pcloud.book.keywords.dto.ServiceResourceDTO
;
import
com.pcloud.book.keywords.dto.ServiceResourceDTO
;
import
com.pcloud.book.keywords.vo.*
;
import
com.pcloud.book.keywords.vo.*
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
java.util.List
;
import
java.util.List
;
...
@@ -70,7 +71,7 @@ public interface BookKeywordBiz {
...
@@ -70,7 +71,7 @@ public interface BookKeywordBiz {
* @Desr: 回复关键词消息
* @Desr: 回复关键词消息
* @Date:2019/5/5 16:28
* @Date:2019/5/5 16:28
*/
*/
void
sendKeywordMessage
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
);
void
sendKeywordMessage
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
,
Integer
code
);
/**
/**
* 关键词统计
* 关键词统计
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
ab5f9095
package
com
.
pcloud
.
book
.
keywords
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
keywords
.
biz
.
impl
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.clock.check.BookClockCheck
;
import
com.pcloud.book.clock.check.BookClockCheck
;
import
com.pcloud.book.clock.dao.BookClockKeywordDao
;
import
com.pcloud.book.clock.dao.BookClockKeywordDao
;
import
com.pcloud.book.clock.dto.BookClockKeywordDTO
;
import
com.pcloud.book.clock.dto.BookClockKeywordDTO
;
...
@@ -13,8 +14,11 @@ import com.pcloud.book.group.dao.AppTouchRecordDao;
...
@@ -13,8 +14,11 @@ import com.pcloud.book.group.dao.AppTouchRecordDao;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dao.JoinGroupCipherDao
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupQrcodeDTO
;
import
com.pcloud.book.group.dto.JoinGroupCipherDTO
;
import
com.pcloud.book.group.dto.PushAddUserMessageDTO
;
import
com.pcloud.book.group.dto.PushAddUserMessageDTO
;
import
com.pcloud.book.group.entity.AppTouchRecord
;
import
com.pcloud.book.group.entity.AppTouchRecord
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.entity.GroupQrcode
;
...
@@ -25,19 +29,30 @@ import com.pcloud.book.keywords.biz.BookGuideBiz;
...
@@ -25,19 +29,30 @@ import com.pcloud.book.keywords.biz.BookGuideBiz;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.dao.BookGuideDao
;
import
com.pcloud.book.keywords.dao.BookGuideDao
;
import
com.pcloud.book.keywords.dao.BookGuideReplyDao
;
import
com.pcloud.book.keywords.dao.BookGuideReplyDao
;
import
com.pcloud.book.keywords.dao.KeywordDao
;
import
com.pcloud.book.keywords.dto.GuideDTO
;
import
com.pcloud.book.keywords.dto.GuideDTO
;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
import
com.pcloud.book.keywords.dto.ReplyKeywordDTO
;
import
com.pcloud.book.keywords.entity.BookGuide
;
import
com.pcloud.book.keywords.entity.BookGuide
;
import
com.pcloud.book.keywords.entity.BookGuideReply
;
import
com.pcloud.book.keywords.entity.BookGuideReply
;
import
com.pcloud.book.keywords.entity.Keyword
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.vo.GuideVO
;
import
com.pcloud.book.keywords.vo.GuideVO
;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
com.sdk.wxgroup.AddToGroupVO
;
import
com.sdk.wxgroup.SendGroupInviteVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -87,6 +102,116 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -87,6 +102,116 @@ public class BookGuideBizImpl implements BookGuideBiz {
private
GroupQrcodeDao
groupQrcodeDao
;
private
GroupQrcodeDao
groupQrcodeDao
;
@Autowired
@Autowired
private
BookGroupClassifyDao
bookGroupClassifyDao
;
private
BookGroupClassifyDao
bookGroupClassifyDao
;
@Autowired
private
JoinGroupCipherDao
joinGroupCipherDao
;
@Autowired
private
KeywordDao
keywordDao
;
@ParamLog
(
"同意加好友发送欢迎语"
)
@Override
public
void
sendGuide
(
AgreeAddUserDTO
agreeAddUserDTO
)
{
if
(
null
==
agreeAddUserDTO
||
StringUtil
.
isBlank
(
agreeAddUserDTO
.
getRobotWxId
())
||
StringUtil
.
isBlank
(
agreeAddUserDTO
.
getUserWxId
()))
{
log
.
info
(
"[同意加好友发送欢迎语] 参数为空 agreeAddUserDTO:{}"
,
agreeAddUserDTO
);
return
;
}
String
cipher
=
agreeAddUserDTO
.
getCipher
();
if
(
StringUtil
.
isBlank
(
cipher
))
{
cipher
=
wechatGroupConsr
.
getCipherByRobotAndUserWxId
(
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
());
}
if
(
StringUtil
.
isBlank
(
cipher
))
{
log
.
info
(
"[同意加好友发送欢迎语] 暗号为空 agreeAddUserDTO:{}"
,
agreeAddUserDTO
);
return
;
}
final
JoinGroupCipherDTO
dto
=
joinGroupCipherDao
.
getDTOByCipher
(
cipher
);
//获取群
final
String
wxGroupId
=
bookGroupClassifyBiz
.
getWxGroupIdByClassifyIdAndWechatId
(
dto
.
getClassifyId
(),
dto
.
getWechatUserId
());
if
(
agreeAddUserDTO
.
getFirst
()
!=
null
&&
agreeAddUserDTO
.
getFirst
())
{
// 如果是第一次就只发欢迎文案
SendTextMessageVO
vo
=
new
SendTextMessageVO
();
vo
.
setContent
(
"你好,我是本书智能小助手,请回复你的进群暗号,获取本书资源服务,以及入群链接如果忘了进群暗号,请重新扫描书上的二维码,点击入群即可获取"
);
vo
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
vo
.
setWxId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo
.
setWxGroupId
(
agreeAddUserDTO
.
getUserWxId
());
vo
.
setIp
(
agreeAddUserDTO
.
getIp
());
log
.
info
(
"[同意加好友发送欢迎语] : {}"
,
vo
);
WxGroupSDK
.
sendTextMessage
(
vo
);
}
else
{
// 如果不是第一次就发关键词
// 根据暗号获取分类id和bookGroupId推送关键词欢迎语
List
<
KeywordDTO
>
keywords
=
bookKeywordBiz
.
listFiveKeyword
(
dto
.
getClassifyId
(),
dto
.
getBookGroupId
());
//发主打资源
sendMainKeyword
(
keywords
,
agreeAddUserDTO
,
dto
,
wxGroupId
);
//发关键词列表
SendWeixinRequestTools
.
sendKeywordsInfo
(
keywords
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
());
}
// 拉群
final
Integer
peopleCounts
=
WxGroupSDK
.
getPeopleCounts
(
wxGroupId
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getIp
());
// 邀请好友进群有次数限制,目前测试为每天只能拉30-40人就操作频繁,所以在此加判断,超过30人或者群人数超过30人就发送邀请链接
final
String
num
=
JedisClusterUtils
.
get
(
BookConstant
.
WXGROUP_ADD_USER_NUM
+
agreeAddUserDTO
.
getRobotWxId
());
log
.
info
(
"[同意加好友发送欢迎语] 拉群 agreeAddUserDTO:{}, wxGroupId:{}, peopleCounts:{}, num:{}"
,
agreeAddUserDTO
,
wxGroupId
,
peopleCounts
,
num
);
if
(
StringUtil
.
isBlank
(
wxGroupId
))
{
log
.
info
(
"[同意加好友发送欢迎语] 拉群 没有找到群 bookGroupClassifyBiz.getGroupQrcode4ClassifyWechat JoinGroupCipherDTO :{}"
,
dto
);
return
;
}
// 生产环境限制30,其它5和10
final
boolean
isPro
=
"pro"
.
equalsIgnoreCase
(
BookProps
.
getSystemEnv
());
if
((!
StringUtil
.
isBlank
(
num
)
&&
Integer
.
parseInt
(
num
)
>=
(
isPro
?
30
:
5
))
||
peopleCounts
>=
(
isPro
?
30
:
10
))
{
SendGroupInviteVO
sendGroupInviteVO
=
new
SendGroupInviteVO
();
sendGroupInviteVO
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
sendGroupInviteVO
.
setWxId
(
agreeAddUserDTO
.
getUserWxId
());
sendGroupInviteVO
.
setWxGroupId
(
wxGroupId
);
WxGroupSDK
.
sendGroupInvite
(
sendGroupInviteVO
);
log
.
info
(
"[同意加好友发送欢迎语] 发送进群链接 sendGroupInviteVO:{}"
,
sendGroupInviteVO
);
// 进群之后更新群qrCodeId
updateQrcodeForCipher
(
wxGroupId
,
cipher
,
agreeAddUserDTO
.
getUserWxId
());
return
;
}
AddToGroupVO
vo1
=
new
AddToGroupVO
();
vo1
.
setWxGroupId
(
wxGroupId
);
vo1
.
setWxId
(
agreeAddUserDTO
.
getUserWxId
());
vo1
.
setAltId
(
agreeAddUserDTO
.
getRobotWxId
());
vo1
.
setIp
(
agreeAddUserDTO
.
getIp
());
log
.
info
(
"[同意加好友发送欢迎语 拉群] AddToGroupVO :{}"
,
vo1
);
WxGroupSDK
.
addToGroup
(
vo1
);
// 进群之后更新群qrCodeId
updateQrcodeForCipher
(
wxGroupId
,
cipher
,
agreeAddUserDTO
.
getUserWxId
());
// 拉一次+1
if
(
StringUtil
.
isBlank
(
num
))
{
JedisClusterUtils
.
getSet
(
BookConstant
.
WXGROUP_ADD_USER_NUM
+
agreeAddUserDTO
.
getRobotWxId
(),
"1"
,
3600
*
24
);
}
else
{
JedisClusterUtils
.
incr
(
BookConstant
.
WXGROUP_ADD_USER_NUM
+
agreeAddUserDTO
.
getRobotWxId
());
}
}
@ParamLog
(
"进群之后更新群qrCodeId"
)
private
void
updateQrcodeForCipher
(
String
wxGroupId
,
String
cipher
,
String
userWxId
){
log
.
info
(
"根据群id查询群信息wxGroupId"
,
wxGroupId
);
GroupQrcodeDTO
groupQrcodeInfo
=
groupQrcodeDao
.
getGroupQrcodeInfo
(
wxGroupId
);
log
.
info
(
"根据群id查询群信息groupQrcodeInfo"
,
groupQrcodeInfo
.
toString
());
log
.
info
(
"更新暗号的群cipher="
+
cipher
+
"wxId="
+
userWxId
+
"qrcodeId="
+
groupQrcodeInfo
.
getId
());
joinGroupCipherDao
.
updateQrcodeId
(
cipher
,
userWxId
,
groupQrcodeInfo
.
getId
());
}
@ParamLog
(
"发送主打资源"
)
private
void
sendMainKeyword
(
List
<
KeywordDTO
>
keywords
,
AgreeAddUserDTO
agreeAddUserDTO
,
JoinGroupCipherDTO
dto
,
String
wxGroupId
)
{
if
(!
ListUtils
.
isEmpty
(
keywords
))
{
KeywordDTO
keywordDTO
=
keywords
.
get
(
0
);
Keyword
keyword
=
keywordDao
.
getById
(
keywordDTO
.
getKeywordId
());
GroupQrcodeDTO
groupQrcodeInfo
=
groupQrcodeDao
.
getGroupQrcodeInfo
(
wxGroupId
);
if
(
keyword
!=
null
&&
groupQrcodeInfo
!=
null
)
{
ReplyKeywordDTO
replyKeywordDTO
=
new
ReplyKeywordDTO
();
BeanUtils
.
copyProperties
(
keyword
,
replyKeywordDTO
);
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
replyKeywordDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
replyKeywordDTO
.
getReplyType
()))
{
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
dto
.
getBookGroupId
());
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
bookGroupDTO
.
getChannelId
());
String
linkUrl
=
SendWeixinRequestTools
.
splitUrlNew
(
accountSettingDto
,
replyKeywordDTO
.
getLinkUrl
(),
dto
.
getBookGroupId
(),
dto
.
getClassifyId
(),
groupQrcodeInfo
.
getId
());
replyKeywordDTO
.
setLinkUrl
(
linkUrl
);
}
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
(),
agreeAddUserDTO
.
getIp
(),
SendMessageTypeEnum
.
SELF
.
getCode
());
}
}
}
@Override
@Override
@ParamLog
(
"新增欢迎语"
)
@ParamLog
(
"新增欢迎语"
)
...
@@ -223,37 +348,12 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -223,37 +348,12 @@ public class BookGuideBizImpl implements BookGuideBiz {
log
.
info
(
"[关键词消息回复] robotId is null robotId:{},weixinGroupId:{}"
,
robotId
,
weixinGroupId
);
log
.
info
(
"[关键词消息回复] robotId is null robotId:{},weixinGroupId:{}"
,
robotId
,
weixinGroupId
);
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
}
}
//String robotId = "wxid_e6zsl8oohcnl22";
// 判断是否需要发送
// boolean canSend = false;
// // 查看群成员
// GroupInfoVO groupInfoVO = WxGroupSDK.getGroupInfo(weixinGroupId, robotId);
// log.info("[查看群成员] : groupInfoVO:{}",groupInfoVO);
// if (!CollectionUtils.isEmpty(groupInfoVO.getIdList())) {
// // 查看该用户weixinid
// final List<String> nickName = wechatGroupConsr.getWxUserIdsByNickName(pushAddUserMessageDTO.getNickName());
// log.info("[查看该用户weixinid] : nickName:{}",nickName);
// if(!CollectionUtils.isEmpty(nickName)) {
// final Map<String, Boolean> map = Maps.newHashMap();
// for (String s : groupInfoVO.getIdList()) {
// map.put(s, true);
// }
// for (String s : nickName) {
// if (null != map.get(s) && map.get(s)) {
// // 若在群设置true
// canSend = true;
// break;
// }
// }
// }
// }
// 判断是否黑名单
// 判断是否黑名单
final
Boolean
kickUser
=
wechatGroupConsr
.
isKickUser
(
pushAddUserMessageDTO
.
getNickName
(),
weixinGroupId
);
final
Boolean
kickUser
=
wechatGroupConsr
.
isKickUser
(
pushAddUserMessageDTO
.
getNickName
(),
weixinGroupId
);
// log.info("[推送欢迎语消息]:pushAddUserMessageDTO:{},kickUser:{},canSend:{}", pushAddUserMessageDTO, kickUser,canSend);
log
.
info
(
"[推送欢迎语消息]:pushAddUserMessageDTO:{},kickUser:{}"
,
pushAddUserMessageDTO
,
kickUser
);
log
.
info
(
"[推送欢迎语消息]:pushAddUserMessageDTO:{},kickUser:{}"
,
pushAddUserMessageDTO
,
kickUser
);
// 在群,且非黑名单
// 在群,且非黑名单
// canSend = canSend && !kickUser;
// canSend = canSend && !kickUser;
if
(
kickUser
)
{
if
(
null
!=
kickUser
&&
kickUser
)
{
log
.
info
(
"[推送欢迎语消息]:不推送"
);
log
.
info
(
"[推送欢迎语消息]:不推送"
);
return
;
return
;
}
}
...
@@ -265,24 +365,25 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -265,24 +365,25 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
}
//获取公众号基本信息
//获取公众号基本信息
AccountSettingDto
wechatInfo
=
qrcodeSceneConsr
.
getWechatInfo
(
classifyQrcodeInfo
.
getChannelId
());
AccountSettingDto
wechatInfo
=
qrcodeSceneConsr
.
getWechatInfo
(
classifyQrcodeInfo
.
getChannelId
());
//获取关键词信息(改成10个了)
//获取关键词信息(改成10个了)
刘娜需求 1001282 群不推送关键词
List
<
KeywordDTO
>
keywords
=
bookKeywordBiz
.
listFiveKeyword
(
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
//
List<KeywordDTO> keywords = bookKeywordBiz.listFiveKeyword(classifyQrcodeInfo.getClassifyId(), classifyQrcodeInfo.getBookGroupId());
Boolean
isHaveKeywords
=
!
ListUtils
.
isEmpty
(
keywords
);
//
Boolean isHaveKeywords = !ListUtils.isEmpty(keywords);
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
if
(
ListUtils
.
isEmpty
(
replyMessages
))
{
//获取群名称
//获取群名称
GroupQrcodeBaseInfoVO
groupInfo
=
groupQrcodeBiz
.
getBaseById
(
classifyQrcodeInfo
.
getGroupQrcodeId
());
GroupQrcodeBaseInfoVO
groupInfo
=
groupQrcodeBiz
.
getBaseById
(
classifyQrcodeInfo
.
getGroupQrcodeId
());
//推送消息
//推送消息 刘娜需求 1001282 群不推送关键词
SendWeixinRequestTools
.
sendDefaultMessage
(
groupInfo
==
null
?
""
:
groupInfo
.
getGroupName
(),
robotId
,
weixinGroupId
,
isHaveKeywords
,
pushAddUserMessageDTO
.
getIp
());
// SendWeixinRequestTools.sendDefaultMessage(groupInfo == null ? "" : groupInfo.getGroupName(), robotId, weixinGroupId, isHaveKeywords, pushAddUserMessageDTO.getIp());
SendWeixinRequestTools
.
sendDefaultMessage
(
groupInfo
==
null
?
""
:
groupInfo
.
getGroupName
(),
robotId
,
weixinGroupId
,
false
,
pushAddUserMessageDTO
.
getIp
());
}
else
{
}
else
{
//处理链接
//处理链接
handleUrl
(
replyMessages
,
wechatInfo
,
classifyQrcodeInfo
);
handleUrl
(
replyMessages
,
wechatInfo
,
classifyQrcodeInfo
);
//推送消息
//推送消息
SendWeixinRequestTools
.
sendGuideMessage
(
replyMessages
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
SendWeixinRequestTools
.
sendGuideMessage
(
replyMessages
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
()
,
SendMessageTypeEnum
.
GROUP
.
getCode
()
);
//新增欢迎语应用触发记录
//新增欢迎语应用触发记录
addGuideAppTouchRecord
(
replyMessages
,
weixinGroupId
,
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
());
addGuideAppTouchRecord
(
replyMessages
,
weixinGroupId
,
classifyQrcodeInfo
.
getBookGroupId
(),
classifyQrcodeInfo
.
getClassifyId
());
}
}
//获取关键词信息(改成10个了)
//获取关键词信息(改成10个了)
刘娜需求 1001282 群不推送关键词
SendWeixinRequestTools
.
sendKeywordsInfo
(
keywords
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
//
SendWeixinRequestTools.sendKeywordsInfo(keywords, robotId, weixinGroupId, pushAddUserMessageDTO.getIp());
//如果设置了群学习报告,加一个群学习报告的关键词
//如果设置了群学习报告,加一个群学习报告的关键词
pushLearningReport
(
classifyQrcodeInfo
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
pushLearningReport
(
classifyQrcodeInfo
,
robotId
,
weixinGroupId
,
pushAddUserMessageDTO
.
getIp
());
if
(
bookGuide
!=
null
&&
bookGuide
.
getIsRecommend
()
!=
null
&&
bookGuide
.
getIsRecommend
()
==
1
)
{
if
(
bookGuide
!=
null
&&
bookGuide
.
getIsRecommend
()
!=
null
&&
bookGuide
.
getIsRecommend
()
==
1
)
{
...
@@ -316,10 +417,24 @@ public class BookGuideBizImpl implements BookGuideBiz {
...
@@ -316,10 +417,24 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
}
}
}
@ParamLog
(
"推关学习报告键词消息"
)
@ParamLog
(
"推关学习报告
/猜谜语关
键词消息"
)
private
void
pushLearningReport
(
GroupClassifyQrcodeDTO
classifyQrcodeInfo
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
private
void
pushLearningReport
(
GroupClassifyQrcodeDTO
classifyQrcodeInfo
,
String
robotId
,
String
weixinGroupId
,
String
ip
)
{
Boolean
reportOpen
=
false
;
Boolean
riddleOpen
=
false
;
if
(
classifyQrcodeInfo
.
getHasOpenLearningReport
()
!=
null
&&
classifyQrcodeInfo
.
getHasOpenLearningReport
())
{
if
(
classifyQrcodeInfo
.
getHasOpenLearningReport
()
!=
null
&&
classifyQrcodeInfo
.
getHasOpenLearningReport
())
{
reportOpen
=
true
;
}
GroupQrcode
groupQrcode
=
groupQrcodeDao
.
getGroupQrcodeByGroupId
(
weixinGroupId
);
if
(
null
!=
groupQrcode
&&
groupQrcode
.
getRiddleOpen
())
{
riddleOpen
=
true
;
}
if
(
reportOpen
&&
riddleOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值\n"
+
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666"
,
robotId
,
weixinGroupId
,
ip
);
}
else
if
(
reportOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值"
,
robotId
,
weixinGroupId
,
ip
);
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【学习报告】\n 获取个人专属学习报告,与群成员PK元气值"
,
robotId
,
weixinGroupId
,
ip
);
}
else
if
(
riddleOpen
)
{
SendWeixinRequestTools
.
sendTextMessage
(
"关键词【猜谜语】\n 猜谜语,大家一起玩,看谁666"
,
robotId
,
weixinGroupId
,
ip
);
}
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
ab5f9095
...
@@ -2,6 +2,7 @@ package com.pcloud.book.keywords.biz.impl;
...
@@ -2,6 +2,7 @@ package com.pcloud.book.keywords.biz.impl;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Sets
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
...
@@ -10,6 +11,7 @@ import com.pcloud.book.consumer.app.AppConsr;
...
@@ -10,6 +11,7 @@ import com.pcloud.book.consumer.app.AppConsr;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.dao.AppTouchRecordDao
;
import
com.pcloud.book.group.dao.AppTouchRecordDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
...
@@ -17,11 +19,13 @@ import com.pcloud.book.group.dao.BookGroupDao;
...
@@ -17,11 +19,13 @@ import com.pcloud.book.group.dao.BookGroupDao;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.JoinGroupCipherDTO
;
import
com.pcloud.book.group.entity.AppTouchRecord
;
import
com.pcloud.book.group.entity.AppTouchRecord
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.enums.TouchTypeEnum
;
import
com.pcloud.book.group.enums.TouchTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.vo.ClassifyNameVO
;
import
com.pcloud.book.group.vo.ClassifyNameVO
;
import
com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.dao.BookKeywordRecordDao
;
import
com.pcloud.book.keywords.dao.BookKeywordRecordDao
;
...
@@ -53,6 +57,7 @@ import com.pcloud.common.utils.string.StringUtil;
...
@@ -53,6 +57,7 @@ import com.pcloud.common.utils.string.StringUtil;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.resourcecenter.product.dto.ProductTypeDto
;
import
com.pcloud.resourcecenter.product.dto.ProductTypeDto
;
import
com.pcloud.wechatgroup.group.dto.RobotReplyDTO
;
import
com.pcloud.wechatgroup.group.dto.RobotReplyDTO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -66,8 +71,10 @@ import java.util.ArrayList;
...
@@ -66,8 +71,10 @@ import java.util.ArrayList;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.TreeSet
;
import
java.util.TreeSet
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -110,6 +117,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -110,6 +117,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private
BookGroupClassifyDao
bookGroupClassifyDao
;
private
BookGroupClassifyDao
bookGroupClassifyDao
;
@Autowired
@Autowired
private
QrcodeSceneService
qrcodeSceneService
;
private
QrcodeSceneService
qrcodeSceneService
;
@Autowired
private
BookGroupBiz
bookGroupBiz
;
@Override
@Override
@ParamLog
(
"新增关键词"
)
@ParamLog
(
"新增关键词"
)
...
@@ -411,11 +420,145 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -411,11 +420,145 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@Override
@Override
@ParamLog
(
"关键词消息回复"
)
@ParamLog
(
"关键词消息回复"
)
public
void
sendKeywordMessage
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
)
{
public
void
sendKeywordMessage
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
,
Integer
code
)
{
// 刘娜需求 1001282 群不推送关键词
if
(
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
code
))
{
this
.
sendKeywordMessageToGroup
(
content
,
weixinGroupId
,
userWxId
,
robotId
,
ip
,
code
);
return
;
}
//个人机器人接收消息的时候,weixinGroupId就是userWxId,也就是用户的id,robotId是接收的机器人的id
//简单过滤非关键词的词
//简单过滤非关键词的词
if
(
StringUtil
.
isEmpty
(
content
)
||
content
.
length
()
>
20
)
{
if
(
StringUtil
.
isEmpty
(
content
)
||
content
.
length
()
>
20
)
{
return
;
return
;
}
}
// TODO 根据小号和用户id获取所有相关的分类id,若该关键词存在多本书,则组装成文本加链接一次发送
final
List
<
JoinGroupCipherDTO
>
dtos
=
bookGroupBiz
.
getClassifyIdsByWxIdAndAltId
(
userWxId
,
robotId
);
if
(
CollectionUtils
.
isEmpty
(
dtos
))
{
log
.
info
(
"[关键词消息回复] classifyIds is null"
);
return
;
}
final
Set
<
Long
>
cIds
=
Sets
.
newHashSet
();
final
Set
<
Long
>
bIds
=
Sets
.
newHashSet
();
Map
<
Long
,
Long
>
classifyToBookGroupMap
=
new
HashMap
<>();
Map
<
Long
,
Long
>
classifyToQrcodeMap
=
new
HashMap
<>();
for
(
JoinGroupCipherDTO
dto
:
dtos
)
{
cIds
.
add
(
dto
.
getClassifyId
());
bIds
.
add
(
dto
.
getBookGroupId
());
classifyToBookGroupMap
.
put
(
dto
.
getClassifyId
(),
dto
.
getBookGroupId
());
classifyToQrcodeMap
.
put
(
dto
.
getClassifyId
(),
dto
.
getQrcodeId
());
}
final
List
<
Long
>
classifyIds
=
Lists
.
newArrayList
(
cIds
);
List
<
ReplyKeywordDTO
>
replyKeywordDTOs
=
new
ArrayList
<>();
Map
<
Long
,
Long
>
keywordClassifyIdMap
=
new
HashMap
<>();
List
<
Long
>
keywordIds
=
new
ArrayList
<>();
for
(
Long
classifyId
:
classifyIds
)
{
//获取匹配关键词
ReplyKeywordDTO
replyKeywordDTO
=
bookKeywordDao
.
getKeywordId
(
classifyId
,
classifyToBookGroupMap
.
get
(
classifyId
),
content
);
if
(
replyKeywordDTO
==
null
)
{
continue
;
}
keywordClassifyIdMap
.
put
(
replyKeywordDTO
.
getKeywordId
(),
classifyId
);
//避免一本书下两个分类的关键词重复
if
(!
keywordIds
.
contains
(
replyKeywordDTO
.
getKeywordId
()))
{
replyKeywordDTOs
.
add
(
replyKeywordDTO
);
keywordIds
.
add
(
replyKeywordDTO
.
getKeywordId
());
}
}
final
List
<
GroupClassifyQrcodeDTO
>
qrcodeDTOS
=
bookGroupClassifyBiz
.
listClassifyQrcodeInfo
(
classifyIds
);
if
(
CollectionUtils
.
isEmpty
(
replyKeywordDTOs
))
{
log
.
info
(
"[关键词消息回复] keywordIds is null"
);
return
;
}
if
(
CollectionUtils
.
isEmpty
(
qrcodeDTOS
))
{
log
.
info
(
"[关键词消息回复] qrcodeDTOS is null"
);
return
;
}
final
Map
<
Long
,
GroupClassifyQrcodeDTO
>
classifyMap
=
qrcodeDTOS
.
stream
().
collect
(
Collectors
.
toMap
(
GroupClassifyQrcodeDTO:
:
getClassifyId
,
p
->
p
,
(
v1
,
v2
)
->
v2
));
// 记录循环插入,消息一条发送
for
(
ReplyKeywordDTO
replyKeywordDTO
:
replyKeywordDTOs
)
{
log
.
info
(
"[关键词回复原始数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, altId:{}"
,
replyKeywordDTO
,
robotId
,
userWxId
);
// 处理链接地址
Long
classifyId
=
keywordClassifyIdMap
.
get
(
replyKeywordDTO
.
getKeywordId
());
final
GroupClassifyQrcodeDTO
dto
=
classifyMap
.
get
(
classifyId
);
Long
qrcodeId
=
classifyToQrcodeMap
.
get
(
dto
.
getClassifyId
());
GroupQrcodeBaseInfoVO
qrcodeInfo
=
groupQrcodeDao
.
getBaseById
(
qrcodeId
);
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
replyKeywordDTO
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
replyKeywordDTO
.
getReplyType
()))
{
if
(
null
==
dto
)
{
log
.
info
(
"[关键词消息回复] 分类信息为空 replyKeywordDTO:{}; classifyMap:{}"
,
replyKeywordDTO
,
classifyMap
);
continue
;
}
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
dto
.
getChannelId
());
String
linkUrl
=
SendWeixinRequestTools
.
splitUrlNew
(
accountSettingDto
,
replyKeywordDTO
.
getLinkUrl
(),
dto
.
getBookGroupId
(),
dto
.
getClassifyId
(),
qrcodeId
);
replyKeywordDTO
.
setLinkUrl
(
linkUrl
);
if
(!
StringUtil
.
isEmpty
(
linkUrl
))
{
replyKeywordDTO
.
setShortLinkUrl
(
UrlUtils
.
getShortUrl4Own
(
linkUrl
));
}
}
String
redisContent
=
JedisClusterUtils
.
getJson
(
"BOOK:KEYWORD:"
+
userWxId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
String
.
class
);
// 同一群10秒内不回复同一关键词
if
(
insertBookKeywordRecord
(
qrcodeInfo
.
getWeixinGroupId
(),
userWxId
,
replyKeywordDTO
,
dto
,
redisContent
))
{
return
;
}
//获取推送消息机器人
// 20190704改为收发一体
if
(
StringUtil
.
isBlank
(
robotId
))
{
log
.
info
(
"[关键词消息回复] robotId is null content:{}, robotId:{},weixinGroupId:{}"
,
content
,
robotId
,
qrcodeInfo
.
getWeixinGroupId
());
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
qrcodeInfo
.
getWeixinGroupId
());
}
log
.
info
(
"[关键词回复发送数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, weixinGroupId:{}"
,
replyKeywordDTO
,
robotId
,
qrcodeInfo
.
getWeixinGroupId
());
//新增关键词触发记录
addKeywordAppTouchRecord
(
replyKeywordDTO
,
qrcodeInfo
.
getWeixinGroupId
(),
dto
.
getClassifyId
(),
dto
.
getBookGroupId
());
}
// 单条还是按原来的发送
if
(
replyKeywordDTOs
.
size
()
<=
1
)
{
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTOs
.
get
(
0
),
robotId
,
userWxId
,
ip
,
code
);
}
else
{
// 多条时文字,应用,链接组装成一条发送
ReplyKeywordDTO
d
=
new
ReplyKeywordDTO
();
final
StringBuilder
sb
=
new
StringBuilder
();
for
(
ReplyKeywordDTO
dto
:
replyKeywordDTOs
)
{
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
dto
.
getReplyType
())
||
ReplyTypeEnum
.
LINK
.
value
.
equals
(
dto
.
getReplyType
()))
{
sb
.
append
(
dto
.
getKeywords
()).
append
(
":"
).
append
(
dto
.
getShortLinkUrl
()).
append
(
"\n"
);
}
else
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
dto
.
getReplyType
())){
sb
.
append
(
dto
.
getKeywords
()).
append
(
":"
).
append
(
dto
.
getContent
()).
append
(
"\n"
);
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
dto
.
getReplyType
()))
{
SendWeixinRequestTools
.
sendKeywordMessage
(
dto
,
robotId
,
userWxId
,
ip
,
code
);
continue
;
}
}
d
.
setContent
(
sb
.
toString
());
d
.
setReplyType
(
ReplyTypeEnum
.
TEXT
.
value
);
SendWeixinRequestTools
.
sendKeywordMessage
(
d
,
robotId
,
userWxId
,
ip
,
code
);
}
}
private
boolean
insertBookKeywordRecord
(
String
weixinGroupId
,
String
userWxId
,
ReplyKeywordDTO
replyKeywordDTO
,
GroupClassifyQrcodeDTO
dto
,
String
redisContent
)
{
if
(
redisContent
!=
null
)
{
insertBookKeywordRecord
(
dto
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
false
);
log
.
info
(
"[关键词消息回复] redisContent:{} insertBookKeywordRecord return"
,
redisContent
);
return
true
;
}
else
{
JedisClusterUtils
.
setJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
replyKeywordDTO
.
getKeywordId
(),
10
);
insertBookKeywordRecord
(
dto
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
true
);
}
return
false
;
}
/**
* 原有的推送群关键词改为推送个人关键词
*/
@ParamLog
(
"群关键词消息回复"
)
private
void
sendKeywordMessageToGroup
(
String
content
,
String
weixinGroupId
,
String
userWxId
,
String
robotId
,
String
ip
,
Integer
code
)
{
//简单过滤非关键词的词
if
(
StringUtil
.
isEmpty
(
content
)
||
content
.
length
()
>
20
)
{
return
;
}
// 若非之前的机器人则不回复普通关键词
final
Boolean
groupRobot
=
wechatGroupConsr
.
isGroupRobot
(
robotId
);
log
.
info
(
"[wechatGroupConsr.isGroupRobot] robotId:{} groupRobot:{}"
,
robotId
,
groupRobot
);
if
(!
groupRobot
)
{
return
;
}
//通过群id获取对应基本信息
//通过群id获取对应基本信息
GroupClassifyQrcodeDTO
classifyQrcodeInfo
=
bookGroupClassifyBiz
.
getClassifyQrcodeInfo
(
weixinGroupId
);
GroupClassifyQrcodeDTO
classifyQrcodeInfo
=
bookGroupClassifyBiz
.
getClassifyQrcodeInfo
(
weixinGroupId
);
if
(
classifyQrcodeInfo
==
null
)
{
if
(
classifyQrcodeInfo
==
null
)
{
...
@@ -443,13 +586,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -443,13 +586,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
}
String
redisContent
=
JedisClusterUtils
.
getJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
String
.
class
);
String
redisContent
=
JedisClusterUtils
.
getJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
String
.
class
);
// 同一群10秒内不回复同一关键词
// 同一群10秒内不回复同一关键词
if
(
redisContent
!=
null
)
{
if
(
insertBookKeywordRecord
(
weixinGroupId
,
userWxId
,
replyKeywordDTO
,
classifyQrcodeInfo
,
redisContent
))
{
insertBookKeywordRecord
(
classifyQrcodeInfo
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
false
);
log
.
info
(
"[关键词消息回复] redisContent:{} insertBookKeywordRecord return"
,
redisContent
);
return
;
return
;
}
else
{
JedisClusterUtils
.
setJson
(
"BOOK:KEYWORD:"
+
weixinGroupId
+
"-"
+
replyKeywordDTO
.
getKeywordId
(),
replyKeywordDTO
.
getKeywordId
(),
10
);
insertBookKeywordRecord
(
classifyQrcodeInfo
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
true
);
}
}
//获取推送消息机器人
//获取推送消息机器人
// 20190704改为收发一体
// 20190704改为收发一体
...
@@ -458,7 +596,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -458,7 +596,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
robotId
=
wechatGroupConsr
.
getRobotIdByGroupId
(
weixinGroupId
);
}
}
log
.
info
(
"[关键词回复发送数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, weixinGroupId:{}"
,
replyKeywordDTO
,
robotId
,
weixinGroupId
);
log
.
info
(
"[关键词回复发送数据] : sendKeywordMessage replyKeywordDTO :{}, robotId:{}, weixinGroupId:{}"
,
replyKeywordDTO
,
robotId
,
weixinGroupId
);
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
);
SendWeixinRequestTools
.
sendKeywordMessage
(
replyKeywordDTO
,
robotId
,
weixinGroupId
,
ip
,
code
);
//新增关键词触发记录
//新增关键词触发记录
addKeywordAppTouchRecord
(
replyKeywordDTO
,
weixinGroupId
,
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
addKeywordAppTouchRecord
(
replyKeywordDTO
,
weixinGroupId
,
classifyQrcodeInfo
.
getClassifyId
(),
classifyQrcodeInfo
.
getBookGroupId
());
//第一推送关键词消息埋点
//第一推送关键词消息埋点
...
@@ -506,6 +644,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
...
@@ -506,6 +644,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
bookKeywordRecord
.
setUserWxId
(
userWxId
);
bookKeywordRecord
.
setUserWxId
(
userWxId
);
bookKeywordRecord
.
setWeixinGroupId
(
weixinGroupId
);
bookKeywordRecord
.
setWeixinGroupId
(
weixinGroupId
);
bookKeywordRecord
.
setSend
(
isSend
);
bookKeywordRecord
.
setSend
(
isSend
);
if
(
bookKeywordRecord
.
getGroupQrcodeId
()
==
null
)
{
GroupQrcode
groupQr
=
groupQrcodeDao
.
getGroupQrcodeByGroupId
(
weixinGroupId
);
if
(
groupQr
!=
null
){
bookKeywordRecord
.
setGroupQrcodeId
(
groupQr
.
getId
());
}
}
bookKeywordRecordDao
.
insert
(
bookKeywordRecord
);
bookKeywordRecordDao
.
insert
(
bookKeywordRecord
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dao/BookKeywordDao.java
View file @
ab5f9095
...
@@ -52,6 +52,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
...
@@ -52,6 +52,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
ReplyKeywordDTO
getKeywordId
(
Long
classifyId
,
Long
bookGroupId
,
String
content
);
ReplyKeywordDTO
getKeywordId
(
Long
classifyId
,
Long
bookGroupId
,
String
content
);
/**
/**
* 根据分类ids和群ids批量获取关键词
*/
List
<
ReplyKeywordDTO
>
getKeywordIds
(
List
<
Long
>
classifyIds
,
List
<
Long
>
bookGroupIds
,
String
content
);
/**
* @Author:lili
* @Author:lili
* @Desr:校验关键词
* @Desr:校验关键词
* @Date:2019/5/6 14:47
* @Date:2019/5/6 14:47
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dao/impl/BookKeywordDaoImpl.java
View file @
ab5f9095
package
com
.
pcloud
.
book
.
keywords
.
dao
.
impl
;
package
com
.
pcloud
.
book
.
keywords
.
dao
.
impl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.pcloud.book.group.vo.SyncKeyworsVO
;
import
com.pcloud.book.group.vo.SyncKeyworsVO
;
...
@@ -12,10 +13,14 @@ import com.pcloud.book.keywords.vo.ListKeywordVO;
...
@@ -12,10 +13,14 @@ import com.pcloud.book.keywords.vo.ListKeywordVO;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collector
;
import
java.util.stream.Collectors
;
/**
/**
* @author lily
* @author lily
...
@@ -62,6 +67,18 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
...
@@ -62,6 +67,18 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
}
}
@Override
@Override
public
List
<
ReplyKeywordDTO
>
getKeywordIds
(
List
<
Long
>
classifyIds
,
List
<
Long
>
bookGroupIds
,
String
content
)
{
if
(
CollectionUtils
.
isEmpty
(
classifyIds
)
||
CollectionUtils
.
isEmpty
(
bookGroupIds
)
||
StringUtils
.
isEmpty
(
content
))
{
return
Lists
.
newArrayList
();
}
Map
<
String
,
Object
>
paramMap
=
Maps
.
newHashMap
();
paramMap
.
put
(
"classifyId"
,
classifyIds
.
stream
().
map
(
Object:
:
toString
).
collect
(
Collectors
.
joining
(
","
)));
paramMap
.
put
(
"bookGroupId"
,
bookGroupIds
.
stream
().
map
(
Object:
:
toString
).
collect
(
Collectors
.
joining
(
","
)));
paramMap
.
put
(
"content"
,
content
);
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getKeywordIds"
),
paramMap
);
}
@Override
public
Boolean
checkKeyword
(
String
keywords
,
Long
classifyId
,
Long
bookGroupId
,
Long
keywordId
)
{
public
Boolean
checkKeyword
(
String
keywords
,
Long
classifyId
,
Long
bookGroupId
,
Long
keywordId
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"classifyId"
,
classifyId
);
paramMap
.
put
(
"classifyId"
,
classifyId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dto/ReplyKeywordDTO.java
View file @
ab5f9095
...
@@ -27,6 +27,12 @@ public class ReplyKeywordDTO implements Serializable {
...
@@ -27,6 +27,12 @@ public class ReplyKeywordDTO implements Serializable {
@ApiModelProperty
(
"仓库关键词id"
)
@ApiModelProperty
(
"仓库关键词id"
)
private
Long
warehouseId
;
private
Long
warehouseId
;
@ApiModelProperty
(
"分类id"
)
private
Long
classifyId
;
@ApiModelProperty
(
"群id"
)
private
Long
bookGroupId
;
@ApiModelProperty
(
"内容"
)
@ApiModelProperty
(
"内容"
)
private
String
content
;
private
String
content
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/facade/impl/BookGuideFacadeImpl.java
View file @
ab5f9095
...
@@ -6,12 +6,15 @@ import com.pcloud.book.keywords.vo.GuideVO;
...
@@ -6,12 +6,15 @@ import com.pcloud.book.keywords.vo.GuideVO;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.ReplyMessageVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.SetGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.book.keywords.vo.UpdateGuideVO
;
import
com.pcloud.common.core.constant.MQTopicProducer
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
org.springframework.amqp.core.AmqpTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -26,16 +29,34 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -26,16 +29,34 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
lombok.extern.slf4j.Slf4j
;
/**
/**
* @author lily
* @author lily
* @date 2019/4/23 15:24
* @date 2019/4/23 15:24
*/
*/
@Slf4j
@RestController
(
"bookGuideFacade"
)
@RestController
(
"bookGuideFacade"
)
@RequestMapping
(
"bookGuide"
)
@RequestMapping
(
"bookGuide"
)
public
class
BookGuideFacadeImpl
implements
BookGuideFacade
{
public
class
BookGuideFacadeImpl
implements
BookGuideFacade
{
@Autowired
@Autowired
private
BookGuideBiz
bookGuidBiz
;
private
BookGuideBiz
bookGuidBiz
;
@Autowired
private
AmqpTemplate
amqpTemplate
;
@PostMapping
(
"test"
)
public
void
test
()
{
final
AgreeAddUserDTO
agreeAddUserDTO
=
new
AgreeAddUserDTO
();
agreeAddUserDTO
.
setNickName
(
"大威"
);
agreeAddUserDTO
.
setRobotWxId
(
"wxid_arjobo1bbk2i22"
);
// 当消息为个人消息时,wechatGroupId为发送人id
agreeAddUserDTO
.
setUserWxId
(
"p867263500"
);
agreeAddUserDTO
.
setIp
(
"http://192.168.92.122:8081"
);
log
.
info
(
"[processSelfMessage] start convertAndSend agreeAddUserDTO:{}"
,
agreeAddUserDTO
);
// 发送topic book处理后续欢迎语,关键词和拉群操作
amqpTemplate
.
convertAndSend
(
MQTopicProducer
.
EXCHAGE
,
MQTopicProducer
.
WX_AGREE_ADD_USER
,
agreeAddUserDTO
);
}
@Override
@Override
@PostMapping
(
"insertGuide"
)
@PostMapping
(
"insertGuide"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/config/MQTopicConumer.java
View file @
ab5f9095
...
@@ -70,4 +70,9 @@ public class MQTopicConumer {
...
@@ -70,4 +70,9 @@ public class MQTopicConumer {
*/
*/
public
static
final
String
WXGROUP_LEARNING_REPORT
=
PREFIX
+
MQTopicProducer
.
WXGROUP_LEARNING_REPORT
;
public
static
final
String
WXGROUP_LEARNING_REPORT
=
PREFIX
+
MQTopicProducer
.
WXGROUP_LEARNING_REPORT
;
/**
* 微信群同意添加好友成功
*/
public
static
final
String
WX_AGREE_ADD_USER
=
PREFIX
+
MQTopicProducer
.
WX_AGREE_ADD_USER
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/UpdateWXGroupNameListener.java
View file @
ab5f9095
...
@@ -51,8 +51,8 @@ public class UpdateWXGroupNameListener {
...
@@ -51,8 +51,8 @@ public class UpdateWXGroupNameListener {
}
}
String
groupName
=
groupQrcode
.
getGroupName
();
String
groupName
=
groupQrcode
.
getGroupName
();
// 如果数据库微信群名称超过16,就截断,然后重新设置数据库的名称,因为wxgroup那边设置的时候截断了
// 如果数据库微信群名称超过16,就截断,然后重新设置数据库的名称,因为wxgroup那边设置的时候截断了
if
(
groupName
.
length
()
>
1
6
)
{
if
(
groupName
.
length
()
>
1
5
)
{
groupName
=
groupName
.
substring
(
0
,
1
6
);
groupName
=
groupName
.
substring
(
0
,
1
5
);
groupQrcodeDao
.
updateGroupName
(
groupQrcode
.
getId
(),
groupName
);
groupQrcodeDao
.
updateGroupName
(
groupQrcode
.
getId
(),
groupName
);
}
}
if
(!
groupNameDTO
.
getNewGroupName
().
equals
(
groupName
))
{
if
(!
groupNameDTO
.
getNewGroupName
().
equals
(
groupName
))
{
...
@@ -67,7 +67,7 @@ public class UpdateWXGroupNameListener {
...
@@ -67,7 +67,7 @@ public class UpdateWXGroupNameListener {
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
"@"
+
groupNameDTO
.
getNickName
()+
",为方便群友入群分享好的助学方法,请不要随意修改群名。如再修改,会将您移出群聊。谢谢配合。"
);
sendTextMessageVO
.
setContent
(
"@"
+
groupNameDTO
.
getNickName
()+
",为方便群友入群分享好的助学方法,请不要随意修改群名。如再修改,会将您移出群聊。谢谢配合。"
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setGroupId
(
wechatGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
wechatGroupId
);
LOGGER
.
info
(
"发送警告文本消息"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送警告文本消息"
+
sendTextMessageVO
.
toString
());
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WXGroupLearningReportListener.java
View file @
ab5f9095
...
@@ -25,6 +25,7 @@ import com.pcloud.wechatgroup.message.dto.GroupLearningReportDTO;
...
@@ -25,6 +25,7 @@ import com.pcloud.wechatgroup.message.dto.GroupLearningReportDTO;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendPicMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
...
@@ -63,8 +64,9 @@ public class WXGroupLearningReportListener {
...
@@ -63,8 +64,9 @@ public class WXGroupLearningReportListener {
try
{
try
{
if
(
groupLearningReportDTO
==
null
if
(
groupLearningReportDTO
==
null
||
groupLearningReportDTO
.
getWechatGroupId
()
==
null
||
groupLearningReportDTO
.
getWechatGroupId
()
==
null
||
groupLearningReportDTO
.
getWechatUserId
()
==
null
)
||
groupLearningReportDTO
.
getWechatUserId
()
==
null
)
{
return
;
return
;
}
String
wechatUserId
=
groupLearningReportDTO
.
getWechatUserId
();
String
wechatUserId
=
groupLearningReportDTO
.
getWechatUserId
();
String
wechatGroupId
=
groupLearningReportDTO
.
getWechatGroupId
();
String
wechatGroupId
=
groupLearningReportDTO
.
getWechatGroupId
();
//新增触发记录
//新增触发记录
...
@@ -102,7 +104,7 @@ public class WXGroupLearningReportListener {
...
@@ -102,7 +104,7 @@ public class WXGroupLearningReportListener {
return
;
return
;
}
}
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
wechatGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
wechatGroupId
);
sendTextMessageVO
.
setAltId
(
alt
);
sendTextMessageVO
.
setAltId
(
alt
);
sendTextMessageVO
.
setContent
(
"个人专属学习报告,及群成员元气排行榜。点击获取"
+
resultUrl
);
sendTextMessageVO
.
setContent
(
"个人专属学习报告,及群成员元气排行榜。点击获取"
+
resultUrl
);
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
...
@@ -115,12 +117,12 @@ public class WXGroupLearningReportListener {
...
@@ -115,12 +117,12 @@ public class WXGroupLearningReportListener {
}
}
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setPicUrl
(
imageUrl
);
sendPicMessageVO
.
setPicUrl
(
imageUrl
);
sendPicMessageVO
.
setGroupId
(
wechatGroupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
wechatGroupId
);
sendPicMessageVO
.
setAltId
(
alt
);
sendPicMessageVO
.
setAltId
(
alt
);
sendPicMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
sendPicMessageVO
.
setIp
(
findIp
(
wechatGroupId
));
LOGGER
.
info
(
"发送分享图消息开始"
+
send
Text
MessageVO
.
toString
());
LOGGER
.
info
(
"发送分享图消息开始"
+
send
Pic
MessageVO
.
toString
());
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
LOGGER
.
info
(
"发送分享图消息开始"
+
send
Text
MessageVO
.
toString
());
LOGGER
.
info
(
"发送分享图消息开始"
+
send
Pic
MessageVO
.
toString
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"接收学习报告topic失败"
+
e
.
getMessage
(),
e
);
LOGGER
.
error
(
"接收学习报告topic失败"
+
e
.
getMessage
(),
e
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WxAgreeAddUserListener.java
0 → 100644
View file @
ab5f9095
package
com
.
pcloud
.
book
.
mq
.
topic
;
import
com.pcloud.book.keywords.biz.BookGuideBiz
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO
;
import
org.springframework.amqp.rabbit.annotation.RabbitHandler
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
/**
* @author lily
* @date 2019/5/6 11:01
*/
@Slf4j
@Component
public
class
WxAgreeAddUserListener
{
@Resource
private
BookGuideBiz
bookGuideBiz
;
/**
* 接收微信用户进群消息
*/
@ParamLog
(
"同意加好友发送欢迎语"
)
@RabbitListener
(
queues
=
MQTopicConumer
.
WX_AGREE_ADD_USER
)
public
void
onMessage
(
AgreeAddUserDTO
agreeAddUserDTO
)
throws
BizException
{
try
{
bookGuideBiz
.
sendGuide
(
agreeAddUserDTO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"同意加好友发送欢迎语"
+
e
.
getMessage
(),
e
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/mq/topic/WxGroupSendTextListener.java
View file @
ab5f9095
...
@@ -6,11 +6,13 @@ import com.pcloud.book.clock.dto.BookClockInfoDTO;
...
@@ -6,11 +6,13 @@ import com.pcloud.book.clock.dto.BookClockInfoDTO;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.mq.config.MQTopicConumer
;
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.core.aspect.ParamLog
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -18,9 +20,7 @@ import org.springframework.amqp.rabbit.annotation.RabbitHandler;
...
@@ -18,9 +20,7 @@ import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
/**
/**
...
@@ -33,7 +33,6 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -33,7 +33,6 @@ import lombok.extern.slf4j.Slf4j;
public
class
WxGroupSendTextListener
{
public
class
WxGroupSendTextListener
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
WxGroupSendTextListener
.
class
);
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
WxGroupSendTextListener
.
class
);
@Autowired
@Autowired
private
BookKeywordBiz
bookKeywordBiz
;
private
BookKeywordBiz
bookKeywordBiz
;
@Autowired
@Autowired
...
@@ -42,6 +41,8 @@ public class WxGroupSendTextListener {
...
@@ -42,6 +41,8 @@ public class WxGroupSendTextListener {
private
BookClockKeywordBiz
bookClockKeywordBiz
;
private
BookClockKeywordBiz
bookClockKeywordBiz
;
@Autowired
@Autowired
private
BookClockCheck
bookClockCheck
;
private
BookClockCheck
bookClockCheck
;
@Autowired
private
RiddleRecordBiz
riddleRecordBiz
;
/**
/**
* 接收微信用户进群消息
* 接收微信用户进群消息
...
@@ -57,16 +58,19 @@ public class WxGroupSendTextListener {
...
@@ -57,16 +58,19 @@ public class WxGroupSendTextListener {
List
<
String
>
allRobotWxIds
=
wechatGroupConsr
.
listAllRobotWxId
();
List
<
String
>
allRobotWxIds
=
wechatGroupConsr
.
listAllRobotWxId
();
if
(!
ListUtils
.
isEmpty
(
allRobotWxIds
)
&&
!
allRobotWxIds
.
contains
(
wechatUserId
)
&&
!
StringUtil
.
isEmpty
(
sendTextDTO
.
getTextContent
()))
{
if
(!
ListUtils
.
isEmpty
(
allRobotWxIds
)
&&
!
allRobotWxIds
.
contains
(
wechatUserId
)
&&
!
StringUtil
.
isEmpty
(
sendTextDTO
.
getTextContent
()))
{
BookClockInfoDTO
bookClockInfoDTO
=
bookClockCheck
.
checkKeywordIsClock
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
());
BookClockInfoDTO
bookClockInfoDTO
=
bookClockCheck
.
checkKeywordIsClock
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
());
if
(
null
!=
bookClockInfoDTO
){
if
(
null
!=
bookClockInfoDTO
&&
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
sendTextDTO
.
getCode
())
){
bookClockKeywordBiz
.
sendKeywordMessage
(
bookClockInfoDTO
,
wechatUserId
,
sendTextDTO
.
getWechatGroupId
(),
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
bookClockKeywordBiz
.
sendKeywordMessage
(
bookClockInfoDTO
,
wechatUserId
,
sendTextDTO
.
getWechatGroupId
(),
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
}
else
{
}
else
{
final
long
l
=
System
.
currentTimeMillis
();
final
long
l
=
System
.
currentTimeMillis
();
bookKeywordBiz
.
sendKeywordMessage
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
(),
wechatUserId
,
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
());
bookKeywordBiz
.
sendKeywordMessage
(
sendTextDTO
.
getTextContent
().
trim
(),
sendTextDTO
.
getWechatGroupId
(),
wechatUserId
,
sendTextDTO
.
getWxId
(),
sendTextDTO
.
getIp
()
,
sendTextDTO
.
getCode
()
);
log
.
info
(
"[接收用户发送文本消息] 总耗时:{}ms "
,
System
.
currentTimeMillis
()
-
l
);
log
.
info
(
"[接收用户发送文本消息] 总耗时:{}ms "
,
System
.
currentTimeMillis
()
-
l
);
}
}
//猜谜语
riddleRecordBiz
.
riddleProcess
(
sendTextDTO
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"接收用户发送文本消息失败"
+
e
.
getMessage
(),
e
);
LOGGER
.
error
(
"接收用户发送文本消息失败"
+
e
.
getMessage
(),
e
);
}
}
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/push/biz/impl/PushBizImpl.java
View file @
ab5f9095
...
@@ -320,7 +320,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -320,7 +320,7 @@ public class PushBizImpl implements PushBiz {
Integer
itemType
=
pushItem
.
getItemType
();
Integer
itemType
=
pushItem
.
getItemType
();
if
(
ItemTypeEnum
.
TEXT
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
TEXT
.
value
.
equals
(
itemType
))
{
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setGroupId
(
groupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
groupId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setAltId
(
altId
);
sendTextMessageVO
.
setContent
(
pushItem
.
getTextContent
());
sendTextMessageVO
.
setContent
(
pushItem
.
getTextContent
());
sendTextMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendTextMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
...
@@ -331,7 +331,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -331,7 +331,7 @@ public class PushBizImpl implements PushBiz {
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setDescription
(
pushItem
.
getLinkDescription
());
sendArticleMessageVO
.
setDescription
(
pushItem
.
getLinkDescription
());
sendArticleMessageVO
.
setGroupId
(
groupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
groupId
);
String
url
=
pushItem
.
getLinkUrl
();
String
url
=
pushItem
.
getLinkUrl
();
if
(
url
.
contains
(
"?"
))
{
if
(
url
.
contains
(
"?"
))
{
url
=
url
+
"&"
+
otherUrl
;
url
=
url
+
"&"
+
otherUrl
;
...
@@ -359,7 +359,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -359,7 +359,7 @@ public class PushBizImpl implements PushBiz {
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setAltId
(
altId
);
sendArticleMessageVO
.
setDescription
(
appDto
.
getTypeName
());
sendArticleMessageVO
.
setDescription
(
appDto
.
getTypeName
());
sendArticleMessageVO
.
setGroupId
(
groupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
groupId
);
// 处理链接地址
// 处理链接地址
String
endUrl
=
pushItem
.
getAppUrl
()
+
"&"
+
otherUrl
;
String
endUrl
=
pushItem
.
getAppUrl
()
+
"&"
+
otherUrl
;
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
...
@@ -381,7 +381,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -381,7 +381,7 @@ public class PushBizImpl implements PushBiz {
if
(
productDto
.
getProductTypeDto
()
!=
null
)
{
if
(
productDto
.
getProductTypeDto
()
!=
null
)
{
sendArticleMessageVO
.
setDescription
(
productDto
.
getProductTypeDto
().
getTypeName
());
sendArticleMessageVO
.
setDescription
(
productDto
.
getProductTypeDto
().
getTypeName
());
}
}
sendArticleMessageVO
.
setGroupId
(
groupId
);
sendArticleMessageVO
.
set
Wx
GroupId
(
groupId
);
// 处理链接地址
// 处理链接地址
String
endUrl
=
pushItem
.
getProductUrl
()
+
"&"
+
otherUrl
;
String
endUrl
=
pushItem
.
getProductUrl
()
+
"&"
+
otherUrl
;
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
...
@@ -399,7 +399,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -399,7 +399,7 @@ public class PushBizImpl implements PushBiz {
if
(
ItemTypeEnum
.
IMAGE
.
value
.
equals
(
itemType
))
{
if
(
ItemTypeEnum
.
IMAGE
.
value
.
equals
(
itemType
))
{
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setAltId
(
altId
);
sendPicMessageVO
.
setGroupId
(
groupId
);
sendPicMessageVO
.
set
Wx
GroupId
(
groupId
);
sendPicMessageVO
.
setPicUrl
(
pushItem
.
getImageUrl
());
sendPicMessageVO
.
setPicUrl
(
pushItem
.
getImageUrl
());
sendPicMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendPicMessageVO
.
setPushGroupRecordId
(
pushGroupRecordId
);
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
sendPicMessageVO
.
setIp
(
findIp
(
groupId
));
...
@@ -980,7 +980,7 @@ public class PushBizImpl implements PushBiz {
...
@@ -980,7 +980,7 @@ public class PushBizImpl implements PushBiz {
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setContent
(
content
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setAltId
(
robotId
);
sendTextMessageVO
.
setGroupId
(
weixinGroupId
);
sendTextMessageVO
.
set
Wx
GroupId
(
weixinGroupId
);
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
sendTextMessageVO
.
setIp
(
findIp
(
weixinGroupId
));
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
LOGGER
.
info
(
"发送早晚报"
+
sendTextMessageVO
.
toString
());
LOGGER
.
info
(
"发送早晚报"
+
sendTextMessageVO
.
toString
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/riddle/biz/RiddleRecordBiz.java
0 → 100644
View file @
ab5f9095
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 @
ab5f9095
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.SendMessageTypeEnum
;
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
;
}
if
(!
SendMessageTypeEnum
.
GROUP
.
getCode
().
equals
(
sendTextDTO
.
getCode
()))
{
//非群消息不处理
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
.
setGroupId
(
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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 @
ab5f9095
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/java/com/pcloud/book/util/properties/BookProps.java
View file @
ab5f9095
...
@@ -34,8 +34,7 @@ public class BookProps {
...
@@ -34,8 +34,7 @@ public class BookProps {
*/
*/
private
static
String
jisuAppKey
;
private
static
String
jisuAppKey
;
@Value
(
"group.luck.url"
)
private
static
String
systemEnv
;
private
String
groupLuckUrl
;
public
static
String
getJisuAppKey
()
{
public
static
String
getJisuAppKey
()
{
return
jisuAppKey
;
return
jisuAppKey
;
...
@@ -73,11 +72,13 @@ public class BookProps {
...
@@ -73,11 +72,13 @@ public class BookProps {
BookProps
.
appCode
=
appCode
;
BookProps
.
appCode
=
appCode
;
}
}
public
String
getGroupLuckUrl
()
{
return
groupLuckUrl
;
public
static
String
getSystemEnv
()
{
return
systemEnv
;
}
}
public
void
setGroupLuckUrl
(
String
groupLuckUrl
)
{
@Value
(
"${system.env}"
)
this
.
groupLuckUrl
=
groupLuckUrl
;
public
void
setSystemEnv
(
String
systemEnv
)
{
BookProps
.
systemEnv
=
systemEnv
;
}
}
}
}
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingDetailFileMapper.xml
0 → 100644
View file @
ab5f9095
<?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.advertising.dao.impl.AdvertisingDetailFileDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.advertising.entity.AdvertisingDetailFile"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"ad_id"
property=
"adId"
jdbcType=
"BIGINT"
/>
<result
column=
"file_id"
property=
"fileId"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_convert_state"
property=
"fileConvertState"
jdbcType=
"INTEGER"
/>
<result
column=
"file_size"
property=
"fileSize"
jdbcType=
"BIGINT"
/>
<result
column=
"file_name"
property=
"fileName"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_duration"
property=
"fileDuration"
jdbcType=
"BIGINT"
/>
<result
column=
"file_url"
property=
"fileUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_pilot_second"
property=
"filePilotSecond"
jdbcType=
"BIGINT"
/>
<result
column=
"file_pilot_url"
property=
"filePilotUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_pilot_finish_tip"
property=
"filePilotFinishTip"
jdbcType=
"VARCHAR"
/>
<result
column=
"title"
property=
"title"
jdbcType=
"VARCHAR"
/>
<result
column=
"cover_pic"
property=
"coverPic"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, ad_id, file_id, file_convert_state, file_size, file_name, file_duration, file_url,
file_pilot_second, file_pilot_url, file_pilot_finish_tip, title, cover_pic, create_time, update_time
</sql>
<select
id=
"getByAdId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from advertising_detail_file
where ad_id = #{adId,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByAdId"
parameterType=
"Long"
>
delete from advertising_detail_file
where ad_id = #{adId,jdbcType=BIGINT}
</delete>
<insert
id=
"batchInsert"
useGeneratedKeys=
"true"
parameterType=
"java.util.List"
keyProperty=
"id"
>
insert into advertising_detail_file (
ad_id, file_id,
file_convert_state, file_size, file_name,
file_duration, file_url, file_pilot_second,
file_pilot_url, file_pilot_finish_tip, title,
cover_pic, create_time)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.adId,jdbcType=BIGINT}, #{item.fileId,jdbcType=VARCHAR},
#{item.fileConvertState,jdbcType=INTEGER}, #{item.fileSize,jdbcType=BIGINT}, #{item.fileName,jdbcType=VARCHAR},
#{item.fileDuration,jdbcType=BIGINT}, #{item.fileUrl,jdbcType=VARCHAR}, #{item.filePilotSecond,jdbcType=BIGINT},
#{item.filePilotUrl,jdbcType=VARCHAR}, #{item.filePilotFinishTip,jdbcType=VARCHAR}, #{item.title,jdbcType=VARCHAR},
#{item.coverPic,jdbcType=VARCHAR}, NOW()
)
</foreach>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pcloud.book.advertising.entity.AdvertisingDetailFile"
>
update advertising_detail_file
<set
>
<if
test=
"fileId != null"
>
file_id = #{fileId,jdbcType=VARCHAR},
</if>
<if
test=
"fileConvertState != null"
>
file_convert_state = #{fileConvertState,jdbcType=INTEGER},
</if>
<if
test=
"fileSize != null"
>
file_size = #{fileSize,jdbcType=BIGINT},
</if>
<if
test=
"fileName != null"
>
file_name = #{fileName,jdbcType=VARCHAR},
</if>
<if
test=
"fileDuration != null"
>
file_duration = #{fileDuration,jdbcType=BIGINT},
</if>
<if
test=
"fileUrl != null"
>
file_url = #{fileUrl,jdbcType=VARCHAR},
</if>
<if
test=
"filePilotSecond != null"
>
file_pilot_second = #{filePilotSecond,jdbcType=BIGINT},
</if>
<if
test=
"filePilotUrl != null"
>
file_pilot_url = #{filePilotUrl,jdbcType=VARCHAR},
</if>
<if
test=
"filePilotFinishTip != null"
>
file_pilot_finish_tip = #{filePilotFinishTip,jdbcType=VARCHAR},
</if>
<if
test=
"title != null"
>
title = #{title,jdbcType=VARCHAR},
</if>
<if
test=
"coverPic != null"
>
cover_pic = #{coverPic,jdbcType=VARCHAR},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/book/Book.Mapper.xml
View file @
ab5f9095
...
@@ -604,6 +604,50 @@
...
@@ -604,6 +604,50 @@
G.UPDATE_TIME DESC
G.UPDATE_TIME DESC
</select>
</select>
<select
id=
"listBookGroup4Channel"
resultType=
"com.pcloud.book.group.vo.ListBook4ChannelVO"
parameterType=
"map"
>
SELECT b.BOOK_ID bookId,b.COVER_IMG coverImg, bg.id bookGroupId ,b.ISBN isbn,b.BOOK_NAME bookName,CONCAT('BK',b.BOOK_ID) bookNumber FROM `book_group` bg
LEFT JOIN book b ON bg.book_id = b.BOOK_ID
LEFT JOIN book_fund bf ON bg.book_id = bf.BOOK_ID AND bf.END_TIME
<![CDATA[ > ]]>
NOW() AND bf.START_TIME
<![CDATA[ < ]]>
NOW()
LEFT JOIN book_group_classify bgc ON bg.id = bgc.book_group_id
WHERE bg.channel_id = #{channelId}
<if
test=
"keywords != null"
>
AND (b.ISBN like CONCAT('%',#{keywords},'%') OR b.BOOK_NAME like CONCAT('%',#{keywords},'%') OR bg.group_qrcode_name like CONCAT('%',#{keywords},'%'))
</if>
<if
test=
"isFundBook != null and isFundBook == 1"
>
AND bf.BOOK_FUND_ID IS NOT NULL
</if>
<if
test=
"startTime != null "
>
AND bg.create_time
>
= #{startTime}
</if>
<if
test=
"endTime != null "
>
AND bg.create_time
<
= #{endTime}
</if>
AND bgc.id is not null
AND b.BOOK_ID is not null
AND b.IS_DELETE = 0
AND bg.IS_DELETE = 0
AND bgc.is_delete = 0
GROUP BY b.BOOK_ID
ORDER BY bg.create_time DESC
</select>
<select
id=
"getBookGroupInfo4Channel"
resultType=
"com.pcloud.book.group.vo.ListBook4ChannelVO"
parameterType=
"map"
>
SELECT b.BOOK_ID bookId,b.COVER_IMG coverImg, bg.id bookGroupId ,b.ISBN isbn,b.BOOK_NAME bookName,CONCAT('BK',b.BOOK_ID) bookNumber FROM `book_group` bg
LEFT JOIN book b ON bg.book_id = b.BOOK_ID
LEFT JOIN book_fund bf ON bg.book_id = bf.BOOK_ID
LEFT JOIN book_group_classify bgc ON bg.id = bgc.book_group_id
WHERE bg.id in
<foreach
collection=
"bookGroupIds"
index=
"i"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
AND bgc.id is not null
AND b.BOOK_ID is not null
AND b.IS_DELETE = 0
AND bg.IS_DELETE = 0
AND bgc.is_delete = 0
GROUP BY b.BOOK_ID
</select>
<!-- 获取社群书列表(编辑) -->
<!-- 获取社群书列表(编辑) -->
<select
id=
"listSimpleBookGroup4Adviser"
resultMap=
"bookMap"
parameterType=
"map"
>
<select
id=
"listSimpleBookGroup4Adviser"
resultMap=
"bookMap"
parameterType=
"map"
>
SELECT
SELECT
...
...
pcloud-service-book/src/main/resources/mapper/group/BookGroupClassify.Mapper.xml
View file @
ab5f9095
...
@@ -159,7 +159,7 @@
...
@@ -159,7 +159,7 @@
product_id productId,
product_id productId,
product_spec_id productSpecId,
product_spec_id productSpecId,
change_number changeNumber,
change_number changeNumber,
create_user
create_user
createUser
from
from
book_group_classify
book_group_classify
where
where
...
@@ -310,10 +310,31 @@
...
@@ -310,10 +310,31 @@
q.id groupQrcodeId,
q.id groupQrcodeId,
c.has_open_learning_report hasOpenLearningReport,
c.has_open_learning_report hasOpenLearningReport,
q.weixin_qrcode_id weixinQrcodeId,
q.weixin_qrcode_id weixinQrcodeId,
q.qrcode_url qrCodeUrl
q.qrcode_url qrCodeUrl,
g.join_group_type joinGroupType
FROM
book_group_classify c
JOIN book_group_qrcode q ON c.id = q.classify_id
JOIN book_group g ON c.book_group_id = g.id
WHERE q.weixin_group_id = #{_parameter}
LIMIT 1
</select>
<select
id=
"listClassifyQrcodeInfo"
resultType=
"GroupClassifyQrcodeDTO"
parameterType=
"list"
>
select
c.id classifyId,
c.create_user adviserId,
c.book_id bookId,
c.channel_id channelId,
c.book_group_id bookGroupId,
c.price price,
c.has_open_learning_report hasOpenLearningReport
from
from
book_group_classify c join book_group_qrcode q on c.id = q.classify_id
book_group_classify c
and q.weixin_group_id = #{_parameter} limit 1
where c.id in
<foreach
collection=
"list"
open=
"("
separator=
","
close=
")"
item=
"item"
>
#{item}
</foreach>
</select>
</select>
...
@@ -823,4 +844,19 @@
...
@@ -823,4 +844,19 @@
group by c.id
group by c.id
order by c.id desc
order by c.id desc
</select>
</select>
<!--拖动排序-->
<update
id=
"dragSortClassify"
parameterType=
"map"
>
update book_group_classify
set rank = case
<foreach
collection=
"classifyIds"
index=
"index"
item=
"classifyId"
>
when id = #{classifyId} then #{index} + 1
</foreach>
end,
update_time = now()
where id in
<foreach
collection=
"classifyIds"
item=
"classifyId"
separator=
","
open=
"("
close=
")"
>
#{classifyId}
</foreach>
</update>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/BookGroupMapper.xml
View file @
ab5f9095
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BIT"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BIT"
/>
<result
column=
"is_show_book_name"
property=
"isShowBookName"
jdbcType=
"BOOLEAN"
/>
<result
column=
"is_show_book_name"
property=
"isShowBookName"
jdbcType=
"BOOLEAN"
/>
<result
column=
"join_group_type"
property=
"joinGroupType"
jdbcType=
"INTEGER"
/>
</resultMap>
</resultMap>
<resultMap
id=
"BookGroupDTO"
type=
"com.pcloud.book.group.dto.BookGroupDTO"
>
<resultMap
id=
"BookGroupDTO"
type=
"com.pcloud.book.group.dto.BookGroupDTO"
>
...
@@ -45,13 +46,14 @@
...
@@ -45,13 +46,14 @@
<result
column=
"BOOK_NAME"
property=
"bookName"
jdbcType=
"VARCHAR"
/>
<result
column=
"BOOK_NAME"
property=
"bookName"
jdbcType=
"VARCHAR"
/>
<result
column=
"book_clock_info_id"
property=
"bookClockInfoId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_clock_info_id"
property=
"bookClockInfoId"
jdbcType=
"BIGINT"
/>
<result
column=
"is_show_book_name"
property=
"isShowBookName"
jdbcType=
"BOOLEAN"
/>
<result
column=
"is_show_book_name"
property=
"isShowBookName"
jdbcType=
"BOOLEAN"
/>
<result
column=
"join_group_type"
property=
"joinGroupType"
jdbcType=
"INTEGER"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, book_id, channel_id, scene_id, group_qrcode_url, group_qrcode_name, pro_label_id, dep_label_id,
id, book_id, channel_id, scene_id, group_qrcode_url, group_qrcode_name, pro_label_id, dep_label_id,
pur_label_id, join_title, join_slogan, personal_qrcode_url, product_id, create_user,
pur_label_id, join_title, join_slogan, personal_qrcode_url, product_id, create_user,
create_time,
create_time,
update_time, is_delete, is_show_book_name
update_time, is_delete, is_show_book_name
,join_group_type
</sql>
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
...
@@ -86,6 +88,7 @@
...
@@ -86,6 +88,7 @@
and book_id = #{bookId,jdbcType=BIGINT}
and book_id = #{bookId,jdbcType=BIGINT}
and channel_id = #{channelId,jdbcType=BIGINT}
and channel_id = #{channelId,jdbcType=BIGINT}
and create_user = #{adviserId,jdbcType=BIGINT}
and create_user = #{adviserId,jdbcType=BIGINT}
ORDER BY create_time ASC limit 1
</select>
</select>
<select
id=
"getBookGroupCount"
resultType=
"Integer"
parameterType=
"Long"
>
<select
id=
"getBookGroupCount"
resultType=
"Integer"
parameterType=
"Long"
>
...
@@ -223,6 +226,9 @@
...
@@ -223,6 +226,9 @@
<if
test=
"sceneId != null and sceneId != 0"
>
<if
test=
"sceneId != null and sceneId != 0"
>
scene_id = #{sceneId},
scene_id = #{sceneId},
</if>
</if>
<if
test=
"joinGroupType != null"
>
join_group_type = #{joinGroupType},
</if>
update_time = NOW(),
update_time = NOW(),
</set>
</set>
where id = #{id,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
...
...
pcloud-service-book/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
View file @
ab5f9095
...
@@ -18,11 +18,12 @@
...
@@ -18,11 +18,12 @@
<result
column=
"update_user"
property=
"updateUser"
jdbcType=
"BIGINT"
/>
<result
column=
"update_user"
property=
"updateUser"
jdbcType=
"BIGINT"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BIT"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BIT"
/>
<result
column=
"riddle_open"
property=
"riddleOpen"
jdbcType=
"BIT"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<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,
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>
</sql>
<update
id=
"updateGroupQrcode"
parameterType=
"map"
>
<update
id=
"updateGroupQrcode"
parameterType=
"map"
>
...
@@ -176,7 +177,7 @@
...
@@ -176,7 +177,7 @@
<select
id=
"getBaseById"
parameterType=
"Long"
resultType=
"GroupQrcodeBaseInfoVO"
>
<select
id=
"getBaseById"
parameterType=
"Long"
resultType=
"GroupQrcodeBaseInfoVO"
>
select
select
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl
, weixin_group_id as weixinGroupId
from
from
book_group_qrcode
book_group_qrcode
where
where
...
@@ -498,4 +499,46 @@
...
@@ -498,4 +499,46 @@
#{item}
#{item}
</foreach>
</foreach>
</select>
</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
WHERE
q.create_user = #{partyId}
AND b.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>
ORDER BY q.id DESC
</select>
<update
id=
"updateRiddleOpenStatus"
parameterType=
"map"
>
UPDATE book_group_qrcode
SET riddle_open = #{status}
WHERE
id = #{qrcodeId}
</update>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/JoinGroupCipher.xml
0 → 100644
View file @
ab5f9095
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.group.dao.impl.JoinGroupCipherDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.group.entity.JoinGroupCipher"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"cipher"
property=
"cipher"
jdbcType=
"VARCHAR"
/>
<result
column=
"classify_id"
property=
"classifyId"
jdbcType=
"BIGINT"
/>
<result
column=
"qrcode_id"
property=
"qrcodeId"
jdbcType=
"BIGINT"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"wx_id"
property=
"wxId"
jdbcType=
"VARCHAR"
/>
<result
column=
"has_used"
property=
"hasUsed"
jdbcType=
"BOOLEAN"
/>
<result
column=
"alt_id"
property=
"altId"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, cipher, classify_id, qrcode_id, create_time, wechat_user_id, update_time, wx_id, has_used, alt_id
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.group.entity.JoinGroupCipher"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into join_group_cipher
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
cipher,
classify_id,
qrcode_id,
create_time,
wechat_user_id,
has_used,
alt_id
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{cipher,jdbcType=VARCHAR},
#{classifyId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
now(),
#{wechatUserId,jdbcType=BIGINT},
0,
#{altId,jdbcType=VARCHAR}
</trim>
</insert>
<!--获取基本信息-->
<select
id=
"getByWechatUserId"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from join_group_cipher
where wechat_user_id=#{wechatUserId} and
classify_id=#{classifyId}
</select>
<!--根据暗号获取-->
<select
id=
"getByCipher"
parameterType=
"String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from join_group_cipher
where cipher=#{cipher} limit 1
</select>
<!--根据暗号获取包含bookGroupId-->
<select
id=
"getDTOByCipher"
parameterType=
"String"
resultType=
"com.pcloud.book.group.dto.JoinGroupCipherDTO"
>
select
a.id, cipher, a.classify_id as classifyId, a.qrcode_id qrcodeId, a.wechat_user_id as wechatUserId, a.wx_id as wxId,
a.has_used as hasUsed, b.book_group_id as bookGroupId
from join_group_cipher a left join book_group_classify b on a.classify_id = b.id
where a.cipher=#{cipher} limit 1
</select>
<!--更新暗号状态为已使用-->
<update
id=
"updateCipherStateToUsed"
parameterType=
"map"
>
update join_group_cipher set
has_used=1,
wx_id=#{wxId},
update_time=now()
where cipher=#{cipher}
</update>
<!--根据微信id和机器人id获取分类集合-->
<select
id=
"getClassifyIdsByWxIdAndAltId"
parameterType=
"map"
resultType=
"com.pcloud.book.group.dto.JoinGroupCipherDTO"
>
select a.classify_id as classifyId, a.qrcode_id qrcodeId, b.book_group_id as bookGroupId from join_group_cipher a
left join book_group_classify b on a.classify_id = b.id where
a.has_used=1
and a.alt_id=#{altId}
and a.wx_id=#{wxId}
</select>
<!--更新二维码-->
<update
id=
"updateQrcodeId"
parameterType=
"map"
>
update join_group_cipher set
qrcode_id=#{qrcodeId}
where cipher=#{cipher}
and wx_id=#{wxId}
</update>
<!--获取用户支付金额-->
<select
id=
"getPayPrice"
parameterType=
"map"
resultType=
"decimal"
>
SELECT
price
FROM
join_group_cipher c
LEFT JOIN book_classify_buy_record r ON c.classify_id = r.classify_id
AND c.wechat_user_id = r.wechat_user_id
WHERE
c.qrcode_id = #{qrcodeId}
AND c.wx_id = #{wxId}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/TempletRelevance.xml
0 → 100644
View file @
ab5f9095
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.group.dao.impl.TempletRelevanceDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.group.entity.TempletRelevance"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"templet_id"
property=
"templetId"
jdbcType=
"BIGINT"
/>
<result
column=
"large_templet"
property=
"largeTemplet"
jdbcType=
"INTEGER"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, templet_id, large_templet
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.group.entity.TempletRelevance"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into templet_relevance
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
templet_id,
large_templet
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{templetId,jdbcType=BIGINT},
#{largeTemplet,jdbcType=INTEGER}
</trim>
</insert>
<!--根据模板id查询大类id-->
<select
id=
"getByTempletId"
parameterType=
"Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from templet_relevance
where templet_id=#{templetId} order by id desc limit 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/WeixinQrcode.Mapper.xml
View file @
ab5f9095
...
@@ -275,4 +275,12 @@
...
@@ -275,4 +275,12 @@
where generation = #{_parameter}
where generation = #{_parameter}
</select>
</select>
<!--根据状态获取群数量-->
<select
id=
"countByState"
parameterType=
"map"
resultType=
"Integer"
>
select count(1) from weixin_qrcode t where t.robot_wx_id in
<foreach
collection=
"altIds"
item=
"item"
index=
"index"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
and use_state=#{state}
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/keywords/BookKeyword.Mapper.xml
View file @
ab5f9095
...
@@ -177,6 +177,33 @@
...
@@ -177,6 +177,33 @@
order by set_type desc, matching_rule desc, bk.id desc limit 1
order by set_type desc, matching_rule desc, bk.id desc limit 1
</select>
</select>
<select
id=
"getKeywordIds"
resultType=
"ReplyKeywordDTO"
parameterType=
"map"
>
SELECT
k.id keywordId,
k.keywords,
k.reply_type replyType,
k.content,
k.description,
k.link_url linkUrl,
k.pic_url picUrl,
bk.is_warehouse as isWarehouse,
bk.warehouse_id as warehouseId,
bk.classify_id as classifyId,
bk.book_group_id as bookGroupId,
k.reply_type replyType
FROM
book_keyword bk
JOIN
keyword k ON bk.keyword_id = k.id
WHERE
bk.is_delete = 0 AND k.is_delete = 0
AND classify_id in (0, ${classifyId})
AND book_group_id in (${bookGroupId})
AND ((k.keywords = #{content} and matching_rule = 1 ) or (k.keywords like
concat('%',#{content},'%') and matching_rule = 0))
order by set_type desc, matching_rule desc, bk.id desc
</select>
<select
id=
"checkKeyword"
resultType=
"Boolean"
parameterType=
"map"
>
<select
id=
"checkKeyword"
resultType=
"Boolean"
parameterType=
"map"
>
SELECT
SELECT
count(1)
count(1)
...
...
pcloud-service-book/src/main/resources/mapper/riddle/RiddleMapper.xml
0 → 100644
View file @
ab5f9095
<?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 @
ab5f9095
<?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 @
ab5f9095
<?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