Commit a1c16f5b by Joneq

增加代码

parent 45593311
...@@ -71,6 +71,7 @@ func StringTurnFloat64(val string)(float64) { ...@@ -71,6 +71,7 @@ func StringTurnFloat64(val string)(float64) {
return floatval return floatval
} }
//获取项目详情
func getModelByProjectId(projectId int64)(modelInfo map[string]string) { func getModelByProjectId(projectId int64)(modelInfo map[string]string) {
ctx := context.Background() ctx := context.Background()
connect := dao.New() connect := dao.New()
...@@ -78,6 +79,14 @@ func getModelByProjectId(projectId int64)(modelInfo map[string]string) { ...@@ -78,6 +79,14 @@ func getModelByProjectId(projectId int64)(modelInfo map[string]string) {
return res return res
} }
//获取顶头详情
func GetModelTopsetByProjectId(projectId int64)(modelInfo map[string]string) {
ctx := context.Background()
connect := dao.New()
res,_ := connect.GetModelTopsetByProjectId(ctx,projectId)
return res
}
//设置分数 //设置分数
func SetScore(curretScoreRelace float64,modelId int64)(fimalScore float64) { func SetScore(curretScoreRelace float64,modelId int64)(fimalScore float64) {
......
...@@ -19,7 +19,7 @@ func CompanyInfo()(finalScore float64) { ...@@ -19,7 +19,7 @@ func CompanyInfo()(finalScore float64) {
lawsuitsInPastTwoYars() lawsuitsInPastTwoYars()
NumberOfSocial() NumberOfSocial()
modelInfo := getModelByProjectId(1) modelInfo := GetModelTopsetByProjectId(1)
weight = StringTurnFloat64(modelInfo["weight"]) weight = StringTurnFloat64(modelInfo["weight"])
finalScore = SetProjectScore(c_totalScore,weight,StringTurnFloat64(modelInfo["full_score"])) finalScore = SetProjectScore(c_totalScore,weight,StringTurnFloat64(modelInfo["full_score"]))
......
...@@ -13,7 +13,7 @@ func EnterPriseCredit()(finalScore float64) { ...@@ -13,7 +13,7 @@ func EnterPriseCredit()(finalScore float64) {
IsEnterpriseOverdueWhether() IsEnterpriseOverdueWhether()
IsHistoryOverdue() IsHistoryOverdue()
modelInfo := getModelByProjectId(2) modelInfo := GetModelTopsetByProjectId(2)
e_weight = StringTurnFloat64(modelInfo["weight"]) e_weight = StringTurnFloat64(modelInfo["weight"])
finalScore = 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)
......
...@@ -18,7 +18,7 @@ func HistoryBussiness()(finalScore float64) { ...@@ -18,7 +18,7 @@ func HistoryBussiness()(finalScore float64) {
AverageMoneyThreeMonths() AverageMoneyThreeMonths()
AverageMoneySixMonths() AverageMoneySixMonths()
modelInfo := getModelByProjectId(4) modelInfo := GetModelTopsetByProjectId(4)
h_weight = StringTurnFloat64(modelInfo["weight"]) h_weight = StringTurnFloat64(modelInfo["weight"])
finalScore = 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)
......
...@@ -24,7 +24,7 @@ func PersonalCredit()(finalScore float64) { ...@@ -24,7 +24,7 @@ func PersonalCredit()(finalScore float64) {
TotalCreditCardLimit() TotalCreditCardLimit()
MaximumAmountOfSingleCreditCard() MaximumAmountOfSingleCreditCard()
modelInfo := getModelByProjectId(3) modelInfo := GetModelTopsetByProjectId(3)
p_weight = StringTurnFloat64(modelInfo["weight"]) p_weight = StringTurnFloat64(modelInfo["weight"])
finalScore = 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)
......
package dao
import (
"context"
"fmt"
"github.com/pkg/errors"
"github.com/bilibili/kratos/pkg/database/sql"
)
//通过projectId获取该项信息
func (d *dao) GetModelTopsetByProjectId(c context.Context, projectId int64) (res map[string]string, err error) {
var (
rows *sql.Rows
)
if rows, err = d.db.Query(c, "select "+ SqlField + " from lie_model_topset where project_id = ?",projectId); 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
}
return
}
package model
//CREATE TABLE `lie_model_topset` (
//`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '模型ID',
//`type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1静态 2动态 3银行',
//`project_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '项目ID',
//`project_name` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '项目名称',
//`full_score` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '满分分值',
//`weight` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '权重',
//`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态,1-启用,-1-禁用',
//`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`),
//UNIQUE KEY `project_id` (`project_id`) USING BTREE,
//KEY `status_time` (`status`,`create_time`) USING BTREE,
//KEY `type_time` (`type`,`create_time`) USING BTREE
//) ENGINE=InnoDB AUTO_INCREMENT=18 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