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
f048a091
authored
Dec 16, 2019
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
增加相应的代码
parent
6d9aeb15
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
186 additions
and
169 deletions
cmd/static/Common.go → cmd/static/detail/Common.go
cmd/static/add_score.go → cmd/static/detail/add_score.go
cmd/static/detail/com_var.go
cmd/static/company_info.go → cmd/static/detail/company_info.go
cmd/static/enterprise_credit.go → cmd/static/detail/enterprise_credit.go
cmd/static/history_bussiness.go → cmd/static/detail/history_bussiness.go
cmd/static/personal_credit.go → cmd/static/detail/personal_credit.go
cmd/static/main.go
internal/dao/lie_model.go
internal/dao/model_items.go
internal/service/service.go
cmd/static/Common.go
→
cmd/static/
detail/
Common.go
View file @
f048a091
package
main
package
detail
import
(
"context"
"fmt"
"kaopu-server/internal/dao"
"strconv"
"time"
)
//计算单一项总的静态分
func
SetSumScore
(
c
context
.
Context
)
{
com_credits
.
Id
=
i
nsertScoreMsg
.
ComCreditsId
c
om_credits
.
StaticCreditScore
=
CompanyInfo
()
+
AddScore
()
+
EnterPriseCredit
()
+
HistoryBussiness
()
+
PersonalCredit
()
_
,
err
:=
svclient
.
UpdateStaticSumScores
(
c
,
c
om_credits
)
Com_credits
.
Id
=
I
nsertScoreMsg
.
ComCreditsId
C
om_credits
.
StaticCreditScore
=
CompanyInfo
()
+
AddScore
()
+
EnterPriseCredit
()
+
HistoryBussiness
()
+
PersonalCredit
()
_
,
err
:=
Svclient
.
UpdateStaticSumScores
(
c
,
C
om_credits
)
fmt
.
Print
(
err
)
}
//协程增加分值记录
func
InsertRecord
()
{
for
insertScoreMsgRecord
:=
range
s
ocreRecordChan
{
insertId
,
err
:=
svclient
.
InsertScores
(
conclient
,
i
nsertScoreMsgRecord
)
for
InsertScoreMsgRecord
:=
range
S
ocreRecordChan
{
insertId
,
err
:=
Svclient
.
InsertScores
(
Conclient
,
I
nsertScoreMsgRecord
)
if
err
!=
nil
{
fmt
.
Print
(
err
)
}
fmt
.
Print
(
insertId
)
}
defer
w
g
.
Done
()
defer
W
g
.
Done
()
}
//设置插入的分数头
func
SetInsertScoreChanFooter
(
_typy
,
project_pid
,
project_id
int8
)
{
insertScoreMsg
.
Type
,
insertScoreMsg
.
ProjectPid
,
i
nsertScoreMsg
.
ProjectId
=
_typy
,
project_pid
,
project_id
socreRecordChan
<-
i
nsertScoreMsg
InsertScoreMsg
.
Type
,
InsertScoreMsg
.
ProjectPid
,
I
nsertScoreMsg
.
ProjectId
=
_typy
,
project_pid
,
project_id
SocreRecordChan
<-
I
nsertScoreMsg
}
//获取详细的计算基本数据
func
GetCompanyRunInfo
()
{
companyBasicInfo
,
_
=
svclient
.
GetCompanyBaseInfoByCid
(
conclient
,
i
nsertScoreMsg
.
ComCreditsId
)
companySoreFields
,
_
=
svclient
.
GetCompanyScoreFieldsByCid
(
conclient
,
i
nsertScoreMsg
.
ComCreditsId
)
companyAddScore
,
_
=
svclient
.
GetCompanyAddSoreByCid
(
conclient
,
i
nsertScoreMsg
.
ComCreditsId
)
CompanyBasicInfo
,
_
=
Svclient
.
GetCompanyBaseInfoByCid
(
Conclient
,
I
nsertScoreMsg
.
ComCreditsId
)
CompanySoreFields
,
_
=
Svclient
.
GetCompanyScoreFieldsByCid
(
Conclient
,
I
nsertScoreMsg
.
ComCreditsId
)
CompanyAddScore
,
_
=
Svclient
.
GetCompanyAddSoreByCid
(
Conclient
,
I
nsertScoreMsg
.
ComCreditsId
)
}
func
GetTimeStamp
()(
timestamp
int64
)
{
...
...
@@ -58,33 +57,25 @@ func StringTurnFloat64(val string)(float64) {
//获取项目详情
func
getModelByProjectId
(
projectId
int64
)(
modelInfo
map
[
string
]
string
)
{
ctx
:=
context
.
Background
()
connect
:=
dao
.
New
()
res
,
_
:=
connect
.
GetCompanyModelByProjectid
(
ctx
,
projectId
)
res
,
_
:=
Svclient
.
GetCompanyModelByProjectid
(
Conclient
,
projectId
)
return
res
}
//获取顶头详情
func
GetModelTopsetByProjectId
(
projectId
int64
)(
modelInfo
map
[
string
]
string
)
{
ctx
:=
context
.
Background
()
connect
:=
dao
.
New
()
res
,
_
:=
connect
.
GetModelTopsetByProjectId
(
ctx
,
projectId
)
res
,
_
:=
Svclient
.
GetModelTopsetByProjectId
(
Conclient
,
projectId
)
return
res
}
//获取顶头详情
func
GetCompanyModelItemsByProjectid
(
projectId
int64
,
score
float64
)
(
modelInfo
map
[
string
]
string
)
{
ctx
:=
context
.
Background
()
connect
:=
dao
.
New
()
res
,
_
:=
connect
.
GetCompanyModelItemsByProjectid
(
ctx
,
projectId
,
score
)
res
,
_
:=
Svclient
.
GetCompanyModelItemsByProjectid
(
Conclient
,
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
)
res
,
_
:=
Svclient
.
GetCompanyModelItemsByProjectidWitchString
(
Conclient
,
project_id
,
stringVal
)
return
res
}
...
...
@@ -92,9 +83,7 @@ func GetScore(projectId int64, stringVal string) (fianlscore float64) {
var
score
float64
ctx
:=
context
.
Background
()
connect
:=
dao
.
New
()
modelTypeInfo
,
_
:=
connect
.
GetCompanyModelByProjectid
(
ctx
,
projectId
)
modelTypeInfo
,
_
:=
Svclient
.
GetCompanyModelByProjectid
(
Conclient
,
projectId
)
modelInfo
:=
make
(
map
[
string
]
string
)
...
...
@@ -125,12 +114,12 @@ func SetScore(curretScoreRelace float64,modelId int64)(fimalScore float64) {
curretScoreRelace
=
StringTurnFloat64
(
modelInfo
[
"full_score"
])
}
i
nsertScoreMsg
.
TotalScore
=
curretScoreRelace
I
nsertScoreMsg
.
TotalScore
=
curretScoreRelace
//设置分数
insertScoreMsg
.
FinalScore
,
i
nsertScoreMsg
.
CurrentScore
=
curretScoreRelace
*
weightReplace
,
curretScoreRelace
*
weightReplace
i
nsertScoreMsg
.
Weight
=
weightReplace
return
i
nsertScoreMsg
.
FinalScore
InsertScoreMsg
.
FinalScore
,
I
nsertScoreMsg
.
CurrentScore
=
curretScoreRelace
*
weightReplace
,
curretScoreRelace
*
weightReplace
I
nsertScoreMsg
.
Weight
=
weightReplace
return
I
nsertScoreMsg
.
FinalScore
}
//设置project总分
...
...
@@ -149,26 +138,26 @@ func SetProjectScore(totalScoreReplace [20]float64, weightReplace float64, fullS
}
}
insertScoreMsg
.
CurrentScore
,
i
nsertScoreMsg
.
TotalScore
=
sumScore
,
sumScore
InsertScoreMsg
.
CurrentScore
,
I
nsertScoreMsg
.
TotalScore
=
sumScore
,
sumScore
//如果是0则不判断了
if
sumScore
==
0
{
i
nsertScoreMsg
.
FinalScore
=
0
I
nsertScoreMsg
.
FinalScore
=
0
}
else
{
//如果最后金额大于满分,则算为最满分
if
sumScore
>
fullScore
{
i
nsertScoreMsg
.
TotalScore
=
fullScore
I
nsertScoreMsg
.
TotalScore
=
fullScore
}
else
{
i
nsertScoreMsg
.
TotalScore
=
sumScore
I
nsertScoreMsg
.
TotalScore
=
sumScore
}
//经过权重计算之后的总分值
i
nsertScoreMsg
.
FinalScore
=
sumScore
*
weightReplace
I
nsertScoreMsg
.
FinalScore
=
sumScore
*
weightReplace
}
fmt
.
Print
(
"
insertScoreMsg.FinalScore"
,
i
nsertScoreMsg
.
FinalScore
)
fmt
.
Print
(
"
InsertScoreMsg.FinalScore"
,
I
nsertScoreMsg
.
FinalScore
)
i
nsertScoreMsg
.
Weight
=
weightReplace
I
nsertScoreMsg
.
Weight
=
weightReplace
return
i
nsertScoreMsg
.
FinalScore
return
I
nsertScoreMsg
.
FinalScore
}
\ No newline at end of file
cmd/static/add_score.go
→
cmd/static/
detail/
add_score.go
View file @
f048a091
package
main
package
detail
//加分项30分)
func
AddScore
()(
finalScore
float64
)
{
...
...
@@ -7,16 +7,16 @@ func AddScore()(finalScore float64) {
sumScore
float64
=
0
)
for
_
,
v
:=
range
c
ompanyAddScore
{
for
_
,
v
:=
range
C
ompanyAddScore
{
sumScore
+=
StringTurnFloat64
(
v
[
"final_score"
])
}
//经过权重计算之后的总分值
insertScoreMsg
.
FinalScore
,
insertScoreMsg
.
TotalScore
,
i
nsertScoreMsg
.
CurrentScore
=
sumScore
,
sumScore
,
sumScore
i
nsertScoreMsg
.
Weight
=
1
InsertScoreMsg
.
FinalScore
,
InsertScoreMsg
.
TotalScore
,
I
nsertScoreMsg
.
CurrentScore
=
sumScore
,
sumScore
,
sumScore
I
nsertScoreMsg
.
Weight
=
1
SetInsertScoreChanFooter
(
1
,
0
,
5
)
finalScore
=
i
nsertScoreMsg
.
FinalScore
finalScore
=
I
nsertScoreMsg
.
FinalScore
return
finalScore
}
...
...
cmd/static/detail/com_var.go
0 → 100644
View file @
f048a091
package
detail
import
(
"context"
"kaopu-server/internal/model"
"kaopu-server/internal/service"
"sync"
)
var
(
//获取的公司信息
CompanyData
[]
map
[
string
]
string
//分数记录通道
SocreRecordChan
=
make
(
chan
model
.
Scores
)
//分数的数据
InsertScoreMsg
model
.
Scores
//公司总的信息
Com_credits
model
.
ComCredits
//公司的详细数据
CompanyBasicInfo
map
[
string
]
string
//公司的逾期数据
CompanySoreFields
map
[
string
]
string
//公司的历史数据
BasicInfo
map
[
string
]
string
//公司的加分数据
CompanyAddScore
[]
map
[
string
]
string
//设置等待
Wg
sync
.
WaitGroup
//设置svclient
Svclient
*
service
.
Service
//content Client
Conclient
context
.
Context
)
cmd/static/company_info.go
→
cmd/static/
detail/
company_info.go
View file @
f048a091
package
main
package
detail
import
(
"strconv"
...
...
@@ -35,7 +35,7 @@ func CompanyInfo()(finalScore float64) {
//成立时间(1分) 大于五年1分,小于零分
func
EstablishmentTime
()
{
establishment_time
:=
StringTurnInt64
(
c
ompanyBasicInfo
[
"establishment_time"
])
establishment_time
:=
StringTurnInt64
(
C
ompanyBasicInfo
[
"establishment_time"
])
diffTime
:=
(
GetTimeStamp
()
-
establishment_time
)
/
(
3600
*
24
*
365
)
c_currentScore
=
GetScore
(
8
,
strconv
.
FormatInt
(
diffTime
,
10
))
...
...
@@ -46,7 +46,7 @@ func EstablishmentTime() {
//公司性质(1分)上,国,央,一分,其它零分
func
CompanyNature
()
{
c_currentScore
=
GetScore
(
9
,
c
ompanyBasicInfo
[
"customer_property"
])
c_currentScore
=
GetScore
(
9
,
C
ompanyBasicInfo
[
"customer_property"
])
c_totalScore
[
1
]
=
SetScore
(
c_currentScore
,
9
)
...
...
@@ -55,7 +55,7 @@ func CompanyNature() {
//5年内法人变更次数(1分)
func
ChangeslegalInFiveYears
()
{
c_currentScore
=
GetScore
(
10
,
c
ompanyBasicInfo
[
"five_legal_change"
])
c_currentScore
=
GetScore
(
10
,
C
ompanyBasicInfo
[
"five_legal_change"
])
c_totalScore
[
2
]
=
SetScore
(
c_currentScore
,
10
)
SetInsertScoreChanFooter
(
1
,
1
,
10
)
...
...
@@ -63,14 +63,14 @@ func ChangeslegalInFiveYears() {
//注册资本(2分)
func
RegisteredCapital
()
{
c_currentScore
=
GetScore
(
11
,
c
ompanyBasicInfo
[
"registered_capital"
])
c_currentScore
=
GetScore
(
11
,
C
ompanyBasicInfo
[
"registered_capital"
])
c_totalScore
[
3
]
=
SetScore
(
c_currentScore
,
11
)
SetInsertScoreChanFooter
(
1
,
1
,
11
)
}
//年纳税额(2分)
func
AnnualTaxRate
()
{
c_currentScore
=
GetScore
(
12
,
c
ompanyBasicInfo
[
"year_tax_payable"
])
c_currentScore
=
GetScore
(
12
,
C
ompanyBasicInfo
[
"year_tax_payable"
])
c_totalScore
[
4
]
=
SetScore
(
c_currentScore
,
12
)
SetInsertScoreChanFooter
(
1
,
1
,
12
)
...
...
@@ -78,7 +78,7 @@ func AnnualTaxRate() {
//近两年内有无诉讼(2分)
func
lawsuitsInPastTwoYars
()
{
c_currentScore
=
GetScore
(
13
,
c
ompanyBasicInfo
[
"two_years_no_lawsuit"
])
c_currentScore
=
GetScore
(
13
,
C
ompanyBasicInfo
[
"two_years_no_lawsuit"
])
c_totalScore
[
5
]
=
SetScore
(
c_currentScore
,
13
)
SetInsertScoreChanFooter
(
1
,
1
,
13
)
...
...
@@ -86,7 +86,7 @@ func lawsuitsInPastTwoYars() {
//社保参保人数(1分)
func
NumberOfSocial
()
{
c_currentScore
=
GetScore
(
14
,
c
ompanyBasicInfo
[
"social_security_participants"
])
c_currentScore
=
GetScore
(
14
,
C
ompanyBasicInfo
[
"social_security_participants"
])
c_totalScore
[
6
]
=
SetScore
(
c_currentScore
,
14
)
SetInsertScoreChanFooter
(
1
,
1
,
14
)
...
...
cmd/static/enterprise_credit.go
→
cmd/static/
detail/
enterprise_credit.go
View file @
f048a091
package
main
package
detail
var
(
e_totalScore
[
20
]
float64
...
...
@@ -23,7 +23,7 @@ func EnterPriseCredit()(finalScore float64) {
//企业有无负债(5分)
func
IsEnterpriseOverdueWhether
()
{
e_currentScore
=
GetScore
(
15
,
c
ompanySoreFields
[
"company_has_liabilities"
])
e_currentScore
=
GetScore
(
15
,
C
ompanySoreFields
[
"company_has_liabilities"
])
e_totalScore
[
0
]
=
SetScore
(
e_currentScore
,
15
)
...
...
@@ -33,7 +33,7 @@ func IsEnterpriseOverdueWhether() {
//历史有无逾期(5分)
func
IsHistoryOverdue
()
{
e_currentScore
=
GetScore
(
15
,
c
ompanySoreFields
[
"history_overdue"
])
e_currentScore
=
GetScore
(
15
,
C
ompanySoreFields
[
"history_overdue"
])
e_totalScore
[
1
]
=
SetScore
(
e_currentScore
,
16
)
...
...
cmd/static/history_bussiness.go
→
cmd/static/
detail/
history_bussiness.go
View file @
f048a091
package
main
package
detail
import
(
"strconv"
...
...
@@ -32,7 +32,7 @@ func HistoryBussiness()(finalScore float64) {
//合作时间(5分)
func
CooperationTime
()
{
first_order_time
:=
StringTurnInt64
(
b
asicInfo
[
"first_order_time"
])
first_order_time
:=
StringTurnInt64
(
B
asicInfo
[
"first_order_time"
])
diffTime
:=
(
GetTimeStamp
()
-
first_order_time
)
/
(
3600
*
24
*
365
)
h_currentScore
=
GetScore
(
29
,
strconv
.
FormatInt
(
diffTime
,
10
))
...
...
@@ -46,7 +46,7 @@ func CooperationTime() {
func
AccumulatedAmountOfCooperation
()
{
h_currentScore
=
GetScore
(
30
,
b
asicInfo
[
"total_order_amount"
])
h_currentScore
=
GetScore
(
30
,
B
asicInfo
[
"total_order_amount"
])
h_totalScore
[
1
]
=
SetScore
(
h_currentScore
,
30
)
SetInsertScoreChanFooter
(
1
,
4
,
30
)
...
...
@@ -55,7 +55,7 @@ func AccumulatedAmountOfCooperation() {
//累计毛利(10分)
func
AccumulatedGrossProfit
()
{
h_currentScore
=
GetScore
(
31
,
b
asicInfo
[
"total_gross_profit"
])
h_currentScore
=
GetScore
(
31
,
B
asicInfo
[
"total_gross_profit"
])
h_totalScore
[
2
]
=
SetScore
(
h_currentScore
,
31
)
SetInsertScoreChanFooter
(
1
,
4
,
31
)
...
...
@@ -64,7 +64,7 @@ func AccumulatedGrossProfit() {
//历史逾期次数(5分)
func
HistoricalOverdueTimes
()
{
h_currentScore
=
GetScore
(
32
,
b
asicInfo
[
"total_delay_times"
])
h_currentScore
=
GetScore
(
32
,
B
asicInfo
[
"total_delay_times"
])
h_totalScore
[
3
]
=
SetScore
(
h_currentScore
,
32
)
SetInsertScoreChanFooter
(
1
,
4
,
32
)
...
...
@@ -73,7 +73,7 @@ func HistoricalOverdueTimes() {
//近3个月的平均交易额(10分)
func
AverageMoneyThreeMonths
()
{
h_currentScore
=
GetScore
(
33
,
b
asicInfo
[
"recently_three_average_amount"
])
h_currentScore
=
GetScore
(
33
,
B
asicInfo
[
"recently_three_average_amount"
])
h_totalScore
[
4
]
=
SetScore
(
h_currentScore
,
33
)
...
...
@@ -83,7 +83,7 @@ func AverageMoneyThreeMonths() {
//近6个月的平均交易额(10分)
func
AverageMoneySixMonths
()
{
h_currentScore
=
GetScore
(
34
,
b
asicInfo
[
"recently_six_max_amount"
])
h_currentScore
=
GetScore
(
34
,
B
asicInfo
[
"recently_six_max_amount"
])
h_totalScore
[
5
]
=
SetScore
(
h_currentScore
,
34
)
...
...
cmd/static/personal_credit.go
→
cmd/static/
detail/
personal_credit.go
View file @
f048a091
package
main
package
detail
var
(
...
...
@@ -33,7 +33,7 @@ func PersonalCredit()(finalScore float64) {
//年龄(1分)
func
Age
()
{
p_currentScore
=
GetScore
(
17
,
c
ompanySoreFields
[
"age"
])
p_currentScore
=
GetScore
(
17
,
C
ompanySoreFields
[
"age"
])
p_totalScore
[
0
]
=
SetScore
(
p_currentScore
,
17
)
SetInsertScoreChanFooter
(
1
,
3
,
17
)
}
...
...
@@ -41,7 +41,7 @@ func Age() {
//婚姻状况(1分)
func
MaritalStatus
()
{
p_currentScore
=
GetScore
(
18
,
c
ompanySoreFields
[
"marital_status"
])
p_currentScore
=
GetScore
(
18
,
C
ompanySoreFields
[
"marital_status"
])
p_totalScore
[
1
]
=
SetScore
(
p_currentScore
,
18
)
...
...
@@ -51,7 +51,7 @@ func MaritalStatus() {
//违约账户比(2分)
func
DefaultAccountRatio
()
{
p_currentScore
=
GetScore
(
19
,
c
ompanySoreFields
[
"account_ratio"
])
p_currentScore
=
GetScore
(
19
,
C
ompanySoreFields
[
"account_ratio"
])
p_totalScore
[
2
]
=
SetScore
(
p_currentScore
,
19
)
...
...
@@ -61,7 +61,7 @@ func DefaultAccountRatio() {
//对外担保(5分)
func
ExternalGuarantee
()
{
p_currentScore
=
GetScore
(
20
,
c
ompanySoreFields
[
"guaranty"
])
p_currentScore
=
GetScore
(
20
,
C
ompanySoreFields
[
"guaranty"
])
p_totalScore
[
3
]
=
SetScore
(
p_currentScore
,
20
)
...
...
@@ -70,7 +70,7 @@ func ExternalGuarantee() {
//近2年内30天内逾期次数(3分)
func
SumBeOverdueMonthTwoYesar
()
{
p_currentScore
=
GetScore
(
22
,
c
ompanySoreFields
[
"two_years_th_days_overdue_times"
])
p_currentScore
=
GetScore
(
22
,
C
ompanySoreFields
[
"two_years_th_days_overdue_times"
])
p_totalScore
[
4
]
=
SetScore
(
p_currentScore
,
22
)
SetInsertScoreChanFooter
(
1
,
3
,
22
)
...
...
@@ -80,7 +80,7 @@ func SumBeOverdueMonthTwoYesar() {
func
MaxBeOverdueTwoYears
()
{
p_currentScore
=
GetScore
(
23
,
c
ompanySoreFields
[
"two_years_max_overdue_amount"
])
p_currentScore
=
GetScore
(
23
,
C
ompanySoreFields
[
"two_years_max_overdue_amount"
])
p_totalScore
[
5
]
=
SetScore
(
p_currentScore
,
23
)
...
...
@@ -92,7 +92,7 @@ func MaxBeOverdueTwoYears() {
func
IsBeOverdue
()
{
p_currentScore
=
GetScore
(
23
,
c
ompanySoreFields
[
"is_exist_now_overdue"
])
p_currentScore
=
GetScore
(
23
,
C
ompanySoreFields
[
"is_exist_now_overdue"
])
p_totalScore
[
6
]
=
SetScore
(
p_currentScore
,
24
)
...
...
@@ -104,7 +104,7 @@ func IsBeOverdue() {
func
IsMortgage
()
{
p_currentScore
=
GetScore
(
25
,
c
ompanySoreFields
[
"presence_of_mortgage"
])
p_currentScore
=
GetScore
(
25
,
C
ompanySoreFields
[
"presence_of_mortgage"
])
p_totalScore
[
7
]
=
SetScore
(
p_currentScore
,
25
)
...
...
@@ -115,7 +115,7 @@ func IsMortgage() {
func
NumberOfCreditInquiryInThePastTwoMonths
()
{
p_currentScore
=
GetScore
(
26
,
c
ompanySoreFields
[
"two_months_credit_view_nums"
])
p_currentScore
=
GetScore
(
26
,
C
ompanySoreFields
[
"two_months_credit_view_nums"
])
p_totalScore
[
8
]
=
SetScore
(
p_currentScore
,
26
)
...
...
@@ -126,7 +126,7 @@ func NumberOfCreditInquiryInThePastTwoMonths() {
func
TotalCreditCardLimit
()
{
p_currentScore
=
GetScore
(
27
,
c
ompanySoreFields
[
"credit_card_total"
])
p_currentScore
=
GetScore
(
27
,
C
ompanySoreFields
[
"credit_card_total"
])
p_totalScore
[
9
]
=
SetScore
(
p_currentScore
,
27
)
...
...
@@ -136,7 +136,7 @@ func TotalCreditCardLimit() {
//单张信用卡最高额度(3分)
func
MaximumAmountOfSingleCreditCard
()
{
p_currentScore
=
GetScore
(
28
,
c
ompanySoreFields
[
"maximum_credit_card_limit"
])
p_currentScore
=
GetScore
(
28
,
C
ompanySoreFields
[
"maximum_credit_card_limit"
])
p_totalScore
[
10
]
=
SetScore
(
p_currentScore
,
28
)
...
...
cmd/static/main.go
View file @
f048a091
...
...
@@ -8,111 +8,44 @@ import (
"github.com/bilibili/kratos/pkg/conf/paladin"
"github.com/bilibili/kratos/pkg/log"
"github.com/ichunt2019/go-msgserver/utils/rabbitmq"
"kaopu-server/cmd/static/detail"
"kaopu-server/internal/model"
"kaopu-server/internal/service"
"os"
"sync"
"time"
)
var
(
//获取的公司信息
companyData
[]
map
[
string
]
string
//分数记录通道
socreRecordChan
=
make
(
chan
model
.
Scores
)
//分数的数据
insertScoreMsg
model
.
Scores
//公司总的信息
com_credits
model
.
ComCredits
//公司的详细数据
companyBasicInfo
map
[
string
]
string
//公司的逾期数据
companySoreFields
map
[
string
]
string
//公司的历史数据
basicInfo
map
[
string
]
string
//公司的加分数据
companyAddScore
[]
map
[
string
]
string
//设置等待
wg
sync
.
WaitGroup
//设置svclient
svclient
*
service
.
Service
//content Client
conclient
context
.
Context
)
type
RecvPro
struct
{
}
type
Rabitmq
struct
{
Dsn
string
//rabitmq 配置1
}
func
(
t
*
RecvPro
)
FailAction
([]
byte
)
error
{
fmt
.
Print
(
1
)
panic
(
"implement me"
)
}
type
RabbitMsg
struct
{
ComCreditsId
string
`json:"com_credits_id"`
ErpCompanyCode
string
`json:"erp_company_code"`
}
//获取配置参数
func
GetConfig
()
{
//获取输入参数
flag
.
Parse
()
if
err
:=
paladin
.
Init
();
err
!=
nil
{
panic
(
err
)
}
//初始化日志目录
SetLog
(
"kaopuserver start"
,
0
)
}
func
SetLog
(
k
string
,
v
interface
{}){
//初始化日志目录
log
.
Init
(
&
log
.
Config
{
Dir
:
"logs"
})
defer
log
.
Close
()
log
.
Info
(
k
,
v
)
}
func
main
()
{
//获取config
GetConfig
()
s
vclient
=
service
.
New
()
c
onclient
=
context
.
Background
()
GetConfig
()
detail
.
S
vclient
=
service
.
New
()
detail
.
C
onclient
=
context
.
Background
()
if
os
.
Args
[
2
]
==
"one"
{
//设置协程数量
w
g
.
Add
(
1
)
detail
.
W
g
.
Add
(
1
)
go
InsertRecord
()
go
detail
.
InsertRecord
()
//调用服务获取公司信息,然后进行全局赋值
companyData
,
_
=
svclient
.
GetCompanyCresitsList
(
c
onclient
)
detail
.
CompanyData
,
_
=
detail
.
Svclient
.
GetCompanyCresitsList
(
detail
.
C
onclient
)
for
_
,
v
:=
range
c
ompanyData
{
for
_
,
v
:=
range
detail
.
C
ompanyData
{
insertScoreMsg
.
ComCreditsId
=
StringTurnInt64
(
v
[
"id"
])
GetCompanyRunInfo
()
basicInfo
,
_
=
svclient
.
GetBasicInfoByCid
(
c
onclient
,
v
[
"erp_company_code"
])
SetSumScore
(
c
onclient
)
detail
.
InsertScoreMsg
.
ComCreditsId
=
detail
.
StringTurnInt64
(
v
[
"id"
])
detail
.
GetCompanyRunInfo
()
detail
.
BasicInfo
,
_
=
detail
.
Svclient
.
GetBasicInfoByCid
(
detail
.
C
onclient
,
v
[
"erp_company_code"
])
detail
.
SetSumScore
(
detail
.
C
onclient
)
//break
}
//赋值完关闭通道
close
(
s
ocreRecordChan
)
w
g
.
Wait
()
close
(
detail
.
S
ocreRecordChan
)
detail
.
W
g
.
Wait
()
}
else
{
...
...
@@ -158,26 +91,68 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
fmt
.
Print
(
rbm
)
s
ocreRecordChan
=
make
(
chan
model
.
Scores
)
detail
.
S
ocreRecordChan
=
make
(
chan
model
.
Scores
)
//设置协程数量
w
g
.
Add
(
1
)
detail
.
W
g
.
Add
(
1
)
c
onclient
=
context
.
Background
()
go
InsertRecord
()
detail
.
C
onclient
=
context
.
Background
()
go
detail
.
InsertRecord
()
insertScoreMsg
.
ComCreditsId
=
StringTurnInt64
(
rbm
.
ComCreditsId
)
GetCompanyRunInfo
()
basicInfo
,
_
=
svclient
.
GetBasicInfoByCid
(
c
onclient
,
rbm
.
ErpCompanyCode
)
SetSumScore
(
c
onclient
)
detail
.
InsertScoreMsg
.
ComCreditsId
=
detail
.
StringTurnInt64
(
rbm
.
ComCreditsId
)
detail
.
GetCompanyRunInfo
()
detail
.
BasicInfo
,
_
=
detail
.
Svclient
.
GetBasicInfoByCid
(
detail
.
C
onclient
,
rbm
.
ErpCompanyCode
)
detail
.
SetSumScore
(
detail
.
C
onclient
)
//赋值完关闭通道
close
(
s
ocreRecordChan
)
w
g
.
Wait
()
close
(
detail
.
S
ocreRecordChan
)
detail
.
W
g
.
Wait
()
return
nil
}
type
RecvPro
struct
{
}
type
Rabitmq
struct
{
Dsn
string
//rabitmq 配置1
}
func
(
t
*
RecvPro
)
FailAction
([]
byte
)
error
{
fmt
.
Print
(
1
)
panic
(
"implement me"
)
}
type
RabbitMsg
struct
{
ComCreditsId
string
`json:"com_credits_id"`
ErpCompanyCode
string
`json:"erp_company_code"`
}
//获取配置参数
func
GetConfig
()
{
//获取输入参数
flag
.
Parse
()
if
err
:=
paladin
.
Init
();
err
!=
nil
{
panic
(
err
)
}
//初始化日志目录
SetLog
(
"kaopuserver start"
,
0
)
}
func
SetLog
(
k
string
,
v
interface
{}){
//初始化日志目录
log
.
Init
(
&
log
.
Config
{
Dir
:
"logs"
})
defer
log
.
Close
()
log
.
Info
(
k
,
v
)
}
internal/dao/lie_model.go
View file @
f048a091
...
...
@@ -33,7 +33,6 @@ 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
View file @
f048a091
...
...
@@ -62,7 +62,6 @@ func (d *dao) GetCompanyModelItemsByProjectidWitchString(c context.Context, proj
res
=
v
break
}
defer
d
.
db
.
Close
()
fmt
.
Print
(
res
)
...
...
internal/service/service.go
View file @
f048a091
...
...
@@ -116,6 +116,25 @@ func (s *Service) GetCompanyAddSore(c context.Context, companyId int64) (res []m
return
}
//获取模型的详细数据
func
(
s
*
Service
)
GetCompanyModelItemsByProjectidWitchString
(
c
context
.
Context
,
project_id
int64
,
stringVal
string
)
(
res
map
[
string
]
string
,
err
error
){
res
,
err
=
s
.
dao
.
GetCompanyModelItemsByProjectidWitchString
(
c
,
project_id
,
stringVal
)
return
}
//获取模型的头部信息
func
(
s
*
Service
)
GetModelTopsetByProjectId
(
c
context
.
Context
,
companyId
int64
)
(
res
map
[
string
]
string
,
err
error
){
res
,
err
=
s
.
dao
.
GetModelTopsetByProjectId
(
c
,
companyId
)
return
}
func
(
s
*
Service
)
GetCompanyModelItemsByProjectid
(
c
context
.
Context
,
project_id
int64
,
score
float64
)
(
res
map
[
string
]
string
,
err
error
){
res
,
err
=
s
.
dao
.
GetCompanyModelItemsByProjectid
(
c
,
project_id
,
score
)
return
}
// 修改公司静态加分项
func
(
s
*
Service
)
UpdateStaticSumScores
(
c
context
.
Context
,
com_credits
model
.
ComCredits
)
(
res
int64
,
err
error
)
{
...
...
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