Commit a02143e8 by Joneq

增加参数方式

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