Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
f22103c7
Commit
f22103c7
authored
Nov 18, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加领取集点活动接口
parent
4f516337
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
134 additions
and
8 deletions
+134
-8
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+28
-0
PointActivities.java
...em/src/main/java/share/system/domain/PointActivities.java
+6
-0
PointActivitiesVo.java
...c/main/java/share/system/domain/vo/PointActivitiesVo.java
+6
-0
ISConsumerCouponService.java
...in/java/share/system/service/ISConsumerCouponService.java
+2
-0
PointActivitiesService.java
...ain/java/share/system/service/PointActivitiesService.java
+5
-0
PointActivitiesServiceImpl.java
...share/system/service/impl/PointActivitiesServiceImpl.java
+37
-0
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+34
-0
PointActivitiesMapper.xml
...rc/main/resources/mapper/system/PointActivitiesMapper.xml
+16
-8
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
f22103c7
...
...
@@ -124,6 +124,9 @@ public class RedisTask {
@Autowired
private
JobErrorLogService
jobErrorLogService
;
@Autowired
private
PointActivitiesService
pointActivitiesService
;
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
...
...
@@ -945,6 +948,31 @@ public class RedisTask {
}
@XxlJob
(
"AutoResetPointActivity"
)
public
void
AutoResetPointActivity
()
{
logger
.
debug
(
"AutoResetPointActivity:月初自动重置集点活动开始"
);
List
<
PointActivities
>
pointActivitiesList
=
pointActivitiesService
.
list
(
new
LambdaQueryWrapper
<
PointActivities
>()
.
eq
(
PointActivities:
:
getIsReceive
,
YesNoEnum
.
yes
.
getIndex
())
.
eq
(
PointActivities:
:
getCouponReceived
,
YesNoEnum
.
yes
.
getIndex
())
);
if
(
CollectionUtils
.
isEmpty
(
pointActivitiesList
))
{
return
;
}
List
<
PointActivities
>
updateList
=
new
ArrayList
<>();
pointActivitiesList
.
stream
().
forEach
(
item
->
{
item
.
setPoints
(
YesNoEnum
.
no
.
getIndex
());
item
.
setLastConsumptionTime
(
null
);
item
.
setIsReceive
(
YesNoEnum
.
no
.
getIndex
());
item
.
setCouponReceived
(
YesNoEnum
.
no
.
getIndex
());
item
.
setReceivedDate
(
null
);
item
.
setCouponExpirationDate
(
null
);
updateList
.
add
(
item
);
});
pointActivitiesService
.
updateBatchById
(
updateList
);
logger
.
debug
(
"AutoResetPointActivity:月初自动重置集点活动结束"
);
}
private
void
addNewConsumer
(
SOrder
sorder
)
{
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
sorder
.
getConsumerId
()));
//新增用户为普通会员
...
...
share-system/src/main/java/share/system/domain/PointActivities.java
View file @
f22103c7
...
...
@@ -60,6 +60,12 @@ public class PointActivities extends BaseEntity {
private
Date
lastConsumptionTime
;
/**
* 当前活动月份
*/
@Excel
(
name
=
"当前活动月份"
)
private
Integer
currentMonth
;
/**
* 是否可领取
*/
@Excel
(
name
=
"是否可领取"
)
...
...
share-system/src/main/java/share/system/domain/vo/PointActivitiesVo.java
View file @
f22103c7
...
...
@@ -63,6 +63,12 @@ public class PointActivitiesVo extends BaseEntity {
private
Date
lastConsumptionTime
;
/**
* 当前活动月份
*/
@Excel
(
name
=
"当前活动月份"
)
private
Integer
currentMonth
;
/**
* 是否可领取
*/
@Excel
(
name
=
"是否可领取"
,
dictType
=
"store_is_use_coupon"
)
...
...
share-system/src/main/java/share/system/service/ISConsumerCouponService.java
View file @
f22103c7
...
...
@@ -76,6 +76,8 @@ public interface ISConsumerCouponService extends IService<SConsumerCoupon>
int
give
(
SConsumerCoupon
sConsumerCoupon
);
public
Integer
give
(
Long
consumerId
,
Long
couponId
,
Integer
giveDay
);
SConsumerCoupon
queryById
(
Long
couponId
);
List
<
SConsumerCoupon
>
queryByIds
(
List
<
Long
>
couponIds
);
...
...
share-system/src/main/java/share/system/service/PointActivitiesService.java
View file @
f22103c7
...
...
@@ -2,6 +2,7 @@ package share.system.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.PointActivities
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.PointActivitiesVo
;
import
java.util.List
;
...
...
@@ -60,4 +61,8 @@ public interface PointActivitiesService extends IService<PointActivities> {
* @return 结果
*/
public
int
deletePointActivitiesById
(
Long
id
);
public
void
joinPointActivities
(
SOrder
sOrder
);
public
void
receivePointActivities
(
Long
id
);
}
share-system/src/main/java/share/system/service/impl/PointActivitiesServiceImpl.java
View file @
f22103c7
...
...
@@ -13,10 +13,13 @@ import share.system.domain.SConsumer;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.PointActivitiesVo
;
import
share.system.mapper.PointActivitiesMapper
;
import
share.system.service.ISConsumerCouponService
;
import
share.system.service.PointActivitiesConfService
;
import
share.system.service.PointActivitiesService
;
import
share.system.service.SConsumerService
;
import
java.time.LocalDate
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -33,6 +36,8 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
private
SConsumerService
sConsumerService
;
@Autowired
private
PointActivitiesConfService
pointActivitiesConfService
;
@Autowired
private
ISConsumerCouponService
sConsumerCouponService
;
/**
* 查询用户集点活动
...
...
@@ -81,6 +86,7 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
}
//参与集点活动
@Override
public
void
joinPointActivities
(
SOrder
sOrder
)
{
SConsumer
user
=
sConsumerService
.
getInfo
();
PointActivitiesConf
pointActivitiesConf
=
pointActivitiesConfService
.
list
().
get
(
0
);
...
...
@@ -91,6 +97,7 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
if
(
oldPointActivities
.
getPoints
().
equals
(
pointActivitiesConf
.
getPointsRequired
()))
{
oldPointActivities
.
setIsReceive
(
YesNoEnum
.
yes
.
getIndex
());
}
updateById
(
oldPointActivities
);
}
else
{
PointActivities
pointActivities
=
new
PointActivities
();
pointActivities
.
setConsumerId
(
user
.
getId
());
...
...
@@ -100,10 +107,40 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
pointActivities
.
setLastConsumptionTime
(
sOrder
.
getPayTime
());
pointActivities
.
setIsReceive
(
YesNoEnum
.
no
.
getIndex
());
pointActivities
.
setCouponReceived
(
YesNoEnum
.
no
.
getIndex
());
LocalDate
currentDate
=
LocalDate
.
now
();
pointActivities
.
setCurrentMonth
(
currentDate
.
getMonthValue
());
save
(
pointActivities
);
}
}
//领取集点活动
@Override
public
void
receivePointActivities
(
Long
id
)
{
PointActivities
pointActivities
=
pointActivitiesMapper
.
selectById
(
id
);
PointActivitiesConf
activitiesConf
=
pointActivitiesConfService
.
getById
(
pointActivities
.
getConfId
());
//领取的时间小于领取期限(最后的时间加领取的期限)
if
(
DateUtils
.
addDays
(
pointActivities
.
getLastConsumptionTime
(),
activitiesConf
.
getCollectionDeadline
()).
compareTo
(
new
Date
())
<
0
&&
pointActivities
.
getPoints
().
equals
(
activitiesConf
.
getPointsRequired
()))
{
if
(
pointActivities
.
getCurrentMonth
().
compareTo
(
LocalDate
.
now
().
getMonthValue
())
==
0
)
{
pointActivities
.
setCouponReceived
(
YesNoEnum
.
yes
.
getIndex
());
pointActivities
.
setReceivedDate
(
new
Date
());
sConsumerCouponService
.
give
(
pointActivities
.
getConsumerId
(),
activitiesConf
.
getCouponId
(),
activitiesConf
.
getCouponDuration
());
pointActivities
.
setCouponExpirationDate
(
DateUtils
.
addDays
(
pointActivities
.
getReceivedDate
(),
activitiesConf
.
getCouponDuration
()));
pointActivitiesMapper
.
updateById
(
pointActivities
);
}
else
{
PointActivities
newPointActivities
=
new
PointActivities
();
newPointActivities
.
setConsumerId
(
pointActivities
.
getConsumerId
());
newPointActivities
.
setConfId
(
pointActivities
.
getConfId
());
newPointActivities
.
setCouponId
(
activitiesConf
.
getCouponId
());
newPointActivities
.
setPoints
(
YesNoEnum
.
no
.
getIndex
());
newPointActivities
.
setCurrentMonth
(
LocalDate
.
now
().
getMonthValue
());
pointActivitiesMapper
.
insert
(
newPointActivities
);
}
}
else
{
throw
new
RuntimeException
(
"领取时间超过领取期限"
);
}
}
/**
* 批量删除用户集点活动
*
...
...
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
f22103c7
...
...
@@ -550,6 +550,40 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
@Override
public
Integer
give
(
Long
consumerId
,
Long
couponId
,
Integer
giveDay
)
{
SCoupon
sCoupon
=
sCouponService
.
selectSCouponById
(
couponId
);
//创建优惠卷领取记录
SConsumerCoupon
newSConsumerCoupon
=
new
SConsumerCoupon
();
newSConsumerCoupon
.
setCouponId
(
sCoupon
.
getId
());
newSConsumerCoupon
.
setConsumerId
(
consumerId
);
newSConsumerCoupon
.
setName
(
sCoupon
.
getName
());
newSConsumerCoupon
.
setStoreType
(
sCoupon
.
getStoreType
());
newSConsumerCoupon
.
setRoomType
(
sCoupon
.
getRoomType
());
newSConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
newSConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
newSConsumerCoupon
.
setCouponType
(
sCoupon
.
getCouponType
());
newSConsumerCoupon
.
setMinPrice
(
new
BigDecimal
(
0.00
));
newSConsumerCoupon
.
setWeeks
(
sCoupon
.
getWeeks
());
newSConsumerCoupon
.
setStoreIds
(
sCoupon
.
getStoreIds
());
newSConsumerCoupon
.
setOriginalPrice
(
sCoupon
.
getOriginalPrice
());
newSConsumerCoupon
.
setCouponPayPrice
(
sCoupon
.
getCouponPayPrice
());
newSConsumerCoupon
.
setSalePrice
(
sCoupon
.
getSalePrice
());
newSConsumerCoupon
.
setMinDuration
(
sCoupon
.
getMinDuration
());
newSConsumerCoupon
.
setMaxDuration
(
sCoupon
.
getMaxDuration
());
newSConsumerCoupon
.
setDuration
(
sCoupon
.
getDuration
());
newSConsumerCoupon
.
setOrderType
(
sCoupon
.
getOrderType
());
newSConsumerCoupon
.
setPackIds
(
sCoupon
.
getPackIds
());
newSConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
GIVE
.
getCode
());
newSConsumerCoupon
.
setPlatformType
(
sCoupon
.
getPlatformType
());
newSConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
newSConsumerCoupon
.
setEndDate
(
DateUtils
.
addDays
(
new
Date
(),
giveDay
));
newSConsumerCoupon
.
setRemark
(
sCoupon
.
getRemark
());
newSConsumerCoupon
.
setCreateTime
(
new
Date
());
return
baseMapper
.
insert
(
newSConsumerCoupon
);
}
@Override
public
SConsumerCoupon
queryById
(
Long
couponId
)
{
return
baseMapper
.
queryById
(
couponId
);
}
...
...
share-system/src/main/resources/mapper/system/PointActivitiesMapper.xml
View file @
f22103c7
...
...
@@ -15,6 +15,7 @@
<result
property=
"couponId"
column=
"coupon_id"
/>
<result
property=
"couponName"
column=
"coupon_name"
/>
<result
property=
"points"
column=
"points"
/>
<result
property=
"currentMonth"
column=
"current_month"
/>
<result
property=
"lastConsumptionTime"
column=
"last_consumption_time"
/>
<result
property=
"isReceive"
column=
"is_receive"
/>
<result
property=
"couponReceived"
column=
"coupon_received"
/>
...
...
@@ -34,6 +35,7 @@
conf_id,
coupon_id,
points,
current_month,
last_consumption_time,
is_receive,
coupon_received,
...
...
@@ -57,20 +59,21 @@
c.phone as 'phone',
p.conf_id,
c2.name as 'conf_name',
p.
coupon_id,
p.coupon_id,
c1.name as 'coupon_name',
p.points,
p. last_consumption_time,
p.current_month,
p.last_consumption_time,
p.is_receive,
p.coupon_received,
p.received_date,
p.
coupon_expiration_date,
p.coupon_expiration_date,
p.is_delete,
p.
create_by,
p.
create_time,
p.
update_by,
p.
update_time,
p.
remark
p.create_by,
p.create_time,
p.update_by,
p.update_time,
p.remark
from s_point_activities p left join s_consumer c on p.consumer_id = c.id
left join s_coupon c1 on p.coupon_id = c1.id
left join s_point_activities_conf c2 on p.conf_id = c2.id
...
...
@@ -82,6 +85,7 @@
<if
test=
"confId != null "
>
and p.conf_id = #{confId}
</if>
<if
test=
"couponId != null "
>
and p.coupon_id = #{couponId}
</if>
<if
test=
"points != null "
>
and p.points = #{points}
</if>
<if
test=
"currentMonth != null"
>
and p.current_month = #{currentMonth}
</if>
<if
test=
"lastConsumptionTime != null "
>
and p.last_consumption_time = #{lastConsumptionTime}
</if>
<if
test=
"isReceive != null "
>
and p.is_receive = #{isReceive}
</if>
<if
test=
"couponReceived != null "
>
and p.coupon_received = #{couponReceived}
</if>
...
...
@@ -89,6 +93,7 @@
<if
test=
"couponExpirationDate != null "
>
and p.coupon_expiration_date = #{couponExpirationDate}
</if>
<if
test=
"isDelete != null "
>
and p.is_delete = #{isDelete}
</if>
</where>
order by p.current_month desc
</select>
<select
id=
"selectPointActivitiesById"
parameterType=
"Long"
resultMap=
"PointActivitiesResult"
>
...
...
@@ -103,6 +108,7 @@
<if
test=
"confId != null"
>
conf_id,
</if>
<if
test=
"couponId != null"
>
coupon_id,
</if>
<if
test=
"points != null"
>
points,
</if>
<if
test=
"currentMonth != null"
>
current_month,
</if>
<if
test=
"lastConsumptionTime != null"
>
last_consumption_time,
</if>
<if
test=
"isReceive != null"
>
is_receive,
</if>
<if
test=
"couponReceived != null"
>
coupon_received,
</if>
...
...
@@ -120,6 +126,7 @@
<if
test=
"confId != null"
>
#{confId},
</if>
<if
test=
"couponId != null"
>
#{couponId},
</if>
<if
test=
"points != null"
>
#{points},
</if>
<if
test=
"currentMonth != null"
>
#{currentMonth},
</if>
<if
test=
"lastConsumptionTime != null"
>
#{lastConsumptionTime},
</if>
<if
test=
"isReceive != null"
>
#{isReceive},
</if>
<if
test=
"couponReceived != null"
>
#{couponReceived},
</if>
...
...
@@ -141,6 +148,7 @@
<if
test=
"confId != null"
>
conf_id = #{confId},
</if>
<if
test=
"couponId != null"
>
coupon_id = #{couponId},
</if>
<if
test=
"points != null"
>
points = #{points},
</if>
<if
test=
"currentMonth != null"
>
current_month = #{currentMonth},
</if>
<if
test=
"lastConsumptionTime != null"
>
last_consumption_time = #{lastConsumptionTime},
</if>
<if
test=
"isReceive != null"
>
is_receive = #{isReceive},
</if>
<if
test=
"couponReceived != null"
>
coupon_received = #{couponReceived},
</if>
...
...
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