Commit a02143e8 by Joneq

增加参数方式

parent f3bfe591
package main package main
var( var(
currentScore float64 c_currentScore float64
totalScore [20]float64 c_totalScore [20]float64
weight float64 weight float64
) )
...@@ -23,7 +23,7 @@ func CompanyInfo() { ...@@ -23,7 +23,7 @@ func CompanyInfo() {
NumberOfSocial() NumberOfSocial()
setProjectScore(totalScore,weight,stringTurnFloat64(modelInfo["full_score"])) setProjectScore(c_totalScore,weight,stringTurnFloat64(modelInfo["full_score"]))
setInsertScoreChanFooter(1,0,1) setInsertScoreChanFooter(1,0,1)
} }
...@@ -37,14 +37,14 @@ func EstablishmentTime() { ...@@ -37,14 +37,14 @@ func EstablishmentTime() {
//五年以上有分 //五年以上有分
if diffTime > (3600 * 24 * 365 * 5) { if diffTime > (3600 * 24 * 365 * 5) {
currentScore = 1 c_currentScore = 1
} else { } else {
currentScore = 0 c_currentScore = 0
} }
totalScore[0]= currentScore c_totalScore[0]= c_currentScore
setScore(currentScore,weight) setScore(c_currentScore,weight)
setInsertScoreChanFooter(1,1,8) setInsertScoreChanFooter(1,1,8)
} }
...@@ -55,14 +55,14 @@ func CompanyNature() { ...@@ -55,14 +55,14 @@ func CompanyNature() {
customer_property := stringTurnInt64(companyBasicInfo["customer_property"]) customer_property := stringTurnInt64(companyBasicInfo["customer_property"])
if customer_property == 0 { if customer_property == 0 {
currentScore = 0 c_currentScore = 0
}else{ }else{
currentScore = 1 c_currentScore = 1
} }
totalScore[1]= currentScore c_totalScore[1]= c_currentScore
setScore(currentScore,weight) setScore(c_currentScore,weight)
setInsertScoreChanFooter(1,1,9) setInsertScoreChanFooter(1,1,9)
} }
...@@ -73,14 +73,14 @@ func ChangeslegalInFiveYears() { ...@@ -73,14 +73,14 @@ func ChangeslegalInFiveYears() {
//两次以上0分,以下一分 //两次以上0分,以下一分
if five_legal_change < 2 { if five_legal_change < 2 {
currentScore = 1 c_currentScore = 1
}else{ }else{
currentScore = 0 c_currentScore = 0
} }
totalScore[2]= currentScore c_totalScore[2]= c_currentScore
setScore(currentScore,weight) setScore(c_currentScore,weight)
setInsertScoreChanFooter(1,1,10) setInsertScoreChanFooter(1,1,10)
} }
...@@ -90,16 +90,16 @@ func RegisteredCapital() { ...@@ -90,16 +90,16 @@ func RegisteredCapital() {
registered_capital := stringTurnInt64(companyBasicInfo["registered_capital"]) registered_capital := stringTurnInt64(companyBasicInfo["registered_capital"])
if registered_capital < 500000 { if registered_capital < 500000 {
currentScore = 0 c_currentScore = 0
}else if registered_capital > 2000000 { }else if registered_capital > 2000000 {
currentScore = 2 c_currentScore = 2
}else{ }else{
currentScore = 1 c_currentScore = 1
} }
totalScore[3]= currentScore c_totalScore[3]= c_currentScore
setScore(currentScore,weight) setScore(c_currentScore,weight)
setInsertScoreChanFooter(1,1,11) setInsertScoreChanFooter(1,1,11)
} }
...@@ -108,16 +108,16 @@ func AnnualTaxRate() { ...@@ -108,16 +108,16 @@ func AnnualTaxRate() {
year_tax_payable := stringTurnFloat64(companyBasicInfo["year_tax_payable"]) year_tax_payable := stringTurnFloat64(companyBasicInfo["year_tax_payable"])
if year_tax_payable < 20000 { if year_tax_payable < 20000 {
currentScore = 0 c_currentScore = 0
}else if year_tax_payable > 50000{ }else if year_tax_payable > 50000{
currentScore = 2 c_currentScore = 2
}else{ }else{
currentScore = 1 c_currentScore = 1
} }
totalScore[4]= currentScore c_totalScore[4]= c_currentScore
setScore(currentScore,weight) setScore(c_currentScore,weight)
setInsertScoreChanFooter(1,1,12) setInsertScoreChanFooter(1,1,12)
} }
...@@ -126,14 +126,14 @@ func lawsuitsInPastTwoYars() { ...@@ -126,14 +126,14 @@ func lawsuitsInPastTwoYars() {
two_years_no_lawsuit := stringTurnInt64(companyBasicInfo["two_years_no_lawsuit"]) two_years_no_lawsuit := stringTurnInt64(companyBasicInfo["two_years_no_lawsuit"])
if two_years_no_lawsuit == 1 { if two_years_no_lawsuit == 1 {
currentScore = 0 c_currentScore = 0
}else{ }else{
currentScore = 2 c_currentScore = 2
} }
totalScore[5]= currentScore c_totalScore[5]= c_currentScore
setScore(currentScore,weight) setScore(c_currentScore,weight)
setInsertScoreChanFooter(1,1,13) setInsertScoreChanFooter(1,1,13)
} }
...@@ -143,14 +143,14 @@ func NumberOfSocial() { ...@@ -143,14 +143,14 @@ func NumberOfSocial() {
social_security_participants := stringTurnInt64(companyBasicInfo["social_security_participants"]) social_security_participants := stringTurnInt64(companyBasicInfo["social_security_participants"])
if social_security_participants > 5 { if social_security_participants > 5 {
currentScore = 1 c_currentScore = 1
}else{ }else{
currentScore = 0 c_currentScore = 0
} }
totalScore[6]= currentScore c_totalScore[6]= c_currentScore
setScore(currentScore,weight) setScore(c_currentScore,weight)
setInsertScoreChanFooter(1,1,14) setInsertScoreChanFooter(1,1,14)
} }
......
package main package main
var( var(
e_currentScore float64
e_totalScore [20]float64 e_totalScore [20]float64
e_currentScore float64
e_weight float64 e_weight float64
) )
......
...@@ -32,6 +32,8 @@ var ( ...@@ -32,6 +32,8 @@ var (
companyAddScore []map[string]string companyAddScore []map[string]string
//设置等待 //设置等待
wg sync.WaitGroup wg sync.WaitGroup
//运行方式
runtype string
) )
...@@ -44,25 +46,27 @@ func main() { ...@@ -44,25 +46,27 @@ func main() {
//设置协程数量 //设置协程数量
wg.Add(1) wg.Add(1)
flag.StringVar(&runtype, "runtype", "one", "default config path")
go insertRecord() go insertRecord()
svc := service.New() svc := service.New()
c := context.Background() c := context.Background()
//调用服务获取公司信息,然后进行全局赋值 if runtype == "one" {
companyData,_ = svc.GetCompanyCresitsList(c) //调用服务获取公司信息,然后进行全局赋值
companyData,_ = svc.GetCompanyCresitsList(c)
setLog("companyData",companyData) for _,v :=range companyData{
insertScoreMsg.ComCreditsId = stringTurnInt64(v["id"])
for _,v :=range companyData{ getCompanyRunInfo(c)
insertScoreMsg.ComCreditsId = stringTurnInt64(v["id"]) setSumScore()
getCompanyRunInfo(c) }
CompanyInfo() }else{
AddScore() fmt.Print("待补充rabbitmq")
HistoryBussiness()
EnterPriseCredit()
PersonalCredit()
} }
//赋值完关闭通道 //赋值完关闭通道
close(socreRecordChan) close(socreRecordChan)
...@@ -88,6 +92,15 @@ func setLog(k string,v interface{}){ ...@@ -88,6 +92,15 @@ func setLog(k string,v interface{}){
log.Info(k,v) log.Info(k,v)
} }
//计算单一项总的静态分
func setSumScore() {
CompanyInfo()
AddScore()
HistoryBussiness()
EnterPriseCredit()
PersonalCredit()
}
//协程增加分值记录 //协程增加分值记录
func insertRecord() { func insertRecord() {
...@@ -100,7 +113,6 @@ func insertRecord() { ...@@ -100,7 +113,6 @@ func insertRecord() {
//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 := connect.InsertScores(ctx,insertScoreMsgRecord)
fmt.Print(err) fmt.Print(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment