Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hz_crm_api into cygx/cygx_11.1.1

xingzai 1 year ago
parent
commit
567e82e2fa
58 changed files with 4416 additions and 392 deletions
  1. 2 2
      controllers/business_trip/business_apply.go
  2. 115 5
      controllers/company.go
  3. 25 3
      controllers/company_apply_v2.go
  4. 1 1
      controllers/company_seller.go
  5. 178 36
      controllers/cygx/activity.go
  6. 24 15
      controllers/cygx/activity_meet.go
  7. 15 4
      controllers/cygx/activity_signup.go
  8. 2 0
      controllers/cygx/activity_special.go
  9. 118 26
      controllers/cygx/activity_special_trip.go
  10. 17 2
      controllers/cygx/cygx_activity_type.go
  11. 9 2
      controllers/cygx/industrial_management.go
  12. 2 0
      controllers/eta_business/eta_business.go
  13. 197 0
      controllers/eta_business/eta_business_menu.go
  14. 401 0
      controllers/eta_version_update_log.go
  15. 1 1
      controllers/full_company.go
  16. 539 0
      controllers/help_doc/classify.go
  17. 429 0
      controllers/help_doc/doc.go
  18. 1 1
      controllers/sys_menu.go
  19. 7 5
      go.mod
  20. 33 0
      go.sum
  21. 1 1
      models/company/company.go
  22. 17 0
      models/company/company_permission.go
  23. 184 158
      models/cygx/activity.go
  24. 27 26
      models/cygx/activity_meet.go
  25. 26 25
      models/cygx/activity_signup.go
  26. 19 2
      models/cygx/activity_special_trip.go
  27. 110 2
      models/cygx/activity_special_trip_bill.go
  28. 1 1
      models/cygx/activity_type.go
  29. 23 0
      models/cygx/aliyun_ocr_log.go
  30. 1 1
      models/cygx/company_user_type.go
  31. 39 0
      models/cygx/cygx_activity_special_points_company.go
  32. 32 0
      models/db.go
  33. 1 0
      models/eta_business/eta_business.go
  34. 147 0
      models/eta_business/eta_business_menu.go
  35. 133 0
      models/eta_business/eta_business_menu_relate.go
  36. 144 0
      models/eta_version_update_log.go
  37. 248 0
      models/help_doc/classify.go
  38. 192 0
      models/help_doc/help_doc.go
  39. 4 1
      models/yb/apply_record.go
  40. 171 0
      routers/commentsRouter.go
  41. 13 0
      routers/router.go
  42. 80 0
      services/aliyun_ocr.go
  43. 24 0
      services/company_apply/company_approval.go
  44. 6 0
      services/company_approval_message.go
  45. 5 5
      services/cygx/acitvity.go
  46. 157 0
      services/cygx/activity_ocr.go
  47. 1 1
      services/cygx/activity_poster.go
  48. 13 0
      services/cygx/activity_power_check.go
  49. 1 1
      services/cygx/activity_signup.go
  50. 367 61
      services/cygx/activity_special.go
  51. 12 4
      services/cygx/yidong.go
  52. 33 0
      services/data/help_doc_classify.go
  53. 10 0
      services/elastic/es_comprehensive.go
  54. 15 0
      services/eta_business/eta_business_menu.go
  55. 22 0
      services/task.go
  56. 12 0
      utils/common.go
  57. 2 0
      utils/config.go
  58. 7 0
      utils/constants.go

+ 2 - 2
controllers/business_trip/business_apply.go

@@ -166,7 +166,7 @@ func (this *BusinessTrip) ApplyAdd() {
 		}
 	}
 
-	approveItem, err := system.GetSysUserById(66)
+	approveItem, err := system.GetSysUserById(utils.ApproveUserId)
 	if err != nil {
 		br.Msg = "获取审批人信息失败!"
 		br.ErrMsg = "获取审批人信息失败,Err:" + err.Error()
@@ -508,7 +508,7 @@ func (this *BusinessTrip) ApplyEdit() {
 		}
 	}
 
-	approveItem, err := system.GetSysUserById(66)
+	approveItem, err := system.GetSysUserById(utils.ApproveUserId)
 	if err != nil {
 		br.Msg = "获取审批人信息失败!"
 		br.ErrMsg = "获取审批人信息失败,Err:" + err.Error()

+ 115 - 5
controllers/company.go

@@ -136,7 +136,7 @@ func (this *CompanyController) SearchList() {
 		item := list[i]
 		itemStatus := item.Status
 		//白嫖客户标记
-		if _, ok := scroungeMap[item.CompanyId]; ok{
+		if _, ok := scroungeMap[item.CompanyId]; ok {
 			item.IsScrounge = 1
 		}
 		if !strings.Contains(item.Status, "/") {
@@ -969,6 +969,8 @@ func (this *CompanyController) List() {
 				} else {
 					sortStr = " ORDER BY b.try_out_day_total "
 				}
+			} else if sortParam == "closeTime" {
+				sortStr = " ORDER BY b.close_time "
 			} else {
 				br.Msg = "获取失败"
 				br.ErrMsg = "排序字段传入数据异常:" + sortParam
@@ -1739,7 +1741,7 @@ func (this *CompanyController) List() {
 		scroungeMap[v.CompanyId] = 1
 	}
 	for i, v := range companyLists {
-		if _, ok := scroungeMap[v.CompanyId]; ok{
+		if _, ok := scroungeMap[v.CompanyId]; ok {
 			companyLists[i].IsScrounge = 1
 		}
 	}
@@ -3248,7 +3250,7 @@ func (this *CompanyController) Detail() {
 				return
 			}
 			// cygx8.2专项产业调研展示
-			item.SpecialSurplus, err = cygxService.GetSpecialSurplusByCompany(companyId)
+			item.SpecialSurplus, err = cygxService.GetSpecialSurplusByCompanyNew(companyId)
 			if err != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取专项调研信息失败,Err:" + err.Error()
@@ -3393,7 +3395,7 @@ func (this *CompanyController) Detail() {
 	for _, v := range scroungeList {
 		scroungeMap[v.CompanyId] = 1
 	}
-	if _, ok := scroungeMap[item.CompanyId]; ok{
+	if _, ok := scroungeMap[item.CompanyId]; ok {
 		item.IsScrounge = 1
 	}
 
@@ -3607,7 +3609,7 @@ func (this *CompanyController) DetailByCreditCode() {
 				//	checkList = append(checkList, n.ChartPermissionId)
 				//}
 			}
-			item.SpecialSurplus, err = cygxService.GetSpecialSurplusByCompany(companyId)
+			item.SpecialSurplus, err = cygxService.GetSpecialSurplusByCompanyNew(companyId)
 			if err != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取专项调研信息失败,Err:" + err.Error()
@@ -9226,3 +9228,111 @@ func (this *CompanyController) DelRemark() {
 	br.Success = true
 	br.Msg = "操作成功"
 }
+
+// @Title 获取流水信息接口
+// @Description 获取流水信息接口
+// @Param   CompanyId   query   int  true       "客户id"
+// @Success 200 {object} company.CygxActivityPointsBillListResp
+// @router /company/activity/special/points/bill [get]
+func (this *CompanyTodoController) CompanyActivitySpecialPointsBill() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	companyId, _ := this.GetInt("CompanyId")
+	if companyId <= 0 {
+		br.Msg = "请选择客户"
+		return
+	}
+
+	// 获取流水信息
+	var condition string
+	var pars []interface{}
+
+	condition += ` AND company_id = ? `
+	pars = append(pars, companyId)
+
+	//查询当年的数据
+	//condition += ` AND b.create_time >= ?  `
+	//pars = append(pars, time.Now().Format(utils.FormatYearDate)+"-01-01")
+	list, err := cygx.GetCygxActivitySpecialTripBillDetailListAll(condition, pars)
+	if err != nil {
+		br.Msg = "获取任务信息失败"
+		br.ErrMsg = "获取任务信息失败,err:" + err.Error()
+		return
+	}
+
+	//userType, tripRemaining, mapChartName, err := cygxService.GetChartPermissionSpecialSurplusByCompany(companyId)
+	//if err != nil {
+	//	br.Msg = "获取专项调研剩余次数失败"
+	//	br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+	//	return
+	//}
+	//chartMap := map[int]string{utils.YI_YAO_ID: utils.YI_YAO_NAME, utils.XIAO_FEI_ID: utils.XIAO_FEI_NAME, utils.KE_JI_ID: utils.KE_JI_NAME, utils.ZHI_ZAO_ID: utils.ZHI_ZAO_NAME}
+	resp := new(cygx.CygxActivitySpecialPointsBillResp)
+	//lastTripRemaining := 0
+	for _, v := range list {
+		item := cygx.CygxActivitySpecialPointsBillRespItem{
+			Id:                  v.Id,
+			CreateTime:          v.CreateTime.Format(utils.FormatDateTime),
+			CompanyId:           v.CompanyId,
+			CompanyName:         v.CompanyName,
+			RealName:            v.RealName,
+			BillDetailed:        v.BillDetailed,
+			ActivityName:        v.ResearchTheme,
+			ChartPermissionId:   v.ChartPermissionId,
+			ChartPermissionName: v.ChartPermissionName,
+			Total:               v.Total,
+		}
+		if v.ActivityId == 0 {
+			item.Content = v.Content
+		} else {
+			if v.DoType == 1 && v.Way != 4 && v.Way != 3 {
+				item.Content = item.ActivityName + "--报名"
+			} else if v.DoType == 2 && v.Way != 4 && v.Way != 3  {
+				item.Content = item.ActivityName + "--取消报名"
+			} else if v.Way == 4 {
+				item.Content = item.ActivityName + "--活动取消"
+			}
+		}
+		//if userType == 2 {
+		//	if i== 0 {
+		//		item.Total += strconv.Itoa(tripRemaining) + "次"
+		//	} else {
+		//		item.Total += strconv.Itoa(tripRemaining-list[i-1].BillDetailed) + "次"
+		//	}
+		//	//if v.BillDetailed < 4 {
+		//	//	item.Total += strconv.Itoa(lastTripRemaining-list[i-1].BillDetailed) + "次"
+		//	//} else {
+		//	//	item.Total += strconv.Itoa(lastTripRemaining) + "次"
+		//	//}
+		//} else {
+		//	for k, num := range mapChartName {
+		//		if i== 0 {
+		//			item.Total += k + strconv.Itoa(num) + "次+"
+		//		} else {
+		//			if list[i-1].ActivityId == 0 {
+		//				item.Total += k + strconv.Itoa(num) + "次+"
+		//			} else {
+		//				item.Total += k + strconv.Itoa(num-list[i-1].BillDetailed) + "次+"
+		//			}
+		//		}
+		//		//if num > 0 {
+		//		//	if i== 0{
+		//		//		item.Total += k + strconv.Itoa(num) + "次+"
+		//		//	} else {
+		//		//		item.Total += k + strconv.Itoa(num-v.BillDetailed) + "次+"
+		//		//	}
+		//		//}
+		//	}
+		//	item.Total = strings.TrimRight(item.Total, "+")
+		//}
+		resp.List = append(resp.List, &item)
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 25 - 3
controllers/company_apply_v2.go

@@ -519,8 +519,15 @@ func (this *CompanyApplyController) ApplyTurnPositive() {
 		br.ErrMsg = "客户状态为:" + companyProduct.Status + ";不可进行转正申请"
 		return
 	}
+
+	companyItem, e := company.GetCompanyById(req.CompanyId)
+	if e != nil {
+		br.Msg = "客户信息有误"
+		br.ErrMsg = "获取客户信息失败, Err: " + e.Error()
+		return
+	}
 	//客户归属判断
-	if companyProduct.SellerId != sysUser.AdminId {
+	if companyProduct.SellerId != sysUser.AdminId && companyItem.ShareSellerId != sysUser.AdminId {
 		br.Msg = "客户信息异常"
 		br.ErrMsg = "客户信息异常,不是当前所属销售,客户所属销售:" + companyProduct.SellerName + ";当前销售:" + sysUser.AdminName
 		return
@@ -1397,12 +1404,19 @@ func (this *CompanyApplyController) ApplyThaw() {
 		return
 	}
 
+	companyItem, e := company.GetCompanyById(req.CompanyId)
+	if e != nil {
+		br.Msg = "客户信息有误"
+		br.ErrMsg = "获取客户信息失败, Err: " + e.Error()
+		return
+	}
 	//客户归属判断
-	if companyProduct.SellerId != sysUser.AdminId {
+	if companyProduct.SellerId != sysUser.AdminId && companyItem.ShareSellerId != sysUser.AdminId {
 		br.Msg = "客户信息异常"
 		br.ErrMsg = "客户信息异常,不是当前所属销售,客户所属销售:" + companyProduct.SellerName + ";当前销售:" + sysUser.AdminName
 		return
 	}
+
 	// CRM8.8(仅针对权益客户)-此处同申请试用的逻辑
 	if companyProduct.ProductId == utils.COMPANY_PRODUCT_RAI_ID {
 		reportPermissions, e := company.GetCompanyReportPermission(req.CompanyId, utils.COMPANY_PRODUCT_RAI_ID)
@@ -1643,12 +1657,20 @@ func (this *CompanyApplyController) ApplyDelay() {
 		br.Msg = "存在待审批订单,不可重复提交"
 		return
 	}
+
+	companyItem, e := company.GetCompanyById(req.CompanyId)
+	if e != nil {
+		br.Msg = "客户信息有误"
+		br.ErrMsg = "获取客户信息失败, Err: " + e.Error()
+		return
+	}
 	//客户归属判断
-	if companyProduct.SellerId != sysUser.AdminId {
+	if companyProduct.SellerId != sysUser.AdminId && companyItem.ShareSellerId != sysUser.AdminId {
 		br.Msg = "客户信息异常"
 		br.ErrMsg = "客户信息异常,不是当前所属销售,客户所属销售:" + companyProduct.SellerName + ";当前销售:" + sysUser.AdminName
 		return
 	}
+
 	// CRM8.8(仅针对权益客户)-申请延期的权限不再进行选择, 而是自动将所有的试用权限延期
 	if companyProduct.ProductId == utils.COMPANY_PRODUCT_RAI_ID {
 		reportPermissions, e := company.GetCompanyReportPermission(req.CompanyId, utils.COMPANY_PRODUCT_RAI_ID)

+ 1 - 1
controllers/company_seller.go

@@ -2424,7 +2424,7 @@ func (this *CompanySellerController) RoadshowFiccList() {
 		utils.ROLE_TYPE_CODE_FICC_ADMIN, utils.ROLE_TYPE_CODE_FICC_DEPARTMENT, utils.ROLE_TYPE_CODE_FICC_GROUP,
 		utils.ROLE_TYPE_CODE_FICC_TEAM, utils.ROLE_TYPE_CODE_FICC_SELLER,
 	}
-	cond := fmt.Sprintf(` AND role_type_code IN (%s)`, utils.GetOrmInReplace(len(roleArr)))
+	cond := fmt.Sprintf(` AND role_type_code IN (%s) AND enabled = 1`, utils.GetOrmInReplace(len(roleArr)))
 	pars := make([]interface{}, 0)
 	pars = append(pars, roleArr)
 	sellers, e := system.GetSysUserItemsOrderByCreated(cond, pars)

+ 178 - 36
controllers/cygx/activity.go

@@ -85,10 +85,30 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
+
+	//处理识图建会的会议信息列表 因为活动发布处理的业务逻辑过多,方便后期统一维护这里 根据 list 数据类型自己拼接 活动的 body  查研观向 11.12
+	listImgToText := req.ListImgToText
+
+	if len(listImgToText) > 0 {
+		var errmsg string
+		req, err, errmsg = cygxService.MakeActivityReqText(listImgToText)
+		if err != nil {
+			br.Msg = "识图建会失败!"
+			br.ErrMsg = "参数解析失败,Err:" + err.Error()
+			return
+		}
+		if errmsg != "" {
+			br.Msg = "识图建会失败," + errmsg
+			br.ErrMsg = "识图建会失败," + errmsg
+			return
+		}
+	}
 	if req.Body == "" {
 		br.Msg = "内容不可为空"
 		return
 	}
+
+	//return
 	//不限制人数的,强制改为全部客户可见
 	if req.LimitPeopleNum == 0 {
 		req.VisibleRange = 2
@@ -108,6 +128,11 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 	videoDetail := req.VideoDetail
 	isBClass := req.IsBClass
 	isResearchPoints := req.IsResearchPoints
+	isShowHz := req.IsShowHz
+	isResearch := req.IsResearch //是否是研选类型的活动
+	if isResearch {
+		req.PermissionName = utils.CHART_PERMISSION_NAME_MF_YANXUAN
+	}
 	var items []*cygx.CygxActivity
 	//temporaryLabel := req.TemporaryLabel
 	industrialManagementIdS := req.IndustrialManagementIdS
@@ -276,17 +301,17 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 		}
 	}
 	permissionName := req.PermissionName
-	List := cygxService.GetActChartPermissionList()
-	var haveCheck bool
-	for _, v := range List {
-		if permissionName == v.PermissionName {
-			haveCheck = true
-		}
-	}
-	if !haveCheck {
-		br.Msg = "行业名称:" + permissionName + "不存在"
-		return
-	}
+	//List := cygxService.GetActChartPermissionList()
+	//var haveCheck bool
+	//for _, v := range List {
+	//	if permissionName == v.PermissionName {
+	//		haveCheck = true
+	//	}
+	//}
+	//if !haveCheck {
+	//	br.Msg = "行业名称:" + permissionName + "不存在"
+	//	return
+	//}
 	if strings.Contains(permissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
 		permissionName = utils.CHART_PERMISSION_NAME_MF_YANXUAN
 	}
@@ -359,7 +384,6 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 		}
 		itemPointsSet = itemResp
 	}
-
 	for k, v := range slice {
 		//如果内容不存在 时间:字段则不予处理
 		if strings.Contains(v, "时间:") || strings.Contains(v, "时间:") {
@@ -418,7 +442,14 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 			item.IsYidongConduct = req.IsYidongConduct
 			item.IsCanOutboundCall = req.IsCanOutboundCall
 			item.IsNeedEmail = isNeedEmail
-			item.SiginupDeadline = siginupDeadline
+
+			if len(listImgToText) > 0 {
+				resultTime := utils.StrTimeToTime(item.ActivityTime)                                       //时间字符串格式转时间格式
+				item.SiginupDeadline = resultTime.AddDate(0, 0, -1).Format(utils.FormatDate) + " 15:30:00" //批量建会报名截止之前默认:活动前一天15:30:00
+			} else {
+				item.SiginupDeadline = siginupDeadline
+			}
+
 			if isResearchPoints == 1 {
 				item.IsResearchPoints = 1
 			}
@@ -435,6 +466,9 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 			item.Scale = scale
 			item.IsExternalLabel = isExternalLabel
 			item.IsAllCustomerType = req.IsAllCustomerType
+			item.IsShowHz = isShowHz
+			item.ChartPermissionIdDeputy = charInfo.ChartPermissionId
+			item.ChartPermissionNameDeputy = charInfo.PermissionName
 			if len(labelList) == 1 {
 				item.IsCanAppointmentMinutes = labelList[0].IsCanAppointmentMinutes
 			} else {
@@ -674,12 +708,10 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 				//更新活动音频
 				if int(voiceIdNew) > 0 {
 					go cygxService.UpdateResourceData(int(voiceIdNew), "activityvoice", "add", activityInfo.ActivityTime)
-					go elastic.AddComprehensiveActivityVoice(activityId) //更新ES中的活动音频内容
 				}
 				//更新活动视频
 				if int(videoIdNew) > 0 {
 					go cygxService.UpdateResourceData(int(videoIdNew), "activityvideo", "add", activityInfo.ActivityTime)
-					go elastic.AddComprehensiveActivityVideo(activityId) //更新ES中的活动视频内容
 				}
 
 				errAct = err
@@ -708,7 +740,6 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 						go cygxService.DoActivityOnenIdWxTemplateMsg(activityId)
 					}
 				}
-
 				//已结束或者进行中的活动修改时间后,修改活动状态以及重新发送邮件附件
 				if activeState != 0 && activeState != 1 {
 					resultTime := utils.StrTimeToTime(item.ActivityTime) //时间字符串格式转时间格式
@@ -731,10 +762,9 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 				if activityInfo.ActivityName != item.ActivityName || activityInfo.SigninImg == "" {
 					go cygxService.MakeActivitySigninImg(req.ActivityId)
 				}
-
+				//如果活动之前是发布的状态,那么就对公司的扣点进行更新(涉及到新老公司的扣点返点,不放在Redis统一处理了)
 				if activityInfo.PublishStatus == 1 {
-					go cygxService.UpdateYanXuanActivityPointsBillOldComapny(activityInfo, AdminUser.AdminId, itemPointsSet, itemPointsSetOld) //活动发布以及取消发布处理研选扣点,如果活动之前是发布的状态,那么就对公司的扣点进行更新(涉及到新老公司的扣点返点,不放在Redis统一处理了)
-					go elastic.AddComprehensiveActivity(item.ActivityId)                                                                       // Es添加活动
+					go cygxService.UpdateYanXuanActivityPointsBillOldComapny(activityInfo, AdminUser.AdminId, itemPointsSet, itemPointsSetOld) //活动发布以及取消发布处理研选扣点
 				}
 
 				//如果活动之前是未发布的状态,现在又发布了那么就对公司的扣点进行更新
@@ -758,15 +788,18 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 			br.ErrMsg = "发布失败,Err:" + err.Error()
 			return
 		}
-
 		//如果是添加多条活动那么就推送多次
 		for _, v := range activityIdArr {
 			if req.DoType == 1 {
-				go cygxService.DoActivityOnenIdWxTemplateMsg(v)
-				go cygxService.UpdateResourceData(v, "activity", "add", time.Now().Format(utils.FormatDateTime))
-				go cygxService.YiDongSaveRoadshowDetail(v)
-				go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(v, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣点
-				go elastic.AddComprehensiveActivity(v)                                                    // Es添加活动
+				go func() {
+					//同时添加多个活动的时候,避免协程开的过多
+					cygxService.DoActivityOnenIdWxTemplateMsg(v)
+					cygxService.UpdateResourceData(v, "activity", "add", time.Now().Format(utils.FormatDateTime))
+					cygxService.YiDongSaveRoadshowDetail(v)
+					cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(v, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣
+					elastic.AddComprehensiveActivity(v)
+				}()
+
 			}
 			go cygxService.MakeActivitySigninImg(v)
 		}
@@ -776,8 +809,11 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 			go cygxService.UpdateResourceData(req.ActivityId, "activity", "add", time.Now().Format(utils.FormatDateTime))
 			go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, 1) //活动发布以及取消发布处理研选扣点
 		}
+		//如果二次编辑的时候,取消了易董办会选项,那么就对易董发送取消发布到广场的通知
+		if req.IsYidongConduct == 0 {
+			go cygxService.YiDongUpdateActivityStatus(activityId)
+		}
 	}
-
 	// 查研观向7.4-更新产业布局时间
 	if len(industryIds) > 0 {
 		go cygxService.UpdateIndustryLayoutTime(industryIds, false)
@@ -802,6 +838,7 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 // @Param   PublishEndDate   query   string  false       "发布结束时间,列如2021-03-06 "
 // @Param   KeyWord   query   string  false       "搜索关键词"
 // @Param   ActiveState   query   string  false       "活动进行状态 未开始:NotStarted、进行中HaveInHand、已结束Complete"
+// @Param   IsResearch   query   bool  true       "是否为研选"
 // @Success 200 {object} cygx.GetCygxActivityListRep
 // @router /activity/list [get]
 func (this *ActivityCoAntroller) ActivityList() {
@@ -828,10 +865,12 @@ func (this *ActivityCoAntroller) ActivityList() {
 	publishEndDate := this.GetString("PublishEndDate")
 	keyWord := this.GetString("KeyWord")
 	activeState := this.GetString("ActiveState")
-	activityLabel := this.GetString("ActivityLabel") // 查研观向7.4-活动标签
+	activityLabel := this.GetString("ActivityLabel")   // 查研观向7.4-活动标签
+	isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
 	if activeState != "HaveInHand" && activeState != "Complete" {
 		activeState = "NotStarted"
 	}
+
 	var startSize int
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
@@ -846,6 +885,11 @@ func (this *ActivityCoAntroller) ActivityList() {
 	if keyWord != "" {
 		condition += ` AND (art.activity_name LIKE '%` + keyWord + `%' )  `
 	}
+	if isResearch {
+		chartPermissionId = utils.CHART_PERMISSION_ID_YANXUAN
+	} else {
+		condition += ` AND art.chart_permission_id  !=  '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `'`
+	}
 	//行业名称
 	if chartPermissionId > 0 {
 		condition += ` AND art.chart_permission_id  =  '` + strconv.Itoa(chartPermissionId) + `'`
@@ -886,9 +930,7 @@ func (this *ActivityCoAntroller) ActivityList() {
 	}
 	// 活动标签
 	if activityLabel != "" {
-		keywords := "%" + activityLabel + "%"
-		condition += ` AND art.label LIKE ?`
-		pars = append(pars, keywords)
+		condition += ` AND (art.label LIKE '%` + activityLabel + `%' )  `
 	}
 
 	//C类电话会,仅本组销售、部门管理员、admin、权益研究员账号能看到。
@@ -997,13 +1039,16 @@ func (this *ActivityCoAntroller) ActivityList() {
 		}
 		if v.YidongActivityId != "" {
 			list[k].ActivityTypeName += utils.YI_DONG_NAME
+			if v.ChartPermissionNameDeputy != "" && v.ChartPermissionNameDeputy != v.ChartPermissionName {
+				v.ChartPermissionName = v.ChartPermissionNameDeputy // 易董同步过来的活动展示副权限  v11.0
+			}
 		}
 		if v.IsYidongConduct == 1 {
 			list[k].ActivityTypeName += utils.YI_DONG_NAME_TWO
 		}
 		list[k].IsUpload = mapUpload[v.ActivityId]
 		//是否展示签到码
-		if (v.ActivityTypeId == 5 || v.ActivityTypeId == 6) && v.SigninImg != "" && v.ActiveState == 1 && v.PublishStatus == 1 {
+		if (v.ActivityTypeId == 5 || v.ActivityTypeId == 6 || v.ActivityTypeId == 8) && v.SigninImg != "" && v.ActiveState == 1 && v.PublishStatus == 1 {
 			list[k].IsShowSigninButton = true
 		}
 	}
@@ -1190,10 +1235,10 @@ func (this *ActivityCoAntroller) PublishAndCancel() {
 		br.Msg = popupMsg
 		return
 	}
-	if activityInfo.ActiveState != 1 {
-		br.Msg = "活动已经开始,无法修改"
-		return
-	}
+	//if activityInfo.ActiveState != 1 {
+	//	br.Msg = "活动已经开始,无法修改"
+	//	return
+	//}
 	if activityInfo.PublishStatus == 0 {
 		item.PublishStatus = 1
 		item.IsCancel = 0
@@ -1234,7 +1279,7 @@ func (this *ActivityCoAntroller) PublishAndCancel() {
 	}
 	go cygxService.YanXuanActivityPointsBillActivityPublishAndCancel(activityId, AdminUser.AdminId, item.PublishStatus) //活动发布以及取消发布处理研选扣点
 
-	go elastic.AddComprehensiveActivity(activityId) // Es添加活动
+	go elastic.AddComprehensiveActivity(activityId) // 同步Es添加活动
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "操作成功"
@@ -1316,6 +1361,7 @@ func (this *ActivityCoAntroller) Delete() {
 
 // @Title 获取活动行业分类
 // @Description 获取活动行业分类接口
+// @Param   IsHideResearch  query  bool  false  "是否隐藏买方研选(默认不隐藏)"
 // @Success 200 {object} cygx.ChartPermissionRepMoreList
 // @router /activity/chartPermission/list [get]
 func (this *ActivityCoAntroller) ChartPermissionListAct() {
@@ -1454,3 +1500,99 @@ func (this *ActivityCoAntroller) DeadlineSet() {
 	br.Success = true
 	br.Data = list
 }
+
+// @Title 根据图片获取建会信息接口
+// @Description 根据图片获取建会信息接口
+// @Param   request	body cygx.ActivityIdRep true "type json string"
+// @Success Ret=200
+// @router /activity/imgToText [post]
+func (this *ActivityCoAntroller) ImgToText() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	AdminUser := this.SysUser
+	if AdminUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var req cygx.AliyunOcrImgUrlReq
+	resp := new(cygx.AliyunOcrTextActivityListResp)
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	imgUrl := req.ImgUrl
+	if imgUrl == "" {
+		br.Msg = "请上传图片"
+		return
+	}
+
+	ocrResp, err := services.AliOcrByImageToText(imgUrl)
+	if err != nil {
+		br.Msg = "图片解析失败!"
+		br.ErrMsg = "图片解析失败,Err:" + err.Error()
+		return
+	}
+	if len(ocrResp.Ret) == 0 {
+		br.Msg = "图片解析失败!"
+		return
+	}
+
+	var titmeYMD string
+	var titmeHM string
+	var company string
+	var list []*cygx.AliyunOcrTextActivityResp
+	var mapTitmeYMD = make(map[int]string)
+	var mapTitmeHM = make(map[int]string)
+	var mapCompany = make(map[int]string)
+	var lineNum int
+	for k, v := range ocrResp.Ret {
+		if k == 0 && !strings.Contains(v.Word, "/") {
+			continue
+		}
+		if strings.Contains(v.Word, "/") {
+			mapTitmeYMD[lineNum] = v.Word
+			titmeYMD = v.Word
+		}
+		if strings.Contains(v.Word, "AM") || strings.Contains(v.Word, "PM") {
+			mapTitmeHM[lineNum] = v.Word
+			titmeHM = v.Word
+		}
+		if strings.Contains(v.Word, "(") && strings.Contains(v.Word, ")") {
+			if mapTitmeYMD[lineNum] == "" {
+				mapTitmeYMD[lineNum] = mapTitmeYMD[lineNum-1]
+			}
+			titmeYMD = mapTitmeYMD[lineNum]
+			mapCompany[lineNum] = v.Word
+			company = v.Word
+			lineNum++
+
+		}
+		if titmeYMD != "" && titmeHM != "" && company != "" {
+			item := new(cygx.AliyunOcrTextActivityResp)
+			item.TitmeYMD = titmeYMD
+			item.TitmeHM = titmeHM
+			item.Company = company
+			list = append(list, item)
+			titmeYMD = ""
+			titmeHM = ""
+			company = ""
+		}
+	}
+
+	for _, v := range list {
+		v.TitmeYMD = cygxService.ConvertActivityTitmeYMD(v.TitmeYMD)
+		v.TitmeHM = cygxService.ConvertActivityTitmeHM(v.TitmeHM)
+	}
+	resp.List = list
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+	br.IsAddLog = true
+}

+ 24 - 15
controllers/cygx/activity_meet.go

@@ -35,6 +35,7 @@ type ActivityMeetCoAntroller struct {
 // @Param   EndDate   query   string  false       "结束时间,列如2021-03-06 "
 // @Param   KeyWord   query   string  false       "搜索关键词"
 // @Param   MeetType   query   int  true       "会议类型 1线上、2线下"
+// @Param   IsResearch   query   bool  true       "是否为研选"
 // @Success 200 {object} cygx.GetCygxMeetListRep
 // @router /activityMeet/list [get]
 func (this *ActivityMeetCoAntroller) MeetList() {
@@ -58,7 +59,7 @@ func (this *ActivityMeetCoAntroller) MeetList() {
 	endDate := this.GetString("EndDate")
 	keyWord := this.GetString("KeyWord")
 	meetType, _ := this.GetInt("MeetType")
-
+	isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
 	var startSize int
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
@@ -78,11 +79,16 @@ func (this *ActivityMeetCoAntroller) MeetList() {
 	if meetType == 1 {
 		condition += ` AND a.activity_type_id  IN (1,2,3,7)  `
 	} else {
-		condition += ` AND a.activity_type_id  IN (4,5,6) ` //默认
+		condition += ` AND a.activity_type_id  IN (4,5,6,8) ` //默认
 	}
 	if ActivityTypeId != "" {
 		condition += ` AND a.activity_type_id IN (` + ActivityTypeId + `) `
 	}
+	if isResearch {
+		chartPermissionId = utils.CHART_PERMISSION_ID_YANXUAN
+	} else {
+		condition += ` AND a.chart_permission_id  !=  '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `'`
+	}
 	//行业名称
 	if chartPermissionId > 0 {
 		condition += ` AND a.chart_permission_id  =  '` + strconv.Itoa(chartPermissionId) + `'`
@@ -173,6 +179,10 @@ func (this *ActivityMeetCoAntroller) MeetList() {
 			if v.IsSubmitMeeting == 1 {
 				list[k].IsShowAttendanceDetails = true
 			}
+
+			if v.ChartPermissionNameDeputy != "" && v.ChartPermissionNameDeputy != v.ChartPermissionName {
+				v.ChartPermissionName = v.ChartPermissionNameDeputy // 易董同步过来的活动展示副权限  v11.0
+			}
 		}
 
 		//判断是否是易董在易董举办的会议
@@ -182,7 +192,7 @@ func (this *ActivityMeetCoAntroller) MeetList() {
 			list[k].IsShowUpdateMeeting = false
 		}
 		//是否展示签到码
-		if (v.ActivityTypeId == 5 || v.ActivityTypeId == 6) && v.SigninImg != "" {
+		if (v.ActivityTypeId == 5 || v.ActivityTypeId == 6 || v.ActivityTypeId == 8) && v.SigninImg != "" {
 			list[k].IsShowSigninButton = true
 		}
 		list[k].MeetPeopleNum += v.PotentialPeopleNum //加上潜在客户人数
@@ -341,18 +351,17 @@ func (this *ActivityMeetCoAntroller) MeetingDo() {
 		br.ErrMsg = "操作失败,Err:" + errInfo.Error()
 		return
 	}
-	//校验活动后台管理员、销售是否有修改权限 校验需求取消 2023-7-10
-	//havePower, popupMsg, err := cygxService.CheckActivityUpdatePower(AdminUser.AdminId, activityInfo)
-	//if err != nil {
-	//	br.Msg = "获取管理员身份信息失败"
-	//	br.ErrMsg = "获取管理员身份信息失败,Err:" + err.Error()
-	//	return
-	//}
-	//if !havePower {
-	//	br.Msg = popupMsg
-	//	return
-	//}
-
+	//校验活动后台管理员、销售是否有修改权限
+	havePower, popupMsg, err := cygxService.CheckActivityUpdatePower(AdminUser.AdminId, activityInfo)
+	if err != nil {
+		br.Msg = "获取管理员身份信息失败"
+		br.ErrMsg = "获取管理员身份信息失败,Err:" + err.Error()
+		return
+	}
+	if !havePower {
+		br.Msg = popupMsg
+		return
+	}
 	noMeetingUids, err := cygx.GetSignupUserIds(activityId, meetingUids) //未到会的用户ID
 	if err != nil {
 		br.Msg = "获取信息失败"

+ 15 - 4
controllers/cygx/activity_signup.go

@@ -34,9 +34,10 @@ type ActivitySignupCoAntroller struct {
 // @Param   StartDate   query   string  false       "开始时间 ,列如2021-03-06 "
 // @Param   EndDate   query   string  false       "结束时间,列如2021-03-06 "
 // @Param   KeyWord   query   string  false       "搜索关键词"
-// @Param   SearchType   query   int  true       "筛选类型 1专家/分析师电话会、2专家/分析师线下沙龙 、3公司调研/、4C类电话会"
+// @Param   SearchType   query   int  true       "筛选类型 1专家/分析师电话会、2专家/分析师线下沙龙 、3公司调研/、4C类电话会、5买方线下交流"
 // @Param   ActiveState   query   int  false       "发布状态 ,1未开始、2进行中、3已结束 ,默认1未开始"
 // @Param   PublishStatus   query   int  false       "发布状态 ,0未发布,1已发布,3已取消,传2查询所有"
+// @Param   IsResearch   query   bool  true       "是否为研选"
 // @Success 200 {object} cygx.GetCygxSignupListRep
 // @router /activitySignup/list [get]
 func (this *ActivitySignupCoAntroller) SignupList() {
@@ -62,6 +63,7 @@ func (this *ActivitySignupCoAntroller) SignupList() {
 	activeState, _ := this.GetInt("ActiveState")
 	searchType, _ := this.GetInt("SearchType")
 	publishStatus, _ := this.GetInt("PublishStatus")
+	isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
 	if activeState == 0 {
 		activeState = 1
 	}
@@ -78,7 +80,6 @@ func (this *ActivitySignupCoAntroller) SignupList() {
 	var pars []interface{}
 	if keyWord != "" {
 		template.HTMLEscapeString(keyWord)
-		fmt.Println("keyWord", keyWord)
 		keyWord = "%" + keyWord + "%"
 		condition += ` AND (art.activity_name LIKE  ? )  `
 		pars = append(pars, keyWord)
@@ -86,7 +87,9 @@ func (this *ActivitySignupCoAntroller) SignupList() {
 	condition += ` 	 AND art.active_state =  ?  `
 	pars = append(pars, activeState)
 	if ActivityTypeId == "" {
-		if searchType == 4 {
+		if searchType == 5 {
+			condition += ` AND art.activity_type_id  IN (8) `
+		} else if searchType == 4 {
 			condition += ` AND art.activity_type_id  IN (7) `
 		} else if searchType == 3 {
 			condition += ` AND art.activity_type_id  IN (3,4) `
@@ -99,6 +102,11 @@ func (this *ActivitySignupCoAntroller) SignupList() {
 	if ActivityTypeId != "" {
 		condition += ` AND art.activity_type_id IN (` + ActivityTypeId + `) `
 	}
+	if isResearch {
+		chartPermissionId = utils.CHART_PERMISSION_ID_YANXUAN
+	} else {
+		condition += ` AND art.chart_permission_id  !=  '` + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + `'`
+	}
 	//行业名称
 	if chartPermissionId > 0 {
 		condition += ` AND art.chart_permission_id  =  '` + strconv.Itoa(chartPermissionId) + `'`
@@ -157,6 +165,10 @@ func (this *ActivitySignupCoAntroller) SignupList() {
 		//	list[k].IsShowAppointment = cygxService.IsShowAppointmentByadminSet(v.IsCanAppointmentMinutes)
 		//}
 		activityIds += strconv.Itoa(v.ActivityId) + ","
+
+		if v.ChartPermissionNameDeputy != "" && v.ChartPermissionNameDeputy != v.ChartPermissionName && v.YidongActivityId != "" {
+			v.ChartPermissionName = v.ChartPermissionNameDeputy // 易董同步过来的活动展示副权限  v11.0
+		}
 	}
 	activityIds = strings.TrimRight(activityIds, ",")
 	mapIndustrial := make(map[int]string)
@@ -1726,7 +1738,6 @@ func (this *ActivitySignupCoAntroller) AddSignuUser() {
 					br.ErrMsg = "活动ID:" + strconv.Itoa(activityId) + "活动名称:" + activityInfo.ActivityName + "用户ID:" + strconv.Itoa(int(wxUser.UserId))
 					return
 				}
-
 				popupMsg, err := cygxService.CheckActivityUserAll(activityInfo, wxUser)
 				if err != nil {
 					br.Msg = "报名失败!"

+ 2 - 0
controllers/cygx/activity_special.go

@@ -521,6 +521,8 @@ func (this *ActivitySpecialCoAntroller) PublishAndCancel() {
 		updateParams["PublishDate"] = time.Now()
 	} else {
 		item.PublishStatus = 0
+		// 取消专项调研返点
+		go cygxService.ActivitySpecialPublishAndCancel(activityInfo)
 	}
 	updateParams["PublishStatus"] = item.PublishStatus
 	item.ActivityId = req.ActivityId

+ 118 - 26
controllers/cygx/activity_special_trip.go

@@ -63,7 +63,7 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
 		uids += strconv.Itoa(v.UserId) + ","
 	}
 	uids = strings.TrimRight(uids, ",")
-	for _, v := range uidList {
+	for i, v := range uidList {
 		uid := v.UserId
 		wxUser, userErr := models.GetWxUserByUserId(uid)
 		if userErr != nil {
@@ -128,6 +128,12 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
 				return
 			}
 			if total == 0 {
+				totalAll, err := cygx.GetUserActivitySpecialTripCount(uid, activityId)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
+					return
+				}
 				//流水记录表
 				itemBill := new(cygx.CygxActivitySpecialTripBill)
 				itemBill.UserId = infoUser.UserId
@@ -145,36 +151,68 @@ func (this *ActivitySpecialTripCoAntroller) AddUser() {
 				itemBill.ChartPermissionId = activityInfo.ChartPermissionId
 				itemBill.AdminId = AdminUser.AdminId
 
-				item := new(cygx.CygxActivitySpecialTrip)
-				item.UserId = infoUser.UserId
-				item.RealName = infoUser.RealName
-				item.SellerName = infoUser.SellerName
-				item.ActivityId = activityId
-				item.CreateTime = time.Now()
-				item.Mobile = infoUser.Mobile
-				item.Email = infoUser.Email
-				item.Email = infoUser.Email
-				item.CompanyId = infoUser.CompanyId
-				item.CompanyName = infoUser.CompanyName
-				item.AdminId = AdminUser.AdminId
-				item.Source = 2
-				//优先绑定用户修改过的外呼手机号
-				if infoUser.OutboundMobile != "" {
-					item.OutboundMobile = infoUser.OutboundMobile
-					if infoUser.OutboundCountryCode == "" {
-						item.CountryCode = "86"
+				if totalAll == 0 {
+					item := new(cygx.CygxActivitySpecialTrip)
+					item.UserId = infoUser.UserId
+					item.RealName = infoUser.RealName
+					item.SellerName = infoUser.SellerName
+					item.ActivityId = activityId
+					item.CreateTime = time.Now()
+					item.Mobile = infoUser.Mobile
+					item.Email = infoUser.Email
+					item.Email = infoUser.Email
+					item.CompanyId = infoUser.CompanyId
+					item.CompanyName = infoUser.CompanyName
+					item.AdminId = AdminUser.AdminId
+					item.Source = 2
+					//优先绑定用户修改过的外呼手机号
+					if infoUser.OutboundMobile != "" {
+						item.OutboundMobile = infoUser.OutboundMobile
+						if infoUser.OutboundCountryCode == "" {
+							item.CountryCode = "86"
+						} else {
+							item.CountryCode = infoUser.OutboundCountryCode
+						}
 					} else {
-						item.CountryCode = infoUser.OutboundCountryCode
+						item.OutboundMobile = infoUser.Mobile
+						if infoUser.CountryCode == "" {
+							item.CountryCode = "86"
+						} else {
+							item.CountryCode = infoUser.CountryCode
+						}
 					}
+					items = append(items, item)
 				} else {
-					item.OutboundMobile = infoUser.Mobile
-					if infoUser.CountryCode == "" {
-						item.CountryCode = "86"
-					} else {
-						item.CountryCode = infoUser.CountryCode
+					err = cygx.UpdateSpecialTrip(1,0,uid, activityId)
+					if err != nil {
+						br.Msg = "报名失败,"
+						br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
+						return
+					}
+					resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
+					//48小时之内的取消也扣除一次参会记录
+					if time.Now().Add(+time.Hour * 48).After(resultTime) {
+						itemBill.BillDetailed = 0 //48小时之内,取消报名之后二次报名,不扣除流水记录
 					}
 				}
-				items = append(items, item)
+				userType, tripRemaining, mapChartName, err := cygxService.GetChartPermissionSpecialSurplusByCompany(infoUser.CompanyId)
+				if err != nil {
+					br.Msg = "获取专项调研剩余次数失败"
+					br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+					return
+				}
+				if userType == 2 {
+					tripRemaining = tripRemaining + itemBill.BillDetailed-i
+					itemBill.Total = strconv.Itoa(tripRemaining) + "次"
+				} else {
+					for k, num := range mapChartName {
+						if activityInfo.ChartPermissionName == k {
+							num = num + itemBill.BillDetailed - i
+						}
+						itemBill.Total += k + strconv.Itoa(num) + "次+"
+					}
+					itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+				}
 				itemsBill = append(itemsBill, itemBill)
 			}
 
@@ -508,6 +546,24 @@ func (this *ActivitySpecialTripCoAntroller) TripCancel() {
 		br.ErrMsg = "修改失败 Err:" + err.Error()
 		return
 	}
+	userType, tripRemaining, mapChartName, err := cygxService.GetChartPermissionSpecialSurplusByCompany(infoUser.CompanyId)
+	if err != nil {
+		br.Msg = "获取专项调研剩余次数失败"
+		br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+		return
+	}
+	if userType == 2 {
+		tripRemaining += itemBill.BillDetailed
+		itemBill.Total = strconv.Itoa(tripRemaining) + "次"
+	} else {
+		for k, num := range mapChartName {
+			if activityInfo.ChartPermissionName == k {
+				num += itemBill.BillDetailed
+			}
+			itemBill.Total += k + strconv.Itoa(num) + "次+"
+		}
+		itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+	}
 	err = cygx.AddCygxActivitySpecialTripBill(itemBill)
 	if err != nil {
 		br.Msg = "修改失败"
@@ -736,6 +792,24 @@ func (this *ActivitySpecialTripCoAntroller) MeetingDo() {
 				itemBill.ChartPermissionId = activityInfo.ChartPermissionId
 				itemBill.AdminId = AdminUser.AdminId
 				itemBill.Way = 2
+				userType, tripRemaining, mapChartName, err := cygxService.GetChartPermissionSpecialSurplusByCompany(v.CompanyId)
+				if err != nil {
+					br.Msg = "获取专项调研剩余次数失败"
+					br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+					return
+				}
+				if userType == 2 {
+					tripRemaining += itemBill.BillDetailed
+					itemBill.Total = strconv.Itoa(tripRemaining) + "次"
+				} else {
+					for k, num := range mapChartName {
+						if activityInfo.ChartPermissionName == k {
+							num += itemBill.BillDetailed
+						}
+						itemBill.Total += k + strconv.Itoa(num) + "次+"
+					}
+					itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+				}
 				itemsBill = append(itemsBill, itemBill)
 			}
 		}
@@ -775,6 +849,24 @@ func (this *ActivitySpecialTripCoAntroller) MeetingDo() {
 			itemBill.ChartPermissionId = activityInfo.ChartPermissionId
 			itemBill.AdminId = AdminUser.AdminId
 			itemBill.Way = 2
+			userType, tripRemaining, mapChartName, err := cygxService.GetChartPermissionSpecialSurplusByCompany(v.CompanyId)
+			if err != nil {
+				br.Msg = "获取专项调研剩余次数失败"
+				br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+				return
+			}
+			if userType == 2 {
+				tripRemaining -= 1
+				itemBill.Total = strconv.Itoa(tripRemaining) + "次"
+			} else {
+				for k, num := range mapChartName {
+					if activityInfo.ChartPermissionName == k {
+						num -= 1
+					}
+					itemBill.Total += k + strconv.Itoa(num) + "次+"
+				}
+				itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+			}
 			itemsBill = append(itemsBill, itemBill)
 		}
 		items = append(items, item)

+ 17 - 2
controllers/cygx/cygx_activity_type.go

@@ -15,6 +15,7 @@ type ActivityTypeCoAntroller struct {
 
 // @Title 活动类型列表
 // @Description活动类型列表接口
+// @Param   IsResearch   query   bool  true       "是否为研选"
 // @Success 200 {object} cygx.ActivityTypeListResp
 // @router /activityType/list [get]
 func (this *ActivityTypeCoAntroller) List() {
@@ -30,8 +31,15 @@ func (this *ActivityTypeCoAntroller) List() {
 		br.Ret = 408
 		return
 	}
+	isResearch, _ := this.GetBool("IsResearch", false)
+	var condition string
 	resp := new(cygx.ActivityTypeListResp)
-	list, err := cygx.GetActivityTypeList()
+	if isResearch {
+		condition = " source_type IN (0,2) "
+	} else {
+		condition = " source_type IN (0,1) "
+	}
+	list, err := cygx.GetActivityTypeSearchList(condition)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
@@ -94,7 +102,7 @@ func (this *ActivityTypeCoAntroller) Detail() {
 
 // @Title 活动类型列表小分类筛选
 // @Description 获取活动类型列表小分类筛选接口
-// @Param   SearchType   query   int  true       "筛选类型 1专家/分析师话会、2专家/分析师线下沙龙 、3公司调研/ 4、C类电话会"
+// @Param   SearchType   query   int  true       "筛选类型 1专家/分析师话会、2专家/分析师线下沙龙 、3公司调研/ 4、C类电话会"
 // @Success 200 {object} cygx.ActivityTypeListResp
 // @router /activityType/listSearch [get]
 func (this *ActivityTypeCoAntroller) ListSearch() {
@@ -138,6 +146,7 @@ func (this *ActivityTypeCoAntroller) ListSearch() {
 // @Title 线上、线下会议类型
 // @Description 线上、线下会议类型
 // @Param   MeetType   query   int  true       "会议类型 1线上、2线下"
+// @Param   IsResearch   query   bool  true       "是否为研选"
 // @Success 200 {object} cygx.ActivityTypeListResp
 // @router /activityType/meetType [get]
 func (this *ActivityTypeCoAntroller) MeetType() {
@@ -154,6 +163,7 @@ func (this *ActivityTypeCoAntroller) MeetType() {
 		return
 	}
 	meetType, _ := this.GetInt("MeetType")
+	isResearch, _ := this.GetBool("IsResearch", false) // 是否为研选 查研观向11.0 (研选活动独立显示)
 	resp := new(cygx.ActivityTypeListResp)
 	var condition string
 	if meetType == 1 {
@@ -161,6 +171,11 @@ func (this *ActivityTypeCoAntroller) MeetType() {
 	} else {
 		condition += ` activity_type  = 0 `
 	}
+	if isResearch {
+		condition += " AND  source_type IN (0,2) "
+	} else {
+		condition += " AND source_type IN (0,1) "
+	}
 	list, err := cygx.GetActivityTypeSearchList(condition)
 	if err != nil {
 		br.Msg = "获取失败"

+ 9 - 2
controllers/cygx/industrial_management.go

@@ -30,6 +30,7 @@ type IndustrialManagementController struct {
 // @Title 获取一级分类
 // @Description 获取一级分类接口
 // @Param   HideMacro  query  bool  false  "是否隐藏宏观(默认不隐藏)"
+// @Param   IsHideResearch  query  bool  false  "是否隐藏买方研选(默认不隐藏)"
 // @Param   IsCeLueReport  query  bool  false  "是否是策略平台的报告类型"
 // @Success 200 {object} cygx.ChartPermissionResp
 // @router /chartPermission/first [get]
@@ -41,6 +42,7 @@ func (this *IndustrialManagementController) ChartPermissionList() {
 	}()
 	// 是否隐藏宏观
 	hideMacro, _ := this.GetBool("HideMacro")
+	isHideResearch, _ := this.GetBool("IsHideResearch")
 	isCeLueReport, _ := this.GetBool("IsCeLueReport")
 	resp := new(cygx.ChartPermissionResp)
 	list, err := cygx.GetChartPermissionAll()
@@ -61,15 +63,20 @@ func (this *IndustrialManagementController) ChartPermissionList() {
 		item.ChartPermissionId = utils.GU_SHOU_ID
 		resp.List = append(resp.List, item)
 	} else {
+		for _, v := range list {
+			if v.PermissionName == utils.CHART_PERMISSION_NAME_MF_YANXUAN && isHideResearch {
+				continue
+			}
+			resp.List = append(resp.List, v)
+		}
 		// 查研观向7.4-新增一个宏观
 		if !hideMacro {
 			macro := &cygx.ChartPermission{
 				ChartPermissionId: 1,
 				PermissionName:    "宏观",
 			}
-			list = append(list, macro)
+			resp.List = append(resp.List, macro)
 		}
-		resp.List = list
 	}
 
 	br.Ret = 200

+ 2 - 0
controllers/eta_business/eta_business.go

@@ -399,6 +399,7 @@ func (this *EtaBusinessController) Add() {
 		br.ErrMsg = "生成商家编码失败, Err: " + e.Error()
 		return
 	}
+	codeEncrypt := utils.MD5(fmt.Sprintf("%s%s", businessCode, utils.BusinessCodeSalt))
 
 	now := time.Now().Local()
 	// 若当前时间不在首次签约时间内, 也算作已终止, 进入合约期时会由定时任务改为首次签约
@@ -418,6 +419,7 @@ func (this *EtaBusinessController) Add() {
 	businessItem := new(eta_business.EtaBusiness)
 	businessItem.BusinessName = req.BusinessName
 	businessItem.BusinessCode = businessCode
+	businessItem.CodeEncrypt = codeEncrypt
 	businessItem.CreditCode = req.CreditCode
 	businessItem.RegionType = req.RegionType
 	businessItem.Province = req.Province

+ 197 - 0
controllers/eta_business/eta_business_menu.go

@@ -0,0 +1,197 @@
+package eta_business
+
+import (
+	"encoding/json"
+	"hongze/hz_crm_api/controllers"
+	"hongze/hz_crm_api/models"
+	"hongze/hz_crm_api/models/eta_business"
+	etaBusinessService "hongze/hz_crm_api/services/eta_business"
+)
+
+// EtaBusinessMenuController ETA商家菜单
+type EtaBusinessMenuController struct {
+	controllers.BaseAuthController
+}
+
+// List
+// @Title 商家菜单列表
+// @Description 商家菜单列表
+// @Param   BusinessId	query	int	false	"商家ID"
+// @Success 200 Ret=200 获取成功
+// @router /menu/list [get]
+func (this *EtaBusinessMenuController) List() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	resp := new(eta_business.EtaBusinessMenuListResp)
+	resp.ChoiceList = make([]int, 0)
+	resp.HalfChoiceList = make([]int, 0)
+	resp.List = make([]*eta_business.EtaBusinessMenuItem, 0)
+	// 权限校验
+	ok, e := etaBusinessService.CheckEtaBusinessOperateAuth(sysUser.RoleTypeCode)
+	if e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "操作权限校验失败, ErrMsg: " + e.Error()
+		return
+	}
+	if !ok {
+		br.Data = resp
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		return
+	}
+
+	// 商家勾选的权限
+	businessId, _ := this.GetInt("EtaBusinessId", 0)
+	if businessId > 0 {
+		relateOb := new(eta_business.EtaBusinessMenuRelate)
+		cond := ` AND eta_business_id = ?`
+		pars := make([]interface{}, 0)
+		pars = append(pars, businessId)
+		relates, e := relateOb.GetItemsByCondition(cond, pars, []string{}, "")
+		if e != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取商家菜单关联列表失败, Err: " + e.Error()
+			return
+		}
+		for _, r := range relates {
+			if r.Type == 1 {
+				resp.HalfChoiceList = append(resp.HalfChoiceList, r.MenuId)
+				continue
+			}
+			resp.ChoiceList = append(resp.ChoiceList, r.MenuId)
+		}
+	}
+
+	menuOb := new(eta_business.EtaBusinessMenu)
+	order := `sort ASC, create_time DESC, menu_id DESC`
+	list, e := menuOb.GetItemsByCondition("", make([]interface{}, 0), []string{}, order)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取商家菜单列表失败, Err: " + e.Error()
+		return
+	}
+
+	items := make([]*eta_business.EtaBusinessMenuItem, 0)
+	for _, v := range list {
+		t := &eta_business.EtaBusinessMenuItem{
+			MenuId:       v.MenuId,
+			ParentId:     v.ParentId,
+			Name:         v.Name,
+			Sort:         v.Sort,
+			Path:         v.Path,
+			PathName:     v.PathName,
+			IconPath:     v.IconPath,
+			Component:    v.Component,
+			Hidden:       v.Hidden,
+			HiddenLayout: v.HiddenLayout,
+			Level:        v.Level,
+			MenuType:     v.MenuType,
+			ButtonCode:   v.ButtonCode,
+			Children:     make([]*eta_business.EtaBusinessMenuItem, 0),
+		}
+		items = append(items, t)
+	}
+
+	// 递归返回树形结构
+	items = etaBusinessService.GetMenuTreeRecursive(items, 0)
+
+	resp.List = items
+	br.Data = resp
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+}
+
+// SaveRelate
+// @Title 保存商家菜单关联
+// @Description 保存商家菜单关联
+// @Param	request	body eta_business.EtaBusinessAddReq true "type json string"
+// @Success 200 Ret=200 操作成功
+// @router /menu/relate/save [post]
+func (this *EtaBusinessMenuController) SaveRelate() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	// 操作权限校验
+	ok, e := etaBusinessService.CheckEtaBusinessOperateAuth(sysUser.RoleTypeCode)
+	if e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "操作权限校验失败, ErrMsg: " + e.Error()
+		return
+	}
+	if !ok {
+		br.Msg = "无权操作"
+		return
+	}
+
+	// 参数校验
+	var req eta_business.EtaBusinessMenuRelateSaveReq
+	if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + e.Error()
+		return
+	}
+	if req.EtaBusinessId <= 0 {
+		br.Msg = "参数有误"
+		return
+	}
+	if len(req.MenuIds) == 0 {
+		br.Msg = "请选择菜单"
+		return
+	}
+
+	ob := new(eta_business.EtaBusinessMenuRelate)
+	items := make([]*eta_business.EtaBusinessMenuRelate, 0)
+	for _, v := range req.MenuIds {
+		t := new(eta_business.EtaBusinessMenuRelate)
+		t.MenuId = v
+		t.EtaBusinessId = req.EtaBusinessId
+		items = append(items, t)
+	}
+	for _, v := range req.HalfMenuIds {
+		t := new(eta_business.EtaBusinessMenuRelate)
+		t.MenuId = v
+		t.Type = 1
+		t.EtaBusinessId = req.EtaBusinessId
+		items = append(items, t)
+	}
+	if e := ob.CreateMulti(req.EtaBusinessId, items); e != nil {
+		br.Msg = "保存失败"
+		br.ErrMsg = "保存商家菜单关联失败, Err: " + e.Error()
+		return
+	}
+
+	// TODO:后续需要生成SQL脚本文件
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}

+ 401 - 0
controllers/eta_version_update_log.go

@@ -0,0 +1,401 @@
+package controllers
+
+import (
+	"encoding/json"
+	"fmt"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hz_crm_api/models"
+	"hongze/hz_crm_api/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// EtaVersionUpdateLogController ETA版本更新日志
+type EtaVersionUpdateLogController struct {
+	BaseAuthController
+}
+
+// PageList
+// @Title 更新日志列表-分页
+// @Description 更新日志列表-分页
+// @Param   Keyword		query	string	false	"关键词"
+// @Param   SortType	query	string	false	"排序方式, 1-ASC; 2-DESC"
+// @Success 200 Ret=200 获取成功
+// @router /page_list [get]
+func (this *EtaVersionUpdateLogController) PageList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	// 分页
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+
+	cond := ``
+	pars := make([]interface{}, 0)
+	// 关键词
+	keyword := this.GetString("Keyword", "")
+	keyword = strings.TrimSpace(keyword)
+	if keyword != "" {
+		kw := fmt.Sprint("%", keyword, "%")
+		cond += ` AND content LIKE ?`
+		pars = append(pars, kw)
+	}
+
+	sortType, _ := this.GetInt("SortType", 0)
+	orderMap := map[int]string{0: "", 1: "update_date ASC", 2: "update_date DESC"}
+	order := orderMap[sortType]
+
+	// 获取列表
+	businessOb := new(models.EtaVersionUpdateLog)
+	total, e := businessOb.GetCountByCondition(cond, pars)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取更新日志总数失败, Err: " + e.Error()
+		return
+	}
+	list, e := businessOb.GetPageItemsByCondition(cond, pars, []string{}, order, startSize, pageSize)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取更新日志列表失败, Err: " + e.Error()
+		return
+	}
+
+	items := make([]*models.EtaVersionUpdateLogItem, 0)
+	for _, v := range list {
+		b := new(models.EtaVersionUpdateLogItem)
+		b.Id = v.Id
+		b.Version = v.Version
+		b.Content = v.Content
+		b.UpdateDate = v.UpdateDate.Format(utils.FormatDate)
+		b.CreateTime = v.CreateTime.Format(utils.FormatDateTime)
+		b.ModifyTime = v.ModifyTime.Format(utils.FormatDateTime)
+		items = append(items, b)
+	}
+
+	resp := new(models.EtaVersionUpdateLogListResp)
+	resp.List = items
+	resp.Paging = paging.GetPaging(currentIndex, pageSize, total)
+	br.Data = resp
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+}
+
+// Add
+// @Title 新增
+// @Description 新增
+// @Param	request	body models.EtaVersionUpdateLogAddReq true "type json string"
+// @Success 200 Ret=200 操作成功
+// @router /add [post]
+func (this *EtaVersionUpdateLogController) Add() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	// 参数校验
+	var req models.EtaVersionUpdateLogAddReq
+	if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + e.Error()
+		return
+	}
+	req.Version = strings.TrimSpace(req.Version)
+	if req.Version == "" {
+		br.Msg = "版本号不可为空"
+		return
+	}
+	// 版本号格式: X.X.X
+	versionArr := strings.Split(req.Version, ".")
+	if len(versionArr) != 3 {
+		br.Msg = "请输入正确格式的版本号"
+		return
+	}
+	for _, n := range versionArr {
+		if _, e := strconv.Atoi(n); e != nil {
+			br.Msg = "请输入正确格式的版本号"
+			return
+		}
+	}
+
+	req.Content = strings.TrimSpace(req.Content)
+	if req.Content == "" {
+		br.Msg = "更新内容不可为空"
+		return
+	}
+	updateDate, e := time.ParseInLocation(utils.FormatDate, req.UpdateDate, time.Local)
+	if e != nil {
+		br.Msg = "更新日期格式有误"
+		br.ErrMsg = "更新日期格式有误, Err: " + e.Error()
+		return
+	}
+
+	// 版本号重复校验
+	{
+		item := new(models.EtaVersionUpdateLog)
+		cond := ` AND version = ?`
+		pars := make([]interface{}, 0)
+		pars = append(pars, req.Version)
+		exist, e := item.GetItemByCondition(cond, pars)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取更新日志重复版本号失败, Err: " + e.Error()
+			return
+		}
+		if exist != nil {
+			br.Msg = "该版本号已有更新日志, 请重新输入"
+			return
+		}
+	}
+
+	// 更新日期重复校验
+	{
+		item := new(models.EtaVersionUpdateLog)
+		cond := ` AND update_date = ?`
+		pars := make([]interface{}, 0)
+		pars = append(pars, req.UpdateDate)
+		exist, e := item.GetItemByCondition(cond, pars)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取更新日志重复日期失败, Err: " + e.Error()
+			return
+		}
+		if exist != nil {
+			br.Msg = "该日期已有更新日志, 请重新选择"
+			return
+		}
+	}
+
+	// 新增
+	item := new(models.EtaVersionUpdateLog)
+	item.Version = req.Version
+	item.UpdateDate = updateDate
+	item.Content = req.Content
+	item.CreateTime = time.Now().Local()
+	item.ModifyTime = time.Now().Local()
+	if e = item.Create(); e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "新增更新日志失败, Err: " + e.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}
+
+// Edit
+// @Title 编辑
+// @Description 编辑
+// @Param	request	body models.EtaVersionUpdateLogEditReq true "type json string"
+// @Success 200 Ret=200 操作成功
+// @router /edit [post]
+func (this *EtaVersionUpdateLogController) Edit() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	// 参数校验
+	var req models.EtaVersionUpdateLogEditReq
+	if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + e.Error()
+		return
+	}
+	if req.Id <= 0 {
+		br.Msg = "参数有误"
+		return
+	}
+	req.Version = strings.TrimSpace(req.Version)
+	if req.Version == "" {
+		br.Msg = "版本号不可为空"
+		return
+	}
+	// 版本号格式: X.X.X
+	versionArr := strings.Split(req.Version, ".")
+	if len(versionArr) != 3 {
+		br.Msg = "请输入正确格式的版本号"
+		return
+	}
+	for _, n := range versionArr {
+		if _, e := strconv.Atoi(n); e != nil {
+			br.Msg = "请输入正确格式的版本号"
+			return
+		}
+	}
+	req.Content = strings.TrimSpace(req.Content)
+	if req.Content == "" {
+		br.Msg = "更新内容不可为空"
+		return
+	}
+	updateDate, e := time.ParseInLocation(utils.FormatDate, req.UpdateDate, time.Local)
+	if e != nil {
+		br.Msg = "更新日期格式有误"
+		br.ErrMsg = "更新日期格式有误, Err: " + e.Error()
+		return
+	}
+
+	// 版本号重复校验
+	{
+		item := new(models.EtaVersionUpdateLog)
+		cond := ` AND version = ?`
+		pars := make([]interface{}, 0)
+		pars = append(pars, req.Version)
+		exist, e := item.GetItemByCondition(cond, pars)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取更新日志重复版本号失败, Err: " + e.Error()
+			return
+		}
+		if exist != nil && exist.Id != req.Id {
+			br.Msg = "该版本号已有更新日志, 请重新输入"
+			return
+		}
+	}
+
+	// 更新日期重复校验
+	{
+		item := new(models.EtaVersionUpdateLog)
+		cond := ` AND update_date = ?`
+		pars := make([]interface{}, 0)
+		pars = append(pars, req.UpdateDate)
+		exist, e := item.GetItemByCondition(cond, pars)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取更新日志重复日期失败, Err: " + e.Error()
+			return
+		}
+		if exist != nil && exist.Id != req.Id {
+			br.Msg = "该日期已有更新日志, 请重新选择"
+			return
+		}
+	}
+
+	ob := new(models.EtaVersionUpdateLog)
+	item, e := ob.GetItemById(req.Id)
+	if e != nil {
+		if e.Error() == utils.ErrNoRow() {
+			br.Msg = "更新日志不存在, 请刷新页面"
+			return
+		}
+		br.Msg = "操作失败"
+		br.ErrMsg = "获取更新日志信息失败, Err: " + e.Error()
+		return
+	}
+	item.Version = req.Version
+	item.Content = req.Content
+	item.UpdateDate = updateDate
+	item.ModifyTime = time.Now().Local()
+	cols := []string{"Version", "Content", "UpdateDate", "ModifyTime"}
+	if e := item.Update(cols); e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "编辑更新日志失败, Err: " + e.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}
+
+// Del
+// @Title 删除
+// @Description 删除
+// @Param	request	body models.EtaVersionUpdateLogDelReq true "type json string"
+// @Success 200 Ret=200 操作成功
+// @router /del [post]
+func (this *EtaVersionUpdateLogController) Del() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	// 参数校验
+	var req models.EtaVersionUpdateLogDelReq
+	if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + e.Error()
+		return
+	}
+	if req.Id <= 0 {
+		br.Msg = "参数有误"
+		return
+	}
+
+	ob := new(models.EtaVersionUpdateLog)
+	item, e := ob.GetItemById(req.Id)
+	if e != nil {
+		if e.Error() == utils.ErrNoRow() {
+			br.Msg = "更新日志不存在, 请刷新页面"
+			return
+		}
+		br.Msg = "操作失败"
+		br.ErrMsg = "获取更新日志信息失败, Err: " + e.Error()
+		return
+	}
+	if e := item.Del(); e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "删除更新日志失败, Err: " + e.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}

+ 1 - 1
controllers/full_company.go

@@ -2453,7 +2453,7 @@ func (this *FullCompanyController) Detail() {
 				return
 			}
 			// cygx8.2专项产业调研展示
-			item.SpecialSurplus, err = cygxService.GetSpecialSurplusByCompany(companyId)
+			item.SpecialSurplus, err = cygxService.GetSpecialSurplusByCompanyNew(companyId)
 			if err != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取专项调研信息失败,Err:" + err.Error()

+ 539 - 0
controllers/help_doc/classify.go

@@ -0,0 +1,539 @@
+package help_doc
+
+import (
+	"encoding/json"
+	"hongze/hz_crm_api/controllers"
+	"hongze/hz_crm_api/models"
+	"hongze/hz_crm_api/models/help_doc"
+	"hongze/hz_crm_api/services/data"
+	"hongze/hz_crm_api/utils"
+	"time"
+)
+
+// HelpDocClassifyController 帮助文档分类
+type HelpDocClassifyController struct {
+	controllers.BaseAuthController
+}
+
+// ListClassify
+// @Title 获取分类列表
+// @Description 获取分类列表
+// @Param   KeyWord   query   string  true       "检索关键词"
+// @Success 200 {object} models.HelpDocClassifyListResp
+// @router /classify/list [get]
+func (this *HelpDocClassifyController) ListClassify() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	keyWord := this.GetString("KeyWord")
+
+	resp := new(help_doc.HelpDocClassifyListResp)
+
+	rootList, err := help_doc.GetHelpDocClassifyByParentId(0, "")
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
+	docAll, err := help_doc.GetAllHelpDoc()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
+	classifyMap := make(map[int]int,0)
+	for _, v := range docAll {
+		classifyMap[v.ClassifyId] = 1
+	}
+
+	classifyAll := make([]*help_doc.HelpDocClassifyItems, 0)
+	newClassifyAll := make([]*help_doc.HelpDocClassifyItems, 0)
+	newRootList := make([]help_doc.HelpDocClassifyItems, 0)
+	//parentMap := make(map[int]int)
+	classifyAllMap := make(map[int]*help_doc.HelpDocClassifyItems, 0)
+	classifyKeyMap := make(map[int]*help_doc.HelpDocClassifyItems, 0)
+	rootMap := make(map[*help_doc.HelpDocClassifyItems]int, 0)
+	if keyWord != "" {
+		classifyAll, err = help_doc.GetAllHelpDocClassifyByKeyword("")
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+
+		for _, v := range classifyAll {
+			classifyAllMap[v.ClassifyId] = v
+		}
+
+		keywordClassify, err := help_doc.GetAllHelpDocClassifyByKeyword(keyWord)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+		for _, v := range keywordClassify {
+			if v.Level == 3 {
+				ppid := classifyAllMap[v.ParentId].ParentId
+				//newRootList = append(newRootList, *classifyAllMap[ppid])
+				rootMap[classifyAllMap[ppid]] = 1
+				classifyKeyMap[v.ClassifyId] = v
+				classifyKeyMap[v.ParentId] = classifyAllMap[v.ParentId]
+			} else if v.Level == 2{
+				pid := classifyAllMap[v.ParentId].ClassifyId
+				//newRootList = append(newRootList, *classifyAllMap[pid])
+				rootMap[classifyAllMap[pid]] = 1
+				classifyKeyMap[v.ClassifyId] = v
+			} else if v.Level == 1 {
+				//newRootList = append(newRootList, *v)
+				rootMap[v] = 1
+			}
+		}
+		// 重新组合 newRootList
+		//for _, v := range rootList {
+		//	if root,ok := rootMap[v.ClassifyId]; ok{
+		//		newRootList = append(newRootList, *root)
+		//	}
+		//}
+		for v, _ := range rootMap {
+			newRootList = append(newRootList, *v)
+		}
+		// 重新组合 newClassifyAll
+		for _, v := range classifyKeyMap {
+			if v.Level != 1 {
+				newClassifyAll = append(newClassifyAll, v)
+			}
+		}
+	} else {
+		classifyAll, err = help_doc.GetHelpDocClassifyAll("")
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+		newRootList = rootList
+		newClassifyAll = classifyAll
+	}
+
+	for k := range newClassifyAll {
+		_,ok := classifyMap[newClassifyAll[k].ClassifyId]
+		newClassifyAll[k].Disabled = ok
+	}
+
+	//rootListAll := make([]help_doc.HelpDocClassifyItems, 0)
+	//rootListAll = rootList
+	nodeAll := make([]*help_doc.HelpDocClassifyItems, 0)
+	for k := range newRootList {
+		rootNode := newRootList[k]
+		data.HelpDocClassifyItemsMakeTree(newClassifyAll, &rootNode)
+		nodeAll = append(nodeAll, &rootNode)
+	}
+
+	//添加分类用,只有一二级目录
+	classifyLevel, err := help_doc.GetHelpDocClassifyLevel()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	for k := range classifyLevel {
+		_,ok := classifyMap[classifyLevel[k].ClassifyId]
+		classifyLevel[k].Disabled = ok
+	}
+
+	//rootListLevel := make([]help_doc.HelpDocClassifyItems, 0)
+	//rootListLevel = rootList
+	nodeAllTwoLevel := make([]*help_doc.HelpDocClassifyItems, 0)
+	for k := range rootList {
+		rootNode := rootList[k]
+		data.HelpDocClassifyItemsMakeTree(classifyLevel, &rootNode)
+		nodeAllTwoLevel = append(nodeAllTwoLevel, &rootNode)
+	}
+
+	resp.AllNodes = nodeAll
+	resp.TwoLevelNodes = nodeAllTwoLevel
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 新增分类
+// @Description 新增分类接口
+// @Param   ClassifyName   int  true       "分类名称"
+// @Param   ParentId   query   int  true       "父级Id 添加父级时为0"
+// @Param   Sort   query   string  false       "排序"
+// @Success 200 新增成功
+// @router /classify/add [post]
+func (this *HelpDocClassifyController) AddClassify() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req help_doc.AddHelpDocClassifyReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	if req.HelpDocClassifyName == "" {
+		br.Msg = "请输入分类名称"
+		br.IsSendEmail = false
+		return
+	}
+	if req.ParentId < 0 {
+		br.Msg = "参数错误"
+		br.IsSendEmail = false
+		return
+	}
+
+	count, err := help_doc.GetHelpDocClassifyCount(req.HelpDocClassifyName, req.ParentId)
+	if err != nil {
+		br.Msg = "判断名称是否已存在失败"
+		br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
+		return
+	}
+	if count > 0 {
+		br.Msg = "分类名称已存在,请重新输入"
+		br.IsSendEmail = false
+		return
+	}
+	//获取该层级下最大的排序数
+	maxSort, err := help_doc.GetHelpDocClassifyMaxSort(req.ParentId)
+
+	classify := new(help_doc.HelpDocClassify)
+	classify.ParentId = req.ParentId
+	classify.ClassifyName = req.HelpDocClassifyName
+	classify.CreateTime = time.Now()
+	classify.ModifyTime = time.Now()
+	classify.SysUserId = this.SysUser.AdminId
+	classify.SysUserRealName = this.SysUser.RealName
+	classify.Level = req.Level + 1
+	classify.Sort = maxSort + 1
+
+	_, err = help_doc.AddHelpDocClassify(classify)
+	if err != nil {
+		br.Msg = "保存分类失败"
+		br.ErrMsg = "保存分类失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Msg = "保存成功"
+	br.Success = true
+}
+
+// @Title 编辑分类
+// @Description 编辑分类接口
+// @Param   ClassifyId   int  true       "分类Id"
+// @Param   ClassifyName   string  true       "分类名称"
+// @Param   ParentId   query   int  true       "父级Id 添加父级时为0"
+// @Param   Sort   query   string  false       "排序"
+// @Success 200 保存成功
+// @router /classify/edit [post]
+func (this *HelpDocClassifyController) EditClassify() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req help_doc.EditHelpDocClassifyReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	if req.HelpDocClassifyName == "" {
+		br.Msg = "请输入分类名称"
+		br.IsSendEmail = false
+		return
+	}
+
+	if req.HelpDocClassifyId <= 0 {
+		br.Msg = "参数错误"
+		br.IsSendEmail = false
+		return
+	}
+
+	item, err := help_doc.GetHelpDocClassifyById(req.HelpDocClassifyId)
+	if err != nil {
+		br.Msg = "保存失败"
+		br.Msg = "获取分类信息失败,Err:" + err.Error()
+		return
+	}
+
+	if item.ClassifyName != req.HelpDocClassifyName {
+		count, err := help_doc.GetHelpDocClassifyCount(req.HelpDocClassifyName, item.ParentId)
+		if err != nil {
+			br.Msg = "判断名称是否已存在失败"
+			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
+			return
+		}
+		if count > 0 {
+			br.Msg = "分类名称已存在,请重新输入"
+			br.IsSendEmail = false
+			return
+		}
+
+		err = help_doc.EditHelpDocClassify(req.HelpDocClassifyId, req.HelpDocClassifyName)
+		if err != nil {
+			br.Msg = "保存失败"
+			br.ErrMsg = "保存失败,Err:" + err.Error()
+			return
+		}
+	}
+	br.Ret = 200
+	br.Msg = "保存成功"
+	br.Success = true
+	br.IsAddLog = true
+}
+
+// @Title 删除分类列表
+// @Description 删除分类列表
+// @Param   ClassifyId   int  true       "分类名称"
+// @Success 200 删除成功
+// @router /classify/delete [get]
+func (this *HelpDocClassifyController) DelClassify() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	classifyId, _ := this.GetInt("ClassifyId")
+
+	_, err := help_doc.GetHelpDocClassifyById(classifyId)
+	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Msg = "当前分类不存在"
+			br.ErrMsg = "当前分类不存在"
+			return
+		}
+		br.Msg = "获取分类信息失败"
+		br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
+		return
+	}
+
+	count, err := help_doc.GetHelpDocClassifyChildCounts(classifyId)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	if count > 0 {
+		br.Msg = "请先删除该分类下关联分类"
+		br.Ret = 403
+		return
+	}
+
+	reportCount, e := help_doc.GetHelpDocCounts(classifyId)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取失败,Err:" + e.Error()
+		return
+	}
+
+	if reportCount > 0 {
+		br.Msg = "该分类已关联文章,不允许删除!"
+		br.Ret = 403
+		return
+	}
+
+	if err = help_doc.DeleteHelpDocClassify(classifyId); err != nil {
+		br.Msg = "删除失败"
+		br.ErrMsg = "删除分类失败, Err: " + err.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "删除成功"
+}
+
+// ChartClassifyMove
+// @Title 分类移动接口
+// @Description 分类移动接口
+// @Success 200 {object} data_manage.MoveChartClassifyReq
+// @router /classify/move [post]
+func (this *HelpDocClassifyController) ClassifyMove() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	var req help_doc.MoveClassifyReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	if req.ClassifyId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "分类id小于等于0"
+		return
+	}
+	//判断分类是否存在
+	classifyInfo, err := help_doc.GetHelpDocClassifyById(req.ClassifyId)
+	if err != nil {
+		br.Msg = "移动失败"
+		br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
+		return
+	}
+	updateCol := make([]string, 0)
+
+	//判断上级id是否一致,如果不一致的话,那么需要移动该分类层级
+	if classifyInfo.ParentId != req.ParentClassifyId && req.ParentClassifyId != 0 {
+		parentClassifyInfo, err := help_doc.GetHelpDocClassifyById(req.ParentClassifyId)
+		if err != nil {
+			br.Msg = "移动失败"
+			br.ErrMsg = "获取上级分类信息失败,Err:" + err.Error()
+			return
+		}
+		classifyInfo.ParentId = parentClassifyInfo.ClassifyId
+		classifyInfo.Level = parentClassifyInfo.Level + 1
+		classifyInfo.ModifyTime = time.Now()
+		updateCol = append(updateCol, "ParentId", "Level", "ModifyTime")
+	}
+
+	//如果有传入 上一个兄弟节点分类id
+	if req.PrevClassifyId > 0 {
+		//上一个兄弟节点
+		prevClassify, err := help_doc.GetHelpDocClassifyById(req.PrevClassifyId)
+		if err != nil {
+			br.Msg = "移动失败"
+			br.ErrMsg = "获取上一个兄弟节点分类信息失败,Err:" + err.Error()
+			return
+		}
+
+		//如果是移动在两个兄弟节点之间
+		if req.NextClassifyId > 0 {
+			//下一个兄弟节点
+			nextClassify, err := help_doc.GetHelpDocClassifyById(req.NextClassifyId)
+			if err != nil {
+				br.Msg = "移动失败"
+				br.ErrMsg = "获取下一个兄弟节点分类信息失败,Err:" + err.Error()
+				return
+			}
+			//如果上一个兄弟与下一个兄弟的排序权重是一致的,那么需要将下一个兄弟(以及下个兄弟的同样排序权重)的排序权重+2,自己变成上一个兄弟的排序权重+1
+			if prevClassify.Sort == nextClassify.Sort || prevClassify.Sort == classifyInfo.Sort {
+				//变更兄弟节点的排序
+				updateSortStr := `sort + 2`
+				_ = help_doc.UpdateHelpDocClassifySortByParentId(prevClassify.ParentId, prevClassify.ClassifyId, prevClassify.Sort, updateSortStr)
+			} else {
+				//如果下一个兄弟的排序权重正好是上个兄弟节点的下一层,那么需要再加一层了
+				if nextClassify.Sort-prevClassify.Sort == 1 {
+					//变更兄弟节点的排序
+					updateSortStr := `sort + 1`
+					_ = help_doc.UpdateHelpDocClassifySortByParentId(prevClassify.ParentId, 0, prevClassify.Sort, updateSortStr)
+				}
+			}
+		}
+
+		classifyInfo.Sort = prevClassify.Sort + 1
+		classifyInfo.ModifyTime = time.Now()
+		updateCol = append(updateCol, "Sort", "ModifyTime")
+
+	} else {
+		firstClassify, err := help_doc.GetFirstHelpDocClassifyByParentId(classifyInfo.ParentId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "移动失败"
+			br.ErrMsg = "获取获取当前父级分类下的排序第一条的分类信息失败,Err:" + err.Error()
+			return
+		}
+
+		//如果该分类下存在其他分类,且第一个其他分类的排序等于0,那么需要调整排序
+		if firstClassify != nil && firstClassify.Sort == 0 {
+			updateSortStr := ` sort + 1 `
+			_ = help_doc.UpdateHelpDocClassifySortByParentId(firstClassify.ParentId, firstClassify.ClassifyId-1, 0, updateSortStr)
+		}
+
+		classifyInfo.Sort = 0 //那就是排在第一位
+		classifyInfo.ModifyTime = time.Now()
+		updateCol = append(updateCol, "Sort", "ModifyTime")
+	}
+
+	//更新
+	if len(updateCol) > 0 {
+		err = classifyInfo.Update(updateCol)
+		if err != nil {
+			br.Msg = "移动失败"
+			br.ErrMsg = "修改失败,Err:" + err.Error()
+			return
+		}
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "移动成功"
+}
+
+// @Title 编辑分类可见权限
+// @Description 编辑分类可见权限接口
+// @Param   ClassifyId   int  true       "分类Id"
+// @Param   ClassifyName   string  true       "分类名称"
+// @Param   ParentId   query   int  true       "父级Id 添加父级时为0"
+// @Param   Sort   query   string  false       "排序"
+// @Success 200 保存成功
+// @router /classify/visible/edit [post]
+func (this *HelpDocClassifyController) EditClassifyVisible() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req help_doc.EditHelpDocClassifyVisibleReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	if req.HelpDocClassifyId <= 0 {
+		br.Msg = "参数错误"
+		br.IsSendEmail = false
+		return
+	}
+
+	//item, err := help_doc.GetHelpDocClassifyById(req.HelpDocClassifyId)
+	//if err != nil {
+	//	br.Msg = "保存失败"
+	//	br.Msg = "获取分类信息失败,Err:" + err.Error()
+	//	return
+	//}
+
+	err = help_doc.EditHelpDocClassifyVisible(req.HelpDocClassifyId, req.VisibleBusinessIds)
+	if err != nil {
+		br.Msg = "保存失败"
+		br.ErrMsg = "保存失败,Err:" + err.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Msg = "保存成功"
+	br.Success = true
+	br.IsAddLog = true
+}

+ 429 - 0
controllers/help_doc/doc.go

@@ -0,0 +1,429 @@
+package help_doc
+
+import (
+	"encoding/json"
+	"fmt"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hz_crm_api/controllers"
+	"hongze/hz_crm_api/models"
+	"hongze/hz_crm_api/models/help_doc"
+	"hongze/hz_crm_api/utils"
+	"html"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// HelpDocController 帮助文档
+type HelpDocController struct {
+	controllers.BaseAuthController
+}
+
+// @Title 新增报告接口
+// @Description 新增报告
+// @Param	request	body help_doc.AddHelpDocReq true "type json string"
+// @Success 200 {object} models.AddEnglishReportResp
+// @router /add [post]
+func (this *HelpDocController) Add() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var req help_doc.AddHelpDocReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	fmt.Println("Id:", req.Id)
+	if req.Content == "" {
+		br.Msg = "请输入内容"
+		return
+	}
+	var anchor []byte
+	if req.AnchorData != nil {
+		anchor, err = json.Marshal(req.AnchorData)
+		if err != nil {
+			br.Msg = "参数解析异常!"
+			br.ErrMsg = "参数解析失败,Err:" + err.Error()
+			return
+		}
+	}
+	var recommend []byte
+	if req.RecommendData != nil {
+		recommend, err = json.Marshal(req.RecommendData)
+		if err != nil {
+			br.Msg = "参数解析异常!"
+			br.ErrMsg = "参数解析失败,Err:" + err.Error()
+			return
+		}
+	}
+
+	item := new(help_doc.HelpDoc)
+	item.ClassifyId = req.ClassifyId
+	item.Title = req.Title
+	item.Author = req.Author
+	item.Status = req.Status
+	item.Content = html.EscapeString(req.Content)
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+	item.AdminId = sysUser.AdminId
+	item.AdminRealName = sysUser.RealName
+	item.Anchor = string(anchor)
+	item.Recommend = string(recommend)
+	if req.Status == 2 {
+		item.PublishTime = time.Now()
+	}
+
+	if req.Id == 0 {
+		_, err = help_doc.AddHelpDoc(item)
+		if err != nil {
+			br.Msg = "新增失败"
+			br.ErrMsg = "保存失败,Err:" + err.Error()
+			return
+		}
+	} else {
+		err = help_doc.EditHelpDoc(item, req.Id)
+		if err != nil {
+			br.Msg = "保存失败"
+			br.ErrMsg = "保存失败,Err:" + err.Error()
+			return
+		}
+	}
+
+	if req.Status == 1 {
+		br.Msg = "保存成功"
+	} else {
+		br.Msg = "发布成功"
+	}
+	br.Ret = 200
+	br.Success = true
+
+}
+
+// @Title 获取报告详情接口
+// @Description 获取报告详情
+// @Param	request	body models.ReportDetailReq true "type json string"
+// @Success 200 {object} models.EnglishReportDetailView
+// @router /detail [get]
+func (this *HelpDocController) Detail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	docId, err := this.GetInt("DocId")
+	if err != nil {
+		br.Msg = "获取参数失败!"
+		br.ErrMsg = "获取参数失败,Err:" + err.Error()
+		return
+	}
+	if docId <= 0 {
+		br.Msg = "参数错误"
+		return
+	}
+	item, err := help_doc.GetHelpDocById(docId)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	item.Content = html.UnescapeString(item.Content)
+
+	var anchor []help_doc.AnchorList
+	if item.Anchor != "" {
+		err = json.Unmarshal([]byte(item.Anchor), &anchor)
+		if err != nil {
+			br.Msg = "解析失败"
+			br.ErrMsg = "解析失败,Err:" + err.Error()
+			return
+		}
+	}
+
+	var recommend []help_doc.RecommendList
+	if item.Recommend != "" {
+		err = json.Unmarshal([]byte(item.Recommend), &recommend)
+		if err != nil {
+			br.Msg = "解析失败"
+			br.ErrMsg = "解析失败,Err:" + err.Error()
+			return
+		}
+	}
+
+	resp := help_doc.HelpDocResp{
+		Id:            item.Id,
+		ClassifyId:    item.ClassifyId,
+		Title:         item.Title,
+		Author:        item.Author,
+		CreateTime:    item.CreateTime,
+		ModifyTime:    item.ModifyTime,
+		Status:        item.Status,
+		PublishTime:   item.PublishTime,
+		Content:       item.Content,
+		AdminId:       item.AdminId,
+		AdminRealName: item.AdminRealName,
+		Anchor:        anchor,
+		Recommend:     recommend,
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 获取报告列表接口
+// @Description 获取报告列表
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   KeyWord   query   string  true       "搜索关键词"
+// @Success 200 {object} models.ReportListResp
+// @router /list [get]
+func (this *HelpDocController) ListReport() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	classifyIds := this.GetString("ClassifyIds")
+	keyWord := this.GetString("KeyWord")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+
+	var condition string
+	var pars []interface{}
+
+	if keyWord != "" {
+		condition += ` AND title LIKE '%` + keyWord + `%' `
+	}
+
+	if len(classifyIds) > 0 {
+		classifyIdSlice := strings.Split(classifyIds, ",")
+		condition += ` AND classify_id IN ( ` + utils.GetOrmInReplace(len(classifyIdSlice)) + ` ) `
+		pars = append(pars, classifyIdSlice)
+	}
+
+	//拿到所有分类信息,显示路径用
+	classifyAll, err := help_doc.GetAllHelpDocClassify()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
+	parentMap := make(map[int]int)
+	classifyNameMap := make(map[int]string)
+	for _, v := range classifyAll {
+		classifyNameMap[v.ClassifyId] = v.ClassifyName
+		if v.ParentId != 0 {
+			parentMap[v.ClassifyId] = v.ParentId
+		}
+	}
+
+	total, err := help_doc.GetHelpDocListCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	list, err := help_doc.GetHelpDocList(condition, pars, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	resp := new(help_doc.HelpDocListResp)
+	for _, item := range list {
+		var anchor []help_doc.AnchorList
+		if item.Anchor != "" {
+			err = json.Unmarshal([]byte(item.Anchor), &anchor)
+			if err != nil {
+				br.Msg = "解析失败"
+				br.ErrMsg = "解析失败,Err:" + err.Error()
+				return
+			}
+		}
+
+		var recommend []help_doc.RecommendList
+		if item.Recommend != "" {
+			err = json.Unmarshal([]byte(item.Recommend), &recommend)
+			if err != nil {
+				br.Msg = "解析失败"
+				br.ErrMsg = "解析失败,Err:" + err.Error()
+				return
+			}
+		}
+		respItem := help_doc.HelpDocResp{
+			Id:            item.Id,
+			ClassifyId:    item.ClassifyId,
+			Title:         item.Title,
+			Author:        item.Author,
+			CreateTime:    item.CreateTime,
+			ModifyTime:    item.ModifyTime,
+			Status:        item.Status,
+			PublishTime:   item.PublishTime,
+			Content:       item.Content,
+			AdminId:       item.AdminId,
+			AdminRealName: item.AdminRealName,
+			Anchor:        anchor,
+			Recommend:     recommend,
+		}
+		if pid, ok := parentMap[respItem.ClassifyId]; ok {
+			pName := classifyNameMap[pid]
+			if ppid, ok := parentMap[pid]; ok {
+				ppName := classifyNameMap[ppid]
+				respItem.ClassifyName = ppName + "/" + pName + "/" + classifyNameMap[respItem.ClassifyId]
+			} else {
+				respItem.ClassifyName = pName + "/" + classifyNameMap[respItem.ClassifyId]
+			}
+		} else {
+			respItem.ClassifyName = classifyNameMap[respItem.ClassifyId]
+		}
+		resp.List = append(resp.List, &respItem)
+	}
+
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.Paging = page
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 发布报告接口
+// @Description 发布报告
+// @Param	request	body models.PublishReq true "type json string"
+// @Success 200 Ret=200 发布成功
+// @router /publish [post]
+func (this *HelpDocController) PublishReport() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req help_doc.PublishReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	docId := req.DocId
+	if docId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,报告id不可为空"
+		return
+	}
+
+	doc, err := help_doc.GetHelpDocById(docId)
+	if err != nil {
+		br.Msg = "获取报告信息失败"
+		br.ErrMsg = "获取报告信息失败,Err:" + err.Error()
+		return
+	}
+	if doc == nil {
+		br.Msg = "报告不存在"
+		return
+	}
+
+	var tmpErr error
+
+	if doc.Content == "" {
+		br.Msg = "报告内容为空,不可发布"
+		br.ErrMsg = "报告内容为空,不需要生成,report_id:" + strconv.Itoa(doc.Id)
+		return
+	}
+	if tmpErr = help_doc.PublishHelpDocById(docId, req.Status); tmpErr != nil {
+		br.Msg = "报告发布失败"
+		br.ErrMsg = "报告发布失败, Err:" + tmpErr.Error() + ", doc_id:" + strconv.Itoa(docId)
+		return
+	}
+
+	if req.Status == 1 {
+		br.Msg = "取消发布成功"
+	} else {
+		br.Msg = "发布成功"
+	}
+
+	br.Ret = 200
+	br.Success = true
+
+}
+
+// @Title 删除报告接口
+// @Description 删除报告
+// @Param	request	body models.DeleteReq true "type json string"
+// @Success 200 Ret=200 删除成功
+// @router /delete [post]
+func (this *HelpDocController) Delete() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req help_doc.DeleteReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	if req.DocId <= 0 {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,报告id不可为空"
+		return
+	}
+	_, err = help_doc.GetHelpDocById(req.DocId)
+	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Msg = "报告不存在"
+			return
+		}
+		br.Msg = "查询报告信息失败"
+		br.ErrMsg = "查询报告信息失败, Err" + err.Error()
+		return
+	}
+
+	err = help_doc.DeleteHelpDoc(req.DocId)
+	if err != nil {
+		br.Msg = "删除报告失败"
+		br.ErrMsg = "删除报告失败, Err" + err.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "删除成功"
+}

+ 1 - 1
controllers/sys_menu.go

@@ -100,7 +100,7 @@ func (this *SysRoleController) SysMenuList() {
 			}
 		}
 
-		if strings.Contains(item.Name, "出差管理") && sysUser.AdminId == 66 {
+		if strings.Contains(item.Name, "出差管理") && sysUser.AdminId == utils.ApproveUserId {
 			cm := new(system.ChildMenu)
 			cm.MenuId = 10000
 			cm.Name = "出差审批"

+ 7 - 5
go.mod

@@ -51,8 +51,9 @@ require (
 	github.com/alibabacloud-go/tea-utils v1.3.6 // indirect
 	github.com/alibabacloud-go/tea-xml v1.1.2 // indirect
 	github.com/aliyun/credentials-go v1.1.2 // indirect
-	github.com/andybalholm/cascadia v1.3.1 // indirect
+	github.com/andybalholm/cascadia v1.3.2 // indirect
 	github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211218165449-dd623ecc2f02 // indirect
+	github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect
 	github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d // indirect
@@ -92,6 +93,7 @@ require (
 	github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
 	github.com/sirupsen/logrus v1.9.0 // indirect
 	github.com/spf13/cast v1.5.0 // indirect
+	github.com/stevenyao/go-opencc v0.0.0-20161014062826-cc376a51b65e // indirect
 	github.com/stretchr/testify v1.8.1 // indirect
 	github.com/tidwall/gjson v1.14.1 // indirect
 	github.com/tidwall/match v1.1.1 // indirect
@@ -100,9 +102,9 @@ require (
 	github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect
 	github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
 	golang.org/x/crypto v0.5.0 // indirect
-	golang.org/x/net v0.5.0 // indirect
-	golang.org/x/sys v0.4.0 // indirect
-	golang.org/x/text v0.6.0 // indirect
+	golang.org/x/net v0.9.0 // indirect
+	golang.org/x/sys v0.7.0 // indirect
+	golang.org/x/text v0.9.0 // indirect
 	golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
 	google.golang.org/protobuf v1.28.1 // indirect
 	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
@@ -111,4 +113,4 @@ require (
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	xorm.io/builder v0.3.6 // indirect
 	xorm.io/core v0.7.2-0.20190928055935-90aeac8d08eb // indirect
-)
+)

+ 33 - 0
go.sum

@@ -84,6 +84,8 @@ github.com/aliyun/credentials-go v1.1.2 h1:qU1vwGIBb3UJ8BwunHDRFtAhS6jnQLnde/yk0
 github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw=
 github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
 github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
+github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
+github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
 github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211218165449-dd623ecc2f02 h1:o2oaBQGTzO+xNh12e7xWkphNe7H2DTiWv1ml9a2P9PQ=
 github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211218165449-dd623ecc2f02/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
 github.com/apache/thrift v0.12.0 h1:pODnxUFNcjP9UTLZGTdeh+j16A8lJbRvD3rOtrk/7bs=
@@ -92,6 +94,8 @@ github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ=
 github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA=
 github.com/aws/aws-sdk-go v1.42.23 h1:V0V5hqMEyVelgpu1e4gMPVCJ+KhmscdNxP/NWP1iCOA=
 github.com/aws/aws-sdk-go v1.42.23/go.mod h1:gyRszuZ/icHmHAVE4gc/r+cfCmhA1AD+vqfWbgI+eHs=
+github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+IrOD63t4i/RW7RqrAVl9LTZ9UqQ=
+github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIgjX4RBBcHnJ05h//6/k6foqmgE45jTQtxg=
 github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA=
 github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
 github.com/beego/bee/v2 v2.0.4 h1:nEjPwxJ8D+cr54eWChJGoGRH7bJ7OQwbhx8rU0OQf7E=
@@ -494,6 +498,8 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
 github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM=
 github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec h1:q6XVwXmKvCRHRqesF3cSv6lNqqHi0QWOvgDlSohg8UA=
 github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
+github.com/stevenyao/go-opencc v0.0.0-20161014062826-cc376a51b65e h1:EScGwVsN5G1/xRUdOKtUGugKseKjvHrvA71486Q39zg=
+github.com/stevenyao/go-opencc v0.0.0-20161014062826-cc376a51b65e/go.mod h1:lHc78mZexRHu9CQrKCEO0CLFl7GN0Xpj3PH3jBJ5EpY=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
@@ -548,6 +554,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
 github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
 github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM=
 github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
+github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
 github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973 h1:iCnkJ/qjKZGdZnlcj1N55AxPDan814kpc3s1cDpQKd8=
 github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
 github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
@@ -574,6 +582,7 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
 golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
 golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
@@ -590,6 +599,9 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl
 golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
+golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
+golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
 golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -606,14 +618,19 @@ golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/
 golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
 golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
 golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
 golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
 golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
 golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
 golang.org/x/net v0.0.0-20220812174116-3211cb980234/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
 golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
 golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
+golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
+golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
+golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8=
@@ -625,7 +642,9 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
 golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
+golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -649,14 +668,22 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
 golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
+golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg=
+golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
+golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
+golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@@ -665,6 +692,9 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
 golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
 golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
+golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20220609170525-579cf78fd858 h1:Dpdu/EMxGMFgq0CeYMh4fazTD2vtlZRYE7wyynxJb9U=
@@ -681,6 +711,9 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
 golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
 golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
+golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
+golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
+golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

+ 1 - 1
models/company/company.go

@@ -109,7 +109,7 @@ func GetCompanySearchList(condition string, pars []interface{}, limitParam ...in
 			b.freeze_time,b.loss_time,a.lose_reason,b.is_suspend,b.seller_id,b.product_id,b.group_id,b.formal_time,b.freeze_time,
 			GROUP_CONCAT(b.start_date ORDER BY b.product_id ASC SEPARATOR '/') AS start_date,
 			GROUP_CONCAT(b.end_date ORDER BY b.product_id ASC SEPARATOR '/') AS end_date,
-			GROUP_CONCAT(DISTINCT b.company_type ORDER BY b.product_id ASC SEPARATOR '/') AS company_type,
+			GROUP_CONCAT(DISTINCT b.product_name ORDER BY b.product_id ASC SEPARATOR '/') AS company_type,
             GROUP_CONCAT(DISTINCT b.approve_status ORDER BY b.product_id ASC SEPARATOR '/') AS approve_status,
             GROUP_CONCAT(DISTINCT b.freeze_start_date ORDER BY b.product_id ASC SEPARATOR '/') AS freeze_start_date,
             GROUP_CONCAT(DISTINCT b.freeze_end_date ORDER BY b.product_id ASC SEPARATOR '/') AS freeze_end_date

+ 17 - 0
models/company/company_permission.go

@@ -623,3 +623,20 @@ func GetReportPermissionIdsByCompanyIds(companyIds []int) (items []*CompanyListP
 	_, err = o.Raw(sql, companyIds).QueryRows(&items)
 	return
 }
+
+
+// GetCompanyReportPermissionByCompanyIdAndProductId 获取权限类型
+func GetCompanyReportPermissionByCompanyIdAndProductId(companyId, productId int) (items []*CompanyReportPermission, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	re.*
+FROM
+	company_report_permission  as re 
+	INNER JOIN chart_permission as  c ON c.chart_permission_id = re.chart_permission_id
+WHERE
+	re.company_id = ? 
+	AND re.product_id = ? 
+	AND STATUS = '正式' `
+	_, err = o.Raw(sql, companyId, productId).QueryRows(&items)
+	return
+}

+ 184 - 158
models/cygx/activity.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"github.com/beego/beego/v2/client/orm"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hz_crm_api/utils"
 	"time"
 )
 
@@ -76,11 +77,14 @@ type ActivityRep struct {
 	IsNeedEmail             int                       `description:"是否需要提供邮箱 1是,0否"`
 	SiginupDeadline         string                    `description:"报名截止时间"`
 	IsResearchPoints        int                       `description:"是否为研选扣点  1是,0否"`
+	IsResearch              bool                      `description:"是否为研选"`
+	IsShowHz                int                       `description:"是否同时在弘则展示  1是,0否"`
 	PointsSet               *CygxActivityPointsSetRsq `description:"研选扣点明细"`
 	IsAllCustomerType       int                       `description:"是否全选活动可见类型 0无 1全选"`
 	List                    []*ActivityGroupIndustrialRep
 	VoiceList               []*CygxActivityVoiceReq
 	VideoDetail             *CygxActivityVideoReq
+	ListImgToText           []*AliyunOcrTextActivityResp `description:"识图建会的会议信息列表"`
 }
 
 // 活动添加、修改入参
@@ -94,72 +98,74 @@ type ActivityGroupIndustrialRep struct {
 
 // 活动详情
 type ActivityDetail struct {
-	ActivityId              int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
-	ActivityTypeId          int    `description:"活动类型id"`
-	ActivityTypeName        string `description:"活动类型名称"`
-	ChartPermissionId       int    `description:"行业id"`
-	ChartPermissionName     string `description:"行业名称"`
-	Body                    string `description:"内容"`
-	CreateTime              string `description:"创建时间"`
-	IsLimitPeople           int    `description:"是否限制人数 1是,0否"`
-	LimitPeopleNum          string `description:"限制的人数数量"`
-	CustomerTypeIds         string `description:"活动可见的客户类型,多个ID用 , 隔开"`
-	PublishStatus           int    `description:"发布状态 1已发布,0未发布"`
-	LastUpdatedTime         string `description:"更新时间"`
-	ActivityTime            string `description:"活动时间"`
-	ActivityTimeText        string `description:"活动时间带文字"`
-	DistinguishedGuest      string `description:"嘉宾"`
-	Host                    string `description:"主持人"`
-	MainlandTell            string `description:"大陆拨入号"`
-	HongKongTell            string `description:"香港拨入号"`
-	TaiwanTell              string `description:"台湾拨入号"`
-	AmericaTell             string `description:"美国拨入号"`
-	ParticipationCode       string `description:"参会密码"`
-	Theme                   string `description:"主题"`
-	Expert                  string `description:"专家"`
-	ActivityName            string `description:"活动名称"`
-	OnlineParticipation     string `description:"网络参会"`
-	ReportLink              string `description:"报告链接"`
-	City                    string `description:"城市"`
-	Address                 string `description:"活动地址"`
-	Highlights              string `description:"活动亮点"`
-	Remarks                 string `description:"备注"`
-	ShowType                string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
-	Speaker                 string `description:"主讲人"`
-	ActiveState             int    `description:"活动进行状态 未开始:1、进行中2、已结束3"`
-	IsSubmitMeeting         int    `description:"是否提交过到会情况,1是,0否"`
-	TemporaryLabel          string `description:"临时标签"`
-	IsMakerShow             int    `description:"是否仅决策人可见 0,否 、1,是"`
-	VisibleRange            int    `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
-	Scale                   string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
-	IsShowSubjectName       int    `description:"小程序内是否展示标的名称 1是 ,0 否 默认0 "`
-	AdminId                 int    `description:"销售/管理员ID"`
-	AdminName               string `description:"销售/管理员姓名"`
-	IsHideAppointment       int    `description:"是否隐藏预约纪要按钮  1是,0 否"`
-	PermissionType          int    `description:"1主观,2客观"`
-	Label                   string `description:"标签"`
-	ListIndustrial          []*IndustrialActivityGroupManagementRep
-	ListSubject             []*SubjectActivityGroupManagementRep
-	IsCanAppointmentMinutes int    `description:"是否可预约纪要 1是 ,0 否 默认0 "`
-	YidongActivityId        string `description:"易董的活动ID"`
-	YidongActivityEndTime   string `description:"易董活动截止时间"`
-	VoiceList               []*CygxActivityVoiceReq
-	VideoDetail             *CygxActivityVideo
-	ActivityJoinType        string                    `description:"活动入会类型01报名审核后可入会 02预约即可入会 03仅定向邀请人员可入会"`
-	YidongSignUpEnd         string                    `description:"易董活动截止时间"` // 报名结束时间,适应于报名审核后可入会,为空表示不限制报名时间
-	YidongSignUpStart       string                    `description:"易董活动截止时间"` // 报名开始时间,适应于报名审核后可入会,为空表示不限制报名时间
-	PublishDate             string                    `description:"发布时间"`
-	IsYidongConduct         int                       `description:"是否属于易董办会 1:是 、0:否"`
-	IsCanOutboundCall       int                       `description:"是否提供外呼 1:是 、0:否"`
-	YidongActivityIdByCygx  string                    `description:"通过查研观向建会易董返回的活动ID"`
-	TencentConferenceNumber string                    `description:"腾讯会议号"`
-	IsExternalLabel         int                       `description:"是否为外部资源 1是,0否"`
-	SigninImg               string                    `description:"签到码图片"`
-	IsResearchPoints        int                       `description:"是否为研选扣点  1是,0否"`
-	IsBClass                int                       `description:"是否为B类电话会 1是,0否"`
-	IsNeedEmail             int                       `description:"是否需要提供邮箱 1是,0否"`
-	SiginupDeadline         string                    `description:"报名截止时间"`
-	PointsSet               *CygxActivityPointsSetRsq `description:"研选扣点明细"`
+	ActivityId                int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityTypeId            int    `description:"活动类型id"`
+	ActivityTypeName          string `description:"活动类型名称"`
+	ChartPermissionId         int    `description:"行业id"`
+	ChartPermissionName       string `description:"行业名称"`
+	Body                      string `description:"内容"`
+	CreateTime                string `description:"创建时间"`
+	IsLimitPeople             int    `description:"是否限制人数 1是,0否"`
+	LimitPeopleNum            string `description:"限制的人数数量"`
+	CustomerTypeIds           string `description:"活动可见的客户类型,多个ID用 , 隔开"`
+	PublishStatus             int    `description:"发布状态 1已发布,0未发布"`
+	LastUpdatedTime           string `description:"更新时间"`
+	ActivityTime              string `description:"活动时间"`
+	ActivityTimeText          string `description:"活动时间带文字"`
+	DistinguishedGuest        string `description:"嘉宾"`
+	Host                      string `description:"主持人"`
+	MainlandTell              string `description:"大陆拨入号"`
+	HongKongTell              string `description:"香港拨入号"`
+	TaiwanTell                string `description:"台湾拨入号"`
+	AmericaTell               string `description:"美国拨入号"`
+	ParticipationCode         string `description:"参会密码"`
+	Theme                     string `description:"主题"`
+	Expert                    string `description:"专家"`
+	ActivityName              string `description:"活动名称"`
+	OnlineParticipation       string `description:"网络参会"`
+	ReportLink                string `description:"报告链接"`
+	City                      string `description:"城市"`
+	Address                   string `description:"活动地址"`
+	Highlights                string `description:"活动亮点"`
+	Remarks                   string `description:"备注"`
+	ShowType                  string `description:"人数限制类型,1不展示限制,2可选限制,3强制限制"`
+	Speaker                   string `description:"主讲人"`
+	ActiveState               int    `description:"活动进行状态 未开始:1、进行中2、已结束3"`
+	IsSubmitMeeting           int    `description:"是否提交过到会情况,1是,0否"`
+	TemporaryLabel            string `description:"临时标签"`
+	IsMakerShow               int    `description:"是否仅决策人可见 0,否 、1,是"`
+	VisibleRange              int    `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
+	Scale                     string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
+	IsShowSubjectName         int    `description:"小程序内是否展示标的名称 1是 ,0 否 默认0 "`
+	AdminId                   int    `description:"销售/管理员ID"`
+	AdminName                 string `description:"销售/管理员姓名"`
+	IsHideAppointment         int    `description:"是否隐藏预约纪要按钮  1是,0 否"`
+	PermissionType            int    `description:"1主观,2客观"`
+	Label                     string `description:"标签"`
+	ListIndustrial            []*IndustrialActivityGroupManagementRep
+	ListSubject               []*SubjectActivityGroupManagementRep
+	IsCanAppointmentMinutes   int    `description:"是否可预约纪要 1是 ,0 否 默认0 "`
+	YidongActivityId          string `description:"易董的活动ID"`
+	YidongActivityEndTime     string `description:"易董活动截止时间"`
+	VoiceList                 []*CygxActivityVoiceReq
+	VideoDetail               *CygxActivityVideo
+	ActivityJoinType          string                    `description:"活动入会类型01报名审核后可入会 02预约即可入会 03仅定向邀请人员可入会"`
+	YidongSignUpEnd           string                    `description:"易董活动截止时间"` // 报名结束时间,适应于报名审核后可入会,为空表示不限制报名时间
+	YidongSignUpStart         string                    `description:"易董活动截止时间"` // 报名开始时间,适应于报名审核后可入会,为空表示不限制报名时间
+	PublishDate               string                    `description:"发布时间"`
+	IsYidongConduct           int                       `description:"是否属于易董办会 1:是 、0:否"`
+	IsCanOutboundCall         int                       `description:"是否提供外呼 1:是 、0:否"`
+	YidongActivityIdByCygx    string                    `description:"通过查研观向建会易董返回的活动ID"`
+	TencentConferenceNumber   string                    `description:"腾讯会议号"`
+	IsExternalLabel           int                       `description:"是否为外部资源 1是,0否"`
+	SigninImg                 string                    `description:"签到码图片"`
+	IsResearchPoints          int                       `description:"是否为研选扣点  1是,0否"`
+	IsBClass                  int                       `description:"是否为B类电话会 1是,0否"`
+	IsNeedEmail               int                       `description:"是否需要提供邮箱 1是,0否"`
+	SiginupDeadline           string                    `description:"报名截止时间"`
+	PointsSet                 *CygxActivityPointsSetRsq `description:"研选扣点明细"`
+	IsShowHz                  int                       `description:"是否同时在弘则展示  1是,0否"`
+	ChartPermissionNameDeputy string                    `description:"副行业名称"`
 }
 
 type ActivityDetailRep struct {
@@ -170,65 +176,68 @@ type ActivityDetailRep struct {
 
 // 活动详情
 type CygxActivity struct {
-	ActivityId              int       `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
-	ActivityTypeId          int       `description:"活动类型id"`
-	ActivityTypeName        string    `description:"活动类型名称"`
-	ChartPermissionId       int       `description:"行业id"`
-	ChartPermissionName     string    `description:"行业名称"`
-	ChartPermissionNames    string    `description:"行业名称辅助字段,区分研选子分类"`
-	Body                    string    `description:"内容"`
-	CreateTime              time.Time `description:"创建时间"`
-	PublishDate             time.Time `description:"发布时间"`
-	IsLimitPeople           int       `description:"是否限制人数 1是,0否"`
-	LimitPeopleNum          int       `description:"限制的人数数量"`
-	CustomerTypeIds         string    `description:"活动可见的客户类型,多个ID用 , 隔开"`
-	PublishStatus           int       `description:"发布状态 1已发布,0未发布"`
-	LastUpdatedTime         time.Time `description:"更新时间"`
-	ActivityTime            string    `description:"活动时间"`
-	ActivityTimeText        string    `description:"活动时间带文字"`
-	DistinguishedGuest      string    `description:"嘉宾"`
-	Host                    string    `description:"主持人"`
-	MainlandTell            string    `description:"大陆拨入号"`
-	HongKongTell            string    `description:"香港拨入号"`
-	TaiwanTell              string    `description:"台湾拨入号"`
-	AmericaTell             string    `description:"美国拨入号"`
-	ParticipationCode       string    `description:"参会密码"`
-	Theme                   string    `description:"主题"`
-	Expert                  string    `description:"专家"`
-	ActivityName            string    `description:"活动名称"`
-	ActivityNameTask        string    `description:"活动名称定时任务同步的时候使用"`
-	OnlineParticipation     string    `description:"网络参会"`
-	ReportLink              string    `description:"报告链接"`
-	City                    string    `description:"城市"`
-	Address                 string    `description:"活动地址"`
-	Highlights              string    `description:"活动亮点"`
-	Remarks                 string    `description:"备注"`
-	Speaker                 string    `description:"主讲人"`
-	ArticleId               int       `description:"关联报告id"`
-	Label                   string    `description:"标签"`
-	LinkParticipants        string    `description:"链接参会"`
-	AppAttendance           string    `description:"App参会"`
-	ConferencePassword      string    `description:"会议密码"`
-	TemporaryLabel          string    `description:"临时标签"`
-	IsMakerShow             int       `description:"是否仅决策人可见 0,否 、1,是"`
-	VisibleRange            int       `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
-	Scale                   string    `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
-	IsShowSubjectName       int       `description:"小程序内是否展示标的名称 1是 ,0 否 默认0 "`
-	IsHideAppointment       int       `description:"是否隐藏预约纪要按钮 1是 ,0 否 默认0 "`
-	AdminId                 int       `description:"销售/管理员ID"`
-	AdminName               string    `description:"销售/管理员姓名"`
-	IsCanAppointmentMinutes int       `description:"是否可预约纪要 1是 ,0 否 默认0 "`
-	IsYidongConduct         int       `description:"是否属于易董办会 1:是 、0:否"`
-	IsCanOutboundCall       int       `description:"是否提供外呼 1:是 、0:否"`
-	IsCancel                int       `description:"是否取消,1是,0否"`
-	TencentConferenceNumber string    `description:"腾讯会议号"`
-	IsExternalLabel         int       `description:"是否为外部资源 1是,0否"`
-	IsBClass                int       `description:"是否为B类电话会 1是,0否"`
-	IsNeedEmail             int       `description:"是否需要提供邮箱 1是,0否"`
-	SiginupDeadline         string    `description:"报名截止时间"`
-	CancelDeadline          string    `description:"取消报名截止时间"`
-	IsResearchPoints        int       `description:"是否为研选扣点  1是,0否"`
-	IsAllCustomerType       int       `description:"是否全选活动可见类型 0无 1全选"`
+	ActivityId                int       `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityTypeId            int       `description:"活动类型id"`
+	ActivityTypeName          string    `description:"活动类型名称"`
+	ChartPermissionId         int       `description:"行业id"`
+	ChartPermissionName       string    `description:"行业名称"`
+	ChartPermissionNames      string    `description:"行业名称辅助字段,区分研选子分类"`
+	Body                      string    `description:"内容"`
+	CreateTime                time.Time `description:"创建时间"`
+	PublishDate               time.Time `description:"发布时间"`
+	IsLimitPeople             int       `description:"是否限制人数 1是,0否"`
+	LimitPeopleNum            int       `description:"限制的人数数量"`
+	CustomerTypeIds           string    `description:"活动可见的客户类型,多个ID用 , 隔开"`
+	PublishStatus             int       `description:"发布状态 1已发布,0未发布"`
+	LastUpdatedTime           time.Time `description:"更新时间"`
+	ActivityTime              string    `description:"活动时间"`
+	ActivityTimeText          string    `description:"活动时间带文字"`
+	DistinguishedGuest        string    `description:"嘉宾"`
+	Host                      string    `description:"主持人"`
+	MainlandTell              string    `description:"大陆拨入号"`
+	HongKongTell              string    `description:"香港拨入号"`
+	TaiwanTell                string    `description:"台湾拨入号"`
+	AmericaTell               string    `description:"美国拨入号"`
+	ParticipationCode         string    `description:"参会密码"`
+	Theme                     string    `description:"主题"`
+	Expert                    string    `description:"专家"`
+	ActivityName              string    `description:"活动名称"`
+	ActivityNameTask          string    `description:"活动名称定时任务同步的时候使用"`
+	OnlineParticipation       string    `description:"网络参会"`
+	ReportLink                string    `description:"报告链接"`
+	City                      string    `description:"城市"`
+	Address                   string    `description:"活动地址"`
+	Highlights                string    `description:"活动亮点"`
+	Remarks                   string    `description:"备注"`
+	Speaker                   string    `description:"主讲人"`
+	ArticleId                 int       `description:"关联报告id"`
+	Label                     string    `description:"标签"`
+	LinkParticipants          string    `description:"链接参会"`
+	AppAttendance             string    `description:"App参会"`
+	ConferencePassword        string    `description:"会议密码"`
+	TemporaryLabel            string    `description:"临时标签"`
+	IsMakerShow               int       `description:"是否仅决策人可见 0,否 、1,是"`
+	VisibleRange              int       `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
+	Scale                     string    `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
+	IsShowSubjectName         int       `description:"小程序内是否展示标的名称 1是 ,0 否 默认0 "`
+	IsHideAppointment         int       `description:"是否隐藏预约纪要按钮 1是 ,0 否 默认0 "`
+	AdminId                   int       `description:"销售/管理员ID"`
+	AdminName                 string    `description:"销售/管理员姓名"`
+	IsCanAppointmentMinutes   int       `description:"是否可预约纪要 1是 ,0 否 默认0 "`
+	IsYidongConduct           int       `description:"是否属于易董办会 1:是 、0:否"`
+	IsCanOutboundCall         int       `description:"是否提供外呼 1:是 、0:否"`
+	IsCancel                  int       `description:"是否取消,1是,0否"`
+	TencentConferenceNumber   string    `description:"腾讯会议号"`
+	IsExternalLabel           int       `description:"是否为外部资源 1是,0否"`
+	IsBClass                  int       `description:"是否为B类电话会 1是,0否"`
+	IsNeedEmail               int       `description:"是否需要提供邮箱 1是,0否"`
+	SiginupDeadline           string    `description:"报名截止时间"`
+	IsResearchPoints          int       `description:"是否为研选扣点  1是,0否"`
+	IsAllCustomerType         int       `description:"是否全选活动可见类型 0无 1全选"`
+	IsShowHz                  int       `description:"是否同时在弘则展示  1是,0否"`
+	ChartPermissionIdDeputy   int       `description:"行业id"`
+	ChartPermissionNameDeputy string    `description:"行业名称"`
+	CancelDeadline            string    `description:"取消报名截止时间"`
 }
 
 type CygxActivityEditDetail struct {
@@ -289,15 +298,16 @@ func AddActivity(items []*CygxActivity, industrialActivityItems [][]*CygxIndustr
 				}
 			}
 		}
-	}
 
-	{
-		//添加研选扣点内容
-		if itemPointsSet.PointsObject != "" {
-			itemPointsSet.ActivityId = int(newId)
-			_, err = to.Insert(itemPointsSet)
-			if err != nil {
-				return
+		{
+			//添加研选扣点内容
+			if itemPointsSet.PointsObject != "" {
+				itemPointsSet.ActivityId = int(newId)
+				itemPointsSet.Id = 0 // 二次插入的时候主键被赋值了
+				_, err = to.Insert(itemPointsSet)
+				if err != nil {
+					return
+				}
 			}
 		}
 	}
@@ -393,8 +403,13 @@ func EditActivity(item *CygxActivity, oldPublishStatus int, industrialActivityIt
 	updateParams["IsNeedEmail"] = item.IsNeedEmail
 	updateParams["SiginupDeadline"] = item.SiginupDeadline
 	updateParams["IsResearchPoints"] = item.IsResearchPoints
-	updateParams["CancelDeadline"] = item.CancelDeadline
 	updateParams["IsAllCustomerType"] = item.IsAllCustomerType
+	if item.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
+		updateParams["IsShowHz"] = item.IsShowHz //研选的才做修改
+	}
+	updateParams["ChartPermissionNameDeputy"] = item.ChartPermissionNameDeputy
+	updateParams["ChartPermissionIdDeputy"] = item.ChartPermissionIdDeputy
+	updateParams["CancelDeadline"] = item.CancelDeadline
 	//修改活动信息
 	ptrStructOrTableName := "cygx_activity"
 	whereParam := map[string]interface{}{"activity_id": item.ActivityId}
@@ -557,30 +572,31 @@ func EditActivityStatus(activityId int) (err error) {
 
 // 活动详情
 type CygxActivityList struct {
-	ActivityId           int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
-	ActivityTypeId       int    `description:"活动类型id"`
-	ActivityName         string `description:"活动名称"`
-	ActivityTypeName     string `description:"活动类型名称"`
-	ActiveState          int    `description:"活动进行状态 未开始:1、进行中2、已结束3"`
-	ChartPermissionId    int    `description:"行业id"`
-	ChartPermissionName  string `description:"行业名称"`
-	ChartPermissionNames string `description:"行业名称辅助字段,区分研选子分类"`
-	Body                 string `description:"内容"`
-	IsLimitPeople        int    `description:"是否限制人数 1是,0否"`
-	LimitPeopleNum       int    `description:"限制的人数数量"`
-	CustomerTypeIds      string `description:"活动可见的客户类型,多个ID用 , 隔开"`
-	PublishStatus        int    `description:"发布状态 1已发布,0未发布"`
-	LastUpdatedTime      string `description:"更新时间"`
-	ActivityTime         string `description:"活动时间"`
-	ActivityTimeText     string `description:"活动时间带文字"`
-	Label                string `description:"标签"`
-	YidongActivityId     string `description:"易董的活动ID"`
-	TemporaryLabel       string `description:"临时标签"`
-	IsCancel             int    `description:"是否取消,1是,0否"`
-	IsUpload             bool   `description:"是否上传"`
-	IsYidongConduct      int    `description:"是否属于易董办会 1:是 、0:否"`
-	IsShowSigninButton   bool   `description:"是否展示签到码按钮"`
-	SigninImg            string `description:"签到码图片"`
+	ActivityId                int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityTypeId            int    `description:"活动类型id"`
+	ActivityName              string `description:"活动名称"`
+	ActivityTypeName          string `description:"活动类型名称"`
+	ActiveState               int    `description:"活动进行状态 未开始:1、进行中2、已结束3"`
+	ChartPermissionId         int    `description:"行业id"`
+	ChartPermissionName       string `description:"行业名称"`
+	ChartPermissionNames      string `description:"行业名称辅助字段,区分研选子分类"`
+	Body                      string `description:"内容"`
+	IsLimitPeople             int    `description:"是否限制人数 1是,0否"`
+	LimitPeopleNum            int    `description:"限制的人数数量"`
+	CustomerTypeIds           string `description:"活动可见的客户类型,多个ID用 , 隔开"`
+	PublishStatus             int    `description:"发布状态 1已发布,0未发布"`
+	LastUpdatedTime           string `description:"更新时间"`
+	ActivityTime              string `description:"活动时间"`
+	ActivityTimeText          string `description:"活动时间带文字"`
+	Label                     string `description:"标签"`
+	YidongActivityId          string `description:"易董的活动ID"`
+	TemporaryLabel            string `description:"临时标签"`
+	IsCancel                  int    `description:"是否取消,1是,0否"`
+	IsUpload                  bool   `description:"是否上传"`
+	IsYidongConduct           int    `description:"是否属于易董办会 1:是 、0:否"`
+	IsShowSigninButton        bool   `description:"是否展示签到码按钮"`
+	SigninImg                 string `description:"签到码图片"`
+	ChartPermissionNameDeputy string `description:"副行业名称"`
 }
 
 type GetCygxActivityListRep struct {
@@ -728,3 +744,13 @@ func UpdateCygxActivitySigninImg(signinImg string, activityId int) (err error) {
 	_, err = o.Raw(sql, signinImg, activityId).Exec()
 	return
 }
+
+type AliyunOcrTextActivityResp struct {
+	TitmeYMD string `description:"时间年月日"`
+	TitmeHM  string `description:"时间时分"`
+	Company  string `description:"公司名称"`
+}
+
+type AliyunOcrTextActivityListResp struct {
+	List []*AliyunOcrTextActivityResp
+}

+ 27 - 26
models/cygx/activity_meet.go

@@ -12,32 +12,33 @@ import (
 
 // 活动详情
 type CygxMeetList struct {
-	ActivityId              int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
-	ActivityName            string `description:"活动名称"`
-	ActivityTypeName        string `description:"活动类型名称"`
-	ActivityTypeId          int    `description:"活动类型ID"`
-	ChartPermissionName     string `description:"行业名称"`
-	ChartPermissionNames    string `description:"行业名称"`
-	ActivityTime            string `description:"活动时间"`
-	ActivityTimeText        string `description:"活动时间带文字"`
-	SignupPeopleNum         int    `description:"报名人数/预约外呼人数"`
-	MeetPeopleNum           int    `description:"实际参会人数"`
-	PotentialPeopleNum      int    `description:"潜在参会人数"`
-	OmeetPeopleNum          int    `description:"实际参会人数(辅助字段不使用)"`
-	IsSubmitMeeting         int    `description:"是否提交过到会信息 ,1是,0否"`
-	OperationStyle          int    `description:"操作方式,1提交到会情况/上传参会表格,2修改到会详情/重新上传"`
-	UpdateTime              string `description:"更新时间"`
-	IsCClassMeeting         bool   `description:"是否是c类电话会"`
-	SubmitMeetingType       int    `description:"操作展示类型 ,1修改到会详情"`
-	IsShowAttendanceDetails bool   `description:"是否展示到会详情"`
-	IsShowHandMovement      bool   `description:"是否展示手动匹配"`
-	IsShowSubmitMeeting     bool   `description:"是否展示提交到会情况"`
-	IsShowUpdateMeeting     bool   `description:"是否展示修改到会情况"`
-	YidongActivityId        string `description:"易董的活动ID"`
-	ActivityJoinType        string `description:"易董活动入会类型01报名审核后可入会 02预约即可入会 03仅定向邀请人员可入会"`
-	IsYidongConduct         int    `description:"是否属于易董办会 1:是 、0:否"`
-	IsShowSigninButton      bool   `description:"是否展示签到码按钮"`
-	SigninImg               string `description:"签到码图片"`
+	ActivityId                int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityName              string `description:"活动名称"`
+	ActivityTypeName          string `description:"活动类型名称"`
+	ActivityTypeId            int    `description:"活动类型ID"`
+	ChartPermissionName       string `description:"行业名称"`
+	ChartPermissionNames      string `description:"行业名称"`
+	ActivityTime              string `description:"活动时间"`
+	ActivityTimeText          string `description:"活动时间带文字"`
+	SignupPeopleNum           int    `description:"报名人数/预约外呼人数"`
+	MeetPeopleNum             int    `description:"实际参会人数"`
+	PotentialPeopleNum        int    `description:"潜在参会人数"`
+	OmeetPeopleNum            int    `description:"实际参会人数(辅助字段不使用)"`
+	IsSubmitMeeting           int    `description:"是否提交过到会信息 ,1是,0否"`
+	OperationStyle            int    `description:"操作方式,1提交到会情况/上传参会表格,2修改到会详情/重新上传"`
+	UpdateTime                string `description:"更新时间"`
+	IsCClassMeeting           bool   `description:"是否是c类电话会"`
+	SubmitMeetingType         int    `description:"操作展示类型 ,1修改到会详情"`
+	IsShowAttendanceDetails   bool   `description:"是否展示到会详情"`
+	IsShowHandMovement        bool   `description:"是否展示手动匹配"`
+	IsShowSubmitMeeting       bool   `description:"是否展示提交到会情况"`
+	IsShowUpdateMeeting       bool   `description:"是否展示修改到会情况"`
+	YidongActivityId          string `description:"易董的活动ID"`
+	ActivityJoinType          string `description:"易董活动入会类型01报名审核后可入会 02预约即可入会 03仅定向邀请人员可入会"`
+	IsYidongConduct           int    `description:"是否属于易董办会 1:是 、0:否"`
+	IsShowSigninButton        bool   `description:"是否展示签到码按钮"`
+	SigninImg                 string `description:"签到码图片"`
+	ChartPermissionNameDeputy string `description:"副行业名称"`
 }
 
 type GetCygxMeetListRep struct {

+ 26 - 25
models/cygx/activity_signup.go

@@ -13,31 +13,32 @@ import (
 
 // 活动详情
 type CygxSignupList struct {
-	ActivityId              int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
-	ActivityName            string `description:"活动名称"`
-	ActivityTypeName        string `description:"活动类型名称"`
-	ChartPermissionName     string `description:"行业名称"`
-	ChartPermissionNames    string `description:"行业名称辅助字段,区分研选子分类"`
-	LimitPeopleNum          int    `description:"限制的人数数量"`
-	ActivityTime            string `description:"活动时间"`
-	ActivityTimeText        string `description:"活动时间带文字"`
-	SignupPeopleNum         int    `description:"报名人数/预约外呼人数"`
-	SignupFailPeopleNum     int    `description:"报名/预约外呼失败人数"`
-	AskNum                  int    `description:"带问人数"`
-	AppointmentPeopleNum    int    `description:"预约纪要人数"`
-	ReminderPeopleNum       int    `description:"设置会议提醒人数"`
-	IsShowAppointment       bool   `description:"是否展示预约纪要"`
-	IsHideAppointment       int    `description:"是否隐藏预约纪要按钮  1是,0 否"`
-	ActivityTypeId          int    `description:"活动类型id"`
-	Label                   string `description:"标签"`
-	ActiveState             int    `description:"活动进行状态 未开始:1、进行中2、已结束3"`
-	PublishStatus           int    `description:"发布状态 1已发布,0未发布"`
-	TemporaryLabel          string `description:"临时标签"`
-	YidongActivityId        string `description:"易董的活动ID"`
-	IsCanAppointmentMinutes int    `description:"是否可预约纪要 1是 ,0 否 默认0 "`
-	IsCancel                int    `description:"是否取消,1是,0否"`
-	IsYidongConduct         int    `description:"是否属于易董办会 1:是 、0:否"`
-	IsResearchPoints        int    `description:"是否为研选扣点  1是,0否"`
+	ActivityId                int    `orm:"column(activity_id);pk";description:"活动ID 等于0新增活动,大于0修改活动"`
+	ActivityName              string `description:"活动名称"`
+	ActivityTypeName          string `description:"活动类型名称"`
+	ChartPermissionName       string `description:"行业名称"`
+	ChartPermissionNames      string `description:"行业名称辅助字段,区分研选子分类"`
+	LimitPeopleNum            int    `description:"限制的人数数量"`
+	ActivityTime              string `description:"活动时间"`
+	ActivityTimeText          string `description:"活动时间带文字"`
+	SignupPeopleNum           int    `description:"报名人数/预约外呼人数"`
+	SignupFailPeopleNum       int    `description:"报名/预约外呼失败人数"`
+	AskNum                    int    `description:"带问人数"`
+	AppointmentPeopleNum      int    `description:"预约纪要人数"`
+	ReminderPeopleNum         int    `description:"设置会议提醒人数"`
+	IsShowAppointment         bool   `description:"是否展示预约纪要"`
+	IsHideAppointment         int    `description:"是否隐藏预约纪要按钮  1是,0 否"`
+	ActivityTypeId            int    `description:"活动类型id"`
+	Label                     string `description:"标签"`
+	ActiveState               int    `description:"活动进行状态 未开始:1、进行中2、已结束3"`
+	PublishStatus             int    `description:"发布状态 1已发布,0未发布"`
+	TemporaryLabel            string `description:"临时标签"`
+	YidongActivityId          string `description:"易董的活动ID"`
+	IsCanAppointmentMinutes   int    `description:"是否可预约纪要 1是 ,0 否 默认0 "`
+	IsCancel                  int    `description:"是否取消,1是,0否"`
+	IsYidongConduct           int    `description:"是否属于易董办会 1:是 、0:否"`
+	IsResearchPoints          int    `description:"是否为研选扣点  1是,0否"`
+	ChartPermissionNameDeputy string `description:"副行业名称"`
 }
 
 type GetCygxSignupListRep struct {

+ 19 - 2
models/cygx/activity_special_trip.go

@@ -113,8 +113,9 @@ func AddCygxActivitySpecialTrip(items []*CygxActivitySpecialTrip, itemsBill []*C
 	}
 
 	//添加流水记录
-	for _, item := range itemsBill {
-		_, err = to.Insert(item)
+	//倒序插入,让流水表看起来是正的
+	for i := len(itemsBill) - 1; i >= 0; i-- {
+		_, err = to.Insert(itemsBill[i])
 		if err != nil {
 			return
 		}
@@ -280,3 +281,19 @@ func GetCygxActivitySpecialTripListCondition(condition string, pars []interface{
 	}
 	return
 }
+
+//获取某一用户的报名的数量
+func GetUserActivitySpecialTripCount(uid, activityId int) (count int, err error) {
+	sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_special_trip  WHERE  user_id=?  AND   activity_id =? `
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, uid, activityId).QueryRow(&count)
+	return
+}
+
+
+func UpdateSpecialTrip(isValid, isCancel, userId, activityId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_activity_special_trip SET is_valid = ?,create_time=NOW(),is_cancel=?  WHERE user_id=? AND activity_id=? `
+	_, err = o.Raw(sql, isValid, isCancel, userId, activityId).Exec()
+	return
+}

+ 110 - 2
models/cygx/activity_special_trip_bill.go

@@ -21,7 +21,9 @@ type CygxActivitySpecialTripBill struct {
 	DoType            int       `description:"操作方式,1报名,2取消报名"`
 	RegisterPlatform  int       `description:"来源 1小程序,2:网页"`
 	ChartPermissionId int       `description:"行业id"`
-	Way               int       `description:"1报名,取消报名。2到会取消到会"`
+	Way               int       `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"`
+	Content           string    `description:"内容"`
+	Total             string    `description:"总和"`
 }
 
 type CygxActivitySpecialTripBillList struct {
@@ -41,6 +43,8 @@ type CygxActivitySpecialTripBillList struct {
 	RegisterPlatform    int       `description:"来源 1小程序,2:网页"`
 	ChartPermissionId   int       `description:"行业id"`
 	ChartPermissionName string    `description:"行业名称"`
+	Way                 int       `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"`
+	Content             string    `description:"内容"`
 }
 
 // 添加
@@ -70,13 +74,31 @@ func GetCygxActivitySpecialTripBillList(condition string, pars []interface{}) (i
 			c.chart_permission_name 
 		FROM
 			cygx_activity_special_trip_bill AS b
-			INNER JOIN chart_permission AS c ON c.chart_permission_id = b.chart_permission_id 
+			LEFT JOIN chart_permission AS c ON c.chart_permission_id = b.chart_permission_id 
 		WHERE
 			1 = 1` + condition
 	_, err = o.Raw(sql, pars).QueryRows(&item)
 	return
 }
 
+type AirborneCount struct {
+	Count             int
+	ChartPermissionId int ` description:"品种权限ID"`
+}
+
+// 获取空降的公司报名的记录
+func GetActivitySpecialTripAirborneListByActivitySpecial(condition string, pars []interface{}) (items []*AirborneCount, err error) {
+	sqlCount := ` SELECT chart_permission_id,COUNT(1) AS count
+		FROM
+			cygx_activity_special_meeting_detail AS t
+			INNER JOIN cygx_activity_special AS a ON a.activity_id = t.activity_id 
+		WHERE
+			 1= 1  	AND YEAR ( t.create_time )= YEAR (NOW()) ` + condition + `GROUP BY chart_permission_id`
+	o := orm.NewOrm()
+	_, err = o.Raw(sqlCount, pars).QueryRows(&items)
+	return
+}
+
 // 获取空降的公司报名的记录
 func GetActivitySpecialTripAirborneCountByActivitySpecial(condition string, pars []interface{}) (count int, err error) {
 	sqlCount := ` SELECT COUNT(1) AS count
@@ -89,3 +111,89 @@ func GetActivitySpecialTripAirborneCountByActivitySpecial(condition string, pars
 	err = o.Raw(sqlCount, pars).QueryRow(&count)
 	return
 }
+
+type CygxActivitySpecialTripBillDetailList struct {
+	Id                  int       `orm:"column(id);pk"`
+	UserId              int       `description:"用户id,多个用,隔开"`
+	ActivityId          int       `description:"活动ID"`
+	ResearchTheme       string    `description:"调研主题"`
+	CreateTime          time.Time `description:"创建时间"`
+	Mobile              string    `description:"手机号"`
+	Email               string    `description:"邮箱号"`
+	CompanyId           int       `description:"公司ID"`
+	CompanyName         string    `description:"公司名称"`
+	RealName            string    `description:"用户实际名称"`
+	AdminId             int       `description:"销售/管理员ID"`
+	Source              int       `description:"来源,1小程序,2后台添加, 3开发人员手动添加"`
+	BillDetailed        int       `description:"流水明细,判断是进账还是出账"`
+	DoType              int       `description:"操作方式,1报名,2取消报名"`
+	RegisterPlatform    int       `description:"来源 1小程序,2:网页"`
+	ChartPermissionId   int       `description:"行业id"`
+	ChartPermissionName string    `description:"行业名称"`
+	Content             string    `description:"内容"`
+	Way                 int       `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"`
+	Total               string    `description:"总和"`
+}
+
+func GetCygxActivitySpecialTripBillDetailList(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillDetailList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			b.*,
+			a.research_theme,
+			c.chart_permission_name 
+		FROM
+			cygx_activity_special_trip_bill AS b
+			INNER JOIN chart_permission AS c ON c.chart_permission_id = b.chart_permission_id 
+			INNER JOIN cygx_activity_special AS a ON a.activity_id = b.activity_id
+		WHERE
+			1 = 1` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+	return
+}
+
+type CygxActivitySpecialPointsBillRespItem struct {
+	Id                  int    `gorm:"column:id;primary_key;AUTO_INCREMENT"`
+	Content             string `gorm:"column:content" `                                 // 内容说明
+	Total               string `gorm:"column:points;default:0;NOT NULL" `               // 合计
+	CreateTime          string `gorm:"column:create_time" `                             // 创建时间
+	CompanyId           int    `gorm:"column:company_id;default:0" `                    // 公司ID
+	CompanyName         string `gorm:"column:company_name" `                            // 公司名称
+	RealName            string `gorm:"column:real_name"`                                // 用户实际名称
+	BillDetailed        int    `gorm:"column:bill_detailed;default:0;NOT NULL" json:""` // 流水明细,判断是进账还是出账
+	ActivityName        string `description:"活动标题"`
+	ChartPermissionId   int    `description:"行业id"`
+	ChartPermissionName string `description:"行业名称"`
+}
+
+type CygxActivitySpecialPointsBillResp struct {
+	List []*CygxActivitySpecialPointsBillRespItem
+}
+
+func GetCygxActivitySpecialTripBillDetailListAll(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillDetailList, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			b.*,
+			a.research_theme,
+			c.chart_permission_name 
+		FROM
+			cygx_activity_special_trip_bill AS b
+			LEFT JOIN chart_permission AS c ON c.chart_permission_id = b.chart_permission_id 
+			LEFT JOIN cygx_activity_special AS a ON a.activity_id = b.activity_id
+		WHERE
+			1 = 1` + condition
+
+	sql += ` ORDER BY b.create_time DESC`
+	_, err = o.Raw(sql, pars).QueryRows(&item)
+	return
+}
+
+func GetCygxActivitySpecialTripBillByCompanyId(companyId int) (item *CygxActivitySpecialTripBill, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			*
+		FROM
+			cygx_activity_special_trip_bill WHERE company_id = ? ORDER BY create_time DESC LIMIT 1
+		`
+	err = o.Raw(sql, companyId).QueryRow(&item)
+	return
+}

+ 1 - 1
models/cygx/activity_type.go

@@ -6,7 +6,7 @@ import (
 
 type ActivityType struct {
 	ActivityTypeId   int    `description:"活动类型id"`
-	ActivityTypeName string `description:"活动名称"`
+	ActivityTypeName string `description:"活动类型名称"`
 	TemplateP        string `description:"活动模板,带P标签"`
 	Template         string `description:"活动模板"`
 	ZoomTemplateP    string `description:"Zoom活动模板,带P标签"`

+ 23 - 0
models/cygx/aliyun_ocr_log.go

@@ -0,0 +1,23 @@
+package cygx
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type AliyunOcrImgUrlReq struct {
+	ImgUrl string `description:"图片地址"`
+}
+
+type AliyunOcrLog struct {
+	Id         int       `orm:"column(id);pk"`
+	ImgUrl     string    `description:"图片地址"`
+	Result     string    `description:"手机号"`
+	CreateTime time.Time `description:"创建时间"`
+}
+
+func AddAliyunOcrLog(item *AliyunOcrLog) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	_, err = o.Insert(item)
+	return
+}

+ 1 - 1
models/cygx/company_user_type.go

@@ -55,7 +55,7 @@ func GetCygxCompanyUserTypeList() (items []*CygxCompanyUserType, err error) {
 // CygxCompanyUserType 更新权益客户身份类型
 func UpdateCygxCompanyUserTypeAndPackageType(companyId, useType, packageType int) (err error) {
 	o := orm.NewOrm()
-	sql := `UPDATE cygx_company_user_type SET customer_type_id=? AND package_type = ? WHERE company_id=? `
+	sql := `UPDATE cygx_company_user_type SET customer_type_id=?, package_type = ? WHERE company_id=? `
 	_, err = o.Raw(sql, useType, packageType, companyId).Exec()
 	return
 }

+ 39 - 0
models/cygx/cygx_activity_special_points_company.go

@@ -0,0 +1,39 @@
+package cygx
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxActivitySpecialInheritPointsCompany struct {
+	Id                  int       `orm:"column(id);pk"`
+	CompanyId           int       // 公司ID
+	CompanyName         string    // 公司名称
+	Points              int   // 公司剩余点数
+	CreateTime          time.Time // 创建时间
+	ModifyTime          time.Time // 更新时间
+	ChartPermissionId   int       // 品种ID
+	ChartPermissionName string    // 品种名称
+}
+
+func AddCygxActivitySpecialPointsCompany(item *CygxActivitySpecialInheritPointsCompany) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	if err != nil {
+		return
+	}
+	return
+}
+
+func AddCygxActivitySpecialInheritPointsCompanyMulti(items []*CygxActivitySpecialInheritPointsCompany) (err error) {
+	o := orm.NewOrm()
+	_, err = o.InsertMulti(1, items)
+	return
+}
+
+func GetCygxActivitySpecialInheritPointsByCompanyId(companyId int) (list []*CygxActivitySpecialInheritPointsCompany, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT * FROM cygx_activity_special_inherit_points_company WHERE company_id = ?  `
+	_, err = o.Raw(sql,companyId).QueryRows(&list)
+	return
+}

+ 32 - 0
models/db.go

@@ -17,6 +17,7 @@ import (
 	"hongze/hz_crm_api/models/day_new"
 	"hongze/hz_crm_api/models/eta_business"
 	"hongze/hz_crm_api/models/eta_trial"
+	"hongze/hz_crm_api/models/help_doc"
 	"hongze/hz_crm_api/models/roadshow"
 	"hongze/hz_crm_api/models/seal"
 	"hongze/hz_crm_api/models/system"
@@ -86,6 +87,13 @@ func init() {
 	fms_datadb, _ := orm.GetDB("fms")
 	fms_datadb.SetConnMaxLifetime(10 * time.Minute)
 
+	_ = orm.RegisterDataBase("hz_cygx", "mysql", utils.MYSQL_URL_CYGX)
+	orm.SetMaxIdleConns("hz_cygx", 50)
+	orm.SetMaxOpenConns("hz_cygx", 100)
+
+	cygx_db, _ := orm.GetDB("hz_cygx")
+	cygx_db.SetConnMaxLifetime(10 * time.Minute)
+
 	orm.Debug = true
 	orm.DebugLog = orm.NewLog(utils.Binlog)
 
@@ -186,6 +194,12 @@ func init() {
 
 	// ETA商家
 	initEtaBusiness()
+
+	// ETA版本更新日志
+	initEtaVersionUpdateLog()
+
+	// 帮助文档
+	initHelpDoc()
 }
 
 // initSystem 系统表 数据表
@@ -423,6 +437,7 @@ func initCygx() {
 		new(cygx.CygxActivityPointsBill),
 		new(cygx.CygxActivityPointsCompany),
 		new(cygx.CygxTag),
+		new(cygx.AliyunOcrLog),
 	)
 }
 
@@ -642,5 +657,22 @@ func initEtaBusiness() {
 		new(eta_business.EtaBusiness),                // ETA商家表
 		new(eta_business.EtaBusinessContract),        // ETA合同表
 		new(eta_business.EtaBusinessOperationRecord), // ETA操作记录表
+		new(eta_business.EtaBusinessMenu),            // ETA商家菜单表
+		new(eta_business.EtaBusinessMenuRelate),      // ETA商家菜单关联表
+	)
+}
+
+// initEtaVersionUpdateLog ETA版本更新日志
+func initEtaVersionUpdateLog() {
+	orm.RegisterModel(
+		new(EtaVersionUpdateLog), // 更新日志表
+	)
+}
+
+func initHelpDoc() {
+	//注册对象
+	orm.RegisterModel(
+		new(help_doc.HelpDocClassify), //分类
+		new(help_doc.HelpDoc),         //文章
 	)
 }

+ 1 - 0
models/eta_business/eta_business.go

@@ -19,6 +19,7 @@ type EtaBusiness struct {
 	EtaBusinessId    int       `orm:"column(eta_business_id);pk"`
 	BusinessName     string    `description:"商家名称"`
 	BusinessCode     string    `description:"商家编码"`
+	CodeEncrypt      string    `description:"商家编码加密"`
 	CreditCode       string    `description:"社会统一信用码"`
 	RegionType       string    `description:"所属区域:国内;海外"`
 	Province         string    `description:"省份"`

+ 147 - 0
models/eta_business/eta_business_menu.go

@@ -0,0 +1,147 @@
+package eta_business
+
+import (
+	"fmt"
+	"github.com/beego/beego/v2/client/orm"
+	"strings"
+	"time"
+)
+
+// EtaBusinessMenu ETA商家基础菜单表
+type EtaBusinessMenu struct {
+	MenuId       int       `orm:"column(menu_id);pk"`
+	ParentId     int       `description:"父级菜单ID"`
+	Name         string    `description:"菜单名称或者按钮名称"`
+	RootId       int       `description:"顶层菜单ID"`
+	Sort         string    `description:"排序"`
+	Path         string    `description:"路由地址"`
+	PathName     string    `description:"路由名称"`
+	IconPath     string    `description:"菜单图标地址"`
+	Component    int       `description:"组件路径"`
+	Hidden       int       `description:"是否隐藏:1-隐藏 0-显示"`
+	HiddenLayout int       `description:"是否隐藏layout:1-隐藏 0-显示"`
+	Level        int       `description:"菜单等级:1-2-3"`
+	IsLevel      int       `description:"是否为多级菜单:1,只有一级;2,有多级"`
+	LevelPath    string    `description:"兼容以前menu表的字段"`
+	MenuType     int       `description:"菜单类型: 0-菜单; 1-按钮; 2-字段(需要特殊处理)"`
+	ButtonCode   string    `description:"按钮/菜单唯一标识"`
+	CreateTime   time.Time `description:"创建时间"`
+	ModifyTime   time.Time `description:"更新时间"`
+}
+
+func (m *EtaBusinessMenu) TableName() string {
+	return "eta_business_menu"
+}
+
+func (m *EtaBusinessMenu) PrimaryId() string {
+	return "menu_id"
+}
+
+func (m *EtaBusinessMenu) Create() (err error) {
+	o := orm.NewOrm()
+	id, err := o.Insert(m)
+	if err != nil {
+		return
+	}
+	m.MenuId = int(id)
+	return
+}
+
+func (m *EtaBusinessMenu) CreateMulti(items []*EtaBusinessMenu) (err error) {
+	if len(items) == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	_, err = o.InsertMulti(len(items), items)
+	return
+}
+
+func (m *EtaBusinessMenu) Update(cols []string) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Update(m, cols...)
+	return
+}
+
+func (m *EtaBusinessMenu) Del() (err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
+	_, err = o.Raw(sql, m.MenuId).Exec()
+	return
+}
+
+func (m *EtaBusinessMenu) GetItemById(id int) (item *EtaBusinessMenu, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
+	err = o.Raw(sql, id).QueryRow(&item)
+	return
+}
+
+func (m *EtaBusinessMenu) GetItemByCondition(condition string, pars []interface{}) (item *EtaBusinessMenu, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s LIMIT 1`, m.TableName(), condition)
+	err = o.Raw(sql, pars).QueryRow(&item)
+	return
+}
+
+func (m *EtaBusinessMenu) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
+	err = o.Raw(sql, pars).QueryRow(&count)
+	return
+}
+
+func (m *EtaBusinessMenu) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*EtaBusinessMenu, err error) {
+	o := orm.NewOrm()
+	fields := strings.Join(fieldArr, ",")
+	if len(fieldArr) == 0 {
+		fields = `*`
+	}
+	order := `ORDER BY create_time DESC`
+	if orderRule != "" {
+		order = ` ORDER BY ` + orderRule
+	}
+	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+func (m *EtaBusinessMenu) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*EtaBusinessMenu, err error) {
+	o := orm.NewOrm()
+	fields := strings.Join(fieldArr, ",")
+	if len(fieldArr) == 0 {
+		fields = `*`
+	}
+	order := `ORDER BY create_time DESC`
+	if orderRule != "" {
+		order = ` ORDER BY ` + orderRule
+	}
+	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// EtaBusinessMenuListResp ETA商家菜单列表响应体
+type EtaBusinessMenuListResp struct {
+	ChoiceList     []int                  `description:"已选菜单"`
+	HalfChoiceList []int                  `description:"半选菜单-方便前端回显用的"`
+	List           []*EtaBusinessMenuItem `description:"菜单列表"`
+}
+
+// EtaBusinessMenuItem ETA商家菜单
+type EtaBusinessMenuItem struct {
+	MenuId       int
+	ParentId     int                    `description:"父级菜单ID"`
+	Name         string                 `description:"菜单名称或者按钮名称"`
+	RootId       int                    `description:"顶层菜单ID"`
+	Sort         string                 `description:"排序"`
+	Path         string                 `description:"路由地址"`
+	PathName     string                 `description:"路由名称"`
+	IconPath     string                 `description:"菜单图标地址"`
+	Component    int                    `description:"组件路径"`
+	Hidden       int                    `description:"是否隐藏:1-隐藏 0-显示"`
+	HiddenLayout int                    `description:"是否隐藏layout:1-隐藏 0-显示"`
+	Level        int                    `description:"菜单等级:1-2-3"`
+	MenuType     int                    `description:"菜单类型: 0-菜单; 1-按钮; 2-字段(需要特殊处理)"`
+	ButtonCode   string                 `description:"按钮/菜单唯一标识"`
+	Children     []*EtaBusinessMenuItem `description:"子菜单"`
+}

+ 133 - 0
models/eta_business/eta_business_menu_relate.go

@@ -0,0 +1,133 @@
+package eta_business
+
+import (
+	"fmt"
+	"github.com/beego/beego/v2/client/orm"
+	"strings"
+)
+
+// EtaBusinessMenuRelate ETA商家菜单关联表
+type EtaBusinessMenuRelate struct {
+	Id            int `orm:"column(id);pk"`
+	EtaBusinessId int `description:"商家ID"`
+	MenuId        int `description:"菜单ID"`
+	Type          int `description:"类型: 0-全选; 1-半选(此字段仅供前端回显做区分)"`
+}
+
+func (m *EtaBusinessMenuRelate) TableName() string {
+	return "eta_business_menu_relate"
+}
+
+func (m *EtaBusinessMenuRelate) PrimaryId() string {
+	return "id"
+}
+
+func (m *EtaBusinessMenuRelate) Create() (err error) {
+	o := orm.NewOrm()
+	id, err := o.Insert(m)
+	if err != nil {
+		return
+	}
+	m.MenuId = int(id)
+	return
+}
+
+func (m *EtaBusinessMenuRelate) CreateMulti(businessId int, items []*EtaBusinessMenuRelate) (err error) {
+	if businessId == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	tx, err := o.Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		if err != nil {
+			_ = tx.Rollback()
+			return
+		}
+		_ = tx.Commit()
+	}()
+
+	sql := fmt.Sprintf(`DELETE FROM %s WHERE eta_business_id = ?`, m.TableName())
+	_, err = tx.Raw(sql, businessId).Exec()
+	if err != nil {
+		return
+	}
+
+	if len(items) > 0 {
+		_, err = tx.InsertMulti(len(items), items)
+	}
+	return
+}
+
+func (m *EtaBusinessMenuRelate) Update(cols []string) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Update(m, cols...)
+	return
+}
+
+func (m *EtaBusinessMenuRelate) Del() (err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
+	_, err = o.Raw(sql, m.MenuId).Exec()
+	return
+}
+
+func (m *EtaBusinessMenuRelate) GetItemById(id int) (item *EtaBusinessMenuRelate, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
+	err = o.Raw(sql, id).QueryRow(&item)
+	return
+}
+
+func (m *EtaBusinessMenuRelate) GetItemByCondition(condition string, pars []interface{}) (item *EtaBusinessMenuRelate, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s LIMIT 1`, m.TableName(), condition)
+	err = o.Raw(sql, pars).QueryRow(&item)
+	return
+}
+
+func (m *EtaBusinessMenuRelate) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
+	err = o.Raw(sql, pars).QueryRow(&count)
+	return
+}
+
+func (m *EtaBusinessMenuRelate) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*EtaBusinessMenuRelate, err error) {
+	o := orm.NewOrm()
+	fields := strings.Join(fieldArr, ",")
+	if len(fieldArr) == 0 {
+		fields = `*`
+	}
+	order := ``
+	if orderRule != "" {
+		order = ` ORDER BY ` + orderRule
+	}
+	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+func (m *EtaBusinessMenuRelate) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*EtaBusinessMenuRelate, err error) {
+	o := orm.NewOrm()
+	fields := strings.Join(fieldArr, ",")
+	if len(fieldArr) == 0 {
+		fields = `*`
+	}
+	order := ``
+	if orderRule != "" {
+		order = ` ORDER BY ` + orderRule
+	}
+	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// EtaBusinessMenuRelateSaveReq 保存商家菜单关联
+type EtaBusinessMenuRelateSaveReq struct {
+	EtaBusinessId int   `description:"商家ID"`
+	MenuIds       []int `description:"菜单IDs"`
+	HalfMenuIds   []int `description:"半选菜单IDs-仅供前端回显用的"`
+}

+ 144 - 0
models/eta_version_update_log.go

@@ -0,0 +1,144 @@
+package models
+
+import (
+	"fmt"
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"strings"
+	"time"
+)
+
+// EtaVersionUpdateLog ETA版本更新日志表
+type EtaVersionUpdateLog struct {
+	Id         int       `orm:"column(id);pk"`
+	Version    string    `description:"版本号"`
+	Content    string    `description:"更新内容"`
+	UpdateDate time.Time `description:"更新日期"`
+	CreateTime time.Time
+	ModifyTime time.Time
+}
+
+func (m *EtaVersionUpdateLog) TableName() string {
+	return "eta_version_update_log"
+}
+
+func (m *EtaVersionUpdateLog) PrimaryId() string {
+	return "id"
+}
+
+func (m *EtaVersionUpdateLog) Create() (err error) {
+	o := orm.NewOrm()
+	id, err := o.Insert(m)
+	if err != nil {
+		return
+	}
+	m.Id = int(id)
+	return
+}
+
+func (m *EtaVersionUpdateLog) CreateMulti(items []*EtaVersionUpdateLog) (err error) {
+	if len(items) == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	_, err = o.InsertMulti(len(items), items)
+	return
+}
+
+func (m *EtaVersionUpdateLog) Update(cols []string) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Update(m, cols...)
+	return
+}
+
+func (m *EtaVersionUpdateLog) Del() (err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
+	_, err = o.Raw(sql, m.Id).Exec()
+	return
+}
+
+func (m *EtaVersionUpdateLog) GetItemById(id int) (item *EtaVersionUpdateLog, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
+	err = o.Raw(sql, id).QueryRow(&item)
+	return
+}
+
+func (m *EtaVersionUpdateLog) GetItemByCondition(condition string, pars []interface{}) (item *EtaVersionUpdateLog, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s LIMIT 1`, m.TableName(), condition)
+	err = o.Raw(sql, pars).QueryRow(&item)
+	return
+}
+
+func (m *EtaVersionUpdateLog) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
+	err = o.Raw(sql, pars).QueryRow(&count)
+	return
+}
+
+func (m *EtaVersionUpdateLog) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*EtaVersionUpdateLog, err error) {
+	o := orm.NewOrm()
+	fields := strings.Join(fieldArr, ",")
+	if len(fieldArr) == 0 {
+		fields = `*`
+	}
+	order := `ORDER BY create_time DESC`
+	if orderRule != "" {
+		order = ` ORDER BY ` + orderRule
+	}
+	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+func (m *EtaVersionUpdateLog) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*EtaVersionUpdateLog, err error) {
+	o := orm.NewOrm()
+	fields := strings.Join(fieldArr, ",")
+	if len(fieldArr) == 0 {
+		fields = `*`
+	}
+	order := `ORDER BY create_time DESC`
+	if orderRule != "" {
+		order = ` ORDER BY ` + orderRule
+	}
+	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+// EtaVersionUpdateLogItem 更新日志信息
+type EtaVersionUpdateLogItem struct {
+	Id         int
+	Version    string `description:"版本号"`
+	Content    string `description:"更新内容"`
+	UpdateDate string `description:"更新日期"`
+	CreateTime string
+	ModifyTime string
+}
+
+// EtaVersionUpdateLogListResp 更新日志列表响应体
+type EtaVersionUpdateLogListResp struct {
+	List   []*EtaVersionUpdateLogItem
+	Paging *paging.PagingItem
+}
+
+// EtaVersionUpdateLogAddReq 新增更新日志请求体
+type EtaVersionUpdateLogAddReq struct {
+	Version    string `description:"版本号"`
+	Content    string `description:"更新内容"`
+	UpdateDate string `description:"更新日期"`
+}
+
+// EtaVersionUpdateLogEditReq 编辑更新日志请求体
+type EtaVersionUpdateLogEditReq struct {
+	Id int
+	EtaVersionUpdateLogAddReq
+}
+
+// EtaVersionUpdateLogDelReq 删除更新日志请求体
+type EtaVersionUpdateLogDelReq struct {
+	Id int
+}

+ 248 - 0
models/help_doc/classify.go

@@ -0,0 +1,248 @@
+package help_doc
+
+import (
+	"fmt"
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type HelpDocClassify struct {
+	ClassifyId      int       `orm:"column(classify_id);pk"`
+	ClassifyName    string    `description:"分类名称"`
+	ParentId        int       `description:"父级id"`
+	CreateTime      time.Time `description:"创建时间"`
+	ModifyTime      time.Time `description:"修改时间"`
+	SysUserId       int       `description:"创建人id"`
+	SysUserRealName string    `description:"创建人姓名"`
+	Level           int       `description:"层级"`
+	Sort            int       `description:"排序字段,越小越靠前,默认值:10"`
+}
+
+func AddHelpDocClassify(item *HelpDocClassify) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+type AddHelpDocClassifyReq struct {
+	HelpDocClassifyName string `description:"分类名称"`
+	ParentId            int    `description:"父级id,第一级传0"`
+	Level               int    `description:"层级,第一级传0,其余传上一级的层级"`
+}
+
+func GetHelpDocClassifyCount(HelpDocClassifyName string, parentId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM help_doc_classify WHERE parent_id=? AND classify_name=? `
+	err = o.Raw(sql, parentId, HelpDocClassifyName).QueryRow(&count)
+	return
+}
+
+type EditHelpDocClassifyReq struct {
+	HelpDocClassifyName string `description:"分类名称"`
+	HelpDocClassifyId   int    `description:"分类id"`
+}
+
+func GetHelpDocClassifyById(classifyId int) (item *HelpDocClassify, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM help_doc_classify WHERE classify_id=? `
+	err = o.Raw(sql, classifyId).QueryRow(&item)
+	return
+}
+
+func GetHelpDocClassifyCountById(classifyId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT count(1) AS count FROM help_doc_classify WHERE classify_id=? `
+	err = o.Raw(sql, classifyId).QueryRow(&count)
+	return
+}
+
+func EditHelpDocClassify(classifyId int, HelpDocClassifyName string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE help_doc_classify SET classify_name=?, modify_time=NOW() WHERE classify_id=? `
+	_, err = o.Raw(sql, HelpDocClassifyName, classifyId).Exec()
+	return
+}
+
+// GetHelpDocClassifyByParentId
+func GetHelpDocClassifyByParentId(parentId int, keyWord string) (items []HelpDocClassifyItems, err error) {
+	o := orm.NewOrm()
+	sql := ``
+	if keyWord != "" {
+		sql = ` SELECT * FROM help_doc_classify WHERE parent_id=? AND (classify_name LIKE '%` + keyWord + `%' ) order by sort asc,classify_id asc`
+	} else {
+		sql = ` SELECT * FROM help_doc_classify WHERE parent_id=? order by sort asc,classify_id asc`
+	}
+	_, err = o.Raw(sql, parentId).QueryRows(&items)
+	return
+}
+
+// GetHelpDocClassifyAll
+func GetHelpDocClassifyAll(keyWord string) (items []*HelpDocClassifyItems, err error) {
+	o := orm.NewOrm()
+	sql := ``
+	if keyWord != "" {
+		sql = ` SELECT * FROM help_doc_classify WHERE parent_id<>0 AND (classify_name LIKE '%` + keyWord + `%' ) order by sort asc,classify_id asc`
+	} else {
+		sql = ` SELECT * FROM help_doc_classify WHERE parent_id<>0 order by sort asc,classify_id asc`
+	}
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+type HelpDocClassifyItems struct {
+	ClassifyId         int `description:"分类id"`
+	ClassifyName       string
+	ParentId           int
+	Level              int    `description:"层级"`
+	Sort               int    `description:"排序字段,越小越靠前,默认值:10"`
+	SysUserId          int    `description:"创建人id"`
+	SysUserRealName    string `description:"创建人姓名"`
+	VisibleBusinessIds string
+	Disabled           bool `description:"是否能选 true不能 false可以"`
+	Children           []*HelpDocClassifyItems
+}
+
+type HelpDocClassifyListResp struct {
+	AllNodes      []*HelpDocClassifyItems
+	TwoLevelNodes []*HelpDocClassifyItems
+}
+
+type HelpDocClassifyDeleteCheckResp struct {
+	DeleteStatus int    `description:"检测状态:0:默认值,如果为0,继续走其他校验,1:该分类下关联不可删除,2:确认删除当前目录及包含的子目录吗"`
+	TipsMsg      string `description:"提示信息"`
+}
+
+type HelpDocClassifyDeleteCheckReq struct {
+	HelpDocClassifyId int `description:"分类id"`
+	ChartInfoId       int `description:"指标id"`
+}
+
+func GetHelpDocClassifyByCondition(condition string, pars []interface{}) (item *HelpDocClassify, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT * FROM help_doc_classify WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	err = o.Raw(sql, pars).QueryRow(&item)
+	return
+}
+
+// MoveHelpDocClassifyReq 移动分类请求参数
+type MoveHelpDocClassifyReq struct {
+	ClassifyId       int `description:"分类id"`
+	ParentClassifyId int `description:"父级分类id"`
+	PrevClassifyId   int `description:"上一个兄弟节点分类id"`
+	NextClassifyId   int `description:"下一个兄弟节点分类id"`
+}
+
+// GetFirstHelpDocClassifyByParentId 获取当前父级分类下的排序第一条的数据
+func GetFirstHelpDocClassifyByParentId(parentId int) (item *HelpDocClassify, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT * FROM help_doc_classify WHERE parent_id=? order by sort asc,classify_id asc limit 1`
+	err = o.Raw(sql, parentId).QueryRow(&item)
+	return
+}
+
+// UpdateHelpDocClassifySortByParentId 根据父类id更新排序
+func UpdateHelpDocClassifySortByParentId(parentId, classifyId, nowSort int, updateSort string) (err error) {
+	o := orm.NewOrm()
+	sql := ` update help_doc_classify set sort = ` + updateSort + ` WHERE parent_id=? and sort > ? `
+	if classifyId > 0 {
+		sql += ` or ( classify_id > ` + fmt.Sprint(classifyId) + ` and sort= ` + fmt.Sprint(nowSort) + `)`
+	}
+	_, err = o.Raw(sql, parentId, nowSort).Exec()
+	return
+}
+
+// Update 更新分类基础信息
+func (HelpDocClassify *HelpDocClassify) Update(cols []string) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Update(HelpDocClassify, cols...)
+	return
+}
+
+// GetHelpDocClassifyMaxSort 获取分类下最大的排序数
+func GetHelpDocClassifyMaxSort(parentId int) (sort int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT Max(sort) AS sort FROM help_doc_classify WHERE parent_id=?  `
+	err = o.Raw(sql, parentId).QueryRow(&sort)
+	return
+}
+
+type HelpDocClassifyView struct {
+	HelpDocClassifyId   int    `orm:"column(classify_id);pk"`
+	HelpDocClassifyName string `description:"分类名称"`
+	ParentId            int    `description:"父级id"`
+}
+
+func EditHelpDocClassifySysUser(classifyId, sysUserId int, HelpDocClassifyName string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE help_doc_classify SET sys_user_id=?,sys_user_real_name=?,modify_time=NOW() WHERE parent_id=?  AND level=3 `
+	_, err = o.Raw(sql, sysUserId, HelpDocClassifyName, classifyId).Exec()
+	return
+}
+
+func GetHelpDocClassifyChildCounts(parentId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM help_doc_classify WHERE parent_id=? `
+	err = o.Raw(sql, parentId).QueryRow(&count)
+	return
+}
+
+func GetHelpDocCounts(classifyId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM help_doc WHERE classify_id=? `
+	err = o.Raw(sql, classifyId).QueryRow(&count)
+	return
+}
+
+// DeleteHelpDocClassify 删除分类
+func DeleteHelpDocClassify(classifyId int) (err error) {
+	o := orm.NewOrm()
+	sql := ` DELETE FROM help_doc_classify WHERE classify_id =? `
+	_, err = o.Raw(sql, classifyId).Exec()
+	return
+}
+
+// MoveClassifyReq 移动分类请求参数
+type MoveClassifyReq struct {
+	ClassifyId       int `description:"分类id"`
+	ParentClassifyId int `description:"父级分类id"`
+	PrevClassifyId   int `description:"上一个兄弟节点分类id"`
+	NextClassifyId   int `description:"下一个兄弟节点分类id"`
+}
+
+// GetHelpDocClassifyLevel
+func GetHelpDocClassifyLevel() (items []*HelpDocClassifyItems, err error) {
+	o := orm.NewOrm()
+	sql := ``
+	sql = ` SELECT * FROM help_doc_classify WHERE level IN (1,2) `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+type EditHelpDocClassifyVisibleReq struct {
+	HelpDocClassifyId  int `description:"分类id"`
+	VisibleBusinessIds string
+}
+
+func EditHelpDocClassifyVisible(classifyId int, visibleBusinessIds string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE help_doc_classify SET visible_business_ids=?, modify_time=NOW() WHERE classify_id=? `
+	_, err = o.Raw(sql, visibleBusinessIds, classifyId).Exec()
+	return
+}
+
+func GetAllHelpDocClassify() (items []*HelpDocClassifyItems, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM help_doc_classify `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+func GetAllHelpDocClassifyByKeyword(keyword string) (items []*HelpDocClassifyItems, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM help_doc_classify WHERE classify_name LIKE '%` + keyword + `%' `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 192 - 0
models/help_doc/help_doc.go

@@ -0,0 +1,192 @@
+package help_doc
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
+)
+
+type HelpDoc struct {
+	Id            int       `orm:"column(id);pk"`
+	ClassifyId    int       // 分类id
+	Title         string    // 标题
+	Author        string    // 作者
+	CreateTime    time.Time // 创建时间
+	ModifyTime    time.Time // 修改时间
+	Status        int       // 1:未发布,2:已发布
+	PublishTime   time.Time // 发布时间
+	Content       string    // 内容
+	AdminId       int       // 创建人
+	AdminRealName string    // 创建人姓名
+	Anchor        string    // 锚点
+	Recommend     string    // 推荐
+}
+
+type HelpDocItem struct {
+	Id            int    `orm:"column(id);pk"`
+	ClassifyId    int    // 分类id
+	Title         string // 标题
+	Author        string // 作者
+	CreateTime    string // 创建时间
+	ModifyTime    string // 修改时间
+	Status        int    // 1:未发布,2:已发布
+	PublishTime   string // 发布时间
+	Content       string // 内容
+	AdminId       int    // 创建人
+	AdminRealName string // 创建人姓名
+	Anchor        string // 锚点
+	Recommend     string // 推荐
+}
+
+func EditHelpDocClassifyId(classifyId int, classifyName string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE help_doc SET classify_name=?,modify_time=NOW() WHERE classify_id=? `
+	_, err = o.Raw(sql, classifyId, classifyName).Exec()
+	return
+}
+
+type AddHelpDocReq struct {
+	Id            int64  `description:"文章id"`
+	ClassifyId    int    `description:"分类id"`
+	Title         string `description:"标题"`
+	Author        string `description:"作者"`
+	Status        int    `description:"状态:1:未发布,2:已发布"`
+	Content       string `description:"内容"`
+	AnchorData    []AnchorList
+	RecommendData []RecommendList
+}
+
+type AnchorList struct {
+	AnchorId   string
+	Anchor     string
+	AnchorName string
+	Child      []AnchorList
+}
+
+type RecommendList struct {
+	Name string
+	Url  string
+}
+
+func AddHelpDoc(item *HelpDoc) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+type EditHelpDocReq struct {
+	Id            int64  `description:"文章id"`
+	ClassifyId    int    `description:"分类id"`
+	Title         string `description:"标题"`
+	Author        string `description:"作者"`
+	Status        int    `description:"状态:1:未发布,2:已发布"`
+	Content       string `description:"内容"`
+	AnchorData    []AnchorList
+	RecommendData []RecommendList
+}
+
+func EditHelpDoc(item *HelpDoc, reportId int64) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE help_doc
+			SET
+			  classify_id =?,
+			  title = ?,
+			  author = ?,
+			  content = ?,
+			  modify_time = ?,
+			  status = ?,
+			  publish_time = ?,
+			  anchor = ?,
+			  recommend = ? 
+			WHERE id = ? `
+	_, err = o.Raw(sql, item.ClassifyId, item.Title, item.Author, item.Content, item.ModifyTime,
+		item.Status, item.PublishTime, item.Anchor, item.Recommend, reportId).Exec()
+	return
+}
+
+func GetHelpDocById(docId int) (item *HelpDocItem, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM help_doc WHERE id=?`
+	err = o.Raw(sql, docId).QueryRow(&item)
+	return
+}
+
+type HelpDocResp struct {
+	Id            int             `orm:"column(id);pk"`
+	ClassifyId    int             // 分类id
+	ClassifyName  string          // 分类路径
+	Title         string          // 标题
+	Author        string          // 作者
+	CreateTime    string          // 创建时间
+	ModifyTime    string          // 修改时间
+	Status        int             // 1:未发布,2:已发布
+	PublishTime   string          // 发布时间
+	Content       string          // 内容
+	AdminId       int             // 创建人
+	AdminRealName string          // 创建人姓名
+	Anchor        []AnchorList    // 锚点
+	Recommend     []RecommendList // 推荐
+}
+
+func GetHelpDocListCount(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM help_doc WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	err = o.Raw(sql, pars).QueryRow(&count)
+	return
+}
+
+func GetHelpDocList(condition string, pars []interface{}, startSize, pageSize int) (items []*HelpDocItem, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM help_doc WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += `ORDER BY create_time DESC LIMIT ?,?`
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+type HelpDocListResp struct {
+	List         []*HelpDocResp
+	ClassifyName string
+	Paging       *paging.PagingItem `description:"分页数据"`
+}
+
+type PublishReq struct {
+	DocId  int
+	Status int `description:"状态:1:未发布,2:已发布"`
+}
+
+// 发布报告
+func PublishHelpDocById(reportId, status int) (err error) {
+	o := orm.NewOrm()
+	sql := ``
+	if status == 1 {
+		sql = `UPDATE help_doc SET status=1,publish_time=NULL,modify_time=NOW() WHERE id = ? `
+	} else {
+		sql = `UPDATE help_doc SET status=2,publish_time=now(),modify_time=NOW() WHERE id = ? `
+	}
+	_, err = o.Raw(sql, reportId).Exec()
+	return
+}
+
+type DeleteReq struct {
+	DocId int `description:"id"`
+}
+
+func DeleteHelpDoc(reportIds int) (err error) {
+	o := orm.NewOrm()
+	sql := ` DELETE FROM help_doc WHERE id =? `
+	_, err = o.Raw(sql, reportIds).Exec()
+	return
+}
+
+func GetAllHelpDoc() (items []*HelpDocItem, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM help_doc `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 4 - 1
models/yb/apply_record.go

@@ -49,7 +49,7 @@ type ApplyList struct {
 	IsMove          int       `description:"是否已移动"`
 	Source          int       `description:"申请来源 1-我的 2-活动 3-图库"`
 	SourceAgent     int       `description:"申请入口来源,1:小程序,2:pc"`
-	FromPage        string    `description:"申请来源具体页面`
+	FromPage        string    `description:"申请来源具体页面"`
 	CreateTime      time.Time `description:"申请时间"`
 }
 
@@ -175,6 +175,7 @@ WHERE
 	AND ( a.mobile <> '' OR a.email <> '' ) 
 	AND ( c.create_platform <> 4 OR c.create_platform IS NULL )
     AND ((y.apply_record_id > 0 and y.create_time > ?) OR (y.apply_record_id is null AND a.created_time > ?) )
+	AND ( y.source > 0 )
 `
 	sql += condition
 	sql += ` GROUP BY a.user_id ORDER BY last_time desc`
@@ -205,6 +206,7 @@ WHERE
 	AND ( a.mobile <> '' OR a.email <> '' ) 
 	AND ( c.create_platform <> 4 OR c.create_platform IS NULL )
     AND ((y.apply_record_id > 0 and y.create_time > ?) OR (y.apply_record_id is null AND a.created_time > ?) )
+	AND ( y.source > 0 )
 `
 	pars = append(pars, startTime)
 	pars = append(pars, startTime)
@@ -259,6 +261,7 @@ WHERE
 	AND ( a.mobile <> '' OR a.email <> '' ) 
 	AND ( c.create_platform <> 4 OR c.create_platform IS NULL )
     AND ((y.apply_record_id > 0 and y.create_time > ?) OR (y.apply_record_id is null AND a.created_time > ?) )
+	AND ( y.source > 0 )
 `
 	sql += condition
 	sql += ` GROUP BY a.user_id ORDER BY last_time desc`

+ 171 - 0
routers/commentsRouter.go

@@ -538,6 +538,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ActivityCoAntroller"],
+        beego.ControllerComments{
+            Method: "ImgToText",
+            Router: `/activity/imgToText`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ActivityCoAntroller"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:ActivityCoAntroller"],
         beego.ControllerComments{
             Method: "ActivityList",
@@ -6550,6 +6559,123 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/eta_business:EtaBusinessMenuController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/eta_business:EtaBusinessMenuController"],
+        beego.ControllerComments{
+            Method: "List",
+            Router: `/menu/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/eta_business:EtaBusinessMenuController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/eta_business:EtaBusinessMenuController"],
+        beego.ControllerComments{
+            Method: "SaveRelate",
+            Router: `/menu/relate/save`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"],
+        beego.ControllerComments{
+            Method: "AddClassify",
+            Router: `/classify/add`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"],
+        beego.ControllerComments{
+            Method: "DelClassify",
+            Router: `/classify/delete`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"],
+        beego.ControllerComments{
+            Method: "EditClassify",
+            Router: `/classify/edit`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"],
+        beego.ControllerComments{
+            Method: "ListClassify",
+            Router: `/classify/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"],
+        beego.ControllerComments{
+            Method: "ClassifyMove",
+            Router: `/classify/move`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocClassifyController"],
+        beego.ControllerComments{
+            Method: "EditClassifyVisible",
+            Router: `/classify/visible/edit`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"],
+        beego.ControllerComments{
+            Method: "Add",
+            Router: `/add`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"],
+        beego.ControllerComments{
+            Method: "Delete",
+            Router: `/delete`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"],
+        beego.ControllerComments{
+            Method: "Detail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"],
+        beego.ControllerComments{
+            Method: "ListReport",
+            Router: `/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/help_doc:HelpDocController"],
+        beego.ControllerComments{
+            Method: "PublishReport",
+            Router: `/publish`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/roadshow:CalendarController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/roadshow:CalendarController"],
         beego.ControllerComments{
             Method: "Accept",
@@ -8899,6 +9025,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:CompanyTodoController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:CompanyTodoController"],
+        beego.ControllerComments{
+            Method: "CompanyActivitySpecialPointsBill",
+            Router: `/company/activity/special/points/bill`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:CompanyTodoController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:CompanyTodoController"],
         beego.ControllerComments{
             Method: "CompanyTryOutDayList",
@@ -9358,6 +9493,42 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:EtaVersionUpdateLogController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:EtaVersionUpdateLogController"],
+        beego.ControllerComments{
+            Method: "Add",
+            Router: `/add`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:EtaVersionUpdateLogController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:EtaVersionUpdateLogController"],
+        beego.ControllerComments{
+            Method: "Del",
+            Router: `/del`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:EtaVersionUpdateLogController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:EtaVersionUpdateLogController"],
+        beego.ControllerComments{
+            Method: "Edit",
+            Router: `/edit`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:EtaVersionUpdateLogController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:EtaVersionUpdateLogController"],
+        beego.ControllerComments{
+            Method: "PageList",
+            Router: `/page_list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:FullCompanyController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers:FullCompanyController"],
         beego.ControllerComments{
             Method: "Detail",

+ 13 - 0
routers/router.go

@@ -22,6 +22,7 @@ import (
 	"hongze/hz_crm_api/controllers/data_manage/supply_analysis"
 	"hongze/hz_crm_api/controllers/english_report"
 	"hongze/hz_crm_api/controllers/eta_business"
+	"hongze/hz_crm_api/controllers/help_doc"
 	"hongze/hz_crm_api/controllers/roadshow"
 	"hongze/hz_crm_api/controllers/seal"
 	"hongze/hz_crm_api/controllers/yb"
@@ -303,6 +304,18 @@ func init() {
 		web.NSNamespace("/eta_business",
 			web.NSInclude(
 				&eta_business.EtaBusinessController{},
+				&eta_business.EtaBusinessMenuController{},
+			),
+		),
+		web.NSNamespace("/eta_version_update_log",
+			web.NSInclude(
+				&controllers.EtaVersionUpdateLogController{},
+			),
+		),
+		web.NSNamespace("/help_doc",
+			web.NSInclude(
+				&help_doc.HelpDocClassifyController{},
+				&help_doc.HelpDocController{},
 			),
 		),
 	)

+ 80 - 0
services/aliyun_ocr.go

@@ -0,0 +1,80 @@
+package services
+
+import (
+	"encoding/json"
+	"fmt"
+	"hongze/hz_crm_api/models/cygx"
+	"io/ioutil"
+	"net/http"
+	"strings"
+	"time"
+)
+
+var (
+	AliyunAppCode = "22553c4ba74545568aba70ac6cfd441d" // AppCode
+)
+
+type AliOcrByImageToTextResp struct {
+	RequestID string `json:"request_id"`
+	Ret       []struct {
+		Rect struct {
+			Angle  int64 `json:"angle"`
+			Height int64 `json:"height"`
+			Left   int64 `json:"left"`
+			Top    int64 `json:"top"`
+			Width  int64 `json:"width"`
+		} `json:"rect"`
+		Word string `json:"word"`
+	} `json:"ret"`
+	Success bool `json:"success"`
+}
+
+//func init() {
+//	AliOcrByImageToText("https://hzstatic.hzinsights.com/cygx/config/a2.jpg")
+//}
+
+// 阿里云OCR将图片转文字
+func AliOcrByImageToText(imageurl string) (item *AliOcrByImageToTextResp, err error) {
+	url := "https://tysbgpu.market.alicloudapi.com/api/predict/ocr_general"
+	method := "POST"
+
+	payload := strings.NewReader(`{
+    "image":"` + imageurl + `"
+}`)
+
+	client := &http.Client{}
+	req, err := http.NewRequest(method, url, payload)
+
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	req.Header.Add("Authorization", "APPCODE "+AliyunAppCode)
+	req.Header.Add("Content-Type", "application/json")
+
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	err = json.Unmarshal(body, &item)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	logItem := new(cygx.AliyunOcrLog)
+	logItem.ImgUrl = imageurl
+	logItem.Result = string(body)
+	logItem.CreateTime = time.Now()
+	err = cygx.AddAliyunOcrLog(logItem)
+	return
+}

+ 24 - 0
services/company_apply/company_approval.go

@@ -391,6 +391,29 @@ func Approved(approvalRecord *contract.ContractApprovalRecord, opUser *system.Ad
 				// 处理权益客户的身份信息()
 				cygxService.UpdateCygxCompanyUserType(recordInfo.CompanyContractId)
 
+				if recordInfo.ApplyMethod == 1{
+					//获取合同信息
+					contractInfo, tmpErr := company.GetCompanyContractDetail(recordInfo.CompanyId, recordInfo.ProductId, recordInfo.CompanyContractId)
+					if tmpErr != nil {
+						err = errors.New(fmt.Sprint("待审批信息不存在,CompanyId:", recordInfo.CompanyId, ";productId:", recordInfo.ProductId, ";Err:"+tmpErr.Error()))
+						return
+					}
+					if contractInfo == nil {
+						err = errors.New(fmt.Sprint("待审批信息不存在,CompanyId:", recordInfo.CompanyId, ";productId:", recordInfo.ProductId))
+						return
+					}
+
+					//格式化合同开始时间
+					contractStartDate, tmpErr := time.Parse(utils.FormatDate, contractInfo.StartDate)
+					if tmpErr != nil {
+						err = errors.New("合同开始时间转换失败,Err:" + tmpErr.Error())
+						return
+					}
+					if time.Now().After(contractStartDate) {
+						cygxService.ActivitySpecialCompanyApproval(recordInfo.CompanyId, companyInfo.CompanyName) //审批通过的时候专项调研次数更新
+					}
+				}
+
 				//权益销售客户申请转正后,消息群发给所有销售
 				services.AddCompanyApprovalMessageRai(recordInfo.CompanyId, recordInfo.CompanyContractId, recordInfo.ApplyRealName, companyInfo.CompanyName)
 
@@ -398,6 +421,7 @@ func Approved(approvalRecord *contract.ContractApprovalRecord, opUser *system.Ad
 				services.AddCompanyApprovalMessageWangYang(recordInfo.CompanyId, recordInfo.CompanyContractId, recordInfo.ApplyRealName, companyInfo.CompanyName)
 
 				go cygxService.YanXuanCompanyApproval(recordInfo.CompanyId) //研选审批通过的时候研选扣点更新
+
 			}
 		}()
 	} else {

+ 6 - 0
services/company_approval_message.go

@@ -212,6 +212,9 @@ func AddCompanyApprovalMessageRai(companyId, companyContractId int, applyRealNam
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		return err
 	}
+	if len(openIdList) == 0 {
+		return
+	}
 	go SendWxMsgWithRaiSell(first, keyword1, keyword2, keyword3, keyword4, openIdList)
 	return
 }
@@ -246,6 +249,9 @@ func AddCompanyApprovalMessageWangYang(companyId, companyContractId int, applyRe
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		return err
 	}
+	if len(openIdList) == 0 {
+		return
+	}
 	go SendWxMsgWithRaiWangYang(keyword1, keyword2, keyword3, keyword4, openIdList)
 	return
 }

+ 5 - 5
services/cygx/acitvity.go

@@ -1421,11 +1421,11 @@ func GetActChartPermissionList() []*cygx.ChartPermissionRepMore {
 		{PermissionName: "智造"},
 		{PermissionName: "策略"},
 		{PermissionName: "宏观"},
-		{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN},
-		{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN + "(医药)"},
-		{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN + "(消费)"},
-		{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN + "(科技)"},
-		{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN + "(智造)"},
+		//{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN},
+		//{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN + "(医药)"},
+		//{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN + "(消费)"},
+		//{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN + "(科技)"},
+		//{PermissionName: utils.CHART_PERMISSION_NAME_MF_YANXUAN + "(智造)"},
 	}
 	return list
 }

+ 157 - 0
services/cygx/activity_ocr.go

@@ -0,0 +1,157 @@
+package cygx
+
+import (
+	"errors"
+	"hongze/hz_crm_api/models/cygx"
+	"hongze/hz_crm_api/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+//处理OCR识别图片建会的逻辑
+
+//星期日 Sunday=Sun. 读音:英[ˈsʌndeɪ]美[ˈsʌnˌdeɪ]
+//
+//星期一 Monday=Mon. 读音:英[ˈmʌndeɪ]美[ˈmʌndeɪ]
+//
+//星期二 Tuesday=Tues. 读音:英[ˈtju:zdeɪ]美[ˈtu:zdeɪ]
+//
+//星期三 Wednesday=Wed. 读音:英[ˈwenzdeɪ]美[ˈwɛnzdi, -ˌde]
+//
+//星期四 Thursday=Thur./Thurs. 读音:英[ˈθɜ:zdeɪ]美[ˈθɜ:rzdeɪ]
+//
+//星期五 Friday=Fri. 读音:英[ˈfraɪdeɪ]美[ˈfraɪˌdeɪ]
+//
+//星期六 Saturday=Sat. 读音: 英[ˈsætədeɪ]美[ˈsætərdeɪ]
+
+// 处理年月日格式
+func ConvertActivityTitmeYMD(TitmeYMD string) (titmeYMDNew string) {
+	titmeYMDNew = TitmeYMD
+	titmeYMDNew = strings.Replace(titmeYMDNew, "/", "月", -1)
+	//titmeYMDNew = strings.Replace(titmeYMDNew, "SUN", "日(周日)", -1)
+	//titmeYMDNew = strings.Replace(titmeYMDNew, "MON", "日(周一)", -1)
+	//titmeYMDNew = strings.Replace(titmeYMDNew, "TUE", "日(周二)", -1)
+	//titmeYMDNew = strings.Replace(titmeYMDNew, "WED", "日(周三)", -1)
+	//titmeYMDNew = strings.Replace(titmeYMDNew, "THU", "日(周四)", -1)
+	//titmeYMDNew = strings.Replace(titmeYMDNew, "FRI", "日(周五)", -1)
+	//titmeYMDNew = strings.Replace(titmeYMDNew, "SAT", "日(周六)", -1)
+
+	titmeYMDNew = strings.Replace(titmeYMDNew, "SUN", "日", -1)
+	titmeYMDNew = strings.Replace(titmeYMDNew, "MON", "日", -1)
+	titmeYMDNew = strings.Replace(titmeYMDNew, "TUE", "日", -1)
+	titmeYMDNew = strings.Replace(titmeYMDNew, "WED", "日", -1)
+	titmeYMDNew = strings.Replace(titmeYMDNew, "THU", "日", -1)
+	titmeYMDNew = strings.Replace(titmeYMDNew, "FRI", "日", -1)
+	titmeYMDNew = strings.Replace(titmeYMDNew, "SAT", "日", -1)
+	titmeYMDNew = strconv.Itoa(time.Now().Year()) + "年" + titmeYMDNew
+	return
+}
+
+// 处理时分PM格式
+func ConvertActivityTitmeHM(titmeHM string) (titmeHMNew string) {
+	titmeHMNew = titmeHM
+	//var hNum int
+	var amOrPm string
+	if strings.Contains(titmeHM, "PM") {
+		//hNum = 12
+		amOrPm = "PM"
+	} else {
+		amOrPm = "AM"
+	}
+	titmeHM = strings.Replace(titmeHM, "AM", "", -1)
+	titmeHM = strings.Replace(titmeHM, "PM", "", -1)
+	sliceHm := strings.Split(titmeHM, ":")
+	if len(sliceHm) != 2 {
+		return
+	}
+	hourNum, _ := strconv.Atoi(sliceHm[0])
+	minute := sliceHm[1]
+	titmeHMNew = strconv.Itoa(hourNum) + ":" + minute + " " + amOrPm
+	return
+}
+
+// 活动内容模版
+var ActivityOcrTemplate = "<p>【买方研选-小范围公司线上交流】{{COMPANY}}</p><p>时间:{{TIME}}</p><p>嘉宾:IR</p><p>主持人:IR</p><p>链接参会:(会前一天下午更新)</p><p>备注:</p><p>1、请先报名,我们将于会议前一天提供【Webex】入会链接(可电话拨入or网络端参会);</p><p>2、会议语言:{{LANGUAGE}};</p><p>3、本场会议报名截止时间为会议开始前一天下午3点半;</p><p>4、本次会议扣0.5次研选服务点。</p>"
+
+func MakeActivityReqText(list []*cygx.AliyunOcrTextActivityResp) (req cygx.ActivityRep, err error, errMsg string) {
+	for _, v := range list {
+		ActivityOcrTmp := ActivityOcrTemplate
+		sliceCompany := strings.Split(v.Company, "(")
+		company := sliceCompany[0]
+		ActivityOcrTmp = strings.Replace(ActivityOcrTmp, "{{COMPANY}}", company, -1)
+		v.TitmeYMD = strings.Replace(v.TitmeYMD, "年", "-", -1)
+		v.TitmeYMD = strings.Replace(v.TitmeYMD, "月", "-", -1)
+		v.TitmeYMD = strings.Replace(v.TitmeYMD, "日", "", -1)
+		weeknum := utils.StrDateTimeToWeek(v.TitmeYMD + " 00:00:00")
+
+		havePm := strings.Contains(v.TitmeHM, "PM")
+		var activityTime string
+		activityTime = strings.Replace(v.TitmeHM, " ", "", -1)
+		activityTime = strings.Replace(activityTime, "AM", "", -1)
+		activityTime = strings.Replace(activityTime, "PM", "", -1)
+
+		activityTime = v.TitmeYMD + " " + activityTime + ":00"
+		resultTime := utils.StrTimeToTime(activityTime)
+		var amOrPm string
+		if havePm {
+			//前端传过来的是 2:00PM 这里转成 14:00 PM
+			slicePm := strings.Split(v.TitmeHM, ":")
+			for sk, sv := range slicePm {
+				// 如果是中午 12:30 PM 就不做任何处理
+				if sk == 0 && sv != "12" {
+					resultTime = resultTime.Add(12 * time.Hour)
+					activityTime = resultTime.Format(utils.FormatDateTime)
+				}
+			}
+			amOrPm = "PM"
+		} else {
+			amOrPm = "AM"
+		}
+		var condition string
+		var pars []interface{}
+		condition = " AND activity_type_id = 3 AND  activity_time = ? AND temporary_label = ? "
+		pars = append(pars, activityTime, company)
+		total, e := cygx.GetActivityCount(condition, pars)
+		if e != nil {
+			err = errors.New("GetActivityCount,Err" + e.Error())
+			return
+		}
+
+		if total > 0 {
+			errMsg = "相同时段已存在对应活动"
+			return
+		}
+		ActivityOcrTmp = strings.Replace(ActivityOcrTmp, "{{TIME}}", v.TitmeYMD+"("+weeknum+")"+resultTime.Format(utils.FormatTimeHm)+amOrPm, -1)
+		if !utils.CheckStrHaveLetter(company) {
+			ActivityOcrTmp = strings.Replace(ActivityOcrTmp, "{{LANGUAGE}}", "中文", -1)
+		} else {
+			ActivityOcrTmp = strings.Replace(ActivityOcrTmp, "{{LANGUAGE}}", "英文", -1)
+		}
+		req.Body += ActivityOcrTmp + "<hr>" //分隔符标签
+		label := new(cygx.ActivityGroupIndustrialRep)
+		label.TemporaryLabel = company
+		req.List = append(req.List, label)
+	}
+	//初始化相关活动参数信息
+	req.Body = strings.TrimRight(req.Body, "<hr>")
+	req.DoType = 1
+	req.ActivityTypeId = 3
+	req.PermissionName = utils.CHART_PERMISSION_NAME_MF_YANXUAN
+	req.CustomerTypeIds = "1,2,8,10,3,9,5,6,7"
+	req.IsAllCustomerType = 1
+	req.LimitPeopleNum = 10
+	req.LabelType = 1
+	req.VisibleRange = 2
+	req.IsResearchPoints = 1
+	req.IsNeedEmail = 1
+	// 研选点数
+	pointsSet := new(cygx.CygxActivityPointsSetRsq)
+	pointsSet.PointsObject = "1"
+	pointsSet.UserPointsNum = "0.5"
+	pointsSet.PointsType = "1"
+	pointsSet.CompanyPointsNum = "0"
+	pointsSet.CancelDeadlineType = "1"
+	req.PointsSet = pointsSet
+	return
+}

+ 1 - 1
services/cygx/activity_poster.go

@@ -92,7 +92,7 @@ func MakeActivitySigninImg(activityId int) (imgUrl string, err error) {
 	if activityInfo == nil {
 		return
 	}
-	if activityInfo.ActivityTypeId != 5 && activityInfo.ActivityTypeId != 6 {
+	if activityInfo.ActivityTypeId != 5 && activityInfo.ActivityTypeId != 6 && activityInfo.ActivityTypeId != 8 {
 		return
 	}
 	itemToken, err := models.GetWxToken(utils.WxCygxAppId, utils.WxCygxAppSecret)

+ 13 - 0
services/cygx/activity_power_check.go

@@ -236,6 +236,19 @@ func GetActivityDetailUserPower(user *models.WxUser, adminInfo *system.Admin, ac
 		return
 	}
 
+	//如果是易董的活动,主、副权限有一个满足即可
+	if activityInfo.YidongActivityId != "" {
+		if strings.Contains(permissionStr, activityInfo.ChartPermissionName) || strings.Contains(permissionStr, activityInfo.ChartPermissionNameDeputy) {
+			havePower = true
+			return
+		}
+	}
+
+	//如果权限不包含那么直接返回
+	if !strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
+		return
+	}
+
 	//处理决策人可见权限
 	if user.IsMaker == 0 && activityInfo.IsMakerShow == 1 {
 		havePower = false

+ 1 - 1
services/cygx/activity_signup.go

@@ -303,7 +303,7 @@ func MakeActivitySigninImg12(activityId int) (err error) {
 // 校验报名截止时间
 func CheckSiginupDeadline(activityInfo *cygx.ActivityDetail) (checkTime bool, popupMsg string) {
 	checkTime = true
-	if activityInfo.SiginupDeadline != utils.EmptyDateTimeStr {
+	if activityInfo.SiginupDeadline != utils.EmptyDateTimeStr && activityInfo.SiginupDeadline != "" {
 		timeResp := utils.StrTimeToTime(activityInfo.SiginupDeadline)
 		if timeResp.Before(time.Now()) {
 			checkTime = false

+ 367 - 61
services/cygx/activity_special.go

@@ -223,48 +223,55 @@ func GetSpecialSurplusByCompany(companyId int) (specialSurplus string, err error
 	if companyDetail.Status == "永续" {
 		specialSurplus = "不限次数"
 	}
+	// 获取继承点数
+	inheritList, e := cygx.GetCygxActivitySpecialInheritPointsByCompanyId(companyId)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxActivitySpecialInheritPointsByCompanyId, Err: " + e.Error())
+	}
+	//chartMap := map[int]string{utils.YI_YAO_ID:utils.YI_YAO_NAME, utils.XIAO_FEI_ID:utils.XIAO_FEI_NAME, utils.KE_JI_ID:utils.KE_JI_NAME, utils.ZHI_ZAO_ID:utils.ZHI_ZAO_NAME}
+	//chartNumMap := map[int]int{utils.YI_YAO_ID:0, utils.XIAO_FEI_ID:0, utils.KE_JI_ID:0, utils.ZHI_ZAO_ID:0}
+	chartNameMap := map[string]int{utils.YI_YAO_NAME: 0, utils.XIAO_FEI_NAME: 0, utils.KE_JI_NAME: 0, utils.ZHI_ZAO_NAME: 0}
+	var condition string
+	var pars []interface{}
+
+	condition += ` AND company_id = ? `
+	pars = append(pars, companyId)
+
+	//查询当年的数据
+	//condition += ` AND b.create_time >= ?  `
+	//pars = append(pars, time.Now().Format(utils.FormatYearDate)+"-01-01")
+	listTripBill, e := cygx.GetCygxActivitySpecialTripBillList(condition, pars)
+	if e != nil {
+		err = errors.New("GetActivitySpecialTripCountByActivitySpecial, Err: " + e.Error())
+		return
+	}
 
 	if companyDetail.Status == "正式" {
-		userType, packageType, _, _, _ := GetUserType(companyId)
-		var airborneTota int
+		userType, _, _, _, _ := GetUserType(companyId)
 		if userType == 2 {
-			var condition string
-			var pars []interface{}
-
-			condition += ` AND company_id = ? `
-			pars = append(pars, companyId)
-
-			//到会空降的也加入流水记录表,这里不在做单独计算 2023-07-10
-			//airborneTota, e = cygx.GetActivitySpecialTripAirborneCountByActivitySpecial(condition, pars)
-			//if e != nil {
-			//	err = errors.New("GetActivitySpecialTripAirborneCountByActivitySpecial, Err: " + e.Error())
-			//	return
-			//}
-			//condition += ` AND is_valid = 1 `
-			//查询当年的数据
-			condition += ` AND create_time >= ?  `
-			pars = append(pars, time.Now().Format(utils.FormatYearDate)+"-01-01")
-			listTripBill, e := cygx.GetCygxActivitySpecialTripBill(condition, pars)
-			if e != nil {
-				err = errors.New("GetActivitySpecialTripCountByActivitySpecial, Err: " + e.Error())
-				return
-			}
-			var TripBillNum int
+			var tripBillNum int
 			for _, v := range listTripBill {
-				TripBillNum += v.BillDetailed
+				//if v.ActivityId == 0 {
+				//	continue
+				//}
+				tripBillNum += v.BillDetailed
 			}
-			// CRM13.2 70w客户有16次专项调研, 45w有10次
-			packageTypeMap := map[int]int{1: 16, 2: 10}
-			totalTrip := packageTypeMap[packageType]
 
-			tripRemaining := totalTrip - airborneTota + TripBillNum
+			if len(inheritList) > 0 {
+				for _, v := range inheritList {
+					if v.ChartPermissionId == 0 {
+						tripBillNum += v.Points
+					}
+				}
+			}
+			tripRemaining := tripBillNum
 			if tripRemaining < 0 {
 				tripRemaining = 0
 			}
+
 			specialSurplus = strconv.Itoa(tripRemaining) + "次"
-			//tripRemaining = 12 - tripTota
 		} else {
-			list, e := company.GetCompanyReportPermissionUpgrade(companyId, 2)
+			list, e := company.GetCompanyReportPermissionByCompanyIdAndProductId(companyId, 2)
 			if e != nil && e.Error() != utils.ErrNoRow() {
 				err = errors.New("GetCompanyReportPermissionUpgrade, Err: " + e.Error())
 			}
@@ -273,51 +280,57 @@ func GetSpecialSurplusByCompany(companyId int) (specialSurplus string, err error
 			}
 			var chartPermissionIdSlice []string
 			mapChartName := make(map[string]int)
+			mapUpgradeId := make(map[int]int)
 			mapPermissionNameTrip := make(map[string]int)
+			mapInheritChartName := make(map[string]int)
 			//mapPermissionName := make(map[int]string)
 			for _, v := range list {
 				chartPermissionIdSlice = append(chartPermissionIdSlice, strconv.Itoa(v.ChartPermissionId))
-
+				//是升级套餐才有点数
+				if v.IsUpgrade == 1 {
+					mapUpgradeId[v.ChartPermissionId] = 1
+				}
 			}
-			chartList, e := models.GetChartPermissionByIds(chartPermissionIdSlice)
-			if e != nil {
-				err = errors.New("获取品种信息失败, Err:" + e.Error())
-				return
+			chartList := make([]*models.ChartPermission, 0)
+			if len(chartPermissionIdSlice) > 0 {
+				chartList, e = models.GetChartPermissionByIds(chartPermissionIdSlice)
+				if e != nil {
+					err = errors.New("获取品种信息失败, Err:" + e.Error())
+					return
+				}
 			}
+
 			if len(chartList) == 0 {
 				return
 			}
-			//到会空降的也加入流水记录表,这里不在做单独计算 2023-07-10
-			//airborneList, e := cygx.GetCygxActivitySpecialTripAirborneListByComapnyId(companyId)
-			//if e != nil {
-			//	err = errors.New("获取品种信息失败, Err:" + e.Error())
-			//	return
-			//}
-			//for _, v := range airborneList {
-			//	mapPermissionNameTrip[v.ChartPermissionName] += 1
-			//}
-
-			var condition string
-			var pars []interface{}
-
-			condition += ` AND company_id = ? `
-			pars = append(pars, companyId)
-
-			//查询当年的数据
-			condition += ` AND b.create_time >= ?  `
-			pars = append(pars, time.Now().Format(utils.FormatYearDate)+"-01-01")
-			listTripBill, e := cygx.GetCygxActivitySpecialTripBillList(condition, pars)
-			if e != nil {
-				err = errors.New("GetActivitySpecialTripCountByActivitySpecial, Err: " + e.Error())
-				return
-			}
+
 			//var TripBillNum int
 			for _, v := range listTripBill {
+				if v.ActivityId == 0 {
+					continue
+				}
 				mapPermissionNameTrip[v.ChartPermissionName] += v.BillDetailed
 			}
 			for _, v := range chartList {
-				mapChartName[v.PermissionName] = 5 + mapPermissionNameTrip[v.ChartPermissionName]
+				//如果是升级则加点
+				if _, ok := mapUpgradeId[v.ChartPermissionId]; ok {
+					mapChartName[v.PermissionName] = 5 + mapPermissionNameTrip[v.ChartPermissionName]
+				} else {
+					mapChartName[v.PermissionName] = mapPermissionNameTrip[v.ChartPermissionName]
+				}
+			}
+			// 通过继承获得的加点
+			for _, v := range inheritList {
+				mapInheritChartName[v.ChartPermissionName] = v.Points
+			}
+			for k, _ := range chartNameMap {
+				if _, ok := mapChartName[k]; ok {
+					if inherit, ok2 := mapInheritChartName[k]; ok2 {
+						mapChartName[k] += inherit
+					}
+				}
 			}
+
 			for k, v := range mapChartName {
 				if v > 0 {
 					specialSurplus += k + strconv.Itoa(v) + "次+"
@@ -391,3 +404,296 @@ func CheckActivitySpecialUpdatePower(adminId int, activityInfo *cygx.ActivitySpe
 	havePower = true
 	return
 }
+
+// GetChartPermissionSpecialSurplusByCompany 获取公司专项调研次数-分品种
+func GetChartPermissionSpecialSurplusByCompany(companyId int) (userType int, tripRemaining int, mapChartName map[string]int, err error) {
+	companyDetail, e := cygx.GetCompanyDetailByIdGroup(companyId)
+	if e != nil {
+		err = errors.New("GetCompanyDetailByIdGroup, Err: " + e.Error())
+	}
+	if companyDetail == nil {
+		return
+	}
+	if companyDetail.Status != "永续" && companyDetail.Status != "正式" {
+		return
+	}
+	var specialSurplus string
+	if companyDetail.Status == "永续" {
+		specialSurplus = "不限次数"
+	}
+	//chartMap := map[int]string{utils.YI_YAO_ID:utils.YI_YAO_NAME, utils.XIAO_FEI_ID:utils.XIAO_FEI_NAME, utils.KE_JI_ID:utils.KE_JI_NAME, utils.ZHI_ZAO_ID:utils.ZHI_ZAO_NAME}
+	//chartNumMap := map[int]int{utils.YI_YAO_ID:0, utils.XIAO_FEI_ID:0, utils.KE_JI_ID:0, utils.ZHI_ZAO_ID:0}
+	chartNameMap := map[string]int{utils.YI_YAO_NAME: 0, utils.XIAO_FEI_NAME: 0, utils.KE_JI_NAME: 0, utils.ZHI_ZAO_NAME: 0}
+	if companyDetail.Status == "正式" {
+		//var packageType int
+		userType, _, _, _, _ = GetUserType(companyId)
+		var condition string
+		var pars []interface{}
+
+		condition += ` AND company_id = ? `
+		pars = append(pars, companyId)
+
+		//查询当年的数据
+		//condition += ` AND b.create_time >= ?  `
+		//pars = append(pars, time.Now().Format(utils.FormatYearDate)+"-01-01")
+		listTripBill, e := cygx.GetCygxActivitySpecialTripBillList(condition, pars)
+		if e != nil {
+			err = errors.New("GetActivitySpecialTripCountByActivitySpecial, Err: " + e.Error())
+			return
+		}
+		// 获取继承点数
+		inheritList, e := cygx.GetCygxActivitySpecialInheritPointsByCompanyId(companyId)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("GetCygxActivitySpecialInheritPointsByCompanyId, Err: " + e.Error())
+		}
+		if userType == 2 {
+
+			var tripBillNum int
+			for _, v := range listTripBill {
+				//if v.ActivityId == 0 {
+				//	continue
+				//}
+				tripBillNum += v.BillDetailed
+			}
+			if len(inheritList) > 0 {
+				for _, v := range inheritList {
+					if v.ChartPermissionId == 0 {
+						tripBillNum += v.Points
+					}
+				}
+			}
+
+			tripRemaining = tripBillNum
+			if tripRemaining < 0 {
+				tripRemaining = 0
+			}
+
+		} else {
+			list, e := company.GetCompanyReportPermissionByCompanyIdAndProductId(companyId, 2)
+			if e != nil && e.Error() != utils.ErrNoRow() {
+				err = errors.New("GetCompanyReportPermissionUpgrade, Err: " + e.Error())
+			}
+			if len(list) == 0 {
+				return
+			}
+			var chartPermissionIdSlice []string
+			mapChartName = make(map[string]int)
+			mapUpgradeId := make(map[int]int)
+			mapPermissionNameTrip := make(map[string]int)
+			mapInheritChartName := make(map[string]int)
+			//mapPermissionName := make(map[int]string)
+			for _, v := range list {
+				chartPermissionIdSlice = append(chartPermissionIdSlice, strconv.Itoa(v.ChartPermissionId))
+				//是升级套餐才有点数
+				if v.IsUpgrade == 1 {
+					mapUpgradeId[v.ChartPermissionId] = 1
+				}
+			}
+			chartList := make([]*models.ChartPermission, 0)
+			if len(chartPermissionIdSlice) > 0 {
+				chartList, e = models.GetChartPermissionByIds(chartPermissionIdSlice)
+				if e != nil {
+					err = errors.New("获取品种信息失败, Err:" + e.Error())
+					return
+				}
+			}
+
+			if len(chartList) == 0 {
+				return
+			}
+
+			for _, v := range listTripBill {
+				if v.ActivityId == 0 {
+					continue
+				}
+				mapPermissionNameTrip[v.ChartPermissionName] += v.BillDetailed
+			}
+			for _, v := range chartList {
+				//如果是升级则加点
+				if _, ok := mapUpgradeId[v.ChartPermissionId]; ok {
+					mapChartName[v.PermissionName] = 5 + mapPermissionNameTrip[v.ChartPermissionName]
+				} else {
+					mapChartName[v.PermissionName] = mapPermissionNameTrip[v.ChartPermissionName]
+				}
+			}
+			// 通过继承获得的加点
+			for _, v := range inheritList {
+				mapInheritChartName[v.ChartPermissionName] = v.Points
+			}
+			for k, _ := range chartNameMap {
+				if _, ok := mapChartName[k]; ok {
+					if inherit, ok2 := mapInheritChartName[k]; ok2 {
+						mapChartName[k] += inherit
+					}
+				}
+			}
+
+			for k, v := range mapChartName {
+				if v > 0 {
+					specialSurplus += k + strconv.Itoa(v) + "次+"
+				}
+			}
+			specialSurplus = strings.TrimRight(specialSurplus, "+")
+		}
+	}
+	return
+}
+
+// 审批通过的时候专项调研次数更新
+func ActivitySpecialCompanyApproval(companyId int, companyName string) (err error) {
+	userType, packageType, _, _, _ := GetUserType(companyId)
+	// 获取继承点数
+	inheritList, e := cygx.GetCygxActivitySpecialInheritPointsByCompanyId(companyId)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxActivitySpecialInheritPointsByCompanyId, Err: " + e.Error())
+	}
+	chartNameMap := map[string]int{utils.YI_YAO_NAME: 0, utils.XIAO_FEI_NAME: 0, utils.KE_JI_NAME: 0, utils.ZHI_ZAO_NAME: 0}
+
+	itemBill := new(cygx.CygxActivitySpecialTripBill)
+	itemBill.CreateTime = time.Now()
+	itemBill.CompanyId = companyId
+	itemBill.CompanyName = companyName
+	itemBill.Source = 2
+	itemBill.DoType = 2
+	itemBill.Way = 3
+	if userType == 2{
+		packageTypeMap := map[int]int{1: 16, 2: 10}
+		totalTrip := packageTypeMap[packageType]
+		if len(inheritList) > 0 {
+			for _, v := range inheritList {
+				if v.ChartPermissionId == 0 {
+					itemBill.BillDetailed = totalTrip + v.Points
+				} else {
+					itemBill.BillDetailed = totalTrip
+				}
+			}
+		} else {
+			itemBill.BillDetailed = totalTrip
+		}
+
+		itemBill.Total = strconv.Itoa(itemBill.BillDetailed) + "次"
+		if totalTrip == 10 {
+			itemBill.Content = "45w大套餐转正"
+		} else {
+			itemBill.Content = "70w大套餐转正"
+		}
+	} else {
+		list, e := company.GetCompanyReportPermissionByCompanyIdAndProductId(companyId, 2)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("GetCompanyReportPermissionUpgrade, Err: " + e.Error())
+		}
+		if len(list) == 0 {
+			return
+		}
+		var chartPermissionIdSlice []string
+		mapChartName := make(map[string]int)
+		mapUpgradeId := make(map[int]int)
+		mapInheritChartName := make(map[string]int)
+		mapPermissionNameTrip := make(map[string]int)
+		//mapPermissionName := make(map[int]string)
+		for _, v := range list {
+			chartPermissionIdSlice = append(chartPermissionIdSlice, strconv.Itoa(v.ChartPermissionId))
+			//是升级套餐才有点数
+			if v.IsUpgrade == 1 {
+				mapUpgradeId[v.ChartPermissionId] = 1
+			}
+		}
+		chartList := make([]*models.ChartPermission, 0)
+		if len(chartPermissionIdSlice) > 0 {
+			chartList, e = models.GetChartPermissionByIds(chartPermissionIdSlice)
+			if e != nil {
+				err = errors.New("获取品种信息失败, Err:" + e.Error())
+				return
+			}
+		}
+		if len(chartList) == 0 {
+			return
+		}
+		for _, v := range chartList {
+			//如果是升级则加点
+			if _, ok := mapUpgradeId[v.ChartPermissionId]; ok {
+				mapChartName[v.PermissionName] = 5 + mapPermissionNameTrip[v.ChartPermissionName]
+			} else {
+				mapChartName[v.PermissionName] = mapPermissionNameTrip[v.ChartPermissionName]
+			}
+		}
+		// 通过继承获得的加点
+		for _, v := range inheritList {
+			mapInheritChartName[v.ChartPermissionName] = v.Points
+		}
+		for k, _ := range chartNameMap {
+			if _, ok := mapChartName[k]; ok {
+				if inherit, ok2 := mapInheritChartName[k]; ok2 {
+					mapChartName[k] += inherit
+				}
+			}
+		}
+		for k, v := range mapChartName {
+			if v > 0 {
+				itemBill.BillDetailed += v
+				itemBill.Total += k + strconv.Itoa(v) + "次+"
+			}
+		}
+		itemBill.Content = "行业升级套餐转正"
+		itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+	}
+	err = cygx.AddCygxActivitySpecialTripBill(itemBill)
+	if err != nil {
+		return
+	}
+	return
+}
+
+// 取消专项调研返点
+func ActivitySpecialPublishAndCancel(activityInfo *cygx.ActivitySpecialDetail) (err error) {
+	//userType, tripRemaining, mapChartName, err := GetChartPermissionSpecialSurplusByCompany(companyId)
+	//if err != nil {
+	//	br.Msg = "获取专项调研剩余次数失败"
+	//	br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+	//	return
+	//}
+	//itemBill := new(cygx.CygxActivitySpecialTripBill)
+	//itemBill.CreateTime = time.Now()
+	//itemBill.ActivityId = activityInfo.ActivityId
+	//itemBill.Content = activityInfo.ResearchTheme + "--活动取消"
+	//itemBill.Source = 2
+	//itemBill.DoType = 2
+	//itemBill.Way = 4
+	//itemBill.BillDetailed = 1
+	//err = cygx.AddCygxActivitySpecialTripBill(itemBill)
+	//if err != nil {
+	//	return
+	//}
+	return
+}
+
+// GetSpecialSurplusByCompanyNew 获取公司专项调研剩余次数-用流水表数据不计算了,计算都丢在流水里
+func GetSpecialSurplusByCompanyNew(companyId int) (specialSurplus string, err error) {
+	companyDetail, e := cygx.GetCompanyDetailByIdGroup(companyId)
+	if e != nil {
+		err = errors.New("GetCompanyDetailByIdGroup, Err: " + e.Error())
+	}
+	if companyDetail == nil {
+		return
+	}
+	if companyDetail.Status != "永续" && companyDetail.Status != "正式" {
+		return
+	}
+	if companyDetail.Status == "永续" {
+		specialSurplus = "不限次数"
+	}
+	//chartMap := map[int]string{utils.YI_YAO_ID:utils.YI_YAO_NAME, utils.XIAO_FEI_ID:utils.XIAO_FEI_NAME, utils.KE_JI_ID:utils.KE_JI_NAME, utils.ZHI_ZAO_ID:utils.ZHI_ZAO_NAME}
+	//chartNumMap := map[int]int{utils.YI_YAO_ID:0, utils.XIAO_FEI_ID:0, utils.KE_JI_ID:0, utils.ZHI_ZAO_ID:0}
+	if companyDetail.Status == "正式" {
+		billItem,e := cygx.GetCygxActivitySpecialTripBillByCompanyId(companyId)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = e
+			return
+		}
+		if billItem != nil {
+			specialSurplus = billItem.Total
+		}
+		return
+	}
+	return
+}

+ 12 - 4
services/cygx/yidong.go

@@ -670,7 +670,7 @@ func YiDongUpdateActivityStatus(activityId int) {
 	defer func() {
 		if err != nil {
 			fmt.Println(err)
-			go alarm_msg.SendAlarmMsg("发布路演到活动广场(新);err:"+err.Error(), 3)
+			go alarm_msg.SendAlarmMsg(" 删除路演活动(新);err:"+err.Error(), 3)
 		}
 	}()
 	activityInfo, err := cygx.GetAddActivityInfoById(activityId)
@@ -685,14 +685,22 @@ func YiDongUpdateActivityStatus(activityId int) {
 	if activityInfo.ActivityTypeId == 7 {
 		activityInfo.PublishStatus = 0
 	}
+	//如果关联的易董活动ID为空,那么不做处理
+	if activityInfo.YidongActivityIdByCygx == "" {
+		return
+	}
+	//如果状态是已发布,而且是易董办会那么就不做处理
+	if activityInfo.IsYidongConduct == 1 && activityInfo.PublishStatus == 1 {
+		return
+	}
 	token, _ := GetYidongToken()
 	if token == "" {
 		return
 	}
 	url := utils.YiDongZhengTongYunUrl + "interact/activityThirdApi/updateActivityStatus" + "?access_token=" + token
-	if activityInfo.IsYidongConduct == 0 || activityInfo.YidongActivityIdByCygx == "" {
-		return
-	}
+	//if activityInfo.IsYidongConduct == 0 || activityInfo.YidongActivityIdByCygx == "" {
+	//	return
+	//}
 	params := YiDongUpdateActivityPublishResp{
 		Id: activityInfo.YidongActivityIdByCygx,
 	}

+ 33 - 0
services/data/help_doc_classify.go

@@ -0,0 +1,33 @@
+package data
+
+import "hongze/hz_crm_api/models/help_doc"
+
+func helpDocClassifyHaveChild(allNode []*help_doc.HelpDocClassifyItems, node *help_doc.HelpDocClassifyItems) (childs []*help_doc.HelpDocClassifyItems, yes bool) {
+	for _, v := range allNode {
+		if v.ParentId == node.ClassifyId {
+			childs = append(childs, v)
+		}
+	}
+	if len(childs) > 0 {
+		yes = true
+	}
+	return
+}
+
+func HelpDocClassifyItemsMakeTree(allNode []*help_doc.HelpDocClassifyItems, node *help_doc.HelpDocClassifyItems) {
+	childs, _ := helpDocClassifyHaveChild(allNode, node) //判断节点是否有子节点并返回
+	if len(childs) > 0 {
+		node.Children = append(node.Children, childs[0:]...) //添加子节点
+		for _, v := range childs {                           //查询子节点的子节点,并添加到子节点
+			_, has := helpDocClassifyHaveChild(allNode, v)
+			if has {
+				HelpDocClassifyItemsMakeTree(allNode, v) //递归添加节点
+			} else {
+				v.Children = nil
+			}
+		}
+	} else {
+		node.Children = nil
+	}
+}
+

+ 10 - 0
services/elastic/es_comprehensive.go

@@ -12,6 +12,7 @@ import (
 	"html"
 	"strconv"
 	"strings"
+	"time"
 )
 
 type ElasticComprehensiveDetail struct {
@@ -138,6 +139,7 @@ func EsDeleteComprehensiveData(item *ElasticComprehensiveDetail) (err error) {
 
 // ES添加文章:报告、纪要
 func AddComprehensiveArticle(sourceId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {
@@ -176,6 +178,7 @@ func AddComprehensiveArticle(sourceId int) {
 
 // Es添加活动
 func AddComprehensiveActivity(sourceId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {
@@ -229,6 +232,7 @@ func AddComprehensiveActivity(sourceId int) {
 
 // Es添加专项调研活动
 func AddComprehensiveActivitySpecial(sourceId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {
@@ -286,6 +290,7 @@ func AddComprehensiveActivitySpecial(sourceId int) {
 
 // Es添加活动视频
 func AddComprehensiveActivityVideo(activityId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {
@@ -344,6 +349,7 @@ func AddComprehensiveActivityVideo(activityId int) {
 
 // Es添加活动音频
 func AddComprehensiveActivityVoice(activityId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {
@@ -403,6 +409,7 @@ func AddComprehensiveActivityVoice(activityId int) {
 
 // Es添加微路演
 func AddComprehensiveRoadshow(sourceId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {
@@ -432,6 +439,7 @@ func AddComprehensiveRoadshow(sourceId int) {
 
 // Es添加晨会精华
 func AddComprehensiveMeetingreviewchapt(sourceId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {
@@ -463,6 +471,7 @@ func AddComprehensiveMeetingreviewchapt(sourceId int) {
 
 // Es删除晨会精华
 func DeleteComprehensiveMeetingreviewchapt(sourceId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {
@@ -479,6 +488,7 @@ func DeleteComprehensiveMeetingreviewchapt(sourceId int) {
 
 // 添加产业资源包
 func AddComprehensiveIndustrialSource(sourceType string, articleId int) {
+	time.Sleep(3 * time.Second) // 延迟三秒处理
 	var err error
 	defer func() {
 		if err != nil {

+ 15 - 0
services/eta_business/eta_business_menu.go

@@ -0,0 +1,15 @@
+package eta_business
+
+import "hongze/hz_crm_api/models/eta_business"
+
+// GetMenuTreeRecursive 递归菜单树
+func GetMenuTreeRecursive(list []*eta_business.EtaBusinessMenuItem, parentId int) []*eta_business.EtaBusinessMenuItem {
+	res := make([]*eta_business.EtaBusinessMenuItem, 0)
+	for _, v := range list {
+		if v.ParentId == parentId {
+			v.Children = GetMenuTreeRecursive(list, v.MenuId)
+			res = append(res, v)
+		}
+	}
+	return res
+}

+ 22 - 0
services/task.go

@@ -2,6 +2,8 @@ package services
 
 import (
 	"fmt"
+	"hongze/hz_crm_api/models/eta_business"
+	"hongze/hz_crm_api/utils"
 )
 
 func Task() {
@@ -11,5 +13,25 @@ func Task() {
 
 	go AutoInsertAdminOperateRecordToDB()
 
+	//go FixEtaBusinessCodeEncrypt()
+
 	fmt.Println("task end")
 }
+
+// FixEtaBusinessCodeEncrypt 修复商家编码
+func FixEtaBusinessCodeEncrypt() {
+	ob := new(eta_business.EtaBusiness)
+	list, e := ob.GetItemsByCondition("", make([]interface{}, 0), []string{}, "")
+	if e != nil {
+		fmt.Println(e.Error())
+		return
+	}
+
+	for _, v := range list {
+		v.CodeEncrypt = utils.MD5(fmt.Sprintf("%s%s", v.BusinessCode, utils.BusinessCodeSalt))
+		if e = v.Update([]string{"CodeEncrypt"}); e != nil {
+			fmt.Println(e.Error())
+			return
+		}
+	}
+}

+ 12 - 0
utils/common.go

@@ -2087,3 +2087,15 @@ func FormatTableDataShowValue(x float64) (res string) {
 	}
 	return
 }
+
+// 校验字符是否包含字母
+func CheckStrHaveLetter(checkString string) (checked bool) {
+	allLetterDigit := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
+	for _, v := range allLetterDigit {
+		if strings.Contains(checkString, v) {
+			checked = true
+			return true
+		}
+	}
+	return
+}

+ 2 - 0
utils/config.go

@@ -18,6 +18,7 @@ var (
 	MYSQL_URL_COMEIN_DATA  string // 路演记录数据库
 	MYSQL_URL_WEEKLY_TRIAL string // ETA试用
 	MYSQL_URL_FMS          string // 财务系统
+	MYSQL_URL_CYGX         string // 查研观向
 
 	REDIS_CACHE string       //缓存地址
 	Rc          *cache.Cache //redis缓存
@@ -194,6 +195,7 @@ func init() {
 	MYSQL_URL_COMEIN_DATA = config["mysql_url_comein_data"]
 	MYSQL_URL_WEEKLY_TRIAL = config["mysql_url_weekly_trial"]
 	MYSQL_URL_FMS = config["mysql_url_fms"]
+	MYSQL_URL_CYGX = config["mysql_url_cygx"]
 
 	REDIS_CACHE = config["beego_cache"]
 	if len(REDIS_CACHE) <= 0 {

+ 7 - 0
utils/constants.go

@@ -508,3 +508,10 @@ const (
 	SOURCE_CRM_FLAG = 1
 	SOURCE_ETA_FLAG = 2
 )
+
+// BusinessCodeSalt 商家编码盐值
+const BusinessCodeSalt = "dr7WY0OZgGR7upw1"
+
+const (
+	ApproveUserId = 2 //施琪-出差审批人
+)