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
7f8997b0
Commit
7f8997b0
authored
Mar 14, 2020
by
阮思源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1002495小睿小程序
parent
00862ee1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
941 additions
and
2 deletions
+941
-2
CultivateBiz.java
...main/java/com/pcloud/book/cultivate/biz/CultivateBiz.java
+49
-0
CultivateBizImpl.java
.../com/pcloud/book/cultivate/biz/impl/CultivateBizImpl.java
+0
-0
CultivateConstant.java
...com/pcloud/book/cultivate/constant/CultivateConstant.java
+24
-0
CultivateDao.java
...main/java/com/pcloud/book/cultivate/dao/CultivateDao.java
+12
-0
CultivateRecordDao.java
...ava/com/pcloud/book/cultivate/dao/CultivateRecordDao.java
+19
-0
CultivateRobotClassifyDao.java
.../pcloud/book/cultivate/dao/CultivateRobotClassifyDao.java
+8
-0
CultivateDaoImpl.java
.../com/pcloud/book/cultivate/dao/impl/CultivateDaoImpl.java
+21
-0
CultivateRecordDaoImpl.java
...cloud/book/cultivate/dao/impl/CultivateRecordDaoImpl.java
+54
-0
CultivateRobotClassifyDaoImpl.java
...ook/cultivate/dao/impl/CultivateRobotClassifyDaoImpl.java
+21
-0
CreateCultivateDTO.java
...ava/com/pcloud/book/cultivate/dto/CreateCultivateDTO.java
+10
-0
EnergyConsumptionDTO.java
...a/com/pcloud/book/cultivate/dto/EnergyConsumptionDTO.java
+18
-0
EnergyConsumptionDelayDTO.java
.../pcloud/book/cultivate/dto/EnergyConsumptionDelayDTO.java
+17
-0
FishBallConversionDTO.java
.../com/pcloud/book/cultivate/dto/FishBallConversionDTO.java
+18
-0
FishBallPickDTO.java
...n/java/com/pcloud/book/cultivate/dto/FishBallPickDTO.java
+19
-0
SkillUseDTO.java
.../main/java/com/pcloud/book/cultivate/dto/SkillUseDTO.java
+18
-0
Cultivate.java
...main/java/com/pcloud/book/cultivate/entity/Cultivate.java
+29
-0
CultivateRecord.java
...ava/com/pcloud/book/cultivate/entity/CultivateRecord.java
+51
-0
CultivateRobotClassify.java
.../pcloud/book/cultivate/entity/CultivateRobotClassify.java
+23
-0
CultivateChangeTypeEnum.java
.../pcloud/book/cultivate/enums/CultivateChangeTypeEnum.java
+61
-0
CultivateSkillTypeEnum.java
...m/pcloud/book/cultivate/enums/CultivateSkillTypeEnum.java
+42
-0
FishBallChangeTypeEnum.java
...m/pcloud/book/cultivate/enums/FishBallChangeTypeEnum.java
+18
-0
CultivateFacade.java
...ava/com/pcloud/book/cultivate/facade/CultivateFacade.java
+160
-0
DelayReceiver.java
...src/main/java/com/pcloud/book/mq/delay/DelayReceiver.java
+6
-0
PersonalMedalFacade.java
.../com/pcloud/book/personal/facade/PersonalMedalFacade.java
+1
-2
Cultivate.xml
...ce-book/src/main/resources/mapper/cultivate/Cultivate.xml
+83
-0
CultivateRecord.xml
...k/src/main/resources/mapper/cultivate/CultivateRecord.xml
+111
-0
CultivateRobotClassify.xml
...ain/resources/mapper/cultivate/CultivateRobotClassify.xml
+48
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/biz/CultivateBiz.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
biz
;
import
com.pcloud.book.cultivate.dto.CreateCultivateDTO
;
import
com.pcloud.book.cultivate.dto.EnergyConsumptionDTO
;
import
com.pcloud.book.cultivate.dto.FishBallConversionDTO
;
import
com.pcloud.book.cultivate.dto.FishBallPickDTO
;
import
com.pcloud.book.cultivate.dto.SkillUseDTO
;
import
com.pcloud.book.cultivate.entity.Cultivate
;
import
com.pcloud.book.cultivate.entity.CultivateRecord
;
import
com.pcloud.book.cultivate.entity.CultivateRobotClassify
;
import
com.pcloud.book.personal.dto.PersonalMedalRecordDto
;
import
com.pcloud.common.core.mq.DelayQueueDTO
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
public
interface
CultivateBiz
{
Long
createCultivate
(
CreateCultivateDTO
createCultivateDTO
);
Cultivate
getCultivate
(
Long
wechatUserId
);
void
createCultivateRobotClassify
(
CultivateRobotClassify
cultivateRobotClassify
);
void
energyConsumption
(
EnergyConsumptionDTO
energyConsumptionDTO
);
void
dealDelayEnergyConsumption
(
DelayQueueDTO
delayQueueDTO
);
void
fishBallConversion
(
FishBallConversionDTO
fishBallConversionDTO
);
Long
createCultivateRecord
(
CultivateRecord
cultivateRecord
);
void
addUseSkillRecord
(
Long
wechatUserId
,
SkillUseDTO
skillUseDTO
);
void
fishBallPick
(
FishBallPickDTO
fishBallPickDTO
);
Integer
getFishBallNotPick
(
Long
cultivateId
);
PageBeanNew
<
CultivateRecord
>
getCultivateRecordList
(
Long
cultivateId
,
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
);
Long
getLoginDays
(
Long
wechatUserId
);
Integer
getRanking
(
Long
wechatUserId
);
String
shareMedal
(
Long
wechatUserId
);
List
<
PersonalMedalRecordDto
>
getUserMedalList
(
Long
wechatUserId
);
Integer
getResidueLightTime
(
Long
cultivateId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/biz/impl/CultivateBizImpl.java
0 → 100644
View file @
7f8997b0
This diff is collapsed.
Click to expand it.
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/constant/CultivateConstant.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
constant
;
public
class
CultivateConstant
{
public
static
final
Integer
INITIAL_ENERGY
=
800
;
public
static
final
Integer
INITIAL_STAR
=
30
;
public
static
final
String
ENERGY_CONSUMPTION_DELAY
=
"ENERGY_CONSUMPTION_DELAY"
;
public
static
final
String
USE_SKILL_PRE
=
"使用技能"
;
public
static
final
Integer
FIRST_MEDAL_STAR
=
30
;
public
static
final
Integer
second_MEDAL_STAR
=
90
;
public
static
final
Integer
third_MEDAL_STAR
=
180
;
public
static
final
Integer
fourth_MEDAL_STAR
=
360
;
public
static
final
Integer
fifth_MEDAL_STAR
=
500
;
public
static
final
Integer
sixth_MEDAL_STAR
=
1000
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dao/CultivateDao.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dao
;
import
com.pcloud.book.cultivate.entity.Cultivate
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
public
interface
CultivateDao
extends
BaseDao
<
Cultivate
>
{
Cultivate
getByWechatUserId
(
Long
wechatUserId
);
List
<
Cultivate
>
getAllOrderByStar
();
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dao/CultivateRecordDao.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dao
;
import
com.pcloud.book.cultivate.entity.CultivateRecord
;
import
com.pcloud.common.core.dao.BaseDao
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
public
interface
CultivateRecordDao
extends
BaseDao
<
CultivateRecord
>
{
Integer
getEnergyConsumptionAfter
(
Long
cultivateRecordId
,
Long
wechatUserId
);
CultivateRecord
getLastEnergyConsumptionRecord
(
Long
wechatUserId
,
Long
cultivateId
);
Integer
getUserGatherFishBallCount
(
Long
wechatUserId
,
Long
cultivateId
);
CultivateRecord
getLastLighten
(
Long
wechatUserId
,
Long
cultivateId
);
CultivateRecord
getLastEnergyConsumptionBefore
(
Long
cultivateRecordId
,
Long
wechatUserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dao/CultivateRobotClassifyDao.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dao
;
import
com.pcloud.book.cultivate.entity.CultivateRobotClassify
;
import
com.pcloud.common.core.dao.BaseDao
;
public
interface
CultivateRobotClassifyDao
extends
BaseDao
<
CultivateRobotClassify
>
{
CultivateRobotClassify
getByCondition
(
Long
wechatUserId
,
Long
cultivateId
,
Long
robotClassifyId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dao/impl/CultivateDaoImpl.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dao
.
impl
;
import
com.pcloud.book.cultivate.dao.CultivateDao
;
import
com.pcloud.book.cultivate.entity.Cultivate
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
(
"cultivateDao"
)
public
class
CultivateDaoImpl
extends
BaseDaoImpl
<
Cultivate
>
implements
CultivateDao
{
@Override
public
Cultivate
getByWechatUserId
(
Long
wechatUserId
)
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByWechatUserId"
),
wechatUserId
);
}
@Override
public
List
<
Cultivate
>
getAllOrderByStar
()
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAllOrderByStar"
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dao/impl/CultivateRecordDaoImpl.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dao
.
impl
;
import
com.pcloud.book.cultivate.dao.CultivateRecordDao
;
import
com.pcloud.book.cultivate.entity.CultivateRecord
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Component
(
"cultivateRecordDao"
)
public
class
CultivateRecordDaoImpl
extends
BaseDaoImpl
<
CultivateRecord
>
implements
CultivateRecordDao
{
@Override
public
Integer
getEnergyConsumptionAfter
(
Long
cultivateRecordId
,
Long
wechatUserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cultivateRecordId"
,
cultivateRecordId
);
map
.
put
(
"wechatUserId"
,
wechatUserId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getEnergyConsumptionAfter"
),
map
);
}
@Override
public
CultivateRecord
getLastEnergyConsumptionRecord
(
Long
wechatUserId
,
Long
cultivateId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cultivateId"
,
cultivateId
);
map
.
put
(
"wechatUserId"
,
wechatUserId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getLastEnergyConsumptionRecord"
),
map
);
}
@Override
public
Integer
getUserGatherFishBallCount
(
Long
wechatUserId
,
Long
cultivateId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cultivateId"
,
cultivateId
);
map
.
put
(
"wechatUserId"
,
wechatUserId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getUserGatherFishBallCount"
),
map
);
}
@Override
public
CultivateRecord
getLastLighten
(
Long
wechatUserId
,
Long
cultivateId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cultivateId"
,
cultivateId
);
map
.
put
(
"wechatUserId"
,
wechatUserId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getLastLighten"
),
map
);
}
@Override
public
CultivateRecord
getLastEnergyConsumptionBefore
(
Long
cultivateRecordId
,
Long
wechatUserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"cultivateRecordId"
,
cultivateRecordId
);
map
.
put
(
"wechatUserId"
,
wechatUserId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getLastEnergyConsumptionBefore"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dao/impl/CultivateRobotClassifyDaoImpl.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dao
.
impl
;
import
com.pcloud.book.cultivate.dao.CultivateRobotClassifyDao
;
import
com.pcloud.book.cultivate.entity.CultivateRobotClassify
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.Map
;
@Component
(
"cultivateRobotClassifyDao"
)
public
class
CultivateRobotClassifyDaoImpl
extends
BaseDaoImpl
<
CultivateRobotClassify
>
implements
CultivateRobotClassifyDao
{
@Override
public
CultivateRobotClassify
getByCondition
(
Long
wechatUserId
,
Long
cultivateId
,
Long
robotClassifyId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"cultivateId"
,
cultivateId
);
map
.
put
(
"robotClassifyId"
,
robotClassifyId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByCondition"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/CreateCultivateDTO.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
CreateCultivateDTO
{
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/EnergyConsumptionDTO.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
EnergyConsumptionDTO
{
@ApiModelProperty
(
"养成id"
)
private
Long
cultivateId
;
@ApiModelProperty
(
"消耗的能量数"
)
private
Integer
energy
;
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/EnergyConsumptionDelayDTO.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
EnergyConsumptionDelayDTO
implements
Serializable
{
@ApiModelProperty
(
"养成记录id"
)
private
Long
cultivateRecordId
;
@ApiModelProperty
(
"此次延时能量"
)
private
Integer
energy
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/FishBallConversionDTO.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
FishBallConversionDTO
{
@ApiModelProperty
(
"养成id"
)
private
Long
cultivateId
;
@ApiModelProperty
(
"消耗的鱼丸数"
)
private
Integer
fishBall
;
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/FishBallPickDTO.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
FishBallPickDTO
{
@ApiModelProperty
(
"养成id"
)
private
Long
cultivateId
;
@ApiModelProperty
(
"摘取的鱼丸数"
)
private
Integer
fishBall
;
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/dto/SkillUseDTO.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
SkillUseDTO
{
@ApiModelProperty
(
"用户微信id"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"养成id"
)
private
Long
cultivateId
;
@ApiModelProperty
(
"使用技能"
)
private
Integer
skillType
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/entity/Cultivate.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"小睿养成"
)
public
class
Cultivate
extends
BaseEntity
{
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"能量"
)
private
Integer
energy
;
@ApiModelProperty
(
"鱼丸"
)
private
Integer
fishBall
;
@ApiModelProperty
(
"星星"
)
private
Integer
star
;
@ApiModelProperty
(
"是否点亮"
)
private
Boolean
lighten
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/entity/CultivateRecord.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
/**
* 小睿养成记录
*/
@Data
@ApiModel
(
"小睿养成记录"
)
public
class
CultivateRecord
extends
BaseEntity
{
@ApiModelProperty
(
"养成id"
)
private
Long
cultivateId
;
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"动态类型(1鱼丸获取2点亮3熄灭4升级5使用能量值6使用技能7鱼丸兑换星星)"
)
private
Integer
changeType
;
@ApiModelProperty
(
"备注信息"
)
private
String
remark
;
@ApiModelProperty
(
"能量变化"
)
private
Integer
energyChange
;
@ApiModelProperty
(
"鱼丸变化"
)
private
Integer
fishBallChange
;
@ApiModelProperty
(
"鱼丸变化类型:1用户自己收,2熄灯之后系统自动收取"
)
private
Integer
fishBallChangeType
;
@ApiModelProperty
(
"星星变化"
)
private
Integer
starChange
;
@ApiModelProperty
(
"使用技能类型"
)
private
Integer
skillType
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/entity/CultivateRobotClassify.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"小睿养成"
)
public
class
CultivateRobotClassify
extends
BaseEntity
{
@ApiModelProperty
(
"用户id"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"养成id"
)
private
Long
cultivateId
;
@ApiModelProperty
(
"机器人分类id"
)
private
Long
robotClassifyId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/enums/CultivateChangeTypeEnum.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
enums
;
public
enum
CultivateChangeTypeEnum
{
//1鱼丸获取2点亮3熄灭4升级5使用能量值6使用技能7鱼丸兑换星星
/**
* 鱼丸获取
*/
GET_FISH_BALL
(
1
,
"鱼丸获取"
),
/**
* 点亮
*/
LIGHTEN
(
2
,
"点亮"
),
/**
* 熄灭
*/
QUENCH
(
3
,
"熄灭"
),
/**
* 升级
*/
UPGRADE
(
4
,
"升级"
),
/**
* 使用能量值
*/
USE_ENERGY
(
5
,
"使用能量值"
),
/**
* 使用技能
*/
USE_SKILL
(
6
,
"使用技能"
),
/**
* 鱼丸兑换星星
*/
FISH_BALL_CONVERT_STAR
(
7
,
"鱼丸兑换星星"
);
public
final
Integer
code
;
public
final
String
name
;
CultivateChangeTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
String
getNameByCode
(
Integer
code
)
{
if
(
code
==
null
)
{
return
null
;
}
CultivateChangeTypeEnum
[]
all
=
values
();
int
length
=
all
.
length
;
for
(
int
i
=
0
;
i
<
length
;
++
i
)
{
CultivateChangeTypeEnum
cultivateChangeTypeEnum
=
all
[
i
];
if
(
cultivateChangeTypeEnum
.
code
.
equals
(
code
))
{
return
cultivateChangeTypeEnum
.
name
;
}
}
return
null
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/enums/CultivateSkillTypeEnum.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
enums
;
public
enum
CultivateSkillTypeEnum
{
/**
* 打招呼
*/
SAY_HI
(
1
,
"打招呼"
),
/**
* 唱歌
*/
SING
(
2
,
"唱歌"
),
/**
* 爱读书
*/
READ
(
3
,
"爱读书"
);
public
final
Integer
code
;
public
final
String
name
;
CultivateSkillTypeEnum
(
Integer
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
static
String
getNameByCode
(
Integer
code
)
{
if
(
code
==
null
)
{
return
null
;
}
CultivateSkillTypeEnum
[]
all
=
values
();
int
length
=
all
.
length
;
for
(
int
i
=
0
;
i
<
length
;
++
i
)
{
CultivateSkillTypeEnum
cultivateSkillTypeEnum
=
all
[
i
];
if
(
cultivateSkillTypeEnum
.
code
.
equals
(
code
))
{
return
cultivateSkillTypeEnum
.
name
;
}
}
return
null
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/enums/FishBallChangeTypeEnum.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
enums
;
public
enum
FishBallChangeTypeEnum
{
/**
* 1用户自己收
*/
USER_CHANGE
(
1
),
/**
* 2熄灯之后系统自动收取
*/
AUTO_CHANGE
(
2
);
public
final
Integer
value
;
FishBallChangeTypeEnum
(
Integer
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/cultivate/facade/CultivateFacade.java
0 → 100644
View file @
7f8997b0
package
com
.
pcloud
.
book
.
cultivate
.
facade
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.cultivate.biz.CultivateBiz
;
import
com.pcloud.book.cultivate.dto.CreateCultivateDTO
;
import
com.pcloud.book.cultivate.dto.EnergyConsumptionDTO
;
import
com.pcloud.book.cultivate.dto.FishBallConversionDTO
;
import
com.pcloud.book.cultivate.dto.FishBallPickDTO
;
import
com.pcloud.book.cultivate.dto.SkillUseDTO
;
import
com.pcloud.book.cultivate.entity.CultivateRobotClassify
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
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.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
"养成"
)
@RestController
(
"cultivateFacade"
)
@RequestMapping
(
"cultivate"
)
public
class
CultivateFacade
{
@Autowired
private
CultivateBiz
cultivateBiz
;
@ApiOperation
(
"新增养成"
)
@PostMapping
(
"/createCultivate"
)
public
ResponseDto
<?>
createCultivate
(
@RequestBody
CreateCultivateDTO
createCultivateDTO
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
cultivateBiz
.
createCultivate
(
createCultivateDTO
));
}
@ApiOperation
(
"获取养成"
)
@GetMapping
(
"/getCultivate"
)
public
ResponseDto
<?>
getCultivate
(
@RequestParam
(
"wechatUserId"
)
@ApiParam
(
"用户id"
)
Long
wechatUserId
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
cultivateBiz
.
getCultivate
(
wechatUserId
));
}
@ApiOperation
(
"新增养成分类关联"
)
@PostMapping
(
"/createCultivateRobotClassify"
)
public
ResponseDto
<?>
createCultivateRobotClassify
(
@RequestBody
@ApiParam
(
"养成分类关联"
)
CultivateRobotClassify
cultivateRobotClassify
)
throws
BizException
,
PermissionException
{
cultivateBiz
.
createCultivateRobotClassify
(
cultivateRobotClassify
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"能量消耗"
)
@PostMapping
(
"/energyConsumption"
)
public
ResponseDto
<?>
getCultivate
(
@RequestBody
@ApiParam
(
"养成分类关联"
)
EnergyConsumptionDTO
energyConsumptionDTO
)
throws
BizException
,
PermissionException
{
cultivateBiz
.
energyConsumption
(
energyConsumptionDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"鱼丸兑换"
)
@PostMapping
(
"/fishBallConversion"
)
public
ResponseDto
<?>
fishBallConversion
(
@RequestBody
@ApiParam
(
"鱼丸兑换"
)
FishBallConversionDTO
fishBallConversionDTO
)
throws
BizException
,
PermissionException
{
cultivateBiz
.
fishBallConversion
(
fishBallConversionDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"新增技能使用记录"
)
@PostMapping
(
"/addUseSkillRecord"
)
public
ResponseDto
<?>
addUseSkillRecord
(
@RequestBody
@ApiParam
(
"鱼丸兑换"
)
SkillUseDTO
skillUseDTO
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
skillUseDTO
.
getWechatUserId
();
cultivateBiz
.
addUseSkillRecord
(
wechatUserId
,
skillUseDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"鱼丸摘取"
)
@PostMapping
(
"/fishBallPick"
)
public
ResponseDto
<?>
fishBallPick
(
@RequestBody
@ApiParam
(
"鱼丸摘取"
)
FishBallPickDTO
fishBallPickDTO
)
throws
BizException
,
PermissionException
{
cultivateBiz
.
fishBallPick
(
fishBallPickDTO
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"待摘取鱼丸数量获取"
)
@GetMapping
(
"/getFishBallNotPick"
)
public
ResponseDto
<?>
getFishBallNotPick
(
@RequestParam
(
"cultivateId"
)
@ApiParam
(
"养成id"
)
Long
cultivateId
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
cultivateBiz
.
getFishBallNotPick
(
cultivateId
));
}
@ApiOperation
(
"获取动态记录列表"
)
@GetMapping
(
"/getCultivateRecordList"
)
public
ResponseDto
<?>
getCultivateRecordList
(
@RequestParam
Long
wechatUserId
,
@RequestParam
(
"cultivateId"
)
@ApiParam
(
"养成id"
)
Long
cultivateId
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
if
(
currentPage
==
null
||
numPerPage
==
null
||
currentPage
<
0
||
numPerPage
<
0
)
{
throw
BookBizException
.
PAGE_PARAM_DELETION
;
}
if
(!
NumberUtil
.
isNumber
(
wechatUserId
)){
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"wechatUserId 不能为空"
);
}
return
new
ResponseDto
<>(
cultivateBiz
.
getCultivateRecordList
(
cultivateId
,
wechatUserId
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"获取陪伴天数"
)
@GetMapping
(
"/getLoginDays"
)
public
ResponseDto
<?>
getLoginDays
(
@RequestParam
Long
wechatUserId
){
if
(!
NumberUtil
.
isNumber
(
wechatUserId
)){
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"wechatUserId 不能为空"
);
}
return
new
ResponseDto
<>(
cultivateBiz
.
getLoginDays
(
wechatUserId
));
}
@ApiOperation
(
"获取排名"
)
@GetMapping
(
"/getRanking"
)
public
ResponseDto
<?>
getRanking
(
@RequestParam
Long
wechatUserId
){
if
(!
NumberUtil
.
isNumber
(
wechatUserId
)){
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"wechatUserId 不能为空"
);
}
return
new
ResponseDto
<>(
cultivateBiz
.
getRanking
(
wechatUserId
));
}
@ApiOperation
(
"分享"
)
@GetMapping
(
"shareMedal"
)
public
ResponseDto
<?>
shareMedal
(
@RequestParam
Long
wechatUserId
){
if
(!
NumberUtil
.
isNumber
(
wechatUserId
)){
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"wechatUserId 不能为空"
);
}
return
new
ResponseDto
<>(
cultivateBiz
.
shareMedal
(
wechatUserId
));
}
@ApiOperation
(
"获取剩余亮灯时间"
)
@GetMapping
(
"/getResidueLightTime"
)
public
ResponseDto
<?>
getResidueLightTime
(
@RequestParam
(
"cultivateId"
)
@ApiParam
(
"养成id"
)
Long
cultivateId
)
throws
BizException
,
PermissionException
{
return
new
ResponseDto
<>(
cultivateBiz
.
getResidueLightTime
(
cultivateId
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/mq/delay/DelayReceiver.java
View file @
7f8997b0
...
...
@@ -2,6 +2,8 @@ package com.pcloud.book.mq.delay;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pcloud.book.cultivate.biz.CultivateBiz
;
import
com.pcloud.book.cultivate.constant.CultivateConstant
;
import
com.pcloud.book.personalstage.biz.PersonalStageBiz
;
import
com.pcloud.book.personalstage.biz.PersonalStageJumpBiz
;
import
com.pcloud.book.personalstage.constant.PersonalStageConstant
;
...
...
@@ -29,6 +31,8 @@ public class DelayReceiver {
private
PersonalStageBiz
personalStageBiz
;
@Autowired
private
PersonalStageJumpBiz
personalStageJumpBiz
;
@Autowired
private
CultivateBiz
cultivateBiz
;
@RabbitHandler
public
void
onMessage
(
DelayQueueDTO
dto
)
{
...
...
@@ -48,6 +52,8 @@ public class DelayReceiver {
personalStageJumpBiz
.
delayProgress
(
dto
);
}
else
if
(
PersonalStageConstant
.
PERSONALSTAGE_DELAY_PAPER
.
equalsIgnoreCase
(
dto
.
getType
()))
{
personalStageJumpBiz
.
delayPaper
(
dto
);
}
else
if
(
CultivateConstant
.
ENERGY_CONSUMPTION_DELAY
.
equals
(
dto
.
getType
()))
{
cultivateBiz
.
dealDelayEnergyConsumption
(
dto
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/personal/facade/PersonalMedalFacade.java
View file @
7f8997b0
...
...
@@ -42,8 +42,7 @@ public class PersonalMedalFacade {
@ApiOperation
(
"获取用户已获得的勋章"
)
@GetMapping
(
"getUserMedalListCount"
)
public
ResponseDto
<?>
getUserMedalListCount
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
throws
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
public
ResponseDto
<?>
getUserMedalListCount
(
@RequestParam
Long
wechatUserId
)
throws
PermissionException
{
if
(!
NumberUtil
.
isNumber
(
wechatUserId
)){
throw
new
BizException
(
BizException
.
PARAM_IS_NULL
.
getCode
(),
"wechatUserId 不能为空"
);
}
...
...
pcloud-service-book/src/main/resources/mapper/cultivate/Cultivate.xml
0 → 100644
View file @
7f8997b0
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.cultivate.dao.impl.CultivateDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.cultivate.entity.Cultivate"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"BIGINT"
/>
<result
column=
"energy"
property=
"energy"
jdbcType=
"INTEGER"
/>
<result
column=
"fish_ball"
property=
"fishBall"
jdbcType=
"INTEGER"
/>
<result
column=
"star"
property=
"star"
jdbcType=
"INTEGER"
/>
<result
column=
"lighten"
property=
"lighten"
jdbcType=
"BOOLEAN"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, wechat_user_id, energy, fish_ball, star, lighten, create_time,update_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.cultivate.entity.Cultivate"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into cultivate
(
wechat_user_id,
energy,
fish_ball,
star,
lighten,
create_time,
update_time
)
values (
#{wechatUserId},
#{energy},
#{fishBall},
#{star},
#{lighten},
NOW(),
NOW()
)
</insert>
<update
id=
"update"
parameterType=
"com.pcloud.book.cultivate.entity.Cultivate"
>
update cultivate
<set>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId,jdbcType=BIGINT},
</if>
<if
test=
"energy != null"
>
energy = #{energy,jdbcType=INTEGER},
</if>
<if
test=
"fishBall != null"
>
fish_ball = #{fishBall,jdbcType=INTEGER},
</if>
<if
test=
"star != null"
>
star = #{star,jdbcType=INTEGER},
</if>
<if
test=
"lighten != null"
>
lighten = #{lighten,jdbcType=BOOLEAN},
</if>
update_time=NOW()
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select
id=
"getById"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
cultivate
where id=#{id}
</select>
<select
id=
"getByWechatUserId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
cultivate
where wechat_user_id=#{wechatUserId}
limit 1
</select>
<select
id=
"getAllOrderByStar"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
cultivate order by star desc
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/cultivate/CultivateRecord.xml
0 → 100644
View file @
7f8997b0
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.cultivate.dao.impl.CultivateRecordDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.cultivate.entity.CultivateRecord"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"cultivate_id"
property=
"cultivateId"
jdbcType=
"BIGINT"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"BIGINT"
/>
<result
column=
"change_type"
property=
"changeType"
jdbcType=
"INTEGER"
/>
<result
column=
"remark"
property=
"remark"
jdbcType=
"VARCHAR"
/>
<result
column=
"energy_change"
property=
"energyChange"
jdbcType=
"INTEGER"
/>
<result
column=
"fish_ball_change"
property=
"fishBallChange"
jdbcType=
"INTEGER"
/>
<result
column=
"fish_ball_change_type"
property=
"fishBallChangeType"
jdbcType=
"INTEGER"
/>
<result
column=
"star_change"
property=
"starChange"
jdbcType=
"INTEGER"
/>
<result
column=
"skill_type"
property=
"skillType"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, cultivate_id, wechat_user_id, change_type, remark, energy_change, fish_ball_change, fish_ball_change_type, star_change, skill_type, create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.cultivate.entity.CultivateRecord"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into cultivate_record (cultivate_id, wechat_user_id, change_type,
remark, energy_change, fish_ball_change, fish_ball_change_type,star_change, skill_type, create_time
)
values (#{cultivateId},#{wechatUserId},#{changeType},#{remark},#{energyChange},#{fishBallChange},#{fishBallChangeType},
#{starChange}, #{skillType}, NOW()
)
</insert>
<select
id=
"getById"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
cultivate_record
where id=#{id}
</select>
<select
id=
"getEnergyConsumptionAfter"
parameterType=
"map"
resultType=
"integer"
>
select -ifnull(sum(energy_change),0) from
cultivate_record
where id>#{cultivateRecordId}
and wechat_user_id=#{wechatUserId}
and change_type=5
</select>
<select
id=
"getLastEnergyConsumptionRecord"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from cultivate_record
where cultivate_id=#{cultivateId}
and wechat_user_id=#{wechatUserId}
order by create_time desc
limit 1
</select>
<select
id=
"getUserGatherFishBallCount"
parameterType=
"map"
resultType=
"integer"
>
SELECT
IFNULL(SUM(t2.fish_ball_change), 0)
FROM
cultivate_record t2
WHERE
t2.id > (
SELECT
t.id
FROM
cultivate_record t
WHERE
t.change_type = 2
AND t.wechat_user_id = #{wechatUserId}
AND t.cultivate_id = #{cultivateId}
ORDER BY
create_time DESC
LIMIT 1
)
AND t2.change_type = 1
AND t2.wechat_user_id = #{wechatUserId}
AND t2.cultivate_id = #{cultivateId}
</select>
<select
id=
"getCultivateRecordList"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from cultivate_record
where cultivate_id=#{cultivateId}
and wechat_user_id=#{wechatUserId}
order by create_time desc,id desc
</select>
<select
id=
"getLastLighten"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM
cultivate_record t
WHERE
t.change_type = 2
AND t.wechat_user_id = #{wechatUserId}
AND t.cultivate_id = #{cultivateId}
ORDER BY
create_time DESC
LIMIT 1
</select>
<select
id=
"getLastEnergyConsumptionBefore"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from cultivate_record
where wechat_user_id=#{wechatUserId}
and id
<
#{cultivateRecordId}
and change_type=5
order by create_time desc
limit 1
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/cultivate/CultivateRobotClassify.xml
0 → 100644
View file @
7f8997b0
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.cultivate.dao.impl.CultivateRobotClassifyDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.cultivate.entity.CultivateRobotClassify"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"BIGINT"
/>
<result
column=
"cultivate_id"
property=
"cultivateId"
jdbcType=
"BIGINT"
/>
<result
column=
"robot_classify_id"
property=
"robotClassifyId"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, wechat_user_id, cultivate_id, robot_classify_id, create_time
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.cultivate.entity.CultivateRobotClassify"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into cultivate_robot_classify
(
wechat_user_id,
cultivate_id,
robot_classify_id,
create_time
)
values (
#{wechatUserId},
#{cultivateId},
#{robotClassifyId},
NOW()
)
</insert>
<select
id=
"getByCondition"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from cultivate_robot_classify
where 1=1
<if
test=
"wechatUserId!=null"
>
and wechat_user_id=#{wechatUserId}
</if>
<if
test=
"cultivateId!=null"
>
and cultivate_id=#{cultivateId}
</if>
<if
test=
"robotClassifyId!=null"
>
and robot_classify_id=#{robotClassifyId}
</if>
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment