Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
06e1c2e9
Commit
06e1c2e9
authored
Aug 20, 2020
by
徐康
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
cf1fdfbc
4e2da145
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
118 additions
and
49 deletions
+118
-49
assortment-ordercenter-sdk/pom.xml
+2
-2
assortment-ordercenter-sdk/readme.md
+2
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+3
-2
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/CreateOrderProductRequest.java
+5
-3
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/OrderProductAddInfoDto.java
+6
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/service/order/OrderCenterSdkServiceImpl.java
+4
-1
call-back-service/src/main/resources/application-pro.properties
+2
-2
order-application-service/pom.xml
+2
-2
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
+4
-2
order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
+86
-35
shopping-cart-application-service/src/main/java/cn/freemud/ShoppingCartApplication.java
+2
-0
No files found.
assortment-ordercenter-sdk/pom.xml
View file @
06e1c2e9
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
2.0.1
3
-SNAPSHOT
</version>
<version>
2.0.1
4
-SNAPSHOT
</version>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<dependency>
<dependency>
<artifactId>
couponcenter-sdk
</artifactId>
<artifactId>
couponcenter-sdk
</artifactId>
<groupId>
com.freemud.application.service.sdk
</groupId>
<groupId>
com.freemud.application.service.sdk
</groupId>
<version>
1.1
1.0-SNAPSHOT
</version>
<version>
1.1
0.2.RELEASE
</version>
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
assortment-ordercenter-sdk/readme.md
View file @
06e1c2e9
...
@@ -82,3 +82,4 @@
...
@@ -82,3 +82,4 @@
| 2.0.11-SNAPSHOT| 麦咖啡| 谌会阳 |2020-08-08
| 2.0.11-SNAPSHOT| 麦咖啡| 谌会阳 |2020-08-08
| 2.0.12-SNAPSHOT| OrderSourceType 调整 | 谌会阳 |2020-08-10
| 2.0.12-SNAPSHOT| OrderSourceType 调整 | 谌会阳 |2020-08-10
| 2.0.13-SNAPSHOT| 加料商品 | 谌会阳 |2020-08-14
| 2.0.13-SNAPSHOT| 加料商品 | 谌会阳 |2020-08-14
| 2.0.14-SNAPSHOT| 商品统计分类名称保存 | wuping | 2020-08-20 |
\ No newline at end of file
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
06e1c2e9
...
@@ -2596,8 +2596,9 @@ public class OrderSdkAdapter {
...
@@ -2596,8 +2596,9 @@ public class OrderSdkAdapter {
if
(
StringUtils
.
isNotBlank
(
product
.
getThirdCategoryId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getThirdCategoryId
())){
extInfo
.
setThirdCategoryId
(
product
.
getThirdCategoryId
());
extInfo
.
setThirdCategoryId
(
product
.
getThirdCategoryId
());
}
}
if
(
StringUtils
.
isNotBlank
(
product
.
getCategory
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getClassificationId
())){
extInfo
.
setThirdCensusCategoryId
(
product
.
getCategory
());
extInfo
.
setThirdCensusCategoryId
(
product
.
getClassificationId
());
extInfo
.
setThirdCensusCategoryId
(
product
.
getSetClassificationName
());
}
}
if
(
0
!=
product
.
getTax
()){
if
(
0
!=
product
.
getTax
()){
extInfo
.
setTax
(
product
.
getTax
());
extInfo
.
setTax
(
product
.
getTax
());
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/CreateOrderProductRequest.java
View file @
06e1c2e9
...
@@ -166,11 +166,13 @@ public class CreateOrderProductRequest extends BaseConfig {
...
@@ -166,11 +166,13 @@ public class CreateOrderProductRequest extends BaseConfig {
/** 是否主食**/
/** 是否主食**/
private
Integer
stapleFood
;
private
Integer
stapleFood
;
/** 商品统计分类编号**/
private
String
category
;
/** 商品税率**/
/** 商品税率**/
private
double
tax
;
private
double
tax
;
private
String
taxId
;
private
String
taxId
;
/** 商品统计分类编号**/
private
String
classificationId
;
private
String
setClassificationName
;
}
}
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/OrderProductAddInfoDto.java
View file @
06e1c2e9
...
@@ -62,7 +62,13 @@ public class OrderProductAddInfoDto extends BaseConfig {
...
@@ -62,7 +62,13 @@ public class OrderProductAddInfoDto extends BaseConfig {
*/
*/
private
String
thirdCensusCategoryId
;
private
String
thirdCensusCategoryId
;
/**
* 商品统计分类名称
*/
private
String
thirdCensusCategoryName
;
private
double
tax
;
private
double
tax
;
private
String
taxId
;
private
String
taxId
;
}
}
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/service/order/OrderCenterSdkServiceImpl.java
View file @
06e1c2e9
...
@@ -5,6 +5,7 @@ import cn.freemud.amqp.MQAction;
...
@@ -5,6 +5,7 @@ import cn.freemud.amqp.MQAction;
import
cn.freemud.amqp.MQMessage
;
import
cn.freemud.amqp.MQMessage
;
import
cn.freemud.amqp.MQService
;
import
cn.freemud.amqp.MQService
;
import
cn.freemud.base.util.DateUtil
;
import
cn.freemud.base.util.DateUtil
;
import
cn.freemud.base.util.JsonUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager
;
import
com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager
;
...
@@ -70,6 +71,8 @@ import com.freemud.sdk.api.assortment.order.response.payment.OrderPayResponse;
...
@@ -70,6 +71,8 @@ import com.freemud.sdk.api.assortment.order.response.payment.OrderPayResponse;
import
com.freemud.sdk.api.assortment.order.service.OrderCenterSdkService
;
import
com.freemud.sdk.api.assortment.order.service.OrderCenterSdkService
;
import
com.freemud.sdk.api.assortment.order.vo.AssortmentOrderProductVo
;
import
com.freemud.sdk.api.assortment.order.vo.AssortmentOrderProductVo
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.mysql.jdbc.log.LogUtils
;
import
lombok.extern.log4j.Log4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
@@ -242,7 +245,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -242,7 +245,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
CouponLockRequest
couponLockRequest
=
orderSdkAdapter
.
convert2CouponLockRequest
(
orderBean
,
accounts
);
CouponLockRequest
couponLockRequest
=
orderSdkAdapter
.
convert2CouponLockRequest
(
orderBean
,
accounts
);
if
(
couponLockRequest
!=
null
)
{
if
(
couponLockRequest
!=
null
)
{
BaseResponse
<
CouponLockResponse
>
couponLockResponseBaseResponse
=
offlineCouponSdkService
.
couponLock
(
couponLockRequest
,
""
);
BaseResponse
<
CouponLockResponse
>
couponLockResponseBaseResponse
=
offlineCouponSdkService
.
couponLock
(
couponLockRequest
,
""
);
if
(!
ObjectUtils
.
equals
(
RESPONSE_SUCCESS
,
couponLockResponseBaseResponse
.
getStatus
Code
()))
{
if
(!
ObjectUtils
.
equals
(
RESPONSE_SUCCESS
_STR
,
couponLockResponseBaseResponse
.
get
Code
()))
{
CancelOrderRequest
cancelOrderRequest
=
orderSdkAdapter
.
convent2CancelOrderRequest
(
orderBean
.
getOid
(),
orderBean
.
getCompanyId
(),
AfterSalesType
.
SYSTEM_CANCEL
,
"锁定券码失败"
,
""
,
null
);
CancelOrderRequest
cancelOrderRequest
=
orderSdkAdapter
.
convent2CancelOrderRequest
(
orderBean
.
getOid
(),
orderBean
.
getCompanyId
(),
AfterSalesType
.
SYSTEM_CANCEL
,
"锁定券码失败"
,
""
,
null
);
orderCancel
(
cancelOrderRequest
);
orderCancel
(
cancelOrderRequest
);
//失败异步冲正库存,取消订单
//失败异步冲正库存,取消订单
...
...
call-back-service/src/main/resources/application-pro.properties
View file @
06e1c2e9
...
@@ -8,4 +8,4 @@ app.id=SHOP_OPEN_STORE
...
@@ -8,4 +8,4 @@ app.id=SHOP_OPEN_STORE
apollo.meta
=
http://open-store-apollo-configservice-pro.open-store.svc:8080
apollo.meta
=
http://open-store-apollo-configservice-pro.open-store.svc:8080
env
=
pro
env
=
pro
apollo.bootstrap.enabled
=
true
apollo.bootstrap.enabled
=
true
apollo.bootstrap.namespaces
=
micro_progeram_commons,i_callback_service
apollo.bootstrap.namespaces
=
i_callback_service,micro_progeram_commons
\ No newline at end of file
\ No newline at end of file
order-application-service/pom.xml
View file @
06e1c2e9
...
@@ -35,12 +35,12 @@
...
@@ -35,12 +35,12 @@
<dependency>
<dependency>
<artifactId>
couponcenter-sdk
</artifactId>
<artifactId>
couponcenter-sdk
</artifactId>
<groupId>
com.freemud.application.service.sdk
</groupId>
<groupId>
com.freemud.application.service.sdk
</groupId>
<version>
1.1
1.0-SNAPSHOT
</version>
<version>
1.1
0.2.RELEASE
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.freemud
</groupId>
<groupId>
cn.freemud
</groupId>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<artifactId>
assortment-ordercenter-sdk
</artifactId>
<version>
2.0.1
3
-SNAPSHOT
</version>
<version>
2.0.1
4
-SNAPSHOT
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
View file @
06e1c2e9
...
@@ -2102,7 +2102,8 @@ public class OrderAdapter {
...
@@ -2102,7 +2102,8 @@ public class OrderAdapter {
createOrderProductDemoDto
.
setWeight
(
cartGoodsDetailDto
.
getWeight
());
createOrderProductDemoDto
.
setWeight
(
cartGoodsDetailDto
.
getWeight
());
createOrderProductDemoDto
.
setUnit
(
cartGoodsDetailDto
.
getUnit
());
createOrderProductDemoDto
.
setUnit
(
cartGoodsDetailDto
.
getUnit
());
createOrderProductDemoDto
.
setStapleFood
(
0
);
createOrderProductDemoDto
.
setStapleFood
(
0
);
createOrderProductDemoDto
.
setCategory
(
cartGoodsDetailDto
.
getClassificationId
());
createOrderProductDemoDto
.
setClassificationId
(
cartGoodsDetailDto
.
getClassificationId
());
createOrderProductDemoDto
.
setSetClassificationName
(
cartGoodsDetailDto
.
getSetClassificationName
());
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsDetailDto
.
getActivityDiscountsDtos
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsDetailDto
.
getActivityDiscountsDtos
()))
{
createOrderProductDemoDto
.
setAccounts
(
getMaterialAccounts
(
createOrderProductDemoDto
,
cartGoodsDetailDto
));
createOrderProductDemoDto
.
setAccounts
(
getMaterialAccounts
(
createOrderProductDemoDto
,
cartGoodsDetailDto
));
}
}
...
@@ -2131,9 +2132,10 @@ public class OrderAdapter {
...
@@ -2131,9 +2132,10 @@ public class OrderAdapter {
createOrderProductDemoDto
.
setWeight
(
cartGoodsDetailDto
.
getWeight
());
createOrderProductDemoDto
.
setWeight
(
cartGoodsDetailDto
.
getWeight
());
createOrderProductDemoDto
.
setUnit
(
cartGoodsDetailDto
.
getUnit
());
createOrderProductDemoDto
.
setUnit
(
cartGoodsDetailDto
.
getUnit
());
createOrderProductDemoDto
.
setStapleFood
(
0
);
createOrderProductDemoDto
.
setStapleFood
(
0
);
createOrderProductDemoDto
.
setCategory
(
cartGoodsDetailDto
.
getClassificationId
());
createOrderProductDemoDto
.
setTax
(
cartGoodsDetailDto
.
getTax
());
createOrderProductDemoDto
.
setTax
(
cartGoodsDetailDto
.
getTax
());
createOrderProductDemoDto
.
setTaxId
(
cartGoodsDetailDto
.
getTaxId
());
createOrderProductDemoDto
.
setTaxId
(
cartGoodsDetailDto
.
getTaxId
());
createOrderProductDemoDto
.
setClassificationId
(
cartGoodsDetailDto
.
getClassificationId
());
createOrderProductDemoDto
.
setSetClassificationName
(
cartGoodsDetailDto
.
getSetClassificationName
());
return
createOrderProductDemoDto
;
return
createOrderProductDemoDto
;
}
}
...
...
order-application-service/src/main/java/cn/freemud/service/impl/CheckOrder.java
View file @
06e1c2e9
...
@@ -110,6 +110,7 @@ public class CheckOrder {
...
@@ -110,6 +110,7 @@ public class CheckOrder {
@Autowired
@Autowired
private
CouponService
couponService
;
private
CouponService
couponService
;
private
static
Gson
gson
=
new
Gson
();
private
static
Gson
gson
=
new
Gson
();
/**
/**
* 下单会员相关校验
* 下单会员相关校验
*/
*/
...
@@ -144,7 +145,7 @@ public class CheckOrder {
...
@@ -144,7 +145,7 @@ public class CheckOrder {
*/
*/
public
StoreResponse
getStoreInfo
(
String
partnerId
,
String
shopId
,
String
trackingNo
)
{
public
StoreResponse
getStoreInfo
(
String
partnerId
,
String
shopId
,
String
trackingNo
)
{
// 获取门店信息
// 获取门店信息
StoreInfoRequest
storeInfoRequest
=
new
StoreInfoRequest
(
partnerId
,
shopId
,
null
);
StoreInfoRequest
storeInfoRequest
=
new
StoreInfoRequest
(
partnerId
,
shopId
,
null
);
return
storeCenterService
.
getStoreInfo
(
storeInfoRequest
,
trackingNo
);
return
storeCenterService
.
getStoreInfo
(
storeInfoRequest
,
trackingNo
);
}
}
...
@@ -187,20 +188,28 @@ public class CheckOrder {
...
@@ -187,20 +188,28 @@ public class CheckOrder {
}
}
// TODO: 2020/6/16 门店校验处理
// TODO: 2020/6/16 门店校验处理
String
takeMealFlag
=
createOrderVo
.
getTakeMealFlag
();
String
takeMealFlag
=
createOrderVo
.
getTakeMealFlag
();
String
takeMealTimes
=
createOrderVo
.
getTakeMealTime
();
//立即送达
if
(
"0"
.
equals
(
takeMealFlag
)
||
(
StringUtils
.
isEmpty
(
createOrderVo
.
getExpectTime
())
&&
StringUtils
.
isEmpty
(
takeMealTimes
)))
{
//未营业无预约时间无法下单
//未营业无预约时间无法下单
if
(!
StoreConstant
.
BUSINESS
.
equals
(
storeResponseDto
.
getState
())
&&
StringUtils
.
isBlank
(
takeMealFlag
)
&&
"0"
.
equals
(
takeMealFlag
))
{
if
(!
StoreConstant
.
BUSINESS
.
equals
(
storeResponseDto
.
getState
()
))
{
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_CHECK_CLOSE
);
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_CHECK_CLOSE
);
}
}
// 外卖单选择立即送达的话,下单时间必须在店铺外卖时间内
if
(
createOrderVo
.
getOrderType
().
compareTo
(
CreateOrderType
.
TAKE_OUT
.
getCode
())
==
0
)
{
checkTakeOutTime
(
storeResponseDto
,
new
Date
(),
new
Date
(),
true
);
}
}
String
takeMealTimes
=
createOrderVo
.
getTakeMealTime
();
//有预约时间
//有预约时间
if
(
StringUtils
.
isNotBlank
(
takeMealTimes
)
||
StringUtils
.
isNotBlank
(
createOrderVo
.
getExpectTime
()))
{
if
(
StringUtils
.
isNotBlank
(
takeMealTimes
)
||
StringUtils
.
isNotBlank
(
createOrderVo
.
getExpectTime
()))
{
// 设置预约时间
// 设置预约时间
Date
takeMealDateTime
=
getOrderExpectTime
(
takeMealFlag
,
takeMealTimes
,
createOrderVo
.
getExpectTime
(),
Date
takeMealDateTime
=
getOrderExpectTime
(
takeMealFlag
,
takeMealTimes
,
createOrderVo
.
getExpectTime
(),
CreateOrderType
.
getByCode
(
createOrderVo
.
getOrderType
()),
storeResponseDto
.
getServiceTime
(),
storeResponseDto
);
CreateOrderType
.
getByCode
(
createOrderVo
.
getOrderType
()),
storeResponseDto
.
getServiceTime
(),
storeResponseDto
);
if
(
takeMealDateTime
!=
null
)
{
if
(
takeMealDateTime
!=
null
)
{
//校验预约时间
//校验预约时间
checkOrderExpectTime
(
createOrderVo
,
storeResponseDto
,
takeMealDateTime
);
checkOrderExpectTime
(
createOrderVo
,
storeResponseDto
,
takeMealDateTime
);
//重新赋值为yyyy-MM-dd HH:mm:ss格式字符串时间
//重新赋值为yyyy-MM-dd HH:mm:ss格式字符串时间
createOrderVo
.
setExpectTime
(
DateUtil
.
convert2String
(
takeMealDateTime
,
"yyyy-MM-dd HH:mm:ss"
));
createOrderVo
.
setExpectTime
(
DateUtil
.
convert2String
(
takeMealDateTime
,
"yyyy-MM-dd HH:mm:ss"
));
}
}
...
@@ -344,11 +353,53 @@ public class CheckOrder {
...
@@ -344,11 +353,53 @@ public class CheckOrder {
if
(!
expectTimeInTodayBusinessTime
&&
(
takeMealDateTime
.
before
(
nextDeliveryStartDate
)
||
takeMealDateTime
.
after
(
nextDeliveryEndDate
)))
{
if
(!
expectTimeInTodayBusinessTime
&&
(
takeMealDateTime
.
before
(
nextDeliveryStartDate
)
||
takeMealDateTime
.
after
(
nextDeliveryEndDate
)))
{
throw
new
ServiceException
(
ResponseResult
.
ORDER_CREATE_TIME_NOT_DELIVERY
);
throw
new
ServiceException
(
ResponseResult
.
ORDER_CREATE_TIME_NOT_DELIVERY
);
}
}
checkTakeOutTime
(
storeResponseDto
,
date
,
takeMealDateTime
,
expectTimeInTodayBusinessTime
);
}
}
/**
* 检验订单是否在外卖时间内
*
* @param storeResponseDto 店铺信息
* @param now 当前时间
* @param takeMealDateTime 预约单送达时间/即时单下单时间
* @param expectTimeInTodayBusinessTime 是否在当日营业时间内
*/
private
void
checkTakeOutTime
(
StoreResponse
.
BizVO
storeResponseDto
,
Date
now
,
Date
takeMealDateTime
,
boolean
expectTimeInTodayBusinessTime
)
{
String
deliveryStr
=
storeResponseDto
.
getDeliveryHoursDay
().
replace
(
"-"
,
","
)
.
replace
(
"_"
,
","
);
String
[]
deliverys
=
deliveryStr
.
split
(
","
);
Date
deliveryStartDate
=
null
;
Date
deliveryEndDate
=
null
;
if
(
deliverys
.
length
==
2
)
{
SimpleDateFormat
hhmmss
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
yyyyMMdd
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
startDateTimeStr
=
yyyyMMdd
.
format
(
now
)
+
" "
+
deliverys
[
0
]
+
":00"
;
String
endDateTimeStr
=
yyyyMMdd
.
format
(
now
)
+
" "
+
deliverys
[
1
]
+
":00"
;
try
{
deliveryStartDate
=
hhmmss
.
parse
(
startDateTimeStr
);
deliveryEndDate
=
hhmmss
.
parse
(
endDateTimeStr
);
}
catch
(
ParseException
e
)
{
LogUtil
.
error
(
"getStoreDeliveryInfo_error"
,
endDateTimeStr
,
e
.
getMessage
());
}
}
if
(
deliveryStartDate
==
null
||
deliveryEndDate
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
ORDER_CREATE_TIME_NOT_DELIVERY
);
}
// 校验预约配送时间
if
(
expectTimeInTodayBusinessTime
&&
(
takeMealDateTime
.
before
(
deliveryStartDate
)
||
takeMealDateTime
.
after
(
deliveryEndDate
)))
{
throw
new
ServiceException
(
ResponseResult
.
ORDER_CREATE_TIME_NOT_DELIVERY
);
}
Date
nextDeliveryStartDate
=
DateUtil
.
addDays
(
deliveryStartDate
,
1
);
Date
nextDeliveryEndDate
=
DateUtil
.
addDays
(
deliveryEndDate
,
1
);
// 隔日预约外卖校验预约配送时间
if
(!
expectTimeInTodayBusinessTime
&&
(
takeMealDateTime
.
before
(
nextDeliveryStartDate
)
||
takeMealDateTime
.
after
(
nextDeliveryEndDate
)))
{
throw
new
ServiceException
(
ResponseResult
.
ORDER_CREATE_TIME_NOT_DELIVERY
);
}
}
}
}
public
Date
getOrderExpectTime
(
String
takeMealFlag
,
String
takeMealTimes
,
String
expectTime
,
public
Date
getOrderExpectTime
(
String
takeMealFlag
,
String
takeMealTimes
,
String
expectTime
,
CreateOrderType
createOrderType
,
Integer
serviceTime
,
StoreResponse
.
BizVO
storeResponseDto
)
{
CreateOrderType
createOrderType
,
Integer
serviceTime
,
StoreResponse
.
BizVO
storeResponseDto
)
{
Date
takeMealDateTime
=
null
;
Date
takeMealDateTime
=
null
;
//0=到店单我已到店、外卖单尽快送出
//0=到店单我已到店、外卖单尽快送出
if
(
StringUtils
.
isNotBlank
(
takeMealFlag
)
&&
"0"
.
equals
(
takeMealFlag
))
{
if
(
StringUtils
.
isNotBlank
(
takeMealFlag
)
&&
"0"
.
equals
(
takeMealFlag
))
{
...
@@ -359,7 +410,7 @@ public class CheckOrder {
...
@@ -359,7 +410,7 @@ public class CheckOrder {
}
}
//兼容门店隔日预约单格式修改,HH:mm变yyyy-MM-dd HH:mm,前端未升级,未按要求传
//兼容门店隔日预约单格式修改,HH:mm变yyyy-MM-dd HH:mm,前端未升级,未按要求传
if
(
StringUtils
.
isNotBlank
(
takeMealTimes
)
&&
takeMealTimes
.
length
()
>
5
)
{
if
(
StringUtils
.
isNotBlank
(
takeMealTimes
)
&&
takeMealTimes
.
length
()
>
5
)
{
expectTime
=
takeMealTimes
+
":00"
;
expectTime
=
takeMealTimes
+
":00"
;
}
}
Date
date
=
new
Date
();
Date
date
=
new
Date
();
...
@@ -369,21 +420,21 @@ public class CheckOrder {
...
@@ -369,21 +420,21 @@ public class CheckOrder {
takeMealTime
=
takeMealTime
.
append
(
DateUtil
.
convert2String
(
date
,
"yyyy-MM-dd"
))
takeMealTime
=
takeMealTime
.
append
(
DateUtil
.
convert2String
(
date
,
"yyyy-MM-dd"
))
.
append
(
" "
).
append
(
takeMealTimes
).
append
(
":00"
);
.
append
(
" "
).
append
(
takeMealTimes
).
append
(
":00"
);
takeMealDateTime
=
DateUtil
.
convert2Date
(
takeMealTime
.
toString
(),
"yyyy-MM-dd HH:mm:ss"
);
takeMealDateTime
=
DateUtil
.
convert2Date
(
takeMealTime
.
toString
(),
"yyyy-MM-dd HH:mm:ss"
);
Date
newDate
=
DateUtil
.
convert2Date
(
date
,
DateUtil
.
FORMAT_yyyyMMdd_date
);
Date
newDate
=
DateUtil
.
convert2Date
(
date
,
DateUtil
.
FORMAT_yyyyMMdd_date
);
newDate
=
DateUtil
.
addDays
(
newDate
,
1
);
newDate
=
DateUtil
.
addDays
(
newDate
,
1
);
//获取门店当天营业结束时间
//获取门店当天营业结束时间
Date
todayEndDate
=
null
;
Date
todayEndDate
=
null
;
List
<
String
>
todayBusinessTimes
=
storeCenterService
.
getTodayBusinessTime
(
Integer
.
parseInt
(
storeResponseDto
.
getBusinessType
()),
storeResponseDto
.
getBusinessHoursDay
());
List
<
String
>
todayBusinessTimes
=
storeCenterService
.
getTodayBusinessTime
(
Integer
.
parseInt
(
storeResponseDto
.
getBusinessType
()),
storeResponseDto
.
getBusinessHoursDay
());
if
(
CollectionUtils
.
isEmpty
(
todayBusinessTimes
))
{
if
(
CollectionUtils
.
isEmpty
(
todayBusinessTimes
))
{
throw
new
ServiceException
(
ResponseResult
.
STORE_BUSINESS_HOUR_ERROR
);
throw
new
ServiceException
(
ResponseResult
.
STORE_BUSINESS_HOUR_ERROR
);
}
}
BusinessDate
businessDate
=
getStoreBusinessDate
(
todayBusinessTimes
.
get
(
todayBusinessTimes
.
size
()
-
1
),
true
);
BusinessDate
businessDate
=
getStoreBusinessDate
(
todayBusinessTimes
.
get
(
todayBusinessTimes
.
size
()
-
1
),
true
);
todayEndDate
=
businessDate
.
getEndDate
();
todayEndDate
=
businessDate
.
getEndDate
();
//隔天营业的预约时间处理 计算出预约时间在当前时间之前,预约时间加1天 newDate.before(todayEndDate)=隔天营业
//隔天营业的预约时间处理 计算出预约时间在当前时间之前,预约时间加1天 newDate.before(todayEndDate)=隔天营业
if
(
takeMealDateTime
!=
null
&&
takeMealDateTime
.
before
(
date
)
&&
newDate
.
before
(
todayEndDate
))
{
if
(
takeMealDateTime
!=
null
&&
takeMealDateTime
.
before
(
date
)
&&
newDate
.
before
(
todayEndDate
))
{
takeMealDateTime
=
DateUtil
.
addDays
(
takeMealDateTime
,
1
);
takeMealDateTime
=
DateUtil
.
addDays
(
takeMealDateTime
,
1
);
}
}
}
}
if
(
StringUtils
.
isNotBlank
(
expectTime
))
{
if
(
StringUtils
.
isNotBlank
(
expectTime
))
{
...
@@ -395,13 +446,13 @@ public class CheckOrder {
...
@@ -395,13 +446,13 @@ public class CheckOrder {
}
}
//当顾客指定送达时间小于当前时间+提前预约时间时,订单记录类型为即时单
//当顾客指定送达时间小于当前时间+提前预约时间时,订单记录类型为即时单
if
(
CreateOrderType
.
TAKE_OUT
.
equals
(
createOrderType
)
&&
takeMealDateTime
!=
null
if
(
CreateOrderType
.
TAKE_OUT
.
equals
(
createOrderType
)
&&
takeMealDateTime
!=
null
&&
serviceTime
!=
null
&&
takeMealDateTime
.
before
(
DateUtil
.
addMinutes
(
date
,
serviceTime
)))
{
&&
serviceTime
!=
null
&&
takeMealDateTime
.
before
(
DateUtil
.
addMinutes
(
date
,
serviceTime
)))
{
takeMealDateTime
=
null
;
takeMealDateTime
=
null
;
}
}
return
takeMealDateTime
;
return
takeMealDateTime
;
}
}
public
BusinessDate
getStoreBusinessDate
(
String
businessHoursDay
,
boolean
today
){
public
BusinessDate
getStoreBusinessDate
(
String
businessHoursDay
,
boolean
today
)
{
BusinessDate
businessDate
=
new
BusinessDate
();
BusinessDate
businessDate
=
new
BusinessDate
();
//设置营业开始和结束时间
//设置营业开始和结束时间
String
businessHourStr
=
businessHoursDay
.
replace
(
"-"
,
","
).
replace
(
"_"
,
","
);
String
businessHourStr
=
businessHoursDay
.
replace
(
"-"
,
","
).
replace
(
"_"
,
","
);
...
@@ -410,13 +461,13 @@ public class CheckOrder {
...
@@ -410,13 +461,13 @@ public class CheckOrder {
throw
new
ServiceException
(
ResponseResult
.
STORE_NOT_FOUND
);
throw
new
ServiceException
(
ResponseResult
.
STORE_NOT_FOUND
);
}
}
Date
date
=
new
Date
();
Date
date
=
new
Date
();
if
(!
today
)
{
if
(!
today
)
{
date
=
DateUtil
.
addDays
(
date
,
1
);
date
=
DateUtil
.
addDays
(
date
,
1
);
}
}
String
startDateTimeStr
=
DateUtil
.
convert2String
(
date
,
DateUtil
.
FORMAT_YMD
)
+
" "
+
businessHours
[
0
]
+
":00"
;
String
startDateTimeStr
=
DateUtil
.
convert2String
(
date
,
DateUtil
.
FORMAT_YMD
)
+
" "
+
businessHours
[
0
]
+
":00"
;
String
endDateTimeStr
=
DateUtil
.
convert2String
(
date
,
DateUtil
.
FORMAT_YMD
)
+
" "
+
businessHours
[
1
]
+
":00"
;
String
endDateTimeStr
=
DateUtil
.
convert2String
(
date
,
DateUtil
.
FORMAT_YMD
)
+
" "
+
businessHours
[
1
]
+
":00"
;
Date
startDateTime
;
Date
startDateTime
;
Date
endDateTime
;
Date
endDateTime
;
startDateTime
=
DateUtil
.
convert2Date
(
startDateTimeStr
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
startDateTime
=
DateUtil
.
convert2Date
(
startDateTimeStr
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
SimpleDateFormat
hhmmss
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
SimpleDateFormat
hhmmss
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
try
{
try
{
...
@@ -425,8 +476,8 @@ public class CheckOrder {
...
@@ -425,8 +476,8 @@ public class CheckOrder {
throw
new
ServiceException
(
ResponseResult
.
STORE_BUSINESS_HOUR_ERROR
);
throw
new
ServiceException
(
ResponseResult
.
STORE_BUSINESS_HOUR_ERROR
);
}
}
//隔天营业时间处理
//隔天营业时间处理
if
(
startDateTime
.
after
(
endDateTime
))
{
if
(
startDateTime
.
after
(
endDateTime
))
{
endDateTime
=
DateUtil
.
addDays
(
endDateTime
,
1
);
endDateTime
=
DateUtil
.
addDays
(
endDateTime
,
1
);
}
}
// 校验门店是否打烊,打烊了则不让操作
// 校验门店是否打烊,打烊了则不让操作
if
(
startDateTime
==
null
||
endDateTime
==
null
)
{
if
(
startDateTime
==
null
||
endDateTime
==
null
)
{
...
@@ -490,7 +541,7 @@ public class CheckOrder {
...
@@ -490,7 +541,7 @@ public class CheckOrder {
cn
.
freemud
.
base
.
entity
.
BaseResponse
<
ShoppingCartGoodsDto
>
apportionResponse
=
shoppingCartClient
.
getShoppingCartGoodsApportionNew
(
requestDto
);
cn
.
freemud
.
base
.
entity
.
BaseResponse
<
ShoppingCartGoodsDto
>
apportionResponse
=
shoppingCartClient
.
getShoppingCartGoodsApportionNew
(
requestDto
);
if
(!
ObjectUtils
.
equals
(
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
,
apportionResponse
.
getCode
()))
{
if
(!
ObjectUtils
.
equals
(
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
,
apportionResponse
.
getCode
()))
{
ResponseResult
responseResult
=
ResponseResult
.
getResponseResult
(
apportionResponse
.
getCode
());
ResponseResult
responseResult
=
ResponseResult
.
getResponseResult
(
apportionResponse
.
getCode
());
throw
new
ServiceException
(
responseResult
!=
null
?
responseResult
:
ResponseResult
.
SHOPPING_CART_GETINFO_ERROR
);
throw
new
ServiceException
(
responseResult
!=
null
?
responseResult
:
ResponseResult
.
SHOPPING_CART_GETINFO_ERROR
);
}
}
if
(
apportionResponse
.
getResult
()
==
null
||
CollectionUtils
.
isEmpty
(
apportionResponse
.
getResult
().
getProducts
()))
{
if
(
apportionResponse
.
getResult
()
==
null
||
CollectionUtils
.
isEmpty
(
apportionResponse
.
getResult
().
getProducts
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GETINFO_INVAILD
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GETINFO_INVAILD
);
...
@@ -667,31 +718,31 @@ public class CheckOrder {
...
@@ -667,31 +718,31 @@ public class CheckOrder {
}
}
public
void
checkCardCode
(
String
partnerId
,
String
memberId
,
String
cardCode
)
{
public
void
checkCardCode
(
String
partnerId
,
String
memberId
,
String
cardCode
)
{
if
(
StringUtils
.
isBlank
(
cardCode
))
{
if
(
StringUtils
.
isBlank
(
cardCode
))
{
return
;
return
;
}
}
StatisticalPropertyRequest
request
=
new
StatisticalPropertyRequest
();
StatisticalPropertyRequest
request
=
new
StatisticalPropertyRequest
();
request
.
setPartnerId
(
partnerId
);
request
.
setPartnerId
(
partnerId
);
request
.
setMemberId
(
memberId
);
request
.
setMemberId
(
memberId
);
BaseResponse
<
List
<
GetSvcInfoByMemberIdResponse
>>
responseDTO
=
memberPropertyService
.
getSvcInfoByMemberId
(
request
,
LogThreadLocal
.
getTrackingNo
());
BaseResponse
<
List
<
GetSvcInfoByMemberIdResponse
>>
responseDTO
=
memberPropertyService
.
getSvcInfoByMemberId
(
request
,
LogThreadLocal
.
getTrackingNo
());
if
(!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
responseDTO
.
getCode
())
||
responseDTO
.
getData
()
==
null
if
(!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
responseDTO
.
getCode
())
||
responseDTO
.
getData
()
==
null
||
responseDTO
.
getData
().
size
()
==
0
)
{
||
responseDTO
.
getData
().
size
()
==
0
)
{
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_ERROR
);
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_ERROR
);
}
}
//svc卡无效
//svc卡无效
boolean
b
=
true
;
boolean
b
=
true
;
for
(
GetSvcInfoByMemberIdResponse
getSvcInfoByMemberIdResponse
:
responseDTO
.
getData
()){
for
(
GetSvcInfoByMemberIdResponse
getSvcInfoByMemberIdResponse
:
responseDTO
.
getData
())
{
if
(
cardCode
.
equals
(
getSvcInfoByMemberIdResponse
.
getCardCode
())
&&
getSvcInfoByMemberIdResponse
.
getStatusFlag
()
==
0
)
{
if
(
cardCode
.
equals
(
getSvcInfoByMemberIdResponse
.
getCardCode
())
&&
getSvcInfoByMemberIdResponse
.
getStatusFlag
()
==
0
)
{
b
=
false
;
b
=
false
;
}
}
}
}
if
(
b
)
{
if
(
b
)
{
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_ERROR
);
throw
new
ServiceException
(
ResponseResult
.
USER_SVC_CARD_ERROR
);
}
}
}
}
public
void
checkOrderByStore
(
StoreResponse
.
BizVO
storeResponseDto
){
public
void
checkOrderByStore
(
StoreResponse
.
BizVO
storeResponseDto
)
{
// 校验门店是否停业 1 营业 2 停业 3 繁忙置休
// 校验门店是否停业 1 营业 2 停业 3 繁忙置休
if
(
storeResponseDto
.
getActiveFlag
()
==
null
||
storeResponseDto
.
getActiveFlag
()
!=
1
)
{
if
(
storeResponseDto
.
getActiveFlag
()
==
null
||
storeResponseDto
.
getActiveFlag
()
!=
1
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_STOP_BUSINESS
);
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_STOP_BUSINESS
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/ShoppingCartApplication.java
View file @
06e1c2e9
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
package
cn
.
freemud
;
package
cn
.
freemud
;
import
cn.freemud.core.db.DataSourcesConfig
;
import
cn.freemud.core.db.DataSourcesConfig
;
import
com.alibaba.fastjson.parser.ParserConfig
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
feign.RequestInterceptor
;
import
feign.RequestInterceptor
;
import
org.jasypt.encryption.StringEncryptor
;
import
org.jasypt.encryption.StringEncryptor
;
...
@@ -48,6 +49,7 @@ import tk.mybatis.spring.annotation.MapperScan;
...
@@ -48,6 +49,7 @@ import tk.mybatis.spring.annotation.MapperScan;
@EnableAsync
@EnableAsync
public
class
ShoppingCartApplication
{
public
class
ShoppingCartApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
ParserConfig
.
getGlobalInstance
().
setAutoTypeSupport
(
true
);
SpringApplication
.
run
(
ShoppingCartApplication
.
class
,
args
);
SpringApplication
.
run
(
ShoppingCartApplication
.
class
,
args
);
}
}
...
...
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