浏览代码

Merge branch 'CRM_15.5' into debug

# Conflicts:
#	models/company/company_product.go
zwxi 1 年之前
父节点
当前提交
6abb98ef75

+ 29 - 0
controllers/roadshow/calendar.go

@@ -186,6 +186,7 @@ func (this *CalendarController) Add() {
 	rsCalendar.ProvinceCode = req.ProvinceCode
 	rsCalendar.City = req.City
 	rsCalendar.CityCode = req.CityCode
+	rsCalendar.District = req.District
 	rsCalendar.Theme = req.Theme
 	rsCalendar.CooperationName = req.CooperationName
 	rsCalendar.CreateTime = time.Now()
@@ -559,6 +560,10 @@ func (this *CalendarController) Edit() {
 		calendarUpdateParams["city"] = req.City
 	}
 
+	if req.District != "" {
+		calendarUpdateParams["district"] = req.District
+	}
+
 	calendarUpdateParams["english_company"] = req.EnglishCompany
 
 	calendarUpdateParams["modify_time"] = time.Now()
@@ -992,6 +997,30 @@ func (this *CalendarController) ResearcherList() {
 	for _, v := range group {
 		v.ResearcherList = groupMap[v.GroupId]
 	}
+	//sysUserList, err := cygx.GetAskEmailList()
+	//if err != nil {
+	//	br.Msg = "获取失败"
+	//	br.ErrMsg = "获取失败,GetAskEmailList Err: " + err.Error()
+	//	return
+	//}
+	//mapPermissionUser := make(map[string][]*cygx.AllocationRealNameListResp)
+	//listPermission, err := cygx.GetChartPermissionAll()
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+	//	return
+	//}
+	//mapPermissionId := make(map[string]int)
+	//for _, v := range listPermission {
+	//	mapPermissionId[v.PermissionName] = v.ChartPermissionId
+	//}
+	//for _, v := range sysUserList {
+	//	item := new(cygx.AllocationRealNameListResp)
+	//	item.RealName = v.Name
+	//	item.ChartPermissionId = mapPermissionId[v.ChartPermissionName]
+	//	mapPermissionUser[v.ChartPermissionName] = append(mapPermissionUser[v.ChartPermissionName], item)
+	//}
+
 	//allGroup := new(roadshow.ResearcherGroup)
 	//allGroup.GroupId = 99
 	//allGroup.GroupName = "ficc全体"

+ 28 - 19
controllers/roadshow/company.go

@@ -77,9 +77,10 @@ func (this *CalendarController) CompanyDetail() {
 	}
 	englishCompany, _ := this.GetInt("EnglishCompany")
 
-	detailView := new(roadshow.CompanyDetailView)
+	resp := make([]roadshow.CompanyDetailView,0)
 	if englishCompany == 0 {
-		companyProductItem, err := company.GetCompanyProductByCompanyIdAndProductId(companyId, 1)
+		//companyProductItem, err := company.GetCompanyProductByCompanyIdAndProductId(companyId, 1)
+		companyProductList, err := company.GetCompanyProductsByCompanyId(companyId)
 		if err != nil {
 			if err.Error() == utils.ErrNoRow() {
 				br.Msg = "该客户已被删除"
@@ -89,27 +90,34 @@ func (this *CalendarController) CompanyDetail() {
 			br.ErrMsg = "搜索客户失败!Err:" + err.Error()
 			return
 		}
-		permissionList, err := company.GetCompanyProductReportPermissionList(companyId, 1)
-		if err != nil {
-			br.Msg = "搜索客户权限失败!"
-			br.ErrMsg = "搜索客户权限失败!Err:" + err.Error()
-			return
-		}
-		var permissionArr []string
-		for _, v := range permissionList {
-			permissionArr = append(permissionArr, v.PermissionName)
+		for _, v := range companyProductList {
+			detailView := new(roadshow.CompanyDetailView)
+			detailView.CompanyId = v.CompanyId
+			detailView.CompanyName = v.CompanyName
+			detailView.Status = v.Status
+			detailView.IndustryId = v.IndustryId
+			detailView.IndustryName = v.IndustryName
+			detailView.ReportReadTotal = v.ViewTotal //ficc报告-累计阅读次数
+
+			permissionList, err := company.GetCompanyProductReportPermissionList(companyId, v.ProductId)
+			if err != nil {
+				br.Msg = "搜索客户权限失败!"
+				br.ErrMsg = "搜索客户权限失败!Err:" + err.Error()
+				return
+			}
+			var permissionArr []string
+			for _, v := range permissionList {
+				permissionArr = append(permissionArr, v.PermissionName)
+			}
+			detailView.PermissionName = strings.Join(permissionArr, "/")
+
+			resp = append(resp, *detailView)
 		}
-		detailView.CompanyId = companyProductItem.CompanyId
-		detailView.CompanyName = companyProductItem.CompanyName
-		detailView.Status = companyProductItem.Status
-		detailView.IndustryId = companyProductItem.IndustryId
-		detailView.IndustryName = companyProductItem.IndustryName
-		detailView.PermissionName = strings.Join(permissionArr, "/")
-		detailView.ReportReadTotal = companyProductItem.ViewTotal //ficc报告-累计阅读次数
+
 		br.Ret = 200
 		br.Success = true
 		br.Msg = "获取成功"
-		br.Data = detailView
+		br.Data = resp
 		return
 	}
 
@@ -120,6 +128,7 @@ func (this *CalendarController) CompanyDetail() {
 		br.ErrMsg = "获取英文客户详情失败!Err:" + e.Error()
 		return
 	}
+	detailView := new(roadshow.CompanyDetailView)
 	detailView.CompanyId = enItem.CompanyId
 	detailView.CompanyName = enItem.CompanyName
 	detailView.Status = "正常"

+ 1 - 0
models/company/company_product.go

@@ -102,6 +102,7 @@ type CompanyProductDetail struct {
 	IsShare          int       `description:"0:非共享用户,1:共享客户"`
 	ShareSeller      string    `description:"共享销售员"`
 	ShareSellerId    int       `description:"共享销售员id"`
+	ViewTotal        int       `description:"总阅读次数"`
 	PermissionList   []*PermissionLookList
 }
 

+ 4 - 0
models/roadshow/calendar.go

@@ -21,6 +21,7 @@ type AddActivityReq struct {
 	ProvinceCode     string `description:"省编码"`
 	City             string `description:"市"`
 	CityCode         string `description:"市编码"`
+	District         string `description:"区"`
 	Theme            string `description:"会议主题"`
 	CooperationName  string `description:"合作方名称"`
 	ActivityCategory string `description:"活动类别"`
@@ -52,6 +53,7 @@ type RsCalendar struct {
 	ProvinceCode     string `description:"省编码"`
 	City             string `description:"市"`
 	CityCode         string `description:"市编码"`
+	District         string `description:"区"`
 	Theme            string `description:"会议主题"`
 	CooperationName  string `description:"合作方名称"`
 	Title            string `description:"展示在日历的标题"`
@@ -269,6 +271,7 @@ type CalendarListView struct {
 	ProvinceCode           string `description:"省编码"`
 	City                   string `description:"市"`
 	CityCode               string `description:"市编码"`
+	District               string `description:"区"`
 	Theme                  string `description:"会议主题"`
 	CooperationName        string `description:"合作方名称"`
 	ActivityCategory       string `description:"活动类别"`
@@ -533,6 +536,7 @@ type EditActivityReq struct {
 	ProvinceCode           string `description:"省编码"`
 	City                   string `description:"市"`
 	CityCode               string `description:"市编码"`
+	District               string `description:"区"`
 	Theme                  string `description:"会议主题"`
 	CooperationName        string `description:"合作方名称"`
 	ActivityCategory       string `description:"活动类别"`

+ 1 - 1
models/roadshow/company.go

@@ -37,7 +37,7 @@ func CompanySearchV2(sellerId int, keyWord string) (list []*CompanySearchView, e
 				0 AS english_company
 			FROM
 				company AS a
-			INNER JOIN company_product AS b ON a.company_id = b.company_id AND b.product_id = 1
+			INNER JOIN company_product AS b ON a.company_id = b.company_id 
 			WHERE
 				b.status IN ('正式', '试用') AND (b.seller_id = ? OR b.share_seller_id = ?) AND a.company_name LIKE ?
 			GROUP BY