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
ea4d021b
Commit
ea4d021b
authored
Jan 09, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除优惠卷领取记录表增加优惠卷
parent
4f49e546
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
17 deletions
+53
-17
SCouponMapper.java
...stem/src/main/java/share/system/mapper/SCouponMapper.java
+2
-0
ISCouponService.java
...m/src/main/java/share/system/service/ISCouponService.java
+2
-0
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+15
-14
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+22
-3
SCouponServiceImpl.java
...in/java/share/system/service/impl/SCouponServiceImpl.java
+5
-0
SCouponMapper.xml
...system/src/main/resources/mapper/system/SCouponMapper.xml
+7
-0
No files found.
share-system/src/main/java/share/system/mapper/SCouponMapper.java
View file @
ea4d021b
...
...
@@ -60,4 +60,6 @@ public interface SCouponMapper
public
int
deleteSCouponByIds
(
Long
[]
ids
);
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
);
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
);
}
share-system/src/main/java/share/system/service/ISCouponService.java
View file @
ea4d021b
...
...
@@ -65,4 +65,6 @@ public interface ISCouponService
* @return 结果
*/
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
);
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
);
}
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
ea4d021b
...
...
@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.*
;
import
share.common.utils.DateUtils
;
...
...
@@ -102,7 +103,6 @@ public class QPServiceImpl implements QPService {
}
}
//根据优惠卷名称查询优惠劵配置 查询list,取第一个
SCoupon
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
()).
get
(
0
);
TuangouReceiptPrepareResponseEntityVo
response
=
new
TuangouReceiptPrepareResponseEntityVo
();
SConsumerCoupon
sConsumerCoupon
=
new
SConsumerCoupon
();
sConsumerCoupon
.
setConsumerId
(
user
.
getId
());
...
...
@@ -114,15 +114,6 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setUseStatus
(
UserStatusEnum
.
UNUSED
.
getCode
());
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
sConsumerCoupon
.
setCreateTime
(
new
Date
());
if
(
ObjectUtils
.
isEmpty
(
sCoupon
))
{
sConsumerCoupon
.
setCouponType
(
CouponTypeEnum
.
CASH
.
getCode
());
sConsumerCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sConsumerCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
sConsumerCoupon
.
setMinDuration
(
DEFAULT_MIN_DURATION
);
sConsumerCoupon
.
setMaxDuration
(
DEFAULT_MAX_DURATION
);
sConsumerCoupon
.
setDuration
(
DEFAULT_DURATION
);
sConsumerCoupon
.
setMinPrice
(
DEFAULT_MIN_PRICE
);
sConsumerCoupon
.
setSubPrice
(
BigDecimal
.
valueOf
(
prepare
.
getDeal_marketprice
()));
//根据门店id查询门店信息
List
<
TuangouDealQueryShopDealResponseEntity
>
queryshopdeal
=
queryshopdeal
(
openShopUuid
);
...
...
@@ -141,6 +132,20 @@ public class QPServiceImpl implements QPService {
}
});
List
<
SCoupon
>
sCoupons
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
());
SCoupon
sCoupon
=
new
SCoupon
();
if
(!
CollectionUtils
.
isEmpty
(
sCoupons
))
{
sCoupon
=
isCouponService
.
selectSCouponByName
(
prepare
.
getDeal_title
()).
get
(
0
);
}
if
(!
ObjectUtils
.
isEmpty
(
sCoupon
))
{
sConsumerCoupon
.
setCouponType
(
CouponTypeEnum
.
CASH
.
getCode
());
sConsumerCoupon
.
setStoreType
(
StoreType
.
getCodeList
());
sConsumerCoupon
.
setRoomType
(
RoomType
.
getCodeList
());
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
sConsumerCoupon
.
setMinDuration
(
DEFAULT_MIN_DURATION
);
sConsumerCoupon
.
setMaxDuration
(
DEFAULT_MAX_DURATION
);
sConsumerCoupon
.
setDuration
(
DEFAULT_DURATION
);
sConsumerCoupon
.
setMinPrice
(
DEFAULT_MIN_PRICE
);
sConsumerCoupon
.
setCouponTimeStart
(
DEFAULT_START_TIME
);
sConsumerCoupon
.
setCouponTimeEnd
(
DEFAULT_END_TIME
);
}
else
{
...
...
@@ -152,12 +157,8 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setMaxDuration
(
sCoupon
.
getMaxDuration
());
sConsumerCoupon
.
setDuration
(
sCoupon
.
getDuration
());
sConsumerCoupon
.
setMinPrice
(
sCoupon
.
getMinPrice
());
sConsumerCoupon
.
setSubPrice
(
sCoupon
.
getSubPrice
());
sConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
sConsumerCoupon
.
setEndDate
(
prepare
.
getReceiptEndDate
());
sConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
sConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
}
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
response
.
setConsumerCouponId
(
sConsumerCoupon
.
getId
());
...
...
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
ea4d021b
...
...
@@ -4,8 +4,11 @@ package share.system.service.impl;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
cn.hutool.json.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -108,6 +111,23 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
*/
@Override
public
int
deleteSConsumerCouponByIds
(
Long
[]
ids
)
{
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
in
(
SConsumerCoupon:
:
getId
,
ids
);
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponMapper
.
selectList
(
queryWrapper
);
//获取sConsumerCoupons里的优惠券id
Long
[]
couponIds
=
sConsumerCoupons
.
stream
().
map
(
SConsumerCoupon:
:
getCouponId
).
toArray
(
Long
[]::
new
);
//根据优惠券id查询优惠券信息
List
<
SCoupon
>
sCoupons
=
sCouponService
.
selectSCouponByIds
(
couponIds
);
sCoupons
.
stream
().
forEach
(
item
->
{
//判断ids里的优惠券id是否等于sCoupons里的优惠券id
if
(
Arrays
.
asList
(
couponIds
).
contains
(
item
.
getId
()))
{
//优惠券数量加一
item
.
setNumber
(
item
.
getNumber
()
+
1
);
sCouponService
.
updateSCoupon
(
item
);
}
});
return
sConsumerCouponMapper
.
deleteSConsumerCouponByIds
(
ids
);
}
...
...
@@ -205,14 +225,13 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
newSConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
newSConsumerCoupon
.
setCouponType
(
sCoupon
.
getCouponType
());
if
(
sCoupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
CASH
.
getCode
()))
{
newSConsumerCoupon
.
setMinPrice
(
new
BigDecimal
(
0.00
));
newSConsumerCoupon
.
setSubPrice
(
sCoupon
.
getSubPrice
());
}
else
if
(
sCoupon
.
getCouponType
().
equals
(
CouponTypeEnum
.
DURATION
.
getCode
()))
{
newSConsumerCoupon
.
setMinDuration
(
sCoupon
.
getMinDuration
());
newSConsumerCoupon
.
setMaxDuration
(
sCoupon
.
getMaxDuration
());
newSConsumerCoupon
.
setDuration
(
sCoupon
.
getDuration
());
}
newSConsumerCoupon
.
setSourceType
(
SourceTypeEnum
.
GIVE
.
getCode
());
newSConsumerCoupon
.
setPlatformType
(
String
.
valueOf
(
sCoupon
.
getPlatformType
()));
newSConsumerCoupon
.
setStartDate
(
sCoupon
.
getStartDate
());
...
...
share-system/src/main/java/share/system/service/impl/SCouponServiceImpl.java
View file @
ea4d021b
...
...
@@ -129,4 +129,9 @@ public class SCouponServiceImpl implements ISCouponService
public
List
<
SCoupon
>
selectSCouponByName
(
String
dealTitle
)
{
return
sCouponMapper
.
selectSCouponByName
(
dealTitle
);
}
@Override
public
List
<
SCoupon
>
selectSCouponByIds
(
Long
[]
couponIds
)
{
return
sCouponMapper
.
selectSCouponByIds
(
couponIds
);
}
}
share-system/src/main/resources/mapper/system/SCouponMapper.xml
View file @
ea4d021b
...
...
@@ -82,6 +82,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include
refid=
"selectSCouponVo"
/>
where name = #{name}
</select>
<select
id=
"selectSCouponByIds"
resultMap=
"SCouponResult"
>
<include
refid=
"selectSCouponVo"
/>
where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</select>
<insert
id=
"insertSCoupon"
parameterType=
"SCoupon"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_coupon
...
...
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