浏览代码

no message

zhangchuanxing 2 周之前
父节点
当前提交
fe2274ccd6
共有 1 个文件被更改,包括 19 次插入14 次删除
  1. 19 14
      controllers/statistic/rai_data_summary.go

+ 19 - 14
controllers/statistic/rai_data_summary.go

@@ -177,6 +177,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 	mapRenewedContractCompanyNum := make(map[string]int)            // 续约公司(数量)
 	confirmedNoRenewalContractMoney := make(map[string]float64)     // 确认不续约合同(金额)
 	confirmedNoRenewalContractNum := make(map[string]int)           // 确认不续约合同(数量)
+	confirmedNoRenewalContractCompanyNum := make(map[string]int)    // 确认不续约公司(数量)
 	mapSignedClientNum := make(map[string]int)                      // 签约客户(数量)
 	mapSignedClientMoney := make(map[string]float64)                // 签约客户(金额)
 	mapInvoiceAmountMoney := make(map[string]float64)               // 财务系统开票金额(金额)
@@ -188,7 +189,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 	var keyMapTtoal string
 	var keyMapTtoalServer string
 	var keyMapCompany string
-	//var keyMapCompanyNo string
+	var keyMapCompanyNo string
 	var keySigned string
 
 	mapCompanyData := make(map[string]bool)
@@ -244,7 +245,6 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 			mapCompanyData[keySigned] = true
 		}
 	}
-	//fmt.Println(mapSignedClientNum)
 
 	//续约部分的数据
 	mapKeyMapCompanyData := make(map[string]bool)
@@ -306,7 +306,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 
 	//确认不续约、到期合同部分的数据
 	mapKeyMapCompanyEndData := make(map[string]bool)
-	//mapKeyMapCompanyNoData := make(map[string]bool)
+	mapKeyMapCompanyNoData := make(map[string]bool)
 	for _, v := range listEndData {
 		if !mapsellerId[v.SellerIdLast] {
 			continue
@@ -334,7 +334,7 @@ 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)
+		keyMapCompanyNo = fmt.Sprint(yearStr, "_", v.SellerIdLast, "_CID_NO", v.CompanyId)
 		if sellerDevelopIds[v.SellerIdLast] == true {
 			keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
 		} else {
@@ -370,6 +370,13 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 			confirmedNoRenewalContractNum[keyMapTtoal]++
 			//mapKeyMapCompanyNoData[keyMapCompanyNo] = true
 			//}
+
+			if !mapKeyMapCompanyNoData[keyMapCompanyNo] {
+				confirmedNoRenewalContractCompanyNum[keyMap]++
+				confirmedNoRenewalContractCompanyNum[keyMapTtoal]++
+				mapKeyMapCompanyNoData[keyMapCompanyNo] = true
+			}
+
 		}
 	}
 
@@ -514,10 +521,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 				} else {
 					confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMap]/mapExpiredContractMoney[keyMap]*100, 2) + "%"
 				}
-				if confirmedNoRenewalContractNum[keyMap] == 0 || mapExpiredContractCompanyNum[keyMap] == 0 {
+				if confirmedNoRenewalContractCompanyNum[keyMap] == 0 || mapExpiredContractCompanyNum[keyMap] == 0 {
 					confirmNonRenewalRateNum = "0%"
 				} else {
-					confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractNum[keyMap])/float64(mapExpiredContractCompanyNum[keyMap])*100, 2) + "%"
+					confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractCompanyNum[keyMap])/float64(mapExpiredContractCompanyNum[keyMap])*100, 2) + "%"
 				}
 				sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
 
@@ -572,10 +579,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 				} else {
 					confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMapTtoal]/mapExpiredContractMoney[keyMapTtoal]*100, 2) + "%"
 				}
-				if confirmedNoRenewalContractNum[keyMapTtoal] == 0 || mapExpiredContractCompanyNum[keyMapTtoal] == 0 {
+				if confirmedNoRenewalContractCompanyNum[keyMapTtoal] == 0 || mapExpiredContractCompanyNum[keyMapTtoal] == 0 {
 					confirmNonRenewalRateNum = "0%"
 				} else {
-					confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractNum[keyMapTtoal])/float64(mapExpiredContractCompanyNum[keyMapTtoal])*100, 2) + "%"
+					confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractCompanyNum[keyMapTtoal])/float64(mapExpiredContractCompanyNum[keyMapTtoal])*100, 2) + "%"
 				}
 				sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
 
@@ -629,10 +636,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 				} else {
 					confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMap]/mapExpiredContractMoney[keyMap]*100, 2) + "%"
 				}
-				if confirmedNoRenewalContractNum[keyMap] == 0 || mapExpiredContractCompanyNum[keyMap] == 0 {
+				if confirmedNoRenewalContractCompanyNum[keyMap] == 0 || mapExpiredContractCompanyNum[keyMap] == 0 {
 					confirmNonRenewalRateNum = "0%"
 				} else {
-					confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractNum[keyMap])/float64(mapExpiredContractCompanyNum[keyMap])*100, 2) + "%"
+					confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractCompanyNum[keyMap])/float64(mapExpiredContractCompanyNum[keyMap])*100, 2) + "%"
 				}
 				sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
 
@@ -686,10 +693,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
 				} else {
 					confirmNonRenewalRateMoey = utils.SubFloatToString(confirmedNoRenewalContractMoney[keyMapTtoalServer]/mapExpiredContractMoney[keyMapTtoalServer]*100, 2) + "%"
 				}
-				if confirmedNoRenewalContractNum[keyMapTtoalServer] == 0 || mapExpiredContractCompanyNum[keyMapTtoalServer] == 0 {
+				if confirmedNoRenewalContractCompanyNum[keyMapTtoalServer] == 0 || mapExpiredContractCompanyNum[keyMapTtoalServer] == 0 {
 					confirmNonRenewalRateNum = "0%"
 				} else {
-					confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractNum[keyMapTtoalServer])/float64(mapExpiredContractCompanyNum[keyMapTtoalServer])*100, 2) + "%"
+					confirmNonRenewalRateNum = utils.SubFloatToString(float64(confirmedNoRenewalContractCompanyNum[keyMapTtoalServer])/float64(mapExpiredContractCompanyNum[keyMapTtoalServer])*100, 2) + "%"
 				}
 				sellerItem.ConfirmNonRenewalRateData = fmt.Sprint(confirmNonRenewalRateMoey, " / ", confirmNonRenewalRateNum) //确认不续约率(金额/数量)-(数据)"
 
@@ -1039,7 +1046,6 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
 			br.ErrMsg = "获取数据信息失败,Err:" + err.Error()
 			return
 		}
-		//fmt.Println("listRaiData", len(listRaiData))
 
 		//到期合同数据
 		conditionEnd += ` AND  a.status = 1  AND a.end_date >= ?  AND a.end_date <= ?   AND a.end_date < ? `
@@ -1267,7 +1273,6 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
 			br.ErrMsg = "获取数据信息失败,Err:" + err.Error()
 			return
 		}
-		fmt.Println("listInheritData", len(listInheritData))
 
 		var renewedContractCompany int // 续约客户数
 		var renewedContract int        // 续约合同数