|
@@ -62,6 +62,12 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
adminIdArr := strings.Split(adminId, ",")
|
|
|
serviceAdminIdArr := strings.Split(serviceAdminId, ",")
|
|
|
+ if adminId == "" {
|
|
|
+ adminIdArr = make([]string, 0)
|
|
|
+ }
|
|
|
+ if serviceAdminId == "" {
|
|
|
+ serviceAdminIdArr = make([]string, 0)
|
|
|
+ }
|
|
|
|
|
|
dataTypeArr := []string{}
|
|
|
if dataType == "季度" {
|
|
@@ -96,6 +102,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
br.ErrMsg = "获取管理账号失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
var sellerDevelop []*system.AdminItem
|
|
|
var sellerService []*system.AdminItem
|
|
|
var sellerDevelopIds = make(map[int]bool)
|
|
@@ -110,6 +117,23 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
mapsellerId[v.AdminId] = true
|
|
|
}
|
|
|
|
|
|
+ mapsellerDevelop := make(map[int]bool)
|
|
|
+ mapsellerService := make(map[int]bool)
|
|
|
+ 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)
|
|
@@ -188,6 +212,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
mapNewCustomerInvoicingMoney := make(map[string]float64)
|
|
|
mapNewCustomerPaymentsReceivedMoney := make(map[string]float64)
|
|
|
|
|
|
+ mapNewContractMoneyServer := make(map[string]float64)
|
|
|
+ mapNewContractNumServer := make(map[string]int)
|
|
|
mapExpiredContractMoneyServer := make(map[string]float64)
|
|
|
mapExpiredContractNumServer := make(map[string]int)
|
|
|
mapExpiredContractCompanyNumServer := make(map[string]int)
|
|
@@ -209,32 +235,12 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
var keySigned string
|
|
|
|
|
|
mapCompanyData := make(map[string]bool)
|
|
|
-
|
|
|
+
|
|
|
for _, v := range listRaiData {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- startDateTime := utils.StrDateToDate(v.StartDate)
|
|
|
- monthNum := startDateTime.Month()
|
|
|
- yearStr := strconv.Itoa(startDateTime.Year())
|
|
|
- if dataType == "季度" {
|
|
|
- if monthNum < 4 {
|
|
|
- yearStr += "Q1"
|
|
|
- } else if monthNum > 3 && monthNum < 7 {
|
|
|
- yearStr += "Q2"
|
|
|
- } else if monthNum > 6 && monthNum < 10 {
|
|
|
- yearStr += "Q3"
|
|
|
- } else if monthNum > 9 {
|
|
|
- yearStr += "Q4"
|
|
|
- }
|
|
|
- } else if dataType == "半年度" {
|
|
|
- if monthNum < 7 {
|
|
|
- yearStr += "H1"
|
|
|
- } else {
|
|
|
- yearStr += "H2"
|
|
|
- }
|
|
|
+ if !mapsellerDevelop[v.SellerIdInit] {
|
|
|
+ continue
|
|
|
}
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
keySigned = fmt.Sprint(yearStr, "_CID_", v.CompanyId, "_SID_", v.SellerIdLast)
|
|
@@ -262,32 +268,44 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ for _, v := range listRaiData {
|
|
|
+ if !mapsellerDevelop[v.ShareSellerInit] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
+
|
|
|
+ keyMap = fmt.Sprint(yearStr, "_Server_", v.SellerIdLast)
|
|
|
+ keySigned = fmt.Sprint(yearStr, "_Server_", v.CompanyId, "_SID_", v.SellerIdLast)
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Server_")
|
|
|
+
|
|
|
+ if v.RaiContractType == "新签合同" {
|
|
|
+ mapNewContractMoneyServer[keyMap] += v.Money
|
|
|
+ mapNewContractNumServer[keyMap]++
|
|
|
+ mapNewContractMoneyServer[keyMapTtoal] += v.Money
|
|
|
+ mapNewContractNumServer[keyMapTtoal]++
|
|
|
+ }
|
|
|
+
|
|
|
+ mapSignedClientMoneyServer[keyMap] += v.Money
|
|
|
+ mapSignedClientMoneyServer[keyMapTtoal] += v.Money
|
|
|
+
|
|
|
+ if !mapCompanyData[keySigned] && v.RaiContractType == "新签合同" {
|
|
|
+ mapSignedClientNumServer[keyMap]++
|
|
|
+ mapSignedClientNumServer[keyMapTtoal]++
|
|
|
+ mapCompanyData[keySigned] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
mapKeyMapCompanyData := make(map[string]bool)
|
|
|
for _, v := range listInheritData {
|
|
|
- if len(adminIdArr) > 0 && utils.InArrayByStr(adminIdArr, strconv.Itoa(v.SellerIdLast)) {
|
|
|
+ if len(adminIdArr) > 0 && !utils.InArrayByStr(adminIdArr, strconv.Itoa(v.SellerIdLast)) {
|
|
|
continue
|
|
|
}
|
|
|
- startDateTime := utils.StrDateToDate(v.InheritEndDate)
|
|
|
- monthNum := startDateTime.Month()
|
|
|
- yearStr := strconv.Itoa(startDateTime.Year())
|
|
|
- if dataType == "季度" {
|
|
|
- if monthNum < 4 {
|
|
|
- yearStr += "Q1"
|
|
|
- } else if monthNum > 3 && monthNum < 7 {
|
|
|
- yearStr += "Q2"
|
|
|
- } else if monthNum > 6 && monthNum < 10 {
|
|
|
- yearStr += "Q3"
|
|
|
- } else if monthNum > 9 {
|
|
|
- yearStr += "Q4"
|
|
|
- }
|
|
|
- } else if dataType == "半年度" {
|
|
|
- if monthNum < 7 {
|
|
|
- yearStr += "H1"
|
|
|
- } else {
|
|
|
- yearStr += "H2"
|
|
|
- }
|
|
|
+ if !mapsellerDevelop[v.SellerIdInit] {
|
|
|
+ continue
|
|
|
}
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
keyMapCompany = fmt.Sprint(yearStr, "_", v.SellerIdLast, "_CID_", v.CompanyId)
|
|
@@ -320,29 +338,13 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
|
|
|
for _, v := range listInheritData {
|
|
|
- if len(serviceAdminIdArr) > 0 && utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.ShareSellerIdLast)) {
|
|
|
+ if len(serviceAdminIdArr) > 0 && !utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.ShareSellerIdLast)) {
|
|
|
continue
|
|
|
}
|
|
|
- startDateTime := utils.StrDateToDate(v.InheritEndDate)
|
|
|
- monthNum := startDateTime.Month()
|
|
|
- yearStr := strconv.Itoa(startDateTime.Year())
|
|
|
- if dataType == "季度" {
|
|
|
- if monthNum < 4 {
|
|
|
- yearStr += "Q1"
|
|
|
- } else if monthNum > 3 && monthNum < 7 {
|
|
|
- yearStr += "Q2"
|
|
|
- } else if monthNum > 6 && monthNum < 10 {
|
|
|
- yearStr += "Q3"
|
|
|
- } else if monthNum > 9 {
|
|
|
- yearStr += "Q4"
|
|
|
- }
|
|
|
- } else if dataType == "半年度" {
|
|
|
- if monthNum < 7 {
|
|
|
- yearStr += "H1"
|
|
|
- } else {
|
|
|
- yearStr += "H2"
|
|
|
- }
|
|
|
+ if !mapsellerService[v.ShareSellerIdLast] {
|
|
|
+ continue
|
|
|
}
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast)
|
|
|
keyMapCompany = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast, "_CID_", v.CompanyId)
|
|
@@ -378,29 +380,13 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
mapKeyMapCompanyNoData := make(map[string]bool)
|
|
|
|
|
|
for _, v := range listEndData {
|
|
|
- if len(adminIdArr) > 0 && utils.InArrayByStr(adminIdArr, strconv.Itoa(v.SellerIdLast)) {
|
|
|
+ if len(adminIdArr) > 0 && !utils.InArrayByStr(adminIdArr, strconv.Itoa(v.SellerIdLast)) {
|
|
|
continue
|
|
|
}
|
|
|
- startDateTime := utils.StrDateToDate(v.EndDate)
|
|
|
- monthNum := startDateTime.Month()
|
|
|
- yearStr := strconv.Itoa(startDateTime.Year())
|
|
|
- if dataType == "季度" {
|
|
|
- if monthNum < 4 {
|
|
|
- yearStr += "Q1"
|
|
|
- } else if monthNum > 3 && monthNum < 7 {
|
|
|
- yearStr += "Q2"
|
|
|
- } else if monthNum > 6 && monthNum < 10 {
|
|
|
- yearStr += "Q3"
|
|
|
- } else if monthNum > 9 {
|
|
|
- yearStr += "Q4"
|
|
|
- }
|
|
|
- } else if dataType == "半年度" {
|
|
|
- if monthNum < 7 {
|
|
|
- yearStr += "H1"
|
|
|
- } else {
|
|
|
- yearStr += "H2"
|
|
|
- }
|
|
|
+ if !mapsellerDevelop[v.SellerIdInit] {
|
|
|
+ continue
|
|
|
}
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
keyMapCompany = fmt.Sprint(yearStr, "_", v.SellerIdLast, "_CID_", v.CompanyId)
|
|
@@ -440,29 +426,13 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
|
|
|
for _, v := range listEndData {
|
|
|
- if len(serviceAdminIdArr) > 0 && utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.ShareSellerIdLast)) {
|
|
|
+ if len(serviceAdminIdArr) > 0 && !utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.ShareSellerIdLast)) {
|
|
|
continue
|
|
|
}
|
|
|
- startDateTime := utils.StrDateToDate(v.EndDate)
|
|
|
- monthNum := startDateTime.Month()
|
|
|
- yearStr := strconv.Itoa(startDateTime.Year())
|
|
|
- if dataType == "季度" {
|
|
|
- if monthNum < 4 {
|
|
|
- yearStr += "Q1"
|
|
|
- } else if monthNum > 3 && monthNum < 7 {
|
|
|
- yearStr += "Q2"
|
|
|
- } else if monthNum > 6 && monthNum < 10 {
|
|
|
- yearStr += "Q3"
|
|
|
- } else if monthNum > 9 {
|
|
|
- yearStr += "Q4"
|
|
|
- }
|
|
|
- } else if dataType == "半年度" {
|
|
|
- if monthNum < 7 {
|
|
|
- yearStr += "H1"
|
|
|
- } else {
|
|
|
- yearStr += "H2"
|
|
|
- }
|
|
|
+ if !mapsellerService[v.ShareSellerIdLast] {
|
|
|
+ continue
|
|
|
}
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast)
|
|
|
keyMapCompany = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast, "_CID_", v.CompanyId)
|
|
@@ -507,29 +477,13 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
|
|
|
for _, v := range listFmsData {
|
|
|
- if len(adminIdArr) > 0 && utils.InArrayByStr(adminIdArr, strconv.Itoa(v.RaiSellerId)) {
|
|
|
+ if len(adminIdArr) > 0 && !utils.InArrayByStr(adminIdArr, strconv.Itoa(v.RaiSellerId)) {
|
|
|
continue
|
|
|
}
|
|
|
- startDateTime := v.StartDate
|
|
|
- monthNum := startDateTime.Month()
|
|
|
- yearStr := strconv.Itoa(startDateTime.Year())
|
|
|
- if dataType == "季度" {
|
|
|
- if monthNum < 4 {
|
|
|
- yearStr += "Q1"
|
|
|
- } else if monthNum > 3 && monthNum < 7 {
|
|
|
- yearStr += "Q2"
|
|
|
- } else if monthNum > 6 && monthNum < 10 {
|
|
|
- yearStr += "Q3"
|
|
|
- } else if monthNum > 9 {
|
|
|
- yearStr += "Q4"
|
|
|
- }
|
|
|
- } else if dataType == "半年度" {
|
|
|
- if monthNum < 7 {
|
|
|
- yearStr += "H1"
|
|
|
- } else {
|
|
|
- yearStr += "H2"
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ yearStr := getYearStar(v.StartDate, dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.RaiSellerId)
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
@@ -550,29 +504,13 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
|
|
|
for _, v := range listFmsData {
|
|
|
- if len(serviceAdminIdArr) > 0 && utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.RaiSellerId)) {
|
|
|
+ if len(serviceAdminIdArr) > 0 && !utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.RaiSellerId)) {
|
|
|
continue
|
|
|
}
|
|
|
- startDateTime := v.StartDate
|
|
|
- monthNum := startDateTime.Month()
|
|
|
- yearStr := strconv.Itoa(startDateTime.Year())
|
|
|
- if dataType == "季度" {
|
|
|
- if monthNum < 4 {
|
|
|
- yearStr += "Q1"
|
|
|
- } else if monthNum > 3 && monthNum < 7 {
|
|
|
- yearStr += "Q2"
|
|
|
- } else if monthNum > 6 && monthNum < 10 {
|
|
|
- yearStr += "Q3"
|
|
|
- } else if monthNum > 9 {
|
|
|
- yearStr += "Q4"
|
|
|
- }
|
|
|
- } else if dataType == "半年度" {
|
|
|
- if monthNum < 7 {
|
|
|
- yearStr += "H1"
|
|
|
- } else {
|
|
|
- yearStr += "H2"
|
|
|
- }
|
|
|
+ if !mapsellerService[v.RaiSellerId] {
|
|
|
+ continue
|
|
|
}
|
|
|
+ yearStr := getYearStar(v.StartDate, dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.RaiSellerId)
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Server_")
|
|
@@ -771,7 +709,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
sellerServiceIds = append(sellerServiceIds, sellerItem.SellerId)
|
|
|
sellerItem.SellerName = vS.RealName
|
|
|
sellerItem.AddTrialCount = fmt.Sprint(mapAddTrialNum[keyMap])
|
|
|
- sellerItem.NewContractData = fmt.Sprint(utils.SubFloatToString(mapNewContractMoney[keyMap], 2), " / ", mapNewContractNum[keyMap])
|
|
|
+ sellerItem.NewContractData = fmt.Sprint(utils.SubFloatToString(mapNewContractMoneyServer[keyMap], 2), " / ", mapNewContractNumServer[keyMap])
|
|
|
sellerItem.ExpiredContractData = fmt.Sprint(utils.SubFloatToString(mapExpiredContractMoneyServer[keyMap], 2), " / ", mapExpiredContractNumServer[keyMap])
|
|
|
sellerItem.RenewedContractData = fmt.Sprint(utils.SubFloatToString(mapRenewedContractMoneyServer[keyMap], 2), " / ", mapRenewedContractNumServer[keyMap])
|
|
|
var renewalRateMoey string
|
|
@@ -829,7 +767,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
sellerItem.SellerId = strings.Join(sellerServiceIds, ",")
|
|
|
sellerItem.SellerName = "服务组合计"
|
|
|
sellerItem.AddTrialCount = fmt.Sprint(mapAddTrialNum[keyMapTtoalServer])
|
|
|
- sellerItem.NewContractData = fmt.Sprint(utils.SubFloatToString(mapNewContractMoney[keyMapTtoalServer], 2), " / ", mapNewContractNum[keyMapTtoalServer])
|
|
|
+ sellerItem.NewContractData = fmt.Sprint(utils.SubFloatToString(mapNewContractMoneyServer[keyMapTtoalServer], 2), " / ", mapNewContractNumServer[keyMapTtoalServer])
|
|
|
sellerItem.ExpiredContractData = fmt.Sprint(utils.SubFloatToString(mapExpiredContractMoneyServer[keyMapTtoalServer], 2), " / ", mapExpiredContractNumServer[keyMapTtoalServer])
|
|
|
sellerItem.RenewedContractData = fmt.Sprint(utils.SubFloatToString(mapRenewedContractMoneyServer[keyMapTtoalServer], 2), " / ", mapRenewedContractNumServer[keyMapTtoalServer])
|
|
|
var renewalRateMoey string
|
|
@@ -1772,3 +1710,28 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+func getYearStar(startDate time.Time, dataType string) (yearStr string) {
|
|
|
+ startDateTime := startDate
|
|
|
+ monthNum := startDateTime.Month()
|
|
|
+ yearStr = strconv.Itoa(startDateTime.Year())
|
|
|
+ if dataType == "季度" {
|
|
|
+ if monthNum < 4 {
|
|
|
+ yearStr += "Q1"
|
|
|
+ } else if monthNum > 3 && monthNum < 7 {
|
|
|
+ yearStr += "Q2"
|
|
|
+ } else if monthNum > 6 && monthNum < 10 {
|
|
|
+ yearStr += "Q3"
|
|
|
+ } else if monthNum > 9 {
|
|
|
+ yearStr += "Q4"
|
|
|
+ }
|
|
|
+ } else if dataType == "半年度" {
|
|
|
+ if monthNum < 7 {
|
|
|
+ yearStr += "H1"
|
|
|
+ } else {
|
|
|
+ yearStr += "H2"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|