Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
point-project
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
point-project
Commits
fc2e4671
Commit
fc2e4671
authored
Oct 23, 2025
by
“Kongxiangkun”
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加积分商城相关代码
parent
36229ad8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
49 deletions
+52
-49
cloud-point/src/main/java/com/yizhi/application/mapper/PointDetailsMapper.java
+1
-1
cloud-point/src/main/java/com/yizhi/application/service/impl/PointDetailsServiceImpl.java
+32
-34
cloud-point/src/main/java/com/yizhi/application/service/impl/PointServiceImpl.java
+15
-4
cloud-point/src/main/resources/mapper/PointDetailsMapper.xml
+4
-10
No files found.
cloud-point/src/main/java/com/yizhi/application/mapper/PointDetailsMapper.java
View file @
fc2e4671
...
...
@@ -97,7 +97,7 @@ public interface PointDetailsMapper extends BaseMapper<PointDetails> {
@Param
(
"companyId"
)
Long
companyId
,
@Param
(
"siteId"
)
Long
siteId
);
Integer
selectPointVo
(
@Param
(
"accountId"
)
Long
accountId
,
@Param
(
"
siteId"
)
Long
siteId
,
@Param
(
"type"
)
String
type
,
@Param
(
"
toDay"
)
String
toDay
);
Integer
selectPointVo
(
@Param
(
"accountId"
)
Long
accountId
,
@Param
(
"toDay"
)
String
toDay
);
Integer
getAmount
(
@Param
(
"accountId"
)
Long
accountId
,
@Param
(
"siteId"
)
Long
siteId
);
...
...
cloud-point/src/main/java/com/yizhi/application/service/impl/PointDetailsServiceImpl.java
View file @
fc2e4671
...
...
@@ -2,10 +2,12 @@ package com.yizhi.application.service.impl;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.yizhi.application.constant.PointChangeReasonConstant
;
import
com.yizhi.application.constant.PointTypeEnum
;
import
com.yizhi.application.domain.PointDetails
;
import
com.yizhi.application.domain.PointUser
;
import
com.yizhi.application.mapper.PointDetailsMapper
;
...
...
@@ -18,6 +20,7 @@ import com.yizhi.application.service.PointDetailsService;
import
com.yizhi.application.service.PointUserService
;
import
com.yizhi.point.application.vo.*
;
import
com.yizhi.point.application.vo.domain.PointDetailsVo
;
import
com.yizhi.util.application.json.JsonUtil
;
import
lombok.extern.log4j.Log4j2
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -445,41 +448,36 @@ public class PointDetailsServiceImpl extends ServiceImpl<PointDetailsMapper, com
@Override
public
PointDetailVO
getPointDetail
(
Long
accountId
,
Long
siteId
){
PointDetailVO
pointDetailVO
=
new
PointDetailVO
();
List
<
String
>
pointTypeList
=
Lists
.
newArrayList
();
pointTypeList
.
add
(
"登录"
);
pointTypeList
.
add
(
"阅读文章"
);
pointTypeList
.
add
(
"我要投稿"
);
pointTypeList
.
add
(
"发表评论"
);
pointTypeList
.
add
(
"参加活动"
);
pointTypeList
.
add
(
"培训测试"
);
pointDetailVO
.
setPoint
(
0
);
//今日获得积分
String
toDay
=
DateUtil
.
formatDate
(
new
Date
());
Arrays
.
stream
(
PointChangeReasonConstant
.
values
()).
forEach
(
e
->{
if
(
pointTypeList
.
contains
(
e
.
getValue
())){
Integer
point
=
pointDetailsMapper
.
selectPointVo
(
accountId
,
siteId
,
e
.
getKey
(),
toDay
);
Integer
count
=
pointDetailsMapper
.
getCountToDay
(
accountId
,
siteId
,
e
.
getKey
(),
toDay
);
if
(
Objects
.
equals
(
e
.
getKey
(),
PointChangeReasonConstant
.
CREDITCOURSEDONE1
.
getKey
())
||
Objects
.
equals
(
e
.
getKey
(),
PointChangeReasonConstant
.
CREDITEXAMPASSED
.
getKey
())
||
Objects
.
equals
(
e
.
getKey
(),
PointChangeReasonConstant
.
CREDITCALENDARDONE
.
getKey
())){
}
else
if
(
Objects
.
equals
(
e
.
getKey
(),
PointChangeReasonConstant
.
CREDITEXAMDONE
.
getKey
())
||
Objects
.
equals
(
e
.
getKey
(),
PointChangeReasonConstant
.
CREDITSIGNDONE
.
getKey
()))
{
pointDetailVO
.
addPoint
(
e
.
getKey
(),
e
.
getValue
(),
count
,
0
);
}
else
{
pointDetailVO
.
addPoint
(
e
.
getKey
(),
e
.
getValue
(),
count
,
(
point
!=
null
&&
point
>
0
)
?
1
:
0
);
}
if
(
point
!=
null
&&
point
>
0
){
pointDetailVO
.
setPoint
(
point
+
pointDetailVO
.
getPoint
());
}
}
});
Integer
point
=
pointDetailsMapper
.
getAmount
(
accountId
,
siteId
);
if
(
point
!=
null
){
pointDetailVO
.
setAmount
(
point
.
toString
());
}
else
{
pointDetailVO
.
setAmount
(
"0"
);
}
pointDetailVO
.
setPoint
(
pointDetailsMapper
.
selectPointVo
(
accountId
,
toDay
));
//总积分
pointDetailVO
.
setAmount
(
pointDetailsMapper
.
getAmount
(
accountId
,
siteId
).
toString
());
//每日首登
Integer
loginCount
=
pointDetailsMapper
.
getCountTodayByLearnType
(
accountId
,
PointTypeEnum
.
LOGIN
.
getKey
());
pointDetailVO
.
addPoint
(
PointChangeReasonConstant
.
POINT_LOGIN
.
getKey
(),
PointChangeReasonConstant
.
POINT_LOGIN
.
getValue
(),
loginCount
,
(
loginCount
!=
null
&&
loginCount
>
0
)
?
1
:
0
);
//每日阅读
Integer
readCount
=
pointDetailsMapper
.
getCountTodayByLearnType
(
accountId
,
PointTypeEnum
.
READ
.
getKey
());
pointDetailVO
.
addPoint
(
PointChangeReasonConstant
.
POINT_READ
.
getKey
(),
PointChangeReasonConstant
.
POINT_READ
.
getValue
(),
readCount
,
(
readCount
!=
null
&&
readCount
>=
5
)
?
1
:
0
);
//投稿
Integer
pubCount
=
pointDetailsMapper
.
getCountTodayByLearnType
(
accountId
,
PointTypeEnum
.
PUBLICATION
.
getKey
());
pointDetailVO
.
addPoint
(
PointChangeReasonConstant
.
POINT_DRAFT
.
getKey
(),
PointChangeReasonConstant
.
POINT_DRAFT
.
getValue
(),
pubCount
,
0
);
//评论
Integer
commentCount
=
pointDetailsMapper
.
getCountTodayByLearnType
(
accountId
,
PointTypeEnum
.
COMMENT
.
getKey
());
pointDetailVO
.
addPoint
(
PointChangeReasonConstant
.
POINT_COMMENT
.
getKey
(),
PointChangeReasonConstant
.
POINT_COMMENT
.
getValue
(),
commentCount
,
0
);
//活动
Integer
activityCount
=
pointDetailsMapper
.
getCountTodayByLearnType
(
accountId
,
PointTypeEnum
.
ACITVITY
.
getKey
());
pointDetailVO
.
addPoint
(
PointChangeReasonConstant
.
CREDITSIGNDONE
.
getKey
(),
PointChangeReasonConstant
.
CREDITSIGNDONE
.
getValue
(),
activityCount
,
0
);
//培训考试
Integer
examCount
=
pointDetailsMapper
.
getCountTodayByLearnType
(
accountId
,
PointTypeEnum
.
EXAM
.
getKey
());
pointDetailVO
.
addPoint
(
PointChangeReasonConstant
.
CREDITEXAMDONE
.
getKey
(),
PointChangeReasonConstant
.
CREDITEXAMDONE
.
getValue
(),
examCount
,
0
);
log
.
info
(
"我的积分主页返回对象pointDetailVO:{}"
,
JSONUtil
.
toJsonStr
(
pointDetailVO
));
return
pointDetailVO
;
}
...
...
cloud-point/src/main/java/com/yizhi/application/service/impl/PointServiceImpl.java
View file @
fc2e4671
...
...
@@ -22,6 +22,7 @@ import com.yizhi.point.application.vo.PointDetailListVO;
import
com.yizhi.point.application.vo.PointUserExchangeVO
;
import
com.yizhi.util.application.date.DateUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -96,6 +97,10 @@ public class PointServiceImpl extends ServiceImpl<PointMapper, Point> implements
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addPoint
(
Long
accountId
,
String
type
,
String
sourceId
){
if
(
accountId
==
null
||
StringUtils
.
isBlank
(
type
)
||
StringUtils
.
isBlank
(
sourceId
)){
log
.
error
(
"增加积分入参异常 accountId:{}, type:{}, sourceId:{}"
,
accountId
,
type
,
sourceId
);
return
;
}
log
.
info
(
"增加积分入参: accountId:{}, type:{}, sourceId:{}"
,
accountId
,
type
,
sourceId
);
Long
companyId
=
ContextHolder
.
get
().
getCompanyId
();
Long
orgId
=
ContextHolder
.
get
().
getOrgId
();
...
...
@@ -190,10 +195,16 @@ public class PointServiceImpl extends ServiceImpl<PointMapper, Point> implements
return
null
;
}
if
(
type
.
equals
(
PointTypeEnum
.
COMMENT
.
getKey
())){
PointDetails
pd
=
new
PointDetails
();
pd
.
setAccountId
(
accountId
);
pd
.
setLearnType
(
PointTypeEnum
.
COMMENT
.
getKey
());
pd
.
setLearnSource
(
sourceId
);
EntityWrapper
<
PointDetails
>
wrapper
=
new
EntityWrapper
<
PointDetails
>(
pd
);
int
cnt
=
pointDetailsService
.
selectCount
(
wrapper
);
log
.
info
(
"评论上架 赠送积分判断此活动是不是首次评论上架:{}"
,
cnt
);
if
(
cnt
<=
0
)
{
return
new
PointTypeStrategy
(
PointTypeEnum
.
COMMENT
,
sourceId
,
PointTypeEnum
.
COMMENT
.
getPoint
());
}
return
null
;
}
if
(
type
.
equals
(
PointTypeEnum
.
ACITVITY
.
getKey
())){
...
...
cloud-point/src/main/resources/mapper/PointDetailsMapper.xml
View file @
fc2e4671
...
...
@@ -238,18 +238,12 @@
</if>
</select>
<select
id=
"selectPointVo"
resultType=
"java.lang.Integer"
>
select
sum(pd.`point`)
from
point_details pd
inner join mq_point_param mpp on
pd.learn_source_id = mpp.source_id
where mpp.account_id =#{accountId} and mpp.site_id =#{siteId} and mpp.event_name =#{type}
and DATE_FORMAT(mpp.create_point_time, '%Y-%m-%d' ) = #{toDay}
select ifnull(sum(point), 0) from point_details where account_id = #{accountId}
and DATE_FORMAT(create_time, '%Y-%m-%d' ) = #{toDay} and point > 0
</select>
<select
id=
"getAmount"
resultType=
"java.lang.Integer"
>
select
sum(`point`
)
ifnull(sum(`point`), 0
)
from
point_details
where account_id =#{accountId} and site_id =#{siteId}
...
...
@@ -260,7 +254,7 @@
from
mq_point_param mpp
where mpp.account_id =#{accountId} and mpp.site_id =#{siteId} and mpp.event_name =#{type}
and DATE_FORMAT(mpp.create_point_time, '%Y-%m-%d' ) = #{toDay}
and DATE_FORMAT(mpp.create_point_time, '%Y-%m-%d' ) = #{toDay}
</select>
<select
id=
"getPointDetailsList"
resultType=
"com.yizhi.point.application.vo.PointDetailListVO"
>
...
...
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