Browse Source

Merge branch 'crm/13.9' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 1 year ago
parent
commit
7c6467e904

+ 43 - 3
controllers/statistic_report.go

@@ -2255,6 +2255,14 @@ func StackCompanyListExport(this *StatisticReportController, dataType string, re
 		cellDay := titleRow.AddCell()
 		cellDay.SetStyle(style)
 		cellDay.SetValue("超出过期天数")
+
+		cellAscribeContent := titleRow.AddCell()
+		cellAscribeContent.SetStyle(style)
+		cellAscribeContent.SetValue("不续约归因")
+
+		cellContent := titleRow.AddCell()
+		cellContent.SetStyle(style)
+		cellContent.SetValue("详细原因")
 	default:
 		cellTime := titleRow.AddCell()
 		cellTime.SetStyle(style)
@@ -2300,6 +2308,18 @@ func StackCompanyListExport(this *StatisticReportController, dataType string, re
 		cellDay := dataRow.AddCell()
 		cellDay.SetStyle(style)
 		cellDay.SetValue(v.ExpireDay)
+
+		switch dataType {
+		case "未续约客户":
+			cellAscribeContent := dataRow.AddCell()
+			cellAscribeContent.SetStyle(style)
+			cellAscribeContent.SetValue(v.AscribeContent)
+
+			cellContent := dataRow.AddCell()
+			cellContent.SetStyle(style)
+			cellContent.SetValue(v.Content)
+		}
+
 	}
 	err = xlsxFile.Save(downLoadnFilePath)
 	if err != nil {
@@ -2557,7 +2577,7 @@ func getHistoryStackCompanyList(sysUser *system.Admin, currentIndex, pageSize, i
 			ascribecompanyIds = append(ascribecompanyIds, item.CompanyId)
 		}
 		//归因标签
-		mapGetCompanyAscribeContent := services.GetCompanyAscribeContentMap(ascribecompanyIds)
+		mapGetCompanyAscribeContent, mapContent := services.GetCompanyAscribeContentMap(ascribecompanyIds)
 		mapNoRenewedNote := services.GetCompanyNoRenewedNoteMap(ascribecompanyIds)
 		if len(ids) > 0 {
 			idStr := strings.Join(ids, ",")
@@ -2592,6 +2612,7 @@ func getHistoryStackCompanyList(sysUser *system.Admin, currentIndex, pageSize, i
 					}
 				}
 				item.AscribeContent = mapGetCompanyAscribeContent[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
+				item.Content = mapContent[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
 				item.IsShowNoRenewedNote = mapNoRenewedNote[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
 			}
 		}
@@ -3216,10 +3237,11 @@ func getTodayStackCompanyListV2(sysUser *system.Admin, currentIndex, pageSize, i
 		ascribecompanyIds = append(ascribecompanyIds, item.CompanyId)
 	}
 	//归因标签
-	mapGetCompanyAscribeContent := services.GetCompanyAscribeContentMap(ascribecompanyIds)
+	mapGetCompanyAscribeContent, mapContent := services.GetCompanyAscribeContentMap(ascribecompanyIds)
 	mapNoRenewedNote := services.GetCompanyNoRenewedNoteMap(ascribecompanyIds)
 	for _, item := range list {
 		item.AscribeContent = mapGetCompanyAscribeContent[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
+		item.Content = mapContent[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
 		item.IsShowNoRenewedNote = mapNoRenewedNote[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
 	}
 
@@ -3268,6 +3290,7 @@ func getTodayStackCompanyListV2(sysUser *system.Admin, currentIndex, pageSize, i
 			PackageDifference:   v.PackageDifference,
 			AscribeContent:      v.AscribeContent,
 			IsShowNoRenewedNote: v.IsShowNoRenewedNote,
+			Content:             v.Content,
 		}
 		stackCompanyStatisticList = append(stackCompanyStatisticList, &stackCompanyStatistic)
 	}
@@ -3745,11 +3768,12 @@ func (this *StatisticReportController) IncrementalCompanyList() {
 				ascribecompanyIds = append(ascribecompanyIds, item.CompanyId)
 			}
 			//归因标签
-			mapGetCompanyAscribeContent := services.GetCompanyAscribeContentMap(ascribecompanyIds)
+			mapGetCompanyAscribeContent, mapContent := services.GetCompanyAscribeContentMap(ascribecompanyIds)
 			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.IsShowNoRenewedNote = mapNoRenewedNote[fmt.Sprint("CID_", item.CompanyId, "PID_", item.ProductId)]
 			}
 			list = tmpList
@@ -3978,6 +4002,14 @@ func IncrementalCompanyListExport(this *StatisticReportController, dataType stri
 		cellTime.SetValue("续约时间")
 	case "未续约客户":
 		cellTime.SetValue("最近合同到期时间")
+
+		cellAscribeContent := titleRow.AddCell()
+		cellAscribeContent.SetStyle(style)
+		cellAscribeContent.SetValue("不续约归因")
+
+		cellContent := titleRow.AddCell()
+		cellContent.SetStyle(style)
+		cellContent.SetValue("详细原因")
 	}
 
 	for _, v := range resp.List {
@@ -4018,6 +4050,14 @@ func IncrementalCompanyListExport(this *StatisticReportController, dataType stri
 			cellDataTime.SetValue(v.StartDate)
 		case "未续约客户":
 			cellDataTime.SetValue(v.EndDate)
+
+			cellAscribeContent := dataRow.AddCell()
+			cellAscribeContent.SetStyle(style)
+			cellAscribeContent.SetValue(v.AscribeContent)
+
+			cellContent := dataRow.AddCell()
+			cellContent.SetStyle(style)
+			cellContent.SetValue(v.Content)
 		}
 
 	}

+ 1 - 0
models/stack_company_statistic.go

@@ -105,6 +105,7 @@ type StackCompanyStatisticList struct {
 	PackageDifference   string    `description:"和上一份合同的区别"`
 	AscribeContent      string    `description:"归因标签说明"`
 	IsShowNoRenewedNote bool      `description:"是否展示未续约备注按钮"`
+	Content             string    `description:"归因内容说明"`
 }
 
 func GetStackCompanyList(condition, orderBy string, pars []interface{}, startSize, pageSize int) (items []*StackCompanyStatisticList, err error) {

+ 1 - 0
models/statistic_report.go

@@ -399,6 +399,7 @@ type IncrementalList struct {
 	PackageDifference   string                             `description:"和上一份合同的区别"`
 	AscribeContent      string                             `description:"归因标签说明"`
 	IsShowNoRenewedNote bool                               `description:"是否展示未续约备注按钮"`
+	Content             string                             `description:"归因内容说明"`
 }
 
 // GetIncrementalNewCompanyCount 获取增量客户报表列表统计数据(根据合同来展示)

+ 3 - 1
services/company_ascribe.go

@@ -9,7 +9,7 @@ import (
 )
 
 // 处理公司归因展示
-func GetCompanyAscribeContentMap(companyIds []int) (mapResp map[string]string) {
+func GetCompanyAscribeContentMap(companyIds []int) (mapResp map[string]string, mapCountResp map[string]string) {
 	var err error
 	defer func() {
 		if err != nil {
@@ -31,8 +31,10 @@ func GetCompanyAscribeContentMap(companyIds []int) (mapResp map[string]string) {
 		return
 	}
 	mapResp = make(map[string]string, 0)
+	mapCountResp = make(map[string]string, 0)
 	for _, v := range list {
 		mapResp[fmt.Sprint("CID_", v.CompanyId, "PID_", v.ProductId)] = v.AscribeContent
+		mapCountResp[fmt.Sprint("CID_", v.CompanyId, "PID_", v.ProductId)] = v.Content
 	}
 	return
 }