|
@@ -172,7 +172,7 @@ func (s *qualityService) GetSurvey(projectId int, bidsectionId int) map[string]i
|
|
|
year := time.Now().Year()
|
|
|
qualityList := s.daoQuality.GetTypeYear(bidsectionId, year)
|
|
|
// 2.初始化
|
|
|
- rectifylist := make([]viewmodels.SafeSurveyList, 0)
|
|
|
+ rectifylist := make([]viewmodels.QualitySurveyList, 0)
|
|
|
rectifyTotal := 0
|
|
|
approvalTotal := 0
|
|
|
rectifyedTotal := 0
|
|
@@ -193,36 +193,71 @@ func (s *qualityService) GetSurvey(projectId int, bidsectionId int) map[string]i
|
|
|
}
|
|
|
columnarData = append(columnarData, item)
|
|
|
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)
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // 3.当年数据初始化
|
|
|
+ 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 qualityList {
|
|
|
if item.Status == 2 {
|
|
|
- // id, _ := comm.AesEncrypt(item.Id, conf.SignSecret)
|
|
|
- // item.Id = id
|
|
|
- // rectifylist = append(rectifylist, item)
|
|
|
- // rectifyTotal++
|
|
|
- }
|
|
|
- if item.Status == 1 {
|
|
|
- approvalTotal++
|
|
|
+ id, _ := comm.AesEncrypt(item.Id, conf.SignSecret)
|
|
|
+ item.Id = id
|
|
|
+ rectifylist = append(rectifylist, item)
|
|
|
+ rectifyTotal++
|
|
|
}
|
|
|
+
|
|
|
+ approvalTotal++
|
|
|
if item.Status == 4 {
|
|
|
rectifyedTotal++
|
|
|
}
|
|
|
|
|
|
- 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
|
|
|
- }
|
|
|
- }
|
|
|
+ index := item.CreateTime.Format(conf.SysTimeformMonth)
|
|
|
+ submitData[index] = submitData[index] + 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)]
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -239,10 +274,11 @@ func (s *qualityService) GetSurvey(projectId int, bidsectionId int) map[string]i
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- lineData[index]["count"] = 0.00
|
|
|
+ lineData[index]["percentage"] = 0.00
|
|
|
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
|
|
|
}
|
|
|
}
|
|
|
|