|
@@ -742,7 +742,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
dataType := this.GetString("DataType")
|
|
|
- sellerId, _ := this.GetInt("SellerId")
|
|
|
+ sellerId := this.GetString("SellerId")
|
|
|
popupType := this.GetString("PopupType")
|
|
|
|
|
|
var startSize int
|
|
@@ -791,9 +791,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
case "新增试用":
|
|
|
var parsTry []interface{}
|
|
|
var conditionTry string
|
|
|
- if sellerId > 0 {
|
|
|
- conditionTry += ` AND a.sys_user_id = ? `
|
|
|
- parsTry = append(parsTry, sellerId)
|
|
|
+ if sellerId != "" {
|
|
|
+ conditionTry += ` AND a.sys_user_id IN (` + 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') ) `
|
|
|
|
|
@@ -830,9 +829,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
case "新签合同":
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.seller_id_init = ? `
|
|
|
- pars = append(pars, sellerId)
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.seller_id_init IN (` + sellerId + `) `
|
|
|
}
|
|
|
|
|
|
condition += ` AND a.status = 1 AND a.start_date >= ? AND a.start_date <= ? `
|
|
@@ -889,8 +887,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
case "到期合同":
|
|
|
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.seller_id_last = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
}
|
|
|
|
|
@@ -943,8 +941,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
case "续约合同":
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.seller_id_last = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
}
|
|
|
|
|
@@ -999,12 +997,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
case "续约率":
|
|
|
var conditionEnd string
|
|
|
var parsEnd []interface{}
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.seller_id_last = ? `
|
|
|
- pars = append(pars, sellerId)
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
|
|
|
- conditionEnd += ` AND a.seller_id_last = ? `
|
|
|
- parsEnd = append(parsEnd, sellerId)
|
|
|
+ conditionEnd += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
}
|
|
|
|
|
|
condition += ` AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND inherit_company_contract_id > 0 `
|
|
@@ -1015,7 +1011,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
br.ErrMsg = "获取数据信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- fmt.Println("listRaiData", len(listRaiData))
|
|
|
+ //fmt.Println("listRaiData", len(listRaiData))
|
|
|
|
|
|
//到期合同数据
|
|
|
conditionEnd += ` AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? AND a.end_date < ? `
|
|
@@ -1087,9 +1083,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
noRenewedcompanyContractIds := services.GetCompanyContractNoRenewedAscribeListArr()
|
|
|
condition += ` AND a.company_contract_id IN (` + utils.GetOrmInReplace(len(noRenewedcompanyContractIds)) + `) ` // 已确认
|
|
|
pars = append(pars, noRenewedcompanyContractIds)
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.seller_id_last = ? `
|
|
|
- pars = append(pars, sellerId)
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
}
|
|
|
condition += ` AND a.product_id = 2 AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? AND a.end_date <= ? `
|
|
|
pars = append(pars, startDate, endDate, time.Now().Format(utils.FormatDate))
|
|
@@ -1145,11 +1140,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
noRenewedcompanyContractIdsMap := services.GetCompanyContractNoRenewedAscribeListMap()
|
|
|
var conditionEnd string
|
|
|
var parsEnd []interface{}
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.seller_id_last = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
|
|
|
- conditionEnd += ` AND a.seller_id_last = ? `
|
|
|
+ conditionEnd += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
parsEnd = append(parsEnd, sellerId)
|
|
|
}
|
|
|
|
|
@@ -1223,12 +1218,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
case "签约客户数量":
|
|
|
var conditionInherit string
|
|
|
var parsInherit []interface{}
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.seller_id_last = ? `
|
|
|
- pars = append(pars, sellerId)
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
|
|
|
- conditionInherit += ` AND a.seller_id_last = ? `
|
|
|
- parsInherit = append(parsInherit, sellerId)
|
|
|
+ conditionInherit += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
}
|
|
|
condition += " AND a.product_id = 2 AND a.status = 1 AND a.start_date >= ? AND a.start_date <= ? "
|
|
|
pars = append(pars, startDate, endDate)
|
|
@@ -1290,8 +1283,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
listResp = append(listResp, item)
|
|
|
|
|
|
case "客单价":
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.seller_id_last = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
}
|
|
|
condition += " AND a.product_id = 2 AND a.status = 1 AND a.start_date >= ? AND a.start_date <= ? "
|
|
@@ -1320,8 +1313,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
listResp = append(listResp, item)
|
|
|
|
|
|
case "开票金额":
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.rai_seller_id = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
}
|
|
|
condition += " AND a.is_deleted = 0 AND a.start_date >= ? AND a.start_date <= ? AND invoiced_amount > 0 AND product_ids LIKE '%2%' "
|
|
@@ -1366,8 +1359,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
case "到款金额":
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.rai_seller_id = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
}
|
|
|
condition += " AND a.is_deleted = 0 AND a.start_date >= ? AND a.start_date <= ? AND payment_amount > 0 AND product_ids LIKE '%2%' "
|
|
@@ -1413,8 +1406,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
case "未到款比例":
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.rai_seller_id = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
}
|
|
|
condition += " AND a.is_deleted = 0 AND a.start_date >= ? AND a.start_date <= ? AND product_ids LIKE '%2%' "
|
|
@@ -1436,8 +1429,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
case "新客开票":
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.rai_seller_id = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
}
|
|
|
condition += " AND a.is_deleted = 0 AND contract_type = 1 AND a.start_date >= ? AND a.start_date <= ? AND product_ids LIKE '%2%' "
|
|
@@ -1482,8 +1475,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
case "新客到款":
|
|
|
- if sellerId > 0 {
|
|
|
- condition += ` AND a.rai_seller_id = ? `
|
|
|
+ if sellerId != "" {
|
|
|
+ condition += ` AND a.rai_seller_id IN (` + sellerId + `) `
|
|
|
pars = append(pars, sellerId)
|
|
|
}
|
|
|
condition += " AND a.is_deleted = 0 AND contract_type = 1 AND a.start_date >= ? AND a.start_date <= ? AND payment_amount > 0 AND product_ids LIKE '%2%' "
|