|
@@ -60,6 +60,15 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
developButton, _ := this.GetBool("DevelopButton")
|
|
|
serverButton, _ := this.GetBool("ServerButton")
|
|
|
|
|
|
+ adminIdArr := strings.Split(adminId, ",")
|
|
|
+ serviceAdminIdArr := strings.Split(serviceAdminId, ",")
|
|
|
+ if adminId == "" {
|
|
|
+ adminIdArr = make([]string, 0)
|
|
|
+ }
|
|
|
+ if serviceAdminId == "" {
|
|
|
+ serviceAdminIdArr = make([]string, 0)
|
|
|
+ }
|
|
|
+
|
|
|
dataTypeArr := []string{}
|
|
|
if dataType == "季度" {
|
|
|
dataTypeArr = []string{"Q1", "Q2", "Q3", "Q4"}
|
|
@@ -93,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) // 开拓组销售的map
|
|
@@ -107,6 +117,23 @@ 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)
|
|
@@ -185,43 +212,38 @@ 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) // 到期公司(数量)_服务组
|
|
|
+ mapRenewedContractMoneyServer := make(map[string]float64) // 续约合同(金额)_服务组
|
|
|
+ mapRenewedContractNumServer := make(map[string]int) // 续约合同(数量)_服务组
|
|
|
+ mapRenewedContractCompanyNumServer := make(map[string]int) // 续约公司(数量)_服务组
|
|
|
+ confirmedNoRenewalContractMoneyServer := make(map[string]float64) // 确认不续约合同(金额)_服务组
|
|
|
+ confirmedNoRenewalContractNumServer := make(map[string]int) // 确认不续约合同(数量)_服务组
|
|
|
+ confirmedNoRenewalContractCompanyNumServer := make(map[string]int) // 确认不续约公司(数量)_服务组
|
|
|
+ mapSignedClientNumServer := make(map[string]int) // 签约客户(数量)
|
|
|
+ mapSignedClientMoneyServer := make(map[string]float64) // 签约客户(金额)
|
|
|
+
|
|
|
var keyMap string
|
|
|
var keyMapTtoal string
|
|
|
var keyMapTtoalServer string
|
|
|
var keyMapCompany string
|
|
|
var keyMapCompanyNo string
|
|
|
+ //var keyMapCompanyNoServer string
|
|
|
var keySigned string
|
|
|
|
|
|
mapCompanyData := make(map[string]bool)
|
|
|
- //新签部分的数据
|
|
|
+ //新签部分的数据(开拓组)
|
|
|
for _, v := range listRaiData {
|
|
|
- if !mapsellerId[v.SellerIdInit] {
|
|
|
+ if !mapsellerDevelop[v.SellerIdInit] {
|
|
|
continue
|
|
|
}
|
|
|
-
|
|
|
- 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"
|
|
|
- }
|
|
|
- }
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
- keySigned = fmt.Sprint(yearStr, "_", "_CID_", v.CompanyId, "_SID_", v.SellerIdLast)
|
|
|
+ keySigned = fmt.Sprint(yearStr, "_CID_", v.CompanyId, "_SID_", v.SellerIdLast)
|
|
|
|
|
|
if sellerDevelopIds[v.SellerIdLast] == true {
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
@@ -246,115 +268,138 @@ 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 !mapsellerId[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)
|
|
|
- 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")
|
|
|
- }
|
|
|
+ keySigned = fmt.Sprint(yearStr, "_CID_", v.CompanyId, "_SID_", v.SellerIdLast)
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
|
|
|
//续约合同 数据
|
|
|
mapRenewedContractMoney[keyMap] += v.Money
|
|
|
-
|
|
|
mapRenewedContractMoney[keyMapTtoal] += v.Money
|
|
|
-
|
|
|
- mapSignedClientMoney[keyMap] += v.Money
|
|
|
- mapSignedClientMoney[keyMapTtoal] += v.Money
|
|
|
-
|
|
|
- //一家公司同一个时间纬度,只统计一次
|
|
|
- //if !mapKeyMapCompanyData[keyMapCompany] {
|
|
|
mapRenewedContractNum[keyMap]++
|
|
|
mapRenewedContractNum[keyMapTtoal]++
|
|
|
- //mapKeyMapCompanyData[keyMapCompany] = true
|
|
|
- //}
|
|
|
+
|
|
|
+ //续约公司 数据
|
|
|
if !mapKeyMapCompanyData[keyMapCompany] {
|
|
|
mapRenewedContractCompanyNum[keyMap]++
|
|
|
mapRenewedContractCompanyNum[keyMapTtoal]++
|
|
|
mapKeyMapCompanyData[keyMapCompany] = true
|
|
|
}
|
|
|
- if !mapCompanyData[keySigned] && v.RaiContractType == "续约合同" {
|
|
|
+
|
|
|
+ //签约合同 数据
|
|
|
+ mapSignedClientMoney[keyMap] += v.Money
|
|
|
+ mapSignedClientMoney[keyMapTtoal] += v.Money
|
|
|
+
|
|
|
+ if !mapCompanyData[keySigned] {
|
|
|
mapSignedClientNum[keyMap]++
|
|
|
mapSignedClientNum[keyMapTtoal]++
|
|
|
mapCompanyData[keySigned] = true
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //续约部分的数据(服务组)
|
|
|
+ for _, v := range listInheritData {
|
|
|
+ if len(serviceAdminIdArr) > 0 && !utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.ShareSellerIdLast)) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ 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)
|
|
|
+ keySigned = fmt.Sprint(yearStr, "_Server_", v.CompanyId, "_SID_", v.ShareSellerIdLast)
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Server_")
|
|
|
+
|
|
|
+ //续约合同 数据
|
|
|
+ mapRenewedContractMoneyServer[keyMap] += v.Money
|
|
|
+ mapRenewedContractMoneyServer[keyMapTtoal] += v.Money
|
|
|
+ mapRenewedContractNumServer[keyMap]++
|
|
|
+ mapRenewedContractNumServer[keyMapTtoal]++
|
|
|
+
|
|
|
+ //续约公司 数据
|
|
|
+ if !mapKeyMapCompanyData[keyMapCompany] {
|
|
|
+ mapRenewedContractCompanyNumServer[keyMap]++
|
|
|
+ mapRenewedContractCompanyNumServer[keyMapTtoal]++
|
|
|
+ mapKeyMapCompanyData[keyMapCompany] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ ////签约合同 数据
|
|
|
+ mapSignedClientMoneyServer[keyMap] += v.Money
|
|
|
+ mapSignedClientMoneyServer[keyMapTtoal] += v.Money
|
|
|
+
|
|
|
+ //if !mapCompanyData[keySigned] {
|
|
|
+ // mapSignedClientNum[keyMap]++
|
|
|
+ // mapSignedClientNum[keyMapTtoal]++
|
|
|
+ // mapCompanyData[keySigned] = true
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
//确认不续约、到期合同部分的数据
|
|
|
mapKeyMapCompanyEndData := make(map[string]bool)
|
|
|
mapKeyMapCompanyNoData := make(map[string]bool)
|
|
|
+ //开拓组数据
|
|
|
for _, v := range listEndData {
|
|
|
- if !mapsellerId[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)
|
|
|
keyMapCompanyNo = fmt.Sprint(yearStr, "_", v.SellerIdLast, "_CID_NO", v.CompanyId)
|
|
|
- if sellerDevelopIds[v.SellerIdLast] == true {
|
|
|
- keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
- } else {
|
|
|
- keyMapTtoal = fmt.Sprint(yearStr, "_Service")
|
|
|
- }
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
|
|
|
//到期合同数据
|
|
|
mapExpiredContractMoney[keyMap] += v.Money
|
|
|
mapExpiredContractMoney[keyMapTtoal] += v.Money
|
|
|
|
|
|
//一家公司同一个时间纬度,只统计一次
|
|
|
- //if !mapKeyMapCompanyEndData[keyMapCompany] {
|
|
|
mapExpiredContractNum[keyMap]++
|
|
|
mapExpiredContractNum[keyMapTtoal]++
|
|
|
- //mapKeyMapCompanyEndData[keyMapCompany] = true
|
|
|
- //}
|
|
|
|
|
|
//一家公司同一个时间纬度,只统计一次
|
|
|
if !mapKeyMapCompanyEndData[keyMapCompany] {
|
|
@@ -365,22 +410,61 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
if mapNoRenewedcompanyContractIds[v.CompanyContractId] { // 确认不续约合同
|
|
|
confirmedNoRenewalContractMoney[keyMap] += v.Money
|
|
|
-
|
|
|
confirmedNoRenewalContractMoney[keyMapTtoal] += v.Money
|
|
|
|
|
|
//一家公司同一个时间纬度,只统计一次
|
|
|
- //if !mapKeyMapCompanyNoData[keyMapCompanyNo] {
|
|
|
confirmedNoRenewalContractNum[keyMap]++
|
|
|
confirmedNoRenewalContractNum[keyMapTtoal]++
|
|
|
- //mapKeyMapCompanyNoData[keyMapCompanyNo] = true
|
|
|
- //}
|
|
|
|
|
|
if !mapKeyMapCompanyNoData[keyMapCompanyNo] {
|
|
|
confirmedNoRenewalContractCompanyNum[keyMap]++
|
|
|
confirmedNoRenewalContractCompanyNum[keyMapTtoal]++
|
|
|
mapKeyMapCompanyNoData[keyMapCompanyNo] = true
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ //服务组数据
|
|
|
+ for _, v := range listEndData {
|
|
|
+ if len(serviceAdminIdArr) > 0 && !utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.ShareSellerIdLast)) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ 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)
|
|
|
+ keyMapCompanyNo = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast, "_CID_NO", v.CompanyId)
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Server_")
|
|
|
+
|
|
|
+ //到期合同数据
|
|
|
+ mapExpiredContractMoneyServer[keyMap] += v.Money
|
|
|
+ mapExpiredContractMoneyServer[keyMapTtoal] += v.Money
|
|
|
+ mapExpiredContractNumServer[keyMap]++
|
|
|
+ mapExpiredContractNumServer[keyMapTtoal]++
|
|
|
+
|
|
|
+ //一家公司同一个时间纬度,只统计一次
|
|
|
+ if !mapKeyMapCompanyEndData[keyMapCompany] {
|
|
|
+ mapExpiredContractCompanyNumServer[keyMap]++
|
|
|
+ mapExpiredContractCompanyNumServer[keyMapTtoal]++
|
|
|
+ mapKeyMapCompanyEndData[keyMapCompany] = true
|
|
|
+ }
|
|
|
+
|
|
|
+ if mapNoRenewedcompanyContractIds[v.CompanyContractId] { // 确认不续约合同
|
|
|
+ confirmedNoRenewalContractMoneyServer[keyMap] += v.Money
|
|
|
+ confirmedNoRenewalContractMoneyServer[keyMapTtoal] += v.Money
|
|
|
+
|
|
|
+ //一家公司同一个时间纬度,只统计一次
|
|
|
+ confirmedNoRenewalContractNumServer[keyMap]++
|
|
|
+ confirmedNoRenewalContractNumServer[keyMapTtoal]++
|
|
|
+
|
|
|
+ if !mapKeyMapCompanyNoData[keyMapCompanyNo] {
|
|
|
+ confirmedNoRenewalContractCompanyNumServer[keyMap]++
|
|
|
+ confirmedNoRenewalContractCompanyNumServer[keyMapTtoal]++
|
|
|
+ mapKeyMapCompanyNoData[keyMapCompanyNo] = true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -391,38 +475,45 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ //开拓组财务系统数据
|
|
|
for _, v := range listFmsData {
|
|
|
- if !mapsellerId[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"
|
|
|
- }
|
|
|
- }
|
|
|
+ //if !mapsellerDevelop[v.RaiSellerId] {
|
|
|
+ // continue
|
|
|
+ //}
|
|
|
+ yearStr := getYearStar(v.StartDate, dataType)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.RaiSellerId)
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
|
|
|
- if sellerDevelopIds[v.RaiSellerId] == true {
|
|
|
- keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
- } else {
|
|
|
- keyMapTtoal = fmt.Sprint(yearStr, "_Service")
|
|
|
+ mapInvoiceAmountMoney[keyMap] += v.InvoicedAmount
|
|
|
+ mapPaymentAmountMoney[keyMap] += v.PaymentAmount
|
|
|
+
|
|
|
+ mapInvoiceAmountMoney[keyMapTtoal] += v.InvoicedAmount
|
|
|
+ mapPaymentAmountMoney[keyMapTtoal] += v.PaymentAmount
|
|
|
+
|
|
|
+ if v.ContractType == 1 {
|
|
|
+ mapNewCustomerInvoicingMoney[keyMap] += v.InvoicedAmount
|
|
|
+ mapNewCustomerPaymentsReceivedMoney[keyMap] += v.PaymentAmount
|
|
|
+ mapNewCustomerInvoicingMoney[keyMapTtoal] += v.InvoicedAmount
|
|
|
+ mapNewCustomerPaymentsReceivedMoney[keyMapTtoal] += v.PaymentAmount
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ //服务组财务系统数据
|
|
|
+ for _, v := range listFmsData {
|
|
|
+ if len(serviceAdminIdArr) > 0 && !utils.InArrayByStr(serviceAdminIdArr, strconv.Itoa(v.RaiSellerId)) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if !mapsellerService[v.RaiSellerId] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ yearStr := getYearStar(v.StartDate, dataType)
|
|
|
+
|
|
|
+ keyMap = fmt.Sprint(yearStr, "_", v.RaiSellerId)
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Server_")
|
|
|
|
|
|
mapInvoiceAmountMoney[keyMap] += v.InvoicedAmount
|
|
|
mapPaymentAmountMoney[keyMap] += v.PaymentAmount
|
|
@@ -477,20 +568,21 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if sellerDevelopIds[sysUserId] == true {
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
} else {
|
|
|
- keyMapTtoal = fmt.Sprint(yearStr, "_Service")
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Server_")
|
|
|
}
|
|
|
mapAddTrialNum[keyMapTtoal]++
|
|
|
}
|
|
|
|
|
|
resp := new(statistic_report.RaiDataSummaryListResp)
|
|
|
var items []*statistic_report.RaiDataSummaryResp
|
|
|
+
|
|
|
for i := startYear; i <= endYear; i++ {
|
|
|
//if len(dataTypeArr) > 0 {
|
|
|
for _, Dv := range dataTypeArr {
|
|
|
item := new(statistic_report.RaiDataSummaryResp)
|
|
|
item.DataType = fmt.Sprint(i, Dv)
|
|
|
keyMapTtoal = fmt.Sprint(item.DataType, "_Develop")
|
|
|
- keyMapTtoalServer = fmt.Sprint(item.DataType, "_Server")
|
|
|
+ keyMapTtoalServer = fmt.Sprint(item.DataType, "_Server_")
|
|
|
var sellerIds []string
|
|
|
var sellerServiceIds []string
|
|
|
for _, vS := range sellerDevelop {
|
|
@@ -610,48 +702,50 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
|
|
|
for _, vS := range sellerService {
|
|
|
+ keyMap = fmt.Sprint(item.DataType, "_Server_", vS.AdminId)
|
|
|
sellerItem := new(statistic_report.RaiDataSummaryDetail)
|
|
|
+ sellerItem.IsServerSeller = true
|
|
|
sellerItem.SellerId = strconv.Itoa(vS.AdminId)
|
|
|
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.ExpiredContractData = fmt.Sprint(utils.SubFloatToString(mapExpiredContractMoney[keyMap], 2), " / ", mapExpiredContractNum[keyMap]) //"到期合同(金额/数量)-(数据)"
|
|
|
- sellerItem.RenewedContractData = fmt.Sprint(utils.SubFloatToString(mapRenewedContractMoney[keyMap], 2), " / ", mapRenewedContractNum[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
|
|
|
var renewalRateNum string
|
|
|
- if mapRenewedContractMoney[keyMap] == 0 || mapExpiredContractMoney[keyMap] == 0 {
|
|
|
+ if mapRenewedContractMoneyServer[keyMap] == 0 || mapExpiredContractMoneyServer[keyMap] == 0 {
|
|
|
renewalRateMoey = "0%"
|
|
|
} else {
|
|
|
- renewalRateMoey = utils.SubFloatToString(mapRenewedContractMoney[keyMap]/mapExpiredContractMoney[keyMap]*100, 2) + "%"
|
|
|
+ renewalRateMoey = utils.SubFloatToString(mapRenewedContractMoneyServer[keyMap]/mapExpiredContractMoneyServer[keyMap]*100, 2) + "%"
|
|
|
}
|
|
|
- if mapRenewedContractCompanyNum[keyMap] == 0 || mapExpiredContractCompanyNum[keyMap] == 0 {
|
|
|
+ if mapRenewedContractCompanyNumServer[keyMap] == 0 || mapExpiredContractCompanyNumServer[keyMap] == 0 {
|
|
|
renewalRateNum = "0%"
|
|
|
} else {
|
|
|
- renewalRateNum = utils.SubFloatToString(float64(mapRenewedContractCompanyNum[keyMap])/float64(mapExpiredContractCompanyNum[keyMap])*100, 2) + "%"
|
|
|
+ renewalRateNum = utils.SubFloatToString(float64(mapRenewedContractCompanyNumServer[keyMap])/float64(mapExpiredContractCompanyNumServer[keyMap])*100, 2) + "%"
|
|
|
}
|
|
|
- sellerItem.RenewalRateData = fmt.Sprint(renewalRateMoey, " / ", renewalRateNum) //"续约率(金额/数量)-(数据)"
|
|
|
- sellerItem.ConfirmedNoRenewalContractData = fmt.Sprint(utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMap], 2), " / ", confirmedNoRenewalContractNum[keyMap]) //"确认不续约合同(金额/数量)-(数据)"
|
|
|
+ sellerItem.RenewalRateData = fmt.Sprint(renewalRateMoey, " / ", renewalRateNum) //"续约率(金额/数量)-(数据)"
|
|
|
+ sellerItem.ConfirmedNoRenewalContractData = fmt.Sprint(utils.SubFloatToString(confirmedNoRenewalContractMoneyServer[keyMap], 2), " / ", confirmedNoRenewalContractNumServer[keyMap]) //"确认不续约合同(金额/数量)-(数据)"
|
|
|
|
|
|
var confirmNonRenewalRateMoey string
|
|
|
var confirmNonRenewalRateNum string
|
|
|
- if confirmedNoRenewalContractMoney[keyMap] == 0 || mapExpiredContractMoney[keyMap] == 0 {
|
|
|
+ if confirmedNoRenewalContractMoneyServer[keyMap] == 0 || mapExpiredContractMoneyServer[keyMap] == 0 {
|
|
|
confirmNonRenewalRateMoey = "0%"
|
|
|
} else {
|
|
|
- confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMap]/mapExpiredContractMoney[keyMap]*100, 2) + "%"
|
|
|
+ confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoneyServer[keyMap]/mapExpiredContractMoneyServer[keyMap]*100, 2) + "%"
|
|
|
}
|
|
|
- if confirmedNoRenewalContractCompanyNum[keyMap] == 0 || mapExpiredContractCompanyNum[keyMap] == 0 {
|
|
|
+ if confirmedNoRenewalContractCompanyNumServer[keyMap] == 0 || mapExpiredContractCompanyNumServer[keyMap] == 0 {
|
|
|
confirmNonRenewalRateNum = "0%"
|
|
|
} else {
|
|
|
- confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractCompanyNum[keyMap])/float64(mapExpiredContractCompanyNum[keyMap])*100, 2) + "%"
|
|
|
+ confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractCompanyNumServer[keyMap])/float64(mapExpiredContractCompanyNumServer[keyMap])*100, 2) + "%"
|
|
|
}
|
|
|
sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
|
|
|
|
|
|
- sellerItem.SignedClientCount = fmt.Sprint(mapSignedClientNum[keyMap]) // 签约客户数量
|
|
|
- if mapSignedClientNum[keyMap] == 0 || mapSignedClientMoney[keyMap] == 0 {
|
|
|
+ sellerItem.SignedClientCount = fmt.Sprint(mapSignedClientNumServer[keyMap]) // 签约客户数量
|
|
|
+ if mapSignedClientNumServer[keyMap] == 0 || mapSignedClientMoneyServer[keyMap] == 0 {
|
|
|
sellerItem.AverageRevenueCount = "0"
|
|
|
} else {
|
|
|
- sellerItem.AverageRevenueCount = utils.SubFloatToString(mapSignedClientMoney[keyMap]/float64(mapSignedClientNum[keyMap]), 2) //客单价
|
|
|
+ sellerItem.AverageRevenueCount = utils.SubFloatToString(mapSignedClientMoneyServer[keyMap]/float64(mapSignedClientNumServer[keyMap]), 2) //客单价
|
|
|
}
|
|
|
|
|
|
sellerItem.InvoiceAmountCount = utils.SubFloatToString(mapInvoiceAmountMoney[keyMap], 2) //"开票金额-(数据)"
|
|
@@ -669,46 +763,47 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
if len(sellerService) > 0 {
|
|
|
sellerItem := new(statistic_report.RaiDataSummaryDetail)
|
|
|
+ sellerItem.IsServerSeller = true
|
|
|
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.ExpiredContractData = fmt.Sprint(utils.SubFloatToString(mapExpiredContractMoney[keyMapTtoalServer], 2), " / ", mapExpiredContractNum[keyMapTtoalServer]) //"到期合同(金额/数量)-(数据)"
|
|
|
- sellerItem.RenewedContractData = fmt.Sprint(utils.SubFloatToString(mapRenewedContractMoney[keyMapTtoalServer], 2), " / ", mapRenewedContractNum[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
|
|
|
var renewalRateNum string
|
|
|
- if mapRenewedContractMoney[keyMapTtoalServer] == 0 || mapExpiredContractMoney[keyMapTtoalServer] == 0 {
|
|
|
+ if mapRenewedContractMoneyServer[keyMapTtoalServer] == 0 || mapExpiredContractMoneyServer[keyMapTtoalServer] == 0 {
|
|
|
renewalRateMoey = "0%"
|
|
|
} else {
|
|
|
- renewalRateMoey = utils.SubFloatToString(mapRenewedContractMoney[keyMapTtoalServer]/mapExpiredContractMoney[keyMapTtoalServer]*100, 2) + "%"
|
|
|
+ renewalRateMoey = utils.SubFloatToString(mapRenewedContractMoneyServer[keyMapTtoalServer]/mapExpiredContractMoneyServer[keyMapTtoalServer]*100, 2) + "%"
|
|
|
}
|
|
|
- if mapRenewedContractCompanyNum[keyMapTtoalServer] == 0 || mapExpiredContractCompanyNum[keyMapTtoalServer] == 0 {
|
|
|
+ if mapRenewedContractCompanyNumServer[keyMapTtoalServer] == 0 || mapExpiredContractCompanyNumServer[keyMapTtoalServer] == 0 {
|
|
|
renewalRateNum = "0%"
|
|
|
} else {
|
|
|
- renewalRateNum = utils.SubFloatToString(float64(mapRenewedContractCompanyNum[keyMapTtoalServer])/float64(mapExpiredContractCompanyNum[keyMapTtoalServer])*100, 2) + "%"
|
|
|
+ renewalRateNum = utils.SubFloatToString(float64(mapRenewedContractCompanyNumServer[keyMapTtoalServer])/float64(mapExpiredContractCompanyNumServer[keyMapTtoalServer])*100, 2) + "%"
|
|
|
}
|
|
|
- sellerItem.RenewalRateData = fmt.Sprint(renewalRateMoey, " / ", renewalRateNum) //"续约率(金额/数量)-(数据)"
|
|
|
- sellerItem.ConfirmedNoRenewalContractData = fmt.Sprint(utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMapTtoalServer], 2), " / ", confirmedNoRenewalContractNum[keyMapTtoalServer]) //"确认不续约合同(金额/数量)-(数据)"
|
|
|
+ sellerItem.RenewalRateData = fmt.Sprint(renewalRateMoey, " / ", renewalRateNum) //"续约率(金额/数量)-(数据)"
|
|
|
+ sellerItem.ConfirmedNoRenewalContractData = fmt.Sprint(utils.SubFloatToString(confirmedNoRenewalContractMoneyServer[keyMapTtoalServer], 2), " / ", confirmedNoRenewalContractNumServer[keyMapTtoalServer]) //"确认不续约合同(金额/数量)-(数据)"
|
|
|
|
|
|
var confirmNonRenewalRateMoey string
|
|
|
var confirmNonRenewalRateNum string
|
|
|
- if confirmedNoRenewalContractMoney[keyMapTtoalServer] == 0 || mapExpiredContractMoney[keyMapTtoalServer] == 0 {
|
|
|
+ if confirmedNoRenewalContractMoneyServer[keyMapTtoalServer] == 0 || mapExpiredContractMoneyServer[keyMapTtoalServer] == 0 {
|
|
|
confirmNonRenewalRateMoey = "0%"
|
|
|
} else {
|
|
|
- confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMapTtoalServer]/mapExpiredContractMoney[keyMapTtoalServer]*100, 2) + "%"
|
|
|
+ confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoneyServer[keyMapTtoalServer]/mapExpiredContractMoneyServer[keyMapTtoalServer]*100, 2) + "%"
|
|
|
}
|
|
|
- if confirmedNoRenewalContractCompanyNum[keyMapTtoalServer] == 0 || mapExpiredContractCompanyNum[keyMapTtoalServer] == 0 {
|
|
|
+ if confirmedNoRenewalContractCompanyNumServer[keyMapTtoalServer] == 0 || mapExpiredContractCompanyNumServer[keyMapTtoalServer] == 0 {
|
|
|
confirmNonRenewalRateNum = "0%"
|
|
|
} else {
|
|
|
- confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractCompanyNum[keyMapTtoalServer])/float64(mapExpiredContractCompanyNum[keyMapTtoalServer])*100, 2) + "%"
|
|
|
+ confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractCompanyNumServer[keyMapTtoalServer])/float64(mapExpiredContractCompanyNumServer[keyMapTtoalServer])*100, 2) + "%"
|
|
|
}
|
|
|
sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
|
|
|
|
|
|
- sellerItem.SignedClientCount = fmt.Sprint(mapSignedClientNum[keyMapTtoalServer]) // 签约客户数量
|
|
|
- if mapSignedClientNum[keyMapTtoalServer] == 0 || mapSignedClientMoney[keyMapTtoalServer] == 0 {
|
|
|
+ sellerItem.SignedClientCount = fmt.Sprint(mapSignedClientNumServer[keyMapTtoalServer]) // 签约客户数量
|
|
|
+ if mapSignedClientNumServer[keyMapTtoalServer] == 0 || mapSignedClientMoneyServer[keyMapTtoalServer] == 0 {
|
|
|
sellerItem.AverageRevenueCount = "0"
|
|
|
} else {
|
|
|
- sellerItem.AverageRevenueCount = utils.SubFloatToString(mapSignedClientMoney[keyMapTtoalServer]/float64(mapSignedClientNum[keyMapTtoalServer]), 2) //客单价
|
|
|
+ sellerItem.AverageRevenueCount = utils.SubFloatToString(mapSignedClientMoneyServer[keyMapTtoalServer]/float64(mapSignedClientNumServer[keyMapTtoalServer]), 2) //客单价
|
|
|
}
|
|
|
|
|
|
sellerItem.InvoiceAmountCount = utils.SubFloatToString(mapInvoiceAmountMoney[keyMapTtoalServer], 2) //"开票金额-(数据)"
|
|
@@ -738,6 +833,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
// @Param SellerId query int true "销售ID"
|
|
|
// @Param DataType query string false "报表类型,枚举值:`季度`,`年度`,`半年度`"
|
|
|
// @Param PopupType query string false "弹窗数据类型,枚举值:"
|
|
|
+// @Param IsServerSeller query bool false "是否属于服务组销售"
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Success 200 {object} statistic_report.RaiDataSummaryPopupTypeResp
|
|
@@ -761,6 +857,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
dataType := this.GetString("DataType")
|
|
|
sellerId := this.GetString("SellerId")
|
|
|
popupType := this.GetString("PopupType")
|
|
|
+ isServerSeller, _ := this.GetBool("IsServerSeller")
|
|
|
|
|
|
var startSize int
|
|
|
if pageSize <= 0 {
|
|
@@ -862,6 +959,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
} else if v.Operation == "receive" || v.Operation == "apply_receive" {
|
|
|
item.AddType = "领取"
|
|
|
}
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
item.CompanyName = v.CompanyName
|
|
|
item.SellerName = v.SellerName
|
|
|
item.CreateTime = v.CreateTime
|
|
@@ -908,6 +1006,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
for _, v := range tmpList {
|
|
|
item := new(statistic_report.RaiDataSummaryDetailResp)
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
item.CompanyName = v.CompanyName
|
|
|
item.SellerName = v.SellerNameInit
|
|
|
item.StartDate = v.StartDate
|
|
@@ -929,7 +1028,12 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
case "到期合同":
|
|
|
|
|
|
if sellerId != "" {
|
|
|
- condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
+ if isServerSeller {
|
|
|
+ condition += ` AND a.share_seller_id_last IN (` + sellerId + `) `
|
|
|
+ } else {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
condition += ` AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? AND a.end_date < ? `
|
|
@@ -943,7 +1047,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
trialTotal = total
|
|
|
//列表页数据
|
|
|
- tmpList, err := models.GetIncrementalCompanyMergeList(condition, pars, startSize, pageSize)
|
|
|
+ tmpList, err := models.GetIncrementalCompanyMergeListEnd(condition, pars, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
@@ -964,6 +1068,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
for _, v := range tmpList {
|
|
|
item := new(statistic_report.RaiDataSummaryDetailResp)
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
item.CompanyName = v.CompanyName
|
|
|
item.SellerName = v.SellerNameLast
|
|
|
item.StartDate = v.StartDate
|
|
@@ -982,7 +1087,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
case "续约合同":
|
|
|
if sellerId != "" {
|
|
|
- condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
+ if isServerSeller {
|
|
|
+ condition += ` AND a.share_seller_id_last IN (` + sellerId + `) `
|
|
|
+ } else {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
condition += ` AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? AND a.inherit_company_contract_id > 0 AND a.rai_contract_type = '续约合同' AND a.company_id NOT IN (` + utils.GetOrmInReplace(lenArrCompany) + `) `
|
|
@@ -1017,6 +1126,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
for _, v := range tmpList {
|
|
|
item := new(statistic_report.RaiDataSummaryDetailResp)
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
item.CompanyName = v.CompanyName
|
|
|
item.SellerName = v.SellerNameLast
|
|
|
item.StartDate = v.StartDate
|
|
@@ -1122,7 +1232,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
condition += ` AND a.company_contract_id IN (` + utils.GetOrmInReplace(len(noRenewedcompanyContractIds)) + `) ` // 已确认
|
|
|
pars = append(pars, noRenewedcompanyContractIds)
|
|
|
if sellerId != "" {
|
|
|
- condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
+ if isServerSeller {
|
|
|
+ condition += ` AND a.share_seller_id_last IN (` + sellerId + `) `
|
|
|
+ } else {
|
|
|
+ condition += ` AND a.seller_id_last IN (` + sellerId + `) `
|
|
|
+ }
|
|
|
}
|
|
|
condition += ` AND a.product_id = 2 AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? AND a.end_date <= ? `
|
|
|
pars = append(pars, startDate, endDate, time.Now().Format(utils.FormatDate))
|
|
@@ -1156,6 +1270,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
for _, v := range tmpList {
|
|
|
item := new(statistic_report.RaiDataSummaryDetailResp)
|
|
|
+ item.CompanyId = v.CompanyId
|
|
|
item.CompanyName = v.CompanyName
|
|
|
item.SellerName = v.SellerNameInit
|
|
|
item.StartDate = v.StartDate
|
|
@@ -1595,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
|
|
|
+}
|