Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
Z
zion
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
zion
Commits
5212e546
提交
5212e546
authored
10月 29, 2019
作者:
梁业锦
💬
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
5f8ad000
3b7f97ca
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
94 行增加
和
50 行删除
+94
-50
TbCfOrderController.java
...aoyun/zion/chinafrica/controller/TbCfOrderController.java
+4
-4
TbCfIssueCouponDao.java
...a/com/diaoyun/zion/chinafrica/dao/TbCfIssueCouponDao.java
+2
-0
TbCfOrderDao.java
...in/java/com/diaoyun/zion/chinafrica/dao/TbCfOrderDao.java
+1
-0
TbCfCouponEntity.java
.../com/diaoyun/zion/chinafrica/entity/TbCfCouponEntity.java
+13
-1
TbCfIssueCouponEntity.java
...diaoyun/zion/chinafrica/entity/TbCfIssueCouponEntity.java
+6
-8
TbCfOrderService.java
...com/diaoyun/zion/chinafrica/service/TbCfOrderService.java
+2
-2
TbCfOrderServiceImpl.java
...un/zion/chinafrica/service/impl/TbCfOrderServiceImpl.java
+50
-26
TbCfUserInfoServiceImpl.java
...zion/chinafrica/service/impl/TbCfUserInfoServiceImpl.java
+5
-4
TbCfCouponDao.xml
src/main/resources/mapper/TbCfCouponDao.xml
+7
-3
TbCfOrderDao.xml
src/main/resources/mapper/TbCfOrderDao.xml
+3
-1
ZionApplicationTests.java
src/test/java/com/diaoyun/zion/ZionApplicationTests.java
+1
-1
没有找到文件。
src/main/java/com/diaoyun/zion/chinafrica/controller/TbCfOrderController.java
浏览文件 @
5212e546
...
@@ -31,14 +31,14 @@ public class TbCfOrderController {
...
@@ -31,14 +31,14 @@ public class TbCfOrderController {
@ApiOperation
(
"用户结算,返回订单"
)
@ApiOperation
(
"用户结算,返回订单"
)
@GetMapping
(
"/settle"
)
@GetMapping
(
"/settle"
)
public
Result
<
TbCfOrderVo
>
settleAccount
()
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
public
Result
<
TbCfOrderVo
>
settleAccount
(
@ApiParam
(
"发放ID"
)
@RequestParam
(
value
=
"iss_coupon_id"
,
required
=
false
)
String
iss_coupon_id
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
return
tbCfOrderService
.
settleAccount
();
return
tbCfOrderService
.
settleAccount
(
iss_coupon_id
);
}
}
@ApiOperation
(
"用户确定下单"
)
@ApiOperation
(
"用户确定下单"
)
@PostMapping
(
"/place"
)
@PostMapping
(
"/place"
)
public
Result
placeOrder
(
@ApiParam
(
"订单详情"
)
@RequestBody
TbCfOrderVo
tbCfOrderVo
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
public
Result
placeOrder
(
@ApiParam
(
"订单详情"
)
@RequestBody
TbCfOrderVo
tbCfOrderVo
,
@ApiParam
(
"发放ID"
)
@RequestParam
(
value
=
"iss_coupon_id"
,
required
=
false
)
String
iss_coupon_id
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
return
tbCfOrderService
.
placeOrder
(
tbCfOrderVo
);
return
tbCfOrderService
.
placeOrder
(
tbCfOrderVo
,
iss_coupon_id
);
}
}
/**
/**
...
...
src/main/java/com/diaoyun/zion/chinafrica/dao/TbCfIssueCouponDao.java
浏览文件 @
5212e546
...
@@ -15,5 +15,7 @@ import java.util.List;
...
@@ -15,5 +15,7 @@ import java.util.List;
public
interface
TbCfIssueCouponDao
extends
BaseDao
<
TbCfIssueCouponEntity
>
{
public
interface
TbCfIssueCouponDao
extends
BaseDao
<
TbCfIssueCouponEntity
>
{
List
<
TbCfIssueCouponEntityExtends
>
queryCouponByUserId
(
String
userId
);
List
<
TbCfIssueCouponEntityExtends
>
queryCouponByUserId
(
String
userId
);
int
changeCouponStatus
(
String
userId
,
String
couponId
);
int
changeCouponStatus
(
String
userId
,
String
couponId
);
}
}
src/main/java/com/diaoyun/zion/chinafrica/dao/TbCfOrderDao.java
浏览文件 @
5212e546
...
@@ -47,4 +47,5 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
...
@@ -47,4 +47,5 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
List
<
TbCfItemShippedEntity
>
getDeliveryList
(
Date
beginDate
,
Date
endDate
);
List
<
TbCfItemShippedEntity
>
getDeliveryList
(
Date
beginDate
,
Date
endDate
);
OrderEntity
getOrder
(
String
orderId
);
OrderEntity
getOrder
(
String
orderId
);
TbCfCouponEntity
queryCouponPrice
(
String
iss_coupon_id
);
}
}
src/main/java/com/diaoyun/zion/chinafrica/entity/TbCfCouponEntity.java
浏览文件 @
5212e546
...
@@ -17,7 +17,11 @@ import java.util.Date;
...
@@ -17,7 +17,11 @@ import java.util.Date;
@ApiModel
@ApiModel
public
class
TbCfCouponEntity
implements
Serializable
{
public
class
TbCfCouponEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/**
*优惠券发放表id
*/
@ApiModelProperty
(
"优惠券发放表id"
)
private
String
issCouponId
;
/**
/**
* 优惠券id
* 优惠券id
*/
*/
...
@@ -411,4 +415,12 @@ public class TbCfCouponEntity implements Serializable {
...
@@ -411,4 +415,12 @@ public class TbCfCouponEntity implements Serializable {
public
Date
getUpdateTime
()
{
public
Date
getUpdateTime
()
{
return
updateTime
;
return
updateTime
;
}
}
public
String
getIssCouponId
()
{
return
issCouponId
;
}
public
void
setIssCouponId
(
String
issCouponId
)
{
this
.
issCouponId
=
issCouponId
;
}
}
}
src/main/java/com/diaoyun/zion/chinafrica/entity/TbCfIssueCouponEntity.java
浏览文件 @
5212e546
...
@@ -16,7 +16,7 @@ public class TbCfIssueCouponEntity implements Serializable {
...
@@ -16,7 +16,7 @@ public class TbCfIssueCouponEntity implements Serializable {
/**
/**
* 发放表id
* 发放表id
*/
*/
private
String
couponIssuetableI
d
;
private
String
iss_coupon_i
d
;
/**
/**
* 优惠券id
* 优惠券id
*/
*/
...
@@ -47,16 +47,14 @@ public class TbCfIssueCouponEntity implements Serializable {
...
@@ -47,16 +47,14 @@ public class TbCfIssueCouponEntity implements Serializable {
/**
/**
* 设置:发放表id
* 设置:发放表id
*/
*/
public
void
setCouponIssuetableId
(
String
couponIssuetableId
)
{
public
String
getIss_coupon_id
(
)
{
this
.
couponIssuetableId
=
couponIssuetableI
d
;
return
iss_coupon_i
d
;
}
}
/**
public
void
setIss_coupon_id
(
String
iss_coupon_id
)
{
* 获取:发放表id
this
.
iss_coupon_id
=
iss_coupon_id
;
*/
public
String
getCouponIssuetableId
()
{
return
couponIssuetableId
;
}
}
/**
/**
* 设置:优惠券id
* 设置:优惠券id
*/
*/
...
...
src/main/java/com/diaoyun/zion/chinafrica/service/TbCfOrderService.java
浏览文件 @
5212e546
...
@@ -81,7 +81,7 @@ public interface TbCfOrderService {
...
@@ -81,7 +81,7 @@ public interface TbCfOrderService {
*
*
* @return
* @return
*/
*/
Result
settleAccount
()
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
;
Result
settleAccount
(
String
iss_coupon_id
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
;
/**
/**
* 用户下单
* 用户下单
...
@@ -89,7 +89,7 @@ public interface TbCfOrderService {
...
@@ -89,7 +89,7 @@ public interface TbCfOrderService {
* @param tbCfOrderVo
* @param tbCfOrderVo
* @return
* @return
*/
*/
Result
placeOrder
(
TbCfOrderVo
tbCfOrderVo
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
;
Result
placeOrder
(
TbCfOrderVo
tbCfOrderVo
,
String
iss_coupon_id
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
;
/**
/**
* 获取用户订单列表
* 获取用户订单列表
...
...
src/main/java/com/diaoyun/zion/chinafrica/service/impl/TbCfOrderServiceImpl.java
浏览文件 @
5212e546
...
@@ -7,10 +7,7 @@ import com.diaoyun.zion.chinafrica.entity.*;
...
@@ -7,10 +7,7 @@ import com.diaoyun.zion.chinafrica.entity.*;
import
com.diaoyun.zion.chinafrica.enums.CouponCategoryEnum
;
import
com.diaoyun.zion.chinafrica.enums.CouponCategoryEnum
;
import
com.diaoyun.zion.chinafrica.enums.DeliveryStatusEnum
;
import
com.diaoyun.zion.chinafrica.enums.DeliveryStatusEnum
;
import
com.diaoyun.zion.chinafrica.enums.OrderStatusEnum
;
import
com.diaoyun.zion.chinafrica.enums.OrderStatusEnum
;
import
com.diaoyun.zion.chinafrica.service.SpiderService
;
import
com.diaoyun.zion.chinafrica.service.*
;
import
com.diaoyun.zion.chinafrica.service.TbCfCouponService
;
import
com.diaoyun.zion.chinafrica.service.TbCfFeeService
;
import
com.diaoyun.zion.chinafrica.service.TbCfOrderService
;
import
com.diaoyun.zion.chinafrica.vo.TbCfCartItemDetailVo
;
import
com.diaoyun.zion.chinafrica.vo.TbCfCartItemDetailVo
;
import
com.diaoyun.zion.chinafrica.vo.TbCfFinanceVo
;
import
com.diaoyun.zion.chinafrica.vo.TbCfFinanceVo
;
import
com.diaoyun.zion.chinafrica.vo.TbCfOrderVo
;
import
com.diaoyun.zion.chinafrica.vo.TbCfOrderVo
;
...
@@ -103,6 +100,8 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -103,6 +100,8 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
@Autowired
@Autowired
private
HttpServletRequest
request
;
//自动注入request
private
HttpServletRequest
request
;
//自动注入request
@Autowired
private
TbCfIssueCouponService
tbCfIssueCouponService
;
//发放表
@Override
@Override
public
TbCfOrderEntity
queryObject
(
String
orderId
)
{
public
TbCfOrderEntity
queryObject
(
String
orderId
)
{
...
@@ -140,27 +139,36 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -140,27 +139,36 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
return
tbCfOrderDao
.
deleteBatch
(
orderIds
);
return
tbCfOrderDao
.
deleteBatch
(
orderIds
);
}
}
@Override
/**
public
Result
settleAccount
()
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
* 用户计算1
* @param iss_coupon_id
* @return
* @throws IOException
* @throws URISyntaxException
* @throws ExecutionException
* @throws InterruptedException
* @throws TimeoutException
*/
@Override
public
Result
settleAccount
(
String
iss_coupon_id
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
Result
<
TbCfOrderVo
>
result
=
new
Result
<>();
Result
<
TbCfOrderVo
>
result
=
new
Result
<>();
//获取用户
//获取用户
String
token
=
jwtTokenProvider
.
resolveToken
(
request
);
String
token
=
jwtTokenProvider
.
resolveToken
(
request
);
TbCfUserInfoVo
tbCfUserInfoVo
=
tokenManager
.
validate
(
token
);
TbCfUserInfoVo
tbCfUserInfoVo
=
tokenManager
.
validate
(
token
);
//获取购物车已勾选 商品
//获取购物车已勾选 商品
List
<
TbCfCartItemDetailVo
>
tbCfCartItemDetailList
=
tbCfItemDetailDao
.
getCartItemList
(
tbCfUserInfoVo
.
getUserId
(),
StateConstant
.
VALID
);
List
<
TbCfCartItemDetailVo
>
tbCfCartItemDetailList
=
tbCfItemDetailDao
.
getCartItemList
(
tbCfUserInfoVo
.
getUserId
(),
StateConstant
.
VALID
);
if
(
tbCfCartItemDetailList
.
isEmpty
())
{
if
(
tbCfCartItemDetailList
.
isEmpty
())
{
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
()).
setMessage
(
"There are no items in the shopping cart"
);
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
()).
setMessage
(
"There are no items in the shopping cart"
);
}
else
{
}
else
{
//获取订单数据
//获取订单数据
TbCfOrderVo
tbCfOrder
=
getOrderData
(
tbCfUserInfoVo
,
tbCfCartItemDetailList
);
TbCfOrderVo
tbCfOrder
=
getOrderData
(
tbCfUserInfoVo
,
tbCfCartItemDetailList
,
iss_coupon_id
);
result
.
setData
(
tbCfOrder
).
setMessage
(
"Order pending settlement"
);
result
.
setData
(
tbCfOrder
).
setMessage
(
"Order pending settlement"
);
}
}
return
result
;
return
result
;
}
}
@Override
@Override
public
Result
placeOrder
(
TbCfOrderVo
pageOrder
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
public
Result
placeOrder
(
TbCfOrderVo
pageOrder
,
String
iss_coupon_id
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
Result
<
TbCfOrderVo
>
result
=
new
Result
<>();
Result
<
TbCfOrderVo
>
result
=
new
Result
<>();
//获取用户
//获取用户
String
token
=
jwtTokenProvider
.
resolveToken
(
request
);
String
token
=
jwtTokenProvider
.
resolveToken
(
request
);
...
@@ -172,7 +180,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -172,7 +180,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
()).
setMessage
(
"There are no items in the shopping cart"
);
result
.
setCode
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
()).
setMessage
(
"There are no items in the shopping cart"
);
}
else
{
}
else
{
//获取下单的订单数据
//获取下单的订单数据
TbCfOrderVo
definiteOrder
=
ensureOrder
(
tbCfUserInfoVo
,
pageOrder
,
tbCfCartItemDetailList
);
TbCfOrderVo
definiteOrder
=
ensureOrder
(
tbCfUserInfoVo
,
pageOrder
,
tbCfCartItemDetailList
,
iss_coupon_id
);
//持久化订单数据
//持久化订单数据
TbCfOrderEntity
tbCfOrderEntity
=
new
TbCfOrderEntity
();
TbCfOrderEntity
tbCfOrderEntity
=
new
TbCfOrderEntity
();
BeanUtils
.
copyProperties
(
definiteOrder
,
tbCfOrderEntity
);
BeanUtils
.
copyProperties
(
definiteOrder
,
tbCfOrderEntity
);
...
@@ -267,7 +275,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -267,7 +275,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
TbCfFinanceEntity
tbCfFinance
=
createFinance
(
charge
,
tbCfOrderVo
);
TbCfFinanceEntity
tbCfFinance
=
createFinance
(
charge
,
tbCfOrderVo
);
TbCfFinanceVo
tbCfFinanceVo
=
new
TbCfFinanceVo
();
TbCfFinanceVo
tbCfFinanceVo
=
new
TbCfFinanceVo
();
BeanUtils
.
copyProperties
(
tbCfFinance
,
tbCfFinanceVo
);
BeanUtils
.
copyProperties
(
tbCfFinance
,
tbCfFinanceVo
);
//赠送购物返券
/*
//赠送购物返券
List<TbCfCouponEntity> couponList = tbCfCouponDao.getCouponByCategory(CouponCategoryEnum.SHOP.getValue(), new Date());
List<TbCfCouponEntity> couponList = tbCfCouponDao.getCouponByCategory(CouponCategoryEnum.SHOP.getValue(), new Date());
if (!couponList.isEmpty()) {
if (!couponList.isEmpty()) {
//领取优惠券
//领取优惠券
...
@@ -275,7 +283,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -275,7 +283,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
if (couponResult.getCode() == ResultCodeEnum.SUCCESS.getCode()) {
if (couponResult.getCode() == ResultCodeEnum.SUCCESS.getCode()) {
tbCfFinanceVo.setCouponId(couponList.get(0).getCouponId());
tbCfFinanceVo.setCouponId(couponList.get(0).getCouponId());
}
}
}
}
*/
result
.
setData
(
tbCfFinanceVo
);
result
.
setData
(
tbCfFinanceVo
);
}
else
{
}
else
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
"Payment failed!"
);
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
()).
setMessage
(
"Payment failed!"
);
...
@@ -510,7 +518,6 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -510,7 +518,6 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
* @param couponId
* @param couponId
*/
*/
private
void
couponUse
(
String
userId
,
String
couponId
)
{
private
void
couponUse
(
String
userId
,
String
couponId
)
{
//更新领取记录已领取
//更新领取记录已领取
int
res
=
tbCfTakeCouponDao
.
updateEnableFlag
(
userId
,
couponId
,
StateConstant
.
INVALID
);
int
res
=
tbCfTakeCouponDao
.
updateEnableFlag
(
userId
,
couponId
,
StateConstant
.
INVALID
);
if
(
res
<
1
)
{
if
(
res
<
1
)
{
...
@@ -572,9 +579,9 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -572,9 +579,9 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
* @throws IOException
* @throws IOException
* @throws URISyntaxException
* @throws URISyntaxException
*/
*/
private
TbCfOrderVo
ensureOrder
(
TbCfUserInfoVo
tbCfUserInfoVo
,
TbCfOrderVo
pageOrder
,
List
<
TbCfCartItemDetailVo
>
tbCfCartItemDetailList
)
{
private
TbCfOrderVo
ensureOrder
(
TbCfUserInfoVo
tbCfUserInfoVo
,
TbCfOrderVo
pageOrder
,
List
<
TbCfCartItemDetailVo
>
tbCfCartItemDetailList
,
String
iss_coupon_id
)
{
TbCfOrderVo
definiteOrder
=
getGenericOrder
(
tbCfCartItemDetailList
);
TbCfOrderVo
definiteOrder
=
getGenericOrder
(
tbCfCartItemDetailList
);
//获取可以使用的优惠券,后续还有判断此订单是否可以使用
/
*/
/获取可以使用的优惠券,后续还有判断此订单是否可以使用
List<TbCfCouponEntity> tbCfCouponList = tbCfCouponDao.queryUserAvailableCoupon(tbCfUserInfoVo.getUserId(), new Date());
List<TbCfCouponEntity> tbCfCouponList = tbCfCouponDao.queryUserAvailableCoupon(tbCfUserInfoVo.getUserId(), new Date());
if (!tbCfCouponList.isEmpty()) {
if (!tbCfCouponList.isEmpty()) {
//分开可使用和不可使用优惠券
//分开可使用和不可使用优惠券
...
@@ -590,10 +597,10 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -590,10 +597,10 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
definiteOrder.setCouponPrice(usableCoupon.getDeductAmount());
definiteOrder.setCouponPrice(usableCoupon.getDeductAmount());
}
}
}
}
}
}
*/
//计算实际需要付款
//计算实际需要付款
countRealityPay
(
definiteOrder
);
countRealityPay
(
definiteOrder
,
iss_coupon_id
);
//获取订单地址
//获取订单地址
String
deliveryAddressId
=
pageOrder
.
getDeliveryAddressId
();
String
deliveryAddressId
=
pageOrder
.
getDeliveryAddressId
();
Validator
.
NOT_BLANK
.
validate
(
"address"
,
deliveryAddressId
);
Validator
.
NOT_BLANK
.
validate
(
"address"
,
deliveryAddressId
);
...
@@ -687,23 +694,34 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -687,23 +694,34 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
return
result
;
return
result
;
}
}
/**
private
TbCfOrderVo
getOrderData
(
TbCfUserInfoVo
tbCfUserInfoVo
,
List
<
TbCfCartItemDetailVo
>
tbCfCartItemDetailList
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
* 用户计算价格2
* @param tbCfUserInfoVo
* @param tbCfCartItemDetailList
* @param iss_coupon_id
* @return
* @throws IOException
* @throws URISyntaxException
* @throws ExecutionException
* @throws InterruptedException
* @throws TimeoutException
*/
private
TbCfOrderVo
getOrderData
(
TbCfUserInfoVo
tbCfUserInfoVo
,
List
<
TbCfCartItemDetailVo
>
tbCfCartItemDetailList
,
String
iss_coupon_id
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
TbCfOrderVo
tbCfOrder
=
getGenericOrder
(
tbCfCartItemDetailList
);
TbCfOrderVo
tbCfOrder
=
getGenericOrder
(
tbCfCartItemDetailList
);
//获取可以使用的优惠券,后续还有判断此订单是否可以使用
/*
//获取可以使用的优惠券,后续还有判断此订单是否可以使用
List
<
TbCfCouponEntity
>
tbCfCouponList
=
tbCfCouponDao
.
queryUserAvailableCoupon
(
tbCfUserInfoVo
.
getUserId
(),
new
Date
());
List<TbCfCouponEntity> tbCfCouponList = tbCfCouponDao.queryUserAvailableCoupon(tbCfUserInfoVo.getUserId(), new Date());
if (!tbCfCouponList.isEmpty()) {
if (!tbCfCouponList.isEmpty()) {
//分开可使用和不可使用优惠券
//分开可使用和不可使用优惠券
separateCoupon(tbCfOrder, tbCfCouponList);
separateCoupon(tbCfOrder, tbCfCouponList);
if (!tbCfOrder.getUsableCouponList().isEmpty()) {
if (!tbCfOrder.getUsableCouponList().isEmpty()) {
//设置默认的优惠券
//设置默认的优惠券
setDefaultCoupon
(
tbCfOrder
);
setDefaultCoupon(tbCfOrder);
}
}
}
}
*/
//计算实际需要付款
//计算实际需要付款
countRealityPay
(
tbCfOrder
);
countRealityPay
(
tbCfOrder
,
iss_coupon_id
);
tbCfOrder
.
setUserId
(
tbCfUserInfoVo
.
getUserId
());
tbCfOrder
.
setUserId
(
tbCfUserInfoVo
.
getUserId
());
tbCfOrder
.
setUserName
(
tbCfUserInfoVo
.
getNick
());
tbCfOrder
.
setUserName
(
tbCfUserInfoVo
.
getNick
());
...
@@ -715,7 +733,13 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -715,7 +733,13 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
*
*
* @param tbCfOrder
* @param tbCfOrder
*/
*/
private
void
countRealityPay
(
TbCfOrderVo
tbCfOrder
)
{
private
void
countRealityPay
(
TbCfOrderVo
tbCfOrder
,
String
iss_coupon_id
)
{
if
(
iss_coupon_id
!=
null
){
TbCfIssueCouponEntity
coupon
=
tbCfIssueCouponService
.
queryObject
(
iss_coupon_id
);
TbCfCouponEntity
couponEntity
=
tbCfOrderDao
.
queryCouponPrice
(
iss_coupon_id
);
tbCfOrder
.
setCouponPrice
(
couponEntity
.
getDeductAmount
());
}
BigDecimal
couponPrice
=
tbCfOrder
.
getCouponPrice
();
BigDecimal
couponPrice
=
tbCfOrder
.
getCouponPrice
();
//实际需要支付款项
//实际需要支付款项
if
(
couponPrice
!=
null
)
{
if
(
couponPrice
!=
null
)
{
...
@@ -731,7 +755,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
...
@@ -731,7 +755,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
}
}
/**
/**
* 分开可使用和不可使用优惠券
* 分开可使用和不可使用优惠券
(暂时没用)
*
*
* @param tbCfOrder
* @param tbCfOrder
* @param tbCfCouponList
* @param tbCfCouponList
...
...
src/main/java/com/diaoyun/zion/chinafrica/service/impl/TbCfUserInfoServiceImpl.java
浏览文件 @
5212e546
...
@@ -161,8 +161,8 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
...
@@ -161,8 +161,8 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
String
userid
=
IdUtil
.
createIdbyUUID
();
String
userid
=
IdUtil
.
createIdbyUUID
();
tbCfUserInfoVo
.
setUserId
(
userid
);
tbCfUserInfoVo
.
setUserId
(
userid
);
//用户姓名
//用户姓名
String
avatar
=
domainProperties
.
getProperty
(
"user.avatar
"
);
String
nick
=
domainProperties
.
getProperty
(
"user.nick
"
);
tbCfUserInfoVo
.
set
Avatar
(
avatar
);
tbCfUserInfoVo
.
set
Nick
(
nick
);
fillUserNecessayInfo
(
tbCfUserInfoVo
);
fillUserNecessayInfo
(
tbCfUserInfoVo
);
//加密密码
//加密密码
String
password
=
passwordEncoder
.
encode
(
tbCfUserInfoVo
.
getPassword
());
String
password
=
passwordEncoder
.
encode
(
tbCfUserInfoVo
.
getPassword
());
...
@@ -180,10 +180,10 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
...
@@ -180,10 +180,10 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
String
issuseCoupon_id
=
IdUtil
.
createIdbyUUID
();
String
issuseCoupon_id
=
IdUtil
.
createIdbyUUID
();
//把上面获取到的值,赋值到实体类中
//把上面获取到的值,赋值到实体类中
issue
.
setCouponId
(
coupon_id
);
issue
.
setCouponId
(
coupon_id
);
issue
.
set
CouponIssuetabl
eId
(
issuseCoupon_id
);
issue
.
set
Issu
eId
(
issuseCoupon_id
);
issue
.
setCreateTime
(
date
);
issue
.
setCreateTime
(
date
);
issue
.
setUserId
(
userid
);
issue
.
setUserId
(
userid
);
issue
.
setNick
(
avatar
);
issue
.
setNick
(
nick
);
issue
.
setEnableFlag
(
0
);
issue
.
setEnableFlag
(
0
);
tbCfIssueCouponService
.
save
(
issue
);
tbCfIssueCouponService
.
save
(
issue
);
}
}
...
@@ -474,6 +474,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
...
@@ -474,6 +474,7 @@ public class TbCfUserInfoServiceImpl implements TbCfUserInfoService {
}
}
}*/
}*/
private
void
fillUserNecessayInfo
(
TbCfUserInfoVo
tbCfUserInfoVo
)
{
private
void
fillUserNecessayInfo
(
TbCfUserInfoVo
tbCfUserInfoVo
)
{
tbCfUserInfoVo
.
setAvatar
(
domainProperties
.
getProperty
(
"user.avatar"
));
tbCfUserInfoVo
.
setUserNo
(
IdUtil
.
createIdByDate
());
tbCfUserInfoVo
.
setUserNo
(
IdUtil
.
createIdByDate
());
tbCfUserInfoVo
.
setPhoneFlag
(
StateConstant
.
INVALID
);
tbCfUserInfoVo
.
setPhoneFlag
(
StateConstant
.
INVALID
);
tbCfUserInfoVo
.
setLoginCount
(
0
);
tbCfUserInfoVo
.
setLoginCount
(
0
);
...
...
src/main/resources/mapper/TbCfCouponDao.xml
浏览文件 @
5212e546
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
<result
property=
"updateUserId"
column=
"update_user_id"
/>
<result
property=
"updateUserId"
column=
"update_user_id"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"couponVaild"
column=
"coupon_vaild"
/>
<result
property=
"couponVaild"
column=
"coupon_vaild"
/>
<result
property=
"issCouponId"
column=
"coupon_issuetable_id"
/>
</resultMap>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
<select
id=
"queryObject"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
...
@@ -196,7 +197,8 @@
...
@@ -196,7 +197,8 @@
<!--查询用户所有有效的优惠券-->
<!--查询用户所有有效的优惠券-->
<select
id=
"queryUserAvailableCoupon"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
<select
id=
"queryUserAvailableCoupon"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
select DISTINCT
select
t3.coupon_issuetable_id issCouponId,
t2.coupon_id,
t2.coupon_id,
t2.coupon_category_id,
t2.coupon_category_id,
t4.coupon_category_name,
t4.coupon_category_name,
...
@@ -235,7 +237,8 @@
...
@@ -235,7 +237,8 @@
<!--获取已使用的优惠券-->
<!--获取已使用的优惠券-->
<select
id=
"queryUserUsedCoupon"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
<select
id=
"queryUserUsedCoupon"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
select DISTINCT
select
t3.coupon_issuetable_id issCouponId,
t2.coupon_id,
t2.coupon_id,
t2.coupon_category_id,
t2.coupon_category_id,
t4.coupon_category_name,
t4.coupon_category_name,
...
@@ -267,7 +270,8 @@
...
@@ -267,7 +270,8 @@
<!--获取已过期的优惠券-->
<!--获取已过期的优惠券-->
<select
id=
"queryUserExpiredoupon"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
<select
id=
"queryUserExpiredoupon"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
select DISTINCT
select
t3.coupon_issuetable_id issCouponId,
t2.coupon_id,
t2.coupon_id,
t2.coupon_category_id,
t2.coupon_category_id,
t4.coupon_category_name,
t4.coupon_category_name,
...
...
src/main/resources/mapper/TbCfOrderDao.xml
浏览文件 @
5212e546
...
@@ -136,7 +136,9 @@
...
@@ -136,7 +136,9 @@
AND name LIKE concat('%',#{name},'%')
AND name LIKE concat('%',#{name},'%')
</if>
</if>
</select>
</select>
<select
id=
"queryCouponPrice"
resultType=
"com.diaoyun.zion.chinafrica.entity.TbCfCouponEntity"
>
select t2.* from tb_cf_issue_coupon t1 left join tb_cf_coupon t2 on t2.coupon_id=t1.coupon_id where t1.coupon_issuetable_id=#{iss_coupon_id}
</select>
<insert
id=
"save"
parameterType=
"com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity"
>
<insert
id=
"save"
parameterType=
"com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity"
>
insert into tb_cf_order(
insert into tb_cf_order(
`order_id`,
`order_id`,
...
...
src/test/java/com/diaoyun/zion/ZionApplicationTests.java
浏览文件 @
5212e546
...
@@ -458,7 +458,7 @@ public class ZionApplicationTests {
...
@@ -458,7 +458,7 @@ public class ZionApplicationTests {
String
issuseCoupon_id
=
IdUtil
.
createIdbyUUID
();
String
issuseCoupon_id
=
IdUtil
.
createIdbyUUID
();
//把上面获取到的值,赋值到实体类中
//把上面获取到的值,赋值到实体类中
issue
.
setCouponId
(
"1087f4a682354843b145d36c27d2d902"
);
issue
.
setCouponId
(
"1087f4a682354843b145d36c27d2d902"
);
issue
.
set
CouponIssuetabl
eId
(
"5308312b76cd4819b7d94f01dea12ab8"
);
issue
.
set
Issu
eId
(
"5308312b76cd4819b7d94f01dea12ab8"
);
issue
.
setCreateTime
(
new
Date
().
toString
());
issue
.
setCreateTime
(
new
Date
().
toString
());
issue
.
setUserId
(
"5308312b76cd4819b7d94f01dea12ab8"
);
issue
.
setUserId
(
"5308312b76cd4819b7d94f01dea12ab8"
);
issue
.
setNick
(
"avatar"
);
issue
.
setNick
(
"avatar"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论