|
@@ -52,17 +52,15 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
dataType := this.GetString("DataType")
|
|
|
adminId := this.GetString("AdminId")
|
|
|
serviceAdminId := this.GetString("ServiceAdminId")
|
|
|
startYear, _ := this.GetInt("StartYear")
|
|
|
endYear, _ := this.GetInt("EndYear")
|
|
|
- developButton, _ := this.GetInt("DevelopButton")
|
|
|
- serverButton, _ := this.GetInt("ServerButton")
|
|
|
+ developButton, _ := this.GetBool("DevelopButton")
|
|
|
+ serverButton, _ := this.GetBool("ServerButton")
|
|
|
|
|
|
dataTypeArr := []string{}
|
|
|
-
|
|
|
if dataType == "季度" {
|
|
|
dataTypeArr = []string{"Q1", "Q2", "Q3", "Q4"}
|
|
|
} else if dataType == "半年度" {
|
|
@@ -81,11 +79,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
condition += " AND admin_id IN (" + serviceAdminId + ") "
|
|
|
}
|
|
|
|
|
|
- if developButton == 1 && serverButton == 0 && adminId == "" && serviceAdminId == "" {
|
|
|
+ if developButton && !serverButton && adminId == "" && serviceAdminId == "" {
|
|
|
condition += " AND real_name NOT LIKE '%6%' "
|
|
|
}
|
|
|
|
|
|
- if developButton == 0 && serverButton == 1 && adminId == "" && serviceAdminId == "" {
|
|
|
+ if !developButton && serverButton && adminId == "" && serviceAdminId == "" {
|
|
|
condition += " AND real_name LIKE '%6%' "
|
|
|
}
|
|
|
|
|
@@ -111,6 +109,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
startDate := fmt.Sprintf("%d-01-01", startYear)
|
|
|
endDate := fmt.Sprintf("%d-12-31", endYear)
|
|
|
|
|
|
+
|
|
|
var conditionRai string
|
|
|
var parsRai []interface{}
|
|
|
conditionRai = " AND a.product_id = 2 AND a.status = 1 AND a.start_date >= ? AND a.start_date <= ? "
|
|
@@ -122,6 +121,30 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ var conditionInherit string
|
|
|
+ var parsInherit []interface{}
|
|
|
+ conditionInherit = " AND a.product_id = 2 AND a.status = 1 AND a.inherit_end_date >= ? AND a.inherit_end_date <= ? "
|
|
|
+ parsInherit = append(parsInherit, startDate, endDate)
|
|
|
+ listInheritData, err := statistic_report.GetRaiDataSummaryInheritList(conditionInherit, parsInherit)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据信息失败"
|
|
|
+ br.ErrMsg = "获取数据信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ var conditionEnd string
|
|
|
+ var parsEnd []interface{}
|
|
|
+ conditionEnd = " AND a.product_id = 2 AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? "
|
|
|
+ parsEnd = append(parsEnd, startDate, endDate)
|
|
|
+ listEndData, err := statistic_report.GetRaiDataSummaryList(conditionEnd, parsEnd)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据信息失败"
|
|
|
+ br.ErrMsg = "获取数据信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
var conditionConfirm string
|
|
|
var parsConfirm []interface{}
|
|
|
mapNoRenewedcompanyContractIds := make(map[int]bool)
|
|
@@ -155,6 +178,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
var keyMap string
|
|
|
var keyMapTtoal string
|
|
|
var keyMapTtoalServer string
|
|
|
+
|
|
|
for _, v := range listRaiData {
|
|
|
startDateTime := utils.StrDateToDate(v.StartDate)
|
|
|
monthNum := startDateTime.Month()
|
|
@@ -190,22 +214,112 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
mapNewContractMoney[keyMapTtoal] += v.Money
|
|
|
mapNewContractNum[keyMapTtoal]++
|
|
|
- } else if v.RaiContractType == "续约合同" {
|
|
|
- mapRenewedContractMoney[keyMap] += v.Money
|
|
|
- mapRenewedContractNum[keyMap]++
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ mapSignedClientMoney[keyMap] += v.Money
|
|
|
+ mapSignedClientNum[keyMap]++
|
|
|
+
|
|
|
+ mapSignedClientMoney[keyMapTtoal] += v.Money
|
|
|
+ mapSignedClientNum[keyMapTtoal]++
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for _, v := range listInheritData {
|
|
|
+ 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"
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- mapRenewedContractMoney[keyMapTtoal] += v.Money
|
|
|
- mapRenewedContractNum[keyMapTtoal]++
|
|
|
+ keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
+ if sellerDevelopIds[v.SellerIdLast] == true {
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
+ } else {
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Service")
|
|
|
}
|
|
|
|
|
|
- if startDateTime.Before(time.Now().AddDate(0, 0, -1)) {
|
|
|
- mapExpiredContractMoney[keyMap] += v.Money
|
|
|
- mapExpiredContractNum[keyMap]++
|
|
|
+
|
|
|
+ mapRenewedContractMoney[keyMap] += v.Money
|
|
|
+ mapRenewedContractNum[keyMap]++
|
|
|
|
|
|
- mapExpiredContractMoney[keyMapTtoal] += v.Money
|
|
|
- mapExpiredContractNum[keyMapTtoal]++
|
|
|
+ mapRenewedContractMoney[keyMapTtoal] += v.Money
|
|
|
+ mapRenewedContractNum[keyMapTtoal]++
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for _, v := range listEndData {
|
|
|
+ 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"
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
+ if sellerDevelopIds[v.SellerIdLast] == true {
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
|
+ } else {
|
|
|
+ keyMapTtoal = fmt.Sprint(yearStr, "_Service")
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ mapExpiredContractMoney[keyMap] += v.Money
|
|
|
+ mapExpiredContractNum[keyMap]++
|
|
|
+
|
|
|
+ mapExpiredContractMoney[keyMapTtoal] += v.Money
|
|
|
+ mapExpiredContractNum[keyMapTtoal]++
|
|
|
+
|
|
|
if mapNoRenewedcompanyContractIds[v.CompanyContractId] {
|
|
|
confirmedNoRenewalContractMoney[keyMap] += v.Money
|
|
|
confirmedNoRenewalContractNum[keyMap]++
|
|
@@ -213,11 +327,6 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
confirmedNoRenewalContractMoney[keyMapTtoal] += v.Money
|
|
|
confirmedNoRenewalContractNum[keyMapTtoal]++
|
|
|
}
|
|
|
- mapSignedClientMoney[keyMap] += v.Money
|
|
|
- mapSignedClientNum[keyMap]++
|
|
|
-
|
|
|
- mapSignedClientMoney[keyMapTtoal] += v.Money
|
|
|
- mapSignedClientNum[keyMapTtoal]++
|
|
|
}
|
|
|
|
|
|
listFmsData, err := fms.GetContractRegisterListByStartDate(startDate, endDate)
|