新版本

This commit is contained in:
hoteas 2022-07-19 13:42:59 +08:00
parent 8159e5cbda
commit 4ccf7d2f9d
4 changed files with 92 additions and 89 deletions

View File

@ -117,43 +117,43 @@ var CompanyInOutCtr = Ctr{
//
//},
//"total_analyse": func(this *Context) {
// orgId := ObjToInt(this.Req.FormValue("org_id"))
// if orgId == 0 {
// this.Display(3, "参数错误")
// return
// }
//
// companys := this.Db.Select("company", "*", Map{"AND": Map{"org_id": orgId}})
//
// home_data, six_item_data, three_item_data, n_item_data := totalAnalyse(companys)
//
// org := this.Db.Get("org", "*", Map{"id": orgId})
// fmt.Println(six_item_data)
//
// data := Map{
// "name": org.GetString("name"),
// "home_data": home_data.ToJsonString(),
// "six_item_data": six_item_data.ToJsonString(),
// "three_item_data": three_item_data.ToJsonString(),
// "n_item_data": n_item_data.ToJsonString(),
// "modify_time": time.Now().Unix(),
// }
// org_analyse := this.Db.Get("org_analyse", "id", Map{"org_id": orgId})
// if org_analyse == nil {
// //data["name"] = time.Now().Format("2006-01-02 15:04") + "创建"
// data["name"] = org.GetString("name")
// data["org_id"] = orgId
// data["create_time"] = time.Now().Unix()
// id := this.Db.Insert("org_analyse", data)
// data["id"] = id
// } else {
// this.Db.Update("org_analyse", data, Map{"org_id": orgId})
// }
//
// this.Display(0, data)
//
//},
"total_analyse": func(this *Context) {
orgId := ObjToInt(this.Req.FormValue("org_id"))
if orgId == 0 {
this.Display(3, "参数错误")
return
}
companys := this.Db.Select("company", "*", Map{"AND": Map{"org_id": orgId}})
home_data, six_item_data, three_item_data, n_item_data := totalAnalyse(companys)
org := this.Db.Get("org", "*", Map{"id": orgId})
fmt.Println(six_item_data)
data := Map{
"name": org.GetString("name"),
"home_data": home_data.ToJsonString(),
"six_item_data": six_item_data.ToJsonString(),
"three_item_data": three_item_data.ToJsonString(),
"n_item_data": n_item_data.ToJsonString(),
"modify_time": time.Now().Unix(),
}
org_analyse := this.Db.Get("org_analyse", "id", Map{"org_id": orgId})
if org_analyse == nil {
//data["name"] = time.Now().Format("2006-01-02 15:04") + "创建"
data["name"] = org.GetString("name")
data["org_id"] = orgId
data["create_time"] = time.Now().Unix()
id := this.Db.Insert("org_analyse", data)
data["id"] = id
} else {
this.Db.Update("org_analyse", data, Map{"org_id": orgId})
}
this.Display(0, data)
},
//
//"category_analyse": func(this *Context) {
//

View File

@ -788,7 +788,7 @@ func totalAnalyse(datas []Map) (Map, Map, Map, Map) {
if uploadData.GetFloat64("IEDCYNSJ") != 0 {
resTotal["区域纳税总值"] = resTotal.GetFloat64("区域纳税总值") + uploadData.GetFloat64("IEDCYNSJ")
} else {
resTotal["区域纳税总值"] = resTotal.GetFloat64("区域纳税总值") + uploadData.GetFloat64("IEDC2NYJSJ") +
resTotal["区域纳税总值"] = resTotal.GetFloat64("区域纳税总值") + uploadData.GetFloat64("IEDC2NYJSJ0") +
uploadData.GetFloat64("IEDCNSZE") +
uploadData.GetFloat64("IEDC2NSJSJ") + uploadData.GetFloat64("IEDCYJSJ")
}
@ -820,15 +820,15 @@ func totalAnalyse(datas []Map) (Map, Map, Map, Map) {
}
//技术中心
resTotal["企业技术中心数"] = resTotal.GetInt("企业技术中心数") + uploadData.GetInt("IEDCGJJGCJSZX") +
uploadData.GetInt("IEDCSJQYJSZX0") + uploadData.GetInt("IEDCYYQYJSZXGCJSZX") + uploadData.GetInt("IEDCSJQYJSZX")
uploadData.GetInt("IEDCSJQYJSZX0") + uploadData.GetInt("IEDCYYQYJSZXGCJSZX") + uploadData.GetInt("IEDCSJQYJSZX") + uploadData.GetInt("IEDCGJJQYJSZX")
//工程技术中心
resTotal["工程技术中心数"] = resTotal.GetInt("工程技术中心数") + uploadData.GetInt("IEDCSJGCJSZX0") +
uploadData.GetInt("IEDCSJGCJSZX") + uploadData.GetInt("IEDCGJJGCJSZX") + uploadData.GetInt("IEDCSJQYJSZX")
threeItem["投建企业技术中心/工程技术中心企业数"] = resTotal.GetInt("投建企业技术中心/工程技术中心企业数") + uploadData.GetInt("IEDCSJGCJSZX0") +
uploadData.GetInt("IEDCSJGCJSZX") + uploadData.GetInt("IEDCGJJGCJSZX") + uploadData.GetInt("IEDCGJJGCJSZX") +
uploadData.GetInt("IEDCSJQYJSZX0") + uploadData.GetInt("IEDCYYQYJSZXGCJSZX") + uploadData.GetInt("IEDCSJQYJSZX")
threeItem["投建企业技术中心/工程技术中心企业数"] = threeItem.GetInt("投建企业技术中心/工程技术中心企业数") +
uploadData.GetInt("IEDCSJGCJSZX0") + uploadData.GetInt("IEDCSJGCJSZX") + uploadData.GetInt("IEDCGJJGCJSZX") +
uploadData.GetInt("IEDCSJQYJSZX0") + uploadData.GetInt("IEDCGJJQYJSZX") + uploadData.GetInt("IEDCSJQYJSZX") + uploadData.GetInt("IEDCYYQYJSZXGCJSZX")
resTotal["高新技术企业数"] = resTotal.GetInt("高新技术企业数") + uploadData.GetInt("IEDCGXJSQY")
threeItem["高新技术企业数"] = threeItem.GetInt("高新技术企业数") + uploadData.GetInt("IEDCGXJSQY")
@ -966,7 +966,7 @@ func totalAnalyse(datas []Map) (Map, Map, Map, Map) {
//3
threeItem["进入本地区名优产品目录企业数"] = threeItem.GetInt("进入本地区名优产品目录企业数") + uploadData.GetInt("IEDCZMPPQY") + uploadData.GetInt("IEDCCDSMYCP")
threeItem["连续3年盈利/首年度盈利企业数"] = threeItem.GetInt("连续3年盈利/首年度盈利企业数") + uploadData.GetInt("IEDCLX3NYLQY")
threeItem["连续3年盈利/首年度盈利企业数"] = threeItem.GetInt("连续3年盈利/首年度盈利企业数") + uploadData.GetInt("IEDCLX3NYLQY") + uploadData.GetInt("IEDCLX3NYL")
//if analyse.GetInt("LXSNYLDF") == 1 {
// threeItem["连续3年盈利/首年度盈利企业数"] = threeItem.GetInt("连续3年盈利/首年度盈利企业数") + 1
//}

View File

@ -331,6 +331,9 @@ func totalTestAnalyse(companys []Map, tag Map, totalData Map) {
//if strV == "否" {
// v = 0
//}
if k == "高新技术企业" {
fmt.Println(15545)
}
if strings.Index(strV, "%") == len(strV)-1 && len(strV) != 0 {
v = uploadData.GetFloat64(strings.Replace(strV, "%", "", -1)) / 100
}
@ -628,7 +631,7 @@ func ctgTestAnalyse(companys []Map, tag Map, totalData, totalAnalyse Map) {
//if strV == "否" {
// v = 0
//}
if strV == "国家级专精特新" {
if k == "高新技术企业" {
fmt.Println(15545)
}
if strings.Index(strV, "%") == len(strV)-1 && len(strV) != 0 {
@ -794,51 +797,51 @@ var TestCtr = Ctr{
}
this.Display(0, industrys)
},
"total_Analyse": func(this *Context) {
orgId := 1
companys := this.Db.Select("company", "*")
for _, v := range companys {
//上传数据
v["upload_data"] = v.GetMap("upload_data")
v["collect_data"] = v.GetMap("collect_data")
v["analyse"] = v.GetMap("analyse")
}
tagCompany := this.Db.Select("tag", "*", Map{"type": 4, "ORDER": "`sort` ASC"})
//cs := append(NewCompanys{}, companys...)
totalData := Map{}
for _, tag := range tagCompany {
totalTestAnalyse(companys, tag, totalData)
//fmt.Println(data)
}
totalAnalyse1(companys, totalData)
//home_data, six_item_data, three_item_data, n_item_data := totalTestAnalyse(companys)
org := this.Db.Get("org", "*", Map{"id": orgId})
//fmt.Println(six_item_data.ToJsonString())
fmt.Println(totalData)
data := Map{
"name": org.GetString("name"),
"home_data": totalData.ToJsonString(),
//"six_item_data": six_item_data.ToJsonString(),
//"three_item_data": three_item_data.ToJsonString(),
//"n_item_data": n_item_data.ToJsonString(),
"modify_time": time.Now().Unix(),
}
org_analyse := this.Db.Get("org_analyse", "id", Map{"org_id": orgId})
if org_analyse == nil {
data["name"] = org.GetString("name")
data["org_id"] = orgId
data["create_time"] = time.Now().Unix()
id := this.Db.Insert("org_analyse", data)
data["id"] = id
} else {
this.Db.Update("org_analyse", data, Map{"org_id": orgId})
}
this.Display(0, data)
},
//"total_Analyse": func(this *Context) {
//
// orgId := 1
// companys := this.Db.Select("company", "*")
// for _, v := range companys {
// //上传数据
// v["upload_data"] = v.GetMap("upload_data")
// v["collect_data"] = v.GetMap("collect_data")
// v["analyse"] = v.GetMap("analyse")
// }
//
// tagCompany := this.Db.Select("tag", "*", Map{"type": 4, "ORDER": "`sort` ASC"})
// //cs := append(NewCompanys{}, companys...)
// totalData := Map{}
// for _, tag := range tagCompany {
// totalTestAnalyse(companys, tag, totalData)
// //fmt.Println(data)
// }
// totalAnalyse1(companys, totalData)
// //home_data, six_item_data, three_item_data, n_item_data := totalTestAnalyse(companys)
// org := this.Db.Get("org", "*", Map{"id": orgId})
// //fmt.Println(six_item_data.ToJsonString())
// fmt.Println(totalData)
// data := Map{
// "name": org.GetString("name"),
// "home_data": totalData.ToJsonString(),
// //"six_item_data": six_item_data.ToJsonString(),
// //"three_item_data": three_item_data.ToJsonString(),
// //"n_item_data": n_item_data.ToJsonString(),
// "modify_time": time.Now().Unix(),
// }
// org_analyse := this.Db.Get("org_analyse", "id", Map{"org_id": orgId})
// if org_analyse == nil {
// data["name"] = org.GetString("name")
// data["org_id"] = orgId
// data["create_time"] = time.Now().Unix()
// id := this.Db.Insert("org_analyse", data)
// data["id"] = id
// } else {
// this.Db.Update("org_analyse", data, Map{"org_id": orgId})
// }
//
// this.Display(0, data)
//
//},
"analyse": func(this *Context) {
orgId := ObjToInt(this.Req.FormValue("org_id"))
if orgId == 0 {

Binary file not shown.