Browse Source

no message

xingzai 11 months ago
parent
commit
4f2296998a
2 changed files with 35 additions and 77 deletions
  1. 34 76
      controllers/company_apply.go
  2. 1 1
      controllers/company_permission.go

+ 34 - 76
controllers/company_apply.go

@@ -2013,11 +2013,28 @@ func (this *CompanyApplyController) ApplyContract() {
 			return
 		}
 
+		totalForever, err := company.GetCompanyProductRaiForeverCount(companyId) //判断是否是权益的永续客户
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+			return
+		}
 		// 大套餐
 		bigPackage70, bigPackage45 := new(company.PermissionLookItem), new(company.PermissionLookItem)
-		bigPackage70.PermissionName = utils.CHART_PERMISSION_NAME_70W
-		bigPackage45.PermissionName = utils.CHART_PERMISSION_NAME_45W
-		plist.Items = append(plist.Items, bigPackage45, bigPackage70)
+		if totalForever > 0 {
+			//filterPermissionName := []string{"专家", "路演服务", "调研", "研选订阅", "研选扣点包"} //权益的永续客户这些不展示
+			//for _, v := range items {
+			//	if utils.InArrayByStr(filterPermissionName, v.PermissionName) {
+			//		continue
+			//	}
+			//	p.Items = append(p.Items, v)
+			//}
+
+		} else {
+			bigPackage70.PermissionName = utils.CHART_PERMISSION_NAME_70W
+			bigPackage45.PermissionName = utils.CHART_PERMISSION_NAME_45W
+			plist.Items = append(plist.Items, bigPackage45, bigPackage70)
+		}
 
 		// 是否为内部人员, 内部人员需要拆分行业主客观
 		isRai, e := services.CheckRaiAdmin(sysUser.AdminId)
@@ -2071,21 +2088,20 @@ func (this *CompanyApplyController) ApplyContract() {
 		}
 		//mapChartPermissionId := make(map[int]int)
 		mapChartPermissionName := make(map[string]string) // 行业主客观防止重复写入Items用的
+		filterPermissionName := []string{}
+		if totalForever == 0 {
+			filterPermissionName = []string{"专家", "路演服务"} // 需要过滤不展示的行业
+		} else {
+			filterPermissionName = []string{"专家", "路演服务", "调研", "研选订阅", "研选扣点包"} //权益的永续客户这些不展示
+		}
 		for _, n := range items {
-			//count, err := company.GetCompanyContractPermissionCheckByContractId(companyId, contractItem.CompanyContractId, n.ChartPermissionId)
-			//if err != nil {
-			//	br.Msg = "获取失败"
-			//	br.ErrMsg = "获取权限信息失败,Err:" + err.Error()
-			//	return
-			//}
-
-			filterPermissionName := []string{"专家", "路演服务"} // 需要过滤不展示的行业
 			if utils.InArrayByStr(filterPermissionName, n.PermissionName) {
 				continue
 			}
-
+			if n.PermissionType == 2 && totalForever > 0 {
+				continue
+			}
 			if utils.InArrayByInt(permissionIds, n.ChartPermissionId) {
-				fmt.Println(1)
 				n.Checked = true
 				if _, ok := mapUpgrade[n.ChartPermissionId]; ok {
 					checkList = append(checkList, n.ChartPermissionId+utils.PERMISSION_ID_UPGRADE)
@@ -2108,7 +2124,6 @@ func (this *CompanyApplyController) ApplyContract() {
 						}
 					}
 				}
-				//mapChartPermissionId[n.ChartPermissionId] = n.ChartPermissionId
 			}
 
 			// 买方研选3w/5w/10w
@@ -2120,20 +2135,7 @@ func (this *CompanyApplyController) ApplyContract() {
 
 				continue
 			}
-
-			//if mapChartPermissionName[n.PermissionName] == "" {
-			//	plist.Items = append(plist.Items, n)
-			//	mapChartPermissionName[n.PermissionName] = n.PermissionName
-			//	if strings.Contains("医药消费科技智造", n.PermissionName) {
-			//		vS := new(company.PermissionLookItem)
-			//		vS.ChartPermissionId = n.ChartPermissionId + utils.PERMISSION_ID_UPGRADE
-			//		vS.PermissionName = n.PermissionName + "(升级)"
-			//		vS.PermissionType = n.PermissionType
-			//		vS.Checked = n.Checked
-			//		plist.Items = append(plist.Items, vS)
-			//	}
-			//}
-
+			//if totalForever == 0 {
 			// 四行业主客观/升级
 			if mapChartPermissionName[n.PermissionName] == "" {
 				mapChartPermissionName[n.PermissionName] = n.PermissionName
@@ -2142,7 +2144,7 @@ func (this *CompanyApplyController) ApplyContract() {
 					continue
 				}
 				// 内部人员需要拆分主客观权限
-				if isRai {
+				if isRai && totalForever == 0 {
 					n.Child = make([]*company.PermissionLookItem, 0)
 					n.Child = append(n.Child, &company.PermissionLookItem{
 						ChartPermissionId: childSubMap[n.PermissionName],
@@ -2154,9 +2156,11 @@ func (this *CompanyApplyController) ApplyContract() {
 						PermissionType:    2,
 					})
 				}
+			}
 
-				plist.Items = append(plist.Items, n)
+			plist.Items = append(plist.Items, n)
 
+			if totalForever == 0 {
 				t := new(company.PermissionLookItem)
 				t.ChartPermissionId = n.ChartPermissionId + utils.PERMISSION_ID_UPGRADE
 				t.PermissionName = n.PermissionName + "(升级)"
@@ -2165,52 +2169,6 @@ func (this *CompanyApplyController) ApplyContract() {
 				plist.Items = append(plist.Items, t)
 			}
 		}
-		//itemsType, err := company.GetPermissionSetItemsType(2, v)
-		//if err != nil {
-		//	br.Msg = "获取失败"
-		//	br.ErrMsg = "获取权限信息失败,Err:" + err.Error()
-		//	return
-		//}
-		//含有主客观的权限处理
-		//mapChartPermission := make(map[string]int)
-		//pType := new(company.PermissionSetItemType)
-		//for _, v := range itemsType {
-		//	if mapChartPermission[v.PermissionName] == 0 {
-		//		mapChartPermission[v.PermissionName] = v.ChartPermissionId
-		//		pType = new(company.PermissionSetItemType)
-		//		pType.PermissionName = v.PermissionName
-		//	}
-		//	if mapChartPermissionId[v.ChartPermissionId] > 0 {
-		//		v.Checked = true
-		//	}
-		//	pType.Items = append(pType.Items, v)
-		//	if len(pType.Items) == 2 {
-		//		var checkedMinateBool bool
-		//		pType.Checked = true
-		//		for _, pv := range pType.Items {
-		//			if pv.Checked == false {
-		//				pType.Checked = false
-		//			} else {
-		//				checkedMinateBool = true
-		//				pType.NoClicking = true
-		//			}
-		//		}
-		//		if checkedMinateBool == true && pType.Checked == false {
-		//			pType.CheckedMinate = true
-		//		}
-		//		pListType.Items = append(pListType.Items, pType)
-		//	}
-		//}
-
-		////没有主客观的权限处理
-		//for _, v := range items {
-		//	fmt.Println(v)
-		//	if strings.Index(v.Remark, "主观") == -1 && strings.Index(v.Remark, "客观") == -1 {
-		//		if mapChartPermissionId[v.ChartPermissionId] > 0 {
-		//			v.Checked = true
-		//		}
-		//		plist.Items = append(plist.Items, v)
-		//	}
 		//}
 
 		// 如果checklist 里的值 没有在items里,则不返回给前端

+ 1 - 1
controllers/company_permission.go

@@ -45,7 +45,7 @@ func (this *CompanyPermissionController) List() {
 	noUpgrade, _ := this.GetBool("NoUpgrade", false)                       // 添加客户、领取客户=true; 申请转正、续约申请=false
 	isShowYanXuanKouDian, _ := this.GetBool("IsShowYanXuanKouDian", false) // 是否展示研选扣点
 	companyStatus := this.GetString("CompanyStatus")                       // 客户状态
-	if companyStatus == utils.COMPANY_STATUS_X_CLASS_TRY_OUT {
+	if companyStatus == utils.COMPANY_STATUS_X_CLASS_TRY_OUT || strings.Contains(companyStatus, utils.COMPANY_STATUS_FOREVER) {
 		companyStatus = utils.COMPANY_STATUS_FOREVER
 	}
 	var productId int