|
@@ -34,6 +34,8 @@ type StatisticRaiDataSummaryController struct {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -59,6 +61,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
endYear, _ := this.GetInt("EndYear")
|
|
|
developButton, _ := this.GetBool("DevelopButton")
|
|
|
serverButton, _ := this.GetBool("ServerButton")
|
|
|
+ startDate := this.GetString("StartDate")
|
|
|
+ endDate := this.GetString("EndDate")
|
|
|
|
|
|
adminIdArr := strings.Split(adminId, ",")
|
|
|
serviceAdminIdArr := strings.Split(serviceAdminId, ",")
|
|
@@ -143,9 +147,16 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
mapsellerId[v.AdminId] = true
|
|
|
}
|
|
|
|
|
|
+ var isCustomizeDate bool
|
|
|
|
|
|
- startDate := fmt.Sprintf("%d-01-01", startYear)
|
|
|
- endDate := fmt.Sprintf("%d-12-31", endYear)
|
|
|
+ if startDate == "" {
|
|
|
+ startDate = fmt.Sprintf("%d-01-01", startYear)
|
|
|
+ endDate = fmt.Sprintf("%d-12-31", endYear)
|
|
|
+ } else {
|
|
|
+ isCustomizeDate = true
|
|
|
+ startYear = 1
|
|
|
+ endYear = 1
|
|
|
+ }
|
|
|
|
|
|
|
|
|
var conditionRai string
|
|
@@ -179,7 +190,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
var conditionEnd string
|
|
|
var parsEnd []interface{}
|
|
|
- conditionEnd = " AND a.product_id = 2 AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? AND a.end_date < ? "
|
|
|
+ conditionEnd = " AND a.product_id = 2 AND a.status = 1 AND a.due_end_date >= ? AND a.due_end_date <= ? AND a.due_end_date < ? "
|
|
|
parsEnd = append(parsEnd, startDate, endDate, time.Now().Format(utils.FormatDate))
|
|
|
listEndData, err := statistic_report.GetRaiDataSummaryList(conditionEnd, parsEnd)
|
|
|
if err != nil {
|
|
@@ -250,7 +261,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if !mapsellerDevelop[v.SellerIdInit] {
|
|
|
continue
|
|
|
}
|
|
|
- yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType, isCustomizeDate)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdInit)
|
|
|
keySigned = fmt.Sprint(yearStr, "_CID_", v.CompanyId, "_SID_", v.SellerIdInit)
|
|
@@ -278,7 +289,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if !mapsellerService[v.ShareSellerIdInit] {
|
|
|
continue
|
|
|
}
|
|
|
- yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType)
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.StartDate), dataType, isCustomizeDate)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdInit)
|
|
|
keySigned = fmt.Sprint(yearStr, "_Server_", v.CompanyId, "_SID_", v.ShareSellerIdInit)
|
|
@@ -310,7 +321,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if !mapsellerDevelop[v.SellerIdLast] {
|
|
|
continue
|
|
|
}
|
|
|
- yearStr := getYearStar(utils.StrDateToDate(v.InheritEndDate), dataType)
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.InheritEndDate), dataType, isCustomizeDate)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
keyMapCompany = fmt.Sprint(yearStr, "_", v.SellerIdLast, "_CID_", v.CompanyId)
|
|
@@ -349,7 +360,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if !mapsellerService[v.ShareSellerIdLast] {
|
|
|
continue
|
|
|
}
|
|
|
- yearStr := getYearStar(utils.StrDateToDate(v.InheritEndDate), dataType)
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.InheritEndDate), dataType, isCustomizeDate)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast)
|
|
|
keyMapCompany = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast, "_CID_", v.CompanyId)
|
|
@@ -391,7 +402,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if !mapsellerDevelop[v.SellerIdLast] {
|
|
|
continue
|
|
|
}
|
|
|
- yearStr := getYearStar(utils.StrDateToDate(v.EndDate), dataType)
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.DueEndDate), dataType, isCustomizeDate)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SellerIdLast)
|
|
|
keyMapCompany = fmt.Sprint(yearStr, "_", v.SellerIdLast, "_CID_", v.CompanyId)
|
|
@@ -437,7 +448,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if !mapsellerService[v.ShareSellerIdLast] {
|
|
|
continue
|
|
|
}
|
|
|
- yearStr := getYearStar(utils.StrDateToDate(v.EndDate), dataType)
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.DueEndDate), dataType, isCustomizeDate)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast)
|
|
|
keyMapCompany = fmt.Sprint(yearStr, "_Server_", v.ShareSellerIdLast, "_CID_", v.CompanyId)
|
|
@@ -488,7 +499,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if !mapsellerDevelop[v.RaiSellerId] {
|
|
|
continue
|
|
|
}
|
|
|
- yearStr := getYearStar(utils.StrDateToDate(v.InvoiceTime), dataType)
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.InvoiceTime), dataType, isCustomizeDate)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.RaiSellerId)
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Develop")
|
|
@@ -522,7 +533,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
if !mapsellerService[v.RaiSellerId] {
|
|
|
continue
|
|
|
}
|
|
|
- yearStr := getYearStar(utils.StrDateToDate(v.InvoiceTime), dataType)
|
|
|
+ yearStr := getYearStar(utils.StrDateToDate(v.InvoiceTime), dataType, isCustomizeDate)
|
|
|
|
|
|
keyMap = fmt.Sprint(yearStr, "_Server_", v.RaiSellerId)
|
|
|
keyMapTtoal = fmt.Sprint(yearStr, "_Server_")
|
|
@@ -579,6 +590,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
yearStr += "H2"
|
|
|
}
|
|
|
}
|
|
|
+ if isCustomizeDate {
|
|
|
+ yearStr = ""
|
|
|
+ }
|
|
|
+
|
|
|
keyMap = fmt.Sprint(yearStr, "_", v.SysUserId)
|
|
|
mapAddTrialNum[keyMap]++
|
|
|
|
|
@@ -598,7 +613,11 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
for i := startYear; i <= endYear; i++ {
|
|
|
for _, Dv := range dataTypeArr {
|
|
|
item := new(statistic_report.RaiDataSummaryResp)
|
|
|
- item.DataType = fmt.Sprint(i, Dv)
|
|
|
+ if isCustomizeDate {
|
|
|
+ item.DataType = ""
|
|
|
+ } else {
|
|
|
+ item.DataType = fmt.Sprint(i, Dv)
|
|
|
+ }
|
|
|
keyMapTtoal = fmt.Sprint(item.DataType, "_Develop")
|
|
|
keyMapTtoalServer = fmt.Sprint(item.DataType, "_Server_")
|
|
|
for _, vS := range sellerDevelop {
|
|
@@ -850,6 +869,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryList() {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -874,6 +895,8 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
sellerId := this.GetString("SellerId")
|
|
|
popupType := this.GetString("PopupType")
|
|
|
isServerSeller, _ := this.GetBool("IsServerSeller")
|
|
|
+ startDate := this.GetString("StartDate")
|
|
|
+ endDate := this.GetString("EndDate")
|
|
|
|
|
|
var startSize int
|
|
|
if pageSize <= 0 {
|
|
@@ -884,30 +907,32 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
|
|
|
- var startDate string
|
|
|
- var endDate string
|
|
|
- year := (dataType[:4])
|
|
|
- if strings.Contains(dataType, "Q1") {
|
|
|
- startDate = year + "-01-01"
|
|
|
- endDate = year + "-03-31"
|
|
|
- } else if strings.Contains(dataType, "Q2") {
|
|
|
- startDate = year + "-04-01"
|
|
|
- endDate = year + "-06-30"
|
|
|
- } else if strings.Contains(dataType, "Q3") {
|
|
|
- startDate = year + "-07-01"
|
|
|
- endDate = year + "-09-30"
|
|
|
- } else if strings.Contains(dataType, "Q4") {
|
|
|
- startDate = year + "-10-01"
|
|
|
- endDate = year + "-12-31"
|
|
|
- } else if strings.Contains(dataType, "H1") {
|
|
|
- startDate = year + "-01-01"
|
|
|
- endDate = year + "-06-31"
|
|
|
- } else if strings.Contains(dataType, "H2") {
|
|
|
- startDate = year + "-07-01"
|
|
|
- endDate = year + "-12-31"
|
|
|
- } else {
|
|
|
- startDate = year + "-01-01"
|
|
|
- endDate = year + "-12-31"
|
|
|
+
|
|
|
+
|
|
|
+ if startDate == "" {
|
|
|
+ year := (dataType[:4])
|
|
|
+ if strings.Contains(dataType, "Q1") {
|
|
|
+ startDate = year + "-01-01"
|
|
|
+ endDate = year + "-03-31"
|
|
|
+ } else if strings.Contains(dataType, "Q2") {
|
|
|
+ startDate = year + "-04-01"
|
|
|
+ endDate = year + "-06-30"
|
|
|
+ } else if strings.Contains(dataType, "Q3") {
|
|
|
+ startDate = year + "-07-01"
|
|
|
+ endDate = year + "-09-30"
|
|
|
+ } else if strings.Contains(dataType, "Q4") {
|
|
|
+ startDate = year + "-10-01"
|
|
|
+ endDate = year + "-12-31"
|
|
|
+ } else if strings.Contains(dataType, "H1") {
|
|
|
+ startDate = year + "-01-01"
|
|
|
+ endDate = year + "-06-31"
|
|
|
+ } else if strings.Contains(dataType, "H2") {
|
|
|
+ startDate = year + "-07-01"
|
|
|
+ endDate = year + "-12-31"
|
|
|
+ } else {
|
|
|
+ startDate = year + "-01-01"
|
|
|
+ endDate = year + "-12-31"
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
resp := new(statistic_report.RaiDataSummaryPopupTypeResp)
|
|
@@ -1061,7 +1086,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
|
|
|
}
|
|
|
|
|
|
- condition += ` AND a.product_id = 2 AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? AND a.end_date < ? `
|
|
|
+ condition += ` AND a.product_id = 2 AND a.status = 1 AND a.due_end_date >= ? AND a.due_end_date <= ? AND a.due_end_date < ? `
|
|
|
pars = append(pars, startDate, endDate, time.Now().Format(utils.FormatDate))
|
|
|
|
|
|
total, err := company.GetIncrementalNewCompanyProductMergeCount(condition, pars)
|
|
@@ -1198,7 +1223,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- conditionEnd += ` AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? AND a.end_date < ? `
|
|
|
+ conditionEnd += ` AND a.status = 1 AND a.due_end_date >= ? AND a.due_end_date <= ? AND a.due_end_date < ? `
|
|
|
parsEnd = append(parsEnd, startDate, endDate, time.Now().Format(utils.FormatDate))
|
|
|
listEndData, err := statistic_report.GetRaiDataSummaryList(conditionEnd, parsEnd)
|
|
|
if err != nil {
|
|
@@ -1354,7 +1379,7 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- conditionEnd += ` AND a.product_id = 2 AND a.status = 1 AND a.end_date >= ? AND a.end_date <= ? AND a.end_date < ? `
|
|
|
+ conditionEnd += ` AND a.product_id = 2 AND a.status = 1 AND a.due_end_date >= ? AND a.due_end_date <= ? AND a.due_end_date < ? `
|
|
|
parsEnd = append(parsEnd, startDate, endDate, time.Now().Format(utils.FormatDate))
|
|
|
|
|
|
listEndData, err := statistic_report.GetRaiDataSummaryList(conditionEnd, parsEnd)
|
|
@@ -1724,7 +1749,10 @@ func (this *StatisticRaiDataSummaryController) RaiDataSummaryDetail() {
|
|
|
}
|
|
|
|
|
|
|
|
|
-func getYearStar(startDate time.Time, dataType string) (yearStr string) {
|
|
|
+func getYearStar(startDate time.Time, dataType string, isCustomizeDate bool) (yearStr string) {
|
|
|
+ if isCustomizeDate {
|
|
|
+ return
|
|
|
+ }
|
|
|
startDateTime := startDate
|
|
|
monthNum := startDateTime.Month()
|
|
|
yearStr = strconv.Itoa(startDateTime.Year())
|