Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
dafca3c5
authored
Mar 27, 2023
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
专营品牌判断问题
parent
c5907a5f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
24 deletions
service/service_activity.go
service/service_ly_common.go
service/service_activity.go
View file @
dafca3c5
...
...
@@ -130,7 +130,7 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
if
checkData
.
SupplierId
==
17
{
if
as
.
CheckCanal
(
checkData
.
Canal
,
activity
)
{
//品牌不为空,还要去判断品牌,是同时满足的关系
if
activity
.
BrandIds
!=
""
{
if
activity
.
Standard
BrandIds
!=
""
{
//判断是否是搞活动的品牌
if
as
.
CheckStandardBrand
(
checkData
.
StandardBrandId
,
activity
)
{
hasActivity
=
true
...
...
@@ -144,13 +144,13 @@ func (as *ActivityService) GetPriceActivity(checkData model.ActivityCheckData, a
}
else
if
checkData
.
SupplierId
==
10000
{
//自营活动特殊判断
//判断活动指定的渠道编码,品牌,分类id,如果都为空,那么这个活动可以理解为整个供应商了,上面的排除已经会提前去判断了
if
activity
.
BrandIds
==
""
&&
activity
.
ClassIds
==
""
{
if
activity
.
Standard
BrandIds
==
""
&&
activity
.
ClassIds
==
""
{
hasActivity
=
true
goto
INFO
}
if
as
.
CheckClass
(
checkData
.
ClassId
,
activity
)
{
//品牌不为空,还要去判断品牌,是同时满足的关系
if
activity
.
BrandIds
!=
""
{
if
activity
.
Standard
BrandIds
!=
""
{
//判断是否是搞活动的品牌
if
as
.
CheckStandardBrand
(
checkData
.
StandardBrandId
,
activity
)
{
hasActivity
=
true
...
...
service/service_ly_common.go
View file @
dafca3c5
...
...
@@ -2,7 +2,6 @@ package service
import
(
"encoding/json"
"fmt"
"go_sku_server/model"
c
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
...
...
@@ -300,7 +299,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
sku
.
DiscountRatio
.
Ratio
=
cnDiscountRatio
sku
.
DiscountRatio
.
RatioUsd
=
usDiscountRatio
fmt
.
Println
(
"折扣系数 : "
,
cnDiscountRatio
,
usDiscountRatio
)
//再去找售价组系数
//找一个标志位,因为默认的全局折扣系数的数据格式和非全局的是不一样的
...
...
@@ -378,7 +376,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if
eccns
!=
""
{
hasSpecialCheck
=
true
eccnList
:=
strings
.
Split
(
eccns
,
","
)
fmt
.
Println
(
eccnList
)
//找到有对应的eccn,那么优先级肯定是最高的了
for
_
,
eccn
:=
range
eccnList
{
//判断是否有百分号匹配
...
...
@@ -390,36 +387,28 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
hasPrefix
:=
strings
.
HasPrefix
(
eccn
,
"%"
)
hasSuffix
:=
strings
.
HasSuffix
(
eccn
,
"%"
)
if
hasPrefix
&&
hasSuffix
{
fmt
.
Println
(
"前后匹配"
)
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
Contains
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"前后匹配到"
)
findedRatio
=
true
break
outerLoop
}
}
if
hasPrefix
&&
!
hasSuffix
{
fmt
.
Println
(
"前匹配"
)
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
fmt
.
Println
(
sku
.
Eccn
,
eccn
)
if
strings
.
HasSuffix
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"前匹配到"
)
findedRatio
=
true
break
outerLoop
}
}
if
!
hasPrefix
&&
hasSuffix
{
fmt
.
Println
(
"后匹配"
)
eccn
=
strings
.
Replace
(
eccn
,
"%"
,
""
,
10
)
if
strings
.
HasPrefix
(
sku
.
Eccn
,
eccn
)
{
fmt
.
Println
(
"后匹配到"
)
findedRatio
=
true
break
outerLoop
}
}
}
else
{
if
sku
.
Eccn
==
eccn
{
fmt
.
Println
(
"全匹配"
)
findedRatio
=
true
break
outerLoop
}
...
...
@@ -449,7 +438,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
}
sku
.
PriceRatio
=
priceRatioList
sku
.
PriceRatioSort
=
priceRatioSort
fmt
.
Println
(
"售价组系数 : "
,
priceRatioList
)
//这里是供应商系数,先保留这块逻辑
ratio
,
_
:=
redis
.
String
(
redisCon
.
Do
(
"HGET"
,
"pool_supplier_ratio"
,
sku
.
SupplierId
))
...
...
@@ -501,7 +489,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if
!
hasCoefficient
{
coefficient
=
defaultCoefficient
}
fmt
.
Println
(
"供应商系数 : "
,
coefficient
)
//下面是计算价格
//价格计算文档 https://docs.qq.com/doc/DR3RJcnNPeUNkWHRk
...
...
@@ -517,7 +504,6 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
Purchases
:
price
.
Purchases
,
PriceCn
:
price
.
PriceCn
,
})
fmt
.
Println
(
originalPrice
)
if
price
.
Purchases
==
0
{
continue
}
...
...
@@ -535,33 +521,26 @@ func (ls *LyService) GetCoefficientAndPrice(sku model.LySku) model.LySku {
if
margin
<
0
{
margin
=
0
}
fmt
.
Println
(
key
+
margin
)
priceRatio
=
priceRatioList
[
key
+
margin
]
}
else
if
key
>=
ratioCount
{
priceRatio
=
priceRatioList
[
ratioCount
-
1
]
fmt
.
Println
(
"超过了售价利润组的9个,取到的售价组是 : "
,
priceRatio
)
}
else
{
priceRatio
=
model
.
PriceRatio
{
Ratio
:
1
,
RatioUsd
:
1
,
}
}
fmt
.
Println
(
"当前循环售价组 : "
,
priceRatio
)
//美金成本价
priceCostUs
:=
c
.
MulFloat
(
price
.
PriceUs
,
usDiscountRatio
)
priceCostUs
=
c
.
MyRound
(
priceCostUs
,
4
)
fmt
.
Println
(
"美金成本价 :"
,
priceCostUs
)
//美金售价
priceUs
:=
c
.
MulFloat
(
priceCostUs
,
priceRatio
.
RatioUsd
)
fmt
.
Println
(
"美金售价 :"
,
priceUs
)
//人民币成本价
priceCostCn
:=
c
.
MulFloat
(
price
.
PriceUs
,
coefficient
.
Ratio
,
tax
)
priceCostCn
=
c
.
MulFloat
(
c
.
MyRound
(
priceCostCn
,
4
),
cnDiscountRatio
)
priceCostCn
=
c
.
MyRound
(
priceCostCn
,
4
)
fmt
.
Println
(
"人民币成本价 :"
,
priceCostCn
)
//人民币售价
priceCn
:=
c
.
MulFloat
(
priceCostCn
,
priceRatio
.
Ratio
)
fmt
.
Println
(
"人民币售价 :"
,
priceCn
)
data
[
key
]
.
PriceUs
=
c
.
MyRound
(
priceUs
,
4
)
data
[
key
]
.
PriceCostUs
=
priceCostUs
//处理人民币
...
...
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