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
2325d292
authored
Dec 06, 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
9c1545f5
b5619aee
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
176 additions
and
258 deletions
cmd/static/Common.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
internal/dao/add_score.go
internal/dao/basic_info.go
internal/dao/com_basicinfos.go
internal/dao/com_credits.go
internal/dao/credit_score_fields.go
internal/dao/dao.go
internal/dao/lie_model.go
internal/dao/model_items.go
internal/dao/model_topset.go
internal/model/moel_items.go
cmd/static/Common.go
View file @
2325d292
...
...
@@ -87,6 +87,39 @@ func GetModelTopsetByProjectId(projectId int64)(modelInfo map[string]string) {
return
res
}
//获取顶头详情
func
GetCompanyModelItemsByProjectid
(
projectId
int64
,
score
float64
)
(
modelInfo
map
[
string
]
string
)
{
ctx
:=
context
.
Background
()
connect
:=
dao
.
New
()
res
,
_
:=
connect
.
GetCompanyModelItemsByProjectid
(
ctx
,
projectId
,
score
)
return
res
}
//获取顶头详情
func
GetCompanyModelItemsByProjectidWitchString
(
project_id
int64
,
stringVal
string
)
(
modelInfo
map
[
string
]
string
)
{
ctx
:=
context
.
Background
()
connect
:=
dao
.
New
()
res
,
_
:=
connect
.
GetCompanyModelItemsByProjectidWitchString
(
ctx
,
project_id
,
stringVal
)
return
res
}
func
GetScore
(
projectId
int64
,
stringVal
string
)
(
fianlscore
float64
)
{
ctx
:=
context
.
Background
()
connect
:=
dao
.
New
()
modelTypeInfo
,
_
:=
connect
.
GetCompanyModelByProjectid
(
ctx
,
projectId
)
modelInfo
:=
make
(
map
[
string
]
string
)
//如果是四,就用文本类型查询
if
StringTurnInt64
(
modelTypeInfo
[
"numeric_type"
])
==
4
{
modelInfo
=
GetCompanyModelItemsByProjectidWitchString
(
projectId
,
stringVal
)
}
else
{
modelInfo
=
GetCompanyModelItemsByProjectid
(
projectId
,
StringTurnFloat64
(
stringVal
))
}
return
StringTurnFloat64
(
modelInfo
[
"score"
])
}
//设置分数
func
SetScore
(
curretScoreRelace
float64
,
modelId
int64
)(
fimalScore
float64
)
{
...
...
cmd/static/company_info.go
View file @
2325d292
package
main
import
"strconv"
var
(
c_currentScore
float64
c_totalScore
[
20
]
float64
...
...
@@ -34,13 +36,7 @@ func EstablishmentTime() {
establishment_time
:=
StringTurnInt64
(
companyBasicInfo
[
"establishment_time"
])
diffTime
:=
GetTimeStamp
()
-
establishment_time
//五年以上有分
if
diffTime
>
(
3600
*
24
*
365
*
5
)
{
c_currentScore
=
1
}
else
{
c_currentScore
=
0
}
c_currentScore
=
GetScore
(
8
,
strconv
.
FormatInt
(
diffTime
,
10
))
c_totalScore
[
0
]
=
SetScore
(
c_currentScore
,
8
)
SetInsertScoreChanFooter
(
1
,
1
,
8
)
}
...
...
@@ -48,14 +44,7 @@ func EstablishmentTime() {
//公司性质(1分)上,国,央,一分,其它零分
func
CompanyNature
()
{
customer_property
:=
StringTurnInt64
(
companyBasicInfo
[
"customer_property"
])
if
customer_property
==
0
{
c_currentScore
=
0
}
else
{
c_currentScore
=
1
}
c_currentScore
=
GetScore
(
9
,
companyBasicInfo
[
"customer_property"
])
c_totalScore
[
1
]
=
SetScore
(
c_currentScore
,
9
)
...
...
@@ -64,15 +53,7 @@ func CompanyNature() {
//5年内法人变更次数(1分)
func
ChangeslegalInFiveYears
()
{
five_legal_change
:=
StringTurnInt64
(
companyBasicInfo
[
"five_legal_change"
])
//两次以上0分,以下一分
if
five_legal_change
<
2
{
c_currentScore
=
1
}
else
{
c_currentScore
=
0
}
c_currentScore
=
GetScore
(
10
,
companyBasicInfo
[
"five_legal_change"
])
c_totalScore
[
2
]
=
SetScore
(
c_currentScore
,
10
)
SetInsertScoreChanFooter
(
1
,
1
,
10
)
...
...
@@ -80,16 +61,7 @@ func ChangeslegalInFiveYears() {
//注册资本(2分)
func
RegisteredCapital
()
{
registered_capital
:=
StringTurnInt64
(
companyBasicInfo
[
"registered_capital"
])
if
registered_capital
<
500000
{
c_currentScore
=
0
}
else
if
registered_capital
>
2000000
{
c_currentScore
=
2
}
else
{
c_currentScore
=
1
}
c_currentScore
=
GetScore
(
11
,
companyBasicInfo
[
"registered_capital"
])
c_totalScore
[
3
]
=
SetScore
(
c_currentScore
,
11
)
SetInsertScoreChanFooter
(
1
,
1
,
11
)
...
...
@@ -97,15 +69,7 @@ func RegisteredCapital() {
//年纳税额(2分)
func
AnnualTaxRate
()
{
year_tax_payable
:=
StringTurnFloat64
(
companyBasicInfo
[
"year_tax_payable"
])
if
year_tax_payable
<
20000
{
c_currentScore
=
0
}
else
if
year_tax_payable
>
50000
{
c_currentScore
=
2
}
else
{
c_currentScore
=
1
}
c_currentScore
=
GetScore
(
12
,
companyBasicInfo
[
"year_tax_payable"
])
c_totalScore
[
4
]
=
SetScore
(
c_currentScore
,
12
)
SetInsertScoreChanFooter
(
1
,
1
,
12
)
...
...
@@ -113,13 +77,7 @@ func AnnualTaxRate() {
//近两年内有无诉讼(2分)
func
lawsuitsInPastTwoYars
()
{
two_years_no_lawsuit
:=
StringTurnInt64
(
companyBasicInfo
[
"two_years_no_lawsuit"
])
if
two_years_no_lawsuit
==
1
{
c_currentScore
=
0
}
else
{
c_currentScore
=
2
}
c_currentScore
=
GetScore
(
13
,
companyBasicInfo
[
"two_years_no_lawsuit"
])
c_totalScore
[
5
]
=
SetScore
(
c_currentScore
,
13
)
SetInsertScoreChanFooter
(
1
,
1
,
13
)
...
...
@@ -127,14 +85,7 @@ func lawsuitsInPastTwoYars() {
//社保参保人数(1分)
func
NumberOfSocial
()
{
social_security_participants
:=
StringTurnInt64
(
companyBasicInfo
[
"social_security_participants"
])
if
social_security_participants
>
5
{
c_currentScore
=
1
}
else
{
c_currentScore
=
0
}
c_currentScore
=
GetScore
(
14
,
companyBasicInfo
[
"social_security_participants"
])
c_totalScore
[
6
]
=
SetScore
(
c_currentScore
,
14
)
SetInsertScoreChanFooter
(
1
,
1
,
14
)
...
...
cmd/static/enterprise_credit.go
View file @
2325d292
...
...
@@ -23,15 +23,9 @@ func EnterPriseCredit()(finalScore float64) {
//企业有无负债(5分)
func
IsEnterpriseOverdueWhether
()
{
company_has_liabilities
:=
StringTurnInt64
(
companySoreFields
[
"company_has_liabilities"
])
e_currentScore
=
GetScore
(
15
,
companySoreFields
[
"company_has_liabilities"
])
if
company_has_liabilities
==
1
{
e_currentScore
=
0
}
else
{
e_currentScore
=
5
}
e_totalScore
[
0
]
=
SetScore
(
c_currentScore
,
15
)
e_totalScore
[
0
]
=
SetScore
(
e_currentScore
,
15
)
SetInsertScoreChanFooter
(
1
,
2
,
15
)
}
...
...
@@ -39,15 +33,9 @@ func IsEnterpriseOverdueWhether() {
//历史有无逾期(5分)
func
IsHistoryOverdue
()
{
history_overdue
:=
StringTurnInt64
(
companySoreFields
[
"history_overdue"
])
if
history_overdue
==
1
{
e_currentScore
=
0
}
else
{
e_currentScore
=
5
}
e_currentScore
=
GetScore
(
15
,
companySoreFields
[
"history_overdue"
])
e_totalScore
[
1
]
=
SetScore
(
c
_currentScore
,
16
)
e_totalScore
[
1
]
=
SetScore
(
e
_currentScore
,
16
)
SetInsertScoreChanFooter
(
1
,
2
,
16
)
}
\ No newline at end of file
cmd/static/history_bussiness.go
View file @
2325d292
package
main
import
"strconv"
var
(
h_currentScore
float64
h_totalScore
[
20
]
float64
...
...
@@ -31,17 +33,7 @@ func CooperationTime() {
first_order_time
:=
StringTurnInt64
(
basicInfo
[
"first_order_time"
])
diffTime
:=
GetTimeStamp
()
-
first_order_time
if
diffTime
<
(
3600
*
12
*
365
)
{
h_currentScore
=
0
}
else
if
diffTime
<
(
3600
*
24
*
365
)
&&
diffTime
>=
(
3600
*
12
*
365
)
{
h_currentScore
=
1
}
else
if
diffTime
<
(
3600
*
24
*
365
*
2
)
&&
diffTime
>=
(
3600
*
24
*
365
*
1
)
{
h_currentScore
=
2
}
else
if
diffTime
>=
(
3600
*
24
*
365
*
2
){
h_currentScore
=
5
}
else
{
h_currentScore
=
0
}
h_currentScore
=
GetScore
(
29
,
strconv
.
FormatInt
(
diffTime
,
10
))
h_totalScore
[
0
]
=
SetScore
(
h_currentScore
,
29
)
...
...
@@ -51,23 +43,8 @@ func CooperationTime() {
//合作累计金额(10分)
func
AccumulatedAmountOfCooperation
()
{
total_order_amount
:=
StringTurnFloat64
(
basicInfo
[
"total_order_amount"
])
if
total_order_amount
<
1000000
{
h_currentScore
=
0
}
else
if
total_order_amount
<
2000000
&&
total_order_amount
>=
1000000
{
h_currentScore
=
1
}
else
if
total_order_amount
<
3000000
&&
total_order_amount
>=
2000000
{
h_currentScore
=
2
}
else
if
total_order_amount
<
5000000
&&
total_order_amount
>=
3000000
{
h_currentScore
=
3
}
else
if
total_order_amount
<
10000000
&&
total_order_amount
>=
5000000
{
h_currentScore
=
5
}
else
if
total_order_amount
>=
10000000
{
h_currentScore
=
10
}
else
{
h_currentScore
=
0
}
h_currentScore
=
GetScore
(
30
,
basicInfo
[
"total_order_amount"
])
h_totalScore
[
1
]
=
SetScore
(
h_currentScore
,
30
)
SetInsertScoreChanFooter
(
1
,
4
,
30
)
...
...
@@ -76,23 +53,7 @@ func AccumulatedAmountOfCooperation() {
//累计毛利(10分)
func
AccumulatedGrossProfit
()
{
total_gross_profit
:=
StringTurnFloat64
(
basicInfo
[
"total_gross_profit"
])
if
total_gross_profit
<
30000
{
h_currentScore
=
0
}
else
if
total_gross_profit
<
50000
&&
total_gross_profit
>=
30000
{
h_currentScore
=
1
}
else
if
total_gross_profit
<
50000
&&
total_gross_profit
>=
100000
{
h_currentScore
=
2
}
else
if
total_gross_profit
<
200000
&&
total_gross_profit
>=
100000
{
h_currentScore
=
3
}
else
if
total_gross_profit
<
300000
&&
total_gross_profit
>=
200000
{
h_currentScore
=
5
}
else
if
total_gross_profit
>=
300000
{
h_currentScore
=
10
}
else
{
h_currentScore
=
0
}
h_currentScore
=
GetScore
(
31
,
basicInfo
[
"total_gross_profit"
])
h_totalScore
[
2
]
=
SetScore
(
h_currentScore
,
31
)
SetInsertScoreChanFooter
(
1
,
4
,
31
)
...
...
@@ -100,17 +61,8 @@ func AccumulatedGrossProfit() {
//历史逾期次数(5分)
func
HistoricalOverdueTimes
()
{
total_delay_times
:=
StringTurnInt64
(
basicInfo
[
"total_delay_times"
])
if
total_delay_times
>
5
{
h_currentScore
=
0
}
else
if
total_delay_times
<=
5
&&
total_delay_times
>=
2
{
h_currentScore
=
3
}
else
if
total_delay_times
<
2
{
h_currentScore
=
5
}
else
{
h_currentScore
=
0
}
h_currentScore
=
GetScore
(
32
,
basicInfo
[
"total_delay_times"
])
h_totalScore
[
3
]
=
SetScore
(
h_currentScore
,
32
)
SetInsertScoreChanFooter
(
1
,
4
,
32
)
...
...
@@ -119,23 +71,8 @@ func HistoricalOverdueTimes() {
//近3个月的平均交易额(10分)
func
AverageMoneyThreeMonths
()
{
recently_three_average_amount
:=
StringTurnFloat64
(
basicInfo
[
"recently_three_average_amount"
])
if
recently_three_average_amount
<
1
*
100000
{
h_currentScore
=
0
}
else
if
recently_three_average_amount
<
2
*
100000
&&
recently_three_average_amount
>=
1
*
100000
{
h_currentScore
=
1
}
else
if
recently_three_average_amount
<
3
*
100000
&&
recently_three_average_amount
>=
2
*
100000
{
h_currentScore
=
2
}
else
if
recently_three_average_amount
<
5
*
100000
&&
recently_three_average_amount
>=
3
*
100000
{
h_currentScore
=
3
}
else
if
recently_three_average_amount
<
10
*
100000
&&
recently_three_average_amount
>=
5
*
100000
{
h_currentScore
=
5
}
else
if
recently_three_average_amount
>=
10
*
100000
{
h_currentScore
=
10
}
else
{
h_currentScore
=
0
}
h_currentScore
=
GetScore
(
33
,
basicInfo
[
"recently_three_average_amount"
])
h_totalScore
[
4
]
=
SetScore
(
h_currentScore
,
33
)
...
...
@@ -145,23 +82,7 @@ func AverageMoneyThreeMonths() {
//近6个月的平均交易额(10分)
func
AverageMoneySixMonths
()
{
recently_six_max_amount
:=
StringTurnFloat64
(
basicInfo
[
"recently_six_max_amount"
])
if
recently_six_max_amount
<
1
*
100000
{
h_currentScore
=
0
}
else
if
recently_six_max_amount
<
2
*
100000
&&
recently_six_max_amount
>=
1
*
100000
{
h_currentScore
=
1
}
else
if
recently_six_max_amount
<
3
*
100000
&&
recently_six_max_amount
>=
2
*
100000
{
h_currentScore
=
2
}
else
if
recently_six_max_amount
<
5
*
100000
&&
recently_six_max_amount
>=
3
*
100000
{
h_currentScore
=
3
}
else
if
recently_six_max_amount
<
10
*
100000
&&
recently_six_max_amount
>=
5
*
100000
{
h_currentScore
=
5
}
else
if
recently_six_max_amount
>=
10
*
100000
{
h_currentScore
=
10
}
else
{
h_currentScore
=
0
}
h_currentScore
=
GetScore
(
34
,
basicInfo
[
"recently_six_max_amount"
])
h_totalScore
[
5
]
=
SetScore
(
h_currentScore
,
34
)
...
...
cmd/static/main.go
View file @
2325d292
...
...
@@ -79,6 +79,7 @@ func main() {
insertScoreMsg
.
ComCreditsId
=
StringTurnInt64
(
v
[
"id"
])
GetCompanyRunInfo
(
c
)
SetSumScore
(
c
)
//break
}
...
...
cmd/static/personal_credit.go
View file @
2325d292
...
...
@@ -33,15 +33,7 @@ func PersonalCredit()(finalScore float64) {
//年龄(1分)
func
Age
()
{
age
:=
StringTurnInt64
(
companySoreFields
[
"age"
])
if
age
>
30
&&
age
<
50
{
p_currentScore
=
1
}
else
{
p_currentScore
=
0
}
p_currentScore
=
GetScore
(
17
,
companySoreFields
[
"age"
])
p_totalScore
[
0
]
=
SetScore
(
p_currentScore
,
17
)
SetInsertScoreChanFooter
(
1
,
3
,
17
)
}
...
...
@@ -49,13 +41,7 @@ func Age() {
//婚姻状况(1分)
func
MaritalStatus
()
{
marital_status
:=
StringTurnInt64
(
companySoreFields
[
"marital_status"
])
if
marital_status
==
1
{
p_currentScore
=
1
}
else
{
p_currentScore
=
0
}
p_currentScore
=
GetScore
(
18
,
companySoreFields
[
"marital_status"
])
p_totalScore
[
1
]
=
SetScore
(
p_currentScore
,
18
)
...
...
@@ -65,13 +51,7 @@ func MaritalStatus() {
//违约账户比(2分)
func
DefaultAccountRatio
()
{
account_ratio
:=
StringTurnFloat64
(
companySoreFields
[
"account_ratio"
])
if
account_ratio
<
20
{
p_currentScore
=
2
}
else
{
p_currentScore
=
0
}
p_currentScore
=
GetScore
(
19
,
companySoreFields
[
"account_ratio"
])
p_totalScore
[
2
]
=
SetScore
(
p_currentScore
,
19
)
...
...
@@ -81,13 +61,7 @@ func DefaultAccountRatio() {
//对外担保(5分)
func
ExternalGuarantee
()
{
guaranty
:=
StringTurnInt64
(
companySoreFields
[
"guaranty"
])
if
guaranty
==
1
{
p_currentScore
=
0
}
else
{
p_currentScore
=
5
}
p_currentScore
=
GetScore
(
20
,
companySoreFields
[
"guaranty"
])
p_totalScore
[
3
]
=
SetScore
(
p_currentScore
,
20
)
...
...
@@ -96,14 +70,7 @@ func ExternalGuarantee() {
//近2年内30天内逾期次数(3分)
func
SumBeOverdueMonthTwoYesar
()
{
two_years_th_days_overdue_times
:=
StringTurnInt64
(
companySoreFields
[
"two_years_th_days_overdue_times"
])
if
two_years_th_days_overdue_times
<
1
{
p_currentScore
=
3
}
else
{
p_currentScore
=
0
}
p_currentScore
=
GetScore
(
22
,
companySoreFields
[
"two_years_th_days_overdue_times"
])
p_totalScore
[
4
]
=
SetScore
(
p_currentScore
,
22
)
SetInsertScoreChanFooter
(
1
,
3
,
22
)
...
...
@@ -112,17 +79,8 @@ func SumBeOverdueMonthTwoYesar() {
//近2年内最大逾期金额(3分)two_years_max_overdue_amount
func
MaxBeOverdueTwoYears
()
{
two_years_max_overdue_amount
:=
StringTurnFloat64
(
companySoreFields
[
"two_years_max_overdue_amount"
])
if
two_years_max_overdue_amount
>=
10000
{
p_currentScore
=
0
}
else
if
two_years_max_overdue_amount
>=
5000
&&
two_years_max_overdue_amount
<
10000
{
p_currentScore
=
1
}
else
if
two_years_max_overdue_amount
>=
2000
&&
two_years_max_overdue_amount
<
5000
{
p_currentScore
=
2
}
else
if
two_years_max_overdue_amount
>=
0
&&
two_years_max_overdue_amount
<
2000
{
p_currentScore
=
3
}
p_currentScore
=
GetScore
(
23
,
companySoreFields
[
"two_years_max_overdue_amount"
])
p_totalScore
[
5
]
=
SetScore
(
p_currentScore
,
23
)
...
...
@@ -133,14 +91,8 @@ func MaxBeOverdueTwoYears() {
//是否存在当前逾期(3分)
func
IsBeOverdue
()
{
is_exist_now_overdue
:=
StringTurnInt64
(
companySoreFields
[
"is_exist_now_overdue"
])
if
is_exist_now_overdue
==
1
{
p_currentScore
=
0
}
else
{
p_currentScore
=
3
}
p_currentScore
=
GetScore
(
23
,
companySoreFields
[
"is_exist_now_overdue"
])
p_totalScore
[
6
]
=
SetScore
(
p_currentScore
,
24
)
...
...
@@ -151,13 +103,8 @@ func IsBeOverdue() {
//有无房贷(1分)
func
IsMortgage
()
{
presence_of_mortgage
:=
StringTurnInt64
(
companySoreFields
[
"presence_of_mortgage"
])
if
presence_of_mortgage
==
1
{
p_currentScore
=
0
}
else
{
p_currentScore
=
1
}
p_currentScore
=
GetScore
(
25
,
companySoreFields
[
"presence_of_mortgage"
])
p_totalScore
[
7
]
=
SetScore
(
p_currentScore
,
25
)
...
...
@@ -167,21 +114,8 @@ func IsMortgage() {
//近两个月征信查询次数(5分)
func
NumberOfCreditInquiryInThePastTwoMonths
()
{
two_months_credit_view_nums
:=
StringTurnInt64
(
companySoreFields
[
"two_months_credit_view_nums"
])
if
two_months_credit_view_nums
==
0
{
p_currentScore
=
5
}
else
if
two_months_credit_view_nums
==
1
{
p_currentScore
=
3
}
else
if
two_months_credit_view_nums
==
2
{
p_currentScore
=
2
}
else
if
two_months_credit_view_nums
==
3
{
p_currentScore
=
1
}
else
if
two_months_credit_view_nums
>=
4
{
p_currentScore
=
0
}
else
{
p_currentScore
=
0
}
p_currentScore
=
GetScore
(
26
,
companySoreFields
[
"two_months_credit_view_nums"
])
p_totalScore
[
8
]
=
SetScore
(
p_currentScore
,
26
)
...
...
@@ -191,13 +125,8 @@ func NumberOfCreditInquiryInThePastTwoMonths() {
//信用卡总额度(3分)
func
TotalCreditCardLimit
()
{
credit_card_total
:=
StringTurnInt64
(
companySoreFields
[
"credit_card_total"
])
if
credit_card_total
>=
200000
{
p_currentScore
=
3
}
else
{
p_currentScore
=
0
}
p_currentScore
=
GetScore
(
27
,
companySoreFields
[
"credit_card_total"
])
p_totalScore
[
9
]
=
SetScore
(
p_currentScore
,
27
)
...
...
@@ -207,13 +136,8 @@ func TotalCreditCardLimit() {
//单张信用卡最高额度(3分)
func
MaximumAmountOfSingleCreditCard
()
{
maximum_credit_card_limit
:=
StringTurnInt64
(
companySoreFields
[
"maximum_credit_card_limit"
])
p_currentScore
=
GetScore
(
28
,
companySoreFields
[
"maximum_credit_card_limit"
])
if
maximum_credit_card_limit
>=
100000
{
p_currentScore
=
3
}
else
{
p_currentScore
=
0
}
p_totalScore
[
10
]
=
SetScore
(
p_currentScore
,
28
)
...
...
internal/dao/add_score.go
View file @
2325d292
...
...
@@ -18,7 +18,7 @@ func (d *dao) GetCompanyAddSoreByCid(c context.Context, companyId int64) (res []
return
}
defer
rows
.
Close
()
defer
d
.
db
.
Close
()
if
err
!=
nil
{
fmt
.
Println
(
"select fail,err:"
,
err
)
...
...
internal/dao/basic_info.go
View file @
2325d292
...
...
@@ -18,7 +18,7 @@ func (d *dao) GetBasicInfoByCid(c context.Context, companyId int64) (res map[str
return
}
defer
rows
.
Close
()
defer
d
.
db
.
Close
()
if
err
!=
nil
{
fmt
.
Println
(
"select fail,err:"
,
err
)
...
...
internal/dao/com_basicinfos.go
View file @
2325d292
...
...
@@ -19,7 +19,7 @@ func (d *dao) GetCompanyBaseInfoByCid(c context.Context, companyId int64) (res m
return
}
defer
rows
.
Close
()
defer
d
.
db
.
Close
()
if
err
!=
nil
{
fmt
.
Println
(
"select fail,err:"
,
err
)
...
...
internal/dao/com_credits.go
View file @
2325d292
...
...
@@ -20,7 +20,7 @@ func (d *dao) GetCompanyCresitsList(ctx context.Context) (res []map[string]strin
return
}
defer
rows
.
Close
()
defer
d
.
db
.
Close
()
if
err
!=
nil
{
fmt
.
Println
(
"select fail,err:"
,
err
)
...
...
@@ -69,8 +69,6 @@ func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredi
row
.
RowsAffected
()
//defer d.db.Close()
return
}
...
...
internal/dao/credit_score_fields.go
View file @
2325d292
...
...
@@ -34,6 +34,7 @@ func (d *dao) GetCompanyScoreFieldsByCid(c context.Context, companyId int64) (re
res
=
v
break
}
defer
d
.
db
.
Close
()
return
}
\ No newline at end of file
internal/dao/dao.go
View file @
2325d292
...
...
@@ -35,6 +35,8 @@ type (
GetCompanyModelByProjectid
(
c
context
.
Context
,
companyId
int64
)
(
r
map
[
string
]
string
,
err
error
)
GetModelTopsetByProjectId
(
c
context
.
Context
,
companyId
int64
)
(
r
map
[
string
]
string
,
err
error
)
UpdateStaticSumScores
(
c
context
.
Context
,
com_credits
model
.
ComCredits
)
(
resId
int64
,
err
error
)
GetCompanyModelItemsByProjectid
(
c
context
.
Context
,
project_id
int64
,
score
float64
)
(
res
map
[
string
]
string
,
err
error
)
GetCompanyModelItemsByProjectidWitchString
(
c
context
.
Context
,
project_id
int64
,
stringVal
string
)
(
res
map
[
string
]
string
,
err
error
)
UpdateMoveSumScores
(
c
context
.
Context
,
com_credits
model
.
ComCredits
)
(
resId
int64
,
err
error
)
//---静态结束
...
...
internal/dao/lie_model.go
View file @
2325d292
...
...
@@ -33,6 +33,7 @@ func (d *dao) GetCompanyModelByProjectid(c context.Context, projectId int64) (re
res
=
v
break
}
defer
d
.
db
.
Close
()
return
}
\ No newline at end of file
internal/dao/model_items.go
0 → 100644
View file @
2325d292
package
dao
import
(
"context"
"fmt"
"github.com/pkg/errors"
"github.com/bilibili/kratos/pkg/database/sql"
)
//通过projectId获取该项信息
func
(
d
*
dao
)
GetCompanyModelItemsByProjectid
(
c
context
.
Context
,
project_id
int64
,
score
float64
)
(
res
map
[
string
]
string
,
err
error
)
{
var
(
rows
*
sql
.
Rows
)
if
rows
,
err
=
d
.
db
.
Query
(
c
,
"select "
+
SqlField
+
" from lie_model_items where project_id = ? and ladder_range_min <= ? and ladder_range_max > ? "
,
project_id
,
score
,
score
);
err
!=
nil
{
err
=
errors
.
WithStack
(
err
)
return
}
defer
rows
.
Close
()
if
err
!=
nil
{
fmt
.
Println
(
"select fail,err:"
,
err
)
return
}
twoMap
,
err
:=
GetAllParam
(
rows
)
for
_
,
v
:=
range
twoMap
{
res
=
v
break
}
defer
d
.
db
.
Close
()
fmt
.
Print
(
res
)
return
}
func
(
d
*
dao
)
GetCompanyModelItemsByProjectidWitchString
(
c
context
.
Context
,
project_id
int64
,
stringVal
string
)
(
res
map
[
string
]
string
,
err
error
)
{
var
(
rows
*
sql
.
Rows
)
if
rows
,
err
=
d
.
db
.
Query
(
c
,
"select "
+
SqlField
+
" from lie_model_items where project_id = ? and ladder_text = ? "
,
project_id
,
stringVal
);
err
!=
nil
{
err
=
errors
.
WithStack
(
err
)
return
}
defer
rows
.
Close
()
if
err
!=
nil
{
fmt
.
Println
(
"select fail,err:"
,
err
)
return
}
twoMap
,
err
:=
GetAllParam
(
rows
)
for
_
,
v
:=
range
twoMap
{
res
=
v
break
}
defer
d
.
db
.
Close
()
fmt
.
Print
(
res
)
return
}
\ No newline at end of file
internal/dao/model_topset.go
View file @
2325d292
...
...
@@ -32,6 +32,7 @@ func (d *dao) GetModelTopsetByProjectId(c context.Context, projectId int64) (res
res
=
v
break
}
defer
d
.
db
.
Close
()
return
}
internal/model/moel_items.go
View file @
2325d292
...
...
@@ -12,3 +12,22 @@ type ModelItems struct {
Score
int64
`json:"id"`
//'阶梯分值'
Creator
string
`json:"id"`
//'创建人'
}
/*CREATE TABLE `lie_model_items` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '模型条目ID',
`model_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '关联模型ID',
`project_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '项目ID',
`project_name` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '项目名称',
`full_score` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '满分分值',
`ladder_range_min` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '阶梯范围最小值',
`ladder_range_max` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '阶梯范围最大值',
`ladder_text` text CHARACTER SET utf8 NOT NULL COMMENT '阶梯信息文本',
`score` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '阶梯分值',
`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`),
KEY `model_id` (`model_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COMMENT='模型阶梯配置表';*/
\ 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