|
@@ -77,15 +77,41 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
} else {
|
|
|
dataTypeArr = []string{""}
|
|
|
}
|
|
|
-
|
|
|
- condition := " AND role_type_code IN ('rai_seller','rai_group') AND enabled = 1 AND rai_enabled = 1 "
|
|
|
+ var condition string
|
|
|
var pars []interface{}
|
|
|
+
|
|
|
+ mapsellerDevelop := make(map[int]bool) // 开拓组销售Map
|
|
|
+ mapsellerService := make(map[int]bool) // 服务组销售Map
|
|
|
+ var sellerIds []string
|
|
|
+ var sellerServiceIds []string
|
|
|
+ condition = " AND role_type_code IN ('rai_seller','rai_group') "
|
|
|
+ sellerListAll, err := system.GetSysUserItemsOrderByCreated(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取管理账号失败"
|
|
|
+ br.ErrMsg = "获取管理账号失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range sellerListAll {
|
|
|
+ if strings.Contains(v.RealName, "6") {
|
|
|
+ mapsellerService[v.AdminId] = true
|
|
|
+ sellerServiceIds = append(sellerServiceIds, strconv.Itoa(v.AdminId))
|
|
|
+ } else {
|
|
|
+ mapsellerDevelop[v.AdminId] = true
|
|
|
+ sellerIds = append(sellerIds, strconv.Itoa(v.AdminId))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ condition = " AND role_type_code IN ('rai_seller','rai_group') AND enabled = 1 AND rai_enabled = 1 "
|
|
|
+
|
|
|
if adminId != "" {
|
|
|
serviceAdminId = ""
|
|
|
condition += " AND admin_id IN (" + adminId + ") "
|
|
|
+ sellerIds = make([]string, 0)
|
|
|
}
|
|
|
if serviceAdminId != "" {
|
|
|
condition += " AND admin_id IN (" + serviceAdminId + ") "
|
|
|
+ sellerServiceIds = make([]string, 0)
|
|
|
}
|
|
|
|
|
|
if developButton && !serverButton && adminId == "" && serviceAdminId == "" { //开拓组筛选条件
|
|
@@ -117,23 +143,6 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
mapsellerId[v.AdminId] = true
|
|
|
}
|
|
|
|
|
|
- mapsellerDevelop := make(map[int]bool) // 开拓组销售Map
|
|
|
- mapsellerService := make(map[int]bool) // 服务组销售Map
|
|
|
- condition = " AND role_type_code IN ('rai_seller','rai_group') "
|
|
|
- sellerListAll, err := system.GetSysUserItemsOrderByCreated(condition, pars)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取管理账号失败"
|
|
|
- br.ErrMsg = "获取管理账号失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- for _, v := range sellerListAll {
|
|
|
- if strings.Contains(v.RealName, "6") {
|
|
|
- mapsellerService[v.AdminId] = true
|
|
|
- } else {
|
|
|
- mapsellerDevelop[v.AdminId] = true
|
|
|
- }
|
|
|
- }
|
|
|
//拼接起始时间查询
|
|
|
startDate := fmt.Sprintf("%d-01-01", startYear)
|
|
|
endDate := fmt.Sprintf("%d-12-31", endYear)
|
|
@@ -235,6 +244,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
var keySigned string
|
|
|
|
|
|
mapCompanyData := make(map[string]bool)
|
|
|
+
|
|
|
//新签部分的数据(开拓组)
|
|
|
for _, v := range listRaiData {
|
|
|
if !mapsellerDevelop[v.SellerIdInit] {
|
|
@@ -244,12 +254,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
keySigned = fmt.Sprint(yearStr, "_CID_", v.CompanyId, "_SID_", v.SellerIdLast)
|
|
|
-
|
|
|
- if sellerDevelopIds[v.SellerIdLast] == true {
|
|
|
- keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
- } else {
|
|
|
- keyMapTtoal = fmt.Sprint(yearStr, "_Service")
|
|
|
- }
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
|
|
|
if v.RaiContractType == "新签合同" {
|
|
|
mapNewContractMoney[keyMap] += v.Money
|
|
@@ -275,8 +280,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
|
|
|
- keyMap = fmt.Sprint(yearStr, "_Server_", v.SellerIdLast)
|
|
|
- keySigned = fmt.Sprint(yearStr, "_Server_", v.CompanyId, "_SID_", v.SellerIdLast)
|
|
|
+ keyMap = fmt.Sprint(yearStr, "_Server_", v.ShareSellerInit)
|
|
|
+ keySigned = fmt.Sprint(yearStr, "_Server_", v.CompanyId, "_SID_", v.ShareSellerInit)
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Server_")
|
|
|
|
|
|
if v.RaiContractType == "新签合同" {
|
|
@@ -583,8 +588,6 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
item.DataType = fmt.Sprint(i, Dv)
|
|
|
keyMapTtoal = fmt.Sprint(item.DataType, "_Develop")
|
|
|
keyMapTtoalServer = fmt.Sprint(item.DataType, "_Server_")
|
|
|
- var sellerIds []string
|
|
|
- var sellerServiceIds []string
|
|
|
for _, vS := range sellerDevelop {
|
|
|
keyMap = fmt.Sprint(item.DataType, "_", vS.AdminId)
|
|
|
sellerItem := new(statistic_report.RaiDataSummaryDetail)
|
|
@@ -972,7 +975,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
condition += ` AND a.seller_id_init IN (` + sellerId + `) `
|
|
|
}
|
|
|
|
|
|
- condition += ` AND a.status = 1 AND a.start_date >= ? AND a.start_date <= ? `
|
|
|
+ condition += ` AND a.status = 1 AND a.start_date >= ? AND a.start_date <= ? AND a.product_id = 2 `
|
|
|
pars = append(pars, startDate, endDate)
|
|
|
condition += ` AND a.rai_contract_type = ? `
|
|
|
pars = append(pars, "新签合同")
|