aa
This commit is contained in:
@@ -1167,7 +1167,8 @@ func GetDeliveryDetail(ctx *jxcontext.Context, vendorWaybillID string) (queryDyn
|
||||
|
||||
func GetAllDeliveryDetail(ctx *jxcontext.Context, vendorWaybillID, comType string) (result interface{}, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
db = dao.GetDB()
|
||||
getWaybillDetailInfoResult = &txcloudapi.GetWaybillDetailInfoResult{}
|
||||
)
|
||||
jobOrder := &model.JobOrder{
|
||||
VendorWaybillID: vendorWaybillID,
|
||||
@@ -1176,20 +1177,22 @@ func GetAllDeliveryDetail(ctx *jxcontext.Context, vendorWaybillID, comType strin
|
||||
if jobOrder == nil {
|
||||
return result, fmt.Errorf("运单号有误,无法查询!")
|
||||
}
|
||||
if jobOrder.WaybillStatus == model.OrderStatusFinished {
|
||||
return jobOrder.WaybillInfo, err
|
||||
if jobOrder.WaybillStatus >= model.OrderStatusFinished {
|
||||
json.Unmarshal([]byte(jobOrder.WaybillInfo), &getWaybillDetailInfoResult)
|
||||
return getWaybillDetailInfoResult, err
|
||||
}
|
||||
if jobOrder.WaybillQueryTime != utils.ZeroTimeValue {
|
||||
if time.Now().Sub(jobOrder.WaybillQueryTime) <= time.Hour*12 {
|
||||
return jobOrder.WaybillInfo, err
|
||||
json.Unmarshal([]byte(jobOrder.WaybillInfo), &getWaybillDetailInfoResult)
|
||||
return getWaybillDetailInfoResult, err
|
||||
}
|
||||
}
|
||||
getWaybillDetailInfoResult, err := api.TxAPI.GetWaybillDetailInfo(vendorWaybillID, comType)
|
||||
getWaybillDetailInfoResult, err = api.TxAPI.GetWaybillDetailInfo(vendorWaybillID, comType)
|
||||
jobOrder.WaybillQueryTime = time.Now()
|
||||
if waybillInfo, err := json.Marshal(getWaybillDetailInfoResult); err == nil {
|
||||
jobOrder.WaybillInfo = string(waybillInfo)
|
||||
}
|
||||
if getWaybillDetailInfoResult.State == utils.Int2Str(txcloudapi.StatusFinished) {
|
||||
if getWaybillDetailInfoResult.State == utils.Int2Str(txcloudapi.StatusFinished) && jobOrder.WaybillStatus < model.OrderStatusFinished {
|
||||
jobOrder.WaybillStatus = model.OrderStatusFinished
|
||||
}
|
||||
dao.UpdateEntity(db, jobOrder, "WaybillQueryTime", "WaybillInfo", "WaybillStatus")
|
||||
|
||||
Reference in New Issue
Block a user