|
@@ -6402,6 +6402,7 @@ func (this *StatisticReportController) UnusualRenewCompanyList() {
|
|
|
|
|
|
// 按月分组
|
|
|
monthMap := make(map[string]int)
|
|
|
+ monthCompanyMap := make(map[string]struct{})
|
|
|
monthList := make([]string, 0)
|
|
|
tmpDate, _ := time.ParseInLocation(utils.FormatYearMonthDate, startDate, time.Local)
|
|
|
tmpEndDate, _ := time.ParseInLocation(utils.FormatYearMonthDate, endDate, time.Local)
|
|
@@ -6411,8 +6412,36 @@ func (this *StatisticReportController) UnusualRenewCompanyList() {
|
|
|
tmpDate = tmpDate.AddDate(0, 1, 0)
|
|
|
|
|
|
}
|
|
|
+ // 只查询咨询组销售下的客户
|
|
|
+ groupId := 0
|
|
|
+ if utils.RunMode == "release" {
|
|
|
+ groupId = 37
|
|
|
+ } else {
|
|
|
+ groupId = 61
|
|
|
+ }
|
|
|
+ subAdmins, err := system.GetAdminByGroupId(groupId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取销售失败"
|
|
|
+ br.ErrMsg = "获取销售失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(subAdmins) == 0 {
|
|
|
+ resp = &company.GetUnusualRenewListGroupMonthResp{
|
|
|
+ List: allList,
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+ subAdminIds := make([]string, 0)
|
|
|
+ for _, v := range subAdmins {
|
|
|
+ subAdminIds = append(subAdminIds, strconv.Itoa(v.AdminId))
|
|
|
+ }
|
|
|
+ shareSellerIds := strings.Join(subAdminIds, ",")
|
|
|
|
|
|
- list, err := company.GetUnusualRenewList(startDateTimer, endDateTimer, productId)
|
|
|
+ list, err := company.GetUnusualRenewList(startDateTimer, endDateTimer, productId, shareSellerIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "数据异常"
|
|
|
br.ErrMsg = "数据异常,Err:" + err.Error()
|
|
@@ -6421,8 +6450,12 @@ func (this *StatisticReportController) UnusualRenewCompanyList() {
|
|
|
if len(list) > 0 {
|
|
|
for _, v := range list {
|
|
|
t := v.ModifyTime.Format(utils.FormatYearMonthDate)
|
|
|
- if num, ok := monthMap[t]; ok {
|
|
|
- monthMap[t] = num + 1
|
|
|
+ name := fmt.Sprintf("%s_%d", t, v.CompanyId)
|
|
|
+ if _, ok := monthCompanyMap[name]; !ok {
|
|
|
+ if num, ok1 := monthMap[t]; ok1 {
|
|
|
+ monthMap[t] = num + 1
|
|
|
+ }
|
|
|
+ monthCompanyMap[name] = struct{}{}
|
|
|
}
|
|
|
}
|
|
|
}
|