Commit ef906bf6 by Joneq

增加修改静态动态的分数

parent 77c8f7df
package main package main
//加分项30分) //加分项30分)
func AddScore() { func AddScore()(finalScore float64) {
var( var(
sumScore float64 = 0 sumScore float64 = 0
...@@ -19,6 +19,8 @@ func AddScore() { ...@@ -19,6 +19,8 @@ func AddScore() {
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
return finalScore
} }
//业界口碑(2分)) //业界口碑(2分))
......
...@@ -9,7 +9,7 @@ var( ...@@ -9,7 +9,7 @@ var(
//公司信息计算 //公司信息计算
func CompanyInfo() { func CompanyInfo()(finalScore float64) {
modelInfo := getModelByProjectId(1) modelInfo := getModelByProjectId(1)
weight = stringTurnFloat64(modelInfo["weight"]) weight = stringTurnFloat64(modelInfo["weight"])
...@@ -22,10 +22,9 @@ func CompanyInfo() { ...@@ -22,10 +22,9 @@ func CompanyInfo() {
lawsuitsInPastTwoYars() lawsuitsInPastTwoYars()
NumberOfSocial() NumberOfSocial()
finalScore = setProjectScore(c_totalScore,weight,stringTurnFloat64(modelInfo["full_score"]))
setProjectScore(c_totalScore,weight,stringTurnFloat64(modelInfo["full_score"]))
setInsertScoreChanFooter(1,0,1) setInsertScoreChanFooter(1,0,1)
return finalScore
} }
......
...@@ -8,7 +8,7 @@ var( ...@@ -8,7 +8,7 @@ var(
//企业征信(10分) //企业征信(10分)
func EnterPriseCredit() { func EnterPriseCredit()(finalScore float64) {
modelInfo := getModelByProjectId(2) modelInfo := getModelByProjectId(2)
e_weight = stringTurnFloat64(modelInfo["weight"]) e_weight = stringTurnFloat64(modelInfo["weight"])
...@@ -16,9 +16,9 @@ func EnterPriseCredit() { ...@@ -16,9 +16,9 @@ func EnterPriseCredit() {
IsEnterpriseOverdueWhether() IsEnterpriseOverdueWhether()
IsHistoryOverdue() IsHistoryOverdue()
setProjectScore(e_totalScore,e_weight,stringTurnFloat64(modelInfo["full_score"])) finalScore = setProjectScore(e_totalScore,e_weight,stringTurnFloat64(modelInfo["full_score"]))
setInsertScoreChanFooter(1,0,2) setInsertScoreChanFooter(1,0,2)
return finalScore
} }
//企业有无负债(5分) //企业有无负债(5分)
......
...@@ -7,7 +7,7 @@ var( ...@@ -7,7 +7,7 @@ var(
) )
//历史交易情况(50分) //历史交易情况(50分)
func HistoryBussiness() { func HistoryBussiness()(finalScore float64) {
modelInfo := getModelByProjectId(4) modelInfo := getModelByProjectId(4)
h_weight = stringTurnFloat64(modelInfo["weight"]) h_weight = stringTurnFloat64(modelInfo["weight"])
...@@ -19,9 +19,9 @@ func HistoryBussiness() { ...@@ -19,9 +19,9 @@ func HistoryBussiness() {
AverageMoneyThreeMonths() AverageMoneyThreeMonths()
AverageMoneySixMonths() AverageMoneySixMonths()
setProjectScore(h_totalScore,h_weight,stringTurnFloat64(modelInfo["full_score"])) finalScore = setProjectScore(h_totalScore,h_weight,stringTurnFloat64(modelInfo["full_score"]))
setInsertScoreChanFooter(1,0,4) setInsertScoreChanFooter(1,0,4)
return finalScore
} }
//合作时间(5分) //合作时间(5分)
......
...@@ -17,10 +17,12 @@ import ( ...@@ -17,10 +17,12 @@ import (
var ( var (
//获取的公司信息 //获取的公司信息
companyData []map[string]string companyData []map[string]string
//分数记录通道
socreRecordChan = make(chan model.Scores) socreRecordChan = make(chan model.Scores)
//分数的数据 //分数的数据
insertScoreMsg model.Scores insertScoreMsg model.Scores
//公司总的信息
com_credits model.ComCredits
//公司的详细数据 //公司的详细数据
companyBasicInfo map[string]string companyBasicInfo map[string]string
//公司的逾期数据 //公司的逾期数据
...@@ -76,11 +78,8 @@ func main() { ...@@ -76,11 +78,8 @@ func main() {
//计算单一项总的静态分 //计算单一项总的静态分
func setSumScore() { func setSumScore() {
CompanyInfo() com_credits.Id = insertScoreMsg.ComCreditsId
AddScore() com_credits.StaticCreditScore = CompanyInfo() + AddScore() + HistoryBussiness() + EnterPriseCredit() + PersonalCredit()
HistoryBussiness()
EnterPriseCredit()
PersonalCredit()
} }
...@@ -150,7 +149,7 @@ func setScore(curretScoreRelace float64,weightReplace float64) { ...@@ -150,7 +149,7 @@ func setScore(curretScoreRelace float64,weightReplace float64) {
} }
//设置project总分 //设置project总分
func setProjectScore(totalScoreReplace [20]float64, weightReplace float64, fullScore float64) { func setProjectScore(totalScoreReplace [20]float64, weightReplace float64, fullScore float64)(finalScore float64) {
var( var(
sumScore float64 = 0 sumScore float64 = 0
joinNum float64 = 0 joinNum float64 = 0
...@@ -177,4 +176,6 @@ func setProjectScore(totalScoreReplace [20]float64, weightReplace float64, fullS ...@@ -177,4 +176,6 @@ func setProjectScore(totalScoreReplace [20]float64, weightReplace float64, fullS
insertScoreMsg.FinalScore = sumScore / joinNum insertScoreMsg.FinalScore = sumScore / joinNum
insertScoreMsg.Weight = weightReplace insertScoreMsg.Weight = weightReplace
return insertScoreMsg.FinalScore
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ var( ...@@ -8,7 +8,7 @@ var(
) )
//个人征信(30分) //个人征信(30分)
func PersonalCredit() { func PersonalCredit()(finalScore float64) {
modelInfo := getModelByProjectId(3) modelInfo := getModelByProjectId(3)
p_weight = stringTurnFloat64(modelInfo["weight"]) p_weight = stringTurnFloat64(modelInfo["weight"])
...@@ -25,9 +25,9 @@ func PersonalCredit() { ...@@ -25,9 +25,9 @@ func PersonalCredit() {
TotalCreditCardLimit() TotalCreditCardLimit()
MaximumAmountOfSingleCreditCard() MaximumAmountOfSingleCreditCard()
setProjectScore(p_totalScore,p_weight,stringTurnFloat64(modelInfo["full_score"])) finalScore = setProjectScore(p_totalScore,p_weight,stringTurnFloat64(modelInfo["full_score"]))
setInsertScoreChanFooter(1,0,3) setInsertScoreChanFooter(1,0,3)
return finalScore
} }
//年龄(1分) //年龄(1分)
......
...@@ -5,6 +5,8 @@ import ( ...@@ -5,6 +5,8 @@ import (
"fmt" "fmt"
"github.com/bilibili/kratos/pkg/database/sql" "github.com/bilibili/kratos/pkg/database/sql"
"github.com/pkg/errors" "github.com/pkg/errors"
"kaopu-server/internal/model"
"github.com/bilibili/kratos/pkg/log"
) )
//列表方式获取会员信息 //列表方式获取会员信息
...@@ -27,6 +29,47 @@ func (d *dao) GetCompanyCresitsList(ctx context.Context) (res []map[string]strin ...@@ -27,6 +29,47 @@ func (d *dao) GetCompanyCresitsList(ctx context.Context) (res []map[string]strin
return GetAllParam(rows) return GetAllParam(rows)
} }
//修改静态总分记录
func (d *dao) UpdateStaticSumScores(ctx context.Context,com_credits model.ComCredits) (insertId int64,err error) {
var(
execSql string
)
execSql = "update `lie_com_credits` set `dynamic_credit_score` = ? where id = ? "
row,err := d.db.Exec(ctx,execSql,com_credits.DynamicCreditScore,com_credits.Id)
if err != nil {
log.Error("db.DemoExec.Exec(%s) error(%v)", execSql, err)
}
row.RowsAffected()
defer d.db.Close()
return
}
//修改动态总分记录
func (d *dao) UpdateMoveSumScores(ctx context.Context,com_credits model.ComCredits) (insertId int64,err error) {
var(
execSql string
)
execSql = "update `lie_com_credits` set `dynamic_credit_score` = ? where id = ? "
row,err := d.db.Exec(ctx,execSql,com_credits.DynamicCreditScore,com_credits.Id)
if err != nil {
log.Error("db.DemoExec.Exec(%s) error(%v)", execSql, err)
}
row.RowsAffected()
defer d.db.Close()
return
}
......
...@@ -33,6 +33,7 @@ type ( ...@@ -33,6 +33,7 @@ type (
GetBasicInfoByCid(c context.Context, companyId int64) (r map[string]string, err error) GetBasicInfoByCid(c context.Context, companyId int64) (r map[string]string, err error)
GetCompanyAddSoreByCid(c context.Context, companyId int64) (r []map[string]string, err error) GetCompanyAddSoreByCid(c context.Context, companyId int64) (r []map[string]string, err error)
GetCompanyModelByProjectid(c context.Context, companyId int64) (r map[string]string, err error) GetCompanyModelByProjectid(c context.Context, companyId int64) (r map[string]string, err error)
UpdateStaticSumScores(c context.Context,com_credits model.ComCredits) (resId int64, err error)
//---静态结束 //---静态结束
//---动态开始 //---动态开始
......
...@@ -116,5 +116,14 @@ func (s *Service) GetCompanyAddSore(c context.Context, companyId int64) (res []m ...@@ -116,5 +116,14 @@ func (s *Service) GetCompanyAddSore(c context.Context, companyId int64) (res []m
return return
} }
// 修改公司静态加分项
func (s *Service) UpdateStaticSumScores(c context.Context,com_credits model.ComCredits) (res int64, err error) {
//调用DB方法,获取会员数据
res, err = s.dao.UpdateStaticSumScores(c,com_credits)
fmt.Print(err)
return
}
//----------静态结束 //----------静态结束
\ 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