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
211d02cc
Commit
211d02cc
authored
Apr 07, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单详情接口修改
parent
862ac14a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
44 deletions
+65
-44
OrderManageServiceImpl.java
.../application/order/serve/impl/OrderManageServiceImpl.java
+16
-4
CustomerBalanceService.java
...irl/application/user/customer/CustomerBalanceService.java
+4
-4
CustomerBalanceServiceImpl.java
...cation/user/customer/impl/CustomerBalanceServiceImpl.java
+13
-4
RRExceptionHandler.java
...l/infrastructure/common/exception/RRExceptionHandler.java
+1
-1
Schedule.java
...ain/java/com/gogirl/infrastructure/schedule/Schedule.java
+4
-1
AESUtil.java
src/main/java/com/gogirl/infrastructure/util/AESUtil.java
+21
-28
Prefix.java
...main/java/com/gogirl/infrastructure/util/math/Prefix.java
+6
-2
No files found.
src/main/java/com/gogirl/application/order/serve/impl/OrderManageServiceImpl.java
View file @
211d02cc
...
...
@@ -1028,22 +1028,23 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
*/
private
OrderManage
aggregateOrderManage
(
OrderManage
orderManage
)
{
Integer
id
=
orderManage
.
getId
();
//1、订单详情
List
<
OrderServe
>
orderServeList
=
orderServeMapper
.
selectList
(
new
LambdaQueryWrapper
<
OrderServe
>().
eq
(
OrderServe:
:
getOrderId
,
id
));
orderManage
.
setListOrderServer
(
orderServeList
);
//2、订单关联的卡券
List
<
CouponCustomerRelevance
>
couponCustomerRelevanceList
=
couponCustomerRelevanceService
.
list
(
new
LambdaQueryWrapper
<
CouponCustomerRelevance
>().
eq
(
CouponCustomerRelevance:
:
getOrderId
,
id
)
);
orderManage
.
setCouponCustomerRelevanceList
(
couponCustomerRelevanceList
);
//3、订单关联的次卡
List
<
TimesCardUsedRecord
>
timesCardUsedRecordList
=
timesCardUsedRecordService
.
list
(
new
LambdaQueryWrapper
<
TimesCardUsedRecord
>().
eq
(
TimesCardUsedRecord:
:
getOrderId
,
id
)
);
orderManage
.
setCouponCustomerRelevanceList
(
couponCustomerRelevanceList
);
orderManage
.
setListTimesCardRecord
(
timesCardUsedRecordList
);
//4、订单服务关联的美甲师列表
orderManage
.
getListOrderServer
()
.
forEach
(
orderServe
->
{
List
<
String
>
ids
=
Lists
.
newArrayList
(
orderServe
.
getTechnicianId
().
split
(
","
));
...
...
@@ -1054,6 +1055,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
.
collect
(
Collectors
.
toList
()));
});
//订单服务实际时长计算
orderManage
.
getListOrderServer
().
forEach
(
orderServe
->
{
if
(
orderServe
.
getEndTime
()
!=
null
&&
orderServe
.
getStartTime
()
!=
null
)
{
orderServe
.
setActualServeDuration
((
int
)
(
orderServe
.
getEndTime
().
getTime
()
-
...
...
@@ -1061,8 +1063,18 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
}
});
//5、订单关联的预约
ScheduleManage
scheduleManage
=
scheduleManageMapper
.
selectById
(
orderManage
.
getScheduledId
());
orderManage
.
setScheduleManage
(
scheduleManage
);
//6、下单用户
Customer
customer
=
customerService
.
getById
(
orderManage
.
getOrderUser
());
orderManage
.
setCustomer
(
customer
);
//7、支付用户
Customer
payCustomer
=
customerService
.
getById
(
orderManage
.
getPayUser
());
orderManage
.
setPayCustomer
(
payCustomer
);
return
orderManage
;
}
}
...
...
src/main/java/com/gogirl/application/user/customer/CustomerBalanceService.java
View file @
211d02cc
...
...
@@ -27,10 +27,10 @@ public interface CustomerBalanceService extends IService<CustomerBalance> {
/**
* 查看消费记录
*
* @param customerId
* @param pageNum
* @param pageSize
* @return
* @param customerId
用户id
* @param pageNum
页码
* @param pageSize
分页长度
* @return
用户消费记录分页查询结果
*/
PageInfo
<
CustomerBalanceRecord
>
getBalanceRecordCard
(
Integer
customerId
,
int
pageNum
,
int
pageSize
);
}
src/main/java/com/gogirl/application/user/customer/impl/CustomerBalanceServiceImpl.java
View file @
211d02cc
...
...
@@ -8,6 +8,7 @@ import com.github.pagehelper.PageHelper;
import
com.github.pagehelper.PageInfo
;
import
com.gogirl.application.order.serve.OrderManageService
;
import
com.gogirl.application.user.customer.CustomerBalanceService
;
import
com.gogirl.domain.order.serve.OrderManage
;
import
com.gogirl.domain.store.store.StoreUser
;
import
com.gogirl.domain.user.customer.CustomerBalance
;
import
com.gogirl.domain.user.customer.CustomerBalanceRecord
;
...
...
@@ -15,6 +16,7 @@ import com.gogirl.infrastructure.common.exception.RRException;
import
com.gogirl.infrastructure.mapper.store.store.UserManageMapper
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMapper
;
import
com.gogirl.infrastructure.mapper.user.customer.CustomerMapper
;
import
com.gogirl.shared.user.command.ConsumerCommand
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
...
...
@@ -44,6 +46,9 @@ public class CustomerBalanceServiceImpl extends ServiceImpl<CustomerBalanceMappe
@Resource
private
OrderManageService
orderManageService
;
@Resource
CustomerMapper
customerMapper
;
@Override
public
CustomerBalance
getCustomerBalance
(
int
customerId
)
{
CustomerBalance
customerBalance
=
customerBalanceMapper
.
selectOne
(
new
LambdaQueryWrapper
<
CustomerBalance
>()
...
...
@@ -102,11 +107,17 @@ public class CustomerBalanceServiceImpl extends ServiceImpl<CustomerBalanceMappe
param
.
setCustomerId
(
customerId
);
PageHelper
.
startPage
(
pageNum
,
pageSize
);
//1、查询消费记录
List
<
CustomerBalanceRecord
>
list
=
balanceRecordDao
.
getBalanceRecordCard
(
customerId
);
//2、如果是预约订单消费,关联查询预约订单
list
.
stream
()
.
filter
(
balanceRecord
->
balanceRecord
.
getType
().
equals
(-
1
))
.
forEach
(
balanceRecord
->
{
balanceRecord
.
setOrderManage
(
orderManageService
.
queryOrder
(
Integer
.
valueOf
(
balanceRecord
.
getOrderId
())));
//消费记录关联的订单
OrderManage
orderManage
=
orderManageService
.
queryOrder
(
Integer
.
valueOf
(
balanceRecord
.
getOrderId
()));
balanceRecord
.
setOrderManage
(
orderManage
);
//deprecated
if
(
balanceRecord
.
getOrderAmount
()
!=
null
&&
balanceRecord
.
getOrderAmount
()
!=
0
&&
balanceRecord
.
getOrderManage
()
!=
null
)
{
balanceRecord
.
getOrderManage
().
setTotalPrice
(
new
BigDecimal
(
balanceRecord
.
getOrderAmount
()).
divide
(
new
BigDecimal
(
100
),
2
,
BigDecimal
.
ROUND_HALF_UP
));
}
...
...
@@ -133,8 +144,6 @@ public class CustomerBalanceServiceImpl extends ServiceImpl<CustomerBalanceMappe
}
}
PageInfo
<
CustomerBalanceRecord
>
pageInfo
=
new
PageInfo
<>(
list
);
return
pageInfo
;
return
new
PageInfo
<>(
list
);
}
}
src/main/java/com/gogirl/RRExceptionHandler.java
→
src/main/java/com/gogirl/
infrastructure/common/exception/
RRExceptionHandler.java
View file @
211d02cc
package
com
.
gogirl
;
package
com
.
gogirl
.
infrastructure
.
common
.
exception
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
...
...
src/main/java/com/gogirl/infrastructure/schedule/Schedule.java
View file @
211d02cc
...
...
@@ -598,7 +598,10 @@ public class Schedule {
private
final
GogirlProperties
gogirlProperties
;
private
OrderManageMapper
orderManageMapper
;
@Scheduled
(
cron
=
"0 0/1 * * * *"
)
/**
* 每30分钟一次评价提醒图推送
*/
@Scheduled
(
cron
=
"0 0/30 * * * *"
)
public
void
testPaper
()
{
log
.
info
(
"评价提醒推送"
);
Date
date
=
new
Date
(
System
.
currentTimeMillis
()
-
gogirlProperties
.
getTestPaperTime
()
*
60000L
);
...
...
src/main/java/com/gogirl/infrastructure/util/AES.java
→
src/main/java/com/gogirl/infrastructure/util/AES
Util
.java
View file @
211d02cc
...
...
@@ -2,20 +2,21 @@ package com.gogirl.infrastructure.util;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
javax.crypto.BadPaddingException
;
import
javax.crypto.Cipher
;
import
javax.crypto.IllegalBlockSizeException
;
import
javax.crypto.NoSuchPaddingException
;
import
javax.crypto.spec.IvParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.security.*
;
import
java.security.AlgorithmParameters
;
import
java.security.Key
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.Security
;
import
java.security.spec.InvalidParameterSpecException
;
/**
* AES加密
*
* @author liuyazhuang
*/
public
class
AES
{
public
class
AES
Util
{
public
static
boolean
initialized
=
false
;
...
...
@@ -26,8 +27,15 @@ public class AES {
initialized
=
true
;
}
// 生成iv
public
static
AlgorithmParameters
generateIV
(
byte
[]
iv
)
throws
Exception
{
/**
* 生成iv
*
* @param iv iv
* @return AlgorithmParameters
* @throws NoSuchAlgorithmException noSuchAlgorithmException
* @throws InvalidParameterSpecException invalidParameterSpecException
*/
public
static
AlgorithmParameters
generateIV
(
byte
[]
iv
)
throws
NoSuchAlgorithmException
,
InvalidParameterSpecException
{
AlgorithmParameters
params
=
AlgorithmParameters
.
getInstance
(
"AES"
);
params
.
init
(
new
IvParameterSpec
(
iv
));
return
params
;
...
...
@@ -37,33 +45,18 @@ public class AES {
* AES解密
*
* @param content 密文
* @return
* @throws InvalidAlgorithmParameterException
* @throws NoSuchProviderException
* @return result
* @throws Exception e
*/
public
byte
[]
decrypt
(
byte
[]
content
,
byte
[]
keyByte
,
byte
[]
ivByte
)
throws
InvalidAlgorithmParameter
Exception
{
public
byte
[]
decrypt
(
byte
[]
content
,
byte
[]
keyByte
,
byte
[]
ivByte
)
throws
Exception
{
initialize
();
try
{
Cipher
cipher
=
Cipher
.
getInstance
(
"AES/CBC/PKCS7Padding"
);
Key
sKeySpec
=
new
SecretKeySpec
(
keyByte
,
"AES"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
sKeySpec
,
generateIV
(
ivByte
));
// 初始化
byte
[]
result
=
cipher
.
doFinal
(
content
);
return
result
;
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
catch
(
NoSuchPaddingException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvalidKeyException
e
)
{
e
.
printStackTrace
();
}
catch
(
IllegalBlockSizeException
e
)
{
e
.
printStackTrace
();
}
catch
(
BadPaddingException
e
)
{
e
.
printStackTrace
();
}
catch
(
NoSuchProviderException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
// 初始化
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
sKeySpec
,
generateIV
(
ivByte
));
return
cipher
.
doFinal
(
content
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
null
;
...
...
src/main/java/com/gogirl/infrastructure/util/math/Prefix.java
View file @
211d02cc
...
...
@@ -6,6 +6,11 @@ import java.util.List;
import
java.util.function.Supplier
;
import
java.util.stream.Stream
;
/**
* Java8求笛卡尔积
*
* @param <T>
*/
public
class
Prefix
<
T
>
{
private
final
T
value
;
private
final
Prefix
<
T
>
parent
;
...
...
@@ -34,8 +39,7 @@ public class Prefix<T> {
* @param <C>
* @return
*/
public
static
<
T
,
C
extends
Collection
<
T
>>
Stream
<
C
>
ofCombinations
(
Collection
<?
extends
Collection
<
T
>>
values
,
Supplier
<
C
>
supplier
)
{
public
static
<
T
,
C
extends
Collection
<
T
>>
Stream
<
C
>
ofCombinations
(
Collection
<?
extends
Collection
<
T
>>
values
,
Supplier
<
C
>
supplier
)
{
if
(
values
.
isEmpty
())
return
Stream
.
empty
();
return
comb
(
new
ArrayList
<>(
values
),
0
,
null
,
supplier
);
...
...
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