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
29710b8d
Commit
29710b8d
authored
Jul 12, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'KA-20210702-非码发版日售后单时间推迟-周晓航'
parents
9cfd5745
b381413d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
11 deletions
+125
-11
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/constant/CommonConstant.java
+19
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/service/order/OrderCenterSdkServiceImpl.java
+105
-11
order-application-service/src/main/java/cn/freemud/controller/OrderController.java
+1
-0
No files found.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/constant/CommonConstant.java
0 → 100644
View file @
29710b8d
package
com
.
freemud
.
sdk
.
api
.
assortment
.
order
.
constant
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/5 下午4:17
* @description :
*/
public
class
CommonConstant
{
/**
* 2:星期二
* 4:星期四
*/
public
static
List
<
Integer
>
weekDay
=
Arrays
.
asList
(
2
,
4
);
}
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/service/order/OrderCenterSdkServiceImpl.java
View file @
29710b8d
...
@@ -33,7 +33,6 @@ import com.freemud.application.sdk.api.ordercenter.enums.*;
...
@@ -33,7 +33,6 @@ import com.freemud.application.sdk.api.ordercenter.enums.*;
import
com.freemud.application.sdk.api.ordercenter.request.*
;
import
com.freemud.application.sdk.api.ordercenter.request.*
;
import
com.freemud.application.sdk.api.ordercenter.request.create.*
;
import
com.freemud.application.sdk.api.ordercenter.request.create.*
;
import
com.freemud.application.sdk.api.ordercenter.response.*
;
import
com.freemud.application.sdk.api.ordercenter.response.*
;
import
com.freemud.application.sdk.api.ordercenter.response.AfterSalesListResp
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.AfterSalesOrderResp
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.AfterSalesOrderResp
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderInfoReqs
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderInfoReqs
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.QueryByCodeResponse
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.QueryByCodeResponse
;
...
@@ -60,6 +59,7 @@ import com.freemud.application.sdk.api.structure.MessageCenterType;
...
@@ -60,6 +59,7 @@ import com.freemud.application.sdk.api.structure.MessageCenterType;
import
com.freemud.application.sdk.api.structure.request.PushMessageNoticeDto
;
import
com.freemud.application.sdk.api.structure.request.PushMessageNoticeDto
;
import
com.freemud.application.sdk.api.structure.service.MessageCenterClient
;
import
com.freemud.application.sdk.api.structure.service.MessageCenterClient
;
import
com.freemud.sdk.api.assortment.order.adapter.*
;
import
com.freemud.sdk.api.assortment.order.adapter.*
;
import
com.freemud.sdk.api.assortment.order.constant.CommonConstant
;
import
com.freemud.sdk.api.assortment.order.domain.ResponseCodeConstant
;
import
com.freemud.sdk.api.assortment.order.domain.ResponseCodeConstant
;
import
com.freemud.sdk.api.assortment.order.entities.OrderEditInfo
;
import
com.freemud.sdk.api.assortment.order.entities.OrderEditInfo
;
import
com.freemud.sdk.api.assortment.order.enums.*
;
import
com.freemud.sdk.api.assortment.order.enums.*
;
...
@@ -77,8 +77,10 @@ import org.apache.commons.collections4.CollectionUtils;
...
@@ -77,8 +77,10 @@ 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
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -124,6 +126,15 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -124,6 +126,15 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
@Autowired
@Autowired
private
OfflineCouponSdkService
offlineCouponSdkService
;
private
OfflineCouponSdkService
offlineCouponSdkService
;
/**
* 规避 发版时间配置的双虎
*/
@Value
(
"${avoid.version.upgrade.config:}"
)
private
String
avoidVersionUpgradeConfig
;
@Value
(
"${version.upgrade.weekDay:}"
)
private
List
<
Integer
>
weekDay
;
@Override
@Override
public
CreateOrderResponse
createOrderFlow
(
CreateOrderRequest
config
)
{
public
CreateOrderResponse
createOrderFlow
(
CreateOrderRequest
config
)
{
com
.
freemud
.
application
.
sdk
.
api
.
ordercenter
.
request
.
create
.
CreateOrderRequest
request
=
orderSdkAdapter
.
convent2NEWCreateOrderRequest
(
config
.
getBaseCreateOrderRequest
());
com
.
freemud
.
application
.
sdk
.
api
.
ordercenter
.
request
.
create
.
CreateOrderRequest
request
=
orderSdkAdapter
.
convent2NEWCreateOrderRequest
(
config
.
getBaseCreateOrderRequest
());
...
@@ -544,7 +555,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -544,7 +555,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
&&
!
ObjectUtils
.
equals
(
"0"
,
configuration
.
getAutoChargebackOrderTime
()))
{
&&
!
ObjectUtils
.
equals
(
"0"
,
configuration
.
getAutoChargebackOrderTime
()))
{
request
.
setTimeOut
(
AutoOrderConfigTime
.
getTime
(
configuration
.
getAutoChargebackOrderTime
()));
request
.
setTimeOut
(
AutoOrderConfigTime
.
getTime
(
configuration
.
getAutoChargebackOrderTime
()));
}
}
OrderTaskReq
orderTask
=
setAfterSalesOrderTimeOutTask
(
configuration
);
OrderTaskReq
orderTask
=
setAfterSalesOrderTimeOutTask
(
configuration
,
orderRefundRequest
.
getPartnerId
()
);
request
.
setOrderTask
(
orderTask
);
request
.
setOrderTask
(
orderTask
);
com
.
freemud
.
application
.
sdk
.
api
.
ordercenter
.
response
.
BaseResponse
response
=
orderSdkService
.
createAfterSalesOrder
(
request
,
orderRefundRequest
.
getTrackingNo
());
com
.
freemud
.
application
.
sdk
.
api
.
ordercenter
.
response
.
BaseResponse
response
=
orderSdkService
.
createAfterSalesOrder
(
request
,
orderRefundRequest
.
getTrackingNo
());
return
orderSdkAdapter
.
convent2BaseOrderResponse
(
response
);
return
orderSdkAdapter
.
convent2BaseOrderResponse
(
response
);
...
@@ -557,13 +568,24 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -557,13 +568,24 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
* 为了防止同一时刻的退款量太大,需要将退款的订单分散到指定的时间后半小时内
* 为了防止同一时刻的退款量太大,需要将退款的订单分散到指定的时间后半小时内
*/
*/
private
OrderTaskReq
setAfterSalesOrderTimeOutTask
(
StoreResponse
.
Configuration
configuration
)
{
private
OrderTaskReq
setAfterSalesOrderTimeOutTask
(
StoreResponse
.
Configuration
configuration
)
{
OrderTaskReq
orderTaskReq
=
setAfterSalesOrderTimeOutTask
(
configuration
,
null
);
return
orderTaskReq
;
}
/**
* 设置申请退款时间
* 如果时间的类型是2表示采用原来的48小时逻辑
* 如果时间的类型是1表示在指定的时间之后进行退款
* 为了防止同一时刻的退款量太大,需要将退款的订单分散到指定的时间后半小时内
*/
public
OrderTaskReq
setAfterSalesOrderTimeOutTask
(
StoreResponse
.
Configuration
configuration
,
String
partnerId
)
{
if
(
configuration
==
null
){
if
(
configuration
==
null
){
return
null
;
return
null
;
}
}
OrderTaskReq
orderTask
;
if
((
configuration
.
getTimeTypeOfRefund
()
!=
null
&&
2
==
configuration
.
getTimeTypeOfRefund
().
intValue
()
)
||
configuration
.
getTimeTypeOfRefund
()
==
null
){
// 48小时之后
if
((
configuration
.
getTimeTypeOfRefund
()
!=
null
&&
configuration
.
getTimeTypeOfRefund
().
compareTo
(
2
)
==
0
)
||
configuration
.
getTimeTypeOfRefund
()
==
null
){
// 48小时之后
OrderTaskReq
orderTask
=
new
OrderTaskReq
();
orderTask
=
new
OrderTaskReq
();
orderTask
.
setTaskType
(
4
);
orderTask
.
setTaskType
(
4
);
orderTask
.
setTimeout
(
1
);
orderTask
.
setTimeout
(
1
);
//1000*60*60*24*2 毫秒(48小时)
//1000*60*60*24*2 毫秒(48小时)
...
@@ -574,10 +596,8 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -574,10 +596,8 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
orderTask
.
setTaskTime
(
DateUtil
.
convert2String
(
taskTime
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
));
orderTask
.
setTaskTime
(
DateUtil
.
convert2String
(
taskTime
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
));
//处理时间,当前时间加48小时减1分钟
//处理时间,当前时间加48小时减1分钟
orderTask
.
setProcessingTime
(
DateUtil
.
convert2String
(
processingDate
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
));
orderTask
.
setProcessingTime
(
DateUtil
.
convert2String
(
processingDate
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
));
}
else
if
(
configuration
.
getTimeTypeOfRefund
()
!=
null
&&
configuration
.
getTimeTypeOfRefund
().
compareTo
(
1
)
==
0
){
// 指定时间
return
orderTask
;
orderTask
=
new
OrderTaskReq
();
}
else
if
(
configuration
.
getTimeTypeOfRefund
()
!=
null
&&
1
==
configuration
.
getTimeTypeOfRefund
().
intValue
()){
// 指定时间
OrderTaskReq
orderTask
=
new
OrderTaskReq
();
orderTask
.
setTaskType
(
4
);
orderTask
.
setTaskType
(
4
);
orderTask
.
setTimeout
(
1
);
orderTask
.
setTimeout
(
1
);
// 获取门店配置的当天指定的退款时间
// 获取门店配置的当天指定的退款时间
...
@@ -597,10 +617,84 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -597,10 +617,84 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
String
processingStr
=
DateUtil
.
convert2String
(
processingDate
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
String
processingStr
=
DateUtil
.
convert2String
(
processingDate
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
orderTask
.
setTaskTime
(
processingStr
);
orderTask
.
setTaskTime
(
processingStr
);
orderTask
.
setProcessingTime
(
processingStr
);
orderTask
.
setProcessingTime
(
processingStr
);
}
else
{
orderTask
=
null
;
}
return
orderTask
;
// fisherman [KA-20210702] 规避版本升级
if
(
orderTask
!=
null
)
{
avoidVersionUpgrade
(
orderTask
,
partnerId
);
}
}
return
null
;
return
orderTask
;
}
/**
* fisherman 规避版本升级
* 周二周四晚 23:00开始发版, 服务器会存在宕机, 延迟定时器处理时间
* 1.校验时间
* 2.校验 apollo配置商户
* @param orderTask
*/
private
void
avoidVersionUpgrade
(
OrderTaskReq
orderTask
,
String
partnerId
)
{
if
(
Objects
.
isNull
(
partnerId
))
{
return
;
}
// 时间校验
boolean
checkResult
=
checkDate
(
orderTask
);
if
(
checkResult
&&
StringUtils
.
isNotBlank
(
avoidVersionUpgradeConfig
))
{
// 读取 是否商户配置
Map
<
String
,
Integer
>
map
=
JSON
.
parseObject
(
avoidVersionUpgradeConfig
,
Map
.
class
);
if
(
map
.
containsKey
(
partnerId
))
{
Integer
addHours
=
map
.
get
(
partnerId
);
// 增加 时间
String
processingTime
=
orderTask
.
getProcessingTime
();
Date
datet
=
DateUtil
.
convert2Date
(
processingTime
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
Date
date
=
DateUtil
.
addHours
(
datet
,
addHours
);
String
resultTime
=
DateUtil
.
convert2String
(
date
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
orderTask
.
setProcessingTime
(
resultTime
);
// 显示时间一起设置
processingTime
=
orderTask
.
getProcessingTime
();
datet
=
DateUtil
.
convert2Date
(
processingTime
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
date
=
DateUtil
.
addHours
(
datet
,
addHours
);
resultTime
=
DateUtil
.
convert2String
(
date
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
orderTask
.
setTaskTime
(
resultTime
);
}
}
}
private
boolean
checkDate
(
OrderTaskReq
orderTask
)
{
// 校验 是否 周二 周四
String
processingTime
=
orderTask
.
getProcessingTime
();
Calendar
cal
=
Calendar
.
getInstance
();
Date
datet
=
DateUtil
.
convert2Date
(
processingTime
,
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
if
(
datet
==
null
)
{
return
false
;
}
cal
.
setTime
(
datet
);
int
w
=
cal
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
1
;
// 增加一个发版开关
if
(
CollectionUtils
.
isNotEmpty
(
weekDay
)
&&
weekDay
.
size
()>
0
)
{
if
(
weekDay
.
contains
(
w
))
{
// 校验时间 是否是 23:00 之后
int
hourOfDay
=
cal
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hourOfDay
>=
23
){
// 表示 设置时间为23点之后
return
true
;
}
}
}
else
{
if
(
CommonConstant
.
weekDay
.
contains
(
w
))
{
// 校验时间 是否是 23:00 之后
int
hourOfDay
=
cal
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hourOfDay
>=
23
){
// 表示 设置时间为23点之后
return
true
;
}
}
}
return
false
;
}
}
/**
/**
...
@@ -739,7 +833,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -739,7 +833,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
&&
!
ObjectUtils
.
equals
(
"0"
,
configuration
.
getAutoChargebackOrderTime
()))
{
&&
!
ObjectUtils
.
equals
(
"0"
,
configuration
.
getAutoChargebackOrderTime
()))
{
request
.
setTimeOut
(
AutoOrderConfigTime
.
getTime
(
configuration
.
getAutoChargebackOrderTime
()));
request
.
setTimeOut
(
AutoOrderConfigTime
.
getTime
(
configuration
.
getAutoChargebackOrderTime
()));
}
}
OrderTaskReq
orderTask
=
setAfterSalesOrderTimeOutTask
(
configuration
);
OrderTaskReq
orderTask
=
setAfterSalesOrderTimeOutTask
(
configuration
,
cancelOrderRequest
.
getPartnerId
()
);
request
.
setOrderTask
(
orderTask
);
request
.
setOrderTask
(
orderTask
);
}
}
request
.
setRefundDeliveryAmount
(
cancelOrderRequest
.
isRefundDeliveryAmount
());
request
.
setRefundDeliveryAmount
(
cancelOrderRequest
.
isRefundDeliveryAmount
());
...
...
order-application-service/src/main/java/cn/freemud/controller/OrderController.java
View file @
29710b8d
...
@@ -410,5 +410,6 @@ public class OrderController {
...
@@ -410,5 +410,6 @@ public class OrderController {
orderReportJobHandler
.
sendYesterDayStoreMsg
();
orderReportJobHandler
.
sendYesterDayStoreMsg
();
return
ResponseUtil
.
success
();
return
ResponseUtil
.
success
();
}
}
}
}
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