|
@@ -194,29 +194,42 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
}
|
|
}
|
|
columnarData = append(columnarData, item)
|
|
columnarData = append(columnarData, item)
|
|
item = map[string]interface{}{
|
|
item = map[string]interface{}{
|
|
- "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
|
- "count": 0,
|
|
|
|
|
|
+ "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
|
+ "percentage": 0,
|
|
}
|
|
}
|
|
lineData = append(lineData, item)
|
|
lineData = append(lineData, item)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// 3.当年数据初始化
|
|
// 3.当年数据初始化
|
|
- // submitData := map[string]float64{
|
|
|
|
- // fmt.Sprintf("%d-01", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-02", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-03", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-04", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-05", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-06", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-07", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-08", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-09", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-10", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-11", year): 0,
|
|
|
|
- // fmt.Sprintf("%d-12", year): 0,
|
|
|
|
- // }
|
|
|
|
- // rectifyedData := submitData
|
|
|
|
|
|
+ submitData := map[string]int{
|
|
|
|
+ fmt.Sprintf("%d-01", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-02", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-03", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-04", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-05", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-06", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-07", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-08", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-09", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-10", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-11", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-12", year): 0,
|
|
|
|
+ }
|
|
|
|
+ rectifyedData := map[string]int{
|
|
|
|
+ fmt.Sprintf("%d-01", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-02", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-03", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-04", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-05", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-06", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-07", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-08", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-09", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-10", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-11", year): 0,
|
|
|
|
+ fmt.Sprintf("%d-12", year): 0,
|
|
|
|
+ }
|
|
for _, item := range safeList {
|
|
for _, item := range safeList {
|
|
if item.Status == 2 {
|
|
if item.Status == 2 {
|
|
id, _ := comm.AesEncrypt(item.Id, conf.SignSecret)
|
|
id, _ := comm.AesEncrypt(item.Id, conf.SignSecret)
|
|
@@ -224,31 +237,46 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
rectifylist = append(rectifylist, item)
|
|
rectifylist = append(rectifylist, item)
|
|
rectifyTotal++
|
|
rectifyTotal++
|
|
}
|
|
}
|
|
- if item.Status == 1 {
|
|
|
|
- approvalTotal++
|
|
|
|
- }
|
|
|
|
|
|
+ // if item.Status == 1 {
|
|
|
|
+ // approvalTotal++
|
|
|
|
+ // }
|
|
|
|
+ approvalTotal++
|
|
if item.Status == 4 {
|
|
if item.Status == 4 {
|
|
rectifyedTotal++
|
|
rectifyedTotal++
|
|
}
|
|
}
|
|
|
|
|
|
- for index, columnar := range columnarData {
|
|
|
|
- if columnar["month"] == item.CreateTime.Format(conf.SysTimeformMonth) {
|
|
|
|
- if item.Status == 4 && columnar["name"] == "rectifyed" {
|
|
|
|
- columnarData[index]["count"] = columnarData[index]["count"].(int) + 1
|
|
|
|
- }
|
|
|
|
- columnarData[index]["count"] = columnarData[index]["count"].(int) + 1
|
|
|
|
- // if item.Status == 0 && columnar["name"] == "submit" {
|
|
|
|
-
|
|
|
|
- // }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // for index, columnar := range columnarData {
|
|
|
|
+ // rectifyedCount := 0
|
|
|
|
+ // if columnar["month"] == item.CreateTime.Format(conf.SysTimeformMonth) {
|
|
|
|
+ // if item.Status == 4 && columnar["name"] == "rectifyed" {
|
|
|
|
+ // rectifyedCount++
|
|
|
|
+ // }
|
|
|
|
+ // columnarData[index]["count"] = columnarData[index]["count"].(int) + 1
|
|
|
|
+ // columnarData[index]["count"] = rectifyedCount
|
|
|
|
+ // // if item.Status == 0 && columnar["name"] == "submit" {
|
|
|
|
|
|
|
|
+ // // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ index := item.CreateTime.Format(conf.SysTimeformMonth)
|
|
|
|
+ submitData[index] = submitData[index] + 1
|
|
// if item.Status == 0 {
|
|
// if item.Status == 0 {
|
|
// submitData[item.CreateTime.Format(conf.SysTimeformMonth)] = submitData[item.CreateTime.Format(conf.SysTimeformMonth)] + 1
|
|
// submitData[item.CreateTime.Format(conf.SysTimeformMonth)] = submitData[item.CreateTime.Format(conf.SysTimeformMonth)] + 1
|
|
// }
|
|
// }
|
|
- // if item.Status == 4 {
|
|
|
|
- // rectifyedData[item.CreateTime.Format(conf.SysTimeformMonth)] = rectifyedData[item.CreateTime.Format(conf.SysTimeformMonth)] + 1
|
|
|
|
- // }
|
|
|
|
|
|
+ if item.Status == 4 {
|
|
|
|
+ rectifyedData[index] = rectifyedData[index] + 1
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for index, columnar := range columnarData {
|
|
|
|
+
|
|
|
|
+ if columnar["name"] == "rectifyed" {
|
|
|
|
+ columnarData[index]["count"] = rectifyedData[columnar["month"].(string)]
|
|
|
|
+ }
|
|
|
|
+ if columnar["name"] == "submit" {
|
|
|
|
+ columnarData[index]["count"] = submitData[columnar["month"].(string)]
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
for index, line := range lineData {
|
|
for index, line := range lineData {
|
|
@@ -264,10 +292,11 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- lineData[index]["count"] = 0.00
|
|
|
|
|
|
+ lineData[index]["percentage"] = 0.00
|
|
if rectifyedCount != 0 && submitCount != 0 {
|
|
if rectifyedCount != 0 && submitCount != 0 {
|
|
- decimal.DivisionPrecision = 0
|
|
|
|
- lineData[index]["count"] = decimal.NewFromFloat(float64(rectifyedCount)).Div(decimal.NewFromFloat(float64(submitCount)))
|
|
|
|
|
|
+ decimal.DivisionPrecision = 2
|
|
|
|
+ percentage, _ := decimal.NewFromFloat(float64(rectifyedCount)).Div(decimal.NewFromFloat(float64(submitCount))).Float64()
|
|
|
|
+ lineData[index]["percentage"] = percentage * 100
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|