Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
huluobin
gogirl-miniapp-backend
Commits
8e265172
Commit
8e265172
authored
Mar 16, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
long 序列化
parent
3ad9aa82
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
166 additions
and
7 deletions
+166
-7
CouponCustomerRelevanceServiceImpl.java
...ation/market/impl/CouponCustomerRelevanceServiceImpl.java
+14
-3
CouponServiceImpl.java
...com/gogirl/application/market/impl/CouponServiceImpl.java
+3
-0
MarketServiceImpl.java
...com/gogirl/application/market/impl/MarketServiceImpl.java
+0
-0
MallShoppingCartQryServiceImpl.java
...ion/product/mall/impl/MallShoppingCartQryServiceImpl.java
+25
-1
BaseQuestionServiceImpl.java
...tion/user/investigation/impl/BaseQuestionServiceImpl.java
+0
-1
MallProductDTOAssembler.java
...in/java/com/gogirl/assembler/MallProductDTOAssembler.java
+24
-0
MallShoppingCartDTOAssembler.java
...va/com/gogirl/assembler/MallShoppingCartDTOAssembler.java
+41
-0
Coupon.java
src/main/java/com/gogirl/domain/market/coupon/Coupon.java
+4
-0
CouponCustomerRelevance.java
.../gogirl/domain/market/coupon/CouponCustomerRelevance.java
+24
-0
TimesCardCustomerRelevance.java
...l/domain/market/timescard/TimesCardCustomerRelevance.java
+4
-0
MallShoppingCart.java
...n/java/com/gogirl/domain/order/mall/MallShoppingCart.java
+6
-0
TimesCardController.java
.../java/com/gogirl/interfaces/user/TimesCardController.java
+18
-1
OrderServeDTO.java
...ared/order/serve/query/dto/ordermanage/OrderServeDTO.java
+2
-0
MyMallShoppingCartDTO.java
...ogirl/shared/product/query/dto/MyMallShoppingCartDTO.java
+1
-1
No files found.
src/main/java/com/gogirl/application/market/impl/CouponCustomerRelevanceServiceImpl.java
View file @
8e265172
...
...
@@ -20,6 +20,7 @@ import com.gogirl.infrastructure.mapper.order.serve.OrderServeMapper;
import
com.gogirl.shared.market.command.SetUpOuterCouponCommand
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.Date
;
...
...
@@ -30,6 +31,7 @@ import java.util.stream.Collectors;
@Service
@Slf4j
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
CouponCustomerRelevanceServiceImpl
extends
ServiceImpl
<
CouponCustomerRelevanceMapper
,
CouponCustomerRelevance
>
implements
CouponCustomerRelevanceService
{
@Resource
...
...
@@ -65,6 +67,15 @@ public class CouponCustomerRelevanceServiceImpl extends ServiceImpl<CouponCustom
List
<
Integer
>
freeCouponIds
=
discountConfigMapper
.
selectList
(
new
LambdaQueryWrapper
<>()).
stream
().
map
(
DiscountConfig:
:
getCouponId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
canUserServeIds
.
retainAll
(
orderServeList
.
stream
()
.
map
(
OrderServe:
:
getServeId
)
.
collect
(
Collectors
.
toList
()));
return
ListUtil
.
isNotEmpty
(
canUserServeIds
);
})
.
peek
(
couponCustomerRelevance
->
{
List
<
Integer
>
canUserServeIds
=
couponCustomerRelevanceMapper
.
queryCouponCustomerServeRelevance
(
couponCustomerRelevance
.
getCouponId
());
List
<
Integer
>
freeCouponIds
=
discountConfigMapper
.
selectList
(
new
LambdaQueryWrapper
<>()).
stream
().
map
(
DiscountConfig:
:
getCouponId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
if
(
freeCouponIds
.
contains
(
couponCustomerRelevance
.
getCouponId
()))
{
canUserServeIds
.
retainAll
(
orderServeList
.
stream
()
.
filter
(
orderServe
->
orderServe
.
getBindCoupon
()
==
2
)
...
...
@@ -73,13 +84,13 @@ public class CouponCustomerRelevanceServiceImpl extends ServiceImpl<CouponCustom
}
else
{
canUserServeIds
.
retainAll
(
orderServeList
.
stream
()
.
filter
(
orderServe
->
orderServe
.
getBindCoupon
()
==
2
)
.
filter
(
orderServe
->
orderServe
.
getProduceCurrentPrice
()
==
null
)
.
filter
(
orderServe
->
orderServe
.
getProduceCurrentPrice
()
.
compareTo
(
orderServe
.
getProduceBargainPrice
())
>
-
1
)
.
filter
(
orderServe
->
orderServe
.
getProducePromotionTimeId
()
==
null
)
.
filter
(
orderServe
->
orderServe
.
getLeisureDiscountConfigId
()
==
null
)
.
filter
(
orderServe
->
orderServe
.
getLeisureDiscountConfigId
()
==
null
||
orderServe
.
getLeisureDiscountConfigId
()
==
0
)
.
map
(
OrderServe:
:
getServeId
)
.
collect
(
Collectors
.
toList
()));
}
return
ListUtil
.
isNotEmpty
(
canUserServeIds
);
couponCustomerRelevance
.
setCanBeUse
(
ListUtil
.
isNotEmpty
(
canUserServeIds
)
);
})
//过滤可用
.
filter
(
CouponCustomerRelevance:
:
isValid
)
...
...
src/main/java/com/gogirl/application/market/impl/CouponServiceImpl.java
View file @
8e265172
...
...
@@ -223,6 +223,9 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
canUserServeIds
.
retainAll
(
orderServeList
.
stream
().
map
(
OrderServe:
:
getServeId
).
collect
(
Collectors
.
toList
()));
return
ListUtil
.
isNotEmpty
(
canUserServeIds
);
})
.
peek
(
coupon
->
{
})
//过滤达到可用金额
.
filter
(
coupon
->
coupon
.
getReachingAmount
().
compareTo
(
orderManage
.
getTotalPrice
())
<
0
)
.
collect
(
Collectors
.
toList
());
...
...
src/main/java/com/gogirl/application/market/impl/MarketServiceImpl.java
View file @
8e265172
This diff is collapsed.
Click to expand it.
src/main/java/com/gogirl/application/product/mall/impl/MallShoppingCartQryServiceImpl.java
View file @
8e265172
...
...
@@ -2,29 +2,53 @@ package com.gogirl.application.product.mall.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.gogirl.application.product.mall.MallShoppingCartQryService
;
import
com.gogirl.assembler.MallShoppingCartDTOAssembler
;
import
com.gogirl.domain.order.mall.MallShoppingCart
;
import
com.gogirl.domain.product.mall.MallProduct
;
import
com.gogirl.infrastructure.common.util.ListUtil
;
import
com.gogirl.infrastructure.mapper.order.mall.MallShoppingCartMapper
;
import
com.gogirl.infrastructure.mapper.product.mall.MallProductMapper
;
import
com.gogirl.shared.product.query.dto.MallShoppingCartDTO
;
import
com.gogirl.shared.product.query.dto.MyMallShoppingCartDTO
;
import
com.gogirl.shared.product.query.qry.MyShoppingCartQuery
;
import
lombok.AllArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
@AllArgsConstructor
public
class
MallShoppingCartQryServiceImpl
implements
MallShoppingCartQryService
{
private
final
MallShoppingCartMapper
mallShoppingCartMapper
;
private
final
MallShoppingCartDTOAssembler
mallShoppingCartDTOAssembler
;
private
final
MallProductMapper
mallProductMapper
;
@Override
public
MyMallShoppingCartDTO
queryMyShoppingCart
(
MyShoppingCartQuery
qry
)
{
List
<
MallShoppingCart
>
mallShoppingCartList
=
mallShoppingCartMapper
.
selectList
(
new
LambdaQueryWrapper
<
MallShoppingCart
>().
eq
(
MallShoppingCart:
:
getCustomerId
,
qry
.
getCustomerId
())
);
List
<
Long
>
productIds
=
mallShoppingCartList
.
stream
().
map
(
MallShoppingCart:
:
getProductId
)
.
collect
(
Collectors
.
toList
());
if
(
ListUtil
.
isNotEmpty
(
productIds
))
{
Map
<
Long
,
List
<
MallProduct
>>
map
=
mallProductMapper
.
selectBatchIds
(
productIds
)
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
MallProduct:
:
getId
));
mallShoppingCartList
.
forEach
(
mallShoppingCart
->
{
List
<
MallProduct
>
mallProductList
=
map
.
get
(
mallShoppingCart
.
getProductId
());
if
(
ListUtil
.
isNotEmpty
(
mallProductList
))
{
mallShoppingCart
.
setMallProduct
(
mallProductList
.
stream
().
findAny
().
orElse
(
null
));
}
});
}
List
<
MallShoppingCartDTO
>
mallShoppingCartDTOList
=
mallShoppingCartList
.
stream
().
map
(
mallShoppingCartDTOAssembler
).
collect
(
Collectors
.
toList
());
MyMallShoppingCartDTO
data
=
new
MyMallShoppingCartDTO
();
data
.
setMallShoppingCartDTOList
(
mallShoppingCartList
);
data
.
setMallShoppingCartDTOList
(
mallShoppingCart
DTO
List
);
data
.
setItemSum
(
mallShoppingCartList
.
stream
()
.
map
(
MallShoppingCart:
:
getNum
)
...
...
src/main/java/com/gogirl/application/user/investigation/impl/BaseQuestionServiceImpl.java
View file @
8e265172
...
...
@@ -75,7 +75,6 @@ public class BaseQuestionServiceImpl extends ServiceImpl<BaseQuestionMapper, Bas
complaintMainService
.
saveComplainsByOrderQuestion
(
list
);
Coupon
coupon
=
couponService
.
getOne
(
new
LambdaQueryWrapper
<
Coupon
>().
eq
(
Coupon:
:
getName
,
"问卷调查礼券"
));
if
(
coupon
!=
null
)
{
couponService
.
sendCoupon
(
coupon
.
getId
(),
currentCustomerId
);
...
...
src/main/java/com/gogirl/assembler/MallProductDTOAssembler.java
0 → 100644
View file @
8e265172
package
com
.
gogirl
.
assembler
;
import
com.gogirl.domain.product.mall.MallProduct
;
import
com.gogirl.shared.product.query.dto.MallProductDTO
;
import
lombok.AllArgsConstructor
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Component
;
import
java.util.function.Function
;
@Component
@AllArgsConstructor
public
class
MallProductDTOAssembler
implements
Function
<
MallProduct
,
MallProductDTO
>
{
private
final
MallShoppingCartDTOAssembler
.
PurchaseSkuDTOAssembler
purchaseSkuDTOAssembler
;
@Override
public
MallProductDTO
apply
(
MallProduct
mallProduct
)
{
MallProductDTO
mallProductDTO
=
new
MallProductDTO
();
BeanUtils
.
copyProperties
(
mallProduct
,
mallProductDTO
);
return
mallProductDTO
;
}
}
src/main/java/com/gogirl/assembler/MallShoppingCartDTOAssembler.java
0 → 100644
View file @
8e265172
package
com
.
gogirl
.
assembler
;
import
com.gogirl.domain.order.mall.MallShoppingCart
;
import
com.gogirl.domain.product.purchase.PurchaseSku
;
import
com.gogirl.shared.product.query.dto.MallShoppingCartDTO
;
import
com.gogirl.shared.product.query.dto.PurchaseSkuDTO
;
import
lombok.AllArgsConstructor
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Component
;
import
java.util.function.Function
;
@Component
@AllArgsConstructor
public
class
MallShoppingCartDTOAssembler
implements
Function
<
MallShoppingCart
,
MallShoppingCartDTO
>
{
private
final
MallProductDTOAssembler
mallProductDTOAssembler
;
@Override
public
MallShoppingCartDTO
apply
(
MallShoppingCart
mallShoppingCart
)
{
MallShoppingCartDTO
mallShoppingCartDTO
=
new
MallShoppingCartDTO
();
BeanUtils
.
copyProperties
(
mallShoppingCart
,
mallShoppingCartDTO
);
if
(
mallShoppingCart
.
getMallProduct
()
!=
null
)
{
mallShoppingCartDTO
.
setMallProductDTO
(
mallProductDTOAssembler
.
apply
(
mallShoppingCart
.
getMallProduct
()));
}
return
mallShoppingCartDTO
;
}
@Component
static
class
PurchaseSkuDTOAssembler
implements
Function
<
PurchaseSku
,
PurchaseSkuDTO
>
{
@Override
public
PurchaseSkuDTO
apply
(
PurchaseSku
purchaseSku
)
{
PurchaseSkuDTO
purchaseSkuDTO
=
new
PurchaseSkuDTO
();
BeanUtils
.
copyProperties
(
purchaseSku
,
purchaseSkuDTO
);
return
purchaseSkuDTO
;
}
}
}
src/main/java/com/gogirl/domain/market/coupon/Coupon.java
View file @
8e265172
package
com
.
gogirl
.
domain
.
market
.
coupon
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
...
@@ -69,4 +70,7 @@ public class Coupon {
@ApiModelProperty
(
"1-计算 2-不计算"
)
private
Integer
isCalcAchievement
;
@TableField
(
exist
=
false
)
private
Integer
canBeUse
;
}
src/main/java/com/gogirl/domain/market/coupon/CouponCustomerRelevance.java
View file @
8e265172
...
...
@@ -31,6 +31,7 @@ public class CouponCustomerRelevance implements Serializable {
private
Integer
id
;
@ApiModelProperty
(
"顾客Id"
)
private
Integer
customerId
;
@ApiModelProperty
(
"卡券id"
)
private
Integer
couponId
;
...
...
@@ -39,43 +40,66 @@ public class CouponCustomerRelevance implements Serializable {
@ApiModelProperty
(
"领奖码"
)
private
String
code
;
@ApiModelProperty
(
"领券时间"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
receiveTime
;
@ApiModelProperty
(
"可用开始日期"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
validStartTime
;
@ApiModelProperty
(
"可用截止日期"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
validEndTime
;
@ApiModelProperty
(
"使用日期"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
useDate
;
//冗余coupon字段
@ApiModelProperty
(
"卡券配置备注"
)
private
String
remark
;
@ApiModelProperty
(
"能否使用"
)
@TableField
(
exist
=
false
)
private
Boolean
canBeUse
;
@TableField
(
exist
=
false
)
private
Coupon
coupon
;
@TableField
(
exist
=
false
)
private
Customer
customer
;
@ApiModelProperty
(
"卡券名称"
)
private
String
couponName
;
@ApiModelProperty
(
"优惠金额"
)
private
BigDecimal
discountAmount
;
@ApiModelProperty
(
"满这个金额才能减"
)
private
BigDecimal
reachingAmount
;
@ApiModelProperty
(
"优惠折扣"
)
private
BigDecimal
discountPercent
;
@ApiModelProperty
(
"优惠券类型:1.现金抵扣券;2.免单券;3满减券;4卸甲券"
)
private
Integer
type
;
@ApiModelProperty
(
"0 = 内部券 1 = 外部券"
)
private
Integer
sourceType
;
@ApiModelProperty
(
"使用条件:1.重叠使用"
)
private
String
condition1
;
@ApiModelProperty
(
"客户购买该券时,实际支付的金额(用该金额算业绩)"
)
private
BigDecimal
payAmount
;
@ApiModelProperty
(
"卡券来源"
)
private
String
sourceFrom
;
@ApiModelProperty
(
"卡券来源id"
)
...
...
src/main/java/com/gogirl/domain/market/timescard/TimesCardCustomerRelevance.java
View file @
8e265172
...
...
@@ -74,6 +74,9 @@ public class TimesCardCustomerRelevance {
//状态-已过期
public
static
Integer
STATUS_OVER_TIME
=
3
;
@TableField
(
exist
=
false
)
private
Boolean
canBeUse
;
/**
* 次卡是否可用
*
...
...
@@ -83,4 +86,5 @@ public class TimesCardCustomerRelevance {
return
validStartTime
.
getTime
()
<
System
.
currentTimeMillis
()
&&
validEndTime
.
getTime
()
>
System
.
currentTimeMillis
();
}
}
src/main/java/com/gogirl/domain/order/mall/MallShoppingCart.java
View file @
8e265172
package
com
.
gogirl
.
domain
.
order
.
mall
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.databind.ser.std.ToStringSerializer
;
import
com.gogirl.domain.product.mall.MallProduct
;
import
com.gogirl.domain.product.purchase.PurchaseSku
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -37,4 +39,8 @@ public class MallShoppingCart {
private
Long
lastUpdateTime
;
@TableField
(
exist
=
false
)
private
MallProduct
mallProduct
;
}
src/main/java/com/gogirl/interfaces/user/TimesCardController.java
View file @
8e265172
...
...
@@ -20,6 +20,7 @@ import com.gogirl.infrastructure.common.exception.RRException;
import
com.gogirl.infrastructure.common.util.ListUtil
;
import
com.gogirl.infrastructure.config.GogirlProperties
;
import
com.gogirl.infrastructure.feign.wx.WxPayControllerFeign
;
import
com.gogirl.infrastructure.mapper.market.discount.DiscountConfigMapper
;
import
com.gogirl.infrastructure.mapper.market.timescard.TimesCardCustomerRelevanceMapper
;
import
com.gogirl.infrastructure.mapper.market.timescard.TimesCardTypeContentMapper
;
import
com.gogirl.infrastructure.mapper.market.timescard.TimesCardTypeMapper
;
...
...
@@ -150,6 +151,8 @@ public class TimesCardController {
return
JsonResult
.
success
(
timesCardCustomerRelevance
);
}
private
final
DiscountConfigMapper
discountConfigMapper
;
@ApiOperation
(
value
=
"根据订单号查询我的可用的次卡"
)
@GetMapping
(
"/customer/timescard/getMyTimesCardByOrderId"
)
public
JsonResult
<
List
<
TimesCardCustomerRelevance
>>
getMyTimesCardByOrderId
(
@RequestHeader
String
token
,
...
...
@@ -169,10 +172,24 @@ public class TimesCardController {
//次卡可以作用的服务
List
<
Integer
>
canUserServeIds
=
timesCardCustomerRelevanceMapper
.
queryTimesCardServeIds
(
timesCardCustomerRelevance
.
getCardTypeId
());
//可用服务与当前服务交集
canUserServeIds
.
retainAll
(
orderServeList
.
stream
().
map
(
OrderServe:
:
getServeId
).
collect
(
Collectors
.
toList
()));
canUserServeIds
.
retainAll
(
orderServeList
.
stream
()
.
map
(
OrderServe:
:
getServeId
)
.
collect
(
Collectors
.
toList
()));
//不为空
return
ListUtil
.
isNotEmpty
(
canUserServeIds
);
})
.
peek
(
timesCardCustomerRelevance
->
{
List
<
Integer
>
canUserServeIds
=
timesCardCustomerRelevanceMapper
.
queryTimesCardServeIds
(
timesCardCustomerRelevance
.
getCardTypeId
());
canUserServeIds
.
retainAll
(
orderServeList
.
stream
()
.
filter
(
orderServe
->
orderServe
.
getBindCoupon
()
==
2
)
.
filter
(
orderServe
->
orderServe
.
getProduceCurrentPrice
().
compareTo
(
orderServe
.
getProduceBargainPrice
())
>
-
1
)
.
filter
(
orderServe
->
orderServe
.
getProducePromotionTimeId
()
==
null
)
.
filter
(
orderServe
->
orderServe
.
getLeisureDiscountConfigId
()
==
null
||
orderServe
.
getLeisureDiscountConfigId
()
==
0
)
.
map
(
OrderServe:
:
getServeId
)
.
collect
(
Collectors
.
toList
()));
timesCardCustomerRelevance
.
setCanBeUse
(
ListUtil
.
isNotEmpty
(
canUserServeIds
));
})
.
collect
(
Collectors
.
toList
());
return
JsonResult
.
success
(
timesCardCustomerRelevanceList
);
}
...
...
src/main/java/com/gogirl/shared/order/serve/query/dto/ordermanage/OrderServeDTO.java
View file @
8e265172
...
...
@@ -108,4 +108,6 @@ public class OrderServeDTO {
private
Integer
actualServeDuration
;
private
Integer
bindCoupon
;
}
src/main/java/com/gogirl/shared/product/query/dto/MyMallShoppingCartDTO.java
View file @
8e265172
...
...
@@ -14,5 +14,5 @@ public class MyMallShoppingCartDTO {
private
Integer
itemSum
;
private
List
<
MallShoppingCart
>
mallShoppingCartDTOList
;
private
List
<
MallShoppingCart
DTO
>
mallShoppingCartDTOList
;
}
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