Browse Source

Merge branch 'cygx_need_900' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 1 year ago
parent
commit
9b43542b67
3 changed files with 28 additions and 15 deletions
  1. 14 2
      controllers/company.go
  2. 3 3
      services/cygx/activity_special.go
  3. 11 10
      utils/constants.go

+ 14 - 2
controllers/company.go

@@ -479,12 +479,17 @@ func (this *CompanyController) List() {
 	resp := new(company.CompanyListResp)
 	statusItems := make([]*company.CompanyStatus, 0)
 
+	// 永续客户类型,映射成 X类试用
+	if status == utils.COMPANY_STATUS_X_CLASS_TRY_OUT {
+		status = utils.COMPANY_STATUS_FOREVER
+	}
+
 	var statusArr []string
 	// 对权益用户隐藏关闭
 	if productId == utils.COMPANY_PRODUCT_RAI_ID {
-		statusArr = []string{"全部", "试用", "正式", "冻结", "流失", "永续"}
+		statusArr = []string{"全部", "试用", "正式", "冻结", "流失", utils.COMPANY_STATUS_X_CLASS_TRY_OUT}
 	} else {
-		statusArr = []string{"全部", "试用", "正式", "冻结", "流失", utils.COMPANY_STATUS_CLOSE, "永续"}
+		statusArr = []string{"全部", "试用", "正式", "冻结", "流失", utils.COMPANY_STATUS_CLOSE, utils.COMPANY_STATUS_X_CLASS_TRY_OUT}
 	}
 	//var statusArr = [...]string{"全部", "试用-活跃", "试用-非活跃", "正式", "冻结", "流失", "永续"}
 
@@ -1203,6 +1208,7 @@ func (this *CompanyController) List() {
 			if !strings.Contains(item.Status, "/") {
 				if itemStatus == utils.COMPANY_STATUS_FOREVER { //永续
 					expireDay = "-"
+					item.Status = utils.COMPANY_STATUS_X_CLASS_TRY_OUT // 永续客户类型,映射成 X类试用
 				} else if itemStatus == utils.COMPANY_STATUS_TRY_OUT || itemStatus == utils.COMPANY_STATUS_FORMAL { //试用/正式
 					if item.StartDate != "" && item.EndDate != "" {
 						endDateTime, _ := time.Parse(utils.FormatDate, item.EndDate)
@@ -3244,6 +3250,9 @@ func (this *CompanyController) Detail() {
 				item.PermissionList = append(item.PermissionList, plist)
 			}
 			resp.FiccItem = item
+			if resp.FiccItem.Status == utils.COMPANY_STATUS_FOREVER {
+				resp.FiccItem.Status = utils.COMPANY_STATUS_X_CLASS_TRY_OUT
+			}
 			if (roleTypeCode == utils.ROLE_TYPE_CODE_FICC_SELLER ||
 				roleTypeCode == utils.ROLE_TYPE_CODE_FICC_GROUP || roleTypeCode == utils.ROLE_TYPE_CODE_FICC_DEPARTMENT) &&
 				item.Status == utils.COMPANY_STATUS_TRY_OUT && item.ApproveStatus != "待审批" {
@@ -3287,6 +3296,9 @@ func (this *CompanyController) Detail() {
 
 			item.PermissionList = append(item.PermissionList, plist)
 			resp.RaiItem = item
+			if resp.RaiItem.Status == utils.COMPANY_STATUS_FOREVER {
+				resp.RaiItem.Status = utils.COMPANY_STATUS_X_CLASS_TRY_OUT
+			}
 			if (roleTypeCode == utils.ROLE_TYPE_CODE_RAI_SELLER ||
 				roleTypeCode == utils.ROLE_TYPE_CODE_RAI_GROUP ||
 				roleTypeCode == utils.ROLE_TYPE_CODE_RAI_DEPARTMENT) &&

+ 3 - 3
services/cygx/activity_special.go

@@ -771,7 +771,7 @@ func DeductTripRemainingtimesByUser(user *cygx.UserAndCompanyName, activityInfo
 	//判断是不是策略行业的活动,如果不是策略就获取对应行业的点数 ,策略的任何一个行业有剩余点数都能参加
 	if chartPermissionName != utils.CE_LUE_NAME {
 		pars = make([]interface{}, 0)
-		condition = " AND  company_id  = ?  AND  chart_permission_id  = ?   AND points  > 0   ORDER BY  points DESC LIMIT 1   "
+		condition = " AND  company_id  = ?   AND  (chart_permission_id  = ?   OR chart_permission_id = 0 )   AND points  > 0   ORDER BY  points DESC LIMIT 1   "
 		pars = append(pars, companyId, activityInfo.ChartPermissionId)
 	}
 	activitySpecialPermissionPointsList, e := cygx.GetCygxActivitySpecialPermissionPointsList(condition, pars)
@@ -811,7 +811,7 @@ func RebateTripRemainingtimesByUser(user *cygx.UserAndCompanyName, activityInfo
 	//判断是不是策略行业的活动,如果不是策略就获取对应行业的点数 ,策略的任何一个行业有剩余点数都能参加
 	if chartPermissionName != utils.CE_LUE_NAME {
 		pars = make([]interface{}, 0)
-		condition = " AND  company_id  = ?  AND  chart_permission_id  = ?   LIMIT 1   "
+		condition = " AND  company_id  = ?  AND  (chart_permission_id  = ?   OR chart_permission_id = 0 )  LIMIT 1   "
 		pars = append(pars, companyId, activityInfo.ChartPermissionId)
 	} else {
 		lastTripBill, e := cygx.GetCygxActivitySpecialTripBillLastDetialByActivityId(activityInfo.ActivityId, user.UserId)
@@ -821,7 +821,7 @@ func RebateTripRemainingtimesByUser(user *cygx.UserAndCompanyName, activityInfo
 		}
 
 		pars = make([]interface{}, 0)
-		condition = " AND  company_id  = ?  AND  chart_permission_id  = ?    LIMIT 1   "
+		condition = " AND  company_id  = ?  AND  (chart_permission_id  = ?   OR chart_permission_id = 0 )   LIMIT 1   "
 		pars = append(pars, companyId, lastTripBill.ChartPermissionId)
 	}
 	activitySpecialPermissionPointsList, e := cygx.GetCygxActivitySpecialPermissionPointsList(condition, pars)

+ 11 - 10
utils/constants.go

@@ -92,16 +92,17 @@ const (
 
 // 客户状态
 const (
-	COMPANY_STATUS_TRY_OUT       = "试用"
-	COMPANY_STATUS_FOREVER       = "永续"
-	COMPANY_STATUS_FREEZE        = "冻结"
-	COMPANY_STATUS_LOSE          = "流失"
-	COMPANY_STATUS_LOSE_FLAG     = "loss"
-	COMPANY_STATUS_FORMAL        = "正式"
-	COMPANY_STATUS_POTENTIAL     = "潜在"
-	COMPANY_STATUS_CLOSE         = "关闭"
-	COMPANY_STATUS_CLOSE_FLAG    = "close"
-	COMPANY_STATUS_TRY_OUT_COUNT = 60
+	COMPANY_STATUS_TRY_OUT         = "试用"
+	COMPANY_STATUS_X_CLASS_TRY_OUT = "X类试用" //最早定义为永续
+	COMPANY_STATUS_FOREVER         = "永续"
+	COMPANY_STATUS_FREEZE          = "冻结"
+	COMPANY_STATUS_LOSE            = "流失"
+	COMPANY_STATUS_LOSE_FLAG       = "loss"
+	COMPANY_STATUS_FORMAL          = "正式"
+	COMPANY_STATUS_POTENTIAL       = "潜在"
+	COMPANY_STATUS_CLOSE           = "关闭"
+	COMPANY_STATUS_CLOSE_FLAG      = "close"
+	COMPANY_STATUS_TRY_OUT_COUNT   = 60
 
 	COMPANY_APPROVE_STATUS = "待审批"
 )