Commit dafca3c5 by mushishixian

专营品牌判断问题

parent c5907a5f
...@@ -130,7 +130,7 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a ...@@ -130,7 +130,7 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
if checkData.SupplierId == 17 { if checkData.SupplierId == 17 {
if as.CheckCanal(checkData.Canal, activity) { if as.CheckCanal(checkData.Canal, activity) {
//品牌不为空,还要去判断品牌,是同时满足的关系 //品牌不为空,还要去判断品牌,是同时满足的关系
if activity.BrandIds != "" { if activity.StandardBrandIds != "" {
//判断是否是搞活动的品牌 //判断是否是搞活动的品牌
if as.CheckStandardBrand(checkData.StandardBrandId, activity) { if as.CheckStandardBrand(checkData.StandardBrandId, activity) {
hasActivity = true hasActivity = true
...@@ -144,13 +144,13 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a ...@@ -144,13 +144,13 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
} else if checkData.SupplierId == 10000 { } else if checkData.SupplierId == 10000 {
//自营活动特殊判断 //自营活动特殊判断
//判断活动指定的渠道编码,品牌,分类id,如果都为空,那么这个活动可以理解为整个供应商了,上面的排除已经会提前去判断了 //判断活动指定的渠道编码,品牌,分类id,如果都为空,那么这个活动可以理解为整个供应商了,上面的排除已经会提前去判断了
if activity.BrandIds == "" && activity.ClassIds == "" { if activity.StandardBrandIds == "" && activity.ClassIds == "" {
hasActivity = true hasActivity = true
goto INFO goto INFO
} }
if as.CheckClass(checkData.ClassId, activity) { if as.CheckClass(checkData.ClassId, activity) {
//品牌不为空,还要去判断品牌,是同时满足的关系 //品牌不为空,还要去判断品牌,是同时满足的关系
if activity.BrandIds != "" { if activity.StandardBrandIds != "" {
//判断是否是搞活动的品牌 //判断是否是搞活动的品牌
if as.CheckStandardBrand(checkData.StandardBrandId, activity) { if as.CheckStandardBrand(checkData.StandardBrandId, activity) {
hasActivity = true hasActivity = true
......
...@@ -2,7 +2,6 @@ package service ...@@ -2,7 +2,6 @@ package service
import ( import (
"encoding/json" "encoding/json"
"fmt"
"go_sku_server/model" "go_sku_server/model"
c "go_sku_server/pkg/common" c "go_sku_server/pkg/common"
"go_sku_server/pkg/gredis" "go_sku_server/pkg/gredis"
...@@ -300,7 +299,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -300,7 +299,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
} }
sku.DiscountRatio.Ratio = cnDiscountRatio sku.DiscountRatio.Ratio = cnDiscountRatio
sku.DiscountRatio.RatioUsd = usDiscountRatio sku.DiscountRatio.RatioUsd = usDiscountRatio
fmt.Println("折扣系数 : ", cnDiscountRatio, usDiscountRatio)
//再去找售价组系数 //再去找售价组系数
//找一个标志位,因为默认的全局折扣系数的数据格式和非全局的是不一样的 //找一个标志位,因为默认的全局折扣系数的数据格式和非全局的是不一样的
...@@ -378,7 +376,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -378,7 +376,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if eccns != "" { if eccns != "" {
hasSpecialCheck = true hasSpecialCheck = true
eccnList := strings.Split(eccns, ",") eccnList := strings.Split(eccns, ",")
fmt.Println(eccnList)
//找到有对应的eccn,那么优先级肯定是最高的了 //找到有对应的eccn,那么优先级肯定是最高的了
for _, eccn := range eccnList { for _, eccn := range eccnList {
//判断是否有百分号匹配 //判断是否有百分号匹配
...@@ -390,36 +387,28 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -390,36 +387,28 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
hasPrefix := strings.HasPrefix(eccn, "%") hasPrefix := strings.HasPrefix(eccn, "%")
hasSuffix := strings.HasSuffix(eccn, "%") hasSuffix := strings.HasSuffix(eccn, "%")
if hasPrefix && hasSuffix { if hasPrefix && hasSuffix {
fmt.Println("前后匹配")
eccn = strings.Replace(eccn, "%", "", 10) eccn = strings.Replace(eccn, "%", "", 10)
if strings.Contains(sku.Eccn, eccn) { if strings.Contains(sku.Eccn, eccn) {
fmt.Println("前后匹配到")
findedRatio = true findedRatio = true
break outerLoop break outerLoop
} }
} }
if hasPrefix && !hasSuffix { if hasPrefix && !hasSuffix {
fmt.Println("前匹配")
eccn = strings.Replace(eccn, "%", "", 10) eccn = strings.Replace(eccn, "%", "", 10)
fmt.Println(sku.Eccn, eccn)
if strings.HasSuffix(sku.Eccn, eccn) { if strings.HasSuffix(sku.Eccn, eccn) {
fmt.Println("前匹配到")
findedRatio = true findedRatio = true
break outerLoop break outerLoop
} }
} }
if !hasPrefix && hasSuffix { if !hasPrefix && hasSuffix {
fmt.Println("后匹配")
eccn = strings.Replace(eccn, "%", "", 10) eccn = strings.Replace(eccn, "%", "", 10)
if strings.HasPrefix(sku.Eccn, eccn) { if strings.HasPrefix(sku.Eccn, eccn) {
fmt.Println("后匹配到")
findedRatio = true findedRatio = true
break outerLoop break outerLoop
} }
} }
} else { } else {
if sku.Eccn == eccn { if sku.Eccn == eccn {
fmt.Println("全匹配")
findedRatio = true findedRatio = true
break outerLoop break outerLoop
} }
...@@ -449,7 +438,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -449,7 +438,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
} }
sku.PriceRatio = priceRatioList sku.PriceRatio = priceRatioList
sku.PriceRatioSort = priceRatioSort sku.PriceRatioSort = priceRatioSort
fmt.Println("售价组系数 : ", priceRatioList)
//这里是供应商系数,先保留这块逻辑 //这里是供应商系数,先保留这块逻辑
ratio, _ := redis.String(redisCon.Do("HGET", "pool_supplier_ratio", sku.SupplierId)) ratio, _ := redis.String(redisCon.Do("HGET", "pool_supplier_ratio", sku.SupplierId))
...@@ -501,7 +489,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -501,7 +489,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if !hasCoefficient { if !hasCoefficient {
coefficient = defaultCoefficient coefficient = defaultCoefficient
} }
fmt.Println("供应商系数 : ", coefficient)
//下面是计算价格 //下面是计算价格
//价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk //价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk
...@@ -517,7 +504,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -517,7 +504,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
Purchases: price.Purchases, Purchases: price.Purchases,
PriceCn: price.PriceCn, PriceCn: price.PriceCn,
}) })
fmt.Println(originalPrice)
if price.Purchases == 0 { if price.Purchases == 0 {
continue continue
} }
...@@ -535,33 +521,26 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku { ...@@ -535,33 +521,26 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if margin < 0 { if margin < 0 {
margin = 0 margin = 0
} }
fmt.Println(key + margin)
priceRatio = priceRatioList[key+margin] priceRatio = priceRatioList[key+margin]
} else if key >= ratioCount { } else if key >= ratioCount {
priceRatio = priceRatioList[ratioCount-1] priceRatio = priceRatioList[ratioCount-1]
fmt.Println("超过了售价利润组的9个,取到的售价组是 : ", priceRatio)
} else { } else {
priceRatio = model.PriceRatio{ priceRatio = model.PriceRatio{
Ratio: 1, Ratio: 1,
RatioUsd: 1, RatioUsd: 1,
} }
} }
fmt.Println("当前循环售价组 : ", priceRatio)
//美金成本价 //美金成本价
priceCostUs := c.MulFloat(price.PriceUs, usDiscountRatio) priceCostUs := c.MulFloat(price.PriceUs, usDiscountRatio)
priceCostUs = c.MyRound(priceCostUs, 4) priceCostUs = c.MyRound(priceCostUs, 4)
fmt.Println("美金成本价 :", priceCostUs)
//美金售价 //美金售价
priceUs := c.MulFloat(priceCostUs, priceRatio.RatioUsd) priceUs := c.MulFloat(priceCostUs, priceRatio.RatioUsd)
fmt.Println("美金售价 :", priceUs)
//人民币成本价 //人民币成本价
priceCostCn := c.MulFloat(price.PriceUs, coefficient.Ratio, tax) priceCostCn := c.MulFloat(price.PriceUs, coefficient.Ratio, tax)
priceCostCn = c.MulFloat(c.MyRound(priceCostCn, 4), cnDiscountRatio) priceCostCn = c.MulFloat(c.MyRound(priceCostCn, 4), cnDiscountRatio)
priceCostCn = c.MyRound(priceCostCn, 4) priceCostCn = c.MyRound(priceCostCn, 4)
fmt.Println("人民币成本价 :", priceCostCn)
//人民币售价 //人民币售价
priceCn := c.MulFloat(priceCostCn, priceRatio.Ratio) priceCn := c.MulFloat(priceCostCn, priceRatio.Ratio)
fmt.Println("人民币售价 :", priceCn)
data[key].PriceUs = c.MyRound(priceUs, 4) data[key].PriceUs = c.MyRound(priceUs, 4)
data[key].PriceCostUs = priceCostUs data[key].PriceCostUs = priceCostUs
//处理人民币 //处理人民币
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment