|
@@ -11,8 +11,6 @@ import (
|
|
|
cygxService "hongze/hz_crm_api/services/cygx"
|
|
|
"os"
|
|
|
"path/filepath"
|
|
|
- "strings"
|
|
|
-
|
|
|
//"hongze/hz_crm_api/services"
|
|
|
"hongze/hz_crm_api/utils"
|
|
|
//"strings"
|
|
@@ -538,57 +536,57 @@ func MergeCompanyListListExport(this *StatisticCompanyMergerController, dataType
|
|
|
cellSellerName.SetStyle(style)
|
|
|
cellSellerName.SetValue("所属销售")
|
|
|
|
|
|
- permissionMap := make(map[int][]string)
|
|
|
- tmpPermissionMap := make(map[int]map[string][]string)
|
|
|
- companyContractIdList := make([]string, 0)
|
|
|
- for _, v := range resp.List {
|
|
|
- companyContractIdList = append(companyContractIdList, fmt.Sprint(v.CompanyContractId))
|
|
|
- }
|
|
|
- if dataType == "新签客户" || dataType == "续约客户" {
|
|
|
- cellMoney := titleRow.AddCell()
|
|
|
- cellMoney.SetStyle(style)
|
|
|
- cellMoney.SetValue("合同金额")
|
|
|
-
|
|
|
- //这么大费周章的目的是为了:权益的品种存在主观、客观的区分,如果一个品种既存在主观,又存在客观,那么就展示品种名称,否则就要列出品种名称+主、客观类型
|
|
|
- if len(companyContractIdList) > 0 {
|
|
|
- list, tmpErr := company.GetCompanyContractPermissionListByContractIds(strings.Join(companyContractIdList, ","))
|
|
|
- if tmpErr != nil {
|
|
|
- err = tmpErr
|
|
|
- return
|
|
|
- }
|
|
|
- for _, v := range list {
|
|
|
- tmpPermissionNameMap, ok := tmpPermissionMap[v.CompanyContractId]
|
|
|
- if ok {
|
|
|
- tmpPermissionNameList, ok2 := tmpPermissionNameMap[v.ChartPermissionName]
|
|
|
- if ok2 {
|
|
|
- tmpPermissionNameList = append(tmpPermissionNameList, v.PermissionRemark)
|
|
|
- } else {
|
|
|
- tmpPermissionNameList = []string{v.PermissionRemark}
|
|
|
- }
|
|
|
- tmpPermissionNameMap[v.ChartPermissionName] = tmpPermissionNameList
|
|
|
- } else {
|
|
|
- tmpPermissionNameMap = make(map[string][]string)
|
|
|
- tmpPermissionNameMap[v.ChartPermissionName] = []string{v.PermissionRemark}
|
|
|
- }
|
|
|
- tmpPermissionMap[v.CompanyContractId] = tmpPermissionNameMap
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- for companyContractId, tmpPermissionNameMap := range tmpPermissionMap {
|
|
|
- tmpPermissionName := ``
|
|
|
- tmpPermissionList := []string{}
|
|
|
- for tmpChartPermissionName, tmpChartPermissionNameList := range tmpPermissionNameMap {
|
|
|
- if len(tmpChartPermissionNameList) > 1 {
|
|
|
- tmpPermissionName = tmpChartPermissionName
|
|
|
- } else {
|
|
|
- tmpPermissionName = tmpChartPermissionNameList[0]
|
|
|
- }
|
|
|
- tmpPermissionList = append(tmpPermissionList, tmpPermissionName)
|
|
|
- }
|
|
|
+ //permissionMap := make(map[int][]string)
|
|
|
+ //tmpPermissionMap := make(map[int]map[string][]string)
|
|
|
+ //companyContractIdList := make([]string, 0)
|
|
|
+ //for _, v := range resp.List {
|
|
|
+ // companyContractIdList = append(companyContractIdList, fmt.Sprint(v.CompanyContractId))
|
|
|
+ //}
|
|
|
+ //if dataType == "新签客户" || dataType == "续约客户" {
|
|
|
+ cellMoney := titleRow.AddCell()
|
|
|
+ cellMoney.SetStyle(style)
|
|
|
+ cellMoney.SetValue("合同金额")
|
|
|
+
|
|
|
+ //这么大费周章的目的是为了:权益的品种存在主观、客观的区分,如果一个品种既存在主观,又存在客观,那么就展示品种名称,否则就要列出品种名称+主、客观类型
|
|
|
+ //if len(companyContractIdList) > 0 {
|
|
|
+ // list, tmpErr := company.GetCompanyContractPermissionListByContractIds(strings.Join(companyContractIdList, ","))
|
|
|
+ // if tmpErr != nil {
|
|
|
+ // err = tmpErr
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // for _, v := range list {
|
|
|
+ // tmpPermissionNameMap, ok := tmpPermissionMap[v.CompanyContractId]
|
|
|
+ // if ok {
|
|
|
+ // tmpPermissionNameList, ok2 := tmpPermissionNameMap[v.ChartPermissionName]
|
|
|
+ // if ok2 {
|
|
|
+ // tmpPermissionNameList = append(tmpPermissionNameList, v.PermissionRemark)
|
|
|
+ // } else {
|
|
|
+ // tmpPermissionNameList = []string{v.PermissionRemark}
|
|
|
+ // }
|
|
|
+ // tmpPermissionNameMap[v.ChartPermissionName] = tmpPermissionNameList
|
|
|
+ // } else {
|
|
|
+ // tmpPermissionNameMap = make(map[string][]string)
|
|
|
+ // tmpPermissionNameMap[v.ChartPermissionName] = []string{v.PermissionRemark}
|
|
|
+ // }
|
|
|
+ // tmpPermissionMap[v.CompanyContractId] = tmpPermissionNameMap
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //}
|
|
|
|
|
|
- permissionMap[companyContractId] = tmpPermissionList
|
|
|
- }
|
|
|
+ //for companyContractId, tmpPermissionNameMap := range tmpPermissionMap {
|
|
|
+ // tmpPermissionName := ``
|
|
|
+ // tmpPermissionList := []string{}
|
|
|
+ // for tmpChartPermissionName, tmpChartPermissionNameList := range tmpPermissionNameMap {
|
|
|
+ // if len(tmpChartPermissionNameList) > 1 {
|
|
|
+ // tmpPermissionName = tmpChartPermissionName
|
|
|
+ // } else {
|
|
|
+ // tmpPermissionName = tmpChartPermissionNameList[0]
|
|
|
+ // }
|
|
|
+ // tmpPermissionList = append(tmpPermissionList, tmpPermissionName)
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // permissionMap[companyContractId] = tmpPermissionList
|
|
|
+ //}
|
|
|
|
|
|
cellTime := titleRow.AddCell()
|
|
|
cellTime.SetStyle(style)
|
|
@@ -629,11 +627,11 @@ func MergeCompanyListListExport(this *StatisticCompanyMergerController, dataType
|
|
|
cellDataSellerName.SetStyle(style)
|
|
|
cellDataSellerName.SetValue(v.SellerName)
|
|
|
|
|
|
- if dataType == "新签客户" || dataType == "续约客户" {
|
|
|
- cellDataMoney := dataRow.AddCell()
|
|
|
- cellDataMoney.SetStyle(style)
|
|
|
- cellDataMoney.SetValue(v.Money)
|
|
|
- }
|
|
|
+ //if dataType == "新签客户" || dataType == "续约客户" {
|
|
|
+ cellDataMoney := dataRow.AddCell()
|
|
|
+ cellDataMoney.SetStyle(style)
|
|
|
+ cellDataMoney.SetValue(v.Money)
|
|
|
+ //}
|
|
|
|
|
|
cellDataTime := dataRow.AddCell()
|
|
|
cellDataTime.SetStyle(style)
|
|
@@ -666,7 +664,7 @@ func MergeCompanyListListExport(this *StatisticCompanyMergerController, dataType
|
|
|
return
|
|
|
}
|
|
|
randStr := time.Now().Format(utils.FormatDateTimeUnSpace)
|
|
|
- downloadFileName := "增量客户数据_" + randStr + ".xlsx"
|
|
|
+ downloadFileName := dataType + "数据_" + randStr + ".xlsx"
|
|
|
this.Ctx.Output.Download(downLoadnFilePath, downloadFileName)
|
|
|
defer func() {
|
|
|
os.Remove(downLoadnFilePath)
|