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
b4c1426f
Commit
b4c1426f
authored
Nov 20, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into test
parents
babb57a3
29b7d1c5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
19 deletions
+112
-19
PointActivitiesController.java
...hare/web/controller/system/PointActivitiesController.java
+35
-0
PointActivities.java
...em/src/main/java/share/system/domain/PointActivities.java
+6
-6
PointActivitiesService.java
...ain/java/share/system/service/PointActivitiesService.java
+3
-1
ConsumerMonthlyCardServiceImpl.java
...e/system/service/impl/ConsumerMonthlyCardServiceImpl.java
+1
-1
PointActivitiesServiceImpl.java
...share/system/service/impl/PointActivitiesServiceImpl.java
+67
-11
No files found.
share-front/src/main/java/share/web/controller/system/PointActivitiesController.java
0 → 100644
View file @
b4c1426f
package
share
.
web
.
controller
.
system
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.system.service.PointActivitiesService
;
/**
* 用户集点活动Controller
*
* @author wuwenlong
* @date 2024-11-14
*/
@RestController
@RequestMapping
(
"/pointActivities"
)
public
class
PointActivitiesController
extends
BaseController
{
@Autowired
private
PointActivitiesService
pointActivitiesService
;
/**
* 查询用户集点活动列表
*/
@GetMapping
(
"/query"
)
public
AjaxResult
selectByConsumerId
()
{
return
success
(
pointActivitiesService
.
selectByConsumerId
());
}
@GetMapping
(
"/receivePointActivities"
)
public
AjaxResult
receivePointActivities
(
Long
id
)
{
return
success
(
pointActivitiesService
.
receivePointActivities
(
id
));
}
}
share-system/src/main/java/share/system/domain/PointActivities.java
View file @
b4c1426f
...
...
@@ -55,8 +55,8 @@ public class PointActivities extends BaseEntity {
/**
* 上次消费时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"上次消费时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm
"
)
@Excel
(
name
=
"上次消费时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd
HH:mm
"
)
private
Date
lastConsumptionTime
;
/**
...
...
@@ -86,15 +86,15 @@ public class PointActivities extends BaseEntity {
/**
* 优惠券领取日期
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"优惠券领取日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm
"
)
@Excel
(
name
=
"优惠券领取日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd
HH:mm
"
)
private
Date
receivedDate
;
/**
* 优惠券过期日期
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"优惠券过期日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm
"
)
@Excel
(
name
=
"优惠券过期日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd
HH:mm
"
)
private
Date
couponExpirationDate
;
/**
...
...
share-system/src/main/java/share/system/service/PointActivitiesService.java
View file @
b4c1426f
...
...
@@ -64,5 +64,7 @@ public interface PointActivitiesService extends IService<PointActivities> {
public
void
joinPointActivities
(
SOrder
sOrder
);
public
void
receivePointActivities
(
Long
id
);
public
Integer
receivePointActivities
(
Long
id
);
PointActivities
selectByConsumerId
();
}
share-system/src/main/java/share/system/service/impl/ConsumerMonthlyCardServiceImpl.java
View file @
b4c1426f
...
...
@@ -140,7 +140,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
BigDecimal
freeDuration
=
consumerWallet
.
getRemainingDuration
();
if
(
ObjectUtil
.
isNotEmpty
(
consumerMember
))
{
SRoom
room
=
roomService
.
getById
(
monthlyCardRequest
.
getRoomId
());
consumerMonthlyCard
=
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
ConsumerMonthlyCard
>().
eq
(
ConsumerMonthlyCard:
:
getConsumerId
,
user
.
getId
()).
g
t
(
ConsumerMonthlyCard:
:
getFreeDuration
,
0
));
consumerMonthlyCard
=
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
ConsumerMonthlyCard
>().
eq
(
ConsumerMonthlyCard:
:
getConsumerId
,
user
.
getId
()).
g
e
(
ConsumerMonthlyCard:
:
getFreeDuration
,
0
));
consumerSecondaryCard
=
consumerSecondaryCardService
.
list
(
new
LambdaQueryWrapper
<
ConsumerSecondaryCard
>()
.
eq
(
ConsumerSecondaryCard:
:
getConsumerId
,
user
.
getId
())
.
gt
(
ConsumerSecondaryCard:
:
getNumber
,
0
)
...
...
share-system/src/main/java/share/system/service/impl/PointActivitiesServiceImpl.java
View file @
b4c1426f
...
...
@@ -2,6 +2,7 @@ package share.system.service.impl;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -19,6 +20,7 @@ import share.system.service.PointActivitiesService;
import
share.system.service.SConsumerService
;
import
java.time.LocalDate
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -90,14 +92,31 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
public
void
joinPointActivities
(
SOrder
sOrder
)
{
SConsumer
user
=
sConsumerService
.
getInfo
();
PointActivitiesConf
pointActivitiesConf
=
pointActivitiesConfService
.
list
().
get
(
0
);
PointActivities
oldPointActivities
=
pointActivitiesMapper
.
selectOne
(
new
LambdaQueryWrapper
<
PointActivities
>().
eq
(
PointActivities:
:
getConsumerId
,
user
.
getId
()));
PointActivities
oldPointActivities
=
pointActivitiesMapper
.
selectOne
(
new
LambdaQueryWrapper
<
PointActivities
>()
.
eq
(
PointActivities:
:
getConsumerId
,
user
.
getId
())
.
eq
(
PointActivities:
:
getCurrentYear
,
LocalDate
.
now
().
getYear
())
.
eq
(
PointActivities:
:
getCurrentMonth
,
LocalDate
.
now
().
getMonthValue
())
);
if
(
ObjectUtil
.
isNotEmpty
(
oldPointActivities
))
{
oldPointActivities
.
setPoints
(
oldPointActivities
.
getPoints
()
+
YesNoEnum
.
yes
.
getIndex
());
oldPointActivities
.
setLastConsumptionTime
(
sOrder
.
getPayTime
());
if
(
oldPointActivities
.
getPoints
().
equals
(
pointActivitiesConf
.
getPointsRequired
()))
{
oldPointActivities
.
setIsReceive
(
YesNoEnum
.
yes
.
getIndex
());
if
(
ObjectUtil
.
isNotEmpty
(
oldPointActivities
.
getLastConsumptionTime
()))
{
if
(
DateUtils
.
addHours
(
oldPointActivities
.
getLastConsumptionTime
(),
pointActivitiesConf
.
getTimeInterval
()).
compareTo
(
new
Date
())
>=
0
&&
!
oldPointActivities
.
getPoints
().
equals
(
pointActivitiesConf
.
getPointsRequired
()))
{
oldPointActivities
.
setPoints
(
oldPointActivities
.
getPoints
()
+
YesNoEnum
.
yes
.
getIndex
());
oldPointActivities
.
setLastConsumptionTime
(
sOrder
.
getPayTime
());
if
(
oldPointActivities
.
getPoints
().
equals
(
pointActivitiesConf
.
getPointsRequired
()))
{
oldPointActivities
.
setIsReceive
(
YesNoEnum
.
yes
.
getIndex
());
}
updateById
(
oldPointActivities
);
}
}
else
{
oldPointActivities
.
setPoints
(
oldPointActivities
.
getPoints
()
+
YesNoEnum
.
yes
.
getIndex
());
oldPointActivities
.
setLastConsumptionTime
(
sOrder
.
getPayTime
());
if
(
oldPointActivities
.
getPoints
().
equals
(
pointActivitiesConf
.
getPointsRequired
()))
{
oldPointActivities
.
setIsReceive
(
YesNoEnum
.
yes
.
getIndex
());
}
updateById
(
oldPointActivities
);
}
updateById
(
oldPointActivities
);
}
else
{
PointActivities
pointActivities
=
new
PointActivities
();
pointActivities
.
setConsumerId
(
user
.
getId
());
...
...
@@ -116,18 +135,18 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
//领取集点活动
@Override
public
void
receivePointActivities
(
Long
id
)
{
public
Integer
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
if
(
DateUtils
.
addDays
(
pointActivities
.
getLastConsumptionTime
(),
activitiesConf
.
getCollectionDeadline
()).
compareTo
(
new
Date
())
>
0
&&
pointActivities
.
getPoints
().
equals
(
activitiesConf
.
getPointsRequired
()))
{
sConsumerCouponService
.
give
(
pointActivities
.
getConsumerId
(),
activitiesConf
.
getCouponId
(),
activitiesConf
.
getCouponDuration
());
if
(
pointActivities
.
getCurrentMonth
().
compareTo
(
LocalDate
.
now
().
getMonthValue
())
==
0
&&
pointActivities
.
getCurrentYear
().
compareTo
(
LocalDate
.
now
().
getYear
())
==
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
);
return
pointActivitiesMapper
.
updateById
(
pointActivities
);
}
else
{
PointActivities
newPointActivities
=
new
PointActivities
();
newPointActivities
.
setConsumerId
(
pointActivities
.
getConsumerId
());
...
...
@@ -136,13 +155,50 @@ public class PointActivitiesServiceImpl extends ServiceImpl<PointActivitiesMappe
newPointActivities
.
setPoints
(
YesNoEnum
.
no
.
getIndex
());
newPointActivities
.
setCurrentMonth
(
LocalDate
.
now
().
getMonthValue
());
newPointActivities
.
setCurrentYear
(
LocalDate
.
now
().
getYear
());
pointActivitiesMapper
.
insert
(
newPointActivities
);
return
pointActivitiesMapper
.
insert
(
newPointActivities
);
}
}
else
{
throw
new
RuntimeException
(
"领取时间超过领取期限"
);
}
}
@Override
public
PointActivities
selectByConsumerId
()
{
SConsumer
info
=
sConsumerService
.
getInfo
();
List
<
PointActivities
>
activitiesList
=
pointActivitiesMapper
.
selectList
(
new
LambdaQueryWrapper
<
PointActivities
>()
.
eq
(
PointActivities:
:
getConsumerId
,
info
.
getId
())
//当前年月,次数未到的 or 领取优惠券未领取,年月在上个月的
.
eq
(
PointActivities:
:
getCurrentYear
,
LocalDate
.
now
().
getYear
())
.
eq
(
PointActivities:
:
getCurrentMonth
,
LocalDate
.
now
().
getMonthValue
())
.
lt
(
PointActivities:
:
getPoints
,
4
)
.
eq
(
PointActivities:
:
getIsReceive
,
YesNoEnum
.
no
.
getIndex
())
.
eq
(
PointActivities:
:
getCouponReceived
,
YesNoEnum
.
no
.
getIndex
())
.
or
()
.
eq
(
PointActivities:
:
getCurrentYear
,
LocalDate
.
now
().
getYear
())
.
eq
(
PointActivities:
:
getCurrentMonth
,
LocalDate
.
now
().
getMonthValue
())
.
eq
(
PointActivities:
:
getPoints
,
4
)
.
eq
(
PointActivities:
:
getIsReceive
,
YesNoEnum
.
yes
.
getIndex
())
.
eq
(
PointActivities:
:
getCouponReceived
,
YesNoEnum
.
no
.
getIndex
())
.
or
()
//或者夸年的
.
eq
(
PointActivities:
:
getCurrentYear
,
LocalDate
.
now
().
getYear
()
-
1
)
.
eq
(
PointActivities:
:
getCurrentMonth
,
LocalDate
.
now
().
getMonthValue
()
+
11
)
.
eq
(
PointActivities:
:
getIsReceive
,
YesNoEnum
.
yes
.
getIndex
())
.
eq
(
PointActivities:
:
getCouponReceived
,
YesNoEnum
.
no
.
getIndex
())
.
or
()
.
eq
(
PointActivities:
:
getCurrentYear
,
LocalDate
.
now
().
getYear
())
.
eq
(
PointActivities:
:
getCurrentMonth
,
LocalDate
.
now
().
getMonthValue
()
-
1
)
.
eq
(
PointActivities:
:
getIsReceive
,
YesNoEnum
.
yes
.
getIndex
())
.
eq
(
PointActivities:
:
getCouponReceived
,
YesNoEnum
.
no
.
getIndex
())
);
//获取currentYear和currentMonth最大的
if
(
CollectionUtils
.
isNotEmpty
(
activitiesList
))
{
return
activitiesList
.
stream
().
max
(
Comparator
.
comparing
(
PointActivities:
:
getCurrentYear
).
thenComparing
(
PointActivities:
:
getCurrentMonth
)).
get
();
}
return
new
PointActivities
();
}
/**
* 批量删除用户集点活动
*
...
...
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