| 
					
				 | 
			
			
				@@ -8,6 +8,7 @@ import ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"time"
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"github.com/kataras/iris/v12"
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	"github.com/shopspring/decimal"
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"go.mod/comm"
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"go.mod/conf"
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	"go.mod/dao"
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -165,34 +166,44 @@ func (s *qualityService) GetDetail(id int, pid int) viewmodels.QualityDetail { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return data
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 安全概况
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 质量概况
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func (s *qualityService) GetSurvey(projectId int, bidsectionId int) map[string]interface{} {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 1.获得安全巡检
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	year := time.Now().Year()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	qualityList := s.daoQuality.GetTypeYear(bidsectionId, year)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// 2.初始化
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	rectifylist := make([]models.CmQuality, 0)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	rectifylist := make([]viewmodels.SafeSurveyList, 0)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	rectifyTotal := 0
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	approvalTotal := 0
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	rectifyedTotal := 0
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	// 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,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	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),
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			"count": 0,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		columnarData = append(columnarData, item)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		item = map[string]interface{}{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			"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)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	rectifyedData := submitData
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	for _, item := range qualityList {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if item.Status == 2 {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			id, _ := comm.AesEncrypt(item.Id, conf.SignSecret)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			item.Id = id
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			rectifylist = append(rectifylist, item)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			rectifyTotal++
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -203,11 +214,35 @@ func (s *qualityService) GetSurvey(projectId int, bidsectionId int) map[string]i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			rectifyedTotal++
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if item.Status == 0 {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			submitData[item.CreateTime.Format(conf.SysTimeformMonth)] = submitData[item.CreateTime.Format(conf.SysTimeformMonth)] + 1
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for index, columnar := range columnarData {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if columnar["month"] == item.CreateTime.Format(conf.SysTimeformMonth) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if item.Status == 0 && columnar["name"] == "rectifyed" {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					columnarData[index]["count"] = columnarData[index]["count"].(int) + 1
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if item.Status == 4 && columnar["name"] == "submit" {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					columnarData[index]["count"] = columnarData[index]["count"].(int) + 1
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if item.Status == 4 {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			rectifyedData[item.CreateTime.Format(conf.SysTimeformMonth)] = rectifyedData[item.CreateTime.Format(conf.SysTimeformMonth)] + 1
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	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"] = 0.00
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if rectifyedCount != 0 && submitCount != 0 {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			decimal.DivisionPrecision = 0
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			lineData[index]["count"] = decimal.NewFromFloat(float64(rectifyedCount)).Div(decimal.NewFromFloat(float64(submitCount)))
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -217,8 +252,8 @@ func (s *qualityService) GetSurvey(projectId int, bidsectionId int) map[string]i 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		"rectifyTotal":   rectifyTotal,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		"approvalTotal":  approvalTotal,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		"rectifyedTotal": rectifyedTotal,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		"submitData":     submitData,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		"rectifyedData":  rectifyedData,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		"columnarData":   columnarData,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		"lineData":       lineData,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	return surveryData
 
			 |