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
4b6fd491
Commit
4b6fd491
authored
Apr 01, 2020
by
曾迫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
搜索记录列表
parent
c25c406f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
134 additions
and
15 deletions
+134
-15
SearchBookVO.java
...k/src/main/java/com/pcloud/book/book/vo/SearchBookVO.java
+15
-0
CultivateBiz.java
...main/java/com/pcloud/book/cultivate/biz/CultivateBiz.java
+3
-0
CultivateBizImpl.java
.../com/pcloud/book/cultivate/biz/impl/CultivateBizImpl.java
+75
-8
CultivateConstant.java
...com/pcloud/book/cultivate/constant/CultivateConstant.java
+9
-7
CultivateFacade.java
...ava/com/pcloud/book/cultivate/facade/CultivateFacade.java
+17
-0
CultivateRecord.xml
...k/src/main/resources/mapper/cultivate/CultivateRecord.xml
+15
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/book/vo/SearchBookVO.java
View file @
4b6fd491
...
@@ -14,6 +14,10 @@ public class SearchBookVO {
...
@@ -14,6 +14,10 @@ public class SearchBookVO {
@ApiModelProperty
(
"内容"
)
@ApiModelProperty
(
"内容"
)
private
String
content
;
private
String
content
;
@ApiModelProperty
(
"作者"
)
private
String
author
;
@ApiModelProperty
(
"书id"
)
@ApiModelProperty
(
"书id"
)
private
Long
bookId
;
private
Long
bookId
;
...
@@ -29,4 +33,15 @@ public class SearchBookVO {
...
@@ -29,4 +33,15 @@ public class SearchBookVO {
@ApiModelProperty
(
"搜索次数"
)
@ApiModelProperty
(
"搜索次数"
)
private
Integer
searchCount
;
private
Integer
searchCount
;
private
Long
adviserId
;
@ApiModelProperty
(
"书id"
)
private
Long
secondTempletId
;
private
String
secondTempletName
;
private
String
coverImg
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/biz/CultivateBiz.java
View file @
4b6fd491
package
com
.
pcloud
.
book
.
cultivate
.
biz
;
package
com
.
pcloud
.
book
.
cultivate
.
biz
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.cultivate.dto.CreateCultivateDTO
;
import
com.pcloud.book.cultivate.dto.CreateCultivateDTO
;
import
com.pcloud.book.cultivate.dto.EnergyConsumptionDTO
;
import
com.pcloud.book.cultivate.dto.EnergyConsumptionDTO
;
import
com.pcloud.book.cultivate.dto.FishBallConversionDTO
;
import
com.pcloud.book.cultivate.dto.FishBallConversionDTO
;
...
@@ -51,4 +52,6 @@ public interface CultivateBiz {
...
@@ -51,4 +52,6 @@ public interface CultivateBiz {
Long
createCultivateBookUser
(
CultivateBookUser
cultivateBookUser
);
Long
createCultivateBookUser
(
CultivateBookUser
cultivateBookUser
);
CultivateBookUser
getLastCultivateBookUser
(
Long
wechatUserId
);
CultivateBookUser
getLastCultivateBookUser
(
Long
wechatUserId
);
PageBeanNew
<
SearchBookVO
>
getBookSearchRecord
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/biz/impl/CultivateBizImpl.java
View file @
4b6fd491
package
com
.
pcloud
.
book
.
cultivate
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
cultivate
.
biz
.
impl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.vo.SearchBookVO
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.reader.ReaderConsr
;
import
com.pcloud.book.consumer.user.AdviserConsr
;
import
com.pcloud.book.cultivate.biz.CultivateBiz
;
import
com.pcloud.book.cultivate.biz.CultivateBiz
;
import
com.pcloud.book.cultivate.constant.CultivateConstant
;
import
com.pcloud.book.cultivate.constant.CultivateConstant
;
import
com.pcloud.book.cultivate.dao.CultivateBookUserDao
;
import
com.pcloud.book.cultivate.dao.CultivateBookUserDao
;
...
@@ -44,11 +49,13 @@ import com.pcloud.common.utils.string.StringUtil;
...
@@ -44,11 +49,13 @@ import com.pcloud.common.utils.string.StringUtil;
import
com.pcloud.facade.shareimage.dto.HtmlDto
;
import
com.pcloud.facade.shareimage.dto.HtmlDto
;
import
com.pcloud.facade.shareimage.facade.Htm2ImgService
;
import
com.pcloud.facade.shareimage.facade.Htm2ImgService
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.readercenter.wechat.entity.WechatUser
;
import
com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Component
(
"cultivateBiz"
)
@Component
(
"cultivateBiz"
)
public
class
CultivateBizImpl
implements
CultivateBiz
{
public
class
CultivateBizImpl
implements
CultivateBiz
{
...
@@ -85,6 +92,15 @@ public class CultivateBizImpl implements CultivateBiz {
...
@@ -85,6 +92,15 @@ public class CultivateBizImpl implements CultivateBiz {
@Autowired
@Autowired
private
CultivateBookUserDao
cultivateBookUserDao
;
private
CultivateBookUserDao
cultivateBookUserDao
;
@Autowired
private
AssistTempletConsr
assistTempletConsr
;
@Autowired
private
AdviserConsr
adviserConsr
;
...
@@ -317,14 +333,14 @@ public class CultivateBizImpl implements CultivateBiz {
...
@@ -317,14 +333,14 @@ public class CultivateBizImpl implements CultivateBiz {
}
}
if
(
cultivateRecord
.
getChangeType
().
equals
(
CultivateChangeTypeEnum
.
GET_FISH_BALL
.
code
)){
if
(
cultivateRecord
.
getChangeType
().
equals
(
CultivateChangeTypeEnum
.
GET_FISH_BALL
.
code
)){
if
(
cultivateRecord
.
getFishBallChange
()==
null
){
if
(
cultivateRecord
.
getFishBallChange
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
鱼丸
数为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
银两
数为空!"
);
}
}
if
(
cultivateRecord
.
getFishBallChangeType
()==
null
){
if
(
cultivateRecord
.
getFishBallChangeType
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
鱼丸
变化类型为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
银两
变化类型为空!"
);
}
}
cultivateRecord
.
setRemark
(
"获得了"
+
cultivateRecord
.
getFishBallChange
()+
"个
鱼丸
"
);
cultivateRecord
.
setRemark
(
"获得了"
+
cultivateRecord
.
getFishBallChange
()+
"个
银两
"
);
}
}
if
(
cultivateRecord
.
getChangeType
().
equals
(
CultivateChangeTypeEnum
.
LIGHTEN
.
code
)){
if
(
cultivateRecord
.
getChangeType
().
equals
(
CultivateChangeTypeEnum
.
LIGHTEN
.
code
)){
...
@@ -359,9 +375,9 @@ public class CultivateBizImpl implements CultivateBiz {
...
@@ -359,9 +375,9 @@ public class CultivateBizImpl implements CultivateBiz {
if
(
cultivateRecord
.
getChangeType
().
equals
(
CultivateChangeTypeEnum
.
FISH_BALL_CONVERT_STAR
.
code
)){
if
(
cultivateRecord
.
getChangeType
().
equals
(
CultivateChangeTypeEnum
.
FISH_BALL_CONVERT_STAR
.
code
)){
if
(
cultivateRecord
.
getStarChange
()==
null
){
if
(
cultivateRecord
.
getStarChange
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
星星
数量为空!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
玉璧
数量为空!"
);
}
}
cultivateRecord
.
setRemark
(
"你已将"
+
cultivateRecord
.
getStarChange
()*
100
+
"个
鱼丸兑换了"
+
cultivateRecord
.
getStarChange
()+
"颗星
"
);
cultivateRecord
.
setRemark
(
"你已将"
+
cultivateRecord
.
getStarChange
()*
100
+
"个
银两兑换了"
+
cultivateRecord
.
getStarChange
()+
"颗玉璧
"
);
}
}
cultivateRecordDao
.
insert
(
cultivateRecord
);
cultivateRecordDao
.
insert
(
cultivateRecord
);
if
(
cultivateRecord
.
getChangeType
().
equals
(
CultivateChangeTypeEnum
.
FISH_BALL_CONVERT_STAR
.
code
)){
if
(
cultivateRecord
.
getChangeType
().
equals
(
CultivateChangeTypeEnum
.
FISH_BALL_CONVERT_STAR
.
code
)){
...
@@ -403,8 +419,11 @@ public class CultivateBizImpl implements CultivateBiz {
...
@@ -403,8 +419,11 @@ public class CultivateBizImpl implements CultivateBiz {
if
(
CultivateConstant
.
fifth_MEDAL_STAR
<=
newStarCount
&&
newStarCount
<
CultivateConstant
.
sixth_MEDAL_STAR
)
{
if
(
CultivateConstant
.
fifth_MEDAL_STAR
<=
newStarCount
&&
newStarCount
<
CultivateConstant
.
sixth_MEDAL_STAR
)
{
upGradeRecord
.
setRemark
(
"已成功升级LV5学识渊博"
);
upGradeRecord
.
setRemark
(
"已成功升级LV5学识渊博"
);
}
}
if
(
CultivateConstant
.
sixth_MEDAL_STAR
<=
newStarCount
)
{
if
(
CultivateConstant
.
sixth_MEDAL_STAR
<=
newStarCount
&&
newStarCount
<
CultivateConstant
.
seventh_MEDAL_STAR
)
{
upGradeRecord
.
setRemark
(
"已成功升级LV6学亘古今"
);
upGradeRecord
.
setRemark
(
"已成功升级LV6学识渊博"
);
}
if
(
CultivateConstant
.
seventh_MEDAL_STAR
<=
newStarCount
)
{
upGradeRecord
.
setRemark
(
"已成功升级LV7学亘古今"
);
}
}
cultivateRecordDao
.
insert
(
upGradeRecord
);
cultivateRecordDao
.
insert
(
upGradeRecord
);
...
@@ -604,6 +623,46 @@ public class CultivateBizImpl implements CultivateBiz {
...
@@ -604,6 +623,46 @@ public class CultivateBizImpl implements CultivateBiz {
}
}
@Override
@Override
public
PageBeanNew
<
SearchBookVO
>
getBookSearchRecord
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"wechatUserId"
,
wechatUserId
);
PageBeanNew
<
SearchBookVO
>
pageBeanNew
=
cultivateRecordDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"getBookSearchRecord"
);
if
(
pageBeanNew
==
null
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
//填充出版社信息
List
<
Long
>
adviserIds
=
pageBeanNew
.
getRecordList
().
stream
().
filter
(
s
->
s
.
getAdviserId
()!=
null
).
map
(
SearchBookVO:
:
getAdviserId
).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
AdviserBaseInfoDto
>
infoDtoMap
=
adviserConsr
.
getAdviserId2AdviserInfoDtoMap
(
adviserIds
);
List
<
Long
>
templetIds
=
new
ArrayList
<>();
pageBeanNew
.
getRecordList
().
forEach
(
searchBookVO
->
{
if
(
Objects
.
nonNull
(
searchBookVO
.
getSecondTempletId
()))
{
templetIds
.
add
(
searchBookVO
.
getSecondTempletId
());
}
});
Map
<
Long
,
AssistTempletDTO
>
assistTempletDTOMap
=
assistTempletConsr
.
mapByIds
(
templetIds
);
pageBeanNew
.
getRecordList
().
forEach
(
searchBookVO
->
{
Long
secondTempletId
=
searchBookVO
.
getSecondTempletId
();
if
(
secondTempletId
!=
null
&&
assistTempletDTOMap
!=
null
)
{
AssistTempletDTO
templetDTO
=
assistTempletDTOMap
.
get
(
secondTempletId
);
searchBookVO
.
setSecondTempletName
(
Optional
.
ofNullable
(
templetDTO
).
map
(
AssistTempletDTO:
:
getTempletName
).
orElse
(
null
));
}
Long
adviserId
=
searchBookVO
.
getAdviserId
();
if
(
infoDtoMap
!=
null
){
AdviserBaseInfoDto
infoDto
=
infoDtoMap
.
get
(
adviserId
);
if
(
infoDto
!=
null
){
searchBookVO
.
setAgentId
(
infoDto
.
getAgentId
());
searchBookVO
.
setAgentName
(
infoDto
.
getAgentName
());
}
}
});
return
pageBeanNew
;
}
@Override
@ParamLog
(
"分享"
)
@ParamLog
(
"分享"
)
public
String
shareMedal
(
Long
wechatUserId
)
{
public
String
shareMedal
(
Long
wechatUserId
)
{
// 获取用户基本信息
// 获取用户基本信息
...
@@ -648,13 +707,21 @@ public class CultivateBizImpl implements CultivateBiz {
...
@@ -648,13 +707,21 @@ public class CultivateBizImpl implements CultivateBiz {
personalMedalRecordDtos
.
add
(
personalMedalRecordDto
);
personalMedalRecordDtos
.
add
(
personalMedalRecordDto
);
}
}
}
}
if
(
CultivateConstant
.
fifth_MEDAL_STAR
<=
cultivate
.
getStar
())
{
if
(
CultivateConstant
.
sixth_MEDAL_STAR
<=
cultivate
.
getStar
()&&
cultivate
.
getStar
()<
CultivateConstant
.
seventh_MEDAL_STAR
)
{
for
(
int
i
=
0
;
i
<
6
;
i
++)
{
for
(
int
i
=
0
;
i
<
6
;
i
++)
{
PersonalMedalRecordDto
personalMedalRecordDto
=
new
PersonalMedalRecordDto
();
PersonalMedalRecordDto
personalMedalRecordDto
=
new
PersonalMedalRecordDto
();
personalMedalRecordDto
.
setLightImgUrl
(
baseMedalList
.
get
(
i
).
getLightImgUrl
());
personalMedalRecordDto
.
setLightImgUrl
(
baseMedalList
.
get
(
i
).
getLightImgUrl
());
personalMedalRecordDtos
.
add
(
personalMedalRecordDto
);
personalMedalRecordDtos
.
add
(
personalMedalRecordDto
);
}
}
}
}
if
(
CultivateConstant
.
seventh_MEDAL_STAR
<=
cultivate
.
getStar
()){
for
(
int
i
=
0
;
i
<
7
;
i
++)
{
PersonalMedalRecordDto
personalMedalRecordDto
=
new
PersonalMedalRecordDto
();
personalMedalRecordDto
.
setLightImgUrl
(
baseMedalList
.
get
(
i
).
getLightImgUrl
());
personalMedalRecordDtos
.
add
(
personalMedalRecordDto
);
}
}
if
(
wechatUser
==
null
){
if
(
wechatUser
==
null
){
throw
new
BizException
(
BizException
.
DB_DML_FAIL
.
getCode
(),
"未找到用户信息"
);
throw
new
BizException
(
BizException
.
DB_DML_FAIL
.
getCode
(),
"未找到用户信息"
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/constant/CultivateConstant.java
View file @
4b6fd491
...
@@ -4,21 +4,23 @@ public class CultivateConstant {
...
@@ -4,21 +4,23 @@ public class CultivateConstant {
public
static
final
Integer
INITIAL_ENERGY
=
800
;
public
static
final
Integer
INITIAL_ENERGY
=
800
;
public
static
final
Integer
INITIAL_STAR
=
3
0
;
public
static
final
Integer
INITIAL_STAR
=
0
;
public
static
final
String
ENERGY_CONSUMPTION_DELAY
=
"ENERGY_CONSUMPTION_DELAY"
;
public
static
final
String
ENERGY_CONSUMPTION_DELAY
=
"ENERGY_CONSUMPTION_DELAY"
;
public
static
final
String
USE_SKILL_PRE
=
"使用技能"
;
public
static
final
String
USE_SKILL_PRE
=
"使用技能"
;
public
static
final
Integer
FIRST_MEDAL_STAR
=
3
0
;
public
static
final
Integer
FIRST_MEDAL_STAR
=
0
;
public
static
final
Integer
second_MEDAL_STAR
=
9
0
;
public
static
final
Integer
second_MEDAL_STAR
=
3
0
;
public
static
final
Integer
third_MEDAL_STAR
=
18
0
;
public
static
final
Integer
third_MEDAL_STAR
=
9
0
;
public
static
final
Integer
fourth_MEDAL_STAR
=
36
0
;
public
static
final
Integer
fourth_MEDAL_STAR
=
18
0
;
public
static
final
Integer
fifth_MEDAL_STAR
=
50
0
;
public
static
final
Integer
fifth_MEDAL_STAR
=
36
0
;
public
static
final
Integer
sixth_MEDAL_STAR
=
1000
;
public
static
final
Integer
sixth_MEDAL_STAR
=
500
;
public
static
final
Integer
seventh_MEDAL_STAR
=
1000
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/facade/CultivateFacade.java
View file @
4b6fd491
...
@@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -26,6 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.Map
;
@Api
(
"养成"
)
@Api
(
"养成"
)
@RestController
(
"cultivateFacade"
)
@RestController
(
"cultivateFacade"
)
@RequestMapping
(
"cultivate"
)
@RequestMapping
(
"cultivate"
)
...
@@ -173,5 +176,19 @@ public class CultivateFacade {
...
@@ -173,5 +176,19 @@ public class CultivateFacade {
return
new
ResponseDto
<>(
cultivateBiz
.
getLastCultivateBookUser
(
wechatUserId
));
return
new
ResponseDto
<>(
cultivateBiz
.
getLastCultivateBookUser
(
wechatUserId
));
}
}
@ApiOperation
(
"获取搜索书籍记录列表"
)
@GetMapping
(
"/getBookSearchRecord"
)
public
ResponseDto
<?>
getBookSearchRecord
(
@CookieValue
(
value
=
"userInfo"
,
required
=
false
)
String
userInfo
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(!
NumberUtil
.
isNumber
(
wechatUserId
)){
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"wechatUserId 不能为空"
);
}
return
new
ResponseDto
<>(
cultivateBiz
.
getBookSearchRecord
(
wechatUserId
,
currentPage
,
numPerPage
));
}
}
}
pcloud-service-book/src/main/resources/mapper/cultivate/CultivateRecord.xml
View file @
4b6fd491
...
@@ -107,4 +107,18 @@
...
@@ -107,4 +107,18 @@
limit 1
limit 1
</select>
</select>
<select
id=
"getBookSearchRecord"
parameterType=
"map"
resultType=
"com.pcloud.book.book.vo.SearchBookVO"
>
select a.id,a.content,a.book_id bookId ,b.book_name bookName,a.agent_id agentId,c.SECOND_TEMPLET_ID secondTempletId,b.publish ,c.ADVISER_ID adviserId
,a.create_time createTime,b.author,b.COVER_IMG coverImg
from search_record a,book b ,book_adviser c
where a.book_id=b.book_id
and a.book_id=c.book_id
and a.user_delete=0
and b.is_delete=0
and c.is_delete=0
and a.wechat_user_id is not null
and a.wechat_user_id=#{wechatUserId}
order by a.create_time desc
</select>
</mapper>
</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