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
990b5277
Commit
990b5277
authored
Nov 11, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改次卡推荐接口
parent
9d554fa7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
16 deletions
+52
-16
ConsumerMonthlyCardController.java
.../web/controller/system/ConsumerMonthlyCardController.java
+10
-2
MonthlyCardResponse.java
.../main/java/share/system/response/MonthlyCardResponse.java
+25
-0
ConsumerMonthlyCardService.java
...java/share/system/service/ConsumerMonthlyCardService.java
+2
-2
ConsumerMonthlyCardServiceImpl.java
...e/system/service/impl/ConsumerMonthlyCardServiceImpl.java
+15
-12
No files found.
share-front/src/main/java/share/web/controller/system/ConsumerMonthlyCardController.java
View file @
990b5277
package
share
.
web
.
controller
.
system
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
share.common.core.controller.BaseController
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.R
;
import
share.common.core.page.TableDataInfo
;
import
share.common.utils.JsonConvertUtil
;
import
share.system.domain.vo.ConsumerMonthlyCardVo
;
import
share.system.request.MonthlyCardRequest
;
import
share.system.response.MonthlyCardResponse
;
import
share.system.service.ConsumerMonthlyCardService
;
import
java.util.List
;
...
...
@@ -18,6 +22,7 @@ import java.util.List;
* @author wuwenlong
* @date 2024-08-27
*/
@Slf4j
@RestController
@RequestMapping
(
"/consumerMonthlyCard"
)
public
class
ConsumerMonthlyCardController
extends
BaseController
{
...
...
@@ -43,7 +48,10 @@ public class ConsumerMonthlyCardController extends BaseController {
//查询可用卡类
@PostMapping
(
"/queryCardType"
)
public
AjaxResult
queryCardType
(
@RequestBody
@Validated
MonthlyCardRequest
monthlyCardRequest
)
{
return
success
(
consumerMonthlyCardService
.
queryCardType
(
monthlyCardRequest
));
public
R
<
MonthlyCardResponse
>
queryCardType
(
@RequestBody
@Validated
MonthlyCardRequest
monthlyCardRequest
)
{
log
.
debug
(
"ConsumerMonthlyCardController method queryCardType 入参 {}"
,
JsonConvertUtil
.
write2JsonStr
(
monthlyCardRequest
));
MonthlyCardResponse
monthlyCardResponse
=
consumerMonthlyCardService
.
queryCardType
(
monthlyCardRequest
);
log
.
debug
(
"ConsumerMonthlyCardController method queryCardType 出参 {}"
,
JsonConvertUtil
.
write2JsonStr
(
monthlyCardResponse
));
return
R
.
ok
(
monthlyCardResponse
);
}
}
share-system/src/main/java/share/system/response/MonthlyCardResponse.java
0 → 100644
View file @
990b5277
package
share
.
system
.
response
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
share.system.domain.ConsumerMonthlyCard
;
import
share.system.domain.ConsumerSecondaryCard
;
import
java.util.List
;
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"MonthlyCardResponse"
,
description
=
"卡包响应对象"
)
public
class
MonthlyCardResponse
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"月卡"
)
private
List
<
ConsumerMonthlyCard
>
consumerMonthlyCard
;
@ApiModelProperty
(
value
=
"次卡"
)
private
List
<
ConsumerSecondaryCard
>
consumerSecondaryCard
;
}
share-system/src/main/java/share/system/service/ConsumerMonthlyCardService.java
View file @
990b5277
...
...
@@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
share.system.domain.ConsumerMonthlyCard
;
import
share.system.domain.vo.ConsumerMonthlyCardVo
;
import
share.system.request.MonthlyCardRequest
;
import
share.system.response.MonthlyCardResponse
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* 用户月卡Service接口
...
...
@@ -66,7 +66,7 @@ public interface ConsumerMonthlyCardService extends IService<ConsumerMonthlyCard
List
<
ConsumerMonthlyCardVo
>
selectByConsumerId
();
M
ap
<
String
,
List
<
Object
>>
queryCardType
(
MonthlyCardRequest
monthlyCardRequest
);
M
onthlyCardResponse
queryCardType
(
MonthlyCardRequest
monthlyCardRequest
);
List
<
ConsumerMonthlyCard
>
confNameByIds
(
ArrayList
<
Long
>
longs
);
}
share-system/src/main/java/share/system/service/impl/ConsumerMonthlyCardServiceImpl.java
View file @
990b5277
...
...
@@ -14,10 +14,13 @@ import share.system.domain.*;
import
share.system.domain.vo.ConsumerMonthlyCardVo
;
import
share.system.mapper.ConsumerMonthlyCardMapper
;
import
share.system.request.MonthlyCardRequest
;
import
share.system.response.MonthlyCardResponse
;
import
share.system.service.*
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
/**
* 用户月卡Service业务层处理
...
...
@@ -121,13 +124,13 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
}
@Override
public
M
ap
<
String
,
List
<
Object
>>
queryCardType
(
MonthlyCardRequest
monthlyCardRequest
)
{
public
M
onthlyCardResponse
queryCardType
(
MonthlyCardRequest
monthlyCardRequest
)
{
SConsumer
user
=
sConsumerService
.
getInfo
();
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
user
.
getId
()).
eq
(
ConsumerMember:
:
getIsRights
,
YesNoEnum
.
yes
.
getIndex
()));
ConsumerMonthlyCard
consumerMonthlyCard
=
null
;
List
<
ConsumerSecondaryCard
>
consumerSecondaryCard
=
null
;
M
ap
<
String
,
List
<
Object
>>
map
=
new
HashMap
<>
();
M
onthlyCardResponse
map
=
new
MonthlyCardResponse
();
List
<
ConsumerMonthlyCard
>
consumerMonthlyCardList
=
new
ArrayList
<>();
List
<
ConsumerSecondaryCard
>
consumerSecondaryCardList
=
new
ArrayList
<>();
...
...
@@ -146,7 +149,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
//标签没绑定套餐
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
)
&&
new
BigDecimal
(
label
.
getDuration
()).
compareTo
(
BigDecimal
.
ONE
)
>=
0
)
{
consumerMonthlyCardList
.
add
(
consumerMonthlyCard
);
map
.
put
(
"consumerMonthlyCard"
,
Collections
.
singletonList
(
consumerMonthlyCardList
)
);
map
.
setConsumerMonthlyCard
(
consumerMonthlyCardList
);
}
if
(
CollectionUtil
.
isNotEmpty
(
consumerSecondaryCard
))
{
//过滤时长相等的
...
...
@@ -155,7 +158,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
if
(
Objects
.
equals
(
item
.
getSingleDuration
(),
Integer
.
valueOf
(
label
.
getDuration
()))
&&
item
.
getSingleAmount
().
compareTo
(
new
BigDecimal
(
label
.
getDuration
()).
multiply
(
room
.
getPrice
()))
>=
0
)
{
consumerSecondaryCardList
.
add
(
item
);
map
.
put
(
"consumerSecondaryCard"
,
Collections
.
singletonList
(
consumerSecondaryCardList
)
);
map
.
setConsumerSecondaryCard
(
consumerSecondaryCardList
);
}
}
...
...
@@ -172,20 +175,20 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
if
(
Objects
.
equals
(
item
.
getSingleDuration
(),
Integer
.
valueOf
(
byId
.
getDuration
()))
&&
item
.
getSingleAmount
().
compareTo
(
byId
.
getPrice
())
>=
0
)
{
consumerSecondaryCardList
.
add
(
item
);
map
.
put
(
"consumerSecondaryCard"
,
Collections
.
singletonList
(
consumerSecondaryCardList
)
);
map
.
setConsumerSecondaryCard
(
consumerSecondaryCardList
);
}
});
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
)
&&
consumerMonthlyCard
.
getFreeDuration
().
compareTo
(
new
BigDecimal
(
byId
.
getDuration
()))
>=
0
)
{
consumerMonthlyCardList
.
add
(
consumerMonthlyCard
);
map
.
put
(
"consumerMonthlyCard"
,
Collections
.
singletonList
(
consumerMonthlyCardList
)
);
map
.
setConsumerMonthlyCard
(
consumerMonthlyCardList
);
}
return
map
;
//标签绑定了套餐,套餐没开启,小时
}
else
{
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
)
&&
new
BigDecimal
(
label
.
getDuration
()).
compareTo
(
BigDecimal
.
ONE
)
>=
0
)
{
consumerMonthlyCardList
.
add
(
consumerMonthlyCard
);
map
.
put
(
"consumerMonthlyCard"
,
Collections
.
singletonList
(
consumerMonthlyCardList
)
);
map
.
setConsumerMonthlyCard
(
consumerMonthlyCardList
);
}
if
(
CollectionUtil
.
isNotEmpty
(
consumerSecondaryCard
))
{
//过滤时长相等的
...
...
@@ -194,7 +197,7 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
if
(
Objects
.
equals
(
item
.
getSingleDuration
(),
Integer
.
valueOf
(
label
.
getDuration
()))
&&
item
.
getSingleAmount
().
compareTo
(
new
BigDecimal
(
label
.
getDuration
()).
multiply
(
room
.
getPrice
()))
>=
0
)
{
consumerSecondaryCardList
.
add
(
item
);
map
.
put
(
"consumerSecondaryCard"
,
Collections
.
singletonList
(
consumerSecondaryCardList
)
);
map
.
setConsumerSecondaryCard
(
consumerSecondaryCardList
);
}
}
});
...
...
@@ -211,18 +214,18 @@ public class ConsumerMonthlyCardServiceImpl extends ServiceImpl<ConsumerMonthlyC
if
(
Objects
.
equals
(
item
.
getSingleDuration
(),
Integer
.
valueOf
(
pack
.
getDuration
()))
&&
item
.
getSingleAmount
().
compareTo
(
pack
.
getPrice
())
>=
0
)
{
consumerSecondaryCardList
.
add
(
item
);
map
.
put
(
"consumerSecondaryCard"
,
Collections
.
singletonList
(
consumerSecondaryCardList
)
);
map
.
setConsumerSecondaryCard
(
consumerSecondaryCardList
);
}
});
}
if
(
ObjectUtil
.
isNotEmpty
(
consumerMonthlyCard
)
&&
consumerMonthlyCard
.
getFreeDuration
().
compareTo
(
new
BigDecimal
(
pack
.
getDuration
()))
>=
0
)
{
consumerMonthlyCardList
.
add
(
consumerMonthlyCard
);
map
.
put
(
"consumerMonthlyCard"
,
Collections
.
singletonList
(
consumerMonthlyCardList
)
);
map
.
setConsumerMonthlyCard
(
consumerMonthlyCardList
);
}
return
map
;
}
}
return
new
HashMap
<>
();
return
new
MonthlyCardResponse
();
}
@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