Browse Source

Merge branch 'crm/crm_15.4' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 11 months ago
parent
commit
7701b68ede

+ 1 - 0
controllers/company_apply.go

@@ -2247,6 +2247,7 @@ func (this *CompanyApplyController) ApplyContract() {
 		//plist.CheckList = finalCheckList
 		plist.CheckList = checkList
 		contractItem.PermissionList = append(contractItem.PermissionList, plist)
+		contractItem.Quarter, _ = utils.GetQuarterStrStartDatesInRangeHaveYear(contractItem.StartDate, contractItem.EndDate)
 	}
 
 	resp := new(company.ApplyContractResp)

+ 4 - 0
controllers/company_approval.go

@@ -509,6 +509,10 @@ func (this *CompanyApprovalController) List() {
 				opButton.Cancel = true
 			}
 
+			if item.CompanyProductStatus == utils.COMPANY_STATUS_FOREVER {
+				item.CompanyProductStatus = utils.COMPANY_STATUS_X_CLASS_TRY_OUT
+			}
+
 			respTmp := &company.CompanyApprovalList{
 				CompanyId:         item.CompanyId,
 				ProductId:         item.ProductId,

+ 6 - 3
controllers/cygx/enter_score.go

@@ -712,7 +712,7 @@ func (this *EnterScoreController) EnterScoreScoreOverview() {
 				mapenterScoreTypeCompanyIds[v.CompanyId] = true //记录按照百分比录入的公司
 			}
 		}
-
+		fmt.Println(enterScoreIds)
 		var companyCondition string
 		var companypars []interface{}
 		companyCondition += ` AND b.product_name = ? `
@@ -741,8 +741,11 @@ func (this *EnterScoreController) EnterScoreScoreOverview() {
 		}
 
 		if city != "" {
-			companyCondition += ` AND a.city = ? `
-			companypars = append(companypars, city)
+			//传过来多个城市的时候的筛选
+			citySlice := strings.Split(city, ",")
+			city = strings.Join(citySlice, "','")
+			city = "'" + city + "'"
+			companyCondition += ` AND a.city  IN  (` + city + `) `
 		}
 
 		companyList, err := company.GetCompanyIdListByproductName(companyCondition, companypars)

+ 1 - 1
models/company/company_apply.go

@@ -105,7 +105,7 @@ type CompanyContractDetail struct {
 	ContractType      string    `description:"合同类型:枚举值:'新签合同','续约合同','补充协议'"`
 	StartDate         string    `description:"合同开始时间"`
 	EndDate           string    `description:"合同结束时间"`
-	Quarter           string    `comment:"季度(X类试用客户使用)"`
+	Quarter           string    `description:"季度(X类试用客户使用)"`
 	Money             float64   `description:"合同金额"`
 	PayMethod         string    `description:"支付方式"`
 	PayChannel        string    `description:"支付渠道"`

+ 34 - 0
utils/common.go

@@ -2305,3 +2305,37 @@ func GetQuarterStrStartDatesInRange(startTimeStr, endTimeStr string) (quartersSt
 	quartersStar = strings.Join(quarters, "+")
 	return quartersStar, nil
 }
+
+// 通过开始时间,结束时间,获取对应季度的拼接字符串 为啥一样的代码要写两遍,因为产品有的地方要求展示 2024Q1有的地方要求展示24Q1
+func GetQuarterStrStartDatesInRangeHaveYear(startTimeStr, endTimeStr string) (quartersStar string, err error) {
+	startTime, err := time.Parse("2006-01-02", startTimeStr)
+	if err != nil {
+		return
+	}
+
+	endTime, err := time.Parse("2006-01-02", endTimeStr)
+	if err != nil {
+		return
+	}
+
+	adjustedStartTime := startTime.AddDate(0, -int(startTime.Month()-1)%3, -startTime.Day()+1)
+
+	startYear, _, _ := adjustedStartTime.Date()
+	endYear, _, _ := endTime.Date()
+
+	var quarters []string
+	for year := startYear; year <= endYear; year++ {
+		for quarter := 1; quarter <= 4; quarter++ {
+			firstMonth := (quarter-1)*3 + 1
+			quarterStartDate := time.Date(year, time.Month(firstMonth), 1, 0, 0, 0, 0, time.UTC)
+			if quarterStartDate.After(endTime) || quarterStartDate.AddDate(0, 3, -1).Before(adjustedStartTime) {
+				continue
+			}
+			quartersYear := quarterStartDate.Year()
+			yearStr := strconv.Itoa(quartersYear)
+			quarters = append(quarters, fmt.Sprint(yearStr, "Q", quarter))
+		}
+	}
+	quartersStar = strings.Join(quarters, ",")
+	return quartersStar, nil
+}