Browse Source

feature(首页统计):首页统计修改

ZZH-wl 1 year ago
parent
commit
9e1e7c7869
2 changed files with 9 additions and 3 deletions
  1. 3 1
      opms_parent/app/service/home/home.go
  2. 6 2
      opms_parent/app/service/home/report.go

+ 3 - 1
opms_parent/app/service/home/home.go

@@ -227,7 +227,9 @@ func (s *HomeService) getNumStatisticsData(id int64, params *map[string]interfac
 		if err != nil {
 			return "", err
 		}
-		count1, err := contractDao.As("a").DataScope(s.Ctx, "incharge_id").InnerJoin("ctr_contract_invoice b", "a.id=b.contract_id").Where("b.invoice_date>=? AND b.invoice_date<=? AND b.appro_status='30'", yearStart, yearEnd).
+		count1, err := contractDao.As("a").DataScope(s.Ctx, "incharge_id").InnerJoin("ctr_contract_invoice b", "a.id=b.contract_id").
+			Where("b.invoice_date>=? AND b.invoice_date<=? AND b.appro_status='30'", yearStart, yearEnd).
+			Where("a.contract_sign_time>=? AND a.contract_sign_time<=? ", yearStart, yearEnd).
 			Sum("b.invoice_amount")
 		if err != nil {
 			return "", err

+ 6 - 2
opms_parent/app/service/home/report.go

@@ -186,7 +186,8 @@ func getCompanyContractReportData(ctx context.Context, dataType string, params *
 	}
 
 	// 统计目标值和实际值
-	for index, target := range targets {
+	var index int
+	for _, target := range targets {
 		// 过滤掉已删除的销售
 		if !normalUserMap[target["sale_user_id"].Int()] {
 			continue
@@ -203,6 +204,7 @@ func getCompanyContractReportData(ctx context.Context, dataType string, params *
 		} else {
 			reportData.PercentData = append(reportData.PercentData, reportData.YDataReal[index]*100/reportData.YDataTarget[index])
 		}
+		index++
 	}
 
 	return &reportData, nil
@@ -331,7 +333,8 @@ func getClockfrequency(ctx context.Context, dataType string, params *map[string]
 	}
 
 	// 赋值实际值
-	for index, target := range platpunchrecords {
+	var index int
+	for _, target := range platpunchrecords {
 		// 过滤掉已删除的销售
 		if !normalUserMap[target["user_id"].Int()] {
 			continue
@@ -348,6 +351,7 @@ func getClockfrequency(ctx context.Context, dataType string, params *map[string]
 		} else {
 			reportData.PercentData = append(reportData.PercentData, reportData.YDataReal[index]*100/reportData.YDataTarget[index])
 		}
+		index++
 	}
 	return &reportData, nil
 }