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
4d408cc2
authored
Dec 04, 2019
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev' of
http://119.23.72.7/sunlong_v5/kaopu-server
into dev
parents
768f0197
b1160282
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
218 additions
and
95 deletions
cmd/static/add_score.go
cmd/static/company_info.go
cmd/static/enterprise_credit.go
cmd/static/history_bussiness.go
cmd/static/main.go
cmd/static/personal_credit.go
go.sum
internal/dao/com_credits.go
internal/dao/scores.go
internal/logic/common.go
internal/model/grade.go
internal/service/service.go
cmd/static/add_score.go
View file @
4d408cc2
...
@@ -9,7 +9,7 @@ func AddScore()(finalScore float64) {
...
@@ -9,7 +9,7 @@ func AddScore()(finalScore float64) {
)
)
for
_
,
v
:=
range
companyAddScore
{
for
_
,
v
:=
range
companyAddScore
{
sumScore
+=
s
tringTurnFloat64
(
v
[
"final_score"
])
sumScore
+=
S
tringTurnFloat64
(
v
[
"final_score"
])
joinNum
+=
1
joinNum
+=
1
}
}
...
@@ -18,7 +18,7 @@ func AddScore()(finalScore float64) {
...
@@ -18,7 +18,7 @@ func AddScore()(finalScore float64) {
insertScoreMsg
.
FinalScore
,
insertScoreMsg
.
TotalScore
,
insertScoreMsg
.
CurrentScore
=
sumScore
,
sumScore
,
sumScore
insertScoreMsg
.
FinalScore
,
insertScoreMsg
.
TotalScore
,
insertScoreMsg
.
CurrentScore
=
sumScore
,
sumScore
,
sumScore
insertScoreMsg
.
Weight
=
1
insertScoreMsg
.
Weight
=
1
s
etInsertScoreChanFooter
(
1
,
0
,
5
)
S
etInsertScoreChanFooter
(
1
,
0
,
5
)
finalScore
=
insertScoreMsg
.
FinalScore
finalScore
=
insertScoreMsg
.
FinalScore
return
finalScore
return
finalScore
}
}
...
...
cmd/static/company_info.go
View file @
4d408cc2
...
@@ -12,7 +12,7 @@ var(
...
@@ -12,7 +12,7 @@ var(
func
CompanyInfo
()(
finalScore
float64
)
{
func
CompanyInfo
()(
finalScore
float64
)
{
modelInfo
:=
getModelByProjectId
(
1
)
modelInfo
:=
getModelByProjectId
(
1
)
weight
=
s
tringTurnFloat64
(
modelInfo
[
"weight"
])
weight
=
S
tringTurnFloat64
(
modelInfo
[
"weight"
])
EstablishmentTime
()
EstablishmentTime
()
CompanyNature
()
CompanyNature
()
...
@@ -22,8 +22,8 @@ func CompanyInfo()(finalScore float64) {
...
@@ -22,8 +22,8 @@ func CompanyInfo()(finalScore float64) {
lawsuitsInPastTwoYars
()
lawsuitsInPastTwoYars
()
NumberOfSocial
()
NumberOfSocial
()
finalScore
=
setProjectScore
(
c_totalScore
,
weight
,
s
tringTurnFloat64
(
modelInfo
[
"full_score"
]))
finalScore
=
SetProjectScore
(
c_totalScore
,
weight
,
S
tringTurnFloat64
(
modelInfo
[
"full_score"
]))
s
etInsertScoreChanFooter
(
1
,
0
,
1
)
S
etInsertScoreChanFooter
(
1
,
0
,
1
)
return
finalScore
return
finalScore
}
}
...
@@ -31,8 +31,8 @@ func CompanyInfo()(finalScore float64) {
...
@@ -31,8 +31,8 @@ func CompanyInfo()(finalScore float64) {
//成立时间(1分) 大于五年1分,小于零分
//成立时间(1分) 大于五年1分,小于零分
func
EstablishmentTime
()
{
func
EstablishmentTime
()
{
establishment_time
:=
s
tringTurnInt64
(
companyBasicInfo
[
"establishment_time"
])
establishment_time
:=
S
tringTurnInt64
(
companyBasicInfo
[
"establishment_time"
])
diffTime
:=
g
etTimeStamp
()
-
establishment_time
diffTime
:=
G
etTimeStamp
()
-
establishment_time
//五年以上有分
//五年以上有分
if
diffTime
>
(
3600
*
24
*
365
*
5
)
{
if
diffTime
>
(
3600
*
24
*
365
*
5
)
{
...
@@ -44,14 +44,14 @@ func EstablishmentTime() {
...
@@ -44,14 +44,14 @@ func EstablishmentTime() {
c_totalScore
[
0
]
=
c_currentScore
c_totalScore
[
0
]
=
c_currentScore
setScore
(
c_currentScore
,
weight
)
setScore
(
c_currentScore
,
weight
)
s
etInsertScoreChanFooter
(
1
,
1
,
8
)
S
etInsertScoreChanFooter
(
1
,
1
,
8
)
}
}
//公司性质(1分)上,国,央,一分,其它零分
//公司性质(1分)上,国,央,一分,其它零分
func
CompanyNature
()
{
func
CompanyNature
()
{
customer_property
:=
s
tringTurnInt64
(
companyBasicInfo
[
"customer_property"
])
customer_property
:=
S
tringTurnInt64
(
companyBasicInfo
[
"customer_property"
])
if
customer_property
==
0
{
if
customer_property
==
0
{
c_currentScore
=
0
c_currentScore
=
0
...
@@ -62,13 +62,13 @@ func CompanyNature() {
...
@@ -62,13 +62,13 @@ func CompanyNature() {
c_totalScore
[
1
]
=
c_currentScore
c_totalScore
[
1
]
=
c_currentScore
setScore
(
c_currentScore
,
weight
)
setScore
(
c_currentScore
,
weight
)
s
etInsertScoreChanFooter
(
1
,
1
,
9
)
S
etInsertScoreChanFooter
(
1
,
1
,
9
)
}
}
//5年内法人变更次数(1分)
//5年内法人变更次数(1分)
func
ChangeslegalInFiveYears
()
{
func
ChangeslegalInFiveYears
()
{
five_legal_change
:=
s
tringTurnInt64
(
companyBasicInfo
[
"five_legal_change"
])
five_legal_change
:=
S
tringTurnInt64
(
companyBasicInfo
[
"five_legal_change"
])
//两次以上0分,以下一分
//两次以上0分,以下一分
if
five_legal_change
<
2
{
if
five_legal_change
<
2
{
...
@@ -80,13 +80,13 @@ func ChangeslegalInFiveYears() {
...
@@ -80,13 +80,13 @@ func ChangeslegalInFiveYears() {
c_totalScore
[
2
]
=
c_currentScore
c_totalScore
[
2
]
=
c_currentScore
setScore
(
c_currentScore
,
weight
)
setScore
(
c_currentScore
,
weight
)
s
etInsertScoreChanFooter
(
1
,
1
,
10
)
S
etInsertScoreChanFooter
(
1
,
1
,
10
)
}
}
//注册资本(2分)
//注册资本(2分)
func
RegisteredCapital
()
{
func
RegisteredCapital
()
{
registered_capital
:=
s
tringTurnInt64
(
companyBasicInfo
[
"registered_capital"
])
registered_capital
:=
S
tringTurnInt64
(
companyBasicInfo
[
"registered_capital"
])
if
registered_capital
<
500000
{
if
registered_capital
<
500000
{
c_currentScore
=
0
c_currentScore
=
0
...
@@ -99,12 +99,12 @@ func RegisteredCapital() {
...
@@ -99,12 +99,12 @@ func RegisteredCapital() {
c_totalScore
[
3
]
=
c_currentScore
c_totalScore
[
3
]
=
c_currentScore
setScore
(
c_currentScore
,
weight
)
setScore
(
c_currentScore
,
weight
)
s
etInsertScoreChanFooter
(
1
,
1
,
11
)
S
etInsertScoreChanFooter
(
1
,
1
,
11
)
}
}
//年纳税额(2分)
//年纳税额(2分)
func
AnnualTaxRate
()
{
func
AnnualTaxRate
()
{
year_tax_payable
:=
s
tringTurnFloat64
(
companyBasicInfo
[
"year_tax_payable"
])
year_tax_payable
:=
S
tringTurnFloat64
(
companyBasicInfo
[
"year_tax_payable"
])
if
year_tax_payable
<
20000
{
if
year_tax_payable
<
20000
{
c_currentScore
=
0
c_currentScore
=
0
...
@@ -117,12 +117,12 @@ func AnnualTaxRate() {
...
@@ -117,12 +117,12 @@ func AnnualTaxRate() {
c_totalScore
[
4
]
=
c_currentScore
c_totalScore
[
4
]
=
c_currentScore
setScore
(
c_currentScore
,
weight
)
setScore
(
c_currentScore
,
weight
)
s
etInsertScoreChanFooter
(
1
,
1
,
12
)
S
etInsertScoreChanFooter
(
1
,
1
,
12
)
}
}
//近两年内有无诉讼(2分)
//近两年内有无诉讼(2分)
func
lawsuitsInPastTwoYars
()
{
func
lawsuitsInPastTwoYars
()
{
two_years_no_lawsuit
:=
s
tringTurnInt64
(
companyBasicInfo
[
"two_years_no_lawsuit"
])
two_years_no_lawsuit
:=
S
tringTurnInt64
(
companyBasicInfo
[
"two_years_no_lawsuit"
])
if
two_years_no_lawsuit
==
1
{
if
two_years_no_lawsuit
==
1
{
c_currentScore
=
0
c_currentScore
=
0
...
@@ -133,13 +133,13 @@ func lawsuitsInPastTwoYars() {
...
@@ -133,13 +133,13 @@ func lawsuitsInPastTwoYars() {
c_totalScore
[
5
]
=
c_currentScore
c_totalScore
[
5
]
=
c_currentScore
setScore
(
c_currentScore
,
weight
)
setScore
(
c_currentScore
,
weight
)
s
etInsertScoreChanFooter
(
1
,
1
,
13
)
S
etInsertScoreChanFooter
(
1
,
1
,
13
)
}
}
//社保参保人数(1分)
//社保参保人数(1分)
func
NumberOfSocial
()
{
func
NumberOfSocial
()
{
social_security_participants
:=
s
tringTurnInt64
(
companyBasicInfo
[
"social_security_participants"
])
social_security_participants
:=
S
tringTurnInt64
(
companyBasicInfo
[
"social_security_participants"
])
if
social_security_participants
>
5
{
if
social_security_participants
>
5
{
c_currentScore
=
1
c_currentScore
=
1
...
@@ -150,7 +150,7 @@ func NumberOfSocial() {
...
@@ -150,7 +150,7 @@ func NumberOfSocial() {
c_totalScore
[
6
]
=
c_currentScore
c_totalScore
[
6
]
=
c_currentScore
setScore
(
c_currentScore
,
weight
)
setScore
(
c_currentScore
,
weight
)
s
etInsertScoreChanFooter
(
1
,
1
,
14
)
S
etInsertScoreChanFooter
(
1
,
1
,
14
)
}
}
...
...
cmd/static/enterprise_credit.go
View file @
4d408cc2
...
@@ -11,20 +11,20 @@ var(
...
@@ -11,20 +11,20 @@ var(
func
EnterPriseCredit
()(
finalScore
float64
)
{
func
EnterPriseCredit
()(
finalScore
float64
)
{
modelInfo
:=
getModelByProjectId
(
2
)
modelInfo
:=
getModelByProjectId
(
2
)
e_weight
=
s
tringTurnFloat64
(
modelInfo
[
"weight"
])
e_weight
=
S
tringTurnFloat64
(
modelInfo
[
"weight"
])
IsEnterpriseOverdueWhether
()
IsEnterpriseOverdueWhether
()
IsHistoryOverdue
()
IsHistoryOverdue
()
finalScore
=
setProjectScore
(
e_totalScore
,
e_weight
,
s
tringTurnFloat64
(
modelInfo
[
"full_score"
]))
finalScore
=
SetProjectScore
(
e_totalScore
,
e_weight
,
S
tringTurnFloat64
(
modelInfo
[
"full_score"
]))
s
etInsertScoreChanFooter
(
1
,
0
,
2
)
S
etInsertScoreChanFooter
(
1
,
0
,
2
)
return
finalScore
return
finalScore
}
}
//企业有无负债(5分)
//企业有无负债(5分)
func
IsEnterpriseOverdueWhether
()
{
func
IsEnterpriseOverdueWhether
()
{
company_has_liabilities
:=
s
tringTurnInt64
(
companySoreFields
[
"company_has_liabilities"
])
company_has_liabilities
:=
S
tringTurnInt64
(
companySoreFields
[
"company_has_liabilities"
])
if
company_has_liabilities
==
1
{
if
company_has_liabilities
==
1
{
e_currentScore
=
0
e_currentScore
=
0
...
@@ -35,13 +35,13 @@ func IsEnterpriseOverdueWhether() {
...
@@ -35,13 +35,13 @@ func IsEnterpriseOverdueWhether() {
e_totalScore
[
0
]
=
e_currentScore
e_totalScore
[
0
]
=
e_currentScore
setScore
(
e_currentScore
,
e_weight
)
setScore
(
e_currentScore
,
e_weight
)
s
etInsertScoreChanFooter
(
1
,
2
,
15
)
S
etInsertScoreChanFooter
(
1
,
2
,
15
)
}
}
//历史有无逾期(5分)
//历史有无逾期(5分)
func
IsHistoryOverdue
()
{
func
IsHistoryOverdue
()
{
history_overdue
:=
s
tringTurnInt64
(
companySoreFields
[
"history_overdue"
])
history_overdue
:=
S
tringTurnInt64
(
companySoreFields
[
"history_overdue"
])
if
history_overdue
==
1
{
if
history_overdue
==
1
{
e_currentScore
=
0
e_currentScore
=
0
...
@@ -53,5 +53,5 @@ func IsHistoryOverdue() {
...
@@ -53,5 +53,5 @@ func IsHistoryOverdue() {
setScore
(
e_currentScore
,
e_weight
)
setScore
(
e_currentScore
,
e_weight
)
s
etInsertScoreChanFooter
(
1
,
2
,
16
)
S
etInsertScoreChanFooter
(
1
,
2
,
16
)
}
}
\ No newline at end of file
cmd/static/history_bussiness.go
View file @
4d408cc2
...
@@ -10,7 +10,7 @@ var(
...
@@ -10,7 +10,7 @@ var(
func
HistoryBussiness
()(
finalScore
float64
)
{
func
HistoryBussiness
()(
finalScore
float64
)
{
modelInfo
:=
getModelByProjectId
(
4
)
modelInfo
:=
getModelByProjectId
(
4
)
h_weight
=
s
tringTurnFloat64
(
modelInfo
[
"weight"
])
h_weight
=
S
tringTurnFloat64
(
modelInfo
[
"weight"
])
CooperationTime
()
CooperationTime
()
AccumulatedAmountOfCooperation
()
AccumulatedAmountOfCooperation
()
...
@@ -19,16 +19,16 @@ func HistoryBussiness()(finalScore float64) {
...
@@ -19,16 +19,16 @@ func HistoryBussiness()(finalScore float64) {
AverageMoneyThreeMonths
()
AverageMoneyThreeMonths
()
AverageMoneySixMonths
()
AverageMoneySixMonths
()
finalScore
=
setProjectScore
(
h_totalScore
,
h_weight
,
s
tringTurnFloat64
(
modelInfo
[
"full_score"
]))
finalScore
=
SetProjectScore
(
h_totalScore
,
h_weight
,
S
tringTurnFloat64
(
modelInfo
[
"full_score"
]))
s
etInsertScoreChanFooter
(
1
,
0
,
4
)
S
etInsertScoreChanFooter
(
1
,
0
,
4
)
return
finalScore
return
finalScore
}
}
//合作时间(5分)
//合作时间(5分)
func
CooperationTime
()
{
func
CooperationTime
()
{
first_order_time
:=
s
tringTurnInt64
(
basicInfo
[
"first_order_time"
])
first_order_time
:=
S
tringTurnInt64
(
basicInfo
[
"first_order_time"
])
diffTime
:=
g
etTimeStamp
()
-
first_order_time
diffTime
:=
G
etTimeStamp
()
-
first_order_time
if
diffTime
<
(
3600
*
12
*
365
)
{
if
diffTime
<
(
3600
*
12
*
365
)
{
h_currentScore
=
0
h_currentScore
=
0
...
@@ -47,13 +47,13 @@ func CooperationTime() {
...
@@ -47,13 +47,13 @@ func CooperationTime() {
//设置分数
//设置分数
setScore
(
h_currentScore
,
h_weight
)
setScore
(
h_currentScore
,
h_weight
)
s
etInsertScoreChanFooter
(
1
,
4
,
29
)
S
etInsertScoreChanFooter
(
1
,
4
,
29
)
}
}
//合作累计金额(10分)
//合作累计金额(10分)
func
AccumulatedAmountOfCooperation
()
{
func
AccumulatedAmountOfCooperation
()
{
total_order_amount
:=
s
tringTurnFloat64
(
basicInfo
[
"total_order_amount"
])
total_order_amount
:=
S
tringTurnFloat64
(
basicInfo
[
"total_order_amount"
])
if
total_order_amount
<
1000000
{
if
total_order_amount
<
1000000
{
h_currentScore
=
0
h_currentScore
=
0
...
@@ -75,13 +75,13 @@ func AccumulatedAmountOfCooperation() {
...
@@ -75,13 +75,13 @@ func AccumulatedAmountOfCooperation() {
//设置分数
//设置分数
setScore
(
h_currentScore
,
h_weight
)
setScore
(
h_currentScore
,
h_weight
)
s
etInsertScoreChanFooter
(
1
,
4
,
30
)
S
etInsertScoreChanFooter
(
1
,
4
,
30
)
}
}
//累计毛利(10分)
//累计毛利(10分)
func
AccumulatedGrossProfit
()
{
func
AccumulatedGrossProfit
()
{
total_gross_profit
:=
s
tringTurnFloat64
(
basicInfo
[
"total_gross_profit"
])
total_gross_profit
:=
S
tringTurnFloat64
(
basicInfo
[
"total_gross_profit"
])
if
total_gross_profit
<
30000
{
if
total_gross_profit
<
30000
{
h_currentScore
=
0
h_currentScore
=
0
...
@@ -103,12 +103,12 @@ func AccumulatedGrossProfit() {
...
@@ -103,12 +103,12 @@ func AccumulatedGrossProfit() {
//设置分数
//设置分数
setScore
(
h_currentScore
,
h_weight
)
setScore
(
h_currentScore
,
h_weight
)
s
etInsertScoreChanFooter
(
1
,
4
,
31
)
S
etInsertScoreChanFooter
(
1
,
4
,
31
)
}
}
//历史逾期次数(5分)
//历史逾期次数(5分)
func
HistoricalOverdueTimes
()
{
func
HistoricalOverdueTimes
()
{
total_delay_times
:=
s
tringTurnInt64
(
basicInfo
[
"total_delay_times"
])
total_delay_times
:=
S
tringTurnInt64
(
basicInfo
[
"total_delay_times"
])
if
total_delay_times
>
5
{
if
total_delay_times
>
5
{
h_currentScore
=
0
h_currentScore
=
0
...
@@ -125,13 +125,13 @@ func HistoricalOverdueTimes() {
...
@@ -125,13 +125,13 @@ func HistoricalOverdueTimes() {
//设置分数
//设置分数
setScore
(
h_currentScore
,
h_weight
)
setScore
(
h_currentScore
,
h_weight
)
s
etInsertScoreChanFooter
(
1
,
4
,
32
)
S
etInsertScoreChanFooter
(
1
,
4
,
32
)
}
}
//近3个月的平均交易额(10分)
//近3个月的平均交易额(10分)
func
AverageMoneyThreeMonths
()
{
func
AverageMoneyThreeMonths
()
{
recently_three_average_amount
:=
s
tringTurnFloat64
(
basicInfo
[
"recently_three_average_amount"
])
recently_three_average_amount
:=
S
tringTurnFloat64
(
basicInfo
[
"recently_three_average_amount"
])
if
recently_three_average_amount
<
1
*
100000
{
if
recently_three_average_amount
<
1
*
100000
{
h_currentScore
=
0
h_currentScore
=
0
...
@@ -154,13 +154,13 @@ func AverageMoneyThreeMonths() {
...
@@ -154,13 +154,13 @@ func AverageMoneyThreeMonths() {
//设置分数
//设置分数
setScore
(
h_currentScore
,
h_weight
)
setScore
(
h_currentScore
,
h_weight
)
s
etInsertScoreChanFooter
(
1
,
4
,
33
)
S
etInsertScoreChanFooter
(
1
,
4
,
33
)
}
}
//近6个月的平均交易额(10分)
//近6个月的平均交易额(10分)
func
AverageMoneySixMonths
()
{
func
AverageMoneySixMonths
()
{
recently_six_max_amount
:=
s
tringTurnFloat64
(
basicInfo
[
"recently_six_max_amount"
])
recently_six_max_amount
:=
S
tringTurnFloat64
(
basicInfo
[
"recently_six_max_amount"
])
if
recently_six_max_amount
<
1
*
100000
{
if
recently_six_max_amount
<
1
*
100000
{
h_currentScore
=
0
h_currentScore
=
0
...
@@ -183,5 +183,5 @@ func AverageMoneySixMonths() {
...
@@ -183,5 +183,5 @@ func AverageMoneySixMonths() {
//设置分数
//设置分数
setScore
(
h_currentScore
,
h_weight
)
setScore
(
h_currentScore
,
h_weight
)
s
etInsertScoreChanFooter
(
1
,
4
,
33
)
S
etInsertScoreChanFooter
(
1
,
4
,
33
)
}
}
cmd/static/main.go
View file @
4d408cc2
...
@@ -49,20 +49,19 @@ func main() {
...
@@ -49,20 +49,19 @@ func main() {
flag
.
StringVar
(
&
runtype
,
"runtype"
,
"one"
,
"default config path"
)
flag
.
StringVar
(
&
runtype
,
"runtype"
,
"one"
,
"default config path"
)
go
insertRecord
()
c
:=
context
.
Background
()
go
InsertRecord
(
c
)
if
runtype
==
"one"
{
if
runtype
==
"one"
{
//调用服务获取公司信息,然后进行全局赋值
//调用服务获取公司信息,然后进行全局赋值
svc
:=
service
.
New
()
svc
:=
service
.
New
()
c
:=
context
.
Background
()
companyData
,
_
=
svc
.
GetCompanyCresitsList
(
c
)
companyData
,
_
=
svc
.
GetCompanyCresitsList
(
c
)
for
_
,
v
:=
range
companyData
{
for
_
,
v
:=
range
companyData
{
c
:=
context
.
Background
()
insertScoreMsg
.
ComCreditsId
=
StringTurnInt64
(
v
[
"id"
])
insertScoreMsg
.
ComCreditsId
=
stringTurnInt64
(
v
[
"id"
])
GetCompanyRunInfo
(
c
)
getCompanyRunInfo
(
c
)
SetSumScore
(
c
)
setSumScore
()
}
}
}
else
{
}
else
{
fmt
.
Print
(
"待补充rabbitmq"
)
fmt
.
Print
(
"待补充rabbitmq"
)
...
@@ -79,28 +78,25 @@ func main() {
...
@@ -79,28 +78,25 @@ func main() {
//计算单一项总的静态分
//计算单一项总的静态分
func
setSumScore
(
)
{
func
SetSumScore
(
c
context
.
Context
)
{
com_credits
.
Id
=
insertScoreMsg
.
ComCreditsId
com_credits
.
Id
=
insertScoreMsg
.
ComCreditsId
com_credits
.
StaticCreditScore
=
CompanyInfo
()
+
AddScore
()
+
HistoryBussiness
()
+
EnterPriseCredit
()
+
PersonalCredit
()
com_credits
.
StaticCreditScore
=
CompanyInfo
()
+
AddScore
()
+
HistoryBussiness
()
+
EnterPriseCredit
()
+
PersonalCredit
()
c
:=
context
.
Background
()
connect
:=
dao
.
New
()
connect
:=
dao
.
New
()
connect
.
UpdateStaticSumScores
(
c
,
com_credits
)
connect
.
UpdateStaticSumScores
(
c
,
com_credits
)
}
}
//协程增加分值记录
//协程增加分值记录
func
insertRecord
(
)
{
func
InsertRecord
(
c
context
.
Context
)
{
for
insertScoreMsgRecord
:=
range
socreRecordChan
{
for
insertScoreMsgRecord
:=
range
socreRecordChan
{
//声明service层
//声明service层
connect
:=
dao
.
New
()
svc
:=
service
.
New
()
ctx
:=
context
.
Background
()
//CurrentScore64 := float64(insertScoreMsgRecord.CurrentScore)
//CurrentScore64 := float64(insertScoreMsgRecord.CurrentScore)
//插入数据
//插入数据
//if !math.IsNaN(CurrentScore64) && CurrentScore64 != 0 {
//if !math.IsNaN(CurrentScore64) && CurrentScore64 != 0 {
//}
//}
insertId
,
err
:=
connect
.
InsertScores
(
ctx
,
insertScoreMsgRecord
)
insertId
,
err
:=
svc
.
InsertScores
(
c
,
insertScoreMsgRecord
)
fmt
.
Print
(
err
)
fmt
.
Print
(
err
)
fmt
.
Print
(
insertId
)
fmt
.
Print
(
insertId
)
}
}
...
@@ -108,13 +104,13 @@ func insertRecord() {
...
@@ -108,13 +104,13 @@ func insertRecord() {
}
}
//设置插入的分数头
//设置插入的分数头
func
s
etInsertScoreChanFooter
(
_typy
,
project_pid
,
project_id
int8
)
{
func
S
etInsertScoreChanFooter
(
_typy
,
project_pid
,
project_id
int8
)
{
insertScoreMsg
.
Type
,
insertScoreMsg
.
ProjectPid
,
insertScoreMsg
.
ProjectId
=
_typy
,
project_pid
,
project_id
insertScoreMsg
.
Type
,
insertScoreMsg
.
ProjectPid
,
insertScoreMsg
.
ProjectId
=
_typy
,
project_pid
,
project_id
socreRecordChan
<-
insertScoreMsg
socreRecordChan
<-
insertScoreMsg
}
}
//获取详细的计算基本数据
//获取详细的计算基本数据
func
g
etCompanyRunInfo
(
c
context
.
Context
)
{
func
G
etCompanyRunInfo
(
c
context
.
Context
)
{
//声明service层
//声明service层
connect
:=
dao
.
New
()
connect
:=
dao
.
New
()
companyBasicInfo
,
_
=
connect
.
GetCompanyBaseInfoByCid
(
c
,
insertScoreMsg
.
ComCreditsId
)
companyBasicInfo
,
_
=
connect
.
GetCompanyBaseInfoByCid
(
c
,
insertScoreMsg
.
ComCreditsId
)
...
@@ -123,16 +119,16 @@ func getCompanyRunInfo(c context.Context) {
...
@@ -123,16 +119,16 @@ func getCompanyRunInfo(c context.Context) {
basicInfo
,
_
=
connect
.
GetBasicInfoByCid
(
c
,
insertScoreMsg
.
ComCreditsId
)
basicInfo
,
_
=
connect
.
GetBasicInfoByCid
(
c
,
insertScoreMsg
.
ComCreditsId
)
}
}
func
g
etTimeStamp
()(
timestamp
int64
)
{
func
G
etTimeStamp
()(
timestamp
int64
)
{
return
time
.
Now
()
.
Unix
()
return
time
.
Now
()
.
Unix
()
}
}
func
s
tringTurnInt64
(
val
string
)
(
int64
)
{
func
S
tringTurnInt64
(
val
string
)
(
int64
)
{
intval
,
_
:=
strconv
.
ParseInt
(
val
,
10
,
64
)
intval
,
_
:=
strconv
.
ParseInt
(
val
,
10
,
64
)
return
intval
return
intval
}
}
func
s
tringTurnFloat64
(
val
string
)(
float64
)
{
func
S
tringTurnFloat64
(
val
string
)(
float64
)
{
floatval
,
_
:=
strconv
.
ParseFloat
(
val
,
64
)
floatval
,
_
:=
strconv
.
ParseFloat
(
val
,
64
)
return
floatval
return
floatval
}
}
...
@@ -154,7 +150,7 @@ func setScore(curretScoreRelace float64,weightReplace float64) {
...
@@ -154,7 +150,7 @@ func setScore(curretScoreRelace float64,weightReplace float64) {
}
}
//设置project总分
//设置project总分
func
s
etProjectScore
(
totalScoreReplace
[
20
]
float64
,
weightReplace
float64
,
fullScore
float64
)(
finalScore
float64
)
{
func
S
etProjectScore
(
totalScoreReplace
[
20
]
float64
,
weightReplace
float64
,
fullScore
float64
)(
finalScore
float64
)
{
var
(
var
(
sumScore
float64
=
0
sumScore
float64
=
0
joinNum
float64
=
0
joinNum
float64
=
0
...
...
cmd/static/personal_credit.go
View file @
4d408cc2
...
@@ -11,7 +11,7 @@ var(
...
@@ -11,7 +11,7 @@ var(
func
PersonalCredit
()(
finalScore
float64
)
{
func
PersonalCredit
()(
finalScore
float64
)
{
modelInfo
:=
getModelByProjectId
(
3
)
modelInfo
:=
getModelByProjectId
(
3
)
p_weight
=
s
tringTurnFloat64
(
modelInfo
[
"weight"
])
p_weight
=
S
tringTurnFloat64
(
modelInfo
[
"weight"
])
Age
()
Age
()
MaritalStatus
()
MaritalStatus
()
...
@@ -25,14 +25,14 @@ func PersonalCredit()(finalScore float64) {
...
@@ -25,14 +25,14 @@ func PersonalCredit()(finalScore float64) {
TotalCreditCardLimit
()
TotalCreditCardLimit
()
MaximumAmountOfSingleCreditCard
()
MaximumAmountOfSingleCreditCard
()
finalScore
=
setProjectScore
(
p_totalScore
,
p_weight
,
s
tringTurnFloat64
(
modelInfo
[
"full_score"
]))
finalScore
=
SetProjectScore
(
p_totalScore
,
p_weight
,
S
tringTurnFloat64
(
modelInfo
[
"full_score"
]))
s
etInsertScoreChanFooter
(
1
,
0
,
3
)
S
etInsertScoreChanFooter
(
1
,
0
,
3
)
return
finalScore
return
finalScore
}
}
//年龄(1分)
//年龄(1分)
func
Age
()
{
func
Age
()
{
age
:=
s
tringTurnInt64
(
companySoreFields
[
"age"
])
age
:=
S
tringTurnInt64
(
companySoreFields
[
"age"
])
if
age
>
30
&&
age
<
50
{
if
age
>
30
&&
age
<
50
{
...
@@ -45,13 +45,13 @@ func Age() {
...
@@ -45,13 +45,13 @@ func Age() {
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
17
)
S
etInsertScoreChanFooter
(
1
,
3
,
17
)
}
}
//婚姻状况(1分)
//婚姻状况(1分)
func
MaritalStatus
()
{
func
MaritalStatus
()
{
marital_status
:=
s
tringTurnInt64
(
companySoreFields
[
"marital_status"
])
marital_status
:=
S
tringTurnInt64
(
companySoreFields
[
"marital_status"
])
if
marital_status
==
1
{
if
marital_status
==
1
{
p_currentScore
=
1
p_currentScore
=
1
...
@@ -64,13 +64,13 @@ func MaritalStatus() {
...
@@ -64,13 +64,13 @@ func MaritalStatus() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
18
)
S
etInsertScoreChanFooter
(
1
,
3
,
18
)
}
}
//违约账户比(2分)
//违约账户比(2分)
func
DefaultAccountRatio
()
{
func
DefaultAccountRatio
()
{
account_ratio
:=
s
tringTurnFloat64
(
companySoreFields
[
"account_ratio"
])
account_ratio
:=
S
tringTurnFloat64
(
companySoreFields
[
"account_ratio"
])
if
account_ratio
<
20
{
if
account_ratio
<
20
{
p_currentScore
=
2
p_currentScore
=
2
...
@@ -83,13 +83,13 @@ func DefaultAccountRatio() {
...
@@ -83,13 +83,13 @@ func DefaultAccountRatio() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
19
)
S
etInsertScoreChanFooter
(
1
,
3
,
19
)
}
}
//对外担保(5分)
//对外担保(5分)
func
ExternalGuarantee
()
{
func
ExternalGuarantee
()
{
guaranty
:=
s
tringTurnInt64
(
companySoreFields
[
"guaranty"
])
guaranty
:=
S
tringTurnInt64
(
companySoreFields
[
"guaranty"
])
if
guaranty
==
1
{
if
guaranty
==
1
{
p_currentScore
=
0
p_currentScore
=
0
...
@@ -102,13 +102,13 @@ func ExternalGuarantee() {
...
@@ -102,13 +102,13 @@ func ExternalGuarantee() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
20
)
S
etInsertScoreChanFooter
(
1
,
3
,
20
)
}
}
//近2年内30天内逾期次数(3分)
//近2年内30天内逾期次数(3分)
func
SumBeOverdueMonthTwoYesar
()
{
func
SumBeOverdueMonthTwoYesar
()
{
two_years_th_days_overdue_times
:=
s
tringTurnInt64
(
companySoreFields
[
"two_years_th_days_overdue_times"
])
two_years_th_days_overdue_times
:=
S
tringTurnInt64
(
companySoreFields
[
"two_years_th_days_overdue_times"
])
if
two_years_th_days_overdue_times
<
1
{
if
two_years_th_days_overdue_times
<
1
{
p_currentScore
=
3
p_currentScore
=
3
...
@@ -121,13 +121,13 @@ func SumBeOverdueMonthTwoYesar() {
...
@@ -121,13 +121,13 @@ func SumBeOverdueMonthTwoYesar() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
22
)
S
etInsertScoreChanFooter
(
1
,
3
,
22
)
}
}
//近2年内最大逾期金额(3分)two_years_max_overdue_amount
//近2年内最大逾期金额(3分)two_years_max_overdue_amount
func
MaxBeOverdueTwoYears
()
{
func
MaxBeOverdueTwoYears
()
{
two_years_max_overdue_amount
:=
s
tringTurnFloat64
(
companySoreFields
[
"two_years_max_overdue_amount"
])
two_years_max_overdue_amount
:=
S
tringTurnFloat64
(
companySoreFields
[
"two_years_max_overdue_amount"
])
if
two_years_max_overdue_amount
>=
10000
{
if
two_years_max_overdue_amount
>=
10000
{
p_currentScore
=
0
p_currentScore
=
0
...
@@ -144,14 +144,14 @@ func MaxBeOverdueTwoYears() {
...
@@ -144,14 +144,14 @@ func MaxBeOverdueTwoYears() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
23
)
S
etInsertScoreChanFooter
(
1
,
3
,
23
)
}
}
//是否存在当前逾期(3分)
//是否存在当前逾期(3分)
func
IsBeOverdue
()
{
func
IsBeOverdue
()
{
is_exist_now_overdue
:=
s
tringTurnInt64
(
companySoreFields
[
"is_exist_now_overdue"
])
is_exist_now_overdue
:=
S
tringTurnInt64
(
companySoreFields
[
"is_exist_now_overdue"
])
if
is_exist_now_overdue
==
1
{
if
is_exist_now_overdue
==
1
{
p_currentScore
=
0
p_currentScore
=
0
...
@@ -165,14 +165,14 @@ func IsBeOverdue() {
...
@@ -165,14 +165,14 @@ func IsBeOverdue() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
24
)
S
etInsertScoreChanFooter
(
1
,
3
,
24
)
}
}
//有无房贷(1分)
//有无房贷(1分)
func
IsMortgage
()
{
func
IsMortgage
()
{
presence_of_mortgage
:=
s
tringTurnInt64
(
companySoreFields
[
"presence_of_mortgage"
])
presence_of_mortgage
:=
S
tringTurnInt64
(
companySoreFields
[
"presence_of_mortgage"
])
if
presence_of_mortgage
==
1
{
if
presence_of_mortgage
==
1
{
p_currentScore
=
0
p_currentScore
=
0
...
@@ -185,13 +185,13 @@ func IsMortgage() {
...
@@ -185,13 +185,13 @@ func IsMortgage() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
25
)
S
etInsertScoreChanFooter
(
1
,
3
,
25
)
}
}
//近两个月征信查询次数(5分)
//近两个月征信查询次数(5分)
func
NumberOfCreditInquiryInThePastTwoMonths
()
{
func
NumberOfCreditInquiryInThePastTwoMonths
()
{
two_months_credit_view_nums
:=
s
tringTurnInt64
(
companySoreFields
[
"two_months_credit_view_nums"
])
two_months_credit_view_nums
:=
S
tringTurnInt64
(
companySoreFields
[
"two_months_credit_view_nums"
])
if
two_months_credit_view_nums
==
0
{
if
two_months_credit_view_nums
==
0
{
p_currentScore
=
5
p_currentScore
=
5
...
@@ -212,13 +212,13 @@ func NumberOfCreditInquiryInThePastTwoMonths() {
...
@@ -212,13 +212,13 @@ func NumberOfCreditInquiryInThePastTwoMonths() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
26
)
S
etInsertScoreChanFooter
(
1
,
3
,
26
)
}
}
//信用卡总额度(3分)
//信用卡总额度(3分)
func
TotalCreditCardLimit
()
{
func
TotalCreditCardLimit
()
{
credit_card_total
:=
s
tringTurnInt64
(
companySoreFields
[
"credit_card_total"
])
credit_card_total
:=
S
tringTurnInt64
(
companySoreFields
[
"credit_card_total"
])
if
credit_card_total
>=
200000
{
if
credit_card_total
>=
200000
{
p_currentScore
=
3
p_currentScore
=
3
...
@@ -231,13 +231,13 @@ func TotalCreditCardLimit() {
...
@@ -231,13 +231,13 @@ func TotalCreditCardLimit() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
27
)
S
etInsertScoreChanFooter
(
1
,
3
,
27
)
}
}
//单张信用卡最高额度(3分)
//单张信用卡最高额度(3分)
func
MaximumAmountOfSingleCreditCard
()
{
func
MaximumAmountOfSingleCreditCard
()
{
maximum_credit_card_limit
:=
s
tringTurnInt64
(
companySoreFields
[
"maximum_credit_card_limit"
])
maximum_credit_card_limit
:=
S
tringTurnInt64
(
companySoreFields
[
"maximum_credit_card_limit"
])
if
maximum_credit_card_limit
>=
100000
{
if
maximum_credit_card_limit
>=
100000
{
p_currentScore
=
3
p_currentScore
=
3
...
@@ -250,5 +250,5 @@ func MaximumAmountOfSingleCreditCard() {
...
@@ -250,5 +250,5 @@ func MaximumAmountOfSingleCreditCard() {
//设置分数
//设置分数
setScore
(
p_currentScore
,
p_weight
)
setScore
(
p_currentScore
,
p_weight
)
s
etInsertScoreChanFooter
(
1
,
3
,
28
)
S
etInsertScoreChanFooter
(
1
,
3
,
28
)
}
}
go.sum
View file @
4d408cc2
...
@@ -37,6 +37,7 @@ github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ1
...
@@ -37,6 +37,7 @@ github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ1
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc=
github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
...
@@ -74,8 +75,6 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
...
@@ -74,8 +75,6 @@ github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE=
github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE=
github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/goinggo/mapstructure v0.0.0-20140717182941-194205d9b4a9 h1:wqckanyE9qc/XnvnybC6SHOb8Nyd62QXAZOzA8twFig=
github.com/goinggo/mapstructure v0.0.0-20140717182941-194205d9b4a9/go.mod h1:64ikIrMv84B+raz7akXOqbF7cK3/OQQ/6cClY10oy7A=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
...
@@ -103,6 +102,7 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
...
@@ -103,6 +102,7 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ichunt2019/go-msgserver v0.0.0-20191203074423-ea6520d9a4ea h1:GLlx6jezFXZGHhCcdECTC5MAAYPgzB91D5synlgzR+Q=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
...
@@ -120,8 +120,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
...
@@ -120,8 +120,10 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8=
github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8=
...
@@ -155,6 +157,7 @@ github.com/openconfig/reference v0.0.0-20190727015836-8dfd928c9696/go.mod h1:ym2
...
@@ -155,6 +157,7 @@ github.com/openconfig/reference v0.0.0-20190727015836-8dfd928c9696/go.mod h1:ym2
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/otokaze/mock v0.0.0-20190125081256-8282b7a7c7c3/go.mod h1:pLR8n2aimFxvvDJ6n8JuQWthMGezCYMjuhlaTjPTZf0=
github.com/otokaze/mock v0.0.0-20190125081256-8282b7a7c7c3/go.mod h1:pLR8n2aimFxvvDJ6n8JuQWthMGezCYMjuhlaTjPTZf0=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/philchia/agollo v0.0.0-20190728085453-a95533fccea3 h1:e/WwwXpp+h9CtbiwSdDxrgq6ymvrvLH/P+kS+8qq4v8=
github.com/philchia/agollo v0.0.0-20190728085453-a95533fccea3/go.mod h1:EXNdWdQkS+QBi0nb/Xm+sBBuQ1PM7/NIPr1JDzOlt8A=
github.com/philchia/agollo v0.0.0-20190728085453-a95533fccea3/go.mod h1:EXNdWdQkS+QBi0nb/Xm+sBBuQ1PM7/NIPr1JDzOlt8A=
github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v0.0.0-20190327172049-315a67e90e41/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
...
@@ -162,6 +165,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
...
@@ -162,6 +165,7 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
...
@@ -211,6 +215,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
...
@@ -211,6 +215,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
...
@@ -314,10 +319,12 @@ google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRn
...
@@ -314,10 +319,12 @@ google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRn
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610=
gopkg.in/bsm/ratelimit.v1 v1.0.0-20160220154919-db14e161995a/go.mod h1:KF9sEfUPAXdG8Oev9e99iLGnl2uJMjc5B+4y3O7x610=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc=
gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc=
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
...
...
internal/dao/com_credits.go
View file @
4d408cc2
...
@@ -5,6 +5,7 @@ import (
...
@@ -5,6 +5,7 @@ import (
"fmt"
"fmt"
"github.com/bilibili/kratos/pkg/database/sql"
"github.com/bilibili/kratos/pkg/database/sql"
"github.com/pkg/errors"
"github.com/pkg/errors"
"kaopu-server/internal/logic"
"kaopu-server/internal/model"
"kaopu-server/internal/model"
"github.com/bilibili/kratos/pkg/log"
"github.com/bilibili/kratos/pkg/log"
)
)
...
@@ -39,9 +40,11 @@ func (d *dao) UpdateStaticSumScores(ctx context.Context,com_credits model.ComCre
...
@@ -39,9 +40,11 @@ func (d *dao) UpdateStaticSumScores(ctx context.Context,com_credits model.ComCre
execSql
=
"update `lie_com_credits` set `static_credit_score` = ? where id = ? "
execSql
=
"update `lie_com_credits` set `static_credit_score` = ? where id = ? "
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
com_credits
.
DynamicCreditScore
,
com_credits
.
Id
)
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
com_credits
.
DynamicCreditScore
,
com_credits
.
Id
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"db.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
log
.
Error
(
"
UpdateStaticSumScores
db.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
}
d
.
UpdateComCredits
(
ctx
,
com_credits
)
row
.
RowsAffected
()
row
.
RowsAffected
()
defer
d
.
db
.
Close
()
defer
d
.
db
.
Close
()
...
@@ -59,7 +62,7 @@ func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredi
...
@@ -59,7 +62,7 @@ func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredi
execSql
=
"update `lie_com_credits` set `dynamic_credit_score` = ? where id = ? "
execSql
=
"update `lie_com_credits` set `dynamic_credit_score` = ? where id = ? "
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
com_credits
.
DynamicCreditScore
,
com_credits
.
Id
)
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
com_credits
.
DynamicCreditScore
,
com_credits
.
Id
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"db.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
log
.
Error
(
"
UpdateMoveSumScores
db.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
}
row
.
RowsAffected
()
row
.
RowsAffected
()
...
@@ -69,7 +72,70 @@ func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredi
...
@@ -69,7 +72,70 @@ func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredi
return
return
}
}
func
(
d
*
dao
)
UpdateComCredits
(
ctx
context
.
Context
,
com_credits
model
.
ComCredits
)(
Id
int64
,
err
error
)
{
var
(
rows
*
sql
.
Rows
res
map
[
string
]
string
)
//获取当前条的数据
if
rows
,
err
=
d
.
db
.
Query
(
ctx
,
"select "
+
SqlField
+
" from lie_com_credits where id = ?"
,
com_credits
.
Id
);
err
!=
nil
{
err
=
errors
.
WithStack
(
err
)
return
}
if
err
!=
nil
{
fmt
.
Println
(
"select fail,err:"
,
err
)
return
}
twoMap
,
err
:=
GetAllParam
(
rows
)
for
_
,
v
:=
range
twoMap
{
res
=
v
break
}
//修改相应的参数
total_credit_score
:=
logic
.
StringTurnFloat64
(
res
[
"static_credit_score"
])
+
logic
.
StringTurnFloat64
(
res
[
"dynamic_credit_score"
])
grade
,
_
:=
d
.
GetGrade
(
ctx
,
total_credit_score
)
execSql
:=
"update `lie_com_credits` set `total_credit_score` = ? , `ichunt_hunting_core` = ? , `recom_time_limit` = ? ,`recommended_amount` = ? where id = ? "
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
total_credit_score
,
grade
[
"grade"
],
grade
[
"recommended_limit"
],
logic
.
StringTurnFloat64
(
grade
[
"recommended_amount"
]),
com_credits
.
Id
)
if
err
!=
nil
{
log
.
Error
(
"UpdateComCreditsdb.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
row
.
RowsAffected
()
return
}
func
(
d
*
dao
)
GetGrade
(
ctx
context
.
Context
,
sumScore
float64
)(
res
map
[
string
]
string
,
err
error
)
{
var
(
rows
*
sql
.
Rows
)
//获取当前条的数据
if
rows
,
err
=
d
.
db
.
Query
(
ctx
,
"select "
+
SqlField
+
" from lie_grade where status = 1 and min_score >= ? and max_score < ?"
,
sumScore
,
sumScore
);
err
!=
nil
{
err
=
errors
.
WithStack
(
err
)
return
}
if
err
!=
nil
{
fmt
.
Println
(
"select fail,err:"
,
err
)
return
}
twoMap
,
err
:=
GetAllParam
(
rows
)
for
_
,
v
:=
range
twoMap
{
res
=
v
break
}
return
}
...
...
internal/dao/scores.go
View file @
4d408cc2
...
@@ -26,7 +26,7 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
...
@@ -26,7 +26,7 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
execSql
=
"INSERT INTO `lie_scores` (`type`, `project_pid`, `project_id`, `total_score`, `current_score`, `weight`, `final_score`, `com_credits_id`, `create_time`)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"
execSql
=
"INSERT INTO `lie_scores` (`type`, `project_pid`, `project_id`, `total_score`, `current_score`, `weight`, `final_score`, `com_credits_id`, `create_time`)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)"
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
TotalScore
,
score
.
CurrentScore
,
score
.
Weight
,
score
.
FinalScore
,
score
.
ComCreditsId
,
time
.
Now
()
.
Unix
())
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
TotalScore
,
score
.
CurrentScore
,
score
.
Weight
,
score
.
FinalScore
,
score
.
ComCreditsId
,
time
.
Now
()
.
Unix
())
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"db.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
log
.
Error
(
"
InsertScores
db.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
else
{
}
else
{
affectNum
,
_
=
row
.
LastInsertId
()
affectNum
,
_
=
row
.
LastInsertId
()
}
}
...
@@ -35,7 +35,7 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
...
@@ -35,7 +35,7 @@ func (d *dao) InsertScores(ctx context.Context,score model.Scores) (insertId int
execSql
=
"update `lie_scores` set `type` = ?, `project_pid` = ?, `project_id` = ?, `total_score` = ?, `current_score` = ?, `weight` = ?, `final_score` = ?, `com_credits_id` = ?, `update_time` = ? where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ?"
execSql
=
"update `lie_scores` set `type` = ?, `project_pid` = ?, `project_id` = ?, `total_score` = ?, `current_score` = ?, `weight` = ?, `final_score` = ?, `com_credits_id` = ?, `update_time` = ? where `type` = ? and project_pid = ? and project_id = ? and com_credits_id = ?"
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
TotalScore
,
score
.
CurrentScore
,
score
.
Weight
,
score
.
FinalScore
,
score
.
ComCreditsId
,
time
.
Now
()
.
Unix
(),
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
ComCreditsId
)
row
,
err
:=
d
.
db
.
Exec
(
ctx
,
execSql
,
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
TotalScore
,
score
.
CurrentScore
,
score
.
Weight
,
score
.
FinalScore
,
score
.
ComCreditsId
,
time
.
Now
()
.
Unix
(),
score
.
Type
,
score
.
ProjectPid
,
score
.
ProjectId
,
score
.
ComCreditsId
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
"db.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
log
.
Error
(
"
updateScores
db.DemoExec.Exec(%s) error(%v)"
,
execSql
,
err
)
}
else
{
}
else
{
affectNum
,
_
=
row
.
RowsAffected
()
affectNum
,
_
=
row
.
RowsAffected
()
}
}
...
...
internal/logic/common.go
View file @
4d408cc2
...
@@ -2247,12 +2247,22 @@ func GetConfig() {
...
@@ -2247,12 +2247,22 @@ func GetConfig() {
panic
(
err
)
panic
(
err
)
}
}
//初始化日志目录
//初始化日志目录
s
etLog
(
"kaopuserver start"
,
0
)
S
etLog
(
"kaopuserver start"
,
0
)
}
}
func
s
etLog
(
k
string
,
v
interface
{}){
func
S
etLog
(
k
string
,
v
interface
{}){
//初始化日志目录
//初始化日志目录
log
.
Init
(
&
log
.
Config
{
Dir
:
"logs"
})
log
.
Init
(
&
log
.
Config
{
Dir
:
"logs"
})
defer
log
.
Close
()
defer
log
.
Close
()
log
.
Info
(
k
,
v
)
log
.
Info
(
k
,
v
)
}
func
StringTurnInt64
(
val
string
)
(
int64
)
{
intval
,
_
:=
strconv
.
ParseInt
(
val
,
10
,
64
)
return
intval
}
func
StringTurnFloat64
(
val
string
)(
float64
)
{
floatval
,
_
:=
strconv
.
ParseFloat
(
val
,
64
)
return
floatval
}
}
\ No newline at end of file
internal/model/grade.go
0 → 100644
View file @
4d408cc2
package
model
type
Grade
struct
{
Id
int64
`json:"id"`
Grade
int64
`json:"grade"`
MinScore
float64
`json:"min_score"`
MaxScore
float64
`json:"max_score"`
RecommendedAmount
float64
`json:"recommended_amount"`
RecommendedLimit
string
`json:"recommended_limit"`
Status
int64
`json:"status"`
Creator
string
`json:"creator"`
CreateTime
int64
`json:"create_time"`
UpdateTime
int64
`json:"update_time"`
}
/*CREATE TABLE `lie_grade` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '信用等级ID',
`grade` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '等级,1-A,2-B, 3-C, 4-D, 5-E, 6-F',
`min_score` decimal(6,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最小分值',
`max_score` decimal(6,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最大分值',
`recommended_amount` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '建议额度',
`recommended_limit` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '建议期限',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态,1-启用,-1-禁用',
`creator` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '创建人',
`create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `grade` (`grade`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COMMENT='信用等级表';*/
\ No newline at end of file
internal/service/service.go
View file @
4d408cc2
...
@@ -125,5 +125,14 @@ func (s *Service) UpdateStaticSumScores(c context.Context,com_credits model.ComC
...
@@ -125,5 +125,14 @@ func (s *Service) UpdateStaticSumScores(c context.Context,com_credits model.ComC
return
return
}
}
// 修改公司静态加分项
func
(
s
*
Service
)
InsertScores
(
c
context
.
Context
,
score
model
.
Scores
)
(
res
int64
,
err
error
)
{
//调用DB方法,获取会员数据
res
,
err
=
s
.
dao
.
InsertScores
(
c
,
score
)
defer
s
.
dao
.
Close
()
fmt
.
Print
(
err
)
return
}
//----------静态结束
//----------静态结束
\ No newline at end of file
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