解决冲突

This commit is contained in:
苏尹岚
2020-05-14 14:35:33 +08:00
4 changed files with 14 additions and 3 deletions

View File

@@ -387,7 +387,7 @@ func (c *OrderManager) updateOrderSkuOtherInfo(order *model.GoodsOrder, db *dao.
storeID = order.StoreID
}
result, err := dao.GetEffectiveActStoreSkuInfo2(db, 0, []int{order.VendorID}, []int{model.ActSkuSecKill, model.ActSkuDirectDown}, []int{storeID}, []int{v.SkuID}, order.OrderCreatedAt, order.OrderCreatedAt)
if len(result) > 0 && err == nil {
if (len(result) > 0 && err == nil) || v.IsVendorAct == model.YES {
if v.VendorPrice == v.SalePrice {
var earningPrice = 0
if v.ShopPrice < v.SalePrice {
@@ -710,6 +710,9 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
actList, _ := dao.QueryActs(db, actID, 0, math.MaxInt32, 0, "", -1, nil, nil, nil, 0, nil, 0, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue, utils.DefaultTimeValue)
if len(actList.Data) > 0 {
orderList, _ = dao.QueryOrders(db, vendorOrderID, actID, vendorIDs, storeID, actList.Data[0].BeginAt, actList.Data[0].EndAt)
if len(orderList) == 0 {
return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("未查询到相关订单!开始时间:[%v],结束时间:[%v]", actList.Data[0].BeginAt, actList.Data[0].EndAt))
}
} else {
return "", model.ErrCodeGeneralFailed, errors.New(fmt.Sprintf("未查询到相关结算活动活动ID[%d]", actID))
}
@@ -735,6 +738,7 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
task := tasksch.NewParallelTask("刷新历史订单结算价", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
order := batchItemList[0].(*model.GoodsOrder)
fmt.Println("test333333333333333333333333333333", order.VendorOrderID)
db := dao.GetDB()
updateSingleOrderEarningPrice(order, db)
dao.Begin(db)

View File

@@ -154,7 +154,7 @@ type OrderSku struct {
SkuType int `json:"skuType"` // 当前如果为gift就为1否则缺省为0
PromotionType int `json:"promotionType"` // todo 当前是用于记录京东的PromotionType(生成jxorder用),没有做转换
OrderCreatedAt time.Time `orm:"type(datetime);index" json:"-"` // 分区考虑
IsVendorAct bool `orm:"-" json:"-"` //用于区分是否在平台上有活动,且需要按新规则填结算价
IsVendorAct int `json:"isVendorAct"`
}
// 同样商品在一个订单中可能重复出现(比如搞活动时,相同商品价格不一样,第一个有优惠)

View File

@@ -232,6 +232,7 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
}
ignoreSkuMap := make(map[int]int)
// detail := result["detail"].([]interface{})
multiSkuMap := make(map[int]int)
for _, product := range detail {
// product := product2.(map[string]interface{})
skuName := product["food_name"].(string)
@@ -264,6 +265,12 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
// sku.SkuType = 1
// }
order.Skus = append(order.Skus, sku)
multiSkuMap[sku.SkuID]++
}
for _, v := range order.Skus {
if multiSkuMap[v.SkuID] > 1 && v.SalePrice == v.VendorPrice {
v.IsVendorAct = model.YES
}
}
jxutils.RefreshOrderSkuRelated(order)

View File

@@ -101,7 +101,7 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas
if len(storeSkuList) == 1 {
storeSku := storeSkuList[0]
result, err := api.YinBaoAPI.QueryProductByBarcode(storeSku.VendorSkuID)
if err != nil {
if err != nil || result == nil {
return nil, err
}
resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(result.Barcode)