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
ae0e84fb
Commit
ae0e84fb
authored
Oct 10, 2019
by
高鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-1001733' into 'master'
10017331V1入群优化 See merge request rays/pcloud-book!189
parents
2d7d5307
db50015f
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
2278 additions
and
65 deletions
+2278
-65
BookDto.java
...-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
+42
-1
BookGroupDTO.java
...src/main/java/com/pcloud/book/group/dto/BookGroupDTO.java
+28
-3
DayCountDTO.java
.../src/main/java/com/pcloud/book/group/dto/DayCountDTO.java
+45
-0
JoinGroupTypeEnum.java
...n/java/com/pcloud/book/group/enums/JoinGroupTypeEnum.java
+35
-0
BookGroupService.java
.../java/com/pcloud/book/group/service/BookGroupService.java
+29
-10
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+24
-0
BookGroupBiz.java
...src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
+76
-8
BookGroupBizImpl.java
...java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
+330
-5
BookGroupClassifyBizImpl.java
.../pcloud/book/group/biz/impl/BookGroupClassifyBizImpl.java
+5
-1
BookGroupCipherUserDao.java
...ava/com/pcloud/book/group/dao/BookGroupCipherUserDao.java
+33
-0
BookGroupClassifyDao.java
.../java/com/pcloud/book/group/dao/BookGroupClassifyDao.java
+1
-0
BookGroupDao.java
...src/main/java/com/pcloud/book/group/dao/BookGroupDao.java
+26
-0
BookGroupServeDao.java
...ain/java/com/pcloud/book/group/dao/BookGroupServeDao.java
+14
-0
GroupQrcodeDao.java
...c/main/java/com/pcloud/book/group/dao/GroupQrcodeDao.java
+2
-0
JoinGroupCipherDao.java
...in/java/com/pcloud/book/group/dao/JoinGroupCipherDao.java
+7
-0
BookGroupCipherUserDaoImpl.java
...cloud/book/group/dao/impl/BookGroupCipherUserDaoImpl.java
+39
-0
BookGroupClassifyDaoImpl.java
.../pcloud/book/group/dao/impl/BookGroupClassifyDaoImpl.java
+5
-0
BookGroupDaoImpl.java
...java/com/pcloud/book/group/dao/impl/BookGroupDaoImpl.java
+27
-6
BookGroupServeDaoImpl.java
...com/pcloud/book/group/dao/impl/BookGroupServeDaoImpl.java
+31
-0
GroupQrcodeDaoImpl.java
...va/com/pcloud/book/group/dao/impl/GroupQrcodeDaoImpl.java
+5
-0
JoinGroupCipherDaoImpl.java
...om/pcloud/book/group/dao/impl/JoinGroupCipherDaoImpl.java
+18
-0
BookGroupDTO.java
...src/main/java/com/pcloud/book/group/dto/BookGroupDTO.java
+56
-3
OwnAltQrcodeInfoDTO.java
...n/java/com/pcloud/book/group/dto/OwnAltQrcodeInfoDTO.java
+24
-0
BookGroup.java
...src/main/java/com/pcloud/book/group/entity/BookGroup.java
+57
-0
BookGroupCipherUser.java
...ava/com/pcloud/book/group/entity/BookGroupCipherUser.java
+69
-0
BookGroupServe.java
...ain/java/com/pcloud/book/group/entity/BookGroupServe.java
+129
-0
JoinGroupCipher.java
...in/java/com/pcloud/book/group/entity/JoinGroupCipher.java
+12
-0
BookGroupFacade.java
...in/java/com/pcloud/book/group/facade/BookGroupFacade.java
+67
-11
BookGroupFacadeImpl.java
...om/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
+94
-2
BookGroupServiceImpl.java
.../pcloud/book/group/service/impl/BookGroupServiceImpl.java
+31
-10
ClassifyAndGroupCountVO.java
...ava/com/pcloud/book/group/vo/ClassifyAndGroupCountVO.java
+12
-0
FriendsVO.java
...ook/src/main/java/com/pcloud/book/group/vo/FriendsVO.java
+211
-0
GroupQrcode4ClassifyVO.java
...java/com/pcloud/book/group/vo/GroupQrcode4ClassifyVO.java
+12
-0
BookKeywordBiz.java
...ain/java/com/pcloud/book/keywords/biz/BookKeywordBiz.java
+6
-0
BookGuideBizImpl.java
...a/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
+12
-0
BookKeywordBizImpl.java
...com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
+212
-1
BookKeywordDao.java
...ain/java/com/pcloud/book/keywords/dao/BookKeywordDao.java
+17
-0
BookKeywordDaoImpl.java
...com/pcloud/book/keywords/dao/impl/BookKeywordDaoImpl.java
+18
-0
KeywordDTO.java
...rc/main/java/com/pcloud/book/keywords/dto/KeywordDTO.java
+6
-0
Book.Mapper.xml
...rvice-book/src/main/resources/mapper/book/Book.Mapper.xml
+3
-1
BookGroupCipherUser.xml
...k/src/main/resources/mapper/group/BookGroupCipherUser.xml
+90
-0
BookGroupClassify.Mapper.xml
.../main/resources/mapper/group/BookGroupClassify.Mapper.xml
+19
-1
BookGroupMapper.xml
...-book/src/main/resources/mapper/group/BookGroupMapper.xml
+77
-1
BookGroupServe.xml
...e-book/src/main/resources/mapper/group/BookGroupServe.xml
+86
-0
GroupQrcode.Mapper.xml
...ok/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
+31
-0
JoinGroupCipher.xml
...-book/src/main/resources/mapper/group/JoinGroupCipher.xml
+24
-1
BookKeyword.Mapper.xml
...src/main/resources/mapper/keywords/BookKeyword.Mapper.xml
+81
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/book/dto/BookDto.java
View file @
ae0e84fb
...
...
@@ -558,6 +558,20 @@ public class BookDto extends BaseDto {
*/
private
String
phone
;
/**
* 进群方式:1群二维码,2客服机器人
*/
private
Integer
joinGroupType
;
/**
* 好友人数
*/
private
Integer
friendsCount
;
/**
* 社群码暗号
*/
private
String
bookGroupCipher
;
public
String
getQrRemark
()
{
return
qrRemark
;
}
...
...
@@ -1490,6 +1504,30 @@ public class BookDto extends BaseDto {
this
.
phone
=
phone
;
}
public
Integer
getJoinGroupType
()
{
return
joinGroupType
;
}
public
void
setJoinGroupType
(
Integer
joinGroupType
)
{
this
.
joinGroupType
=
joinGroupType
;
}
public
Integer
getFriendsCount
()
{
return
friendsCount
;
}
public
void
setFriendsCount
(
Integer
friendsCount
)
{
this
.
friendsCount
=
friendsCount
;
}
public
String
getBookGroupCipher
()
{
return
bookGroupCipher
;
}
public
void
setBookGroupCipher
(
String
bookGroupCipher
)
{
this
.
bookGroupCipher
=
bookGroupCipher
;
}
@Override
public
String
toString
()
{
return
"BookDto{"
+
...
...
@@ -1602,6 +1640,9 @@ public class BookDto extends BaseDto {
", outNum="
+
outNum
+
", outRate="
+
outRate
+
", phone='"
+
phone
+
'\''
+
'}'
;
", joinGroupType="
+
joinGroupType
+
", friendsCount="
+
friendsCount
+
", bookGroupCipher='"
+
bookGroupCipher
+
'\''
+
"} "
+
super
.
toString
();
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/dto/BookGroupDTO.java
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dto
;
import
java.io.Serializable
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.pcloud.book.book.dto.BookDto
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 社群书群二维码DTO
* @author PENG
...
...
@@ -120,6 +121,11 @@ public class BookGroupDTO implements Serializable {
private
String
url
;
/**
* 进群方式:1群二维码,2客服机器人
*/
private
Integer
joinGroupType
;
public
String
getUrl
()
{
return
url
;
}
...
...
@@ -290,6 +296,22 @@ public class BookGroupDTO implements Serializable {
this
.
bookInfo
=
bookInfo
;
}
public
Boolean
getDelete
()
{
return
isDelete
;
}
public
void
setDelete
(
Boolean
delete
)
{
isDelete
=
delete
;
}
public
Integer
getJoinGroupType
()
{
return
joinGroupType
;
}
public
void
setJoinGroupType
(
Integer
joinGroupType
)
{
this
.
joinGroupType
=
joinGroupType
;
}
@Override
public
String
toString
()
{
return
"BookGroupDTO{"
+
...
...
@@ -313,6 +335,8 @@ public class BookGroupDTO implements Serializable {
", updateTime="
+
updateTime
+
", isDelete="
+
isDelete
+
", bookInfo="
+
bookInfo
+
"} "
+
super
.
toString
();
", url='"
+
url
+
'\''
+
", joinGroupType="
+
joinGroupType
+
'}'
;
}
}
\ No newline at end of file
pcloud-facade-book/src/main/java/com/pcloud/book/group/dto/DayCountDTO.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
/**
* @描述:日数量统计
* @作者:zhuyajie
* @创建时间:15:58 2019/9/19
* @版本:1.0
*/
public
class
DayCountDTO
extends
BaseDto
{
/**
* 日期
*/
private
String
date
;
/**
* 数量
*/
private
Integer
count
;
public
String
getDate
()
{
return
date
;
}
public
void
setDate
(
String
date
)
{
this
.
date
=
date
;
}
public
Integer
getCount
()
{
return
count
;
}
public
void
setCount
(
Integer
count
)
{
this
.
count
=
count
;
}
@Override
public
String
toString
()
{
return
"DayCountDTO{"
+
"date='"
+
date
+
'\''
+
", count="
+
count
+
'}'
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/enums/JoinGroupTypeEnum.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
enums
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/9/25 15:05
**/
public
enum
JoinGroupTypeEnum
{
/**
* 群二维码
*/
GROUP_QRCODE
(
1
,
"群二维码"
),
/**
* 客服机器人
*/
ROBOT
(
2
,
"客服机器人"
);
private
final
Integer
code
;
private
final
String
name
;
public
Integer
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
private
JoinGroupTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
}
pcloud-facade-book/src/main/java/com/pcloud/book/group/service/BookGroupService.java
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.pcloud.book.group.dto.PersonalQrcodeDTO
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.GroupCipherDTO
;
import
com.pcloud.book.group.dto.GroupUseDTO
;
import
com.pcloud.book.group.dto.PersonalQrcodeDTO
;
import
com.pcloud.book.group.dto.QueryByBookAdviserDTO
;
import
com.pcloud.book.group.dto.ResourceBrowseParamDto
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.StoreFlowInfoDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
org.springframework.cloud.netflix.feign.FeignClient
;
import
org.springframework.http.ResponseEntity
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
import
java.util.Map
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
/**
...
...
@@ -85,5 +91,18 @@ public interface BookGroupService {
@PostMapping
(
"getResourcesBrowseCount"
)
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
Long
>>>
getResourcesBrowseCount
(
@RequestBody
ResourceBrowseParamDto
resourceBrowseParamDto
);
@ApiOperation
(
"社群书日加好友人数"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"bookGroupId"
,
value
=
"bookGroupId"
,
dataType
=
"long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"startDate"
,
value
=
"开始日期"
,
dataType
=
"string"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"endDate"
,
value
=
"结束日期"
,
dataType
=
"string"
,
paramType
=
"query"
)
})
@GetMapping
(
"getBookGroupFriendsCountByDay"
)
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Integer
>>>
getBookGroupFriendsCountByDay
(
@RequestParam
(
"bookGroupId"
)
Long
bookGroupId
,
@RequestParam
(
"startDate"
)
String
startDate
,
@RequestParam
(
"endDate"
)
String
endDate
);
@ApiOperation
(
"将1v1旧数据的关键词全部都干掉,有应用或作品的挂在社群书配置资源里面"
)
@GetMapping
(
"dealSelfBookGroupKeywordToServer"
)
void
dealSelfBookGroupKeywordToServer
();
}
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
ae0e84fb
...
...
@@ -13,10 +13,12 @@ import com.pcloud.wechatgroup.group.dto.RobotReplyDTO;
import
com.pcloud.wechatgroup.group.service.GroupMemberService
;
import
com.pcloud.wechatgroup.message.dto.BrandParamDTO
;
import
com.pcloud.wechatgroup.message.dto.GroupChatCountDTO
;
import
com.pcloud.wechatgroup.message.dto.UserChatCountDTO
;
import
com.pcloud.wechatgroup.message.dto.GroupStatistics
;
import
com.pcloud.wechatgroup.message.service.MessageService
;
import
com.pcloud.wechatgroup.monitor.service.MonitorService
;
import
com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO
;
import
com.pcloud.wechatgroup.selfrobot.dto.UserRobotDTO
;
import
com.pcloud.wechatgroup.selfrobot.service.SelfRobotService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -360,6 +362,28 @@ public class WechatGroupConsr {
return
map
;
}
@ParamLog
(
value
=
"获取可用机器人"
)
public
SelfRobotDTO
getAvailableRobotByBookGroup
(
Long
wechatUserId
,
Integer
largeTemplet
,
Long
bookGroupId
)
{
SelfRobotDTO
selfRobotDTO
=
null
;
try
{
selfRobotDTO
=
ResponseHandleUtil
.
parseResponse
(
selfRobotService
.
getAvailableRobotByBookGroup
(
wechatUserId
,
largeTemplet
,
bookGroupId
),
SelfRobotDTO
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取可用机器人.[getAvailableRobotByBookGroup]:"
+
e
.
getMessage
(),
e
);
}
return
selfRobotDTO
;
}
@ParamLog
(
"1v1入群-用户基本信息/发言统计"
)
public
Map
<
String
,
UserChatCountDTO
>
getUserChatInfoByUserIdRobotId
(
List
<
UserRobotDTO
>
robotDTOList
)
{
Map
<
String
,
UserChatCountDTO
>
map
=
new
HashMap
<>();
try
{
map
=
ResponseHandleUtil
.
parseMapResponse
(
selfRobotService
.
getUserChatInfoByUserIdRobotId
(
robotDTOList
),
String
.
class
,
UserChatCountDTO
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取用户基本信息/发言统计失败"
+
e
.
getMessage
(),
e
);
}
return
map
;
}
@ParamLog
(
"获取群消息数量"
)
public
Map
<
String
,
GroupStatistics
>
getGroupMessageStatistics4AdBrand
(
List
<
BrandParamDTO
>
paramDTOList
)
{
Map
<
String
,
GroupStatistics
>
map
=
new
HashMap
<>();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
biz
;
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.BookGroupDTO
;
import
com.pcloud.book.group.dto.BookGroupStatisticsDTO
;
import
com.pcloud.book.group.dto.ClassifyKeywordDTO
;
import
com.pcloud.book.group.dto.GroupCipherDTO
;
import
com.pcloud.book.group.dto.GroupStoreMyPayDto
;
import
com.pcloud.book.group.dto.GroupUseDTO
;
import
com.pcloud.book.group.dto.JoinGroupCipherDTO
;
import
com.pcloud.book.group.dto.LargeTempletDTO
;
import
com.pcloud.book.group.dto.OwnAltQrcodeInfoDTO
;
import
com.pcloud.book.group.dto.PersonalQrcodeDTO
;
import
com.pcloud.book.group.dto.QrcodeNameAndProIdDTO
;
import
com.pcloud.book.group.dto.ResourceBrowseParamDto
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.vo.*
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.vo.*
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.vo.FriendsVO
;
import
com.pcloud.book.group.vo.GroupIncomeStaticParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.GroupStatisticVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.StatisticVO
;
import
com.pcloud.book.group.vo.TotalRescourceDataVO
;
import
com.pcloud.book.group.vo.WxGroupStatisticVO
;
import
com.pcloud.common.dto.StoreFlowInfoDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
...
...
@@ -281,6 +291,11 @@ public interface BookGroupBiz {
void
deleteBookGroup
(
Long
bookGroupId
);
/**
* 根据社群码id获取个人二维码信息
*/
OwnAltQrcodeInfoDTO
getOwnAltQrcodeInfoDTOByBookGroupId
(
Long
wechatUserId
,
Long
bookGroupId
);
/**
* 根据分类id获取个人二维码信息
*/
OwnAltQrcodeInfoDTO
getOwnAltQrcodeInfoDTOByClassifyId
(
Long
wechatUserId
,
Long
classifyId
);
...
...
@@ -379,6 +394,59 @@ public interface BookGroupBiz {
*/
Map
<
Long
,
Long
>
getResourcesBrowseCount
(
ResourceBrowseParamDto
resourceBrowseParamDto
);
/**
*日加好友人数
* @param bookGroupId
* @param startDate
* @param endDate
* @return
*/
Map
<
String
,
Integer
>
getBookGroupFriendsCountByDay
(
Long
bookGroupId
,
String
startDate
,
String
endDate
);
/**
* 好友数据统计列表
* @param bookGroupId
* @return
*/
PageBeanNew
<
FriendsVO
>
listPageFriendsStatistic
(
Long
bookGroupId
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 批量新增资源配置
*
* @param partyId
* @param bookGroupServes
*/
void
batchAddBookGroupServe
(
Long
partyId
,
List
<
BookGroupServe
>
bookGroupServes
);
/**
* 删除资源配置
*
* @param id
*/
void
deleteBookGroupServe
(
Long
id
);
/**
* 获取资源配置集合
*
* @param bookGroupId
* @return
*/
List
<
BookGroupServe
>
getBookGroupServeList
(
Long
bookGroupId
);
/**
* 获取社群码暗号
*/
String
getBookGroupCipher
();
/**
* 批量更新资源配置
* @param partyId
* @param bookGroupServes
*/
void
batchUpdateBookGroupServe
(
Long
partyId
,
List
<
BookGroupServe
>
bookGroupServes
);
/**
* 将1v1旧数据的关键词全部都干掉,有应用或作品的挂在社群书配置资源里面
*/
void
dealSelfBookGroupKeywordToServer
();
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
View file @
ae0e84fb
...
...
@@ -27,8 +27,10 @@ import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.dao.AppClickRecordDao
;
import
com.pcloud.book.group.dao.AppTouchRecordDao
;
import
com.pcloud.book.group.dao.BookGroupCipherUserDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.BookGroupServeDao
;
import
com.pcloud.book.group.dao.GroupQrcodeDao
;
import
com.pcloud.book.group.dao.JoinGroupCipherDao
;
import
com.pcloud.book.group.dao.TempletRelevanceDao
;
...
...
@@ -40,6 +42,7 @@ import com.pcloud.book.group.dto.BookGroupStatisticsDTO;
import
com.pcloud.book.group.dto.ClassifyDTO
;
import
com.pcloud.book.group.dto.ClassifyKeywordDTO
;
import
com.pcloud.book.group.dto.ClickClassifyDTO
;
import
com.pcloud.book.group.dto.DayCountDTO
;
import
com.pcloud.book.group.dto.GroupCipherDTO
;
import
com.pcloud.book.group.dto.GroupStoreMyPayDto
;
import
com.pcloud.book.group.dto.GroupUseDTO
;
...
...
@@ -51,13 +54,17 @@ import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import
com.pcloud.book.group.dto.ResourceBrowseParamDto
;
import
com.pcloud.book.group.dto.StatisticsIncomeDto
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.book.group.entity.TempletRelevance
;
import
com.pcloud.book.group.enums.CipherTypeEnum
;
import
com.pcloud.book.group.enums.JoinGroupTypeEnum
;
import
com.pcloud.book.group.enums.LargTempletEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.group.vo.ClassifyAndGroupCountVO
;
import
com.pcloud.book.group.vo.ClassifyQrcodeVO
;
import
com.pcloud.book.group.vo.FriendsVO
;
import
com.pcloud.book.group.vo.GroupIncomeStaticParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
...
...
@@ -70,10 +77,12 @@ import com.pcloud.book.group.vo.StatisticVO;
import
com.pcloud.book.group.vo.TotalRescourceDataVO
;
import
com.pcloud.book.group.vo.WxGroupStatisticVO
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.dto.KeywordDTO
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.keywords.vo.ListKeywordVO
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.biz.MessageBiz
;
import
com.pcloud.common.core.constant.ProductTypeConstant
;
...
...
@@ -95,6 +104,7 @@ import com.pcloud.common.utils.QrcodeUtils;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.UUIDUitl
;
import
com.pcloud.common.utils.export.excel.ExcelExportor
;
import
com.pcloud.common.utils.httpclient.UrlUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.zip.CompressUtils
;
import
com.pcloud.facade.tradecenter.dto.ClassifyPayDetailDto
;
...
...
@@ -121,7 +131,9 @@ import com.pcloud.settlementcenter.record.service.SettlementService;
import
com.pcloud.videolesson.schedule.service.ScheduleService
;
import
com.pcloud.wechatgroup.group.dto.GroupMemberStatisDTO
;
import
com.pcloud.wechatgroup.group.service.GroupMemberService
;
import
com.pcloud.wechatgroup.message.dto.UserChatCountDTO
;
import
com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO
;
import
com.pcloud.wechatgroup.selfrobot.dto.UserRobotDTO
;
import
org.apache.commons.collections.MapUtils
;
import
org.slf4j.Logger
;
...
...
@@ -140,6 +152,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -218,8 +231,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Autowired
private
GroupQrcodeBiz
groupQrcodeBiz
;
@Autowired
private
BookGroupServeDao
bookGroupServeDao
;
@Autowired
private
GroupQrcodeDao
groupQrcodeDao
;
@Autowired
private
BookGroupCipherUserDao
bookGroupCipherUserDao
;
@Override
...
...
@@ -450,8 +466,18 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateBookGroup
(
BookGroup
bookGroup
)
throws
BizException
{
if
(
null
==
bookGroup
.
getId
()
||
StringUtil
.
isEmpty
(
bookGroup
.
getGroupQrcodeName
())
||
null
==
bookGroup
.
getProLabelId
()
||
null
==
bookGroup
.
getDepLabelId
()
||
null
==
bookGroup
.
getPurLabelId
()
||
StringUtil
.
isEmpty
(
bookGroup
.
getJoinTitle
())
||
StringUtil
.
isEmpty
(
bookGroup
.
getJoinSlogan
())
)
{
||
null
==
bookGroup
.
getDepLabelId
()
||
null
==
bookGroup
.
getPurLabelId
()
||
bookGroup
.
getJoinGroupType
()
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(
JoinGroupTypeEnum
.
GROUP_QRCODE
.
getCode
().
equals
(
bookGroup
.
getJoinGroupType
())
&&
(
StringUtil
.
isEmpty
(
bookGroup
.
getJoinTitle
())
||
StringUtil
.
isEmpty
(
bookGroup
.
getJoinSlogan
())))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(
JoinGroupTypeEnum
.
ROBOT
.
getCode
().
equals
(
bookGroup
.
getJoinGroupType
())
&&
(
bookGroup
.
getIsInviteGroup
()
==
null
||
StringUtil
.
isEmpty
(
bookGroup
.
getAddFriendGuide
())
||
StringUtil
.
isEmpty
(
bookGroup
.
getCustomerServiceName
())))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
if
(
bookGroup
.
getGroupQrcodeName
().
contains
(
"#"
)){
...
...
@@ -539,6 +565,9 @@ public class BookGroupBizImpl implements BookGroupBiz {
public
Map
<
String
,
Object
>
getBookNameByBookGroupId
(
Long
bookGroupId
)
throws
BizException
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
if
(
bookGroupDTO
!=
null
)
{
result
.
put
(
"joinGroupType"
,
bookGroupDTO
.
getJoinGroupType
());
}
if
(
null
!=
bookGroupDTO
&&
null
!=
bookGroupDTO
.
getBookId
())
{
BookDto
bookDto
=
bookBiz
.
getBaseById
(
bookGroupDTO
.
getBookId
());
if
(
null
!=
bookDto
)
{
...
...
@@ -595,6 +624,9 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
else
{
bookDto
.
setTotalIncome
(
BigDecimal
.
ZERO
);
}
//好友数量
Integer
friendsCount
=
bookGroupCipherUserDao
.
getFriendsCountByBookGroup
(
bookGroupId
);
bookDto
.
setFriendsCount
(
friendsCount
);
}
return
pageBean
;
}
...
...
@@ -698,6 +730,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Integer
bookGroupCount
=
bookGroupDao
.
getBookGroupCount
(
adviserId
);
result
.
put
(
"bookGroupCount"
,
bookGroupCount
);
Integer
friendsCount
=
bookGroupDao
.
getBookGroupFriendsCountByAdviser
(
adviserId
);
result
.
put
(
"friendsCount"
,
friendsCount
);
return
result
;
}
...
...
@@ -1067,7 +1101,10 @@ public class BookGroupBizImpl implements BookGroupBiz {
for
(
BookDto
bookDto
:
bookDtos
)
{
String
bookName
=
null
!=
bookDto
.
getBookName
()
?
StringUtil
.
addBracket
(
bookDto
.
getBookName
())
:
null
;
String
groupQrcodeName
=
bookDto
.
getGroupQrcodeName
();
String
qrcodeUrl
=
bookDto
.
getGroupQrcodeUrl
()
==
null
?
null
:
bookDto
.
getGroupQrcodeUrl
().
replace
(
"oss.5rs.me"
,
"file.5rs.me"
);
if
(
StringUtil
.
isEmpty
(
bookDto
.
getGroupQrcodeUrl
()))
{
continue
;
}
String
qrcodeUrl
=
bookDto
.
getGroupQrcodeUrl
().
replace
(
"oss.5rs.me"
,
"file.5rs.me"
);
String
qrcodeName
;
if
(!
StringUtil
.
isEmpty
(
bookName
))
{
qrcodeName
=
bookName
;
...
...
@@ -1082,6 +1119,9 @@ public class BookGroupBizImpl implements BookGroupBiz {
qrcodeName
=
"未命名"
+
noName
;
}
}
if
(
Integer
.
valueOf
(
2
).
equals
(
bookDto
.
getJoinGroupType
())
&&
!
StringUtil
.
isEmpty
(
bookDto
.
getBookGroupCipher
()))
{
qrcodeName
=
qrcodeName
+
"("
+
bookDto
.
getBookGroupCipher
()
+
")"
;
}
// 加入二维码图片
String
[]
qrcodePicurl
=
{
qrcodeName
,
qrcodeUrl
};
qrcodePicUrls
.
add
(
qrcodePicurl
);
...
...
@@ -1091,7 +1131,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
zipUrl
=
zipUrlInfo
!=
null
?
zipUrlInfo
.
getUrl
()
:
null
;
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"生成导出文件失败"
,
e
);
LOGGER
.
error
(
"生成导出文件失败"
+
e
.
getMessage
()
,
e
);
isSuccess
=
false
;
}
// 发送消息
...
...
@@ -1239,6 +1279,43 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"根据社群码id获取个人二维码信息"
)
@Override
public
OwnAltQrcodeInfoDTO
getOwnAltQrcodeInfoDTOByBookGroupId
(
Long
wechatUserId
,
Long
bookGroupId
)
{
OwnAltQrcodeInfoDTO
ownAltQrcodeInfoDTO
=
new
OwnAltQrcodeInfoDTO
();
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
if
(
bookGroupDTO
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"没有该社群码"
);
}
ownAltQrcodeInfoDTO
.
setCustomerServiceName
(
bookGroupDTO
.
getCustomerServiceName
());
//这里的暗号从社群书获取
ownAltQrcodeInfoDTO
.
setCipher
(
bookGroupDTO
.
getBookGroupCipher
());
ownAltQrcodeInfoDTO
.
setAddFriendGuide
(
bookGroupDTO
.
getAddFriendGuide
());
Long
bookId
=
bookGroupDTO
.
getBookId
();
Map
<
String
,
Object
>
paramMap
=
Maps
.
newHashMap
();
paramMap
.
put
(
"bookId"
,
bookId
);
paramMap
.
put
(
"adviserId"
,
bookGroupDTO
.
getCreateUser
());
paramMap
.
put
(
"channelId"
,
bookGroupDTO
.
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
();
//根据bookGroupId获取机器人
SelfRobotDTO
selfRobotDTO
=
wechatGroupConsr
.
getAvailableRobotByBookGroup
(
wechatUserId
,
largeTemplet
,
bookGroupId
);
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
());
return
ownAltQrcodeInfoDTO
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"根据分类id获取个人二维码信息"
)
@Override
public
OwnAltQrcodeInfoDTO
getOwnAltQrcodeInfoDTOByClassifyId
(
Long
wechatUserId
,
Long
classifyId
)
{
...
...
@@ -1993,5 +2070,253 @@ public class BookGroupBizImpl implements BookGroupBiz {
return
resultMap
;
}
@Override
public
Map
<
String
,
Integer
>
getBookGroupFriendsCountByDay
(
Long
bookGroupId
,
String
startDate
,
String
endDate
)
{
String
startTime
=
DateUtils
.
formatDate
(
DateUtils
.
getDayStart
(
DateUtils
.
getDateByStr
(
startDate
)),
DateUtils
.
DATE_FORMAT_DATETIME
);
String
endTime
=
DateUtils
.
formatDate
(
DateUtils
.
getDayEnd
(
DateUtils
.
getDateByStr
(
endDate
)),
DateUtils
.
DATE_FORMAT_DATETIME
);
List
<
DayCountDTO
>
countDTOS
=
bookGroupCipherUserDao
.
getBookGroupFriendsCountByDay
(
bookGroupId
,
startTime
,
endTime
);
Map
<
String
,
Integer
>
map
=
new
HashMap
<>();
if
(
ListUtils
.
isEmpty
(
countDTOS
))
{
return
map
;
}
for
(
DayCountDTO
dayCountDTO
:
countDTOS
)
{
map
.
put
(
dayCountDTO
.
getDate
(),
dayCountDTO
.
getCount
());
}
return
map
;
}
@Override
public
PageBeanNew
<
FriendsVO
>
listPageFriendsStatistic
(
Long
bookGroupId
,
Integer
currentPage
,
Integer
numPerPage
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookGroupId"
,
bookGroupId
);
PageBeanNew
<
FriendsVO
>
pageBeanNew
=
bookGroupCipherUserDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listPageFriendsStatistic"
);
List
<
FriendsVO
>
recordList
=
pageBeanNew
.
getRecordList
();
if
(
null
==
pageBeanNew
||
ListUtils
.
isEmpty
(
recordList
))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
0
,
new
ArrayList
<>());
}
List
<
UserRobotDTO
>
paramList
=
new
ArrayList
<>();
recordList
.
forEach
(
friendsVO
->
{
UserRobotDTO
robotDTO
=
new
UserRobotDTO
();
robotDTO
.
setWxUserId
(
friendsVO
.
getWxUserId
());
robotDTO
.
setRobotId
(
friendsVO
.
getRobotId
());
paramList
.
add
(
robotDTO
);
});
Map
<
String
,
UserChatCountDTO
>
dtoMap
=
wechatGroupConsr
.
getUserChatInfoByUserIdRobotId
(
paramList
);
for
(
FriendsVO
friendsVO
:
recordList
)
{
if
(!
MapUtils
.
isEmpty
(
dtoMap
))
{
UserChatCountDTO
countDTO
=
dtoMap
.
get
(
friendsVO
.
getWxUserId
());
friendsVO
.
setNickName
(
countDTO
.
getNickName
());
friendsVO
.
setHeadPic
(
countDTO
.
getHeadPic
());
friendsVO
.
setSex
(
countDTO
.
getSex
());
friendsVO
.
setCountry
(
countDTO
.
getCountry
());
friendsVO
.
setProvince
(
countDTO
.
getProvince
());
friendsVO
.
setCity
(
countDTO
.
getCity
());
friendsVO
.
setSpeakCount
(
countDTO
.
getChatCount
());
friendsVO
.
setSpeakCountLast7
(
countDTO
.
getSevenDayChatCount
());
friendsVO
.
setLastSpeakTime
(
countDTO
.
getLastChatTime
());
}
friendsVO
.
setState
(
"正常"
);
}
return
pageBeanNew
;
}
@ParamLog
(
"批量新增资源配置"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
batchAddBookGroupServe
(
Long
partyId
,
List
<
BookGroupServe
>
bookGroupServes
)
{
checkBookGroupServe
(
bookGroupServes
);
Long
bookGroupId
=
bookGroupServes
.
get
(
0
).
getBookGroupId
();
BookGroupDTO
dto
=
bookGroupDao
.
getDTOById
(
bookGroupId
);
if
(
dto
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数错误!"
);
}
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
dto
.
getChannelId
());
for
(
BookGroupServe
bookGroupServe
:
bookGroupServes
)
{
// 处理链接地址
String
endUrl
=
bookGroupServe
.
getServeUrl
()
+
"&book_group_id="
+
bookGroupId
;
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
//转短链
String
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
linkUrl
);
bookGroupServe
.
setShortUrl
(
resultUrl
);
bookGroupServe
.
setCreateUser
(
partyId
);
}
bookGroupServeDao
.
batchInsert
(
bookGroupServes
);
}
@ParamLog
(
"删除资源配置"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
deleteBookGroupServe
(
Long
id
)
{
if
(
id
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数错误!"
);
}
bookGroupServeDao
.
deleteById
(
id
);
}
@ParamLog
(
"获取资源配置集合"
)
@Override
public
List
<
BookGroupServe
>
getBookGroupServeList
(
Long
bookGroupId
)
{
if
(
bookGroupId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数不能为空!"
);
}
List
<
BookGroupServe
>
list
=
bookGroupServeDao
.
getListByBookGroupId
(
bookGroupId
);
if
(
ListUtils
.
isEmpty
(
list
))
{
return
new
ArrayList
<>();
}
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
appIds
=
new
ArrayList
<>();
for
(
BookGroupServe
bookGroupServe
:
list
)
{
if
(
"PRODUCT"
.
equals
(
bookGroupServe
.
getServeType
()))
{
productIds
.
add
(
bookGroupServe
.
getServeId
());
}
if
(
"APP"
.
equals
(
bookGroupServe
.
getServeType
()))
{
appIds
.
add
(
bookGroupServe
.
getServeId
());
}
}
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
Map
<
Long
,
Boolean
>
isSuperMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
productIds
))
{
productDtoMap
=
productConsr
.
getProBasesByIds
(
productIds
);
isSuperMap
=
productConsr
.
getIsSuperByProductIdList
(
productIds
);
}
if
(!
ListUtils
.
isEmpty
(
appIds
))
{
appDtoMap
=
appConsr
.
mapByIds
(
appIds
);
}
for
(
BookGroupServe
bookGroupServe
:
list
)
{
if
(
"PRODUCT"
.
equals
(
bookGroupServe
.
getServeType
()))
{
ProductDto
productDto
=
productDtoMap
.
get
(
bookGroupServe
.
getServeId
());
if
(
productDto
!=
null
)
{
bookGroupServe
.
setServeName
(
productDto
.
getProductName
());
if
(
productDto
.
getProductTypeDto
()
!=
null
)
{
bookGroupServe
.
setFromType
(
productDto
.
getProductTypeDto
().
getTypeCode
());
}
bookGroupServe
.
setIsSuper
(
isSuperMap
.
get
(
bookGroupServe
.
getServeId
()));
}
}
if
(
"APP"
.
equals
(
bookGroupServe
.
getServeType
()))
{
AppDto
appDto
=
appDtoMap
.
get
(
bookGroupServe
.
getServeId
());
if
(
appDto
!=
null
)
{
bookGroupServe
.
setServeName
(
appDto
.
getTitle
());
bookGroupServe
.
setFromType
(
appDto
.
getTypeCode
());
}
}
}
return
list
;
}
@ParamLog
(
"获取社群码暗号"
)
@Override
public
String
getBookGroupCipher
()
{
String
bookGroupCipher
=
createBookGroupCipher
();
//判断是否为库里面没有的
BookGroup
bookGroup
=
bookGroupDao
.
getByBookGroupCipher
(
bookGroupCipher
);
if
(
bookGroup
!=
null
)
{
//重新生成
bookGroupCipher
=
createBookGroupCipher
();
}
return
bookGroupCipher
;
}
@ParamLog
(
"校验字段"
)
private
void
checkBookGroupServe
(
List
<
BookGroupServe
>
bookGroupServes
){
if
(
ListUtils
.
isEmpty
(
bookGroupServes
))
{
return
;
}
for
(
BookGroupServe
bookGroupServe
:
bookGroupServes
)
{
if
(
bookGroupServe
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数不能为空!"
);
}
if
(
bookGroupServe
.
getBookGroupId
()
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数社群书id不能为空!"
);
}
if
(
bookGroupServe
.
getServeId
()
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数应用或作品id不能为空!"
);
}
if
(
StringUtil
.
isEmpty
(
bookGroupServe
.
getServeUrl
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"链接不能为空!"
);
}
if
(!(
"PRODUCT"
.
equals
(
bookGroupServe
.
getServeType
())
||
"APP"
.
equals
(
bookGroupServe
.
getServeType
())))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数应用或作品类型有误(APP或PRODUCT)!"
);
}
}
}
@ParamLog
(
"批量更新资源配置"
)
@Override
public
void
batchUpdateBookGroupServe
(
Long
partyId
,
List
<
BookGroupServe
>
bookGroupServes
)
{
checkBookGroupServe
(
bookGroupServes
);
Long
bookGroupId
=
bookGroupServes
.
get
(
0
).
getBookGroupId
();
//删除之前旧的
bookGroupServeDao
.
deleteByBookGroupId
(
bookGroupId
);
//批量新增新的
batchAddBookGroupServe
(
partyId
,
bookGroupServes
);
}
@ParamLog
(
"将1v1旧数据的关键词全部都干掉,有应用或作品的挂在社群书配置资源里面"
)
@Override
public
void
dealSelfBookGroupKeywordToServer
()
{
List
<
BookGroup
>
bookGroups
=
bookGroupDao
.
getBookGroupByJoinGroupType
(
JoinGroupTypeEnum
.
ROBOT
.
getCode
());
if
(
ListUtils
.
isEmpty
(
bookGroups
))
{
return
;
}
List
<
Long
>
bookGroupIds
=
bookGroups
.
stream
().
filter
(
s
->
s
.
getId
()
!=
null
).
map
(
BookGroup:
:
getId
).
collect
(
Collectors
.
toList
());
//查询关键词
List
<
KeywordDTO
>
keywordDTOS
=
bookKeywordDao
.
getListByBookGroupIdsAndType
(
bookGroupIds
,
ReplyTypeEnum
.
APP
.
value
);
if
(
ListUtils
.
isEmpty
(
keywordDTOS
))
{
return
;
}
Map
<
Long
,
List
<
KeywordDTO
>>
map
=
keywordDTOS
.
stream
().
filter
(
s
->
s
.
getBookGroupId
()
!=
null
).
collect
(
Collectors
.
groupingBy
(
KeywordDTO:
:
getBookGroupId
));
for
(
BookGroup
bookGroup
:
bookGroups
)
{
Long
bookGroupId
=
bookGroup
.
getId
();
List
<
KeywordDTO
>
list
=
map
.
get
(
bookGroupId
);
if
(
ListUtils
.
isEmpty
(
list
))
{
continue
;
}
//查询有没有配置资源,如果没有则新增加入
List
<
BookGroupServe
>
bookGroupServes
=
bookGroupServeDao
.
getListByBookGroupId
(
bookGroupId
);
if
(!
ListUtils
.
isEmpty
(
bookGroupServes
))
{
continue
;
}
List
<
BookGroupServe
>
bookGroupServesNew
=
new
ArrayList
<>();
for
(
KeywordDTO
keywordDTO
:
list
)
{
BookGroupServe
bookGroupServe
=
new
BookGroupServe
();
bookGroupServe
.
setBookGroupId
(
bookGroupId
);
bookGroupServe
.
setServeId
(
keywordDTO
.
getServeId
());
bookGroupServe
.
setServeType
(
keywordDTO
.
getServeType
());
bookGroupServe
.
setCreateUser
(
bookGroup
.
getCreateUser
());
bookGroupServe
.
setServeUrl
(
keywordDTO
.
getLinkUrl
());
// 处理链接地址
String
endUrl
=
bookGroupServe
.
getServeUrl
()
+
"&book_group_id="
+
bookGroupId
;
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
bookGroup
.
getChannelId
());
String
linkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
endUrl
);
//转短链
String
resultUrl
=
UrlUtils
.
getShortUrl4Own
(
linkUrl
);
bookGroupServe
.
setShortUrl
(
resultUrl
);
bookGroupServesNew
.
add
(
bookGroupServe
);
}
if
(!
ListUtils
.
isEmpty
(
bookGroupServesNew
)){
bookGroupServeDao
.
batchInsert
(
bookGroupServesNew
);
}
}
//按照社群码id集合把关键词逻辑删除
bookKeywordDao
.
deleteByBookGroupIds
(
bookGroupIds
);
}
@ParamLog
(
"生成暗号"
)
private
String
createBookGroupCipher
(){
//生成暗号规则:abc1234,前三位小写字母,后四位数字
Random
random
=
new
Random
();
String
s
=
""
;
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
int
result
=
97
+
random
.
nextInt
(
26
);
s
=
s
+
String
.
valueOf
((
char
)
result
);
}
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
int
result
=
random
.
nextInt
(
10
);
s
=
s
+
String
.
valueOf
(
result
);
}
return
s
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/BookGroupClassifyBizImpl.java
View file @
ae0e84fb
...
...
@@ -17,6 +17,7 @@ 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.BookGroupCipherUserDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dao.BookQrcodeUserDao
;
...
...
@@ -162,10 +163,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
private
LearningReportTouchRecordDao
learningReportTouchRecordDao
;
@Autowired
private
JoinGroupCipherDao
joinGroupCipherDao
;
@Autowired
private
BookAuthUserBiz
bookAuthUserBiz
;
@Autowired
private
BookGroupCipherUserDao
bookGroupCipherUserDao
;
@Autowired
private
BookGroupDao
bookGroupDao
;
...
...
@@ -489,6 +491,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
classifyAndGroupCountVO
.
setClassifyCount
(
statistic
.
get
(
bookGroupId
).
getClassifyCount
());
}
classifyAndGroupCountVO
.
setGroupCount
(
groupCount
);
Integer
friendsCount
=
bookGroupCipherUserDao
.
getFriendsCountByBookGroup
(
bookGroupId
);
classifyAndGroupCountVO
.
setFriendsCount
(
friendsCount
);
return
classifyAndGroupCountVO
;
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/BookGroupCipherUserDao.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.dto.DayCountDTO
;
import
com.pcloud.book.group.entity.BookGroupCipherUser
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/9/24 15:18
**/
public
interface
BookGroupCipherUserDao
extends
BaseDao
<
BookGroupCipherUser
>
{
Long
getBookGroupIdByWxUserId
(
String
wxUserId
);
/**
* 社群码好友数量
* @param bookGroupId
* @return
*/
public
Integer
getFriendsCountByBookGroup
(
Long
bookGroupId
);
/**
* 日加好友数量
* @param bookGroupId
* @param startTime
* @param endTime
* @return
*/
List
<
DayCountDTO
>
getBookGroupFriendsCountByDay
(
Long
bookGroupId
,
String
startTime
,
String
endTime
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/BookGroupClassifyDao.java
View file @
ae0e84fb
...
...
@@ -263,4 +263,5 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
List
<
ListClassifyVO
>
getClassifyIngoreDelete
(
Long
bookGroupId
);
List
<
BookGroupClassify
>
getListByBookGroupId
(
Long
bookGroupId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/BookGroupDao.java
View file @
ae0e84fb
...
...
@@ -155,4 +155,30 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
* 删除社群书
*/
void
deleteByBookGroupId
(
Long
bookGroupId
);
/**
* 根据社群码id获取社群书基本信息(包括书籍封面isbn号)
* @param bookGroupId
* @return
*/
BookGroupDTO
getBookBaseInfoById
(
Long
bookGroupId
);
/**
* 编辑社群书好友人数
* @param adviserId
* @return
*/
public
Integer
getBookGroupFriendsCountByAdviser
(
Long
adviserId
);
/**
* 根据社群码暗号获取社群码
* @param bookGroupCipher
* @return
*/
BookGroup
getByBookGroupCipher
(
String
bookGroupCipher
);
/**
* 根据入群方式查询社群书集合
*/
List
<
BookGroup
>
getBookGroupByJoinGroupType
(
Integer
joinGroupType
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/BookGroupServeDao.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
public
interface
BookGroupServeDao
extends
BaseDao
<
BookGroupServe
>
{
Integer
batchInsert
(
List
<
BookGroupServe
>
bookGroupServes
);
List
<
BookGroupServe
>
getListByBookGroupId
(
Long
bookGroupId
);
void
deleteByBookGroupId
(
Long
bookGroupId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/GroupQrcodeDao.java
View file @
ae0e84fb
...
...
@@ -263,5 +263,7 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
List
<
ClassifyQrcodeVO
>
getQrcodeByClassifyId
(
Long
classifyId
);
List
<
GroupQrcode
>
getListByBookGroupIds
(
List
<
Long
>
bookGroupIds
);
Map
<
Long
,
GroupQrcodeInfo4Advertising
>
getWechatGroupInfoMap
(
List
<
Long
>
qrcodeIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/JoinGroupCipherDao.java
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dao
;
import
com.pcloud.book.group.dto.DayCountDTO
;
import
com.pcloud.book.group.dto.JoinGroupCipherDTO
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.common.core.dao.BaseDao
;
...
...
@@ -28,6 +29,12 @@ public interface JoinGroupCipherDao extends BaseDao<JoinGroupCipher> {
*/
BigDecimal
getPayPrice
(
String
wxId
,
Long
qrcodeId
);
JoinGroupCipher
getByCondition
(
Long
wechatUserId
,
Long
bookGroupId
,
Integer
type
);
List
<
JoinGroupCipher
>
getListByAltIdAndWxIdAndType
(
String
robotId
,
String
userWxId
,
Integer
code
);
JoinGroupCipher
getByWechatUserIdAndQrcodeId
(
Long
wechatUserId
,
Long
qrcodeId
,
Integer
type
);
void
updateCipher
(
Long
id
,
String
cipher
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/BookGroupCipherUserDaoImpl.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.BookGroupCipherUserDao
;
import
com.pcloud.book.group.dto.DayCountDTO
;
import
com.pcloud.book.group.entity.BookGroupCipherUser
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/9/24 15:19
**/
@Component
(
"bookGroupCipherUserDao"
)
public
class
BookGroupCipherUserDaoImpl
extends
BaseDaoImpl
<
BookGroupCipherUser
>
implements
BookGroupCipherUserDao
{
@Override
public
Long
getBookGroupIdByWxUserId
(
String
wxUserId
)
{
return
this
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getBookGroupIdByWxUserId"
),
wxUserId
);
}
@Override
public
Integer
getFriendsCountByBookGroup
(
Long
bookGroupId
)
{
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getFriendsCountByBookGroup"
),
bookGroupId
);
}
@Override
public
List
<
DayCountDTO
>
getBookGroupFriendsCountByDay
(
Long
bookGroupId
,
String
startTime
,
String
endTime
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"bookGroupId"
,
bookGroupId
);
map
.
put
(
"startTime"
,
startTime
);
map
.
put
(
"endTime"
,
endTime
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getBookGroupFriendsCountByDay"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/BookGroupClassifyDaoImpl.java
View file @
ae0e84fb
...
...
@@ -248,4 +248,9 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
public
List
<
ListClassifyVO
>
getClassifyIngoreDelete
(
Long
bookGroupId
)
{
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getClassifyIngoreDelete"
),
bookGroupId
);
}
@Override
public
List
<
BookGroupClassify
>
getListByBookGroupId
(
Long
bookGroupId
)
{
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getListByBookGroupId"
),
bookGroupId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/BookGroupDaoImpl.java
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.pcloud.book.group.dto.PersonalQrcodeDTO
;
import
org.springframework.stereotype.Repository
;
import
com.pcloud.book.group.dao.BookGroupDao
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.PersonalQrcodeDTO
;
import
com.pcloud.book.group.dto.QrcodeNameAndProIdDTO
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Description 社群书群二维码数据访问层接口实现类
* Created by PENG on 2019/4/17.
...
...
@@ -165,4 +166,24 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
paramMap
.
put
(
"bookGroupId"
,
bookGroupId
);
super
.
getSqlSession
().
update
(
getStatement
(
"deleteByBookGroupId"
),
paramMap
);
}
@Override
public
BookGroupDTO
getBookBaseInfoById
(
Long
bookGroupId
)
{
return
this
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getBookBaseInfoById"
),
bookGroupId
);
}
@Override
public
Integer
getBookGroupFriendsCountByAdviser
(
Long
adviserId
)
{
return
this
.
getSqlSession
().
selectOne
(
getStatement
(
"getBookGroupFriendsCountByAdviser"
),
adviserId
);
}
@Override
public
BookGroup
getByBookGroupCipher
(
String
bookGroupCipher
)
{
return
this
.
getSqlSession
().
selectOne
(
getStatement
(
"getByBookGroupCipher"
),
bookGroupCipher
);
}
@Override
public
List
<
BookGroup
>
getBookGroupByJoinGroupType
(
Integer
joinGroupType
)
{
return
this
.
getSqlSession
().
selectList
(
getStatement
(
"getBookGroupByJoinGroupType"
),
joinGroupType
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/BookGroupServeDaoImpl.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.BookGroupServeDao
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/9/23 15:39
**/
@Component
(
"bookGroupServeDao"
)
public
class
BookGroupServeDaoImpl
extends
BaseDaoImpl
<
BookGroupServe
>
implements
BookGroupServeDao
{
@Override
public
Integer
batchInsert
(
List
<
BookGroupServe
>
list
)
{
return
super
.
getSqlSession
().
insert
(
getStatement
(
"batchInsert"
),
list
);
}
@Override
public
List
<
BookGroupServe
>
getListByBookGroupId
(
Long
bookGroupId
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByBookGroupId"
),
bookGroupId
);
}
@Override
public
void
deleteByBookGroupId
(
Long
bookGroupId
)
{
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByBookGroupId"
),
bookGroupId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/GroupQrcodeDaoImpl.java
View file @
ae0e84fb
...
...
@@ -244,6 +244,11 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
}
@Override
public
List
<
GroupQrcode
>
getListByBookGroupIds
(
List
<
Long
>
bookGroupIds
)
{
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getListByBookGroupIds"
),
bookGroupIds
);
}
@Override
public
Map
<
Long
,
GroupQrcodeInfo4Advertising
>
getWechatGroupInfoMap
(
List
<
Long
>
qrcodeIds
)
{
return
this
.
getSqlSession
().
selectMap
(
this
.
getStatement
(
"getWechatGroupInfoMap"
),
qrcodeIds
,
"groupQrcodeId"
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dao/impl/JoinGroupCipherDaoImpl.java
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
dao
.
impl
;
import
com.pcloud.book.group.dao.JoinGroupCipherDao
;
import
com.pcloud.book.group.dto.DayCountDTO
;
import
com.pcloud.book.group.dto.JoinGroupCipherDTO
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
...
...
@@ -71,6 +72,23 @@ public class JoinGroupCipherDaoImpl extends BaseDaoImpl<JoinGroupCipher> impleme
}
@Override
public
JoinGroupCipher
getByCondition
(
Long
wechatUserId
,
Long
bookGroupId
,
Integer
type
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"bookGroupId"
,
bookGroupId
);
map
.
put
(
"type"
,
type
);
return
this
.
getSqlSession
().
selectOne
(
this
.
getStatement
(
"getByCondition"
),
map
);
}
@Override
public
List
<
JoinGroupCipher
>
getListByAltIdAndWxIdAndType
(
String
robotId
,
String
userWxId
,
Integer
type
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"robotId"
,
robotId
);
map
.
put
(
"userWxId"
,
userWxId
);
map
.
put
(
"type"
,
type
);
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getListByAltIdAndWxIdAndType"
),
map
);
}
public
JoinGroupCipher
getByWechatUserIdAndQrcodeId
(
Long
wechatUserId
,
Long
qrcodeId
,
Integer
type
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/BookGroupDTO.java
View file @
ae0e84fb
...
...
@@ -152,6 +152,26 @@ public class BookGroupDTO extends BaseDto {
*/
private
Integer
joinGroupType
;
/**
* 加好友欢迎语
*/
private
String
addFriendGuide
;
/**
* 客服称谓
*/
private
String
customerServiceName
;
/**
* 是否邀请入群
*/
private
Boolean
isInviteGroup
;
/**
* 社群书暗号
*/
private
String
bookGroupCipher
;
public
String
getUrl
()
{
return
url
;
}
...
...
@@ -386,6 +406,38 @@ public class BookGroupDTO extends BaseDto {
this
.
bookNumber
=
bookNumber
;
}
public
String
getAddFriendGuide
()
{
return
addFriendGuide
;
}
public
void
setAddFriendGuide
(
String
addFriendGuide
)
{
this
.
addFriendGuide
=
addFriendGuide
;
}
public
String
getCustomerServiceName
()
{
return
customerServiceName
;
}
public
void
setCustomerServiceName
(
String
customerServiceName
)
{
this
.
customerServiceName
=
customerServiceName
;
}
public
Boolean
getIsInviteGroup
()
{
return
isInviteGroup
;
}
public
void
setIsInviteGroup
(
Boolean
isInviteGroup
)
{
this
.
isInviteGroup
=
isInviteGroup
;
}
public
String
getBookGroupCipher
()
{
return
bookGroupCipher
;
}
public
void
setBookGroupCipher
(
String
bookGroupCipher
)
{
this
.
bookGroupCipher
=
bookGroupCipher
;
}
@Override
public
String
toString
()
{
return
"BookGroupDTO{"
+
...
...
@@ -418,8 +470,10 @@ public class BookGroupDTO extends BaseDto {
", bookClockInfoId="
+
bookClockInfoId
+
", isShowBookName="
+
isShowBookName
+
", joinGroupType="
+
joinGroupType
+
", addFriendGuide='"
+
addFriendGuide
+
'\''
+
", customerServiceName='"
+
customerServiceName
+
'\''
+
", isInviteGroup="
+
isInviteGroup
+
", bookGroupCipher='"
+
bookGroupCipher
+
'\''
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/OwnAltQrcodeInfoDTO.java
View file @
ae0e84fb
...
...
@@ -28,6 +28,12 @@ public class OwnAltQrcodeInfoDTO implements Serializable {
@ApiModelProperty
(
"暗号"
)
private
String
cipher
;
@ApiModelProperty
(
"客服称谓"
)
private
String
customerServiceName
;
@ApiModelProperty
(
"加好友宣传语"
)
private
String
addFriendGuide
;
public
String
getAltId
()
{
return
altId
;
}
...
...
@@ -68,6 +74,22 @@ public class OwnAltQrcodeInfoDTO implements Serializable {
this
.
cipher
=
cipher
;
}
public
String
getCustomerServiceName
()
{
return
customerServiceName
;
}
public
void
setCustomerServiceName
(
String
customerServiceName
)
{
this
.
customerServiceName
=
customerServiceName
;
}
public
String
getAddFriendGuide
()
{
return
addFriendGuide
;
}
public
void
setAddFriendGuide
(
String
addFriendGuide
)
{
this
.
addFriendGuide
=
addFriendGuide
;
}
@Override
public
String
toString
()
{
return
"OwnAltQrcodeInfoDTO{"
+
...
...
@@ -76,6 +98,8 @@ public class OwnAltQrcodeInfoDTO implements Serializable {
", altHeadUrl='"
+
altHeadUrl
+
'\''
+
", altQrcodeUrl='"
+
altQrcodeUrl
+
'\''
+
", cipher='"
+
cipher
+
'\''
+
", customerServiceName='"
+
customerServiceName
+
'\''
+
", addFriendGuide='"
+
addFriendGuide
+
'\''
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/BookGroup.java
View file @
ae0e84fb
...
...
@@ -107,6 +107,26 @@ public class BookGroup extends BaseEntity {
*/
private
Integer
joinGroupType
;
/**
* 加好友欢迎语
*/
private
String
addFriendGuide
;
/**
* 客服称谓
*/
private
String
customerServiceName
;
/**
* 是否邀请入群
*/
private
Boolean
isInviteGroup
;
/**
* 社群书暗号
*/
private
String
bookGroupCipher
;
public
Long
getId
()
{
return
id
;
}
...
...
@@ -259,6 +279,38 @@ public class BookGroup extends BaseEntity {
this
.
joinGroupType
=
joinGroupType
;
}
public
String
getAddFriendGuide
()
{
return
addFriendGuide
;
}
public
void
setAddFriendGuide
(
String
addFriendGuide
)
{
this
.
addFriendGuide
=
addFriendGuide
;
}
public
String
getCustomerServiceName
()
{
return
customerServiceName
;
}
public
void
setCustomerServiceName
(
String
customerServiceName
)
{
this
.
customerServiceName
=
customerServiceName
;
}
public
Boolean
getIsInviteGroup
()
{
return
isInviteGroup
;
}
public
void
setIsInviteGroup
(
Boolean
isInviteGroup
)
{
this
.
isInviteGroup
=
isInviteGroup
;
}
public
String
getBookGroupCipher
()
{
return
bookGroupCipher
;
}
public
void
setBookGroupCipher
(
String
bookGroupCipher
)
{
this
.
bookGroupCipher
=
bookGroupCipher
;
}
@Override
public
String
toString
()
{
return
"BookGroup{"
+
...
...
@@ -281,6 +333,10 @@ public class BookGroup extends BaseEntity {
", isDelete="
+
isDelete
+
", isShowBookName="
+
isShowBookName
+
", joinGroupType="
+
joinGroupType
+
", addFriendGuide='"
+
addFriendGuide
+
'\''
+
", customerServiceName='"
+
customerServiceName
+
'\''
+
", isInviteGroup="
+
isInviteGroup
+
", bookGroupCipher='"
+
bookGroupCipher
+
'\''
+
"} "
+
super
.
toString
();
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/BookGroupCipherUser.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/9/24 15:16
**/
@ApiModel
(
"社群书暗号关联用户"
)
public
class
BookGroupCipherUser
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1763812276337850708L
;
@ApiModelProperty
(
"社群码id"
)
private
Long
bookGroupId
;
@ApiModelProperty
(
"社群码暗号"
)
private
String
bookGroupCipher
;
@ApiModelProperty
(
"用户微信id"
)
private
String
wxUserId
;
@ApiModelProperty
(
"机器人id"
)
private
String
altId
;
public
Long
getBookGroupId
()
{
return
bookGroupId
;
}
public
void
setBookGroupId
(
Long
bookGroupId
)
{
this
.
bookGroupId
=
bookGroupId
;
}
public
String
getBookGroupCipher
()
{
return
bookGroupCipher
;
}
public
void
setBookGroupCipher
(
String
bookGroupCipher
)
{
this
.
bookGroupCipher
=
bookGroupCipher
;
}
public
String
getWxUserId
()
{
return
wxUserId
;
}
public
void
setWxUserId
(
String
wxUserId
)
{
this
.
wxUserId
=
wxUserId
;
}
public
String
getAltId
()
{
return
altId
;
}
public
void
setAltId
(
String
altId
)
{
this
.
altId
=
altId
;
}
@Override
public
String
toString
()
{
return
"BookGroupCipherUser{"
+
"bookGroupId="
+
bookGroupId
+
", bookGroupCipher='"
+
bookGroupCipher
+
'\''
+
", wxUserId='"
+
wxUserId
+
'\''
+
", altId='"
+
altId
+
'\''
+
"} "
+
super
.
toString
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/BookGroupServe.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/9/23 15:35
**/
public
class
BookGroupServe
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
7725930392678110441L
;
@ApiModelProperty
(
"作品或应用id"
)
private
Long
serveId
;
@ApiModelProperty
(
"类型;APP应用,PRODUCT作品"
)
private
String
serveType
;
@ApiModelProperty
(
"链接"
)
private
String
serveUrl
;
@ApiModelProperty
(
"短链"
)
private
String
shortUrl
;
@ApiModelProperty
(
"社群书id"
)
private
Long
bookGroupId
;
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
@ApiModelProperty
(
"应用或作品名称"
)
private
String
serveName
;
@ApiModelProperty
(
"类型"
)
private
String
fromType
;
@ApiModelProperty
(
"是否超级作者"
)
private
Boolean
isSuper
;
public
Long
getServeId
()
{
return
serveId
;
}
public
void
setServeId
(
Long
serveId
)
{
this
.
serveId
=
serveId
;
}
public
String
getServeType
()
{
return
serveType
;
}
public
void
setServeType
(
String
serveType
)
{
this
.
serveType
=
serveType
;
}
public
String
getServeUrl
()
{
return
serveUrl
;
}
public
void
setServeUrl
(
String
serveUrl
)
{
this
.
serveUrl
=
serveUrl
;
}
public
String
getShortUrl
()
{
return
shortUrl
;
}
public
void
setShortUrl
(
String
shortUrl
)
{
this
.
shortUrl
=
shortUrl
;
}
public
Long
getBookGroupId
()
{
return
bookGroupId
;
}
public
void
setBookGroupId
(
Long
bookGroupId
)
{
this
.
bookGroupId
=
bookGroupId
;
}
public
Long
getCreateUser
()
{
return
createUser
;
}
public
void
setCreateUser
(
Long
createUser
)
{
this
.
createUser
=
createUser
;
}
public
String
getServeName
()
{
return
serveName
;
}
public
void
setServeName
(
String
serveName
)
{
this
.
serveName
=
serveName
;
}
public
String
getFromType
()
{
return
fromType
;
}
public
void
setFromType
(
String
fromType
)
{
this
.
fromType
=
fromType
;
}
public
Boolean
getIsSuper
()
{
return
isSuper
;
}
public
void
setIsSuper
(
Boolean
isSuper
)
{
this
.
isSuper
=
isSuper
;
}
@Override
public
String
toString
()
{
return
"BookGroupServe{"
+
"serveId="
+
serveId
+
", serveType='"
+
serveType
+
'\''
+
", serveUrl='"
+
serveUrl
+
'\''
+
", shortUrl='"
+
shortUrl
+
'\''
+
", bookGroupId="
+
bookGroupId
+
", createUser="
+
createUser
+
", serveName='"
+
serveName
+
'\''
+
", fromType='"
+
fromType
+
'\''
+
", isSuper="
+
isSuper
+
"} "
+
super
.
toString
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/entity/JoinGroupCipher.java
View file @
ae0e84fb
...
...
@@ -14,6 +14,9 @@ public class JoinGroupCipher extends BaseEntity {
@ApiModelProperty
(
"密码"
)
private
String
cipher
;
@ApiModelProperty
(
"社群码id"
)
private
Long
bookGroupId
;
@ApiModelProperty
(
"分类id"
)
private
Long
classifyId
;
...
...
@@ -43,6 +46,14 @@ public class JoinGroupCipher extends BaseEntity {
this
.
cipher
=
cipher
;
}
public
Long
getBookGroupId
()
{
return
bookGroupId
;
}
public
void
setBookGroupId
(
Long
bookGroupId
)
{
this
.
bookGroupId
=
bookGroupId
;
}
public
Long
getClassifyId
()
{
return
classifyId
;
}
...
...
@@ -103,6 +114,7 @@ public class JoinGroupCipher extends BaseEntity {
public
String
toString
()
{
return
"JoinGroupCipher{"
+
"cipher='"
+
cipher
+
'\''
+
", bookGroupId="
+
bookGroupId
+
", classifyId="
+
classifyId
+
", qrcodeId="
+
qrcodeId
+
", wechatUserId="
+
wechatUserId
+
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/BookGroupFacade.java
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
facade
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.vo.*
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.vo.FriendsVO
;
import
com.pcloud.book.group.vo.GroupIncomeStaticParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.UpdateRankTypeVO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
org.codehaus.jackson.JsonParseException
;
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.PostMapping
;
...
...
@@ -14,20 +26,14 @@ import org.springframework.web.bind.annotation.RequestHeader;
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.entity.BookGroup
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.UpdateRankTypeVO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
import
com.pcloud.common.permission.PermissionException
;
import
java.util.List
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.List
;
/**
* Description 社群书群二维码接口
* Created by PENG on 2019/4/17.
...
...
@@ -289,6 +295,13 @@ public interface BookGroupFacade {
)
throws
BizException
,
PermissionException
,
JsonParseException
;
@ApiOperation
(
"根据分类id获取个人二维码"
)
@GetMapping
(
"getOwnAltQrcodeInfoDTOByBookGroupId"
)
ResponseDto
<?>
getOwnAltQrcodeInfoDTOByBookGroupId
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"bookGroupId"
)
Long
bookGroupId
)
throws
BizException
,
PermissionException
,
JsonParseException
;
@ApiOperation
(
"根据分类id获取个人二维码"
)
@GetMapping
(
"getOwnAltQrcodeInfoDTOByClassifyId"
)
ResponseDto
<?>
getOwnAltQrcodeInfoDTOByClassifyId
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
...
...
@@ -371,6 +384,49 @@ public interface BookGroupFacade {
public
ResponseDto
<?>
exportRescourceIncomeData
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"bookGroupId"
,
required
=
true
)
Long
bookGroupId
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
value
=
"用户发言数据列表--1v1入群"
,
httpMethod
=
"GET"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"bookGroupId"
,
value
=
"bookGroupId"
,
required
=
true
,
dataType
=
"Long"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"currentPage"
,
value
=
"currentPage"
,
required
=
true
,
dataType
=
"Integer"
,
paramType
=
"query"
),
@ApiImplicitParam
(
name
=
"numPerPage"
,
value
=
"numPerPage"
,
required
=
true
,
dataType
=
"Integer"
,
paramType
=
"query"
)
})
@GetMapping
(
"listPageFriendsStatistic"
)
public
ResponseDto
<
PageBeanNew
<
FriendsVO
>>
listPageFriendsStatistic
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"bookGroupId"
,
required
=
true
)
Long
bookGroupId
,
@RequestParam
(
value
=
"currentPage"
,
required
=
true
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
true
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
;
@ApiOperation
(
"批量新增资源配置"
)
@PostMapping
(
"batchAddBookGroupServe"
)
ResponseDto
<?>
batchAddBookGroupServe
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
BookGroupServe
>
bookGroupServes
)
throws
BizException
,
PermissionException
,
JsonParseException
;
@ApiOperation
(
"批量更新资源配置"
)
@PostMapping
(
"batchUpdateBookGroupServe"
)
ResponseDto
<?>
batchUpdateBookGroupServe
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
BookGroupServe
>
bookGroupServes
)
throws
BizException
,
PermissionException
,
JsonParseException
;
@ApiOperation
(
"删除资源配置"
)
@GetMapping
(
"deleteBookGroupServe"
)
ResponseDto
<?>
deleteBookGroupServe
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
throws
BizException
,
PermissionException
,
JsonParseException
;
@ApiOperation
(
"获取资源配置集合"
)
@GetMapping
(
"getBookGroupServeList"
)
ResponseDto
<?>
getBookGroupServeList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"bookGroupId"
)
Long
bookGroupId
)
throws
BizException
,
PermissionException
,
JsonParseException
;
@ApiOperation
(
"获取社群码暗号"
)
@GetMapping
(
"getBookGroupCipher"
)
ResponseDto
<?>
getBookGroupCipher
(
@RequestHeader
(
"token"
)
String
token
)
throws
BizException
,
PermissionException
,
JsonParseException
;
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
View file @
ae0e84fb
...
...
@@ -6,8 +6,18 @@ 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.BookGroupClassify
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.facade.BookGroupFacade
;
import
com.pcloud.book.group.vo.*
;
import
com.pcloud.book.group.vo.FriendsVO
;
import
com.pcloud.book.group.vo.GroupIncomeStaticParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendParamVO
;
import
com.pcloud.book.group.vo.GroupScanTrendVO
;
import
com.pcloud.book.group.vo.GroupStatisticVO
;
import
com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO
;
import
com.pcloud.book.group.vo.ResourcesStatisticVO
;
import
com.pcloud.book.group.vo.TotalRescourceDataVO
;
import
com.pcloud.book.group.vo.UpdateRankTypeVO
;
import
com.pcloud.book.group.vo.WxGroupStatisticVO
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBean
;
...
...
@@ -17,9 +27,9 @@ import com.pcloud.common.permission.PermissionException;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.codehaus.jackson.JsonParseException
;
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.PostMapping
;
...
...
@@ -410,6 +420,20 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return
new
ResponseDto
<>();
}
@ApiOperation
(
"根据社群书id获取个人二维码"
)
@GetMapping
(
"getOwnAltQrcodeInfoDTOByBookGroupId"
)
@Override
public
ResponseDto
<?>
getOwnAltQrcodeInfoDTOByBookGroupId
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"bookGroupId"
)
Long
bookGroupId
)
throws
BizException
,
PermissionException
,
JsonParseException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
bookGroupId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"社群码id不能为空!"
);
}
return
new
ResponseDto
<>(
bookGroupBiz
.
getOwnAltQrcodeInfoDTOByBookGroupId
(
wechatUserId
,
bookGroupId
));
}
@ApiOperation
(
"根据分类id获取个人二维码"
)
@GetMapping
(
"getOwnAltQrcodeInfoDTOByClassifyId"
)
@Override
...
...
@@ -519,4 +543,72 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
}
@Override
@GetMapping
(
"listPageFriendsStatistic"
)
public
ResponseDto
<
PageBeanNew
<
FriendsVO
>>
listPageFriendsStatistic
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
value
=
"bookGroupId"
,
required
=
true
)
Long
bookGroupId
,
@RequestParam
(
value
=
"currentPage"
,
required
=
true
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
true
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
PageBeanNew
<
FriendsVO
>
pageBeanNew
=
bookGroupBiz
.
listPageFriendsStatistic
(
bookGroupId
,
currentPage
,
numPerPage
);
return
new
ResponseDto
<>(
pageBeanNew
);
}
@ApiOperation
(
"批量新增资源配置"
)
@PostMapping
(
"batchAddBookGroupServe"
)
@Override
public
ResponseDto
<?>
batchAddBookGroupServe
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
BookGroupServe
>
bookGroupServes
)
throws
BizException
,
PermissionException
,
JsonParseException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
bookGroupBiz
.
batchAddBookGroupServe
(
partyId
,
bookGroupServes
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"批量更新资源配置"
)
@PostMapping
(
"batchUpdateBookGroupServe"
)
@Override
public
ResponseDto
<?>
batchUpdateBookGroupServe
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
List
<
BookGroupServe
>
bookGroupServes
)
throws
BizException
,
PermissionException
,
JsonParseException
{
Long
partyId
=
(
Long
)
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
bookGroupBiz
.
batchUpdateBookGroupServe
(
partyId
,
bookGroupServes
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除资源配置"
)
@GetMapping
(
"deleteBookGroupServe"
)
@Override
public
ResponseDto
<?>
deleteBookGroupServe
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
throws
BizException
,
PermissionException
,
JsonParseException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
bookGroupBiz
.
deleteBookGroupServe
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"获取资源配置集合"
)
@GetMapping
(
"getBookGroupServeList"
)
@Override
public
ResponseDto
<?>
getBookGroupServeList
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"bookGroupId"
)
Long
bookGroupId
)
throws
BizException
,
PermissionException
,
JsonParseException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
bookGroupBiz
.
getBookGroupServeList
(
bookGroupId
));
}
@ApiOperation
(
"获取社群码暗号"
)
@GetMapping
(
"getBookGroupCipher"
)
@Override
public
ResponseDto
<?>
getBookGroupCipher
(
@RequestHeader
(
"token"
)
String
token
)
throws
BizException
,
PermissionException
,
JsonParseException
{
SessionUtil
.
getVlaue
(
token
,
SessionUtil
.
PARTY_ID
);
return
new
ResponseDto
<>(
bookGroupBiz
.
getBookGroupCipher
());
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/service/impl/BookGroupServiceImpl.java
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
service
.
impl
;
import
java.util.List
;
import
java.util.Map
;
import
com.pcloud.book.group.dto.PersonalQrcodeDTO
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.dto.GroupCipherDTO
;
import
com.pcloud.book.group.dto.GroupUseDTO
;
import
io.swagger.annotations.ApiOperation
;
import
com.pcloud.book.group.dto.PersonalQrcodeDTO
;
import
com.pcloud.book.group.dto.QueryByBookAdviserDTO
;
import
com.pcloud.book.group.dto.ResourceBrowseParamDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dto.BookGroupDTO
;
import
com.pcloud.book.group.service.BookGroupService
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.StoreFlowInfoDto
;
...
...
@@ -22,6 +15,21 @@ import com.pcloud.common.exceptions.BizException;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
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.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
import
io.swagger.annotations.ApiOperation
;
/**
* Description 社群书内部接口实现类
* Created by PENG on 2019/5/14.
...
...
@@ -152,7 +160,20 @@ public class BookGroupServiceImpl implements BookGroupService {
@PostMapping
(
"getResourcesBrowseCount"
)
public
ResponseEntity
<
ResponseDto
<
Map
<
Long
,
Long
>>>
getResourcesBrowseCount
(
@RequestBody
ResourceBrowseParamDto
resourceBrowseParamDto
)
{
return
ResponseHandleUtil
.
toResponse
(
bookGroupBiz
.
getResourcesBrowseCount
(
resourceBrowseParamDto
));
}
@GetMapping
(
"getBookGroupFriendsCountByDay"
)
public
ResponseEntity
<
ResponseDto
<
Map
<
String
,
Integer
>>>
getBookGroupFriendsCountByDay
(
@RequestParam
(
"bookGroupId"
)
Long
bookGroupId
,
@RequestParam
(
"startDate"
)
String
startDate
,
@RequestParam
(
"endDate"
)
String
endDate
)
{
Map
<
String
,
Integer
>
map
=
bookGroupBiz
.
getBookGroupFriendsCountByDay
(
bookGroupId
,
startDate
,
endDate
);
return
ResponseHandleUtil
.
toResponse
(
map
);
}
@ApiOperation
(
"将1v1旧数据的关键词全部都干掉,有应用或作品的挂在社群书配置资源里面"
)
@GetMapping
(
"dealSelfBookGroupKeywordToServer"
)
@Override
public
void
dealSelfBookGroupKeywordToServer
()
{
bookGroupBiz
.
dealSelfBookGroupKeywordToServer
();
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/ClassifyAndGroupCountVO.java
View file @
ae0e84fb
...
...
@@ -24,6 +24,9 @@ public class ClassifyAndGroupCountVO implements Serializable {
@ApiModelProperty
(
"群数量"
)
private
Integer
groupCount
;
@ApiModelProperty
(
"好友人数"
)
private
Integer
friendsCount
;
public
Long
getBookGroupId
()
{
return
bookGroupId
;
}
...
...
@@ -48,12 +51,21 @@ public class ClassifyAndGroupCountVO implements Serializable {
this
.
groupCount
=
groupCount
;
}
public
Integer
getFriendsCount
()
{
return
friendsCount
;
}
public
void
setFriendsCount
(
Integer
friendsCount
)
{
this
.
friendsCount
=
friendsCount
;
}
@Override
public
String
toString
()
{
return
"ClassifyAndGroupCountVO{"
+
"bookGroupId="
+
bookGroupId
+
", classifyCount="
+
classifyCount
+
", groupCount="
+
groupCount
+
", friendsCount="
+
friendsCount
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/FriendsVO.java
0 → 100644
View file @
ae0e84fb
package
com
.
pcloud
.
book
.
group
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.dto.BaseDto
;
import
java.util.Date
;
/**
* @描述:好友用户信息
* @作者:zhuyajie
* @创建时间:11:51 2019/9/20
* @版本:1.0
*/
public
class
FriendsVO
extends
BaseDto
{
/**
* 机器人id
*/
private
String
robotId
;
/**
* 微信用户ID
*/
private
String
wxUserId
;
/**
* 昵称
*/
private
String
nickName
;
/**
* 头像
*/
private
String
headPic
;
/**
* 性别
*/
private
Integer
sex
;
/**
* 国家
*/
private
String
country
;
/**
* 省份
*/
private
String
province
;
/**
* 城市
*/
private
String
city
;
/**
* 添加时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
/**
* 状态
*/
private
String
state
;
/**
* 累积发言次数
*/
private
Integer
speakCount
;
/**
* 7天累积发言次数
*/
private
Integer
speakCountLast7
;
/**
* 最后一次发言时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
lastSpeakTime
;
public
String
getRobotId
()
{
return
robotId
;
}
public
void
setRobotId
(
String
robotId
)
{
this
.
robotId
=
robotId
;
}
public
String
getWxUserId
()
{
return
wxUserId
;
}
public
void
setWxUserId
(
String
wxUserId
)
{
this
.
wxUserId
=
wxUserId
;
}
public
String
getNickName
()
{
return
nickName
;
}
public
void
setNickName
(
String
nickName
)
{
this
.
nickName
=
nickName
;
}
public
String
getHeadPic
()
{
return
headPic
;
}
public
void
setHeadPic
(
String
headPic
)
{
this
.
headPic
=
headPic
;
}
public
Integer
getSex
()
{
return
sex
;
}
public
void
setSex
(
Integer
sex
)
{
this
.
sex
=
sex
;
}
public
String
getCountry
()
{
return
country
;
}
public
void
setCountry
(
String
country
)
{
this
.
country
=
country
;
}
public
String
getProvince
()
{
return
province
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
public
String
getCity
()
{
return
city
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
Integer
getSpeakCount
()
{
return
speakCount
;
}
public
void
setSpeakCount
(
Integer
speakCount
)
{
this
.
speakCount
=
speakCount
;
}
public
Integer
getSpeakCountLast7
()
{
return
speakCountLast7
;
}
public
void
setSpeakCountLast7
(
Integer
speakCountLast7
)
{
this
.
speakCountLast7
=
speakCountLast7
;
}
public
Date
getLastSpeakTime
()
{
return
lastSpeakTime
;
}
public
void
setLastSpeakTime
(
Date
lastSpeakTime
)
{
this
.
lastSpeakTime
=
lastSpeakTime
;
}
@Override
public
String
toString
()
{
return
"FriendsVO{"
+
"robotId='"
+
robotId
+
'\''
+
", wxUserId='"
+
wxUserId
+
'\''
+
", nickName='"
+
nickName
+
'\''
+
", headPic='"
+
headPic
+
'\''
+
", sex="
+
sex
+
", country='"
+
country
+
'\''
+
", province='"
+
province
+
'\''
+
", city='"
+
city
+
'\''
+
", createTime="
+
createTime
+
", state='"
+
state
+
'\''
+
", speakCount="
+
speakCount
+
", speakCountLast7="
+
speakCountLast7
+
", lastSpeakTime="
+
lastSpeakTime
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/vo/GroupQrcode4ClassifyVO.java
View file @
ae0e84fb
...
...
@@ -36,6 +36,9 @@ public class GroupQrcode4ClassifyVO implements Serializable {
@ApiModelProperty
(
"分类名称"
)
private
String
classify
;
@ApiModelProperty
(
"微信群名称"
)
private
String
weixinGroupId
;
public
String
getClassify
()
{
return
classify
;
}
...
...
@@ -92,6 +95,14 @@ public class GroupQrcode4ClassifyVO implements Serializable {
this
.
spareQr
=
spareQr
;
}
public
String
getWeixinGroupId
()
{
return
weixinGroupId
;
}
public
void
setWeixinGroupId
(
String
weixinGroupId
)
{
this
.
weixinGroupId
=
weixinGroupId
;
}
@Override
public
String
toString
()
{
return
"GroupQrcode4ClassifyVO{"
+
...
...
@@ -102,6 +113,7 @@ public class GroupQrcode4ClassifyVO implements Serializable {
", groupQrcodeId="
+
groupQrcodeId
+
", spareQr='"
+
spareQr
+
'\''
+
", classify='"
+
classify
+
'\''
+
", weixinGroupId='"
+
weixinGroupId
+
'\''
+
'}'
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/BookKeywordBiz.java
View file @
ae0e84fb
...
...
@@ -125,4 +125,10 @@ public interface BookKeywordBiz {
*/
List
<
ServiceResourceDTO
>
getServiceByChannel
(
QrWeixinParam
qrWeixinParam
,
Long
wechatUserId
);
/**
* 根据社群码id获取关键词列表
* @param bookGroupId
* @return
*/
List
<
KeywordDTO
>
getListByBookGroupId
(
Long
bookGroupId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookGuideBizImpl.java
View file @
ae0e84fb
...
...
@@ -115,6 +115,18 @@ public class BookGuideBizImpl implements BookGuideBiz {
return
;
}
String
cipher
=
agreeAddUserDTO
.
getCipher
();
//如果暗号为空,表示直接加好友,需要发送统一欢迎语
if
(
cipher
==
null
)
{
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
());
WxGroupSDK
.
sendTextMessage
(
vo
);
return
;
}
if
(
StringUtil
.
isBlank
(
cipher
))
{
cipher
=
wechatGroupConsr
.
getCipherByRobotAndUserWxId
(
agreeAddUserDTO
.
getRobotWxId
(),
agreeAddUserDTO
.
getUserWxId
());
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/biz/impl/BookKeywordBizImpl.java
View file @
ae0e84fb
...
...
@@ -16,19 +16,29 @@ import com.pcloud.book.group.biz.BookGroupBiz;
import
com.pcloud.book.group.biz.BookGroupClassifyBiz
;
import
com.pcloud.book.group.biz.GroupQrcodeBiz
;
import
com.pcloud.book.group.dao.AppTouchRecordDao
;
import
com.pcloud.book.group.dao.BookGroupCipherUserDao
;
import
com.pcloud.book.group.dao.BookGroupClassifyDao
;
import
com.pcloud.book.group.dao.BookGroupDao
;
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.GroupClassifyQrcodeDTO
;
import
com.pcloud.book.group.dto.JoinGroupCipherDTO
;
import
com.pcloud.book.group.entity.AppTouchRecord
;
import
com.pcloud.book.group.entity.BookGroup
;
import
com.pcloud.book.group.entity.BookGroupCipherUser
;
import
com.pcloud.book.group.entity.BookGroupClassify
;
import
com.pcloud.book.group.entity.BookGroupServe
;
import
com.pcloud.book.group.entity.GroupQrcode
;
import
com.pcloud.book.group.entity.JoinGroupCipher
;
import
com.pcloud.book.group.enums.QrcodeStatusEnum
;
import
com.pcloud.book.group.enums.TouchTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
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.ListClassifyVO
;
import
com.pcloud.book.keywords.biz.BookKeywordBiz
;
import
com.pcloud.book.keywords.dao.BookKeywordDao
;
import
com.pcloud.book.keywords.dao.BookKeywordRecordDao
;
...
...
@@ -71,7 +81,9 @@ import com.pcloud.resourcecenter.product.dto.ProductTypeDto;
import
com.pcloud.wechatgroup.group.dto.RobotReplyDTO
;
import
com.pcloud.wechatgroup.message.dto.SendTextDTO
;
import
com.sdk.wxgroup.ChangeNameVO
;
import
com.sdk.wxgroup.SendGroupInviteVO
;
import
com.sdk.wxgroup.SendMessageTypeEnum
;
import
com.sdk.wxgroup.SendTextMessageVO
;
import
com.sdk.wxgroup.WxGroupSDK
;
import
org.apache.commons.collections.MapUtils
;
...
...
@@ -137,7 +149,15 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@Autowired
private
GroupQrcodeBiz
groupQrcodeBiz
;
@Autowired
private
JoinGroupCipherDao
joinGroupCipherDao
;
@Autowired
private
LiveCons
liveCons
;
@Autowired
private
BookGroupCipherUserDao
bookGroupCipherUserDao
;
/**
* 字符串切割长度
*/
private
static
final
Integer
LE
=
1000
;
@Override
@ParamLog
(
"新增关键词"
)
...
...
@@ -286,7 +306,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private
void
checkKeyword
(
String
keywords
,
Long
classifyId
,
Long
bookGroupId
,
Long
keywordId
)
{
Boolean
isHaveKeyword
=
bookKeywordDao
.
checkKeyword
(
keywords
,
classifyId
,
bookGroupId
,
keywordId
);
if
(
isHaveKeyword
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"
该关键词
已存在!"
);
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"
关键词"
+
keywords
+
"
已存在!"
);
}
}
...
...
@@ -460,6 +480,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
this
.
sendKeywordMessageToGroup
(
sendTextDTO
);
return
;
}
if
(
SendMessageTypeEnum
.
SELF
.
getCode
().
equals
(
sendTextDTO
.
getCode
()))
{
dealBookGroupCipher
(
sendTextDTO
);
//判断是否为某个群分类名称
inviteToGroupByKeyword
(
sendTextDTO
);
}
//个人机器人接收消息的时候,weixinGroupId就是userWxId,也就是用户的id,robotId是接收的机器人的id
//简单过滤非关键词的词
if
(
StringUtil
.
isEmpty
(
content
)
||
content
.
length
()
>
20
)
{
...
...
@@ -583,6 +609,185 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
}
@ParamLog
(
"获取的关键词是否为社群书的暗号"
)
private
void
dealBookGroupCipher
(
SendTextDTO
sendTextDTO
)
{
BookGroup
bookGroup
=
bookGroupDao
.
getByBookGroupCipher
(
sendTextDTO
.
getTextContent
());
if
(
bookGroup
!=
null
)
{
try
{
dealByBookGroup
(
sendTextDTO
,
bookGroup
.
getId
());
}
catch
(
Exception
e
)
{
log
.
error
(
"拉群出错"
+
e
.
getMessage
());
}
}
}
@ParamLog
(
"按照书处理暗号回复"
)
private
void
dealByBookGroup
(
SendTextDTO
sendTextDTO
,
Long
bookGroupId
)
{
BookGroupCipherUser
bookGroupCipherUser
=
new
BookGroupCipherUser
();
bookGroupCipherUser
.
setBookGroupCipher
(
sendTextDTO
.
getTextContent
());
bookGroupCipherUser
.
setBookGroupId
(
bookGroupId
);
bookGroupCipherUser
.
setWxUserId
(
sendTextDTO
.
getWechatUserId
());
bookGroupCipherUser
.
setAltId
(
sendTextDTO
.
getWxId
());
//新增暗号对应记录
bookGroupCipherUserDao
.
insert
(
bookGroupCipherUser
);
BookGroupDTO
bookGroupDTO
=
bookGroupDao
.
getBookBaseInfoById
(
bookGroupId
);
String
text
=
""
;
Boolean
isInviteGroup
=
bookGroupDTO
.
getIsInviteGroup
();
// 获取配置的资源服务
List
<
BookGroupServe
>
bookGroupServeList
=
bookGroupBiz
.
getBookGroupServeList
(
bookGroupId
);
String
bookName
=
bookGroupDTO
.
getBookName
();
if
(!
ListUtils
.
isEmpty
(
bookGroupServeList
))
{
if
(!
StringUtil
.
isEmpty
(
bookName
))
{
text
=
text
+
"《"
+
bookName
+
"》"
+
"配有以下资源服务,戳链接立即获取:\n"
;
}
int
i
=
1
;
for
(
BookGroupServe
bookGroupServe
:
bookGroupServeList
)
{
if
(
i
==
1
||
i
==
2
)
{
text
=
text
+
"🔥"
;
}
text
=
text
+
i
+
"."
+
bookGroupServe
.
getServeName
()
+
bookGroupServe
.
getShortUrl
()
+
"\n"
;
i
=
i
+
1
;
}
}
else
{
text
=
text
+
"《"
+
bookName
+
"》"
+
"还没有配置资源服务,敬请期待。\n"
;
}
//获取配套关键词。先去掉,后面可能需要再加上
// List<KeywordDTO> keywordDTOS = getListByBookGroupId(bookGroupId);
// if (!ListUtils.isEmpty(keywordDTOS)) {
// text = text + "回复括号内关键词领取本书配套资源学习资料:\n";
// for (KeywordDTO keywordDTO : keywordDTOS) {
// if (!StringUtil.isEmpty(keywordDTO.getKeywords())) {
// text = text + "【" + keywordDTO.getKeywords() + "】";
// }
// }
// text = text + "\n";
// }
//邀请进群
if
(
isInviteGroup
!=
null
&&
isInviteGroup
)
{
//获取社群码下的分类
List
<
ListClassifyVO
>
listClassifyVOS
=
bookGroupClassifyBiz
.
listAllClassify
(
bookGroupId
);
if
(!
ListUtils
.
isEmpty
(
listClassifyVOS
))
{
text
=
text
+
"======================\n"
;
if
(
listClassifyVOS
.
size
()
==
1
)
{
ListClassifyVO
listClassifyVO
=
listClassifyVOS
.
get
(
0
);
//如果只有一个分类
text
=
text
+
"☕本书还配有交流群“"
+
listClassifyVO
.
getClassify
()
+
"”,"
+
listClassifyVO
.
getClassifyIntroduce
()
+
",点击下方邀请链接,即可进群"
;
//发送欢迎语
if
(
text
.
length
()
>
LE
)
{
sendTextBatch
(
sendTextDTO
,
text
,
LE
);
}
else
{
sendText
(
sendTextDTO
,
text
);
}
dealGroupInvite
(
sendTextDTO
,
listClassifyVO
.
getId
(),
listClassifyVO
.
getChangeNumber
());
}
else
{
text
=
text
+
"☕本书还配有以下交流群,选择你想加入的微信群,回复群名称,我会拉你入群!\n"
;
for
(
ListClassifyVO
listClassifyVO
:
listClassifyVOS
)
{
text
=
text
+
"☑"
+
listClassifyVO
.
getClassify
()
+
":"
+
listClassifyVO
.
getClassifyIntroduce
()
+
"\n"
;
}
//发送欢迎语
if
(
text
.
length
()
>
LE
)
{
sendTextBatch
(
sendTextDTO
,
text
,
LE
);
}
else
{
sendText
(
sendTextDTO
,
text
);
}
}
return
;
}
}
//发送配置的资源服务和关键词
if
(
text
.
length
()
>
LE
)
{
sendTextBatch
(
sendTextDTO
,
text
,
LE
);
}
else
{
sendText
(
sendTextDTO
,
text
);
}
}
@ParamLog
(
"发送收到暗号后的本书介绍"
)
private
void
sendText
(
SendTextDTO
sendTextDTO
,
String
content
)
{
String
userWxId
=
sendTextDTO
.
getWechatUserId
();
String
ip
=
sendTextDTO
.
getIp
();
Integer
code
=
sendTextDTO
.
getCode
();
String
robotId
=
sendTextDTO
.
getWxId
();
SendTextMessageVO
vo
=
new
SendTextMessageVO
();
vo
.
setContent
(
content
);
vo
.
setCode
(
code
);
vo
.
setWxId
(
robotId
);
vo
.
setAltId
(
robotId
);
vo
.
setWxGroupId
(
userWxId
);
vo
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
vo
);
log
.
info
(
"发送收到暗号后的本书介绍 : {}"
,
vo
);
}
@ParamLog
(
"发送收到暗号后的本书介绍"
)
private
void
sendTextBatch
(
SendTextDTO
sendTextDTO
,
String
content
,
Integer
le
)
{
List
<
String
>
contents
=
new
ArrayList
<>();
String
s
=
content
;
while
(
s
.
length
()
>
le
)
{
contents
.
add
(
s
.
substring
(
0
,
le
));
s
=
s
.
substring
(
le
,
s
.
length
());
}
contents
.
add
(
s
);
for
(
String
sin
:
contents
)
{
sendText
(
sendTextDTO
,
sin
);
}
}
@ParamLog
(
"分类群发送邀请入群链接"
)
private
void
dealGroupInvite
(
SendTextDTO
sendTextDTO
,
Long
classifyId
,
Integer
changeNumber
)
{
//获取分类基本信息
ClassifyVO
classify
=
bookGroupClassifyDao
.
getClassify
(
classifyId
);
if
(
classify
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"分类不存在"
);
}
//获取群
GroupQrcode4ClassifyVO
groupQrcode4ClassifyVO
=
bookGroupClassifyDao
.
getClassifyQrcode
(
classifyId
,
changeNumber
);
if
(
null
==
groupQrcode4ClassifyVO
)
{
throw
new
BookBizException
(
BookBizException
.
ID_NOT_EXIST
,
"群不存在"
);
}
String
wxGroupId
=
groupQrcode4ClassifyVO
.
getWeixinGroupId
();
//发送邀请入群
SendGroupInviteVO
sendGroupInviteVO
=
new
SendGroupInviteVO
();
sendGroupInviteVO
.
setAltId
(
sendTextDTO
.
getWxId
());
sendGroupInviteVO
.
setWxId
(
sendTextDTO
.
getWechatUserId
());
sendGroupInviteVO
.
setWxGroupId
(
wxGroupId
);
sendGroupInviteVO
.
setIp
(
sendTextDTO
.
getIp
());
WxGroupSDK
.
sendGroupInvite
(
sendGroupInviteVO
);
log
.
info
(
"[同意加好友发送欢迎语] 发送进群链接 sendGroupInviteVO:{}"
,
sendGroupInviteVO
);
}
@ParamLog
(
"根据关键词判断关键词是否为1V1社群群名称"
)
private
void
inviteToGroupByKeyword
(
SendTextDTO
sendTextDTO
)
{
String
userWxId
=
sendTextDTO
.
getWechatUserId
();
//获取这个人最近一次触发的关联社群码
Long
bookGroupId
=
bookGroupCipherUserDao
.
getBookGroupIdByWxUserId
(
userWxId
);
if
(
bookGroupId
==
null
)
{
return
;
}
List
<
BookGroupClassify
>
bookGroupClassifyList
=
bookGroupClassifyDao
.
getListByBookGroupId
(
bookGroupId
);
if
(!
ListUtils
.
isEmpty
(
bookGroupClassifyList
))
{
for
(
BookGroupClassify
bookGroupClassify
:
bookGroupClassifyList
)
{
if
(
bookGroupClassify
.
getClassify
().
equals
(
sendTextDTO
.
getTextContent
()))
{
//获取群
GroupQrcode4ClassifyVO
groupQrcode4ClassifyVO
=
bookGroupClassifyDao
.
getClassifyQrcode
(
bookGroupClassify
.
getId
(),
bookGroupClassify
.
getChangeNumber
());
if
(
null
==
groupQrcode4ClassifyVO
)
{
throw
new
BookBizException
(
BookBizException
.
ID_NOT_EXIST
,
"群不存在"
);
}
//发送邀请入群
SendGroupInviteVO
sendGroupInviteVO
=
new
SendGroupInviteVO
();
sendGroupInviteVO
.
setAltId
(
sendTextDTO
.
getWxId
());
sendGroupInviteVO
.
setWxId
(
sendTextDTO
.
getWechatUserId
());
sendGroupInviteVO
.
setWxGroupId
(
groupQrcode4ClassifyVO
.
getWeixinGroupId
());
sendGroupInviteVO
.
setIp
(
sendTextDTO
.
getIp
());
WxGroupSDK
.
sendGroupInvite
(
sendGroupInviteVO
);
log
.
info
(
"邀请入群"
+
sendGroupInviteVO
.
toString
());
}
}
}
}
private
boolean
insertBookKeywordRecord
(
String
weixinGroupId
,
String
userWxId
,
ReplyKeywordDTO
replyKeywordDTO
,
GroupClassifyQrcodeDTO
dto
,
String
redisContent
)
{
if
(
redisContent
!=
null
)
{
insertBookKeywordRecord
(
dto
,
replyKeywordDTO
.
getKeywordId
(),
userWxId
,
weixinGroupId
,
false
);
...
...
@@ -923,6 +1128,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
return
ResponesUtils
.
list
(
messageBookVOS
,
ServiceResourceDTO
.
class
);
}
@ParamLog
(
"根据社群码id获取关键词列表"
)
@Override
public
List
<
KeywordDTO
>
getListByBookGroupId
(
Long
bookGroupId
)
{
return
bookKeywordDao
.
getListByBookGroupId
(
bookGroupId
);
}
@Override
public
ReplyKeywordDTO
getReplyKeyword
(
String
content
,
String
weixinGroupId
,
String
wexinGroupName
)
{
ReplyKeywordDTO
replyKeywordDTO
=
null
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dao/BookKeywordDao.java
View file @
ae0e84fb
...
...
@@ -110,4 +110,21 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
* @date 2019/9/11 17:24
*/
void
updateRank
(
Long
bookGroupId
,
Integer
rank
,
Long
partyId
,
Long
keywordId
);
/**
* 根据社群码id获取列表
* @param bookGroupId
* @return
*/
List
<
KeywordDTO
>
getListByBookGroupId
(
Long
bookGroupId
);
/**
* 根据社群码id集合获取列表
*/
List
<
KeywordDTO
>
getListByBookGroupIdsAndType
(
List
<
Long
>
bookGroupIds
,
Integer
replyType
);
/**
* 根据社群码id逻辑删除
*/
void
deleteByBookGroupIds
(
List
<
Long
>
bookGroupIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dao/impl/BookKeywordDaoImpl.java
View file @
ae0e84fb
...
...
@@ -144,4 +144,22 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
paramMap
.
put
(
"keywordId"
,
keywordId
);
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"updateRank"
),
paramMap
);
}
@Override
public
List
<
KeywordDTO
>
getListByBookGroupId
(
Long
bookGroupId
)
{
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getListByBookGroupId"
),
bookGroupId
);
}
@Override
public
List
<
KeywordDTO
>
getListByBookGroupIdsAndType
(
List
<
Long
>
bookGroupIds
,
Integer
replyType
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"bookGroupIds"
,
bookGroupIds
);
paramMap
.
put
(
"replyType"
,
replyType
);
return
this
.
getSqlSession
().
selectList
(
this
.
getStatement
(
"getListByBookGroupIdsAndType"
),
paramMap
);
}
@Override
public
void
deleteByBookGroupIds
(
List
<
Long
>
bookGroupIds
)
{
this
.
getSqlSession
().
update
(
this
.
getStatement
(
"deleteByBookGroupIds"
),
bookGroupIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/keywords/dto/KeywordDTO.java
View file @
ae0e84fb
...
...
@@ -49,5 +49,11 @@ public class KeywordDTO implements Serializable {
@ApiModelProperty
(
"回复类型"
)
private
Integer
replyType
;
@ApiModelProperty
(
"社群书id"
)
private
Long
bookGroupId
;
@ApiModelProperty
(
"创建人"
)
private
Long
createUser
;
}
pcloud-service-book/src/main/resources/mapper/book/Book.Mapper.xml
View file @
ae0e84fb
...
...
@@ -53,6 +53,8 @@
<result
column=
"SECOND_TEMPLET_ID"
property=
"secondTempletId"
jdbcType=
"BIGINT"
/>
<result
column=
"SECOND_TYPE_CODE"
property=
"secondTypeCode"
jdbcType=
"BIGINT"
/>
<result
column=
"BOOK_GROUP_ID"
property=
"bookGroupId"
jdbcType=
"BIGINT"
/>
<result
column=
"join_group_type"
property=
"joinGroupType"
jdbcType=
"INTEGER"
/>
<result
column=
"book_group_cipher"
property=
"bookGroupCipher"
jdbcType=
"VARCHAR"
/>
</resultMap>
<resultMap
id=
"bookListPageMap"
type=
"bookDto"
extends =
"bookMap"
>
...
...
@@ -557,7 +559,7 @@
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT, A.TEMPLET_ID, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber,
G.update_time LAST_MODIFIED_DATE, G.create_time CREATED_DATE, G.id BOOK_GROUP_ID, G.group_qrcode_url groupQrcodeUrl,
G.group_qrcode_name groupQrcodeName, G.dep_label_id depLabelId
G.group_qrcode_name groupQrcodeName, G.dep_label_id depLabelId
, G.join_group_type, G.book_group_cipher
FROM
book_group G
LEFT JOIN BOOK_ADVISER A ON G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID
...
...
pcloud-service-book/src/main/resources/mapper/group/BookGroupCipherUser.xml
0 → 100644
View file @
ae0e84fb
<?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.BookGroupCipherUserDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.group.entity.BookGroupCipherUser"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"book_group_id"
property=
"bookGroupId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_group_cipher"
property=
"bookGroupCipher"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_user_id"
property=
"wxUserId"
jdbcType=
"VARCHAR"
/>
<result
column=
"alt_id"
property=
"altId"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, book_group_id, book_group_cipher, wx_user_id, alt_id, create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.group.entity.BookGroupCipherUser"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into book_group_cipher_user
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
book_group_id,
book_group_cipher,
wx_user_id,
alt_id,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{bookGroupId,jdbcType=BIGINT},
#{bookGroupCipher,jdbcType=VARCHAR},
#{wxUserId,jdbcType=VARCHAR},
#{altId,jdbcType=VARCHAR},
NOW()
</trim>
</insert>
<!--根据用户查询社群码id-->
<select
id=
"getBookGroupIdByWxUserId"
parameterType=
"String"
resultType=
"long"
>
select book_group_id from book_group_cipher_user t where t.wx_user_id=#{wxUserId} order by create_time desc limit 1
</select>
<select
id=
"getFriendsCountByBookGroup"
parameterType=
"long"
resultType=
"integer"
>
SELECT
COUNT(DISTINCT wx_user_id)
FROM
book_group_cipher_user
WHERE
book_group_id = #{bookGroupId}
</select>
<select
id=
"getBookGroupFriendsCountByDay"
parameterType=
"map"
resultType=
"com.pcloud.book.group.dto.DayCountDTO"
>
SELECT
COUNT(DISTINCT a.wx_user_id) count,
DATE_FORMAT(a.create_time, "%Y-%m-%d") date
FROM
(
SELECT
wx_user_id,create_time
FROM
book_group_cipher_user
WHERE
book_group_id = #{bookGroupId}
GROUP BY
wx_user_id
) AS a
WHERE
a.create_time >= #{startTime}
AND a.create_time
<
= #{endTime}
GROUP BY
DATE_FORMAT(a.create_time, "%Y-%m-%d")
</select>
<select
id=
"listPageFriendsStatistic"
parameterType=
"map"
resultType=
"com.pcloud.book.group.vo.FriendsVO"
>
SELECT
wx_user_id wxUserId,
alt_id robotId,
create_time createTime
FROM
book_group_cipher_user
WHERE
book_group_id = #{bookGroupId}
GROUP BY
wx_user_id,
alt_id
ORDER BY
create_time DESC,id DESC
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/BookGroupClassify.Mapper.xml
View file @
ae0e84fb
...
...
@@ -36,6 +36,11 @@
<result
column=
"book_clock_info_id"
property=
"bookClockInfoId"
jdbcType=
"BIGINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, book_id, channel_id, book_group_id, classify, classify_introduce, price, product_id, product_spec_id, change_number,
rank, create_user, update_user, create_time, update_time, is_delete, has_open_learning_report
</sql>
<insert
id=
"insert"
parameterType=
"BookGroupClassify"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
INSERT INTO book_group_classify
...
...
@@ -397,10 +402,11 @@
classify_id classifyId,
id groupQrcodeId,
qrcode_url qrcodeUrl,
weixin_group_id weixinGroupId,
group_name groupName
FROM
book_group_qrcode
WHERE user_number
<![CDATA[ < ]]>
#{changeNumber} AND classify_id = #{classifyId} AND use_state = 1 AND is_delete = 0 limit 1
WHERE user_number
<![CDATA[ < ]]>
#{changeNumber} AND classify_id = #{classifyId} AND use_state = 1 AND is_delete = 0
order by user_number asc
limit 1
</select>
<select
id=
"listGroupClassifyByAdviser"
resultType=
"com.pcloud.book.group.vo.BookGroupClassifyVO"
parameterType=
"map"
>
...
...
@@ -970,4 +976,15 @@
group by bgc.id
</select>
<!--根据社群码id集合获取-->
<select
id=
"getListByBookGroupId"
parameterType=
"list"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM
book_group_classify t
WHERE
t.book_group_id =#{bookGroupId}
AND t.is_delete = 0
order by create_time asc
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/BookGroupMapper.xml
View file @
ae0e84fb
...
...
@@ -21,6 +21,10 @@
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"BIT"
/>
<result
column=
"is_show_book_name"
property=
"isShowBookName"
jdbcType=
"BOOLEAN"
/>
<result
column=
"join_group_type"
property=
"joinGroupType"
jdbcType=
"INTEGER"
/>
<result
column=
"add_friend_guide"
property=
"addFriendGuide"
jdbcType=
"VARCHAR"
/>
<result
column=
"customer_service_name"
property=
"customerServiceName"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_invite_group"
property=
"isInviteGroup"
jdbcType=
"BOOLEAN"
/>
<result
column=
"book_group_cipher"
property=
"bookGroupCipher"
jdbcType=
"VARCHAR"
/>
</resultMap>
<resultMap
id=
"BookGroupDTO"
type=
"com.pcloud.book.group.dto.BookGroupDTO"
>
...
...
@@ -47,13 +51,18 @@
<result
column=
"book_clock_info_id"
property=
"bookClockInfoId"
jdbcType=
"BIGINT"
/>
<result
column=
"is_show_book_name"
property=
"isShowBookName"
jdbcType=
"BOOLEAN"
/>
<result
column=
"join_group_type"
property=
"joinGroupType"
jdbcType=
"INTEGER"
/>
<result
column=
"add_friend_guide"
property=
"addFriendGuide"
jdbcType=
"VARCHAR"
/>
<result
column=
"customer_service_name"
property=
"customerServiceName"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_invite_group"
property=
"isInviteGroup"
jdbcType=
"BOOLEAN"
/>
<result
column=
"book_group_cipher"
property=
"bookGroupCipher"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
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,
create_time,
update_time, is_delete, is_show_book_name,join_group_type
update_time, is_delete, is_show_book_name,join_group_type,add_friend_guide,customer_service_name,
is_invite_group,book_group_cipher
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
...
...
@@ -178,6 +187,10 @@
create_time,
update_time,
is_show_book_name,
add_friend_guide,
customer_service_name,
is_invite_group,
book_group_cipher,
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{bookId,jdbcType=BIGINT},
...
...
@@ -196,6 +209,10 @@
NOW(),
NOW(),
#{isShowBookName,jdbcType=BOOLEAN},
#{addFriendGuide,jdbcType=VARCHAR},
#{customerServiceName,jdbcType=VARCHAR},
#{isInviteGroup,jdbcType=BOOLEAN},
#{bookGroupCipher,jdbcType=VARCHAR},
</trim>
</insert>
...
...
@@ -244,6 +261,18 @@
<if
test=
"joinGroupType != null"
>
join_group_type = #{joinGroupType},
</if>
<if
test=
"addFriendGuide != null"
>
add_friend_guide = #{addFriendGuide},
</if>
<if
test=
"customerServiceName != null"
>
customer_service_name = #{customerServiceName},
</if>
<if
test=
"isInviteGroup != null"
>
is_invite_group = #{isInviteGroup},
</if>
<if
test=
"bookGroupCipher != null"
>
book_group_cipher = #{bookGroupCipher},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
...
...
@@ -383,4 +412,50 @@
ORDER BY
g.create_time DESC, g.id DESC
</select>
<!--根据id获取社群码基本信息(包括书籍信息)-->
<select
id=
"getBookBaseInfoById"
parameterType=
"list"
resultMap=
"BookGroupDTO"
>
SELECT
bg.id,
bg.book_id,
bg.group_qrcode_name,
bg.add_friend_guide,
bg.is_invite_group,
b.book_name,
b.cover_img book_img,
b.isbn
FROM
book_group bg
LEFT JOIN book b ON bg.book_id = b.BOOK_ID
where bg.id=#{bookGroupId}
</select>
<select
id=
"getBookGroupFriendsCountByAdviser"
resultType=
"integer"
parameterType=
"long"
>
SELECT
COUNT(DISTINCT c.wx_id)
FROM
book_group G
LEFT JOIN join_group_cipher c ON G.id = c.book_group_id
WHERE
G.create_user = #{adviserId, jdbcType=BIGINT}
AND G.is_delete = 0
AND c.has_used = 1
</select>
<!--根据社群码暗号获取-->
<select
id=
"getByBookGroupCipher"
parameterType=
"String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from book_group
where book_group_cipher=#{bookGroupCipher}
and is_delete=0
limit 1
</select>
<!--根据入群方式查询社群书集合-->
<select
id=
"getBookGroupByJoinGroupType"
parameterType=
"Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from book_group
where join_group_type=#{joinGroupType}
and is_delete=0
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/BookGroupServe.xml
0 → 100644
View file @
ae0e84fb
<?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.BookGroupServeDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.group.entity.BookGroupServe"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"serve_id"
property=
"serveId"
jdbcType=
"BIGINT"
/>
<result
column=
"serve_type"
property=
"serveType"
jdbcType=
"VARCHAR"
/>
<result
column=
"serve_url"
property=
"serveUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"short_url"
property=
"shortUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"book_group_id"
property=
"bookGroupId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, serve_id, serve_type, serve_url, short_url, book_group_id, create_user, create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.group.entity.BookGroupServe"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into book_group_serve
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
serve_id,
serve_type,
serve_url,
short_url,
book_group_id,
create_user,
create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{serveUrl,jdbcType=VARCHAR},
#{shortUrl,jdbcType=VARCHAR},
#{bookGroupId,jdbcType=BIGINT},
#{createUser,jdbcType=INTEGER},
NOW()
</trim>
</insert>
<!--批量插入-->
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.group.entity.BookGroupServe"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into book_group_serve (
serve_id,
serve_type,
serve_url,
short_url,
book_group_id,
create_user,
create_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.serveUrl,jdbcType=VARCHAR},
#{item.shortUrl,jdbcType=VARCHAR},
#{item.bookGroupId,jdbcType=BIGINT},
#{item.createUser,jdbcType=INTEGER},
NOW()
)
</foreach>
</insert>
<!--删除-->
<delete
id=
"deleteById"
parameterType=
"long"
>
delete from book_group_serve
where id=#{id}
</delete>
<!--根据社群书id获取集合-->
<select
id=
"getListByBookGroupId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from book_group_serve
where book_group_id=#{bookGroupId}
</select>
<!--根据bookGroupId删除-->
<delete
id=
"deleteByBookGroupId"
parameterType=
"long"
>
delete from book_group_serve
where book_group_id=#{bookGroupId}
</delete>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/group/GroupQrcode.Mapper.xml
View file @
ae0e84fb
...
...
@@ -700,6 +700,37 @@
from book_group_qrcode where classify_id = #{classifyId} and is_delete = 0
</select>
<!--根据社群码id集合获取-->
<select
id=
"getListByBookGroupIds"
parameterType=
"list"
resultMap=
"BaseResultMap"
>
SELECT
t.id,
t.classify_id,
t.group_name,
t.group_seq,
t.user_number,
t.weixin_qrcode_id,
t.weixin_group_id,
t.qrcode_url,
t.use_state,
t.qrcode_state,
t.create_user,
t.create_time,
t.update_time,
t.is_delete,
t.riddle_open
FROM
book_group_qrcode t
INNER JOIN book_group_classify t1 ON t.classify_id = t1.id
WHERE
t1.book_group_id IN
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
AND t.is_delete = 0
AND t1.is_delete = 0
GROUP BY t.id
</select>
<select
id=
"getWechatGroupInfoMap"
parameterType=
"list"
resultType=
"com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising"
>
select id groupQrcodeId, group_name groupName, qrcode_url qrcodeUrl from book_group_qrcode where id in
<foreach
collection=
"list"
separator=
","
open=
"("
close=
")"
item=
"id"
>
...
...
pcloud-service-book/src/main/resources/mapper/group/JoinGroupCipher.xml
View file @
ae0e84fb
...
...
@@ -4,6 +4,7 @@
<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=
"book_group_id"
property=
"bookGroupId"
jdbcType=
"BIGINT"
/>
<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"
/>
...
...
@@ -16,7 +17,7 @@
</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, type
id, cipher,
book_group_id,
classify_id, qrcode_id, create_time, wechat_user_id, update_time, wx_id, has_used, alt_id, type
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.group.entity.JoinGroupCipher"
useGeneratedKeys=
"true"
...
...
@@ -24,6 +25,7 @@
insert into join_group_cipher
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
cipher,
book_group_id,
classify_id,
qrcode_id,
create_time,
...
...
@@ -34,6 +36,7 @@
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{cipher,jdbcType=VARCHAR},
#{bookGroupId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
now(),
...
...
@@ -105,6 +108,26 @@
AND c.wx_id = #{wxId}
</select>
<!--根据条件获取-->
<select
id=
"getByCondition"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from join_group_cipher
where wechat_user_id=#{wechatUserId} and
book_group_id=#{bookGroupId} and
type=#{type}
</select>
<!--根据用户微信id、机器人id、类型获取暗号集合-->
<select
id=
"getListByAltIdAndWxIdAndType"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from join_group_cipher
where wx_id=#{userWxId} and
alt_id=#{robotId} and
type=#{type}
</select>
<!--根据用户id和群id获取基本信息-->
<select
id=
"getByWechatUserIdAndQrcodeId"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from join_group_cipher
...
...
pcloud-service-book/src/main/resources/mapper/keywords/BookKeyword.Mapper.xml
View file @
ae0e84fb
...
...
@@ -2,6 +2,27 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.keywords.dao.impl.BookKeywordDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.keywords.entity.BookKeyword"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"keyword_id"
property=
"keywordId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_group_id"
property=
"bookGroupId"
jdbcType=
"BIGINT"
/>
<result
column=
"book_id"
property=
"bookId"
jdbcType=
"BIGINT"
/>
<result
column=
"channel_id"
property=
"channelId"
jdbcType=
"BIGINT"
/>
<result
column=
"classify_id"
property=
"classifyId"
jdbcType=
"BIGINT"
/>
<result
column=
"rank"
property=
"rank"
jdbcType=
"TINYINT"
/>
<result
column=
"set_type"
property=
"setType"
jdbcType=
"TINYINT"
/>
<result
column=
"create_user"
property=
"createUser"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_user"
property=
"updateUser"
jdbcType=
"BIGINT"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"is_warehouse"
property=
"isWarehouse"
jdbcType=
"TINYINT"
/>
<result
column=
"warehouse_id"
property=
"warehouseId"
jdbcType=
"BIGINT"
/>
<result
column=
"is_edit"
property=
"isEdit"
jdbcType=
"TINYINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,keyword_id,book_group_id, book_id, channel_id, classify_id, rank, set_type, is_delete,create_user, create_time, update_user,
update_time, is_warehouse, warehouse_id, is_edit
</sql>
<insert
id=
"insert"
parameterType=
"bookKeyword"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into book_keyword
...
...
@@ -381,4 +402,63 @@
AND t2.reply_type = 4
order by t.create_time desc
</select>
<!--根据社群码id获取列表-->
<select
id=
"getListByBookGroupId"
resultType=
"com.pcloud.book.keywords.dto.KeywordDTO"
parameterType=
"Long"
>
SELECT
k.keywords,
k.id keywordId,
bk.is_warehouse as isWarehouse,
bk.warehouse_id as warehouseId,
k.guide
FROM
book_keyword bk
JOIN
keyword k ON bk.keyword_id = k.id
WHERE
bk.is_delete = 0
AND
k.is_delete = 0
AND book_group_id = #{bookGroupId} order by bk.rank, bk.id desc
</select>
<!--根据社群码id获取列表-->
<select
id=
"getListByBookGroupIdsAndType"
resultType=
"com.pcloud.book.keywords.dto.KeywordDTO"
parameterType=
"map"
>
SELECT
k.keywords,
k.id keywordId,
bk.is_warehouse as isWarehouse,
bk.warehouse_id as warehouseId,
bk.book_group_id bookGroupId,
k.guide,
k.reply_type replyType,
k.content,
k.description,
k.link_url linkUrl,
k.serve_id serveId,
k.serve_type serveType,
bk.create_user createUser
FROM
book_keyword bk
JOIN
keyword k ON bk.keyword_id = k.id
WHERE
bk.is_delete = 0
AND
k.is_delete = 0
AND bk.book_group_id in
<foreach
collection=
"bookGroupIds"
separator=
","
index=
"index"
item=
"item"
open=
"("
close=
")"
>
#{item}
</foreach>
and k.reply_type=#{replyType}
</select>
<!--根据社群码id逻辑删除-->
<update
id=
"deleteByBookGroupIds"
parameterType=
"list"
>
update book_keyword set is_delete=1,update_time=now()
where book_group_id in
<foreach
collection=
"list"
separator=
","
index=
"index"
item=
"item"
open=
"("
close=
")"
>
#{item}
</foreach>
</update>
</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