|
@@ -77,11 +77,7 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
|
|
|
if dataType != "续约客户" {
|
|
|
packageDifference = "" // 只有续约客户才会有值,过滤前端传过来的脏数据
|
|
|
}
|
|
|
- //if startDate == "" || endDate == "" {
|
|
|
- // br.Msg = "获取失败,开始日期或结束日期未传"
|
|
|
- // br.ErrMsg = "获取失败,开始日期或结束日期未传"
|
|
|
- // return
|
|
|
- //}
|
|
|
+
|
|
|
if startDate == "" {
|
|
|
startDate = "2015-01-01"
|
|
|
}
|
|
@@ -166,7 +162,6 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
|
|
|
}
|
|
|
parsAscribeRai = append(parsAscribeRai, noRenewedcompanyContractIds)
|
|
|
}
|
|
|
- fmt.Println(noRenewedcompanyContractIds)
|
|
|
//归因ID CRM 13.9
|
|
|
if companyAscribeId > 0 {
|
|
|
var conditionAscribe string
|
|
@@ -189,8 +184,6 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
|
|
|
}
|
|
|
conditionAscribRai += ` AND a.company_contract_id IN (` + utils.GetOrmInReplace(len(noRenewedcompanyContractIds)) + `)`
|
|
|
parsAscribeRai = append(parsAscribeRai, noRenewedcompanyContractIds)
|
|
|
-
|
|
|
- fmt.Println(parsAscribeRai)
|
|
|
}
|
|
|
|
|
|
condition += ` AND c.product_id = ? AND a.status = 1 `
|
|
@@ -292,15 +285,6 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
|
|
|
condition1 := condition
|
|
|
pars1 := pars
|
|
|
|
|
|
- //endDateTime, err := time.Parse(utils.FormatDate, endDate)
|
|
|
- //if err != nil {
|
|
|
- // br.Msg = "结束时间异常"
|
|
|
- // br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
- ////选择的日期加一天的原因是因为:筛选条件是截止到时分秒的,如果要把选择的这一天也统计进去,那么需要在选择的结束日期基础上加上一天
|
|
|
- //tryOutEndDate := endDateTime.AddDate(0, 0, 1).Format(utils.FormatDate)
|
|
|
-
|
|
|
condition1 += ` AND a.end_date >= ? AND a.end_date <= ? `
|
|
|
pars1 = append(pars1, startDate, endDate)
|
|
|
//condition1 += ` AND a.operation = ? `
|
|
@@ -370,13 +354,6 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
|
|
|
total = notRenewalNotTryOut
|
|
|
}
|
|
|
|
|
|
- //total, err := models.GetIncrementalCompanyProductCountByOperationRecord(condition1, pars1)
|
|
|
- //if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- // br.Msg = "获取失败"
|
|
|
- // br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
-
|
|
|
//分页total单独计算
|
|
|
total, err = company.GetIncrementalRenewalCompanyProductMergeCount(condition1, pars1)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
@@ -394,18 +371,20 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
|
|
|
}
|
|
|
|
|
|
var ascribecompanyIds []int
|
|
|
+ var companyContractIds []int
|
|
|
for _, item := range tmpList {
|
|
|
//endDateTime, _ := time.Parse(utils.FormatDateTime, item.CreateTime)
|
|
|
//item.EndDate = endDateTime.Format(utils.FormatDate)
|
|
|
ascribecompanyIds = append(ascribecompanyIds, item.CompanyId)
|
|
|
+ companyContractIds = append(companyContractIds, item.CompanyContractId)
|
|
|
}
|
|
|
- //归因标签
|
|
|
- mapGetCompanyAscribeContent, mapContent := services.GetCompanyAscribeContentMap(ascribecompanyIds)
|
|
|
+ //合同归因标签
|
|
|
+ mapGetCompanyAscribeContent, mapContent := services.GetCompanyContractAscribeContentMap(companyContractIds)
|
|
|
mapNoRenewedNote := services.GetCompanyNoRenewedNoteMap(ascribecompanyIds)
|
|
|
|
|
|
for _, item := range tmpList {
|
|
|
- item.AscribeContent = mapGetCompanyAscribeContent[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
|
|
|
- item.Content = mapContent[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
|
|
|
+ item.AscribeContent = mapGetCompanyAscribeContent[item.CompanyContractId]
|
|
|
+ item.Content = mapContent[item.CompanyContractId]
|
|
|
item.IsShowNoRenewedNote = mapNoRenewedNote[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
|
|
|
}
|
|
|
|