fix: 1.时间不传时,默认30d内 2.解析后的时间格式异常,时间置为空 3.售后金额为空时,默认订单金额
This commit is contained in:
parent
aba8a18900
commit
3510be1db7
|
|
@ -112,6 +112,14 @@ func (t *OrderAfterSaleResellerTool) Execute(ctx context.Context, requireData *e
|
||||||
if len(req.OrderNumber) == 0 && len(req.Account) == 0 {
|
if len(req.OrderNumber) == 0 && len(req.Account) == 0 {
|
||||||
return fmt.Errorf("订单号 和 充值账号 不能同时为空")
|
return fmt.Errorf("订单号 和 充值账号 不能同时为空")
|
||||||
}
|
}
|
||||||
|
// 时间格式不匹配,直接置为空
|
||||||
|
if req.SerialCreateTime != "" {
|
||||||
|
_, err := time.ParseInLocation(time.DateTime, req.SerialCreateTime, time.Local)
|
||||||
|
if err != nil {
|
||||||
|
entitys.ResLog(requireData.Ch, t.Name(), "时间格式不匹配,已置为空")
|
||||||
|
req.SerialCreateTime = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
entitys.ResLog(requireData.Ch, t.Name(), "正在拉取售后订单信息")
|
entitys.ResLog(requireData.Ch, t.Name(), "正在拉取售后订单信息")
|
||||||
|
|
||||||
|
|
@ -119,19 +127,21 @@ func (t *OrderAfterSaleResellerTool) Execute(ctx context.Context, requireData *e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *OrderAfterSaleResellerTool) checkOrderAfterSaleReseller(toolReq OrderAfterSaleResellerRequest, requireData *entitys.RequireData) error {
|
func (t *OrderAfterSaleResellerTool) checkOrderAfterSaleReseller(toolReq OrderAfterSaleResellerRequest, requireData *entitys.RequireData) error {
|
||||||
// 流水创建时间上下浮动10min
|
var serialStartTime, serialEndTime int64
|
||||||
serialCreateTime := time.Now()
|
|
||||||
var err error
|
|
||||||
if toolReq.SerialCreateTime != "" {
|
if toolReq.SerialCreateTime != "" {
|
||||||
serialCreateTime, err = time.ParseInLocation(time.DateTime, toolReq.SerialCreateTime, time.Local)
|
// 流水创建时间上下浮动10min
|
||||||
|
serialCreateTime, err := time.ParseInLocation(time.DateTime, toolReq.SerialCreateTime, time.Local)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
serialStartTime = serialCreateTime.Unix() - 10*60
|
||||||
|
serialEndTime = serialCreateTime.Unix() + 10*60
|
||||||
|
} else {
|
||||||
|
// 未指定流水创建时间,默认30天内
|
||||||
|
serialEndTime = time.Now().Unix()
|
||||||
|
serialStartTime = serialEndTime - 60*60*24*30 // 30天内
|
||||||
}
|
}
|
||||||
|
|
||||||
serialStartTime := serialCreateTime.Unix() - 10*60
|
|
||||||
serialEndTime := serialCreateTime.Unix() + 10*60
|
|
||||||
|
|
||||||
// 账号数量超过10直接截断
|
// 账号数量超过10直接截断
|
||||||
if len(toolReq.Account) > 10 {
|
if len(toolReq.Account) > 10 {
|
||||||
entitys.ResLog(requireData.Ch, t.Name(), "账号数量超过10已被截断")
|
entitys.ResLog(requireData.Ch, t.Name(), "账号数量超过10已被截断")
|
||||||
|
|
@ -144,6 +154,7 @@ func (t *OrderAfterSaleResellerTool) checkOrderAfterSaleReseller(toolReq OrderAf
|
||||||
|
|
||||||
// 最终输出
|
// 最终输出
|
||||||
var orderList []*OrderAfterSaleResellerData
|
var orderList []*OrderAfterSaleResellerData
|
||||||
|
var err error
|
||||||
|
|
||||||
// 多订单号
|
// 多订单号
|
||||||
if len(toolReq.OrderNumber) > 0 {
|
if len(toolReq.OrderNumber) > 0 {
|
||||||
|
|
@ -245,6 +256,11 @@ func (t *OrderAfterSaleResellerTool) getAfterSaleResellerList(headers map[string
|
||||||
if responsibleType == 0 {
|
if responsibleType == 0 {
|
||||||
responsibleType = 4 // 默认无
|
responsibleType = 4 // 默认无
|
||||||
}
|
}
|
||||||
|
// 售后金额
|
||||||
|
afterSalesPrice := util.StringToFloat64(originInput.AfterSalesPrice)
|
||||||
|
if afterSalesPrice == 0 {
|
||||||
|
afterSalesPrice = item.OrderPrice
|
||||||
|
}
|
||||||
|
|
||||||
orderList = append(orderList, &OrderAfterSaleResellerData{
|
orderList = append(orderList, &OrderAfterSaleResellerData{
|
||||||
OrderType: item.OrderType,
|
OrderType: item.OrderType,
|
||||||
|
|
@ -261,7 +277,7 @@ func (t *OrderAfterSaleResellerTool) getAfterSaleResellerList(headers map[string
|
||||||
Platforms: item.Platforms,
|
Platforms: item.Platforms,
|
||||||
AfterType: afterType,
|
AfterType: afterType,
|
||||||
Remark: originInput.AfterSalesReason,
|
Remark: originInput.AfterSalesReason,
|
||||||
AfterAmount: util.StringToFloat64(originInput.AfterSalesPrice),
|
AfterAmount: afterSalesPrice,
|
||||||
ResponsibleType: responsibleType,
|
ResponsibleType: responsibleType,
|
||||||
ResponsiblePerson: originInput.ResponsiblePerson,
|
ResponsiblePerson: originInput.ResponsiblePerson,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,11 @@ func (t *OrderAfterSaleResellerBatchTool) checkOrderAfterSaleResellerBatch(toolR
|
||||||
if responsibleType == 0 {
|
if responsibleType == 0 {
|
||||||
responsibleType = 4 // 默认无
|
responsibleType = 4 // 默认无
|
||||||
}
|
}
|
||||||
|
// 售后金额
|
||||||
|
afterSalesPrice := util.StringToFloat64(toolReq.AfterSalesPrice)
|
||||||
|
if afterSalesPrice == 0 {
|
||||||
|
afterSalesPrice = item.OrderPrice
|
||||||
|
}
|
||||||
|
|
||||||
toolResp.Data = append(toolResp.Data, &OrderAfterSaleResellerBatchData{
|
toolResp.Data = append(toolResp.Data, &OrderAfterSaleResellerBatchData{
|
||||||
OrderType: item.OrderType,
|
OrderType: item.OrderType,
|
||||||
|
|
@ -176,7 +181,7 @@ func (t *OrderAfterSaleResellerBatchTool) checkOrderAfterSaleResellerBatch(toolR
|
||||||
Platforms: item.Platforms,
|
Platforms: item.Platforms,
|
||||||
AfterType: afterType,
|
AfterType: afterType,
|
||||||
Remark: toolReq.AfterSalesReason,
|
Remark: toolReq.AfterSalesReason,
|
||||||
AfterAmount: util.StringToFloat64(toolReq.AfterSalesPrice),
|
AfterAmount: afterSalesPrice,
|
||||||
ResponsibleType: responsibleType,
|
ResponsibleType: responsibleType,
|
||||||
ResponsiblePerson: toolReq.ResponsiblePerson,
|
ResponsiblePerson: toolReq.ResponsiblePerson,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,14 @@ func (t *OrderAfterSaleSupplierTool) Execute(ctx context.Context, requireData *e
|
||||||
if len(req.SerialNumber) == 0 && len(req.Account) == 0 {
|
if len(req.SerialNumber) == 0 && len(req.Account) == 0 {
|
||||||
return fmt.Errorf("充值流水号 和 充值账号 不能同时为空")
|
return fmt.Errorf("充值流水号 和 充值账号 不能同时为空")
|
||||||
}
|
}
|
||||||
|
// 时间格式不匹配,直接置为空
|
||||||
|
if req.SerialCreateTime != "" {
|
||||||
|
_, err := time.ParseInLocation(time.DateTime, req.SerialCreateTime, time.Local)
|
||||||
|
if err != nil {
|
||||||
|
entitys.ResLog(requireData.Ch, t.Name(), "时间格式不匹配,已置为空")
|
||||||
|
req.SerialCreateTime = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
entitys.ResLog(requireData.Ch, t.Name(), "正在拉取售后订单信息")
|
entitys.ResLog(requireData.Ch, t.Name(), "正在拉取售后订单信息")
|
||||||
|
|
||||||
|
|
@ -113,17 +121,20 @@ func (t *OrderAfterSaleSupplierTool) Execute(ctx context.Context, requireData *e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *OrderAfterSaleSupplierTool) checkOrderAfterSaleSupplier(toolReq OrderAfterSaleSupplierRequest, requireData *entitys.RequireData) error {
|
func (t *OrderAfterSaleSupplierTool) checkOrderAfterSaleSupplier(toolReq OrderAfterSaleSupplierRequest, requireData *entitys.RequireData) error {
|
||||||
// 流水创建时间上下浮动10min
|
var serialStartTime, serialEndTime int64
|
||||||
serialCreateTime := time.Now()
|
|
||||||
var err error
|
|
||||||
if toolReq.SerialCreateTime != "" {
|
if toolReq.SerialCreateTime != "" {
|
||||||
serialCreateTime, err = time.ParseInLocation(time.DateTime, toolReq.SerialCreateTime, time.Local)
|
// 流水创建时间上下浮动10min
|
||||||
|
serialCreateTime, err := time.ParseInLocation(time.DateTime, toolReq.SerialCreateTime, time.Local)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
serialStartTime = serialCreateTime.Unix() - 10*60
|
||||||
|
serialEndTime = serialCreateTime.Unix() + 10*60
|
||||||
|
} else {
|
||||||
|
// 未指定流水创建时间,默认30天内
|
||||||
|
serialEndTime = time.Now().Unix()
|
||||||
|
serialStartTime = serialEndTime - 60*60*24*30 // 30天内
|
||||||
}
|
}
|
||||||
serialStartTime := serialCreateTime.Unix() - 10*60
|
|
||||||
serialEndTime := serialCreateTime.Unix() + 10*60
|
|
||||||
|
|
||||||
// 账号数量超过10直接截断
|
// 账号数量超过10直接截断
|
||||||
if len(toolReq.Account) > 10 {
|
if len(toolReq.Account) > 10 {
|
||||||
|
|
@ -137,6 +148,7 @@ func (t *OrderAfterSaleSupplierTool) checkOrderAfterSaleSupplier(toolReq OrderAf
|
||||||
|
|
||||||
// 最终输出
|
// 最终输出
|
||||||
var orderList []*OrderAfterSaleSupplierData
|
var orderList []*OrderAfterSaleSupplierData
|
||||||
|
var err error
|
||||||
|
|
||||||
// 多流水号
|
// 多流水号
|
||||||
if len(toolReq.SerialNumber) > 0 {
|
if len(toolReq.SerialNumber) > 0 {
|
||||||
|
|
@ -232,6 +244,11 @@ func (t *OrderAfterSaleSupplierTool) getAfterSaleSupplierList(headers map[string
|
||||||
if afterType == 0 {
|
if afterType == 0 {
|
||||||
afterType = 1 // 默认退款
|
afterType = 1 // 默认退款
|
||||||
}
|
}
|
||||||
|
// 售后金额
|
||||||
|
afterSalesPrice := util.StringToFloat64(originInput.AfterSalesPrice)
|
||||||
|
if afterSalesPrice == 0 {
|
||||||
|
afterSalesPrice = item.PlatformPrice
|
||||||
|
}
|
||||||
|
|
||||||
orderList = append(orderList, &OrderAfterSaleSupplierData{
|
orderList = append(orderList, &OrderAfterSaleSupplierData{
|
||||||
SerialNumber: item.SerialNumber,
|
SerialNumber: item.SerialNumber,
|
||||||
|
|
@ -245,7 +262,7 @@ func (t *OrderAfterSaleSupplierTool) getAfterSaleSupplierList(headers map[string
|
||||||
PlatformID: item.PlatformID,
|
PlatformID: item.PlatformID,
|
||||||
SignCompanyName: item.SignCompanyName,
|
SignCompanyName: item.SignCompanyName,
|
||||||
Reason: originInput.AfterSalesReason,
|
Reason: originInput.AfterSalesReason,
|
||||||
SalePrice: util.StringToFloat64(originInput.AfterSalesPrice),
|
SalePrice: afterSalesPrice,
|
||||||
SaleType: afterType,
|
SaleType: afterType,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue