Commit 00c363b7 by huangchengyi

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

# Conflicts:
#	logs/error.log
#	logs/info.log
#	logs/warning.log
parents 78e1eace 388e74f8
package main package main
//加分项30分) //加分项30分)
func AddScore() { func AddScore() {
IndustryReputation()
OperatingRate() var(
DownstreamCustomerType() sumScore float32 = 0
NumberOfGuarantors() joinNum float32 = 0
Collateral() )
for _,v :=range companyAddScore{
sumScore += float32(stringTurnFloat64(v["final_score"]))
joinNum += 1
}
//经过权重计算之后的总分值
sumScore = sumScore / joinNum
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = sumScore,sumScore,sumScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,0,5)
} }
//业界口碑(2分)) //业界口碑(2分))
......
package main package main
var( var(
currentScore float32 currentScore float32
totalScore float32 totalScore [7]float32
) )
...@@ -13,8 +10,6 @@ var( ...@@ -13,8 +10,6 @@ var(
//公司信息计算 //公司信息计算
func CompanyInfo() { func CompanyInfo() {
totalScore = 0
EstablishmentTime() EstablishmentTime()
CompanyNature() CompanyNature()
ChangeslegalInFiveYears() ChangeslegalInFiveYears()
...@@ -23,9 +18,25 @@ func CompanyInfo() { ...@@ -23,9 +18,25 @@ func CompanyInfo() {
lawsuitsInPastTwoYars() lawsuitsInPastTwoYars()
NumberOfSocial() NumberOfSocial()
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = totalScore,totalScore,totalScore var(
sumScore float32 = 0
joinNum float32 = 0
)
//查找出所有不是0的分值
for i :=0;i < len(totalScore) ; i++ {
if totalScore[i] != 0 {
joinNum += 1
sumScore += totalScore[i] * 0.5
}
}
//经过权重计算之后的总分值
sumScore = sumScore / joinNum
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = sumScore,sumScore,sumScore
insertScoreMsg.Weight = 50 insertScoreMsg.Weight = 50
setInserScoreChanFooter(1,0,1) setInsertScoreChanFooter(1,0,1)
} }
...@@ -35,19 +46,19 @@ func EstablishmentTime() { ...@@ -35,19 +46,19 @@ func EstablishmentTime() {
establishment_time := stringTurnInt64(companyBasicInfo["establishment_time"]) establishment_time := stringTurnInt64(companyBasicInfo["establishment_time"])
diffTime := getTimeStamp() - establishment_time diffTime := getTimeStamp() - establishment_time
//年以上有分 //年以上有分
if diffTime > (3600 * 24 * 365 * 5) { if diffTime > (3600 * 24 * 365 * 5) {
currentScore = 1 currentScore = 1
} else { } else {
currentScore = 0 currentScore = 0
} }
totalScore += currentScore totalScore[0]= currentScore
//设置分数 //设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore
insertScoreMsg.Weight = 50 insertScoreMsg.Weight = 50
setInserScoreChanFooter(1,1,8) setInsertScoreChanFooter(1,1,8)
} }
...@@ -62,13 +73,14 @@ func CompanyNature() { ...@@ -62,13 +73,14 @@ func CompanyNature() {
currentScore = 1 currentScore = 1
} }
totalScore += currentScore totalScore[1]= currentScore
//设置分数 //设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore
insertScoreMsg.Weight = 50 insertScoreMsg.Weight = 50
setInserScoreChanFooter(1,1,9) setInsertScoreChanFooter(1,1,9)
} }
//5年内法人变更次数(1分) //5年内法人变更次数(1分)
...@@ -83,9 +95,10 @@ func ChangeslegalInFiveYears() { ...@@ -83,9 +95,10 @@ func ChangeslegalInFiveYears() {
currentScore = 0 currentScore = 0
} }
totalScore += currentScore totalScore[2]= currentScore
setInserScoreChanFooter(1,1,10)
setInsertScoreChanFooter(1,1,10)
} }
//注册资本(2分) //注册资本(2分)
...@@ -101,8 +114,9 @@ func RegisteredCapital() { ...@@ -101,8 +114,9 @@ func RegisteredCapital() {
currentScore = 1 currentScore = 1
} }
totalScore += currentScore totalScore[3]= currentScore
setInserScoreChanFooter(1,1,11)
setInsertScoreChanFooter(1,1,11)
} }
//年纳税额(2分) //年纳税额(2分)
...@@ -117,8 +131,9 @@ func AnnualTaxRate() { ...@@ -117,8 +131,9 @@ func AnnualTaxRate() {
currentScore = 1 currentScore = 1
} }
totalScore += currentScore totalScore[4]= currentScore
setInserScoreChanFooter(1,1,12)
setInsertScoreChanFooter(1,1,12)
} }
//近两年内有无诉讼(2分) //近两年内有无诉讼(2分)
...@@ -131,8 +146,9 @@ func lawsuitsInPastTwoYars() { ...@@ -131,8 +146,9 @@ func lawsuitsInPastTwoYars() {
currentScore = 2 currentScore = 2
} }
totalScore += currentScore totalScore[5]= currentScore
setInserScoreChanFooter(1,1,13)
setInsertScoreChanFooter(1,1,13)
} }
//社保参保人数(1分) //社保参保人数(1分)
...@@ -146,8 +162,9 @@ func NumberOfSocial() { ...@@ -146,8 +162,9 @@ func NumberOfSocial() {
currentScore = 0 currentScore = 0
} }
totalScore += currentScore totalScore[6]= currentScore
setInserScoreChanFooter(1,1,14)
setInsertScoreChanFooter(1,1,14)
} }
......
package main package main
var(
e_currentScore float32
e_totalScore [2]float32
)
//企业征信(10分) //企业征信(10分)
func EnterPriseCredit() { func EnterPriseCredit() {
var(
sumScore float32 = 0
joinNum float32 = 0
)
IsEnterpriseOverdueWhether() IsEnterpriseOverdueWhether()
IsHistoryOverdue() IsHistoryOverdue()
//查找出所有不是0的分值
for i :=0;i < len(e_totalScore) ; i++ {
if e_totalScore[i] != 0 {
joinNum += 1
sumScore += e_totalScore[i] * 0.5
}
}
//经过权重计算之后的总分值
sumScore = sumScore / joinNum
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = sumScore,sumScore,sumScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,0,2)
} }
//企业有无负债(5分) //企业有无负债(5分)
func IsEnterpriseOverdueWhether() { func IsEnterpriseOverdueWhether() {
company_has_liabilities := stringTurnInt64(companySoreFields["company_has_liabilities"])
if company_has_liabilities == 1 {
e_currentScore = 0
}else{
e_currentScore = 5
}
e_totalScore[0]= e_currentScore
//设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = e_currentScore,e_currentScore,e_currentScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,2,15)
} }
//历史有无逾期(5分) //历史有无逾期(5分)
func IsHistoryOverdue() { func IsHistoryOverdue() {
history_overdue := stringTurnInt64(companySoreFields["history_overdue"])
if history_overdue == 1 {
e_currentScore = 0
}else{
e_currentScore = 5
}
e_totalScore[1]= e_currentScore
//设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = e_currentScore,e_currentScore,e_currentScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,2,16)
} }
\ No newline at end of file
package main package main
var(
h_currentScore float32
h_totalScore [6]float32
)
//历史交易情况(50分) //历史交易情况(50分)
func HistoryBussiness() { func HistoryBussiness() {
CooperationTime() CooperationTime()
...@@ -8,34 +13,188 @@ func HistoryBussiness() { ...@@ -8,34 +13,188 @@ func HistoryBussiness() {
HistoricalOverdueTimes() HistoricalOverdueTimes()
AverageMoneyThreeMonths() AverageMoneyThreeMonths()
AverageMoneySixMonths() AverageMoneySixMonths()
var(
sumScore float32 = 0
joinNum float32 = 0
)
//查找出所有不是0的分值
for i :=0;i < len(totalScore) ; i++ {
if totalScore[i] != 0 {
joinNum += 1
sumScore += totalScore[i] * 0.5
}
}
//经过权重计算之后的总分值
sumScore = sumScore / joinNum
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = sumScore,sumScore,sumScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,0,4)
} }
//合作时间(5分) //合作时间(5分)
func CooperationTime() { func CooperationTime() {
first_order_time := stringTurnInt64(basicInfo["first_order_time"])
diffTime := getTimeStamp() - first_order_time
if diffTime < (3600 * 12 * 365 ) {
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]= h_currentScore
//设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,4,29)
} }
//合作累计金额(10分) //合作累计金额(10分)
func AccumulatedAmountOfCooperation() { func AccumulatedAmountOfCooperation() {
total_order_amount := stringTurnFloat64(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]= h_currentScore
//设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,4,30)
} }
//累计毛利(10分) //累计毛利(10分)
func AccumulatedGrossProfit() { func AccumulatedGrossProfit() {
total_gross_profit := stringTurnFloat64(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]= h_currentScore
//设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,4,31)
} }
//历史逾期次数(5分) //历史逾期次数(5分)
func HistoricalOverdueTimes() { func HistoricalOverdueTimes() {
total_delay_times := stringTurnInt64(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]= h_currentScore
//设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,4,32)
} }
//近3个月的平均交易额(10分) //近3个月的平均交易额(10分)
func AverageMoneyThreeMonths() { func AverageMoneyThreeMonths() {
recently_three_average_amount := stringTurnFloat64(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]= h_currentScore
//设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,4,33)
} }
//近6个月的平均交易额(10分) //近6个月的平均交易额(10分)
func AverageMoneySixMonths() { func AverageMoneySixMonths() {
recently_six_max_amount := stringTurnFloat64(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]= h_currentScore
//设置分数
insertScoreMsg.FinalScore ,insertScoreMsg.TotalScore,insertScoreMsg.CurrentScore = currentScore,currentScore,currentScore
insertScoreMsg.Weight = 50
setInsertScoreChanFooter(1,4,33)
} }
...@@ -10,6 +10,7 @@ import ( ...@@ -10,6 +10,7 @@ import (
"kaopu-server/internal/model" "kaopu-server/internal/model"
"kaopu-server/internal/service" "kaopu-server/internal/service"
"strconv" "strconv"
"sync"
"time" "time"
) )
...@@ -18,13 +19,19 @@ var ( ...@@ -18,13 +19,19 @@ var (
//获取的公司信息 //获取的公司信息
companyData []map[string]string companyData []map[string]string
//插入分值的通道,限制一千,超过等待 //插入分值的通道,限制一千,超过等待
socreRecordChan = make(chan model.Scores, 1000) socreRecordChan = make(chan model.Scores)
//分数的数据 //分数的数据
insertScoreMsg model.Scores insertScoreMsg model.Scores
//公司的详细数据 //公司的详细数据
companyBasicInfo map[string]string companyBasicInfo map[string]string
//公司的逾期数据
isOver = make(chan int) companySoreFields map[string]string
//公司的历史数据
basicInfo map[string]string
//公司的逾期数据
companyAddScore []map[string]string
//设置等待
wg sync.WaitGroup
) )
...@@ -32,32 +39,36 @@ var ( ...@@ -32,32 +39,36 @@ var (
func main() { func main() {
//获取config
getConfig() getConfig()
//设置协程数量
wg.Add(1)
go insertRecord() go insertRecord()
svc := service.New() svc := service.New()
ctx := context.Background() c := context.Background()
//调用服务获取公司信息,然后进行全局赋值 //调用服务获取公司信息,然后进行全局赋值
companyData,_ = svc.GetCompanyCresitsList(ctx) companyData,_ = svc.GetCompanyCresitsList(c)
for _,v :=range companyData{ setLog("companyData",companyData)
for _,v :=range companyData{
insertScoreMsg.ComCreditsId = stringTurnInt64(v["id"]) insertScoreMsg.ComCreditsId = stringTurnInt64(v["id"])
companyBasicInfo,_ = svc.GetCompanyBaseInfoByCid(ctx,insertScoreMsg.ComCreditsId) getCompanyRunInfo(c)
CompanyInfo() CompanyInfo()
//EnterPriseCredit() EnterPriseCredit()
//HistoryBussiness() AddScore()
HistoryBussiness()
//PersonalCredit() //PersonalCredit()
//AddScore()
}
// 判断所有协程是否退出
for range isOver {
close(isOver)
} }
//赋值完关闭通道
close(socreRecordChan)
wg.Wait()
} }
...@@ -69,36 +80,53 @@ func getConfig() { ...@@ -69,36 +80,53 @@ func getConfig() {
panic(err) panic(err)
} }
//初始化日志目录 //初始化日志目录
setLog("kaopuserver start",0)
}
func setLog(k string,v interface{}){
//初始化日志目录
log.Init(&log.Config{Dir: "logs"}) log.Init(&log.Config{Dir: "logs"})
defer log.Close() defer log.Close()
log.Info("caipu-server start") log.Info(k,v)
} }
//协程增加分值记录 //协程增加分值记录
func insertRecord() { func insertRecord() {
for { ctx := context.Background()
for insertScoreMsgRecord := range socreRecordChan{
//声明service层 //声明service层
connect := dao.New() connect := dao.New()
ctx := context.Background()
// 从通道中拿出消息 //CurrentScore64 := float64(insertScoreMsgRecord.CurrentScore)
insertScoreMsg := <- socreRecordChan //插入数据
insertId,err := connect.InsertScores(ctx,insertScoreMsg) //if !math.IsNaN(CurrentScore64) && CurrentScore64 != 0 {
//
//}
insertId,err := connect.InsertScores(ctx,insertScoreMsgRecord)
fmt.Print(err) fmt.Print(err)
fmt.Print(insertId) fmt.Print(insertId)
//插入数据
} }
defer wg.Done()
isOver <- 1
} }
//设置插入的分数头 //设置插入的分数头
func setInserScoreChanFooter(_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(c context.Context) {
//声明service层
connect := dao.New()
companyBasicInfo,_ = connect.GetCompanyBaseInfoByCid(c,insertScoreMsg.ComCreditsId)
companySoreFields,_ = connect.GetCompanyScoreFieldsByCid(c,insertScoreMsg.ComCreditsId)
companyAddScore,_ = connect.GetCompanyAddSoreByCid(c,insertScoreMsg.ComCreditsId)
basicInfo,_ = connect.GetBasicInfoByCid(c,insertScoreMsg.ComCreditsId)
}
func getTimeStamp()(timestamp int64) { func getTimeStamp()(timestamp int64) {
return time.Now().Unix() return time.Now().Unix()
} }
......
package dao
import (
"context"
"fmt"
"github.com/pkg/errors"
"github.com/bilibili/kratos/pkg/database/sql"
)
//通过UID获取用户加分信息
func (d *dao) GetCompanyAddSoreByCid(c context.Context, companyId int64) (res []map[string]string, err error) {
var (
rows *sql.Rows
)
if rows, err = d.db.Query(c, "select "+ SqlField + " from lie_add_score where com_credits_id = ?",companyId); err != nil {
err = errors.WithStack(err)
return
}
defer rows.Close()
if err != nil{
fmt.Println("select fail,err:",err)
return
}
return GetAllParam(rows)
}
\ No newline at end of file
package dao
import (
"context"
"fmt"
"github.com/pkg/errors"
"github.com/bilibili/kratos/pkg/database/sql"
)
//通过UID获取用户信息
func (d *dao) GetBasicInfoByCid(c context.Context, companyId int64) (res map[string]string, err error) {
var (
rows *sql.Rows
)
if rows, err = d.db.Query(c, "select "+ SqlField + " from lie_basic_info where com_credits_id = ?",companyId); 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
}
\ No newline at end of file
...@@ -29,7 +29,6 @@ func GetAllParam(rows *sql.Rows)(res []map[string]string, err error) { ...@@ -29,7 +29,6 @@ func GetAllParam(rows *sql.Rows)(res []map[string]string, err error) {
scans[i] = &vals[i] scans[i] = &vals[i]
} }
row := make(map[string]string)
for rows.Next(){ for rows.Next(){
err = rows.Scan(scans...) err = rows.Scan(scans...)
...@@ -38,6 +37,8 @@ func GetAllParam(rows *sql.Rows)(res []map[string]string, err error) { ...@@ -38,6 +37,8 @@ func GetAllParam(rows *sql.Rows)(res []map[string]string, err error) {
return return
} }
row := make(map[string]string)
for k,v:=range vals{ for k,v:=range vals{
key := cols[k] key := cols[k]
row[key] = string(v) row[key] = string(v)
......
package dao
import (
"context"
"fmt"
"github.com/pkg/errors"
"github.com/bilibili/kratos/pkg/database/sql"
)
//通过UID获取用户信息
func (d *dao) GetCompanyScoreFieldsByCid(c context.Context, companyId int64) (res map[string]string, err error) {
var (
rows *sql.Rows
)
if rows, err = d.db.Query(c, "select "+ SqlField + " from lie_credit_score_fields where com_credits_id = ?",companyId); 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
}
\ No newline at end of file
...@@ -29,6 +29,9 @@ type ( ...@@ -29,6 +29,9 @@ type (
GetCompanyCresitsList(ctx context.Context) (r []map[string]string, err error) GetCompanyCresitsList(ctx context.Context) (r []map[string]string, err error)
InsertScores(ctx context.Context, score model.Scores) (insertId int64, err error) InsertScores(ctx context.Context, score model.Scores) (insertId int64, err error)
GetCompanyBaseInfoByCid(c context.Context, companyId int64) (r map[string]string, err error) GetCompanyBaseInfoByCid(c context.Context, companyId int64) (r map[string]string, err error)
GetCompanyScoreFieldsByCid(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)
//---静态结束 //---静态结束
CountYuqi(ctx context.Context,project_id int) (r []map[string]interface{},err error) //计算逾期 CountYuqi(ctx context.Context,project_id int) (r []map[string]interface{},err error) //计算逾期
......
package model
/*CREATE TABLE `lie_add_score` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '加分项id',
`com_credits_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联信用分id',
`project_name` varchar(50) NOT NULL DEFAULT '' COMMENT '项目名',
`info` varchar(150) NOT NULL DEFAULT '' COMMENT '信息备注',
`current_score` decimal(6,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '得分 没有进行权重运算的得分',
`weight` decimal(5,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '权重',
`final_score` decimal(6,2) NOT NULL DEFAULT '0.00' COMMENT '最终得分-终评分 进行了权重运算后的得分',
`status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1正常 0删除',
`create_time` int(11) unsigned NOT NULL DEFAULT '0',
`update_time` int(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `company_code` (`com_credits_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='加分项表';*/
\ No newline at end of file
package model
//
//CREATE TABLE `lie_basic_info` (
//`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '业务明细ID',
//`erp_company_code` varchar(20) NOT NULL DEFAULT '' COMMENT 'erp公司编码',
//`first_order_time` int(11) NOT NULL COMMENT '首次下单时间',
//`total_order_amount` decimal(10,2) NOT NULL COMMENT '历史交易总额(收款总额)',
//`total_gross_profit` decimal(10,2) NOT NULL COMMENT '历史累计毛利',
//`recently_average_amount` decimal(10,2) NOT NULL COMMENT '近6个月平均交易额',
//`recently_max_amount` decimal(10,2) NOT NULL COMMENT '近6个月最大交易额',
//`last_month_amount` decimal(10,2) NOT NULL COMMENT '上个月交易额',
//`reveive_period_aomunt` decimal(10,2) NOT NULL COMMENT '已获账期金额',
//`total_delay_times` int(11) NOT NULL COMMENT '历史逾期次数',
//`mianly_class` varchar(255) NOT NULL COMMENT '主要交易品类',
//`create_time` int(11) NOT NULL COMMENT '创建时间',
//`update_time` int(11) NOT NULL COMMENT '更新时间',
//`recently_three_average_amount` decimal(10,2) NOT NULL COMMENT '近3个月最大交易额',
//`recently_three_max_amount` decimal(10,2) NOT NULL COMMENT '近3个月最大交易额',
//PRIMARY KEY (`id`)
//) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='业务信息';
\ No newline at end of file
package model
//CREATE TABLE `lie_credit_score_fields` (
//`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
//`company_has_liabilities` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '企业有无负债 1有 0没有',
//`history overdue` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '历史有无逾期 1有 0无',
//`age` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '年龄',
//`marital_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '婚姻状况 1是 0否',
//`account_ratio` decimal(6,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '违约账户比 50.23',
//`guaranty` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '对外担保 1有 0没有',
//`two_years_th_days_overdue_times` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '近2年内最大逾期金额',
//`two_years_max_overdue_amount` decimal(14,4) NOT NULL,
//`is_exist_now_overdue` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 是 0否',
//`presence_of_mortgage` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '有无房贷 1有 0没有',
//`two_months_credit_view_nums` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '近两个月征信查询次数',
//`credit_card_total` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT '信用卡总额度',
//`maximum_credit_card_limit` decimal(14,4) unsigned NOT NULL DEFAULT '0.0000' COMMENT '单张信用卡最高额度',
//`com_credits_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联公司信用id',
//`type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '1个人 2企业',
//`create_time` int(11) unsigned NOT NULL DEFAULT '0',
//`update_time` int(11) unsigned NOT NULL DEFAULT '0',
//PRIMARY KEY (`id`)
//) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='征信相关评分字段表';
\ No newline at end of file
...@@ -79,5 +79,33 @@ func (s *Service) GetCompanyBaseInfoByCid(c context.Context, companyId int64) (r ...@@ -79,5 +79,33 @@ func (s *Service) GetCompanyBaseInfoByCid(c context.Context, companyId int64) (r
return return
} }
// 获取公司征信信息
func (s *Service) GetCompanyScoreFieldsByCid(c context.Context, companyId int64) (res map[string]string, err error) {
//调用DB方法,获取会员数据
res, err = s.dao.GetCompanyScoreFieldsByCid(c,companyId)
fmt.Print(err)
return
}
// 获取公司历史信息
func (s *Service) GetBasicInfoByCid(c context.Context, companyId int64) (res map[string]string, err error) {
//调用DB方法,获取会员数据
res, err = s.dao.GetBasicInfoByCid(c,companyId)
fmt.Print(err)
return
}
// 获取公司加分项
func (s *Service) GetCompanyAddSore(c context.Context, companyId int64) (res []map[string]string, err error) {
//调用DB方法,获取会员数据
res, err = s.dao.GetCompanyAddSoreByCid(c,companyId)
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