Commit 2325d292 by huangchengyi

Merge branch 'dev' of http://119.23.72.7/sunlong_v5/kaopu-server into dev

parents 9c1545f5 b5619aee
...@@ -87,6 +87,39 @@ func GetModelTopsetByProjectId(projectId int64)(modelInfo map[string]string) { ...@@ -87,6 +87,39 @@ func GetModelTopsetByProjectId(projectId int64)(modelInfo map[string]string) {
return res 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) { func SetScore(curretScoreRelace float64,modelId int64)(fimalScore float64) {
......
package main package main
import "strconv"
var( var(
c_currentScore float64 c_currentScore float64
c_totalScore [20]float64 c_totalScore [20]float64
...@@ -34,13 +36,7 @@ func EstablishmentTime() { ...@@ -34,13 +36,7 @@ func EstablishmentTime() {
establishment_time := StringTurnInt64(companyBasicInfo["establishment_time"]) establishment_time := StringTurnInt64(companyBasicInfo["establishment_time"])
diffTime := GetTimeStamp() - establishment_time diffTime := GetTimeStamp() - establishment_time
//五年以上有分 c_currentScore = GetScore(8,strconv.FormatInt(diffTime,10))
if diffTime > (3600 * 24 * 365 * 5) {
c_currentScore = 1
} else {
c_currentScore = 0
}
c_totalScore[0]= SetScore(c_currentScore,8) c_totalScore[0]= SetScore(c_currentScore,8)
SetInsertScoreChanFooter(1,1,8) SetInsertScoreChanFooter(1,1,8)
} }
...@@ -48,14 +44,7 @@ func EstablishmentTime() { ...@@ -48,14 +44,7 @@ func EstablishmentTime() {
//公司性质(1分)上,国,央,一分,其它零分 //公司性质(1分)上,国,央,一分,其它零分
func CompanyNature() { func CompanyNature() {
c_currentScore = GetScore(9,companyBasicInfo["customer_property"])
customer_property := StringTurnInt64(companyBasicInfo["customer_property"])
if customer_property == 0 {
c_currentScore = 0
}else{
c_currentScore = 1
}
c_totalScore[1]= SetScore(c_currentScore,9) c_totalScore[1]= SetScore(c_currentScore,9)
...@@ -64,15 +53,7 @@ func CompanyNature() { ...@@ -64,15 +53,7 @@ func CompanyNature() {
//5年内法人变更次数(1分) //5年内法人变更次数(1分)
func ChangeslegalInFiveYears() { func ChangeslegalInFiveYears() {
c_currentScore = GetScore(10,companyBasicInfo["five_legal_change"])
five_legal_change := StringTurnInt64(companyBasicInfo["five_legal_change"])
//两次以上0分,以下一分
if five_legal_change < 2 {
c_currentScore = 1
}else{
c_currentScore = 0
}
c_totalScore[2]= SetScore(c_currentScore,10) c_totalScore[2]= SetScore(c_currentScore,10)
SetInsertScoreChanFooter(1,1,10) SetInsertScoreChanFooter(1,1,10)
...@@ -80,16 +61,7 @@ func ChangeslegalInFiveYears() { ...@@ -80,16 +61,7 @@ func ChangeslegalInFiveYears() {
//注册资本(2分) //注册资本(2分)
func RegisteredCapital() { func RegisteredCapital() {
c_currentScore = GetScore(11,companyBasicInfo["registered_capital"])
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_totalScore[3]= SetScore(c_currentScore,11) c_totalScore[3]= SetScore(c_currentScore,11)
SetInsertScoreChanFooter(1,1,11) SetInsertScoreChanFooter(1,1,11)
...@@ -97,15 +69,7 @@ func RegisteredCapital() { ...@@ -97,15 +69,7 @@ func RegisteredCapital() {
//年纳税额(2分) //年纳税额(2分)
func AnnualTaxRate() { func AnnualTaxRate() {
year_tax_payable := StringTurnFloat64(companyBasicInfo["year_tax_payable"]) c_currentScore = GetScore(12,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_totalScore[4]= SetScore(c_currentScore,12) c_totalScore[4]= SetScore(c_currentScore,12)
SetInsertScoreChanFooter(1,1,12) SetInsertScoreChanFooter(1,1,12)
...@@ -113,13 +77,7 @@ func AnnualTaxRate() { ...@@ -113,13 +77,7 @@ func AnnualTaxRate() {
//近两年内有无诉讼(2分) //近两年内有无诉讼(2分)
func lawsuitsInPastTwoYars() { func lawsuitsInPastTwoYars() {
two_years_no_lawsuit := StringTurnInt64(companyBasicInfo["two_years_no_lawsuit"]) c_currentScore = GetScore(13,companyBasicInfo["two_years_no_lawsuit"])
if two_years_no_lawsuit == 1 {
c_currentScore = 0
}else{
c_currentScore = 2
}
c_totalScore[5]= SetScore(c_currentScore,13) c_totalScore[5]= SetScore(c_currentScore,13)
SetInsertScoreChanFooter(1,1,13) SetInsertScoreChanFooter(1,1,13)
...@@ -127,14 +85,7 @@ func lawsuitsInPastTwoYars() { ...@@ -127,14 +85,7 @@ func lawsuitsInPastTwoYars() {
//社保参保人数(1分) //社保参保人数(1分)
func NumberOfSocial() { func NumberOfSocial() {
c_currentScore = GetScore(14,companyBasicInfo["social_security_participants"])
social_security_participants := StringTurnInt64(companyBasicInfo["social_security_participants"])
if social_security_participants > 5 {
c_currentScore = 1
}else{
c_currentScore = 0
}
c_totalScore[6]= SetScore(c_currentScore,14) c_totalScore[6]= SetScore(c_currentScore,14)
SetInsertScoreChanFooter(1,1,14) SetInsertScoreChanFooter(1,1,14)
......
...@@ -23,15 +23,9 @@ func EnterPriseCredit()(finalScore float64) { ...@@ -23,15 +23,9 @@ func EnterPriseCredit()(finalScore float64) {
//企业有无负债(5分) //企业有无负债(5分)
func IsEnterpriseOverdueWhether() { func IsEnterpriseOverdueWhether() {
company_has_liabilities := StringTurnInt64(companySoreFields["company_has_liabilities"]) e_currentScore = GetScore(15,companySoreFields["company_has_liabilities"])
if company_has_liabilities == 1 { e_totalScore[0]= SetScore(e_currentScore,15)
e_currentScore = 0
}else{
e_currentScore = 5
}
e_totalScore[0]= SetScore(c_currentScore,15)
SetInsertScoreChanFooter(1,2,15) SetInsertScoreChanFooter(1,2,15)
} }
...@@ -39,15 +33,9 @@ func IsEnterpriseOverdueWhether() { ...@@ -39,15 +33,9 @@ func IsEnterpriseOverdueWhether() {
//历史有无逾期(5分) //历史有无逾期(5分)
func IsHistoryOverdue() { func IsHistoryOverdue() {
history_overdue := StringTurnInt64(companySoreFields["history_overdue"]) e_currentScore = GetScore(15,companySoreFields["history_overdue"])
if history_overdue == 1 {
e_currentScore = 0
}else{
e_currentScore = 5
}
e_totalScore[1]= SetScore(c_currentScore,16) e_totalScore[1]= SetScore(e_currentScore,16)
SetInsertScoreChanFooter(1,2,16) SetInsertScoreChanFooter(1,2,16)
} }
\ No newline at end of file
package main package main
import "strconv"
var( var(
h_currentScore float64 h_currentScore float64
h_totalScore [20]float64 h_totalScore [20]float64
...@@ -31,17 +33,7 @@ func CooperationTime() { ...@@ -31,17 +33,7 @@ func CooperationTime() {
first_order_time := StringTurnInt64(basicInfo["first_order_time"]) first_order_time := StringTurnInt64(basicInfo["first_order_time"])
diffTime := GetTimeStamp() - first_order_time diffTime := GetTimeStamp() - first_order_time
if diffTime < (3600 * 12 * 365 ) { h_currentScore = GetScore(29,strconv.FormatInt(diffTime,10))
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_totalScore[0]= SetScore(h_currentScore,29) h_totalScore[0]= SetScore(h_currentScore,29)
...@@ -51,23 +43,8 @@ func CooperationTime() { ...@@ -51,23 +43,8 @@ func CooperationTime() {
//合作累计金额(10分) //合作累计金额(10分)
func AccumulatedAmountOfCooperation() { func AccumulatedAmountOfCooperation() {
total_order_amount := StringTurnFloat64(basicInfo["total_order_amount"])
h_currentScore = GetScore(30,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_totalScore[1]= SetScore(h_currentScore,30) h_totalScore[1]= SetScore(h_currentScore,30)
SetInsertScoreChanFooter(1,4,30) SetInsertScoreChanFooter(1,4,30)
...@@ -76,23 +53,7 @@ func AccumulatedAmountOfCooperation() { ...@@ -76,23 +53,7 @@ func AccumulatedAmountOfCooperation() {
//累计毛利(10分) //累计毛利(10分)
func AccumulatedGrossProfit() { func AccumulatedGrossProfit() {
total_gross_profit := StringTurnFloat64(basicInfo["total_gross_profit"]) h_currentScore = GetScore(31,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_totalScore[2]= SetScore(h_currentScore,31) h_totalScore[2]= SetScore(h_currentScore,31)
SetInsertScoreChanFooter(1,4,31) SetInsertScoreChanFooter(1,4,31)
...@@ -100,17 +61,8 @@ func AccumulatedGrossProfit() { ...@@ -100,17 +61,8 @@ func AccumulatedGrossProfit() {
//历史逾期次数(5分) //历史逾期次数(5分)
func HistoricalOverdueTimes() { func HistoricalOverdueTimes() {
total_delay_times := StringTurnInt64(basicInfo["total_delay_times"])
h_currentScore = GetScore(32,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_totalScore[3]= SetScore(h_currentScore,32) h_totalScore[3]= SetScore(h_currentScore,32)
SetInsertScoreChanFooter(1,4,32) SetInsertScoreChanFooter(1,4,32)
...@@ -119,23 +71,8 @@ func HistoricalOverdueTimes() { ...@@ -119,23 +71,8 @@ func HistoricalOverdueTimes() {
//近3个月的平均交易额(10分) //近3个月的平均交易额(10分)
func AverageMoneyThreeMonths() { func AverageMoneyThreeMonths() {
recently_three_average_amount := StringTurnFloat64(basicInfo["recently_three_average_amount"])
h_currentScore = GetScore(33,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_totalScore[4]= SetScore(h_currentScore,33) h_totalScore[4]= SetScore(h_currentScore,33)
...@@ -145,23 +82,7 @@ func AverageMoneyThreeMonths() { ...@@ -145,23 +82,7 @@ func AverageMoneyThreeMonths() {
//近6个月的平均交易额(10分) //近6个月的平均交易额(10分)
func AverageMoneySixMonths() { func AverageMoneySixMonths() {
recently_six_max_amount := StringTurnFloat64(basicInfo["recently_six_max_amount"]) h_currentScore = GetScore(34,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_totalScore[5]= SetScore(h_currentScore,34) h_totalScore[5]= SetScore(h_currentScore,34)
......
...@@ -79,6 +79,7 @@ func main() { ...@@ -79,6 +79,7 @@ func main() {
insertScoreMsg.ComCreditsId = StringTurnInt64(v["id"]) insertScoreMsg.ComCreditsId = StringTurnInt64(v["id"])
GetCompanyRunInfo(c) GetCompanyRunInfo(c)
SetSumScore(c) SetSumScore(c)
//break
} }
......
...@@ -33,15 +33,7 @@ func PersonalCredit()(finalScore float64) { ...@@ -33,15 +33,7 @@ func PersonalCredit()(finalScore float64) {
//年龄(1分) //年龄(1分)
func Age() { func Age() {
age := StringTurnInt64(companySoreFields["age"]) p_currentScore = GetScore(17,companySoreFields["age"])
if age > 30 && age <50 {
p_currentScore = 1
} else {
p_currentScore = 0
}
p_totalScore[0]= SetScore(p_currentScore,17) p_totalScore[0]= SetScore(p_currentScore,17)
SetInsertScoreChanFooter(1,3,17) SetInsertScoreChanFooter(1,3,17)
} }
...@@ -49,13 +41,7 @@ func Age() { ...@@ -49,13 +41,7 @@ func Age() {
//婚姻状况(1分) //婚姻状况(1分)
func MaritalStatus() { func MaritalStatus() {
marital_status := StringTurnInt64(companySoreFields["marital_status"]) p_currentScore = GetScore(18,companySoreFields["marital_status"])
if marital_status == 1 {
p_currentScore = 1
} else {
p_currentScore = 0
}
p_totalScore[1]= SetScore(p_currentScore,18) p_totalScore[1]= SetScore(p_currentScore,18)
...@@ -65,13 +51,7 @@ func MaritalStatus() { ...@@ -65,13 +51,7 @@ func MaritalStatus() {
//违约账户比(2分) //违约账户比(2分)
func DefaultAccountRatio() { func DefaultAccountRatio() {
account_ratio := StringTurnFloat64(companySoreFields["account_ratio"]) p_currentScore = GetScore(19,companySoreFields["account_ratio"])
if account_ratio < 20 {
p_currentScore = 2
} else {
p_currentScore = 0
}
p_totalScore[2]= SetScore(p_currentScore,19) p_totalScore[2]= SetScore(p_currentScore,19)
...@@ -81,13 +61,7 @@ func DefaultAccountRatio() { ...@@ -81,13 +61,7 @@ func DefaultAccountRatio() {
//对外担保(5分) //对外担保(5分)
func ExternalGuarantee() { func ExternalGuarantee() {
guaranty := StringTurnInt64(companySoreFields["guaranty"]) p_currentScore = GetScore(20,companySoreFields["guaranty"])
if guaranty == 1 {
p_currentScore = 0
} else {
p_currentScore = 5
}
p_totalScore[3]= SetScore(p_currentScore,20) p_totalScore[3]= SetScore(p_currentScore,20)
...@@ -96,14 +70,7 @@ func ExternalGuarantee() { ...@@ -96,14 +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"])
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_totalScore[4]= SetScore(p_currentScore,22) p_totalScore[4]= SetScore(p_currentScore,22)
SetInsertScoreChanFooter(1,3,22) SetInsertScoreChanFooter(1,3,22)
...@@ -112,17 +79,8 @@ func SumBeOverdueMonthTwoYesar() { ...@@ -112,17 +79,8 @@ func SumBeOverdueMonthTwoYesar() {
//近2年内最大逾期金额(3分)two_years_max_overdue_amount //近2年内最大逾期金额(3分)two_years_max_overdue_amount
func MaxBeOverdueTwoYears() { func MaxBeOverdueTwoYears() {
two_years_max_overdue_amount := StringTurnFloat64(companySoreFields["two_years_max_overdue_amount"])
if two_years_max_overdue_amount >= 10000 { p_currentScore = GetScore(23,companySoreFields["two_years_max_overdue_amount"])
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_totalScore[5]= SetScore(p_currentScore,23) p_totalScore[5]= SetScore(p_currentScore,23)
...@@ -133,14 +91,8 @@ func MaxBeOverdueTwoYears() { ...@@ -133,14 +91,8 @@ func MaxBeOverdueTwoYears() {
//是否存在当前逾期(3分) //是否存在当前逾期(3分)
func IsBeOverdue() { 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) p_totalScore[6]= SetScore(p_currentScore,24)
...@@ -151,13 +103,8 @@ func IsBeOverdue() { ...@@ -151,13 +103,8 @@ func IsBeOverdue() {
//有无房贷(1分) //有无房贷(1分)
func IsMortgage() { func IsMortgage() {
presence_of_mortgage := StringTurnInt64(companySoreFields["presence_of_mortgage"])
if presence_of_mortgage == 1 { p_currentScore = GetScore(25,companySoreFields["presence_of_mortgage"])
p_currentScore = 0
} else {
p_currentScore = 1
}
p_totalScore[7]= SetScore(p_currentScore,25) p_totalScore[7]= SetScore(p_currentScore,25)
...@@ -167,21 +114,8 @@ func IsMortgage() { ...@@ -167,21 +114,8 @@ func IsMortgage() {
//近两个月征信查询次数(5分) //近两个月征信查询次数(5分)
func NumberOfCreditInquiryInThePastTwoMonths() { func NumberOfCreditInquiryInThePastTwoMonths() {
two_months_credit_view_nums := StringTurnInt64(companySoreFields["two_months_credit_view_nums"])
p_currentScore = GetScore(26,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_totalScore[8]= SetScore(p_currentScore,26) p_totalScore[8]= SetScore(p_currentScore,26)
...@@ -191,13 +125,8 @@ func NumberOfCreditInquiryInThePastTwoMonths() { ...@@ -191,13 +125,8 @@ func NumberOfCreditInquiryInThePastTwoMonths() {
//信用卡总额度(3分) //信用卡总额度(3分)
func TotalCreditCardLimit() { func TotalCreditCardLimit() {
credit_card_total := StringTurnInt64(companySoreFields["credit_card_total"])
if credit_card_total >= 200000 { p_currentScore = GetScore(27,companySoreFields["credit_card_total"])
p_currentScore = 3
} else {
p_currentScore = 0
}
p_totalScore[9]= SetScore(p_currentScore,27) p_totalScore[9]= SetScore(p_currentScore,27)
...@@ -207,13 +136,8 @@ func TotalCreditCardLimit() { ...@@ -207,13 +136,8 @@ func TotalCreditCardLimit() {
//单张信用卡最高额度(3分) //单张信用卡最高额度(3分)
func MaximumAmountOfSingleCreditCard() { 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) p_totalScore[10]= SetScore(p_currentScore,28)
......
...@@ -18,7 +18,7 @@ func (d *dao) GetCompanyAddSoreByCid(c context.Context, companyId int64) (res [] ...@@ -18,7 +18,7 @@ func (d *dao) GetCompanyAddSoreByCid(c context.Context, companyId int64) (res []
return return
} }
defer rows.Close() defer d.db.Close()
if err != nil{ if err != nil{
fmt.Println("select fail,err:",err) fmt.Println("select fail,err:",err)
......
...@@ -18,7 +18,7 @@ func (d *dao) GetBasicInfoByCid(c context.Context, companyId int64) (res map[str ...@@ -18,7 +18,7 @@ func (d *dao) GetBasicInfoByCid(c context.Context, companyId int64) (res map[str
return return
} }
defer rows.Close() defer d.db.Close()
if err != nil{ if err != nil{
fmt.Println("select fail,err:",err) fmt.Println("select fail,err:",err)
......
...@@ -19,7 +19,7 @@ func (d *dao) GetCompanyBaseInfoByCid(c context.Context, companyId int64) (res m ...@@ -19,7 +19,7 @@ func (d *dao) GetCompanyBaseInfoByCid(c context.Context, companyId int64) (res m
return return
} }
defer rows.Close() defer d.db.Close()
if err != nil{ if err != nil{
fmt.Println("select fail,err:",err) fmt.Println("select fail,err:",err)
......
...@@ -20,7 +20,7 @@ func (d *dao) GetCompanyCresitsList(ctx context.Context) (res []map[string]strin ...@@ -20,7 +20,7 @@ func (d *dao) GetCompanyCresitsList(ctx context.Context) (res []map[string]strin
return return
} }
defer rows.Close() defer d.db.Close()
if err != nil{ if err != nil{
fmt.Println("select fail,err:",err) fmt.Println("select fail,err:",err)
...@@ -69,8 +69,6 @@ func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredi ...@@ -69,8 +69,6 @@ func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredi
row.RowsAffected() row.RowsAffected()
//defer d.db.Close()
return return
} }
......
...@@ -34,6 +34,7 @@ func (d *dao) GetCompanyScoreFieldsByCid(c context.Context, companyId int64) (re ...@@ -34,6 +34,7 @@ func (d *dao) GetCompanyScoreFieldsByCid(c context.Context, companyId int64) (re
res = v res = v
break break
} }
defer d.db.Close()
return return
} }
\ No newline at end of file
...@@ -35,6 +35,8 @@ type ( ...@@ -35,6 +35,8 @@ type (
GetCompanyModelByProjectid(c context.Context, companyId int64) (r map[string]string, err error) GetCompanyModelByProjectid(c context.Context, companyId int64) (r map[string]string, err error)
GetModelTopsetByProjectId(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) 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) UpdateMoveSumScores(c context.Context,com_credits model.ComCredits) (resId int64, err error)
//---静态结束 //---静态结束
......
...@@ -33,6 +33,7 @@ func (d *dao) GetCompanyModelByProjectid(c context.Context, projectId int64) (re ...@@ -33,6 +33,7 @@ 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
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
...@@ -32,6 +32,7 @@ func (d *dao) GetModelTopsetByProjectId(c context.Context, projectId int64) (res ...@@ -32,6 +32,7 @@ func (d *dao) GetModelTopsetByProjectId(c context.Context, projectId int64) (res
res = v res = v
break break
} }
defer d.db.Close()
return return
} }
...@@ -12,3 +12,22 @@ type ModelItems struct { ...@@ -12,3 +12,22 @@ type ModelItems struct {
Score int64 `json:"id"` //'阶梯分值' Score int64 `json:"id"` //'阶梯分值'
Creator string `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
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