Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
kaopu-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
1582f881
authored
Dec 17, 2019
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.0
parent
aea3f4cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
internal/dao/dong_mod.go
internal/dao/dong_mod.go
View file @
1582f881
...
...
@@ -29,6 +29,13 @@ const (
_sql5
=
"select sum(final_score) sum_dong_score from lie_scores where type=2 and com_credits_id=%d and month in(%s)"
;
//总计动态信用分
_sql6
=
"select * from lie_basic_month where erp_company_code='%s' and month in(%s)"
//获取详情
_sql7
=
"SELECT ((t.my_rate+1)/(t.plat_rate+1))-1 as delay_rate FROM "
+
"( "
+
"SELECT "
+
" (SELECT sum(delay_amount)/sum(receive_amount) from lie_basic_month where erp_company_code = '%s' and MONTH in (%s)) my_rate, "
+
" (SELECT sum(delay_amount)/sum(receive_amount) from lie_basic_month where MONTH in (%s)) plat_rate "
+
")t "
)
/*
...
...
@@ -40,7 +47,6 @@ func (d *dao) DongRate(ctx context.Context,y map[string]string,modelItems []map[
score_one
float64
=
0
;
//对应梯度分数
s1
,
s2
string
//拼接六个月月份字符串
)
sqla
:=
fmt
.
Sprintf
(
_sql4
,
y
[
"erp_company_code"
],
month_six
)
c1
,
_
:=
d
.
QueryOne
(
ctx
,
1
,
sqla
)
...
...
@@ -69,17 +75,26 @@ func (d *dao) DongRate(ctx context.Context,y map[string]string,modelItems []map[
case
43
:
//9 退货率 : 退货总金额/出库总金额(下单总金额) PS退货总金额金额为负数的订单
s1
=
c1
[
"return_amount"
]
s2
=
c1
[
"unload_amount"
]
case
44
:
//近6个月逾期变化率
sql7
:=
fmt
.
Sprintf
(
_sql7
,
y
[
"erp_company_code"
],
month_six
,
month_six
)
c3
,
_
:=
d
.
QueryOne
(
ctx
,
1
,
sql7
)
if
c3
[
"delay_rate"
]
==
""
{
c3
[
"delay_rate"
]
=
"0"
}
ladder_rate
=
logic
.
MyFloat64
(
c3
[
"delay_rate"
]);
remark
=
c3
[
"delay_rate"
]
case
48
:
// 账期使用倍数统计
last_month
:=
time
.
Now
()
.
Format
(
"2006"
)
+
time
.
Now
()
.
AddDate
(
0
,
-
1
,
0
)
.
Format
(
"01"
)
sql6
:=
fmt
.
Sprintf
(
_sql4
,
y
[
"erp_company_code"
],
last_month
)
c3
,
_
:=
d
.
QueryOne
(
ctx
,
1
,
sql6
)
if
c3
[
"period_use_times_six"
]
==
""
{
logic
.
LogWrite
(
"账期使用倍数为空:"
+
y
[
"erp_company_code"
],
"dong_error"
,
1
)
return
c3
[
"period_use_times_six"
]
=
"0"
;
}
ladder_rate
=
logic
.
MyFloat64
(
c3
[
"period_use_times_six"
]);
//六个月的账期使用倍数
remark
=
c3
[
"period_use_times_six"
]
}
if
project_id
!=
48
{
if
project_id
!=
48
&&
project_id
!=
44
{
if
s1
==
""
||
s2
==
""
{
logic
.
LogWrite
(
"没有订单数据跳过:"
+
y
[
"erp_company_code"
],
"dong_error"
,
1
)
return
...
...
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