xingzai 1 рік тому
батько
коміт
123768709e
2 змінених файлів з 19 додано та 14 видалено
  1. 2 2
      controllers/statistic_company_merge.go
  2. 17 12
      models/statistic_report.go

+ 2 - 2
controllers/statistic_company_merge.go

@@ -1421,7 +1421,7 @@ func (this *StatisticCompanyMergerController) CompanyContractPercentageList() {
 		expireRenewalContractMoney = int(totalMoney)
 
 		//列表页数据
-		tmpList, err := models.GetIncrementalCompanyMergeList(condition1, pars1, startSize, pageSize)
+		tmpList, err := models.GetIncrementalCompanyMergeListEnd(condition1, pars1, startSize, pageSize)
 		if err != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取失败,Err:" + err.Error()
@@ -1732,7 +1732,7 @@ func (this *StatisticCompanyMergerController) CompanyContractPercentageListV2()
 		expireRenewalContractMoney = int(totalMoney)
 
 		//列表页数据
-		tmpList, err := models.GetIncrementalCompanyMergeList(condition1, pars1, startSize, pageSize)
+		tmpList, err := models.GetIncrementalCompanyMergeListEnd(condition1, pars1, startSize, pageSize)
 		if err != nil {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取失败,Err:" + err.Error()

+ 17 - 12
models/statistic_report.go

@@ -861,7 +861,23 @@ func GetIncrementalCompanyMergeList(condition string, pars []interface{}, startS
 	if condition != "" {
 		sql += condition
 	}
-	sql += ` group by a.company_contract_id  order by start_date desc,company_id desc limit ?,?`
+	sql += ` group by a.company_contract_id  order by a.start_date desc,a.company_id desc limit ?,?`
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// GetIncrementalNewCompanyList 获取到期合同列表数据(根据合同来展示)
+func GetIncrementalCompanyMergeListEnd(condition string, pars []interface{}, startSize, pageSize int) (items []*IncrementalList, err error) {
+	o := orm.NewOrm()
+
+	sql := `SELECT a.*,b.region_type,c.seller_id,c.seller_name,b.company_name,c.renewal_reason FROM company_contract a
+		 JOIN company b ON a.company_id = b.company_id
+		 JOIN company_product c ON a.company_id = c.company_id and a.product_id=c.product_id WHERE 1 = 1 `
+
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` group by a.company_contract_id  order by a.end_date desc,a.company_id desc limit ?,?`
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }
@@ -870,17 +886,6 @@ func GetIncrementalCompanyMergeList(condition string, pars []interface{}, startS
 func GetIncrementalCompanyListByOperationRecordMerge(condition string, pars []interface{}, startSize, pageSize int) (items []*IncrementalList, err error) {
 	o := orm.NewOrm()
 
-	////查询出最大id
-	//sql1 := `SELECT max(id) id 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 `
-	//if condition != "" {
-	//	sql1 += condition
-	//}
-	//sql1 += ` GROUP BY a.company_id, a.product_id `
-
 	//查询真正的数据
 	sql := `SELECT a.company_contract_id,a.contract_type ,a.company_product_id ,a.contract_code ,a.pay_method ,a.pay_channel ,a.package_difference ,a.company_id, a.start_date, a.end_date, a.money, b.company_name, c.seller_id, c.seller_name, a.product_id, a.product_name, a.create_time, b.region_type, c.renewal_reason, c.renewal_todo, c.status FROM company_contract a
 		RIGHT JOIN company b ON a.company_id = b.company_id