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
a0878418
Commit
a0878418
authored
Jan 25, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into test
parents
f4a0854f
e5b2b132
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
14 deletions
+82
-14
SCouponController.java
...n/java/share/web/controller/system/SCouponController.java
+2
-4
SCouponVo.java
...ystem/src/main/java/share/system/domain/vo/SCouponVo.java
+23
-0
SCouponMapper.java
...stem/src/main/java/share/system/mapper/SCouponMapper.java
+1
-0
ISCouponService.java
...m/src/main/java/share/system/service/ISCouponService.java
+3
-1
SCouponServiceImpl.java
...in/java/share/system/service/impl/SCouponServiceImpl.java
+53
-9
No files found.
share-admin/src/main/java/share/web/controller/system/SCouponController.java
View file @
a0878418
...
...
@@ -23,6 +23,7 @@ import share.common.enums.CouponTypeEnum;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.system.domain.SCoupon
;
import
share.system.domain.vo.SCouponVo
;
import
share.system.service.ISCouponService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
...
...
@@ -58,10 +59,7 @@ public class SCouponController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('system:coupon:list')"
)
@GetMapping
(
"/list/duration"
)
public
TableDataInfo
listDuration
(
SCoupon
sCoupon
)
{
startPage
();
sCoupon
.
setCouponType
(
CouponTypeEnum
.
DURATION
.
getCode
());
List
<
SCoupon
>
list
=
sCouponService
.
listDuration
(
sCoupon
);
return
getDataTable
(
list
);
return
sCouponService
.
listDuration
(
sCoupon
);
}
/**
...
...
share-system/src/main/java/share/system/domain/vo/SCouponVo.java
0 → 100644
View file @
a0878418
package
share
.
system
.
domain
.
vo
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
share.system.domain.SCoupon
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 优惠券对象 s_coupon
*
* @author ruoyi
* @date 2023-09-27
*/
@Data
public
class
SCouponVo
extends
SCoupon
{
private
Integer
givNumber
;
}
share-system/src/main/java/share/system/mapper/SCouponMapper.java
View file @
a0878418
...
...
@@ -5,6 +5,7 @@ import java.util.List;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.SCoupon
;
import
share.system.domain.SmsLog
;
import
share.system.domain.vo.SCouponVo
;
/**
* 优惠券Mapper接口
...
...
share-system/src/main/java/share/system/service/ISCouponService.java
View file @
a0878418
...
...
@@ -3,8 +3,10 @@ package share.system.service;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.common.core.page.TableDataInfo
;
import
share.system.domain.DeviceLog
;
import
share.system.domain.SCoupon
;
import
share.system.domain.vo.SCouponVo
;
/**
* 优惠券Service接口
...
...
@@ -73,7 +75,7 @@ public interface ISCouponService extends IService<SCoupon>
List
<
SCoupon
>
queryShopDeal
();
List
<
SCoupon
>
listDuration
(
SCoupon
sCoupon
);
TableDataInfo
listDuration
(
SCoupon
sCoupon
);
List
<
SCoupon
>
selectSCouponByDealgroupId
(
Long
dealgroupId
);
}
share-system/src/main/java/share/system/service/impl/SCouponServiceImpl.java
View file @
a0878418
...
...
@@ -10,23 +10,24 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.dianping.openapi.sdk.api.tuangou.entity.TuangouDealQueryShopDealResponseEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
share.common.core.page.PageDomain
;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableSupport
;
import
share.common.enums.CouponTypeEnum
;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.system.domain.SStore
;
import
share.system.domain.SmsLog
;
import
share.system.domain.*
;
import
share.system.domain.vo.SCouponVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.SCouponMapper
;
import
share.system.domain.SCoupon
;
import
share.system.mapper.SmsLogMapper
;
import
share.system.service.ISCouponService
;
import
share.system.service.ISStoreService
;
import
share.system.service.QPService
;
import
share.system.service.SmsLogService
;
import
share.system.service.*
;
/**
* 优惠券Service业务层处理
...
...
@@ -42,6 +43,8 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
private
ISStoreService
storeService
;
@Autowired
private
QPService
qpService
;
@Autowired
private
ISConsumerCouponService
sConsumerCouponService
;
//默认时长
private
static
final
String
DEFAULT_DURATION
=
"0"
;
//默认折扣最大时长
...
...
@@ -216,8 +219,49 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
}
@Override
public
List
<
SCoupon
>
listDuration
(
SCoupon
sCoupon
)
{
return
sCouponMapper
.
listDuration
(
sCoupon
);
public
TableDataInfo
listDuration
(
SCoupon
sCoupon
)
{
sCoupon
.
setCouponType
(
CouponTypeEnum
.
DURATION
.
getCode
());
List
<
SCoupon
>
sCouponList
=
sCouponMapper
.
listDuration
(
sCoupon
);
List
<
SCouponVo
>
sCouponVoList
=
convertDoListToVoList
(
sCouponList
);
//获取sCouponVoList的id集合
List
<
Long
>
ids
=
sCouponVoList
.
stream
().
map
(
SCoupon:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
list
(
new
LambdaQueryWrapper
<>(
SConsumerCoupon
.
class
).
in
(
SConsumerCoupon:
:
getCouponId
,
ids
));
//统计每个couponId的出现次数
Map
<
Long
,
Long
>
collect
=
sConsumerCoupons
.
stream
().
collect
(
Collectors
.
groupingBy
(
SConsumerCoupon:
:
getCouponId
,
Collectors
.
counting
()));
sCouponVoList
.
stream
().
forEach
(
item
->
{
Long
count
=
collect
.
get
(
item
.
getId
());
if
(
ObjectUtils
.
isEmpty
(
count
))
{
item
.
setGivNumber
(
0
);
}
else
{
item
.
setGivNumber
(
count
.
intValue
());
}
});
PageDomain
pageDomain
=
TableSupport
.
buildPageRequest
();
Integer
pageNum
=
pageDomain
.
getPageNum
();
Integer
pageSize
=
pageDomain
.
getPageSize
();
sCouponVoList
.
sort
(
Comparator
.
comparing
(
SCouponVo:
:
getCreateTime
).
reversed
());
int
start
=
(
pageNum
-
1
)
*
pageSize
;
int
end
=
Math
.
min
(
start
+
pageSize
,
sCouponVoList
.
size
());
List
<
SCouponVo
>
pagedList
=
sCouponVoList
.
subList
(
start
,
end
);
TableDataInfo
tableDataInfo
=
new
TableDataInfo
();
tableDataInfo
.
setRows
(
pagedList
);
tableDataInfo
.
setTotal
(
sCouponVoList
.
size
());
tableDataInfo
.
setCode
(
200
);
tableDataInfo
.
setMsg
(
"查询成功"
);
return
tableDataInfo
;
}
private
List
<
SCouponVo
>
convertDoListToVoList
(
List
<
SCoupon
>
roomList
)
{
List
<
SCouponVo
>
voList
=
new
ArrayList
<>();
if
(
org
.
apache
.
commons
.
collections4
.
CollectionUtils
.
isNotEmpty
(
roomList
))
{
roomList
.
stream
().
forEach
(
o
->
{
SCouponVo
vo
=
new
SCouponVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
voList
.
add
(
vo
);
});
}
return
voList
;
}
@Override
...
...
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