Browse Source

no message

xingzai 2 years ago
parent
commit
d0865b08f8
1 changed files with 40 additions and 7 deletions
  1. 40 7
      services/activity_special.go

+ 40 - 7
services/activity_special.go

@@ -88,7 +88,7 @@ func ActivityLabelSpecialSql(chartPermissionIds, whichDay, activeState string) (
 }
 
 // ActivityLabelSpecialUserSql 专项产业调研用户权限查询数据预处理
-func ActivityLabelSpecialUserSql(user *models.WxUserItem) (conditionShengji, conditionZhengshi string, err error) {
+func ActivityLabelSpecialUserSql(user *models.WxUserItem) (conditionShengji, conditionZhengshi, conditionHangYe string, err error) {
 	_, userType, e := HandleActivityLabelSpecialTripPermission(user)
 	if e != nil {
 		err = errors.New("HandleActivityLabelSpecialPermission, Err: " + e.Error())
@@ -115,7 +115,7 @@ func ActivityLabelSpecialUserSql(user *models.WxUserItem) (conditionShengji, con
 		err = errs
 		return
 	}
-	if permissionZhengShiStr != "" && userType == 9 {
+	if permissionZhengShiStr != "" {
 		slicePerZhengshi := strings.Split(permissionZhengShiStr, ",")
 		permissionZhengShiStr = ""
 		for _, v := range slicePerZhengshi {
@@ -131,7 +131,10 @@ func ActivityLabelSpecialUserSql(user *models.WxUserItem) (conditionShengji, con
 		permissionZhengShiStr = strings.Replace(permissionZhengShiStr, "(主观)", "", -1)
 		permissionZhengShiStr = strings.Replace(permissionZhengShiStr, "(客观)", "", -1)
 		permissionZhengShiStr = strings.TrimRight(permissionZhengShiStr, ",")
-		conditionZhengshi = `  art.customer_type_ids LIKE '%9%'	   AND art.chart_permission_name  NOT  IN (` + permissionZhengShiStr + `)`
+		conditionHangYe = `  art.customer_type_ids LIKE '%3%'	   AND art.chart_permission_name    IN (` + permissionZhengShiStr + `)`
+		if userType == 9 {
+			conditionZhengshi = `  art.customer_type_ids LIKE '%9%'	   AND art.chart_permission_name  NOT  IN (` + permissionZhengShiStr + `)`
+		}
 	}
 	return
 }
@@ -176,7 +179,7 @@ func GetActivityLabelSpecialList(user *models.WxUserItem, conditionActivitySpeci
 	conditionNoTrip := condition
 	conditionNoTripSql := condition
 	//condition += conditionUser
-	conditionShengji, conditionZhengshi, e := ActivityLabelSpecialUserSql(user)
+	conditionShengji, conditionZhengshi, conditionHangYe, e := ActivityLabelSpecialUserSql(user)
 	if e != nil {
 		err = errors.New("ActivityLabelSpecialUserSql, Err: " + e.Error())
 		return
@@ -185,21 +188,29 @@ func GetActivityLabelSpecialList(user *models.WxUserItem, conditionActivitySpeci
 
 	var conditionZhengshiTrip string
 	var conditionShengjiTrip string
+	var conditionHangYeTrip string
 
 	//处理专项调研确认行程的其它正式客户权限查询
 	if conditionZhengshi != "" {
 		conditionZhengshiTrip = ` OR ( ` + conditionZhengshi + conditionTrip + ` )`
 	}
-	//处理专项调研确认行程的升级权限查询
+	//处理升级权限查询
 	if conditionShengji != "" {
 		conditionShengjiTrip = ` OR ( ` + conditionShengji + conditionTrip + ` )`
 	}
+	//处理行业套餐客户权限查询
+	if conditionHangYe != "" {
+		conditionHangYeTrip = ` OR ( ` + conditionHangYe + conditionTrip + ` )`
+	}
 	if conditionZhengshi != "" {
 		conditionTrip += conditionZhengshiTrip
 	}
 	if conditionShengjiTrip != "" {
 		conditionTrip += conditionShengjiTrip
 	}
+	if conditionHangYeTrip != "" {
+		conditionTrip += conditionHangYeTrip
+	}
 
 	conditionTripSql += conditionUser + conditionTrip + `  ORDER BY art.activity_time ASC `
 	specialList, err := models.GetActivityLabelSpecialListAll(conditionTripSql, pars, 0, 80)
@@ -345,7 +356,7 @@ func GetActivitySpecialPrepareList(user *models.WxUserItem, startSize, pageSize
 		keywords = "%" + keywords + "%"
 		condition += ` AND art.research_theme LIKE  ` + keywords
 	}
-	conditionShengji, conditionZhengshi, e := ActivityLabelSpecialUserSql(user)
+	conditionShengji, conditionZhengshi, conditionHangYe, e := ActivityLabelSpecialUserSql(user)
 	if e != nil {
 		err = errors.New("ActivityLabelSpecialUserSql, Err: " + e.Error())
 		return
@@ -353,18 +364,27 @@ func GetActivitySpecialPrepareList(user *models.WxUserItem, startSize, pageSize
 	conditionNoTrip := condition
 	var conditionShengjiNoTrip string
 	var conditionZhengshiNoTrip string
+	var conditionHangYeNoTrip string
 	if conditionShengji != "" {
 		conditionShengjiNoTrip = ` OR ( ` + conditionShengji + conditionNoTrip + ` )`
 	}
 	if conditionZhengshi != "" {
 		conditionZhengshiNoTrip = ` OR ( ` + conditionZhengshi + conditionNoTrip + ` )`
 	}
+	//处理行业套餐权限查询
+	if conditionHangYe != "" {
+		conditionHangYeNoTrip = ` OR ( ` + conditionHangYe + conditionNoTrip + ` )`
+	}
+
 	if conditionShengji != "" {
 		conditionNoTrip += conditionShengjiNoTrip
 	}
 	if conditionZhengshi != "" {
 		conditionNoTrip += conditionZhengshiNoTrip
 	}
+	if conditionHangYe != "" {
+		conditionNoTrip += conditionHangYeNoTrip
+	}
 	conditionNoTripSql := conditionUser + conditionNoTrip + ` ORDER BY art.last_updated_time DESC`
 	totalPrepare, e = models.GetActivitySpecialCount(conditionNoTripSql, pars)
 	if e != nil {
@@ -436,11 +456,16 @@ func GetActivityLabelSpecialConfirmList(user *models.WxUserItem, startSize, page
 	conditionTripSql := condition
 
 	//condition += conditionUser
-	conditionShengji, conditionZhengshi, e := ActivityLabelSpecialUserSql(user)
+	conditionShengji, conditionZhengshi, conditionHangYe, e := ActivityLabelSpecialUserSql(user)
+	if e != nil {
+		err = errors.New("ActivityLabelSpecialUserSql, Err: " + e.Error())
+		return
+	}
 	conditionTrip += ` AND art.days > 0   AND art.activity_time_end  > '` + time.Now().Format(utils.FormatDateTime) + ` '`
 
 	var conditionZhengshiTrip string
 	var conditionShengjiTrip string
+	var conditionHangYeTrip string
 
 	//处理专项调研确认行程的其它正式客户权限查询
 	if conditionZhengshi != "" {
@@ -450,12 +475,20 @@ func GetActivityLabelSpecialConfirmList(user *models.WxUserItem, startSize, page
 	if conditionShengji != "" {
 		conditionShengjiTrip = ` OR ( ` + conditionShengji + conditionTrip + ` )`
 	}
+	//处理行业套餐客户权限查询
+	if conditionHangYe != "" {
+		conditionHangYeTrip = ` OR ( ` + conditionHangYe + conditionTrip + ` )`
+	}
+
 	if conditionZhengshi != "" {
 		conditionTrip += conditionZhengshiTrip
 	}
 	if conditionShengjiTrip != "" {
 		conditionTrip += conditionShengjiTrip
 	}
+	if conditionHangYeTrip != "" {
+		conditionTrip += conditionHangYeTrip
+	}
 	conditionTripSql += conditionUser + conditionTrip + `  ORDER BY art.activity_time ASC `
 
 	//condition += conditionUser + conditionOr