Browse Source

no message

zhangchuanxing 1 month ago
parent
commit
e9952a173c
2 changed files with 90 additions and 7 deletions
  1. 36 5
      controllers/cygx/report_article.go
  2. 54 2
      models/statistic_report.go

+ 36 - 5
controllers/cygx/report_article.go

@@ -4322,9 +4322,9 @@ func initQuanyi() {
 
 }
 
-//func init() {
-//	initQuanyiXiaoShou()
-//}
+func init() {
+	initQuanyiXiaoShou()
+}
 
 func initBeizhu() {
 
@@ -4751,6 +4751,37 @@ func initQuanyiXiaoShou() {
 		return
 	}
 
+	////列表页数据
+	//tmpList3, err := models.GetIncrementalCompanyListByOperationRecordIniut3(conditionBill, parsBill, 0, 9999)
+	//if err != nil {
+	//	fmt.Println(err)
+	//	return
+	//}
+	//
+	////列表页数据
+	//tmpList4, err := models.GetIncrementalCompanyListByOperationRecordIniut4(conditionBill, parsBill, 0, 9999)
+	//if err != nil {
+	//	fmt.Println(err)
+	//	return
+	//}
+
+	//mapId := make(map[int]bool)
+	//for _, v := range tmpList3 {
+	//	mapId[v.Id] = true
+	//}
+	//
+	//for _, v := range tmpList4 {
+	//	mapId[v.Id] = true
+	//}
+
+	//for _, v := range tmpList {
+	//	if !mapId[v.Id] {
+	//		fmt.Println(v.Id)
+	//	}
+	//}
+	//
+	//return
+
 	mapOperationadd := make(map[int]int)
 	mapOperationreceive := make(map[int]int)
 
@@ -4761,9 +4792,9 @@ func initQuanyiXiaoShou() {
 		}
 
 		if v.Operation == "add" {
-			mapOperationadd[v.SellerId]++
+			mapOperationadd[v.SysUserId]++
 		} else {
-			mapOperationreceive[v.SellerId]++
+			mapOperationreceive[v.SysUserId]++
 		}
 	}
 

+ 54 - 2
models/statistic_report.go

@@ -371,6 +371,7 @@ func GetIncomeList(condition string, pars []interface{}, startSize, pageSize int
 
 // 增量客户统计报表列表数据结构
 type IncrementalList struct {
+	Id                   int                                `description:"合同id"`
 	CompanyContractId    int                                `description:"合同id"`
 	ContractType         string                             `description:"合同类型"`
 	CompanyId            int                                `description:"企业客户id"`
@@ -415,6 +416,7 @@ type IncrementalList struct {
 	SellerIdLast    int    `description:"合同到期之前最后所属销售ID"`
 	ShareSellerInit string `description:"共享销售员"`
 	Operation       string `description:"共享销售员"`
+	SysUserId       int    `description:"操作人用户id"`
 }
 
 // GetIncrementalNewCompanyCount 获取增量客户报表列表统计数据(根据合同来展示)
@@ -828,8 +830,58 @@ func GetIncrementalCompanyListByOperationRecordIniut(condition string, pars []in
 		WHERE
 			1 = 1 
 			AND c.product_id = 2 
-			AND a.create_time >= '2024-10-01' 
-			AND a.create_time <= '2024-12-31' 
+			AND a.create_time >= '2024-01-01' 
+			AND a.create_time < '2024-07-01' 
+			AND a.operation IN ( 'add', 'receive' ) 
+		GROUP BY
+			a.company_id, a.product_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetIncrementalCompanyListByOperationRecord 获取试用客户报表列表数据(根据新增客户时间来展示)
+func GetIncrementalCompanyListByOperationRecordIniut3(condition string, pars []interface{}, startSize, pageSize int) (items []*IncrementalList, err error) {
+	o := orm.NewOrm()
+
+	//查询真正的数据
+	sql := `SELECT
+			a.*,
+			b.company_name 
+		FROM
+			company_operation_record a
+			RIGHT JOIN company b ON a.company_id = b.company_id
+			JOIN company_product c ON b.company_id = c.company_id 
+			AND a.product_id = c.product_id 
+		WHERE
+			1 = 1 
+			AND c.product_id = 2 
+			AND a.create_time >= '2023-07-01' 
+			AND a.create_time <= '2023-09-30' 
+			AND a.operation IN ( 'add', 'receive' ) 
+		GROUP BY
+			a.company_id, a.product_id`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+// GetIncrementalCompanyListByOperationRecord 获取试用客户报表列表数据(根据新增客户时间来展示)
+func GetIncrementalCompanyListByOperationRecordIniut4(condition string, pars []interface{}, startSize, pageSize int) (items []*IncrementalList, err error) {
+	o := orm.NewOrm()
+
+	//查询真正的数据
+	sql := `SELECT
+			a.*,
+			b.company_name 
+		FROM
+			company_operation_record a
+			RIGHT JOIN company b ON a.company_id = b.company_id
+			JOIN company_product c ON b.company_id = c.company_id 
+			AND a.product_id = c.product_id 
+		WHERE
+			1 = 1 
+			AND c.product_id = 2 
+			AND a.create_time >= '2023-10-01' 
+			AND a.create_time <= '2023-12-31' 
 			AND a.operation IN ( 'add', 'receive' ) 
 		GROUP BY
 			a.company_id, a.product_id`