|
@@ -109,7 +109,7 @@ func (this *OverseasCustomController) CustomList() {
|
|
|
if companyStatus == "试用" {
|
|
|
condition += ` AND m.company_status='试用' AND m.overseas_status='' `
|
|
|
} else if companyStatus == "正式" {
|
|
|
- condition += ` AND m.company_status='正式' `
|
|
|
+ condition += ` AND (m.company_status='正式' OR m.overseas_status='正式') `
|
|
|
}
|
|
|
|
|
|
total, err := obj.GetCustomListCount(condition, pars, companyStatus)
|
|
@@ -132,62 +132,11 @@ func (this *OverseasCustomController) CustomList() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- statisticsDataList, err := obj.GetCustomTotal(condition, pars)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取各状态总数失败, Err: " + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- statisticsDataStatusList := make([]*overseas_custom.CustomTotal, 0)
|
|
|
- statisticsDataMap := make(map[string]int)
|
|
|
- for _, v := range statisticsDataList {
|
|
|
- statisticsDataMap[v.CompanyStatus] = v.Total
|
|
|
- }
|
|
|
-
|
|
|
- var statusArr = [3]string{"试用", "正式", "关闭"}
|
|
|
-
|
|
|
- for _, v := range statusArr {
|
|
|
- item := new(overseas_custom.CustomTotal)
|
|
|
- item.CompanyStatus = v
|
|
|
- if val, ok := statisticsDataMap[v]; ok {
|
|
|
- item.Total = val
|
|
|
- }
|
|
|
- statisticsDataStatusList = append(statisticsDataStatusList, item)
|
|
|
- }
|
|
|
-
|
|
|
- overseasLabelDataList, err := obj.GetCustomOverseasLabelTotal(condition, pars)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取子标签总数失败, Err: " + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- labelDataMap := make(map[int]int)
|
|
|
- for _, v := range overseasLabelDataList {
|
|
|
- labelDataMap[v.OverseasLabel] = v.Total
|
|
|
- }
|
|
|
-
|
|
|
- var labelArr = [4]int{1, 2, 3, 4}
|
|
|
-
|
|
|
- labelList := make([]*overseas_custom.OverseasLabelTotal, 0)
|
|
|
-
|
|
|
- for _, v := range labelArr {
|
|
|
- item := new(overseas_custom.OverseasLabelTotal)
|
|
|
- item.OverseasLabel = v
|
|
|
- if val, ok := labelDataMap[v]; ok {
|
|
|
- item.Total = val
|
|
|
- }
|
|
|
- labelList = append(labelList, item)
|
|
|
- }
|
|
|
-
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
|
|
resp := new(overseas_custom.CustomListResp)
|
|
|
resp.Paging = page
|
|
|
resp.List = list
|
|
|
- resp.StatisticsData = statisticsDataStatusList
|
|
|
- resp.OverseasLabelData = labelList
|
|
|
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
@@ -493,6 +442,12 @@ func (this *OverseasCustomController) CustomStatistics() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ total, err := obj.GetCustomOverseasStatusTotal(condition, pars)
|
|
|
+ if err != nil && err.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取海外客户总计状态失败, Err: " + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
statisticsDataStatusList := make([]*overseas_custom.CustomTotal, 0)
|
|
|
statisticsDataMap := make(map[string]int)
|
|
|
for _, v := range list {
|
|
@@ -507,6 +462,12 @@ func (this *OverseasCustomController) CustomStatistics() {
|
|
|
if val, ok := statisticsDataMap[v]; ok {
|
|
|
item.Total = val
|
|
|
}
|
|
|
+
|
|
|
+ if v == "正式" {
|
|
|
+ item.Total = item.Total + total
|
|
|
+ } else if v == "试用" {
|
|
|
+ item.Total = item.Total - total
|
|
|
+ }
|
|
|
statisticsDataStatusList = append(statisticsDataStatusList, item)
|
|
|
}
|
|
|
|