|
@@ -178,6 +178,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
var keyMap string
|
|
|
var keyMapTtoal string
|
|
|
var keyMapTtoalServer string
|
|
|
+ var keyMapCompany string
|
|
|
+ var keyMapCompanyNo string
|
|
|
+ var keySigned string
|
|
|
+
|
|
|
+ mapCompanyData := make(map[string]bool)
|
|
|
//新签部分的数据
|
|
|
for _, v := range listRaiData {
|
|
|
startDateTime := utils.StrDateToDate(v.StartDate)
|
|
@@ -202,6 +207,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
+ keySigned = fmt.Sprint(yearStr, "_", "_CID_", v.CompanyId)
|
|
|
+
|
|
|
if sellerDevelopIds[v.SellerIdLast] == true {
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
} else {
|
|
@@ -239,13 +246,18 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
// confirmedNoRenewalContractNum[keyMapTtoal]++
|
|
|
//}
|
|
|
mapSignedClientMoney[keyMap] += v.Money
|
|
|
- mapSignedClientNum[keyMap]++
|
|
|
|
|
|
mapSignedClientMoney[keyMapTtoal] += v.Money
|
|
|
- mapSignedClientNum[keyMapTtoal]++
|
|
|
+
|
|
|
+ if !mapCompanyData[keySigned] {
|
|
|
+ mapSignedClientNum[keyMap]++
|
|
|
+ mapSignedClientNum[keyMapTtoal]++
|
|
|
+ mapCompanyData[keySigned] = true
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//续约部分的数据
|
|
|
+ mapKeyMapCompanyData := make(map[string]bool)
|
|
|
for _, v := range listInheritData {
|
|
|
startDateTime := utils.StrDateToDate(v.InheritEndDate)
|
|
|
monthNum := startDateTime.Month()
|
|
@@ -269,6 +281,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
+ keyMapCompany = fmt.Sprint(yearStr, "_", v.SellerIdLast, "_CID_", v.CompanyId)
|
|
|
if sellerDevelopIds[v.SellerIdLast] == true {
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
} else {
|
|
@@ -277,13 +290,20 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
//续约合同 数据
|
|
|
mapRenewedContractMoney[keyMap] += v.Money
|
|
|
- mapRenewedContractNum[keyMap]++
|
|
|
|
|
|
mapRenewedContractMoney[keyMapTtoal] += v.Money
|
|
|
- mapRenewedContractNum[keyMapTtoal]++
|
|
|
+
|
|
|
+ //一家公司同一个时间纬度,只统计一次
|
|
|
+ if !mapKeyMapCompanyData[keyMapCompany] {
|
|
|
+ mapRenewedContractNum[keyMap]++
|
|
|
+ mapRenewedContractNum[keyMapTtoal]++
|
|
|
+ mapKeyMapCompanyData[keyMapCompany] = true
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//确认不续约、到期合同部分的数据
|
|
|
+ mapKeyMapCompanyEndData := make(map[string]bool)
|
|
|
+ mapKeyMapCompanyNoData := make(map[string]bool)
|
|
|
for _, v := range listEndData {
|
|
|
startDateTime := utils.StrDateToDate(v.EndDate)
|
|
|
monthNum := startDateTime.Month()
|
|
@@ -307,6 +327,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
}
|
|
|
|
|
|
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 {
|
|
@@ -315,17 +337,26 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
//到期合同数据
|
|
|
mapExpiredContractMoney[keyMap] += v.Money
|
|
|
- mapExpiredContractNum[keyMap]++
|
|
|
-
|
|
|
mapExpiredContractMoney[keyMapTtoal] += v.Money
|
|
|
- mapExpiredContractNum[keyMapTtoal]++
|
|
|
+
|
|
|
+ //一家公司同一个时间纬度,只统计一次
|
|
|
+ if !mapKeyMapCompanyEndData[keyMapCompany] {
|
|
|
+ mapExpiredContractNum[keyMap]++
|
|
|
+ mapExpiredContractNum[keyMapTtoal]++
|
|
|
+ mapKeyMapCompanyEndData[keyMapCompany] = true
|
|
|
+ }
|
|
|
|
|
|
if mapNoRenewedcompanyContractIds[v.CompanyContractId] { // 确认不续约合同
|
|
|
confirmedNoRenewalContractMoney[keyMap] += v.Money
|
|
|
- confirmedNoRenewalContractNum[keyMap]++
|
|
|
|
|
|
confirmedNoRenewalContractMoney[keyMapTtoal] += v.Money
|
|
|
- confirmedNoRenewalContractNum[keyMapTtoal]++
|
|
|
+
|
|
|
+ //一家公司同一个时间纬度,只统计一次
|
|
|
+ if !mapKeyMapCompanyNoData[keyMapCompanyNo] {
|
|
|
+ confirmedNoRenewalContractNum[keyMap]++
|
|
|
+ confirmedNoRenewalContractNum[keyMapTtoal]++
|
|
|
+ mapKeyMapCompanyNoData[keyMapCompanyNo] = true
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -976,18 +1007,18 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
var renewedContractMoney float64 // 续约金额
|
|
|
var renewedContractCompany float64 // 续约客户数
|
|
|
- //maprenewedContractCompany := make(map[int]bool)
|
|
|
+ maprenewedContractCompany := make(map[int]bool)
|
|
|
|
|
|
var expiredContractMoney float64 //到期金额
|
|
|
var expiredContractCompany float64 // 到期客户数
|
|
|
- //mapexpiredContractCompany := make(map[int]bool)
|
|
|
+ mapexpiredContractCompany := make(map[int]bool)
|
|
|
|
|
|
for _, v := range listRaiData {
|
|
|
renewedContractMoney += v.Money
|
|
|
- //if !maprenewedContractCompany[v.CompanyId] {
|
|
|
- renewedContractCompany++
|
|
|
- //maprenewedContractCompany[v.CompanyId] = true
|
|
|
- //}
|
|
|
+ if !maprenewedContractCompany[v.CompanyId] {
|
|
|
+ renewedContractCompany++
|
|
|
+ maprenewedContractCompany[v.CompanyId] = true
|
|
|
+ }
|
|
|
//startDateTime := utils.StrDateToDate(v.StartDate)
|
|
|
//if startDateTime.Before(time.Now().AddDate(0, 0, -1)) { //到期合同数据
|
|
|
// expiredContractMoney += v.Money
|
|
@@ -1000,10 +1031,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
for _, v := range listEndData {
|
|
|
expiredContractMoney += v.Money
|
|
|
- //if !mapexpiredContractCompany[v.CompanyId] {
|
|
|
- expiredContractCompany++
|
|
|
- //mapexpiredContractCompany[v.CompanyId] = true
|
|
|
- //}
|
|
|
+ if !mapexpiredContractCompany[v.CompanyId] {
|
|
|
+ expiredContractCompany++
|
|
|
+ mapexpiredContractCompany[v.CompanyId] = true
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
item := new(statistic_report.RaiDataSummaryDetailResp)
|