1264 lines
44 KiB
Go
1264 lines
44 KiB
Go
package admin
|
||
|
||
import (
|
||
. "../../../hotime"
|
||
. "../../common"
|
||
"fmt"
|
||
"github.com/chain-zhang/pinyin"
|
||
"github.com/xuri/excelize"
|
||
"os"
|
||
"sort"
|
||
"strings"
|
||
"time"
|
||
"unicode"
|
||
)
|
||
|
||
type Org3 struct {
|
||
}
|
||
|
||
func (that *Org3) decodeData2Sql(table [][]string, this *Context, orgId int) error {
|
||
tags := []Map{} //报错所有的tag记录
|
||
tagCtgs := []Map{}
|
||
for k, v := range table {
|
||
|
||
//第一排是指标分类,去除掉第一个参数,其存在合并所以,如果是合并的则删除
|
||
if k == 0 {
|
||
|
||
for ck, cv := range v {
|
||
cv = strings.Replace(cv, " ", "", -1)
|
||
cv = strings.Replace(cv, "\r\t", "", -1)
|
||
cv = strings.Replace(cv, "\r", "", -1)
|
||
v[ck] = cv
|
||
|
||
if ck == 0 {
|
||
continue
|
||
}
|
||
if cv == "" {
|
||
v[ck] = v[ck-1]
|
||
cv = v[ck]
|
||
}
|
||
|
||
tagCtg := this.Db.Get("tag_ctg", "*", Map{"name": cv})
|
||
if tagCtg != nil {
|
||
tagCtgs = append(tagCtgs, tagCtg)
|
||
continue
|
||
}
|
||
tagCtg = Map{
|
||
"name": cv,
|
||
"admin_id": this.Session("admin_id").ToInt(),
|
||
"parent_id": 1, //上传分类为1
|
||
"org_id": orgId,
|
||
"create_time": time.Now().Unix(),
|
||
"modify_time": time.Now().Unix(),
|
||
}
|
||
id := this.Db.Insert("tag_ctg", tagCtg)
|
||
|
||
if id != 0 {
|
||
tagCtg["id"] = id
|
||
this.Db.Update("tag_ctg", Map{
|
||
"index": ",1," + ObjToStr(id) + ",",
|
||
}, Map{"id": id})
|
||
|
||
tagCtgs = append(tagCtgs, tagCtg)
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
//第二排是指标项,去除掉第一个参数,
|
||
//最重要的是参数tag生成,通过中文转拼音获取首字母实现,遇到同名的则最后加一位数字
|
||
if k == 1 {
|
||
|
||
for ck, cv := range v {
|
||
cv = strings.Replace(cv, " ", "", -1)
|
||
cv = strings.Replace(cv, "\r\t", "", -1)
|
||
cv = strings.Replace(cv, "\r", "", -1)
|
||
v[ck] = cv
|
||
if ck == 0 {
|
||
continue
|
||
}
|
||
//补充分类
|
||
if ck >= len(table[0]) {
|
||
tagCtgs = append(tagCtgs, tagCtgs[len(tagCtgs)-1])
|
||
}
|
||
//补充说明
|
||
if ck >= len(table[3]) {
|
||
table[3] = append(table[3], table[3][len(table[3])-1])
|
||
}
|
||
//补充单位
|
||
if ck >= len(table[2]) {
|
||
table[2] = append(table[2], "")
|
||
}
|
||
|
||
tag := this.Db.Get("tag", "*", Map{"AND": Map{"name": cv, "type": "0", "org_id": orgId}})
|
||
|
||
if tag != nil {
|
||
tags = append(tags, tag)
|
||
continue
|
||
}
|
||
sn, err := pinyin.New(cv).Split(" ").Mode(pinyin.InitialsInCapitals).Convert()
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
sn = cv
|
||
} else {
|
||
|
||
sns := strings.Split(sn, " ")
|
||
|
||
sn = "IEDC"
|
||
for _, v1 := range sns {
|
||
|
||
if v1 != "" && !unicode.IsPunct([]rune(v1)[0]) {
|
||
sn = sn + string([]rune(v1)[:1])
|
||
fmt.Println(sn, v1)
|
||
}
|
||
}
|
||
}
|
||
//sn=strings.Replace(sn,"\ufffd","",-1)
|
||
|
||
tagsn := this.Db.Get("tag", "id", Map{"AND": Map{"sn": sn, "type": "0", "org_id": orgId}})
|
||
if tagsn != nil {
|
||
for i := 0; i < 100; i++ {
|
||
tagsn = this.Db.Get("tag", "id", Map{"AND": Map{"sn": sn + ObjToStr(i), "type": "0", "org_id": orgId}})
|
||
if tagsn == nil {
|
||
sn = sn + ObjToStr(i)
|
||
break
|
||
}
|
||
}
|
||
}
|
||
|
||
tag = Map{
|
||
"name": cv,
|
||
"description": table[3][ck], //第三行对应位置为描述
|
||
"unit": table[2][ck],
|
||
"admin_id": this.Session("admin_id").ToInt(),
|
||
"org_id": orgId,
|
||
"type": 0,
|
||
"sn": sn,
|
||
"tag_ctg_id": tagCtgs[ck-1].GetCeilInt("id"),
|
||
"create_time": time.Now().Unix(),
|
||
"modify_time": time.Now().Unix(),
|
||
}
|
||
id := this.Db.Insert("tag", tag)
|
||
tag["id"] = id
|
||
tags = append(tags, tag)
|
||
}
|
||
|
||
}
|
||
|
||
//第四排以后是数据项,去除掉第一个参数,
|
||
//根据统一社会信用代码识别是否存在,同时将校验部分数字
|
||
if k > 3 {
|
||
|
||
//整行数据
|
||
rowData := Map{}
|
||
for ck, cv := range v {
|
||
if ck == 0 {
|
||
continue
|
||
}
|
||
cv = strings.Replace(cv, " ", "", -1)
|
||
cv = strings.Replace(cv, "\r\t", "", -1)
|
||
cv = strings.Replace(cv, "\r", "", -1)
|
||
|
||
if cv == "" {
|
||
|
||
cv = "暂无"
|
||
//return errors.New("第" + ObjToStr(k+1) + "行," + ObjToStr(ck+1) + "列,数据为空请注意检查")
|
||
}
|
||
|
||
v[ck] = cv
|
||
|
||
if ck-1 >= len(tags) {
|
||
fmt.Println(cv, "表格错误")
|
||
continue
|
||
}
|
||
|
||
rowData[tags[ck-1].GetString("sn")] = cv
|
||
}
|
||
|
||
if rowData["IEDCQYMC"] == nil {
|
||
fmt.Println("数据错误")
|
||
}
|
||
|
||
companyData := Map{
|
||
"name": rowData["IEDCQYMC"],
|
||
"sn": rowData["IEDCTYSHXYDM"],
|
||
"address": rowData["IEDCQYDZ"],
|
||
"unit": rowData["IEDCSDMC"],
|
||
"zdmj": rowData["IEDCYDMJ"],
|
||
"yysr": rowData["IEDC2NYYSR"],
|
||
"lrze": rowData["IEDC2NLRZE"],
|
||
"yjsj": rowData["IEDCYNSJ"],
|
||
"yfjf": rowData["IEDCNYFFY"],
|
||
"zgrs": rowData["IEDCSBRS"],
|
||
"zywrwpfdl": rowData["IEDCZYWRWPFDL"],
|
||
"zhnh": rowData["IEDCZHNH"],
|
||
"admin_id": this.Session("admin_id").ToInt(),
|
||
"upload_data": rowData.ToJsonString(),
|
||
"org_id": orgId,
|
||
//"create_time": time.Now().Unix(),
|
||
"modify_time": time.Now().Unix(),
|
||
//"lat": lat,
|
||
//"lng": lng,
|
||
}
|
||
//行业ID
|
||
//org := this.Db.Get("org", "id,name", Map{"id": orgId})
|
||
//regin := "全国"
|
||
//if org != nil {
|
||
// regin = org.GetString("name")
|
||
//}
|
||
//baiduDataStr, _ := baidu.DefaultBaiDuMap.GetPosition(companyData.GetString("address"), regin)
|
||
//baiduData := ObjToMap(baiduDataStr)
|
||
|
||
//city := Map{}
|
||
//if baiduData != nil && baiduData.GetCeilInt("status") == 0 {
|
||
// address := baiduData.GetSlice("result")
|
||
// if len(address) != 0 {
|
||
// companyData["lat"] = address.GetMap(0).GetMap("location").GetFloat64("lat")
|
||
// companyData["lng"] = address.GetMap(0).GetMap("location").GetFloat64("lng")
|
||
//
|
||
// city = this.Db.Get("city", "id", Map{"name[~]": address.GetMap(0).GetString("district"), "ORDER": "`level` DESC"})
|
||
// if city == nil {
|
||
// city = this.Db.Get("city", "id", Map{"name[~]": address.GetMap(0).GetString("city"), "ORDER": "`level` DESC"})
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
//if city != nil {
|
||
// companyData["city_id"] = city.GetCeilInt("id")
|
||
//}
|
||
|
||
//行业ID
|
||
category := this.Db.Get("category", "id", Map{"code": rowData["IEDCSSXYXLDM"]})
|
||
if category != nil {
|
||
companyData["category_id"] = category.GetCeilInt("id")
|
||
}
|
||
|
||
////此处需要优化
|
||
//companyData["org_id"] = 3
|
||
|
||
//产业ID
|
||
industry := this.Db.Get("industry", "id", Map{"name": rowData["IEDCCYLB"]})
|
||
if industry == nil {
|
||
industry = Map{
|
||
"admin_id": this.Session("admin_id").ToInt(),
|
||
"create_time": time.Now().Unix(),
|
||
"modify_time": time.Now().Unix(),
|
||
"name": rowData["IEDCCYLB"],
|
||
}
|
||
id := this.Db.Insert("industry", industry)
|
||
industry["id"] = id
|
||
}
|
||
|
||
if industry.GetCeilInt("id") != 0 {
|
||
|
||
//产业ID
|
||
industryAnalyse := this.Db.Get("industry_analyse", "id", Map{"AND": Map{"industry_id": industry.GetCeilInt("id"), "org_id": orgId}})
|
||
if industryAnalyse == nil {
|
||
industryAnalyse = Map{
|
||
"name": rowData["IEDCCYLB"],
|
||
"create_time": time.Now().Unix(),
|
||
"modify_time": time.Now().Unix(),
|
||
"org_id": orgId,
|
||
"industry_id": industry.GetCeilInt("id"),
|
||
}
|
||
//if city != nil {
|
||
// industryAnalyse["city_id"] = city.GetCeilInt("id")
|
||
//}
|
||
this.Db.Insert("industry_analyse", industryAnalyse)
|
||
}
|
||
companyData["industry_id"] = industry.GetCeilInt("id")
|
||
}
|
||
|
||
company := this.Db.Get("company", "id", Map{"name": companyData["name"]})
|
||
//没有则创建
|
||
if company == nil {
|
||
//更新两张表
|
||
companyData["create_time"] = time.Now().Unix()
|
||
id := this.Db.Insert("company", companyData)
|
||
companyData["company_id"] = id
|
||
company = Map{"id": id}
|
||
} else {
|
||
//有则更新
|
||
this.Db.Update("company", companyData, Map{"name": companyData["name"]})
|
||
companyData["company_id"] = company.GetCeilInt("id")
|
||
companyData["create_time"] = time.Now().Unix()
|
||
}
|
||
|
||
id := this.Db.Insert("company_history", companyData)
|
||
//更新最新的企业信息
|
||
this.Db.Update("company", Map{"company_history_id": id}, Map{"id": company.GetCeilInt("id")})
|
||
|
||
}
|
||
|
||
}
|
||
return nil
|
||
|
||
}
|
||
|
||
func (that *Org3) excel(filePath string) [][][]string {
|
||
xlsx, err := excelize.OpenFile(filePath)
|
||
if err != nil {
|
||
fmt.Println(err)
|
||
os.Exit(1)
|
||
}
|
||
list := xlsx.GetSheetList()
|
||
var data [][][]string
|
||
for _, v := range list {
|
||
rows, e := xlsx.GetRows(v)
|
||
if e != nil {
|
||
fmt.Println(e)
|
||
continue
|
||
}
|
||
data = append(data, rows)
|
||
}
|
||
|
||
return data
|
||
}
|
||
|
||
func (that *Org3) analyse(data Map) Map {
|
||
res := Map{}
|
||
//亩均收入
|
||
res["MJSR"] = data.GetFloat64("IEDC2NYYSR") / data.GetFloat64("IEDCYDMJ")
|
||
res["MJSRDF"] = "" //亩均收入得分
|
||
//亩均税收
|
||
res["MJSS"] = data.GetFloat64("IEDCYNSJ") / data.GetFloat64("IEDCYDMJ")
|
||
res["MJSSDF"] = "" //亩均税收得分
|
||
|
||
//人均收入
|
||
res["RJSR"] = data.GetFloat64("IEDC2NYYSR") / data.GetFloat64("IEDCSBRS")
|
||
res["RJSRDF"] = "" //人均收入得分
|
||
|
||
//研发经费投入强度
|
||
res["YFJFTRQD"] = data.GetFloat64("IEDCNYFFY") / data.GetFloat64("IEDC2NYYSR")
|
||
res["YFJFTRQDDF"] = "" //研发经费投入强度得分
|
||
|
||
//单位能耗税收
|
||
res["DWNHSS"] = data.GetFloat64("IEDCYNSJ") / data.GetFloat64("IEDCZHNH")
|
||
res["DWNHSSDF"] = "" //单位能耗税收得分
|
||
|
||
//主要污染物税收
|
||
//不足1按1计算
|
||
if data.GetFloat64("IEDCZYWRWPFDL") < 1 {
|
||
data["IEDCZYWRWPFDL"] = 1
|
||
}
|
||
|
||
res["ZYWRWSS"] = data.GetFloat64("IEDCYNSJ") / data.GetFloat64("IEDCZYWRWPFDL")
|
||
res["ZYWRWSSDF"] = "" //主要污染物税收
|
||
|
||
res["NXZBDF"] = "" //6项指标得分
|
||
|
||
for k, _ := range res {
|
||
if res.GetString(k) == "无" {
|
||
res[k] = "否"
|
||
}
|
||
}
|
||
|
||
//独角兽、瞪羚企业得分,一个一分
|
||
res["DJSDLQYDF"] = 0
|
||
if data.GetString("IEDCDJSQY") != "" && data.GetString("IEDCDJSQY") != "否" {
|
||
res["DJSDLQYDF"] = res.GetFloat64("DJSDLQYDF") + 1
|
||
}
|
||
if data.GetString("IEDCDLQY ") != "" && data.GetString("IEDCDLQY") != "否" {
|
||
res["DJSDLQYDF"] = res.GetFloat64("DJSDLQYDF") + 1
|
||
}
|
||
|
||
//企业获得国家级、省级、市级企业技术中心,国家级,省级得1分,市级得0.5
|
||
res["JSZXDF"] = 0
|
||
//国家级及省级
|
||
if (data.GetString("IEDCGJJQYJSZX") != "" && data.GetString("IEDCGJJQYJSZX") != "否") || //国家级
|
||
(data.GetString("IEDCSJQYJSZX") != "" && data.GetString("IEDCSJQYJSZX") != "否") || //省级
|
||
(data.GetString("IEDCGJJGCJSZX") != "" && data.GetString("IEDCGJJGCJSZX") != "否") || //国家级
|
||
(data.GetString("IEDCSJGCJSZX") != "" && data.GetString("IEDCSJGCJSZX") != "否") { //省级
|
||
res["JSZXDF"] = res.GetFloat64("JSZXDF") + 1
|
||
} else
|
||
|
||
//市级
|
||
if (data.GetString("IEDCSJQYJSZX0") != "" && data.GetString("IEDCSJQYJSZX0") != "否") ||
|
||
(data.GetString("IEDCSJGCJSZX0") != "" && data.GetString("IEDCSJQYJSZX") != "否") {
|
||
res["JSZXDF"] = res.GetFloat64("JSZXDF") + 0.5
|
||
}
|
||
|
||
//研发费用得分
|
||
res["YFFYDF"] = 0
|
||
if data.GetString("IEDCTRQD1WHZ3YS") != "" && data.GetString("IEDCTRQD1WHZ3YS") != "否" {
|
||
res["YFFYDF"] = 1
|
||
}
|
||
|
||
//高新技术企业得分
|
||
res["GXJSQYDF"] = 0
|
||
if data.GetString("IEDCGXJSQY") != "" && data.GetString("IEDCGXJSQY") != "否" {
|
||
res["GXJSQYDF"] = 1
|
||
}
|
||
//发展潜力总分
|
||
res["FZQLDF"] = res.GetFloat64("GXJSQYDF") + res.GetFloat64("YFFYDF") +
|
||
res.GetFloat64("JSZXDF") + res.GetFloat64("DJSDLQYDF")
|
||
|
||
//首台(套)、首批次、首版次企业
|
||
res["STTDF"] = 0
|
||
if data.GetString("IEDCSTTSPCSBCQY") != "" && data.GetString("IEDCSTTSPCSBCQY") != "否" {
|
||
res["STTDF"] = 1
|
||
}
|
||
|
||
//专利得分
|
||
res["ZLDF"] = 0
|
||
|
||
res["ZLDF"] = data.GetFloat64("IEDCPGJZL") +
|
||
data.GetFloat64("IEDCFMZL")*0.5 +
|
||
data.GetFloat64("IEDCSYXXZL")*0.1 +
|
||
data.GetFloat64("IEDCWGSJZL")*0.1
|
||
|
||
if res.GetFloat64("ZLDF") > 1 {
|
||
res["ZLDF"] = 1
|
||
}
|
||
|
||
//推广目录得分
|
||
res["TGMLDF"] = 0
|
||
if data.GetString("IEDCZMPPQY") != "" && data.GetString("IEDCZMPPQY") != "否" {
|
||
res["TGMLDF"] = 1
|
||
}
|
||
|
||
//知识产权总得分ZSCQDF
|
||
res["ZSCQDF"] = res.GetFloat64("ZLDF") + res.GetFloat64("STTDF") + res.GetFloat64("TGMLDF")
|
||
|
||
//连续3年盈利得分
|
||
res["LXSNYLDF"] = 3
|
||
//18年
|
||
if data.GetFloat64("IEDC1NLRZE") < 0 {
|
||
res["LXSNYLDF"] = res.GetInt("LXSNYLDF") - 1
|
||
}
|
||
//19年
|
||
if data.GetFloat64("IEDC1NLRZE0") < 0 {
|
||
res["LXSNYLDF"] = res.GetInt("LXSNYLDF") - 1
|
||
}
|
||
//20年
|
||
if data.GetFloat64("IEDC2NLRZE") < 0 {
|
||
res["LXSNYLDF"] = res.GetInt("LXSNYLDF") - 1
|
||
}
|
||
|
||
if res.GetInt("LXSNYLDF") == 3 {
|
||
res["LXSNYLDF"] = 1
|
||
} else if res.GetInt("LXSNYLDF") > 0 {
|
||
res["LXSNYLDF"] = 0.5
|
||
}
|
||
|
||
//当年利润总额得分
|
||
res["DNLRZEDF"] = 0
|
||
//企业利润率
|
||
res["QYLRL"] = data.GetFloat64("IEDC2NLRZE") / data.GetFloat64("IEDC2NYYSR")
|
||
if res.GetFloat64("QYLRL") > 0.1 {
|
||
res["DNLRZEDF"] = 1
|
||
} else if res.GetFloat64("QYLRL") > 0 {
|
||
res["DNLRZEDF"] = 0.5
|
||
}
|
||
//企业盈利能力总得分
|
||
res["QYYLNLZDF"] = res.GetFloat64("DNLRZEDF") + res.GetFloat64("LXSNYLDF")
|
||
|
||
//发展质量指标总分
|
||
res["FZZLZBZDF"] = res.GetFloat64("QYYLNLZDF") + res.GetFloat64("ZSCQDF") + res.GetFloat64("FZQLDF")
|
||
|
||
//企业连续3年亏损得分
|
||
res["KSDF"] = 3
|
||
//18年
|
||
if data.GetFloat64("IEDC1NLRZE") < 0 {
|
||
res["KSDF"] = res.GetInt("LXSNYLDF") - 1
|
||
}
|
||
//19年
|
||
if data.GetFloat64("IEDC1NLRZE0") < 0 {
|
||
res["KSDF"] = res.GetInt("LXSNYLDF") - 1
|
||
}
|
||
//20年
|
||
if data.GetFloat64("IEDC2NLRZE") < 0 {
|
||
res["KSDF"] = res.GetInt("LXSNYLDF") - 1
|
||
}
|
||
|
||
//先统一扣0.5分
|
||
if res.GetInt("LXSNYLDF") == 0 {
|
||
res["KSDF"] = 0.5
|
||
} else {
|
||
res["KSDF"] = 0
|
||
}
|
||
|
||
//环保检查得分
|
||
res["HBJCDF"] = 1
|
||
if data.GetString("IEDCHBJCHBCCZBFXWT") == "一般" {
|
||
res["HBJCDF"] = 0.5
|
||
}
|
||
if data.GetString("IEDCHBJCHBCCZBFXWT") == "重大" {
|
||
res["HBJCDF"] = 0
|
||
}
|
||
|
||
//减排技术升级改造
|
||
res["JPJSSJDF"] = 0
|
||
if data.GetString("IEDCJPJSSJGZ") != "" && data.GetString("IEDCJPJSSJGZ") != "否" {
|
||
res["JPJSSJDF"] = 1
|
||
}
|
||
|
||
//绿色生产工艺
|
||
res["LSSCGYDF"] = res.GetFloat64("JPJSSJDF") + res.GetFloat64("HBJCDF")
|
||
|
||
//安全检查得分
|
||
res["AQJCDF"] = 0
|
||
|
||
if data.GetString("IEDCHBJCHBCCZBFXWT") == "一般" {
|
||
res["AQJCDF"] = -1
|
||
}
|
||
if data.GetString("IEDCHBJCHBCCZBFXWT") == "重大" {
|
||
res["AQJCDF"] = -2
|
||
}
|
||
//安全事故得分
|
||
res["AQSGDF"] = 0
|
||
|
||
if data.GetString("IEDCFSAQSG") == "轻微" {
|
||
res["AQSGDF"] = -0.5
|
||
}
|
||
if data.GetString("IEDCFSAQSG") == "一般" {
|
||
res["AQSGDF"] = -1
|
||
}
|
||
if data.GetString("IEDCFSAQSG") == "重大" {
|
||
res["AQSGDF"] = -2
|
||
}
|
||
|
||
//企业风险隐患双预控体系建设得分
|
||
res["QYFXYHSKTXJSDF"] = 0
|
||
|
||
if data.GetString("IEDCFXYHSYKTXJS") != "" && data.GetString("IEDCFXYHSYKTXJS") != "否" {
|
||
res["QYFXYHSKTXJSDF"] = 1
|
||
}
|
||
|
||
//企业安全生产是否达标得分
|
||
res["QYAQSCDBDF"] = 0
|
||
|
||
if data.GetString("IEDCQYSCBZHJS") == "达标" {
|
||
res["QYAQSCDBDF"] = 1
|
||
}
|
||
|
||
//安全生产管理得分AQSCGLDF
|
||
res["AQSCGLDF"] = res.GetFloat64("QYAQSCDBDF") + res.GetFloat64("QYFXYHSKTXJSDF") +
|
||
res.GetFloat64("AQSGDF") + res.GetFloat64("AQJCDF")
|
||
|
||
//"绿色安全指标得分",
|
||
res["LSAQZBDF"] = (res.GetFloat64("AQSCGLDF") + res.GetFloat64("LSSCGYDF")) / 4 * 5
|
||
|
||
//产业链30户得分
|
||
res["CYL30HDF"] = 0
|
||
|
||
if data.GetString("IEDCCYLLZ、SJZD、SJ3HLTQY") != "" && data.GetString("IEDCCYLLZ、SJZD、SJ3HLTQY") != "否" {
|
||
res["CYL30HDF"] = 1
|
||
}
|
||
|
||
//市级100户重点企业得分
|
||
res["SJ100HZDQYDF"] = 0
|
||
|
||
if data.GetString("IEDCSJ1HZDQYQSXZDQY") != "" && data.GetString("IEDCSJ1HZDQYQSXZDQY") != "否" {
|
||
res["SJ100HZDQYDF"] = 1
|
||
}
|
||
|
||
//区域重点企业得分
|
||
res["QYZDQYDF"] = res.GetFloat64("CYL30HDF") + res.GetFloat64("SJ100HZDQYDF")
|
||
|
||
//符合地区重点产业得分
|
||
res["FHDQZDCYDF"] = 0
|
||
|
||
if data.GetString("IEDCFHDQZDCY") != "" && data.GetString("IEDCFHDQZDCY") != "否" {
|
||
res["FHDQZDCYDF"] = 1
|
||
}
|
||
|
||
//协作发展指标得分XZFZZBDF
|
||
res["XZFZZBDF"] = (res.GetFloat64("FHDQZDCYDF") + res.GetFloat64("QYZDQYDF")) / 3 * 5
|
||
|
||
//3项指标
|
||
res["SXZBDF"] = res.GetFloat64("XZFZZBDF") + res.GetFloat64("LSAQZBDF") + res.GetFloat64("FZZLZBZDF")
|
||
|
||
//产业人才得分
|
||
res["CYRCDF"] = 0
|
||
res["CYRCDF"] = data.GetInt("IEDCCYRC") * 2
|
||
if res.GetInt("CYRCDF") > 5 {
|
||
res["CYRCDF"] = 5
|
||
}
|
||
|
||
//资产负债率得分
|
||
res["ZCFZLDF"] = 0
|
||
IEDCZCFZL := ObjToFloat64(strings.Replace(data.GetString("IEDCZCFZL"), "%", "", -1))
|
||
if IEDCZCFZL <= 80 {
|
||
res["ZCFZLDF"] = 1
|
||
}
|
||
|
||
//科研人员占比得分
|
||
res["KYRYZBDF"] = 0
|
||
KYRYZBDF := ObjToFloat64(strings.Replace(data.GetString("IEDCKYRYZB"), "%", "", -1))
|
||
if KYRYZBDF >= 8 {
|
||
res["KYRYZBDF"] = 1
|
||
}
|
||
|
||
//2年研发占比得分
|
||
res["YFZBDF"] = 0
|
||
YFZBDF := ObjToFloat64(strings.Replace(data.GetString("IEDC2NYFZB"), "%", "", -1))
|
||
if YFZBDF >= 1.5 {
|
||
res["YFZBDF"] = 1
|
||
}
|
||
|
||
//具备专精特新知识产权要求得分
|
||
res["JBZJTXZSCQYQDF"] = 0
|
||
if data.GetString("IEDCZDHCYBZZDQY") != "" && data.GetString("IEDCZDHCYBZZDQY") != "否" {
|
||
res["JBZJTXZSCQYQDF"] = 1
|
||
}
|
||
|
||
//具备专精特新环境及条件得分
|
||
res["JBZJTXHJJTJDF"] = 0
|
||
if data.GetString("IEDCJPJSSJGZ") != "" && data.GetString("IEDCJPJSSJGZ") != "否" {
|
||
res["JBZJTXHJJTJDF"] = 1
|
||
}
|
||
|
||
//具备专精特新企业要求产品得分
|
||
res["JBZJTXQYYQCPDF"] = 0
|
||
if data.GetString("IEDCJBZJTXQYYQCP") != "" && data.GetString("IEDCJBZJTXQYYQCP") != "否" {
|
||
res["JBZJTXQYYQCPDF"] = 1
|
||
}
|
||
|
||
//具备专精特新企业基础要求得分
|
||
res["JBZJTXQYJCYQDF"] = 0
|
||
if data.GetString("IEDCJBZJTXQYJCYQ") != "" && data.GetString("IEDCJBZJTXQYJCYQ") != "否" {
|
||
res["JBZJTXQYJCYQDF"] = 1
|
||
}
|
||
|
||
ZJTXQLDFTotal := res.GetFloat64("JBZJTXQYJCYQDF") +
|
||
res.GetFloat64("JBZJTXQYYQCPDF") +
|
||
res.GetFloat64("JBZJTXHJJTJDF") +
|
||
res.GetFloat64("JBZJTXZSCQYQDF") +
|
||
res.GetFloat64("YFZBDF") +
|
||
res.GetFloat64("KYRYZBDF") +
|
||
res.GetFloat64("ZCFZLDF")
|
||
res["ZJTXQLDF"] = 0
|
||
if ZJTXQLDFTotal >= 5 {
|
||
res["ZJTXQLDF"] = 10
|
||
} else if ZJTXQLDFTotal >= 3 {
|
||
res["ZJTXQLDF"] = 6
|
||
} else if ZJTXQLDFTotal >= 1 {
|
||
res["ZJTXQLDF"] = 3
|
||
}
|
||
|
||
res["JGTZ"] = data.GetFloat64("IEDCXZTZQK")
|
||
|
||
return res
|
||
}
|
||
|
||
//6+3+n及首页数据分析
|
||
func (that *Org3) ctgAnalyse(datas []Map, totalAnalyse Map) Map {
|
||
home_data := totalAnalyse.GetMap("home_data")
|
||
|
||
resTotal := Map{
|
||
//经济效益
|
||
"区域生产总值": "暂无",
|
||
"区域企业总数": len(datas),
|
||
|
||
"梯度培育企业数": "暂无",
|
||
|
||
"上市企业数": "暂无",
|
||
"征地企业数/租赁企业数": "暂无",
|
||
"征地企业总面积": "暂无",
|
||
"租赁企业总面积": "暂无",
|
||
"厂房总面积": "暂无",
|
||
|
||
"楼宇总面积": "暂无",
|
||
"办公楼总面积": "暂无",
|
||
"研发楼总面积": "暂无",
|
||
|
||
"区域综合用电": "暂无",
|
||
"区域综合用水": "暂无",
|
||
|
||
"研究生及以上学历人数": "暂无",
|
||
"本科学历人数": "暂无",
|
||
"大专学历人数": "暂无",
|
||
|
||
"大专以下学历人数": "暂无",
|
||
"区域职工平均年收入": "暂无",
|
||
|
||
"技术证书持有人数": "暂无",
|
||
|
||
"拥有环境管理体系数": "暂无",
|
||
"拥有职业健康体系数": "暂无",
|
||
|
||
"属于本区重点企业配套数": "无",
|
||
"宿舍总面积": "无",
|
||
}
|
||
|
||
for _, v := range datas {
|
||
analyse := v.GetMap("analyse")
|
||
upload_data := v.GetMap("upload_data")
|
||
|
||
for k, _ := range upload_data {
|
||
if upload_data.GetString(k) == "无" {
|
||
upload_data[k] = "否"
|
||
}
|
||
}
|
||
|
||
resTotal["区域经营收入"] = resTotal.GetFloat64("区域经营收入") + upload_data.GetFloat64("IEDC2NYYSR")
|
||
resTotal["区域纳税总值"] = resTotal.GetFloat64("区域纳税总值") + upload_data.GetFloat64("IEDCYNSJ")
|
||
resTotal["区域资产总额"] = resTotal.GetFloat64("区域资产总额") + upload_data.GetFloat64("IEDCZCZE")
|
||
|
||
if upload_data.GetString("IEDCDJSQY") != "" && upload_data.GetString("IEDCDJSQY") != "否" {
|
||
resTotal["独角兽企业数"] = resTotal.GetInt("独角兽企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCDLQY ") != "" && upload_data.GetString("IEDCDLQY ") != "否" {
|
||
resTotal["瞪羚企业数"] = resTotal.GetInt("瞪羚企业数") + 1
|
||
}
|
||
|
||
//专精特新企业数
|
||
if analyse.GetInt("ZJTXQLDF") >= 6 {
|
||
resTotal["专精特新企业数"] = resTotal.GetInt("专精特新企业数") + 1
|
||
}
|
||
|
||
//规上企业数
|
||
if v.GetInt("gs") == 1 {
|
||
resTotal["规上企业数"] = resTotal.GetInt("规上企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetFloat64("IEDCXZTZQK") > 0 {
|
||
resTotal["技术改造投资备案数"] = resTotal.GetInt("技术改造投资备案数") + 1
|
||
}
|
||
|
||
if upload_data.GetFloat64("IEDCXZTZQK") > 0 {
|
||
resTotal["固定资产投入数"] = resTotal.GetInt("固定资产投入数") + 1
|
||
}
|
||
if upload_data.GetFloat64("IEDCXZTZQK") > 0 {
|
||
resTotal["固定资产投入"] = resTotal.GetFloat64("固定资产投入") + upload_data.GetFloat64("IEDCXZTZQK")
|
||
}
|
||
|
||
//技术中心
|
||
if (upload_data.GetString("IEDCGJJQYJSZX") != "" && upload_data.GetString("IEDCGJJQYJSZX") != "否") || //国家级
|
||
(upload_data.GetString("IEDCSJQYJSZX") != "" && upload_data.GetString("IEDCSJQYJSZX") != "否") || //省级
|
||
(upload_data.GetString("IEDCSJQYJSZX0") != "" && upload_data.GetString("IEDCSJQYJSZX0") != "否") {
|
||
resTotal["企业技术中心数"] = resTotal.GetInt("企业技术中心数") + 1
|
||
}
|
||
//工程技术中心
|
||
if (upload_data.GetString("IEDCSJGCJSZX0") != "" && upload_data.GetString("IEDCSJQYJSZX") != "否") ||
|
||
(upload_data.GetString("IEDCGJJGCJSZX") != "" && upload_data.GetString("IEDCGJJGCJSZX") != "否") || //国家级
|
||
(upload_data.GetString("IEDCSJGCJSZX") != "" && upload_data.GetString("IEDCSJGCJSZX") != "否") { //省级
|
||
|
||
resTotal["工程技术中心数"] = resTotal.GetInt("工程技术中心数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCGXJSQY") != "" && upload_data.GetString("IEDCGXJSQY") != "否" {
|
||
resTotal["高新技术企业数"] = resTotal.GetInt("高新技术企业数") + 1
|
||
|
||
}
|
||
|
||
if upload_data.GetString("IEDCZMPPQY") != "" && upload_data.GetString("IEDCZMPPQY") != "否" {
|
||
resTotal["知名品牌数"] = resTotal.GetInt("知名品牌数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCSTTSPCSBCQY") != "" && upload_data.GetString("IEDCSTTSPCSBCQY") != "否" {
|
||
resTotal["首台套/首批次/首版次数"] = resTotal.GetInt("首台套/首批次/首版次数") + 1
|
||
|
||
}
|
||
|
||
resTotal["知识产权数"] = resTotal.GetInt("知识产权数") + upload_data.GetInt("IEDCPGJZL") +
|
||
upload_data.GetInt("IEDCFMZL") + upload_data.GetInt("IEDCSYXXZL") +
|
||
upload_data.GetInt("IEDCWGSJZL")
|
||
|
||
resTotal["区域工业土地总面积"] = resTotal.GetFloat64("区域工业土地总面积") + upload_data.GetFloat64("IEDCYDMJ")
|
||
|
||
resTotal["区域综合用煤"] = resTotal.GetFloat64("区域综合用煤") + upload_data.GetFloat64("IEDCZHNH")
|
||
|
||
resTotal["区域总人数"] = resTotal.GetInt("区域总人数") + upload_data.GetInt("IEDCSBRS")
|
||
|
||
resTotal["产业人才数"] = resTotal.GetInt("产业人才数") + upload_data.GetInt("IEDCCYRC")
|
||
|
||
if upload_data.GetString("IEDCHBJCHBCCZBFXWT") != "" && upload_data.GetString("IEDCHBJCHBCCZBFXWT") != "否" {
|
||
resTotal["环保抽查处理数"] = resTotal.GetInt("环保抽查处理数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCHBJCHBCCZBFXWT") != "" && upload_data.GetString("IEDCHBJCHBCCZBFXWT") != "否" {
|
||
resTotal["安全抽查隐患处理数"] = resTotal.GetInt("安全抽查隐患处理数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCFSAQSG") != "" && upload_data.GetString("IEDCFSAQSG") != "否" {
|
||
resTotal["亡人事故数"] = resTotal.GetInt("亡人事故数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCFXYHSYKTXJS") != "" && upload_data.GetString("IEDCFXYHSYKTXJS") != "否" {
|
||
resTotal["拥有安全管理体系数"] = resTotal.GetInt("拥有安全管理体系数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCQYSCBZHJS") == "达标" {
|
||
resTotal["拥有质量管理体系数"] = resTotal.GetInt("拥有质量管理体系数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCSJ1HZDQYQSXZDQY") != "" && upload_data.GetString("IEDCSJ1HZDQYQSXZDQY") != "否" {
|
||
resTotal["区域100户重点企业数"] = resTotal.GetInt("区域100户重点企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCFHDQZDCY") != "" && upload_data.GetString("IEDCFHDQZDCY") != "否" {
|
||
resTotal["符合本区重点发展产业数"] = resTotal.GetInt("符合本区重点发展产业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCFHDQZDCY") != "" && upload_data.GetString("IEDCFHDQZDCY") != "否" {
|
||
resTotal["属于本区重点企业配套数"] = resTotal.GetInt("属于本区重点企业配套数") + 1
|
||
}
|
||
resTotal["企业社保人数"] = resTotal.GetFloat64("企业社保人数") + upload_data.GetFloat64("IEDCSBRS")
|
||
resTotal["企业研发费用"] = resTotal.GetFloat64("企业研发费用") + upload_data.GetFloat64("IEDCNYFFY")
|
||
|
||
resTotal["企业总能耗"] = resTotal.GetFloat64("企业总能耗") + upload_data.GetFloat64("IEDCZHNH")
|
||
resTotal["企业主要污染物排放量"] = resTotal.GetFloat64("企业主要污染物排放量") + upload_data.GetFloat64("IEDCZYWRWPFDL")
|
||
|
||
}
|
||
resTotalNew := Map{}
|
||
for k, _ := range resTotal {
|
||
|
||
if resTotal.GetString(k) != "暂无" {
|
||
resTotalNew[k] = resTotal.GetFloat64(k)
|
||
resTotalNew[k+"比值"] = resTotal.GetFloat64(k) / home_data.GetFloat64(k)
|
||
if resTotalNew.GetFloat64(k+"比值") == 0 {
|
||
resTotalNew[k+"比值"] = "0"
|
||
}
|
||
} else {
|
||
resTotalNew[k+"比值"] = "暂无"
|
||
resTotalNew[k] = "暂无"
|
||
}
|
||
|
||
}
|
||
|
||
return resTotalNew
|
||
}
|
||
|
||
//6+3+n及首页数据分析
|
||
func (that *Org3) totalAnalyse(datas []Map) (Map, Map, Map, Map) {
|
||
resTotal := Map{
|
||
//经济效益
|
||
"区域生产总值": "暂无",
|
||
"区域企业总数": len(datas),
|
||
|
||
"梯度培育企业数": "暂无",
|
||
|
||
"上市企业数": "暂无",
|
||
"征地企业数/租赁企业数": "暂无",
|
||
"征地企业总面积": "暂无",
|
||
"租赁企业总面积": "暂无",
|
||
"厂房总面积": "暂无",
|
||
|
||
"楼宇总面积": "暂无",
|
||
"办公楼总面积": "暂无",
|
||
"研发楼总面积": "暂无",
|
||
|
||
"区域综合用电": "暂无",
|
||
"区域综合用水": "暂无",
|
||
|
||
"研究生及以上学历人数": "暂无",
|
||
"本科学历人数": "暂无",
|
||
"大专学历人数": "暂无",
|
||
|
||
"大专以下学历人数": "暂无",
|
||
"区域职工平均年收入": "暂无",
|
||
|
||
"技术证书持有人数": "暂无",
|
||
|
||
"拥有环境管理体系数": "暂无",
|
||
"拥有职业健康体系数": "暂无",
|
||
|
||
"属于本区重点企业配套数": "无",
|
||
"宿舍总面积": "无",
|
||
}
|
||
|
||
sixItem := Map{} //6
|
||
threeItem := Map{} //3
|
||
nItem := Map{} //N
|
||
for _, v := range datas {
|
||
analyse := v.GetMap("analyse")
|
||
upload_data := v.GetMap("upload_data")
|
||
|
||
for k, _ := range upload_data {
|
||
if upload_data.GetString(k) == "无" {
|
||
upload_data[k] = "否"
|
||
}
|
||
}
|
||
|
||
resTotal["区域经营收入"] = resTotal.GetFloat64("区域经营收入") + upload_data.GetFloat64("IEDC2NYYSR")
|
||
resTotal["区域纳税总值"] = resTotal.GetFloat64("区域纳税总值") + upload_data.GetFloat64("IEDCYNSJ")
|
||
resTotal["区域资产总额"] = resTotal.GetFloat64("区域资产总额") + upload_data.GetFloat64("IEDCZCZE")
|
||
|
||
if upload_data.GetString("IEDCDJSQY") != "" && upload_data.GetString("IEDCDJSQY") != "否" {
|
||
resTotal["独角兽企业数"] = resTotal.GetInt("独角兽企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCDLQY ") != "" && upload_data.GetString("IEDCDLQY ") != "否" {
|
||
resTotal["瞪羚企业数"] = resTotal.GetInt("瞪羚企业数") + 1
|
||
}
|
||
|
||
//专精特新企业数
|
||
if analyse.GetInt("ZJTXQLDF") >= 6 {
|
||
resTotal["专精特新企业数"] = resTotal.GetInt("专精特新企业数") + 1
|
||
}
|
||
|
||
//规上企业数
|
||
if v.GetInt("gs") == 1 {
|
||
resTotal["规上企业数"] = resTotal.GetInt("规上企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetFloat64("IEDCXZTZQK") > 0 {
|
||
resTotal["技术改造投资备案数"] = resTotal.GetInt("技术改造投资备案数") + 1
|
||
}
|
||
|
||
if upload_data.GetFloat64("IEDCXZTZQK") > 0 {
|
||
resTotal["固定资产投入数"] = resTotal.GetInt("固定资产投入数") + 1
|
||
}
|
||
if upload_data.GetFloat64("IEDCXZTZQK") > 0 {
|
||
resTotal["固定资产投入"] = resTotal.GetFloat64("固定资产投入") + upload_data.GetFloat64("IEDCXZTZQK")
|
||
}
|
||
|
||
//技术中心
|
||
if (upload_data.GetString("IEDCGJJQYJSZX") != "" && upload_data.GetString("IEDCGJJQYJSZX") != "否") || //国家级
|
||
(upload_data.GetString("IEDCSJQYJSZX") != "" && upload_data.GetString("IEDCSJQYJSZX") != "否") || //省级
|
||
(upload_data.GetString("IEDCSJQYJSZX0") != "" && upload_data.GetString("IEDCSJQYJSZX0") != "否") {
|
||
resTotal["企业技术中心数"] = resTotal.GetInt("企业技术中心数") + 1
|
||
}
|
||
//工程技术中心
|
||
if (upload_data.GetString("IEDCSJGCJSZX0") != "" && upload_data.GetString("IEDCSJQYJSZX") != "否") ||
|
||
(upload_data.GetString("IEDCGJJGCJSZX") != "" && upload_data.GetString("IEDCGJJGCJSZX") != "否") || //国家级
|
||
(upload_data.GetString("IEDCSJGCJSZX") != "" && upload_data.GetString("IEDCSJGCJSZX") != "否") { //省级
|
||
|
||
resTotal["工程技术中心数"] = resTotal.GetInt("工程技术中心数") + 1
|
||
}
|
||
|
||
//技术中心
|
||
if (upload_data.GetString("IEDCGJJQYJSZX") != "" && upload_data.GetString("IEDCGJJQYJSZX") != "否") || //国家级
|
||
(upload_data.GetString("IEDCSJQYJSZX") != "" && upload_data.GetString("IEDCSJQYJSZX") != "否") || //省级
|
||
(upload_data.GetString("IEDCSJQYJSZX0") != "" && upload_data.GetString("IEDCSJQYJSZX0") != "否") ||
|
||
(upload_data.GetString("IEDCSJGCJSZX0") != "" && upload_data.GetString("IEDCSJQYJSZX") != "否") ||
|
||
(upload_data.GetString("IEDCGJJGCJSZX") != "" && upload_data.GetString("IEDCGJJGCJSZX") != "否") || //国家级
|
||
(upload_data.GetString("IEDCSJGCJSZX") != "" && upload_data.GetString("IEDCSJGCJSZX") != "否") { //省级
|
||
|
||
threeItem["投建企业技术中心/工程技术中心企业数"] = resTotal.GetInt("投建企业技术中心/工程技术中心企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCGXJSQY") != "" && upload_data.GetString("IEDCGXJSQY") != "否" {
|
||
resTotal["高新技术企业数"] = resTotal.GetInt("高新技术企业数") + 1
|
||
threeItem["高新技术企业数"] = threeItem.GetInt("高新技术企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCZMPPQY") != "" && upload_data.GetString("IEDCZMPPQY") != "否" {
|
||
resTotal["知名品牌数"] = resTotal.GetInt("知名品牌数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCSTTSPCSBCQY") != "" && upload_data.GetString("IEDCSTTSPCSBCQY") != "否" {
|
||
resTotal["首台套/首批次/首版次数"] = resTotal.GetInt("首台套/首批次/首版次数") + 1
|
||
threeItem["首台套/首批次/首版次数"] = threeItem.GetInt("首台套/首批次/首版次数") + 1
|
||
}
|
||
|
||
if upload_data.GetInt("IEDCSYXXZL") != 0 ||
|
||
upload_data.GetInt("IEDCFMZL") != 0 ||
|
||
upload_data.GetInt("IEDCPGJZL") != 0 {
|
||
|
||
threeItem["发明专利/实用新型专利/PCT国际专利企业数"] = threeItem.GetInt("发明专利/实用新型专利/PCT国际专利企业数") + 1
|
||
}
|
||
|
||
resTotal["知识产权数"] = resTotal.GetInt("知识产权数") + upload_data.GetInt("IEDCPGJZL") +
|
||
upload_data.GetInt("IEDCFMZL") + upload_data.GetInt("IEDCSYXXZL") +
|
||
upload_data.GetInt("IEDCWGSJZL")
|
||
|
||
resTotal["区域工业土地总面积"] = resTotal.GetFloat64("区域工业土地总面积") + upload_data.GetFloat64("IEDCYDMJ")
|
||
|
||
resTotal["区域综合用煤"] = resTotal.GetFloat64("区域综合用煤") + upload_data.GetFloat64("IEDCZHNH")
|
||
|
||
resTotal["区域总人数"] = resTotal.GetInt("区域总人数") + upload_data.GetInt("IEDCSBRS")
|
||
|
||
resTotal["产业人才数"] = resTotal.GetInt("产业人才数") + upload_data.GetInt("IEDCCYRC")
|
||
|
||
if upload_data.GetString("IEDCJPJSSJGZ") != "" && upload_data.GetString("IEDCJPJSSJGZ") != "否" {
|
||
resTotal["实施减排升级改造数"] = resTotal.GetInt("实施减排升级改造数") + 1
|
||
threeItem["减排技术升级改造企业数"] = threeItem.GetInt("减排技术升级改造企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCHBJCHBCCZBFXWT") != "" && upload_data.GetString("IEDCHBJCHBCCZBFXWT") != "否" {
|
||
resTotal["环保抽查处理数"] = resTotal.GetInt("环保抽查处理数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCHBJCHBCCZBFXWT") != "" && upload_data.GetString("IEDCHBJCHBCCZBFXWT") != "否" {
|
||
resTotal["安全抽查隐患处理数"] = resTotal.GetInt("安全抽查隐患处理数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCFSAQSG") != "" && upload_data.GetString("IEDCFSAQSG") != "否" {
|
||
resTotal["亡人事故数"] = resTotal.GetInt("亡人事故数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCFXYHSYKTXJS") != "" && upload_data.GetString("IEDCFXYHSYKTXJS") != "否" {
|
||
resTotal["拥有安全管理体系数"] = resTotal.GetInt("拥有安全管理体系数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCQYSCBZHJS") == "达标" {
|
||
resTotal["拥有质量管理体系数"] = resTotal.GetInt("拥有质量管理体系数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCSJ1HZDQYQSXZDQY") != "" && upload_data.GetString("IEDCSJ1HZDQYQSXZDQY") != "否" {
|
||
resTotal["区域100户重点企业数"] = resTotal.GetInt("区域100户重点企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCFHDQZDCY") != "" && upload_data.GetString("IEDCFHDQZDCY") != "否" {
|
||
resTotal["符合本区重点发展产业数"] = resTotal.GetInt("符合本区重点发展产业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCJPJSSJGZ") != "" && upload_data.GetString("IEDCJPJSSJGZ") != "否" {
|
||
resTotal["属于本区重点企业配套数"] = resTotal.GetInt("属于本区重点企业配套数") + 1
|
||
}
|
||
resTotal["企业社保人数"] = resTotal.GetFloat64("企业社保人数") + upload_data.GetFloat64("IEDCSBRS")
|
||
resTotal["企业研发费用"] = resTotal.GetFloat64("企业研发费用") + upload_data.GetFloat64("IEDCNYFFY")
|
||
|
||
if upload_data.GetFloat64("IEDCNYFFY") > 1000 {
|
||
threeItem["研发经费投入>1000万元企业数"] = resTotal.GetInt("研发经费投入>1000万元企业数") + 1
|
||
}
|
||
|
||
resTotal["企业总能耗"] = resTotal.GetFloat64("企业总能耗") + upload_data.GetFloat64("IEDCZHNH")
|
||
resTotal["企业主要污染物排放量"] = resTotal.GetFloat64("企业主要污染物排放量") + upload_data.GetFloat64("IEDCZYWRWPFDL")
|
||
|
||
run := func(level string) {
|
||
resTotal[level+"类企业数"] = resTotal.GetInt(level+"类企业数") + 1
|
||
resTotal[level+"类企业数总分"] = resTotal.GetFloat64(level+"类企业数总分") + v.GetFloat64("score")
|
||
if v.GetFloat64("score") > resTotal.GetFloat64(level+"类企业数最高分") {
|
||
resTotal[level+"类企业数最高分"] = v.GetFloat64("score")
|
||
}
|
||
if v.GetFloat64("score") < resTotal.GetFloat64(level+"类企业数最低分") ||
|
||
resTotal.GetFloat64(level+"类企业数最低分") == 0 {
|
||
resTotal[level+"类企业数最低分"] = v.GetFloat64("score")
|
||
}
|
||
//6
|
||
resTotal[level+"类企业营业收入"] = resTotal.GetFloat64(level+"类企业营业收入") + upload_data.GetFloat64("IEDC2NYYSR")
|
||
resTotal[level+"类企业税收"] = resTotal.GetFloat64(level+"类企业税收") + upload_data.GetFloat64("IEDCYNSJ")
|
||
resTotal[level+"类企业占地面积"] = resTotal.GetFloat64(level+"类企业占地面积") + upload_data.GetFloat64("IEDCYDMJ")
|
||
resTotal[level+"类企业社保人数"] = resTotal.GetInt(level+"类企业社保人数") + upload_data.GetInt("IEDCSBRS")
|
||
resTotal[level+"类企业研发费用"] = resTotal.GetFloat64(level+"类企业研发费用") + upload_data.GetFloat64("IEDCNYFFY")
|
||
resTotal[level+"类企业总能耗"] = resTotal.GetFloat64(level+"类企业总能耗") + upload_data.GetFloat64("IEDCZHNH")
|
||
resTotal[level+"类企业主要污染物排放量"] = resTotal.GetFloat64(level+"类企业主要污染物排放量") + upload_data.GetFloat64("IEDCZYWRWPFDL")
|
||
}
|
||
switch v.GetCeilInt("level") {
|
||
case 0:
|
||
run("A")
|
||
case 1:
|
||
run("B")
|
||
case 2:
|
||
run("C")
|
||
case 3:
|
||
run("D")
|
||
}
|
||
//3
|
||
if upload_data.GetString("IEDCZMPPQY") != "" && upload_data.GetString("IEDCZMPPQY") != "否" {
|
||
threeItem["进入本地区名优产品目录企业数"] = threeItem.GetInt("进入本地区名优产品目录企业数") + 1
|
||
}
|
||
if analyse.GetInt("LXSNYLDF") == 1 {
|
||
threeItem["连续3年盈利/首年度盈利企业数"] = threeItem.GetInt("连续3年盈利/首年度盈利企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCHBJCHBCCZBFXWT") == "一般" {
|
||
threeItem["环保检/抽查受一般性处理企业数"] = threeItem.GetInt("环保检/抽查受一般性处理企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCHBJCHBCCZBFXWT") == "一般" {
|
||
threeItem["安全检/抽查存在风险隐患受一般性处理企业数"] = threeItem.GetInt("安全检/抽查存在风险隐患受一般性处理企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCFSAQSG") != "否" {
|
||
threeItem["安全事故发生企业数"] = threeItem.GetInt("安全事故发生企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCFXYHSYKTXJS") != "否" {
|
||
threeItem["已建/在建风险隐患双预控体系企业数"] = threeItem.GetInt("已建/在建风险隐患双预控体系企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCFXYHSYKTXJS") == "未达标" {
|
||
threeItem["生产标准不达标企业数"] = threeItem.GetInt("生产标准不达标企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCFHDQZDCY") != "" && upload_data.GetString("IEDCFHDQZDCY") != "否" {
|
||
threeItem["所处产业符合本地区重点发展产业企业数"] = threeItem.GetInt("所处产业符合本地区重点发展产业企业数") + 1
|
||
}
|
||
|
||
if upload_data.GetString("IEDCCYLLZ、SJZD、SJ3HLTQY") != "" && upload_data.GetString("IEDCCYLLZ、SJZD、SJ3HLTQY") != "否" {
|
||
threeItem["产业链链主/省级重点/市级30户龙头企业数"] = threeItem.GetInt("产业链链主/省级重点/市级30户龙头企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCCYLLZ、SJZD、SJ3HLTQY") != "" && upload_data.GetString("IEDCCYLLZ、SJZD、SJ3HLTQY") != "否" {
|
||
threeItem["市级100户重点/区市县重点企业数"] = threeItem.GetInt("IEDCSJ1HZDQYQSXZDQY") + 1
|
||
}
|
||
|
||
//N
|
||
if upload_data.GetInt("IEDCCYRC") > 0 {
|
||
nItem["配备年薪≥30万元人才企业数"] = nItem.GetInt("配备年薪≥30万元人才企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCZDHCYBZZDQY") != "" && upload_data.GetString("IEDCZDHCYBZZDQY") != "否" {
|
||
nItem["有效发明专利≥2项/满足参与制定标准企业数"] = nItem.GetInt("有效发明专利≥2项/满足参与制定标准企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCJPJSSJGZ") != "" && upload_data.GetString("IEDCJPJSSJGZ") != "否" {
|
||
nItem["具备技术创新任务设备/环境企业数"] = nItem.GetInt("具备技术创新任务设备/环境企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCJBZJTXQYJCYQ") != "" && upload_data.GetString("IEDCJBZJTXQYJCYQ") != "否" {
|
||
nItem["特定细分≥3年且主导产品≥营收60%企业数"] = nItem.GetInt("特定细分≥3年且主导产品≥营收60%企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCJBZJTXQYYQCP") != "" && upload_data.GetString("IEDCJBZJTXQYYQCP") != "否" {
|
||
nItem["大专/中级职称占比≥35%企业数"] = nItem.GetInt("大专/中级职称占比≥35%企业数") + 1
|
||
}
|
||
if upload_data.GetString("IEDCJPJSSJGZ") != "" && upload_data.GetString("IEDCJPJSSJGZ") != "否" {
|
||
nItem["进行技术改造企业数"] = nItem.GetInt("进行技术改造企业数") + 1
|
||
}
|
||
|
||
}
|
||
|
||
sixItem["亩均收入"] = resTotal.GetFloat64("区域经营收入") / resTotal.GetFloat64("区域工业土地总面积")
|
||
sixItem["亩均税收"] = resTotal.GetFloat64("区域纳税总值") / resTotal.GetFloat64("区域工业土地总面积")
|
||
sixItem["人均收入"] = resTotal.GetFloat64("区域经营收入") / resTotal.GetFloat64("企业社保人数")
|
||
sixItem["研发经费投入强度"] = resTotal.GetFloat64("企业研发费用") / resTotal.GetFloat64("区域经营收入")
|
||
sixItem["单位能耗税收"] = resTotal.GetFloat64("区域纳税总值") / resTotal.GetFloat64("企业总能耗")
|
||
sixItem["主要污染物税收"] = resTotal.GetFloat64("区域纳税总值") / resTotal.GetFloat64("企业主要污染物排放量")
|
||
|
||
run1 := func(level string) {
|
||
resTotal[level+"类企业数平均分"] = resTotal.GetFloat64(level+"类企业数总分") / resTotal.GetFloat64(level+"类企业数")
|
||
sixItem[level+"类亩均收入"] = resTotal.GetFloat64(level+"类企业营业收入") / resTotal.GetFloat64(level+"类企业占地面积")
|
||
sixItem[level+"类亩均税收"] = resTotal.GetFloat64(level+"类企业税收") / resTotal.GetFloat64(level+"类企业占地面积")
|
||
sixItem[level+"类人均收入"] = resTotal.GetFloat64(level+"类企业营业收入") / resTotal.GetFloat64(level+"类企业社保人数")
|
||
sixItem[level+"类研发经费投入强度"] = resTotal.GetFloat64(level+"类企业研发费用") / resTotal.GetFloat64(level+"类企业营业收入")
|
||
sixItem[level+"类单位能耗税收"] = resTotal.GetFloat64(level+"类企业税收") / resTotal.GetFloat64(level+"类企业总能耗")
|
||
if resTotal.GetFloat64(level+"类企业主要污染物排放量") == 0 {
|
||
fmt.Println(level, resTotal[level+"类企业主要污染物排放量"], resTotal.GetFloat64(level+"类企业主要污染物排放量"))
|
||
resTotal[level+"类企业主要污染物排放量"] = 1
|
||
}
|
||
sixItem[level+"类主要污染物税收"] = resTotal.GetFloat64(level+"类企业税收") / resTotal.GetFloat64(level+"类企业主要污染物排放量")
|
||
}
|
||
|
||
run1("A")
|
||
run1("B")
|
||
run1("C")
|
||
run1("D")
|
||
|
||
return resTotal, sixItem, threeItem, nItem
|
||
}
|
||
|
||
//单个企业分析
|
||
func (that *Org3) analyseSort(datas []Map) []Map {
|
||
cs := append(Companys{}, datas...)
|
||
|
||
sort6Get := func(指标名称 string, 指标得分名称 string, cs Companys, point float64) Companys {
|
||
csLength := len(cs)
|
||
analyseTypeName = "analyse"
|
||
analyseSortType = 指标名称 //亩均收入得分
|
||
sort.Sort(cs)
|
||
|
||
for _, data := range cs {
|
||
v := data.GetMap("analyse")
|
||
k := len(cs) - 1
|
||
if v.GetFloat64(analyseSortType) == cs[k].GetMap("analyse").GetFloat64(analyseSortType) {
|
||
v[analyseSortType+"排名"] = k + 1
|
||
} else {
|
||
for k1, data1 := range cs {
|
||
v1 := data1.GetMap("analyse")
|
||
if v.GetFloat64(analyseSortType) >= v1.GetFloat64(analyseSortType) {
|
||
k = k1
|
||
v[analyseSortType+"排名"] = k1 + 1
|
||
break
|
||
}
|
||
}
|
||
}
|
||
|
||
if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.1 {
|
||
v[指标得分名称] = point * 1.0
|
||
} else if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.3 {
|
||
v[指标得分名称] = point * 0.85
|
||
} else if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.5 {
|
||
v[指标得分名称] = point * 0.75
|
||
} else if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.7 {
|
||
v[指标得分名称] = point * 0.6
|
||
} else if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.9 {
|
||
v[指标得分名称] = point * 0.5
|
||
} else {
|
||
v[指标得分名称] = point * 0.25
|
||
}
|
||
if v.GetFloat64(指标名称) == 0 {
|
||
v[指标得分名称] = point * 0
|
||
}
|
||
|
||
//6项指标得分
|
||
if 指标名称 == "ZYWRWSS" {
|
||
v["NXZBDF"] = v.GetFloat64("MJSRDF") + v.GetFloat64("MJSSDF") +
|
||
v.GetFloat64("RJSRDF") + v.GetFloat64("YFJFTRQDDF") +
|
||
v.GetFloat64("DWNHSSDF") + v.GetFloat64("ZYWRWSSDF")
|
||
}
|
||
}
|
||
return cs
|
||
}
|
||
|
||
sort6Get("MJSR", "MJSRDF", cs, 15)
|
||
sort6Get("MJSS", "MJSSDF", cs, 15)
|
||
sort6Get("RJSR", "RJSRDF", cs, 10)
|
||
sort6Get("YFJFTRQD", "YFJFTRQDDF", cs, 10)
|
||
sort6Get("DWNHSS", "DWNHSSDF", cs, 5)
|
||
sort6Get("ZYWRWSS", "ZYWRWSSDF", cs, 5)
|
||
|
||
csLength := len(cs)
|
||
analyseSortType = "IEDCXZTZQK" //技改投资
|
||
analyseTypeName = "upload_data"
|
||
sort.Sort(cs)
|
||
|
||
for _, data := range cs {
|
||
|
||
//fmt.Println("dasdas", data.GetString("name"), data.GetMap("upload_data").GetFloat64(analyseSortType))
|
||
|
||
v := data.GetMap("analyse")
|
||
k := len(cs) - 1
|
||
if v.GetFloat64(analyseSortType) == cs[k].GetMap("analyse").GetFloat64(analyseSortType) {
|
||
v[analyseSortType+"排名"] = k + 1
|
||
} else {
|
||
for k1, data1 := range cs {
|
||
v1 := data1.GetMap("analyse")
|
||
if v.GetFloat64(analyseSortType) >= v1.GetFloat64(analyseSortType) {
|
||
k = k1
|
||
v[analyseSortType+"排名"] = k1 + 1
|
||
break
|
||
}
|
||
}
|
||
}
|
||
|
||
v["JGTZPM"] = k + 1
|
||
if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.3 {
|
||
v["JGTZDF"] = 5
|
||
} else if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.6 {
|
||
v["JGTZDF"] = 4
|
||
} else {
|
||
v["JGTZDF"] = 2
|
||
}
|
||
if v.GetFloat64("JGTZ") == 0 {
|
||
v["JGTZDF"] = 2
|
||
}
|
||
//N总得分以及所有项总分,以及企业评级
|
||
v["NZDF"] = v.GetFloat64("JGTZDF") + v.GetFloat64("ZJTXQLDF") + v.GetFloat64("CYRCDF")
|
||
|
||
v["ZDF"] = v.GetFloat64("NZDF") + v.GetFloat64("SXZBDF") + v.GetFloat64("NXZBDF")
|
||
}
|
||
analyseTypeName = "analyse"
|
||
analyseSortType = "ZDF" //技改投资
|
||
sort.Sort(cs)
|
||
|
||
for _, data := range cs {
|
||
v := data.GetMap("analyse")
|
||
//v := data.GetMap("analyse")
|
||
k := len(cs) - 1
|
||
//fmt.Println(v.GetFloat64(analyseSortType),cs[k].GetMap("analyse").GetFloat64(analyseSortType))
|
||
if v.GetFloat64(analyseSortType) == cs[k].GetMap("analyse").GetFloat64(analyseSortType) {
|
||
v[analyseSortType+"排名"] = k + 1
|
||
} else {
|
||
for k1, data1 := range cs {
|
||
v1 := data1.GetMap("analyse")
|
||
if v.GetFloat64(analyseSortType) >= v1.GetFloat64(analyseSortType) {
|
||
k = k1
|
||
v[analyseSortType+"排名"] = k + 1
|
||
break
|
||
}
|
||
}
|
||
}
|
||
|
||
v["ZPM"] = k + 1
|
||
v["ZQYS"] = len(cs)
|
||
if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.1 {
|
||
v["PJ"] = "A"
|
||
} else if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.8 {
|
||
v["PJ"] = "B"
|
||
} else if ObjToFloat64(k) <= ObjToFloat64(csLength)*0.89 {
|
||
v["PJ"] = "C"
|
||
} else {
|
||
v["PJ"] = "D"
|
||
}
|
||
}
|
||
|
||
return cs
|
||
}
|