You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
4.3 KiB
111 lines
4.3 KiB
package gys
|
|
|
|
import (
|
|
"github.com/golangkit/formatime"
|
|
"regexp"
|
|
"strconv"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
type GysCompanyBase struct {
|
|
Id uint `gorm:"column:id;primary_key" json:"id"`
|
|
StaffNumRange string `gorm:"column:staff_num_range" json:"staffNumRange"`
|
|
FromTime int64 `gorm:"column:from_time" json:"fromTime"`
|
|
Type int64 `gorm:"column:type" json:"type"`
|
|
BondName string `gorm:"column:bond_name" json:"bondName"`
|
|
TianyanId int64 `gorm:"column:tianyan_id" json:"tianyanId"`
|
|
IsMicroEnt int64 `gorm:"column:is_micro_ent" json:"isMicroEnt"`
|
|
UsedBondName string `gorm:"column:used_bond_name" json:"usedBondName"`
|
|
RegNumber string `gorm:"column:reg_number" json:"regNumber"`
|
|
PercentileScore int64 `gorm:"column:percentile_score" json:"percentileScore"`
|
|
RegCapital string `gorm:"column:reg_capital" json:"regCapital"`
|
|
Name string `gorm:"column:name" json:"name"`
|
|
RegInstitute string `gorm:"column:reg_institute" json:"regInstitute"`
|
|
RegLocation string `gorm:"column:reg_location" json:"regLocation"`
|
|
Industry string `gorm:"column:industry" json:"industry"`
|
|
ApprovedTime int64 `gorm:"column:approved_time" json:"approvedTime"`
|
|
SocialStaffNum int64 `gorm:"column:social_staff_num" json:"socialStaffNum"`
|
|
Tags string `gorm:"column:tags" json:"tags"`
|
|
TaxNumber string `gorm:"column:tax_number" json:"taxNumber"`
|
|
BusinessScope string `gorm:"column:business_scope" json:"businessScope"`
|
|
Property3 string `gorm:"column:property3" json:"property3"`
|
|
Alias string `gorm:"column:alias" json:"alias"`
|
|
OrgNumber string `gorm:"column:org_number" json:"orgNumber"`
|
|
RegStatus string `gorm:"column:reg_status" json:"regStatus"`
|
|
EstiblishTime int64 `gorm:"column:estiblish_time" json:"estiblishTime"`
|
|
BondType string `gorm:"column:bond_type" json:"bondType"`
|
|
LegalPersonName string `gorm:"column:legal_person_name" json:"legalPersonName"`
|
|
ToTime int64 `gorm:"column:to_time" json:"toTime"`
|
|
ActualCapital string `gorm:"column:actual_capital" json:"actualCapital"`
|
|
CompanyOrgType string `gorm:"column:company_org_type" json:"companyOrgType"`
|
|
Base string `gorm:"column:base" json:"base"`
|
|
CreditCode string `gorm:"column:credit_code" json:"creditCode"`
|
|
HistoryNames string `gorm:"column:history_names" json:"historyNames"`
|
|
BondNum string `gorm:"column:bond_num" json:"bondNum"`
|
|
RevokeDate int64 `gorm:"column:revoke_date" json:"revokeDate"`
|
|
RevokeReason string `gorm:"column:revoke_reason" json:"revokeReason"`
|
|
CancelDate int64 `gorm:"column:cancel_date" json:"cancelDate"`
|
|
CancelReason string `gorm:"column:cancel_reason" json:"cancelReason"`
|
|
Category string `gorm:"column:category" json:"category"`
|
|
CategoryBig string `gorm:"column:category_big" json:"categoryBig"`
|
|
CategoryMiddle string `gorm:"column:category_middle" json:"categoryMiddle"`
|
|
IsCreditCode int `gorm:"column:is_credit_code" json:"isCreditCode"`
|
|
CreatedAt formatime.Second
|
|
UpdatedAt formatime.Second
|
|
}
|
|
|
|
func (g *GysCompanyBase) TableName() string {
|
|
return "gys_company_base"
|
|
}
|
|
|
|
// @Style 获取公司类型
|
|
func (g GysCompanyBase) GetCompanyType() int {
|
|
if strings.Contains(g.CompanyOrgType, "有限责任公司") {
|
|
return 1
|
|
} else if strings.Contains(g.CompanyOrgType, "股份有限公司") {
|
|
return 2
|
|
} else if strings.Contains(g.CompanyOrgType, "个体") {
|
|
return 3
|
|
} else {
|
|
return 4
|
|
}
|
|
}
|
|
|
|
// @Style 获取其他类型说明
|
|
func (g GysCompanyBase) GetCompanyInfo() string {
|
|
if g.GetCompanyType() == 4 {
|
|
return g.CompanyOrgType
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// @Style 获取注册资金
|
|
func (g GysCompanyBase) GetRegCapital() float64 {
|
|
capital := regexp.MustCompile(`\d+[\.]{0,1}[\d]*`).FindString(g.RegCapital)
|
|
result, _ := strconv.ParseFloat(capital, 64)
|
|
return result
|
|
}
|
|
|
|
// @Style 获取注册资金
|
|
func (g GysCompanyBase) GetCurrency() string {
|
|
return "人民币"
|
|
}
|
|
|
|
// @Style 获取营业执照开始时间
|
|
func (g GysCompanyBase) GetBusinessStart() string {
|
|
return time.Unix(g.FromTime/1000, 0).Format("2006-01-02")
|
|
}
|
|
|
|
// @Style 获取营业执照结束时间
|
|
func (g GysCompanyBase) GetBusinessEnd() string {
|
|
if g.ToTime == 0 {
|
|
return "2099-12-31"
|
|
}
|
|
date := time.Unix(g.ToTime/1000, 0).Format("2006-01-02")
|
|
if date > "2099-12-31" {
|
|
return "2099-12-31"
|
|
}
|
|
return date
|
|
}
|