|
@@ -177,24 +177,27 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
|
approvalTotal := 0
|
|
|
rectifyedTotal := 0
|
|
|
|
|
|
- // data:=map[string]string{
|
|
|
-
|
|
|
- // }
|
|
|
-
|
|
|
columnarData := make([]map[string]interface{}, 0)
|
|
|
+ lineData := columnarData
|
|
|
for i := 1; i <= 12; i++ {
|
|
|
item := map[string]interface{}{
|
|
|
- "name": "rectifyed",
|
|
|
- "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
- "rectifyedCount": 0,
|
|
|
+ "name": "rectifyed",
|
|
|
+ "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
+ "count": 0,
|
|
|
}
|
|
|
columnarData = append(columnarData, item)
|
|
|
item = map[string]interface{}{
|
|
|
- "name": "submit",
|
|
|
- "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
- "submitCount": 0,
|
|
|
+ "name": "submit",
|
|
|
+ "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
+ "count": 0,
|
|
|
}
|
|
|
columnarData = append(columnarData, item)
|
|
|
+ item = map[string]interface{}{
|
|
|
+ "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
+ "count": "0",
|
|
|
+ }
|
|
|
+ lineData = append(lineData, item)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 3.当年数据初始化
|
|
@@ -230,10 +233,10 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
|
for index, columnar := range columnarData {
|
|
|
if columnar["month"] == item.CreateTime.Format(conf.SysTimeformMonth) {
|
|
|
if item.Status == 0 && columnar["name"] == "rectifyed" {
|
|
|
- columnarData[index]["rectifyedCount"] = columnarData[index]["rectifyedCount"].(int) + 1
|
|
|
+ columnarData[index]["count"] = columnarData[index]["count"].(int) + 1
|
|
|
}
|
|
|
if item.Status == 4 && columnar["name"] == "submit" {
|
|
|
- columnarData[index]["submitCount"] = columnarData[index]["submitCount"].(int) + 1
|
|
|
+ columnarData[index]["count"] = columnarData[index]["count"].(int) + 1
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -246,6 +249,23 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
+ for index, line := range lineData {
|
|
|
+ rectifyedCount := 0
|
|
|
+ submitCount := 0
|
|
|
+ for _, columnar := range columnarData {
|
|
|
+ if line["month"] == columnar["month"] {
|
|
|
+ if columnar["name"] == "rectifyed" {
|
|
|
+ rectifyedCount = columnar["count"].(int)
|
|
|
+ }
|
|
|
+ if columnar["name"] == "submit" {
|
|
|
+ submitCount = columnar["count"].(int)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ lineData[index]["count"] = rectifyedCount / submitCount
|
|
|
+ }
|
|
|
+
|
|
|
// 整改占总数比例 - 完成整改/提交巡检
|
|
|
surveryData := map[string]interface{}{
|
|
|
"rectifylist": rectifylist,
|