Commit f048a091 by Joneq

增加相应的代码

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