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
9e1d9004
Commit
9e1d9004
authored
Jul 05, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开发 售后单推迟
Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent
d0634eb0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
9 deletions
+102
-9
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
+74
-6
order-application-service/src/main/java/cn/freemud/controller/OrderController.java
+9
-3
No files found.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/constant/CommonConstant.java
0 → 100644
View file @
9e1d9004
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 @
9e1d9004
...
@@ -59,6 +59,7 @@ import com.freemud.application.sdk.api.structure.MessageCenterType;
...
@@ -59,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.*
;
...
@@ -75,6 +76,7 @@ import org.apache.commons.collections4.CollectionUtils;
...
@@ -75,6 +76,7 @@ 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
;
...
@@ -123,6 +125,13 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -123,6 +125,13 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
@Autowired
@Autowired
private
OfflineCouponSdkService
offlineCouponSdkService
;
private
OfflineCouponSdkService
offlineCouponSdkService
;
/**
* 规避 发版时间配置的双虎
*/
@Value
(
"${avoid.version.upgrade.config:}"
)
private
String
avoidVersionUpgradeConfig
;
@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
());
...
@@ -543,7 +552,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -543,7 +552,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
);
...
@@ -556,12 +565,23 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -556,12 +565,23 @@ 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
;
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小时之后
orderTask
=
new
OrderTaskReq
();
orderTask
=
new
OrderTaskReq
();
orderTask
.
setTaskType
(
4
);
orderTask
.
setTaskType
(
4
);
orderTask
.
setTimeout
(
1
);
orderTask
.
setTimeout
(
1
);
...
@@ -573,7 +593,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -573,7 +593,7 @@ 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
&&
1
==
configuration
.
getTimeTypeOfRefund
().
intValue
()
){
// 指定时间
}
else
if
(
configuration
.
getTimeTypeOfRefund
()
!=
null
&&
configuration
.
getTimeTypeOfRefund
().
compareTo
(
1
)
==
0
){
// 指定时间
orderTask
=
new
OrderTaskReq
();
orderTask
=
new
OrderTaskReq
();
orderTask
.
setTaskType
(
4
);
orderTask
.
setTaskType
(
4
);
orderTask
.
setTimeout
(
1
);
orderTask
.
setTimeout
(
1
);
...
@@ -600,7 +620,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -600,7 +620,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
// fisherman [KA-20210702] 规避版本升级
// fisherman [KA-20210702] 规避版本升级
if
(
orderTask
!=
null
)
{
if
(
orderTask
!=
null
)
{
avoidVersionUpgrade
(
orderTask
);
avoidVersionUpgrade
(
orderTask
,
partnerId
);
}
}
return
null
;
return
null
;
}
}
...
@@ -612,8 +632,56 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -612,8 +632,56 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
* 2.校验 apollo配置商户
* 2.校验 apollo配置商户
* @param orderTask
* @param orderTask
*/
*/
private
void
avoidVersionUpgrade
(
OrderTaskReq
orderTask
)
{
private
void
avoidVersionUpgrade
(
OrderTaskReq
orderTask
,
String
partnerId
)
{
ApiLog
.
info
(
"fisherman 发版时间 设置"
);
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
(
CommonConstant
.
weekDay
.
contains
(
w
))
{
// 校验时间 是否是 23:00 之后
int
hourOfDay
=
cal
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hourOfDay
>=
23
){
// 表示 设置时间为23点之后
return
true
;
}
}
return
false
;
}
}
/**
/**
...
@@ -752,7 +820,7 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -752,7 +820,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 @
9e1d9004
...
@@ -29,9 +29,7 @@ import cn.freemud.utils.ResponseUtil;
...
@@ -29,9 +29,7 @@ import cn.freemud.utils.ResponseUtil;
import
cn.freemud.xxljob.OrderCountJobHandler
;
import
cn.freemud.xxljob.OrderCountJobHandler
;
import
com.freemud.application.sdk.api.log.ApiAnnotation
;
import
com.freemud.application.sdk.api.log.ApiAnnotation
;
import
com.freemud.application.sdk.api.log.LogParams
;
import
com.freemud.application.sdk.api.log.LogParams
;
import
com.freemud.application.sdk.api.ordercenter.request.OrderCountReqs
;
import
com.freemud.sdk.api.assortment.order.service.order.OrderCenterSdkServiceImpl
;
import
com.freemud.application.sdk.api.ordercenter.response.OrderCountResp
;
import
com.freemud.application.sdk.api.ordercenter.service.OrderSdkService
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -411,5 +409,13 @@ public class OrderController {
...
@@ -411,5 +409,13 @@ public class OrderController {
orderReportJobHandler
.
sendYesterDayStoreMsg
();
orderReportJobHandler
.
sendYesterDayStoreMsg
();
return
ResponseUtil
.
success
();
return
ResponseUtil
.
success
();
}
}
@Autowired
OrderCenterSdkServiceImpl
orderCenterSdkService
;
@GetMapping
(
"/test"
)
public
BaseResponse
test
()
{
orderCenterSdkService
.
setAfterSalesOrderTimeOutTask
(
null
,
null
);
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