|
@@ -2,6 +2,7 @@ package statistic
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hz_crm_api/controllers"
|
|
|
"hongze/hz_crm_api/models"
|
|
|
"hongze/hz_crm_api/models/company"
|
|
@@ -342,6 +343,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
// @Param SellerId query int true "销售ID"
|
|
|
// @Param DataType query string false "报表类型,枚举值:`季度`,`年度`,`半年度`"
|
|
|
// @Param PopupType query string false "弹窗数据类型,枚举值:"
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Success 200 {object} statistic_report.RaiDataSummaryPopupTypeResp
|
|
|
// @router /rai_data_summary/detail [get]
|
|
|
func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
@@ -358,10 +361,21 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
dataType := this.GetString("DataType")
|
|
|
- sellerId := this.GetString("SellerId")
|
|
|
+ sellerId, _ := this.GetInt("SellerId")
|
|
|
popupType := this.GetString("PopupType")
|
|
|
+
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
var startDate string
|
|
|
var endDate string
|
|
|
year := (dataType[:4])
|
|
@@ -390,13 +404,28 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
fmt.Println(startDate)
|
|
|
fmt.Println(endDate)
|
|
|
resp := new(statistic_report.RaiDataSummaryPopupTypeResp)
|
|
|
+ var trialTotal int
|
|
|
switch popupType {
|
|
|
case "新增试用":
|
|
|
- conditionTry := ` AND a.sys_user_id = ? AND a.create_time >= ? AND a.create_time <= ? AND a.operation in ( "add","receive","apply_receive" ) AND a.sys_user_id IN ( SELECT admin_id FROM admin WHERE role_type_code IN ( 'rai_seller', 'rai_group' , 'rai_admin') ) `
|
|
|
var parsTry []interface{}
|
|
|
- parsTry = append(parsTry, sellerId, startDate, endDate)
|
|
|
+ var conditionTry string
|
|
|
+ if sellerId > 0 {
|
|
|
+ conditionTry += ` AND a.sys_user_id = ? `
|
|
|
+ parsTry = append(parsTry, sellerId)
|
|
|
+ }
|
|
|
+ conditionTry += ` AND a.create_time >= ? AND a.create_time <= ? AND a.operation in ( "add","receive","apply_receive" ) AND a.sys_user_id IN ( SELECT admin_id FROM admin WHERE role_type_code IN ( 'rai_seller', 'rai_group' , 'rai_admin') ) `
|
|
|
+
|
|
|
+ parsTry = append(parsTry, startDate, endDate)
|
|
|
+ total, err := models.GetIncrementalCompanyCountByOperationRecordRai(conditionTry, parsTry)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取新增试用客户数量失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ trialTotal = total
|
|
|
+
|
|
|
//列表页数据
|
|
|
- tryList, err := models.GetIncrementalCompanyListByOperationRecordRai(conditionTry, parsTry, 0, 9999)
|
|
|
+ tryList, err := models.GetIncrementalCompanyListByOperationRecordRai(conditionTry, parsTry, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
@@ -416,7 +445,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
resp.AddTrialItem.List = make([]*models.IncrementalList, 0)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, trialTotal)
|
|
|
+ resp.Paging = page
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|