|
@@ -176,22 +176,43 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
|
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,
|
|
|
+
|
|
|
+ // data:=map[string]string{
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
+ columnarData := make([]map[string]interface{}, 0)
|
|
|
+ for i := 1; i <= 12; i++ {
|
|
|
+ item := map[string]interface{}{
|
|
|
+ "name": "rectifyed",
|
|
|
+ "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
+ "rectifyedCount": 0,
|
|
|
+ }
|
|
|
+ columnarData = append(columnarData, item)
|
|
|
+ item = map[string]interface{}{
|
|
|
+ "name": "submit",
|
|
|
+ "month": fmt.Sprintf("%d-%02d", year, i),
|
|
|
+ "submitCount": 0,
|
|
|
+ }
|
|
|
+ columnarData = append(columnarData, item)
|
|
|
}
|
|
|
- rectifyedData := submitData
|
|
|
+
|
|
|
+ // 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
|
|
|
for _, item := range safeList {
|
|
|
if item.Status == 2 {
|
|
|
rectifylist = append(rectifylist, item)
|
|
@@ -204,12 +225,23 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
|
rectifyedTotal++
|
|
|
}
|
|
|
|
|
|
- if item.Status == 0 {
|
|
|
- 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
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ if item.Status == 4 && columnar["name"] == "submit" {
|
|
|
+ columnarData[index]["submitCount"] = columnarData[index]["submitCount"].(int) + 1
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ // if item.Status == 0 {
|
|
|
+ // 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
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
// 整改占总数比例 - 完成整改/提交巡检
|
|
@@ -218,8 +250,9 @@ func (s *safeService) GetSurvey(projectId int, bidsectionId int) map[string]inte
|
|
|
"rectifyTotal": rectifyTotal,
|
|
|
"approvalTotal": approvalTotal,
|
|
|
"rectifyedTotal": rectifyedTotal,
|
|
|
- "submitData": submitData,
|
|
|
- "rectifyedData": rectifyedData,
|
|
|
+ "columnarData": columnarData,
|
|
|
+ // "submitData": submitData,
|
|
|
+ // "rectifyedData": rectifyedData,
|
|
|
}
|
|
|
|
|
|
return surveryData
|