|
@@ -7,10 +7,8 @@ import (
|
|
|
"hongze/hz_crm_api/models/company"
|
|
|
"hongze/hz_crm_api/models/response"
|
|
|
"hongze/hz_crm_api/services"
|
|
|
- "strings"
|
|
|
//"hongze/hz_crm_api/services"
|
|
|
"hongze/hz_crm_api/utils"
|
|
|
- "strconv"
|
|
|
//"strings"
|
|
|
"time"
|
|
|
)
|
|
@@ -64,6 +62,7 @@ func (this *StatisticCompanyMergerController) IncrementalCompanyList() {
|
|
|
dataType := this.GetString("DataType")
|
|
|
tryOutType := this.GetString("TryOutType")
|
|
|
keyword := this.GetString("Keyword")
|
|
|
+ packageDifference := this.GetString("PackageDifference")
|
|
|
|
|
|
startDate := this.GetString("StartDate")
|
|
|
endDate := this.GetString("EndDate")
|
|
@@ -115,6 +114,12 @@ func (this *StatisticCompanyMergerController) IncrementalCompanyList() {
|
|
|
condition += ` AND b.region_type = ? `
|
|
|
pars = append(pars, regionType)
|
|
|
}
|
|
|
+
|
|
|
+ if packageDifference != "" {
|
|
|
+ condition += ` AND b.package_difference = ? `
|
|
|
+ pars = append(pars, regionType)
|
|
|
+ }
|
|
|
+
|
|
|
//关键字搜索
|
|
|
if keyword != "" {
|
|
|
condition += ` and b.company_name like "%` + keyword + `%" `
|
|
@@ -246,7 +251,7 @@ func (this *StatisticCompanyMergerController) IncrementalCompanyList() {
|
|
|
////额外条件(续约合同的起始日期包含在所选时间段内且不包含在新签合同存续期内的客户)
|
|
|
//pars1 = append(pars1, endDate)
|
|
|
|
|
|
- total, err := company.GetIncrementalRenewalCompanyProductMergeCount(condition1, pars1)
|
|
|
+ total, err := company.GetIncrementalNewCompanyProductMergeCount(condition1, pars1)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
@@ -269,51 +274,10 @@ func (this *StatisticCompanyMergerController) IncrementalCompanyList() {
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
list = tmpList
|
|
|
dataTotal = total
|
|
|
|
|
|
- var ids []string
|
|
|
- companyMap := make(map[int]*models.IncrementalList)
|
|
|
- oldCompanyMap := make(map[int]*models.IncrementalList)
|
|
|
- countMap := make(map[int]int)
|
|
|
- for _, item := range tmpList {
|
|
|
- ids = append(ids, strconv.Itoa(item.CompanyId))
|
|
|
- companyMap[item.CompanyId] = item
|
|
|
- }
|
|
|
- if len(ids) > 0 {
|
|
|
- idStr := strings.Join(ids, ",")
|
|
|
- lists, err := models.GetLastContractMoney(idStr)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- for _, item := range lists {
|
|
|
- _, countOk := countMap[item.CompanyId]
|
|
|
- _, ok := oldCompanyMap[item.CompanyId]
|
|
|
- if !ok {
|
|
|
- oldCompanyMap[item.CompanyId] = item
|
|
|
- } else if !countOk {
|
|
|
- countMap[item.CompanyId] = 1
|
|
|
- oldCompanyMap[item.CompanyId] = item
|
|
|
- }
|
|
|
- }
|
|
|
- //给list赋值
|
|
|
- for _, item := range list {
|
|
|
- if item.ProductName == "权益" {
|
|
|
- lastContract, _ := oldCompanyMap[item.CompanyId]
|
|
|
- if item.Money > lastContract.Money {
|
|
|
- item.PackageDifference = "增加套餐"
|
|
|
- } else if item.Money < lastContract.Money {
|
|
|
- item.PackageDifference = "减少套餐"
|
|
|
- } else {
|
|
|
- item.PackageDifference = "维持套餐"
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|