|
@@ -64,16 +64,13 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
//var dateIntervalArr []statistic_report.DateInterval //时间区间
|
|
|
if dataType == "季度" {
|
|
|
dataTypeArr = []string{"Q1", "Q2", "Q3", "Q4"}
|
|
|
- //dateIntervalArr = []statistic_report.DateInterval{statistic_report.DateInterval{StartDate: "01-01", EndDate: "03-31"}, statistic_report.DateInterval{StartDate: "04-01", EndDate: "06-30"}, statistic_report.DateInterval{StartDate: "07-01", EndDate: "09-30"}, statistic_report.DateInterval{StartDate: "10-01", EndDate: "12-31"}}
|
|
|
} else if dataType == "半年度" {
|
|
|
dataTypeArr = []string{"H1", "H2"}
|
|
|
- //dateIntervalArr = []statistic_report.DateInterval{statistic_report.DateInterval{StartDate: "01-01", EndDate: "06-30"}, statistic_report.DateInterval{StartDate: "07-01", EndDate: "12-31"}}
|
|
|
} else {
|
|
|
dataTypeArr = []string{""}
|
|
|
- //dateIntervalArr = []statistic_report.DateInterval{statistic_report.DateInterval{StartDate: "01-01", EndDate: "12-31"}}
|
|
|
}
|
|
|
|
|
|
- condition := " AND role_type_code IN ('rai_seller','rai_group') AND enabled = 1 AND rai_enabled = 1"
|
|
|
+ condition := " AND role_type_code IN ('rai_seller','rai_group') AND enabled = 1 AND rai_enabled = 1 "
|
|
|
var pars []interface{}
|
|
|
if adminId != "" {
|
|
|
serviceAdminId = ""
|
|
@@ -97,6 +94,17 @@ 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
|
|
|
+ for _, v := range sellerList {
|
|
|
+ if strings.Contains(v.RealName, "6") {
|
|
|
+ sellerService = append(sellerService, v)
|
|
|
+ } else {
|
|
|
+ sellerDevelop = append(sellerDevelop, v)
|
|
|
+ sellerDevelopIds[v.AdminId] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//拼接起始时间查询
|
|
|
startDate := fmt.Sprintf("%d-01-01", startYear)
|
|
@@ -143,6 +151,25 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
mapNewCustomerInvoicingMoney := make(map[string]float64) // 财务系统新客开票金额(金额)
|
|
|
mapNewCustomerPaymentsReceivedMoney := make(map[string]float64) // 财务系统新客到款金额(金额)
|
|
|
|
|
|
+ //mapAddTrialNumTotal := make(map[string]float64) // 新增试用-(数据)_总计
|
|
|
+ //mapNewContractMoneyTotal := make(map[string]float64) // 新签合同(金额)_总计
|
|
|
+ //mapNewContractNumTotal := make(map[string]int) // 新签合同(数量)_总计
|
|
|
+ //mapExpiredContractMoneyTotal := make(map[string]float64) // 到期合同(金额)_总计
|
|
|
+ //mapExpiredContractNumTotal := make(map[string]int) // 到期合同(数量)_总计
|
|
|
+ //mapRenewedContractMoneyTotal := make(map[string]float64) // 续约合同(金额)_总计
|
|
|
+ //mapRenewedContractNumTotal := make(map[string]int) // 续约合同(数量)_总计
|
|
|
+ //confirmedNoRenewalContractMoneyTotal := make(map[string]float64) // 确认不续约合同(金额)_总计
|
|
|
+ //confirmedNoRenewalContractNumTotal := make(map[string]int) // 确认不续约合同(数量)_总计
|
|
|
+ //mapSignedClientNumTotal := make(map[string]int) // 签约客户(数量)_总计
|
|
|
+ //mapSignedClientMoneyTotal := make(map[string]float64) // 签约客户(金额)_总计
|
|
|
+ //mapInvoiceAmountMoneyTotal := make(map[string]float64) // 财务系统开票金额(金额)_总计
|
|
|
+ //mapPaymentAmountMoneyTotal := make(map[string]float64) // 财务系统到款金额(金额)_总计
|
|
|
+ //mapNewCustomerInvoicingMoneyTotal := make(map[string]float64) // 财务系统新客开票金额(金额)_总计
|
|
|
+ //mapNewCustomerPaymentsReceivedMoneyTotal := make(map[string]float64) // 财务系统新客到款金额(金额)_总计
|
|
|
+
|
|
|
+ var keyMap string
|
|
|
+ var keyMapTtoal string
|
|
|
+ var keyMapTtoalServer string
|
|
|
for _, v := range listRaiData {
|
|
|
startDateTime := utils.StrDateToDate(v.StartDate)
|
|
|
monthNum := startDateTime.Month()
|
|
@@ -165,27 +192,47 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- keyMap := fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
+ keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
+ if sellerDevelopIds[v.SellerIdLast] == true {
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
+ } else {
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Service")
|
|
|
+ }
|
|
|
|
|
|
if v.RaiContractType == "新签合同" {
|
|
|
mapNewContractMoney[keyMap] += v.Money
|
|
|
mapNewContractNum[keyMap]++
|
|
|
+
|
|
|
+ mapNewContractMoney[keyMapTtoal] += v.Money
|
|
|
+ mapNewContractNum[keyMapTtoal]++
|
|
|
} else if v.RaiContractType == "续约合同" {
|
|
|
mapRenewedContractMoney[keyMap] += v.Money
|
|
|
mapRenewedContractNum[keyMap]++
|
|
|
+
|
|
|
+ mapRenewedContractMoney[keyMapTtoal] += v.Money
|
|
|
+ mapRenewedContractNum[keyMapTtoal]++
|
|
|
}
|
|
|
|
|
|
if startDateTime.Before(time.Now().AddDate(0, 0, -1)) { //到期合同数据
|
|
|
mapExpiredContractMoney[keyMap] += v.Money
|
|
|
mapExpiredContractNum[keyMap]++
|
|
|
+
|
|
|
+ mapExpiredContractMoney[keyMapTtoal] += v.Money
|
|
|
+ mapExpiredContractNum[keyMapTtoal]++
|
|
|
}
|
|
|
|
|
|
if mapNoRenewedcompanyContractIds[v.CompanyContractId] { // 确认不续约合同
|
|
|
confirmedNoRenewalContractMoney[keyMap] += v.Money
|
|
|
confirmedNoRenewalContractNum[keyMap]++
|
|
|
+
|
|
|
+ confirmedNoRenewalContractMoney[keyMapTtoal] += v.Money
|
|
|
+ confirmedNoRenewalContractNum[keyMapTtoal]++
|
|
|
}
|
|
|
mapSignedClientMoney[keyMap] += v.Money
|
|
|
mapSignedClientNum[keyMap]++
|
|
|
+
|
|
|
+ mapSignedClientMoney[keyMapTtoal] += v.Money
|
|
|
+ mapSignedClientNum[keyMapTtoal]++
|
|
|
}
|
|
|
|
|
|
listFmsData, err := fms.GetContractRegisterListByStartDate(startDate, endDate)
|
|
@@ -218,12 +265,22 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
|
|
|
keyMap := fmt.Sprint(yearStr, "_", v.RaiSellerId)
|
|
|
+
|
|
|
+ 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
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -258,27 +315,19 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
yearStr += "H2"
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
keyMap := fmt.Sprint(yearStr, "_", v.SysUserId)
|
|
|
mapAddTrialNum[keyMap]++
|
|
|
- }
|
|
|
|
|
|
- //fmt.Println(time.Now().AddDate(0, 0, -1))
|
|
|
- //return
|
|
|
- var sellerDevelop []*system.AdminItem // 开拓组销售
|
|
|
- var sellerService []*system.AdminItem // 服务组销售
|
|
|
- for _, v := range sellerList {
|
|
|
- if strings.Contains(v.RealName, "6") {
|
|
|
- sellerService = append(sellerService, v)
|
|
|
+ //var keyMapTtoal string
|
|
|
+ sysUserId, _ := strconv.Atoi(v.SysUserId)
|
|
|
+ if sellerDevelopIds[sysUserId] == true {
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
} else {
|
|
|
- sellerDevelop = append(sellerDevelop, v)
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Service")
|
|
|
}
|
|
|
+ mapAddTrialNum[keyMapTtoal]++
|
|
|
}
|
|
|
|
|
|
- //for _, v := range dateIntervalArr {
|
|
|
- // fmt.Println(v)
|
|
|
- //}
|
|
|
-
|
|
|
resp := new(statistic_report.RaiDataSummaryListResp)
|
|
|
var items []*statistic_report.RaiDataSummaryResp
|
|
|
for i := startYear; i <= endYear; i++ {
|
|
@@ -286,10 +335,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
for _, Dv := range dataTypeArr {
|
|
|
item := new(statistic_report.RaiDataSummaryResp)
|
|
|
item.DataType = fmt.Sprint(i, Dv)
|
|
|
- //fmt.Println("DataType", item.DataType)
|
|
|
-
|
|
|
+ keyMapTtoal = fmt.Sprint(item.DataType, "_Develop")
|
|
|
+ keyMapTtoalServer = fmt.Sprint(item.DataType, "_Server")
|
|
|
for _, vS := range sellerDevelop {
|
|
|
- keyMap := fmt.Sprint(item.DataType, "_", vS.AdminId)
|
|
|
+ keyMap = fmt.Sprint(item.DataType, "_", vS.AdminId)
|
|
|
sellerItem := new(statistic_report.RaiDataSummaryDetail)
|
|
|
sellerItem.SellerId = vS.AdminId
|
|
|
sellerItem.SellerName = vS.RealName
|
|
@@ -348,6 +397,55 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if len(sellerDevelop) > 0 {
|
|
|
sellerItem := new(statistic_report.RaiDataSummaryDetail)
|
|
|
sellerItem.SellerName = "开拓组合计"
|
|
|
+ sellerItem.AddTrialCount = fmt.Sprint(mapAddTrialNum[keyMapTtoal])
|
|
|
+ sellerItem.NewContractData = fmt.Sprint(utils.SubFloatToString(mapNewContractMoney[keyMapTtoal], 2), " / ", mapNewContractNum[keyMapTtoal]) // 新签合同(金额/数量)-(数据)
|
|
|
+ sellerItem.ExpiredContractData = fmt.Sprint(utils.SubFloatToString(mapExpiredContractMoney[keyMapTtoal], 2), " / ", mapExpiredContractNum[keyMapTtoal]) //"到期合同(金额/数量)-(数据)"
|
|
|
+ sellerItem.RenewedContractData = fmt.Sprint(utils.SubFloatToString(mapRenewedContractMoney[keyMapTtoal], 2), " / ", mapRenewedContractNum[keyMapTtoal]) // "续约合同(金额/数量)-(数据)"
|
|
|
+ var renewalRateMoey string
|
|
|
+ var renewalRateNum string
|
|
|
+ if mapRenewedContractMoney[keyMapTtoal] == 0 || mapExpiredContractMoney[keyMapTtoal] == 0 {
|
|
|
+ renewalRateMoey = "0%"
|
|
|
+ } else {
|
|
|
+ renewalRateMoey = utils.SubFloatToString(mapRenewedContractMoney[keyMapTtoal]/mapExpiredContractMoney[keyMapTtoal]*100, 2) + "%"
|
|
|
+ }
|
|
|
+ if mapRenewedContractNum[keyMapTtoal] == 0 || mapExpiredContractNum[keyMapTtoal] == 0 {
|
|
|
+ renewalRateNum = "0%"
|
|
|
+ } else {
|
|
|
+ renewalRateNum = utils.SubFloatToString(float64(mapRenewedContractNum[keyMapTtoal])/float64(mapExpiredContractNum[keyMapTtoal])*100, 2) + "%"
|
|
|
+ }
|
|
|
+ sellerItem.RenewalRateData = fmt.Sprint(renewalRateMoey, " / ", renewalRateNum) //"续约率(金额/数量)-(数据)"
|
|
|
+ sellerItem.ConfirmedNoRenewalContractData = fmt.Sprint(utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMapTtoal], 2), " / ", confirmedNoRenewalContractNum[keyMapTtoal]) //"确认不续约合同(金额/数量)-(数据)"
|
|
|
+
|
|
|
+ var confirmNonRenewalRateMoey string
|
|
|
+ var confirmNonRenewalRateNum string
|
|
|
+ if confirmedNoRenewalContractMoney[keyMapTtoal] == 0 || mapExpiredContractMoney[keyMapTtoal] == 0 {
|
|
|
+ confirmNonRenewalRateMoey = "0%"
|
|
|
+ } else {
|
|
|
+ confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMapTtoal]/mapExpiredContractMoney[keyMapTtoal]*100, 2) + "%"
|
|
|
+ }
|
|
|
+ if confirmedNoRenewalContractNum[keyMapTtoal] == 0 || mapExpiredContractNum[keyMapTtoal] == 0 {
|
|
|
+ confirmNonRenewalRateNum = "0%"
|
|
|
+ } else {
|
|
|
+ confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractNum[keyMapTtoal])/float64(mapExpiredContractNum[keyMapTtoal])*100, 2) + "%"
|
|
|
+ }
|
|
|
+ sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
|
|
|
+
|
|
|
+ sellerItem.SignedClientCount = fmt.Sprint(mapSignedClientNum[keyMapTtoal]) // 签约客户数量
|
|
|
+ if mapSignedClientNum[keyMapTtoal] == 0 || mapSignedClientMoney[keyMapTtoal] == 0 {
|
|
|
+ sellerItem.AverageRevenueCount = "0"
|
|
|
+ } else {
|
|
|
+ sellerItem.AverageRevenueCount = utils.SubFloatToString(mapSignedClientMoney[keyMapTtoal]/float64(mapSignedClientNum[keyMapTtoal]), 2) //客单价
|
|
|
+ }
|
|
|
+
|
|
|
+ sellerItem.InvoiceAmountCount = utils.SubFloatToString(mapInvoiceAmountMoney[keyMapTtoal], 2) //"开票金额-(数据)"
|
|
|
+ sellerItem.PaymentReceivedCount = utils.SubFloatToString(mapPaymentAmountMoney[keyMapTtoal], 2) //"开票金额-(数据)"
|
|
|
+ if mapInvoiceAmountMoney[keyMapTtoal] == 0 || mapPaymentAmountMoney[keyMapTtoal] == 0 {
|
|
|
+ sellerItem.UnpaidRatioCount = "0%"
|
|
|
+ } else {
|
|
|
+ sellerItem.UnpaidRatioCount = utils.SubFloatToString((mapInvoiceAmountMoney[keyMapTtoal]-mapPaymentAmountMoney[keyMapTtoal])/mapInvoiceAmountMoney[keyMapTtoal]*100, 2) + "%" //"未到款比例-(数据)"
|
|
|
+ }
|
|
|
+ sellerItem.NewCustomerInvoicingCount = utils.SubFloatToString(mapNewCustomerInvoicingMoney[keyMapTtoal], 2) // "新客开票-(数据)"
|
|
|
+ sellerItem.NewCustomerPaymentsReceivedCount = utils.SubFloatToString(mapNewCustomerPaymentsReceivedMoney[keyMapTtoal], 2) // "新客到款-(数据)"
|
|
|
item.DataList = append(item.DataList, sellerItem)
|
|
|
}
|
|
|
|
|
@@ -355,25 +453,109 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
sellerItem := new(statistic_report.RaiDataSummaryDetail)
|
|
|
sellerItem.SellerId = vS.AdminId
|
|
|
sellerItem.SellerName = vS.RealName
|
|
|
- sellerItem.AddTrialCount = "新增试用-(数据)"
|
|
|
- sellerItem.NewContractData = "新签合同(金额/数量)-(数据)"
|
|
|
- sellerItem.ExpiredContractData = "到期合同(金额/数量)-(数据)"
|
|
|
- sellerItem.RenewedContractData = "续约合同(金额/数量)-(数据)"
|
|
|
- sellerItem.RenewalRateData = "续约率(金额/数量)-(数据)"
|
|
|
- sellerItem.ConfirmedNoRenewalContractData = "确认不续约合同(金额/数量)-(数据)"
|
|
|
- sellerItem.ConfirmNonRenewalRateData = "确认不续约率(金额/数量)-(数据)"
|
|
|
- sellerItem.SignedClientCount = "签约客户数量-(数据)"
|
|
|
- sellerItem.AverageRevenueCount = "客单价-(数据)"
|
|
|
- sellerItem.InvoiceAmountCount = "开票金额-(数据)"
|
|
|
- sellerItem.PaymentReceivedCount = "到款金额-(数据)"
|
|
|
- sellerItem.UnpaidRatioCount = "未到款比例-(数据)"
|
|
|
- sellerItem.NewCustomerInvoicingCount = "新客开票-(数据)"
|
|
|
- sellerItem.NewCustomerPaymentsReceivedCount = "新客到款-(数据)"
|
|
|
+ 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]) // "续约合同(金额/数量)-(数据)"
|
|
|
+ var renewalRateMoey string
|
|
|
+ var renewalRateNum string
|
|
|
+ if mapRenewedContractMoney[keyMap] == 0 || mapExpiredContractMoney[keyMap] == 0 {
|
|
|
+ renewalRateMoey = "0%"
|
|
|
+ } else {
|
|
|
+ renewalRateMoey = utils.SubFloatToString(mapRenewedContractMoney[keyMap]/mapExpiredContractMoney[keyMap]*100, 2) + "%"
|
|
|
+ }
|
|
|
+ if mapRenewedContractNum[keyMap] == 0 || mapExpiredContractNum[keyMap] == 0 {
|
|
|
+ renewalRateNum = "0%"
|
|
|
+ } else {
|
|
|
+ renewalRateNum = utils.SubFloatToString(float64(mapRenewedContractNum[keyMap])/float64(mapExpiredContractNum[keyMap])*100, 2) + "%"
|
|
|
+ }
|
|
|
+ sellerItem.RenewalRateData = fmt.Sprint(renewalRateMoey, " / ", renewalRateNum) //"续约率(金额/数量)-(数据)"
|
|
|
+ sellerItem.ConfirmedNoRenewalContractData = fmt.Sprint(utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMap], 2), " / ", confirmedNoRenewalContractNum[keyMap]) //"确认不续约合同(金额/数量)-(数据)"
|
|
|
+
|
|
|
+ var confirmNonRenewalRateMoey string
|
|
|
+ var confirmNonRenewalRateNum string
|
|
|
+ if confirmedNoRenewalContractMoney[keyMap] == 0 || mapExpiredContractMoney[keyMap] == 0 {
|
|
|
+ confirmNonRenewalRateMoey = "0%"
|
|
|
+ } else {
|
|
|
+ confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMap]/mapExpiredContractMoney[keyMap]*100, 2) + "%"
|
|
|
+ }
|
|
|
+ if confirmedNoRenewalContractNum[keyMap] == 0 || mapExpiredContractNum[keyMap] == 0 {
|
|
|
+ confirmNonRenewalRateNum = "0%"
|
|
|
+ } else {
|
|
|
+ confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractNum[keyMap])/float64(mapExpiredContractNum[keyMap])*100, 2) + "%"
|
|
|
+ }
|
|
|
+ sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
|
|
|
+
|
|
|
+ sellerItem.SignedClientCount = fmt.Sprint(mapSignedClientNum[keyMap]) // 签约客户数量
|
|
|
+ if mapSignedClientNum[keyMap] == 0 || mapSignedClientMoney[keyMap] == 0 {
|
|
|
+ sellerItem.AverageRevenueCount = "0"
|
|
|
+ } else {
|
|
|
+ sellerItem.AverageRevenueCount = utils.SubFloatToString(mapSignedClientMoney[keyMap]/float64(mapSignedClientNum[keyMap]), 2) //客单价
|
|
|
+ }
|
|
|
+
|
|
|
+ sellerItem.InvoiceAmountCount = utils.SubFloatToString(mapInvoiceAmountMoney[keyMap], 2) //"开票金额-(数据)"
|
|
|
+ sellerItem.PaymentReceivedCount = utils.SubFloatToString(mapPaymentAmountMoney[keyMap], 2) //"开票金额-(数据)"
|
|
|
+ if mapInvoiceAmountMoney[keyMap] == 0 || mapPaymentAmountMoney[keyMap] == 0 {
|
|
|
+ sellerItem.UnpaidRatioCount = "0%"
|
|
|
+ } else {
|
|
|
+ sellerItem.UnpaidRatioCount = utils.SubFloatToString((mapInvoiceAmountMoney[keyMap]-mapPaymentAmountMoney[keyMap])/mapInvoiceAmountMoney[keyMap]*100, 2) + "%" //"未到款比例-(数据)"
|
|
|
+ }
|
|
|
+ sellerItem.NewCustomerInvoicingCount = utils.SubFloatToString(mapNewCustomerInvoicingMoney[keyMap], 2) // "新客开票-(数据)"
|
|
|
+ sellerItem.NewCustomerPaymentsReceivedCount = utils.SubFloatToString(mapNewCustomerPaymentsReceivedMoney[keyMap], 2) // "新客到款-(数据)"
|
|
|
item.DataList = append(item.DataList, sellerItem)
|
|
|
}
|
|
|
if len(sellerService) > 0 {
|
|
|
sellerItem := new(statistic_report.RaiDataSummaryDetail)
|
|
|
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]) // "续约合同(金额/数量)-(数据)"
|
|
|
+ var renewalRateMoey string
|
|
|
+ var renewalRateNum string
|
|
|
+ if mapRenewedContractMoney[keyMapTtoalServer] == 0 || mapExpiredContractMoney[keyMapTtoalServer] == 0 {
|
|
|
+ renewalRateMoey = "0%"
|
|
|
+ } else {
|
|
|
+ renewalRateMoey = utils.SubFloatToString(mapRenewedContractMoney[keyMapTtoalServer]/mapExpiredContractMoney[keyMapTtoalServer]*100, 2) + "%"
|
|
|
+ }
|
|
|
+ if mapRenewedContractNum[keyMapTtoalServer] == 0 || mapExpiredContractNum[keyMapTtoalServer] == 0 {
|
|
|
+ renewalRateNum = "0%"
|
|
|
+ } else {
|
|
|
+ renewalRateNum = utils.SubFloatToString(float64(mapRenewedContractNum[keyMapTtoalServer])/float64(mapExpiredContractNum[keyMapTtoalServer])*100, 2) + "%"
|
|
|
+ }
|
|
|
+ sellerItem.RenewalRateData = fmt.Sprint(renewalRateMoey, " / ", renewalRateNum) //"续约率(金额/数量)-(数据)"
|
|
|
+ sellerItem.ConfirmedNoRenewalContractData = fmt.Sprint(utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMapTtoalServer], 2), " / ", confirmedNoRenewalContractNum[keyMapTtoalServer]) //"确认不续约合同(金额/数量)-(数据)"
|
|
|
+
|
|
|
+ var confirmNonRenewalRateMoey string
|
|
|
+ var confirmNonRenewalRateNum string
|
|
|
+ if confirmedNoRenewalContractMoney[keyMapTtoalServer] == 0 || mapExpiredContractMoney[keyMapTtoalServer] == 0 {
|
|
|
+ confirmNonRenewalRateMoey = "0%"
|
|
|
+ } else {
|
|
|
+ confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMapTtoalServer]/mapExpiredContractMoney[keyMapTtoalServer]*100, 2) + "%"
|
|
|
+ }
|
|
|
+ if confirmedNoRenewalContractNum[keyMapTtoalServer] == 0 || mapExpiredContractNum[keyMapTtoalServer] == 0 {
|
|
|
+ confirmNonRenewalRateNum = "0%"
|
|
|
+ } else {
|
|
|
+ confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractNum[keyMapTtoalServer])/float64(mapExpiredContractNum[keyMapTtoalServer])*100, 2) + "%"
|
|
|
+ }
|
|
|
+ sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
|
|
|
+
|
|
|
+ sellerItem.SignedClientCount = fmt.Sprint(mapSignedClientNum[keyMapTtoalServer]) // 签约客户数量
|
|
|
+ if mapSignedClientNum[keyMapTtoalServer] == 0 || mapSignedClientMoney[keyMapTtoalServer] == 0 {
|
|
|
+ sellerItem.AverageRevenueCount = "0"
|
|
|
+ } else {
|
|
|
+ sellerItem.AverageRevenueCount = utils.SubFloatToString(mapSignedClientMoney[keyMapTtoalServer]/float64(mapSignedClientNum[keyMapTtoalServer]), 2) //客单价
|
|
|
+ }
|
|
|
+
|
|
|
+ sellerItem.InvoiceAmountCount = utils.SubFloatToString(mapInvoiceAmountMoney[keyMapTtoalServer], 2) //"开票金额-(数据)"
|
|
|
+ sellerItem.PaymentReceivedCount = utils.SubFloatToString(mapPaymentAmountMoney[keyMapTtoalServer], 2) //"开票金额-(数据)"
|
|
|
+ if mapInvoiceAmountMoney[keyMapTtoalServer] == 0 || mapPaymentAmountMoney[keyMapTtoalServer] == 0 {
|
|
|
+ sellerItem.UnpaidRatioCount = "0%"
|
|
|
+ } else {
|
|
|
+ sellerItem.UnpaidRatioCount = utils.SubFloatToString((mapInvoiceAmountMoney[keyMapTtoalServer]-mapPaymentAmountMoney[keyMapTtoalServer])/mapInvoiceAmountMoney[keyMapTtoalServer]*100, 2) + "%" //"未到款比例-(数据)"
|
|
|
+ }
|
|
|
+ sellerItem.NewCustomerInvoicingCount = utils.SubFloatToString(mapNewCustomerInvoicingMoney[keyMapTtoalServer], 2) // "新客开票-(数据)"
|
|
|
+ sellerItem.NewCustomerPaymentsReceivedCount = utils.SubFloatToString(mapNewCustomerPaymentsReceivedMoney[keyMapTtoalServer], 2) // "新客到款-(数据)"
|
|
|
item.DataList = append(item.DataList, sellerItem)
|
|
|
}
|
|
|
items = append(items, item)
|