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
b53f572c
Commit
b53f572c
authored
Jan 13, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改查询接口
parent
b249c833
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
SConsumerCouponController.java
...hare/web/controller/system/SConsumerCouponController.java
+26
-2
SConsumerCouponServiceImpl.java
...share/system/service/impl/SConsumerCouponServiceImpl.java
+3
-17
No files found.
share-admin/src/main/java/share/web/controller/system/SConsumerCouponController.java
View file @
b53f572c
package
share
.
web
.
controller
.
system
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -7,6 +8,7 @@ import javax.servlet.http.HttpServletResponse;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
...
...
@@ -21,10 +23,12 @@ import share.common.core.domain.AjaxResult;
import
share.common.enums.BusinessType
;
import
share.common.enums.RoomType
;
import
share.common.enums.StoreType
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.service.ISConsumerCouponService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
import
share.system.service.SConsumerService
;
/**
* 优惠券领取记录Controller
...
...
@@ -39,6 +43,9 @@ public class SConsumerCouponController extends BaseController
@Autowired
private
ISConsumerCouponService
sConsumerCouponService
;
@Autowired
private
SConsumerService
sConsumerService
;
/**
* 查询优惠券领取记录列表
*/
...
...
@@ -47,8 +54,25 @@ public class SConsumerCouponController extends BaseController
public
TableDataInfo
list
(
SConsumerCoupon
sConsumerCoupon
)
{
startPage
();
List
<
SConsumerCoupon
>
list
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
return
getDataTable
(
list
);
List
<
SConsumer
>
list
=
sConsumerService
.
list
();
if
(
share
.
common
.
utils
.
StringUtils
.
isNotBlank
(
sConsumerCoupon
.
getPhone
()))
{
SConsumer
sConsumer
=
list
.
stream
().
filter
(
obj
->
obj
.
getPhone
().
equals
(
sConsumerCoupon
.
getPhone
())).
findFirst
().
orElse
(
null
);
if
(!
ObjectUtils
.
isEmpty
(
sConsumer
))
{
sConsumerCoupon
.
setConsumerId
(
sConsumer
.
getId
());
}
else
{
return
getDataTable
(
new
ArrayList
<>());
}
}
if
(
share
.
common
.
utils
.
StringUtils
.
isNotBlank
(
sConsumerCoupon
.
getNickName
()))
{
SConsumer
sConsumer
=
list
.
stream
().
filter
(
obj
->
share
.
common
.
utils
.
StringUtils
.
isNotBlank
(
obj
.
getNickName
())
&&
obj
.
getNickName
().
equals
(
sConsumerCoupon
.
getNickName
())).
findFirst
().
orElse
(
null
);
if
(!
ObjectUtils
.
isEmpty
(
sConsumer
))
{
sConsumerCoupon
.
setConsumerId
(
sConsumer
.
getId
());
}
else
{
return
getDataTable
(
new
ArrayList
<>());
}
}
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
selectSConsumerCouponList
(
sConsumerCoupon
);
return
getDataTable
(
sConsumerCoupons
);
}
...
...
share-system/src/main/java/share/system/service/impl/SConsumerCouponServiceImpl.java
View file @
b53f572c
...
...
@@ -48,6 +48,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
@Autowired
private
SConsumerService
sConsumerService
;
private
static
final
Integer
ZERO
=
0
;
/**
...
...
@@ -69,23 +70,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
*/
@Override
public
List
<
SConsumerCoupon
>
selectSConsumerCouponList
(
SConsumerCoupon
sConsumerCoupon
)
{
List
<
SConsumer
>
list
=
sConsumerService
.
list
();
if
(
StringUtils
.
isNotBlank
(
sConsumerCoupon
.
getPhone
()))
{
SConsumer
sConsumer
=
list
.
stream
().
filter
(
obj
->
obj
.
getPhone
().
equals
(
sConsumerCoupon
.
getPhone
())).
findFirst
().
orElse
(
null
);
if
(!
ObjectUtils
.
isEmpty
(
sConsumer
))
{
sConsumerCoupon
.
setConsumerId
(
sConsumer
.
getId
());
}
else
{
return
new
ArrayList
<>();
}
}
if
(
StringUtils
.
isNotBlank
(
sConsumerCoupon
.
getNickName
()))
{
SConsumer
sConsumer
=
list
.
stream
().
filter
(
obj
->
StringUtils
.
isNotBlank
(
obj
.
getNickName
())
&&
obj
.
getNickName
().
equals
(
sConsumerCoupon
.
getNickName
())).
findFirst
().
orElse
(
null
);
if
(!
ObjectUtils
.
isEmpty
(
sConsumer
))
{
sConsumerCoupon
.
setConsumerId
(
sConsumer
.
getId
());
}
else
{
return
new
ArrayList
<>();
}
}
List
<
SConsumerCoupon
>
sConsumerCoupons
=
baseMapper
.
selectSConsumerCouponList
(
sConsumerCoupon
);
sConsumerCoupons
.
forEach
(
item
->
{
if
(
item
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
...
...
@@ -94,6 +79,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
baseMapper
.
updateSConsumerCoupon
(
item
);
}
}
List
<
SConsumer
>
list
=
sConsumerService
.
list
();
if
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
isPresent
())
{
item
.
setPhone
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
get
().
getPhone
());
if
(
StringUtils
.
isNotBlank
(
list
.
stream
().
filter
(
obj
->
obj
.
getId
().
equals
(
item
.
getConsumerId
())).
findFirst
().
get
().
getNickName
()))
{
...
...
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