|
@@ -158,17 +158,17 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
br.ErrMsg = "获取数据信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- var companyIds []int
|
|
|
+ var companyContractIds []int
|
|
|
for _, v := range listRaiData {
|
|
|
- companyIds = append(companyIds, v.CompanyId)
|
|
|
+ companyContractIds = append(companyContractIds, v.CompanyId)
|
|
|
}
|
|
|
- companyIds = append(companyIds, 0)
|
|
|
+ companyContractIds = append(companyContractIds, 0)
|
|
|
|
|
|
//续约部分的数据
|
|
|
var conditionInherit string
|
|
|
var parsInherit []interface{}
|
|
|
- conditionInherit = ` AND a.product_id = 2 AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.rai_contract_type = '续约合同' AND a.company_id NOT IN (` + utils.GetOrmInReplace(len(companyIds)) + `) `
|
|
|
- parsInherit = append(parsInherit, startDate, endDate, companyIds)
|
|
|
+ conditionInherit = ` AND a.product_id = 2 AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.rai_contract_type = '续约合同' AND a.company_contract_id NOT IN (` + utils.GetOrmInReplace(len(companyContractIds)) + `) `
|
|
|
+ parsInherit = append(parsInherit, startDate, endDate, companyContractIds)
|
|
|
listInheritData, err := statistic_report.GetRaiDataSummaryInheritList(conditionInherit, parsInherit)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据信息失败"
|
|
@@ -905,15 +905,16 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
|
|
|
- //新签合同的客户ID
|
|
|
- var companyIdsNew []int
|
|
|
+ //新签合同的ID
|
|
|
+ var companyContractIdsNew []int
|
|
|
{
|
|
|
var conditionNew string
|
|
|
var parsNew []interface{}
|
|
|
+ fmt.Println("sellerId", sellerId)
|
|
|
if sellerId != "" {
|
|
|
- conditionNew += ` AND a.sys_user_id IN (` + sellerId + `) `
|
|
|
+ conditionNew += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
}
|
|
|
- conditionNew = " AND a.product_id = 2 AND a.status = 1 AND a.start_date >= ? AND a.start_date <= ? AND a.rai_contract_type = '新签合同' "
|
|
|
+ conditionNew += " AND a.product_id = 2 AND a.status = 1 AND a.start_date >= ? AND a.start_date <= ? AND a.rai_contract_type = '新签合同' "
|
|
|
parsNew = append(parsNew, startDate, endDate)
|
|
|
listNewData, err := statistic_report.GetRaiDataSummaryList(conditionNew, parsNew)
|
|
|
if err != nil {
|
|
@@ -922,11 +923,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
return
|
|
|
}
|
|
|
for _, v := range listNewData {
|
|
|
- companyIdsNew = append(companyIdsNew, v.CompanyId)
|
|
|
+ companyContractIdsNew = append(companyContractIdsNew, v.CompanyId)
|
|
|
}
|
|
|
}
|
|
|
- companyIdsNew = append(companyIdsNew, 0)
|
|
|
- lenArrCompany := len(companyIdsNew)
|
|
|
+ companyContractIdsNew = append(companyContractIdsNew, 0)
|
|
|
+ lenArrCompany := len(companyContractIdsNew)
|
|
|
|
|
|
switch popupType {
|
|
|
case "新增试用":
|
|
@@ -1096,9 +1097,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- condition += ` AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.inherit_company_contract_id > 0 AND a.rai_contract_type = '续约合同' AND a.company_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
|
- pars = append(pars, startDate, endDate, companyIdsNew)
|
|
|
+ condition += ` AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.inherit_company_contract_id > 0 AND a.rai_contract_type = '续约合同' AND a.company_contract_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
|
+ pars = append(pars, startDate, endDate, companyContractIdsNew)
|
|
|
|
|
|
total, err := company.GetIncrementalNewCompanyProductMergeCount(condition, pars)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -1155,8 +1155,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
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 AND a.rai_contract_type = '续约合同' AND a.company_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
|
- pars = append(pars, startDate, endDate, companyIdsNew)
|
|
|
+ condition += ` AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND inherit_company_contract_id > 0 AND a.rai_contract_type = '续约合同' AND a.company_contract_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
|
+ pars = append(pars, startDate, endDate, companyContractIdsNew)
|
|
|
listRaiData, err := statistic_report.GetRaiDataSummaryList(condition, pars)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据信息失败"
|
|
@@ -1387,8 +1387,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
//续约部分的数据
|
|
|
- conditionInherit += ` AND a.product_id = 2 AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.inherit_company_contract_id > 0 AND a.rai_contract_type = '续约合同' AND a.company_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
|
- parsInherit = append(parsInherit, startDate, endDate, companyIdsNew)
|
|
|
+ conditionInherit += ` AND a.product_id = 2 AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.inherit_company_contract_id > 0 AND a.rai_contract_type = '续约合同' AND a.company_contract_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
|
+ parsInherit = append(parsInherit, startDate, endDate, companyContractIdsNew)
|
|
|
listInheritData, err := statistic_report.GetRaiDataSummaryInheritList(conditionInherit, parsInherit)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据信息失败"
|
|
@@ -1467,8 +1467,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
mapCompany[v.CompanyId] = true
|
|
|
}
|
|
|
}
|
|
|
- conditionInherit += ` AND a.product_id = 2 AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.rai_contract_type = '续约合同' AND a.company_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
|
- parsInherit = append(parsInherit, startDate, endDate, companyIdsNew)
|
|
|
+ conditionInherit += ` AND a.product_id = 2 AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.rai_contract_type = '续约合同' AND a.company_contract_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
|
+ parsInherit = append(parsInherit, startDate, endDate, companyContractIdsNew)
|
|
|
listInheritData, err := statistic_report.GetRaiDataSummaryInheritList(conditionInherit, parsInherit)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取数据信息失败"
|