|
@@ -122,6 +122,7 @@ func (this *ReportController) TradeList() {
|
|
|
// @Param OrderColumn query int true "排序字段 ,NewTime 最近更新 ,Recommend弘则推荐"
|
|
|
// @Param DeepCover query int false "深度覆盖:0-否;1-是"
|
|
|
// @Param RecommendFocus query int false "推荐关注:0-否;1-是"
|
|
|
+// @Param IsOpen query int true "是否展开:0-否;1-是,默认0"
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Success 200 {object} models.IndustrialManagementList
|
|
@@ -151,6 +152,7 @@ func (this *ReportController) IndustryList() {
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
deepCover, _ := this.GetInt("DeepCover")
|
|
|
recommendFocus, _ := this.GetInt("RecommendFocus")
|
|
|
+ isOpen, _ := this.GetInt("IsOpen")
|
|
|
var orderSrt string
|
|
|
var condition string
|
|
|
var startSize int
|
|
@@ -208,6 +210,28 @@ func (this *ReportController) IndustryList() {
|
|
|
if recommendFocus == 1 {
|
|
|
condition += ` AND man.recommended_index >= 80`
|
|
|
}
|
|
|
+ var industrialFollow []string //重点关注ID
|
|
|
+ var industrialUninterested []string //重点关注ID
|
|
|
+ followTypeMap := services.GetCygxIndustryFllowListTypeMapByMobile(user.Mobile) // 关注的对应状态
|
|
|
+ for k, v := range followTypeMap {
|
|
|
+ if v == 1 {
|
|
|
+ industrialFollow = append(industrialFollow, strconv.Itoa(k))
|
|
|
+ }
|
|
|
+ if v == 3 {
|
|
|
+ industrialUninterested = append(industrialUninterested, strconv.Itoa(k))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果不感兴趣有值,而且展开按钮没有展开,就放出展开按钮
|
|
|
+ if len(industrialUninterested) > 0 && isOpen == 0 {
|
|
|
+ resp.IsShowOpen = true
|
|
|
+ }
|
|
|
+ industrialUninterested = append(industrialUninterested, "0")
|
|
|
+ //是否展开,展开部分仅展示,不感兴趣的
|
|
|
+ if isOpen == 0 {
|
|
|
+ condition += ` AND man.industrial_management_id NOT IN (` + strings.Join(industrialUninterested, ",") + `) `
|
|
|
+ } else {
|
|
|
+ condition += ` AND man.industrial_management_id IN (` + strings.Join(industrialUninterested, ",") + `) `
|
|
|
+ }
|
|
|
|
|
|
// 列表总数据量
|
|
|
var list []*models.IndustrialManagement
|
|
@@ -869,6 +893,7 @@ func (this *ReportController) Fllow() {
|
|
|
return
|
|
|
}
|
|
|
industrialManagementId := req.IndustrialManagementId
|
|
|
+ followType := req.FollowType
|
|
|
var condition string
|
|
|
countIndustrial, err := models.GetIndustrialManagementCount(industrialManagementId)
|
|
|
if err != nil {
|
|
@@ -894,6 +919,7 @@ func (this *ReportController) Fllow() {
|
|
|
}
|
|
|
item := new(models.CygxIndustryFllow)
|
|
|
item.IndustrialManagementId = industrialManagementId
|
|
|
+ item.FollowType = followType
|
|
|
item.UserId = uid
|
|
|
item.Email = user.Email
|
|
|
item.Mobile = user.Mobile
|
|
@@ -901,28 +927,21 @@ func (this *ReportController) Fllow() {
|
|
|
item.Source = utils.REGISTER_PLATFORM
|
|
|
item.CompanyId = user.CompanyId
|
|
|
item.CompanyName = user.CompanyName
|
|
|
- if count == 0 {
|
|
|
- item.Type = 1
|
|
|
- item.CreateTime = time.Now()
|
|
|
- item.ModifyTime = time.Now()
|
|
|
- _, err = models.AddCygxIndustryFllow(item)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- resp.Status = 1
|
|
|
- } else {
|
|
|
- item.Type = 2
|
|
|
- err = models.RemoveCygxIndustryFllow(uid, industrialManagementId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "操作失败"
|
|
|
- br.ErrMsg = "取消关注失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+ //if count == 0 {
|
|
|
+ item.Type = 1
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ _, err = models.AddCygxIndustryFllow(item)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
}
|
|
|
+ resp.Status = followType
|
|
|
+ br.Msg = "操作成功"
|
|
|
|
|
|
- go services.IndustryFllowWithTrack(industrialManagementId, count, uid) //处理是否关注全部赛道字段
|
|
|
+ //go services.IndustryFllowWithTrack(industrialManagementId, count, uid) //处理是否关注全部赛道字段
|
|
|
go services.IndustryFllowUserLabelLogAdd(industrialManagementId, count, uid) //处理用户标签
|
|
|
go services.AddCygxIndustryFllowLog(item) //添加操作日志记录
|
|
|
br.Msg = "操作成功"
|
|
@@ -4103,3 +4122,484 @@ func (this *ReportController) ZhouqiTacticsList() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 获取用户的选择详情
|
|
|
+// @Description 获取用户的选择详情接口
|
|
|
+// @Success 200 {object} models.CygxXzsChooseSendResp
|
|
|
+// @router /choose/detail [get]
|
|
|
+func (this *ReportController) ChooseDetail() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.CygxXzsChooseSendResp)
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ mobile := user.Mobile
|
|
|
+ if mobile == "" {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ }
|
|
|
+ permissionId, err := models.GetCompanyPermissionId(user.CompanyId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "GetCompanyPermissionId,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if permissionId == "" {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ }
|
|
|
+ //mapIndustrial := make(map[int][]*models.IndustrialManagementRep)
|
|
|
+ mapIndustrialFollow := make(map[int][]*models.IndustrialManagementRep) // 重点关注的行业下的数组结构
|
|
|
+ mapIndustrialPush := make(map[int][]*models.IndustrialManagementRep) // 接受推送的行业下的数组结构
|
|
|
+ mapIndustrialUninterested := make(map[int][]*models.IndustrialManagementRep) // 不感兴趣的行业下的数组结构
|
|
|
+ //mapFllow := make(map[int]int)
|
|
|
+ checkListFollow := make(map[int]int) // 重点关注的ID
|
|
|
+ checkListPush := make(map[int]int) // 接受推送的ID
|
|
|
+ checkListUninterested := make(map[int]int) // 不感兴趣的ID
|
|
|
+ mapCategory := make(map[int]int)
|
|
|
+ //ampCheckList := make(map[int][]int, 0)
|
|
|
+ ampCheckListFollow := make(map[int][]int, 0) // 重点关注的ID
|
|
|
+ ampCheckListPush := make(map[int][]int, 0) // 接受推送的ID
|
|
|
+ ampCheckListUninterested := make(map[int][]int, 0) // 不感兴趣的ID
|
|
|
+ //permissionIdList := make([]string, 0)
|
|
|
+ fllowList, err := models.GetCygxIndustryFllowListByMobile(mobile)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range fllowList {
|
|
|
+ switch v.FollowType {
|
|
|
+ case 1:
|
|
|
+ checkListFollow[v.IndustrialManagementId] = v.IndustrialManagementId
|
|
|
+ case 0:
|
|
|
+ checkListPush[v.IndustrialManagementId] = v.IndustrialManagementId
|
|
|
+ case 3:
|
|
|
+ checkListUninterested[v.IndustrialManagementId] = v.IndustrialManagementId
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ industrialList, err := models.GetindustrialManagement()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取产业信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range industrialList {
|
|
|
+ if v.ChartPermissionId == utils.ZHOU_QI_ID {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ v.IsFllow = true
|
|
|
+ if checkListFollow[v.IndustrialManagementId] > 0 {
|
|
|
+ //添加重点关注的行业赛道
|
|
|
+ ampCheckListFollow[v.ChartPermissionId] = append(ampCheckListFollow[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ mapIndustrialFollow[v.ChartPermissionId] = append(mapIndustrialFollow[v.ChartPermissionId], v)
|
|
|
+ } else if checkListUninterested[v.IndustrialManagementId] > 0 {
|
|
|
+ //添加不感兴趣的行业赛道
|
|
|
+ ampCheckListUninterested[v.ChartPermissionId] = append(ampCheckListUninterested[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ mapIndustrialUninterested[v.ChartPermissionId] = append(mapIndustrialUninterested[v.ChartPermissionId], v)
|
|
|
+ } else {
|
|
|
+ //添加接受推送的行业赛道
|
|
|
+ mapIndustrialPush[v.ChartPermissionId] = append(mapIndustrialPush[v.ChartPermissionId], v)
|
|
|
+ ampCheckListPush[v.ChartPermissionId] = append(ampCheckListPush[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ slicepermissionId := strings.Split(permissionId, ",")
|
|
|
+
|
|
|
+ permissionList, err := models.GetChartPermissionAllXzs(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取产业信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //策略固收的处理
|
|
|
+ categoryListFollow, err := models.GetCygxXzsChooseCategoryList(mobile)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ checkListCelueFollow := make(map[int]int) // 重点关注的ID
|
|
|
+ checkListCeluePush := make(map[int]int) // 接受推送的ID
|
|
|
+ checkListCelueUninterested := make(map[int]int) // 不感兴趣的ID
|
|
|
+ for _, v := range categoryListFollow {
|
|
|
+ //mapFllow[v.IndustrialManagementId] = v.IndustrialManagementId
|
|
|
+ switch v.FollowType {
|
|
|
+ case 1:
|
|
|
+ checkListCelueFollow[v.CategoryId] = v.CategoryId
|
|
|
+ case 0:
|
|
|
+ checkListCeluePush[v.CategoryId] = v.CategoryId
|
|
|
+ case 3:
|
|
|
+ checkListCelueUninterested[v.CategoryId] = v.CategoryId
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range categoryListFollow {
|
|
|
+ mapCategory[v.CategoryId] = v.CategoryId
|
|
|
+ }
|
|
|
+ celueList, err := models.GetReportMappingStrategyAllXzs()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取产业信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range celueList {
|
|
|
+ v.IsFllow = true
|
|
|
+ if checkListCelueFollow[v.IndustrialManagementId] > 0 {
|
|
|
+ //添加重点关注的行业赛道
|
|
|
+ ampCheckListFollow[v.ChartPermissionId] = append(ampCheckListFollow[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ mapIndustrialFollow[v.ChartPermissionId] = append(mapIndustrialFollow[v.ChartPermissionId], v)
|
|
|
+ } else if checkListCelueUninterested[v.IndustrialManagementId] > 0 {
|
|
|
+ //添加不感兴趣的行业赛道
|
|
|
+ ampCheckListUninterested[v.ChartPermissionId] = append(ampCheckListUninterested[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ mapIndustrialUninterested[v.ChartPermissionId] = append(mapIndustrialUninterested[v.ChartPermissionId], v)
|
|
|
+ } else {
|
|
|
+ //添加接受推送的行业赛道
|
|
|
+ mapIndustrialPush[v.ChartPermissionId] = append(mapIndustrialPush[v.ChartPermissionId], v)
|
|
|
+ ampCheckListPush[v.ChartPermissionId] = append(ampCheckListPush[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //策略、固收的处理 end
|
|
|
+
|
|
|
+ //周期的处理
|
|
|
+ zhouqiListFollow, err := models.GetCygxXzsChooseCategoryZhouqiList(mobile)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ checkListZhouqiFollow := make(map[int]int) // 重点关注的ID
|
|
|
+ checkListZhouqiPush := make(map[int]int) // 接受推送的ID
|
|
|
+ checkListZhouqiUninterested := make(map[int]int) // 不感兴趣的ID
|
|
|
+ for _, v := range zhouqiListFollow {
|
|
|
+ //mapFllow[v.IndustrialManagementId] = v.IndustrialManagementId
|
|
|
+ switch v.FollowType {
|
|
|
+ case 1:
|
|
|
+ checkListZhouqiFollow[v.CategoryId] = v.CategoryId
|
|
|
+ case 0:
|
|
|
+ checkListZhouqiPush[v.CategoryId] = v.CategoryId
|
|
|
+ case 3:
|
|
|
+ checkListZhouqiUninterested[v.CategoryId] = v.CategoryId
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ zhouqiList, err := models.GetCygxZhouqiArticleMapFirst()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取产业信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, vZhouqi := range zhouqiList {
|
|
|
+ v := new(models.IndustrialManagementRep)
|
|
|
+ v.IsFllow = true
|
|
|
+ v.IndustrialManagementId = vZhouqi.CategoryId
|
|
|
+ v.IndustryName = vZhouqi.MatchTypeName
|
|
|
+ v.ChartPermissionId = utils.ZHOU_QI_ID
|
|
|
+ if checkListZhouqiFollow[v.IndustrialManagementId] > 0 {
|
|
|
+ //添加重点关注的行业赛道
|
|
|
+ ampCheckListFollow[v.ChartPermissionId] = append(ampCheckListFollow[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ mapIndustrialFollow[v.ChartPermissionId] = append(mapIndustrialFollow[v.ChartPermissionId], v)
|
|
|
+ } else if checkListZhouqiUninterested[v.IndustrialManagementId] > 0 {
|
|
|
+ //添加不感兴趣的行业赛道
|
|
|
+ ampCheckListUninterested[v.ChartPermissionId] = append(ampCheckListUninterested[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ mapIndustrialUninterested[v.ChartPermissionId] = append(mapIndustrialUninterested[v.ChartPermissionId], v)
|
|
|
+ } else {
|
|
|
+ //添加接受推送的行业赛道
|
|
|
+ mapIndustrialPush[v.ChartPermissionId] = append(mapIndustrialPush[v.ChartPermissionId], v)
|
|
|
+ ampCheckListPush[v.ChartPermissionId] = append(ampCheckListPush[v.ChartPermissionId], v.IndustrialManagementId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //周期的处理end
|
|
|
+
|
|
|
+ for k, v := range permissionList {
|
|
|
+ if len(mapIndustrialFollow[v.ChartPermissionId]) == 0 {
|
|
|
+ permissionList[k].ListFollow = make([]*models.IndustrialManagementRep, 0)
|
|
|
+ } else {
|
|
|
+ permissionList[k].ListFollow = mapIndustrialFollow[v.ChartPermissionId]
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(mapIndustrialPush[v.ChartPermissionId]) == 0 {
|
|
|
+ permissionList[k].ListPush = make([]*models.IndustrialManagementRep, 0)
|
|
|
+ } else {
|
|
|
+ permissionList[k].ListPush = mapIndustrialPush[v.ChartPermissionId]
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(mapIndustrialUninterested[v.ChartPermissionId]) == 0 {
|
|
|
+ permissionList[k].ListUninterested = make([]*models.IndustrialManagementRep, 0)
|
|
|
+ } else {
|
|
|
+ permissionList[k].ListUninterested = mapIndustrialUninterested[v.ChartPermissionId]
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(ampCheckListFollow[v.ChartPermissionId]) == 0 {
|
|
|
+ permissionList[k].CheckListFollow = make([]int, 0)
|
|
|
+ } else {
|
|
|
+ permissionList[k].CheckListFollow = ampCheckListFollow[v.ChartPermissionId]
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(ampCheckListPush[v.ChartPermissionId]) == 0 {
|
|
|
+ permissionList[k].CheckListPush = make([]int, 0)
|
|
|
+ } else {
|
|
|
+ permissionList[k].CheckListPush = ampCheckListPush[v.ChartPermissionId]
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(ampCheckListUninterested[v.ChartPermissionId]) == 0 {
|
|
|
+ permissionList[k].CheckListUninterested = make([]int, 0)
|
|
|
+ } else {
|
|
|
+ permissionList[k].CheckListUninterested = ampCheckListUninterested[v.ChartPermissionId]
|
|
|
+ }
|
|
|
+
|
|
|
+ v.HasCheck = utils.InArrayByStr(slicepermissionId, strconv.Itoa(v.ChartPermissionId))
|
|
|
+ }
|
|
|
+ count, err := models.GetXzsChooseSendCountByMobile(mobile)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "GetXzsChooseSendCountByMobile,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if count == 0 {
|
|
|
+ resp.IsObjective = 1
|
|
|
+ resp.IsSubjective = 1
|
|
|
+ } else {
|
|
|
+ detail, err := models.GetCygxXzsChooseSendByMobile(mobile)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "GetCygxXzsChooseSendByMobile,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.IsObjective = detail.IsObjective
|
|
|
+ resp.IsSubjective = detail.IsSubjective
|
|
|
+ resp.IsRefuse = detail.IsRefuse
|
|
|
+ }
|
|
|
+
|
|
|
+ resp.IsPush = 1 - resp.IsRefuse
|
|
|
+ resp.List = permissionList
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 提交用户的选择关注的类型
|
|
|
+// @Description 提交用户的选择关注的类型接口
|
|
|
+// @Param request body models.SubmitChooseSendResp true "type json string"
|
|
|
+// @Success 200 {object} models.CygxXzsChooseSendResp
|
|
|
+// @router /choose/submit_follow_type [post]
|
|
|
+func (this *ReportController) ChooseSubmitFollowType() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if user.Mobile == "" {
|
|
|
+ br.Msg = "提交失败!"
|
|
|
+ br.ErrMsg = "提交失败,手机号不能为空"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var req models.SubmitChooseSendFollowTypeResp
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ listMap, err := models.GetCygxXzsChooseCategoryMapList()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败!"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapReport := make(map[int]int)
|
|
|
+ for _, v := range listMap {
|
|
|
+ mapReport[v.CategoryId] = v.Id
|
|
|
+ }
|
|
|
+
|
|
|
+ followType := req.FollowType
|
|
|
+ listReq := req.List
|
|
|
+
|
|
|
+ var itemsFllow []*models.CygxIndustryFllow
|
|
|
+ var itemsCategory []*models.CygxXzsChooseCategory
|
|
|
+ var itemsZhouqi []*models.CygxXzsChooseCategoryZhouqi
|
|
|
+
|
|
|
+ var zhouqiIds []int
|
|
|
+ var celueIds []int
|
|
|
+ var industryIds []int
|
|
|
+ for _, vChartPermissionn := range listReq {
|
|
|
+ if vChartPermissionn.ChartPermissionName == utils.CE_LUE_NAME || vChartPermissionn.ChartPermissionName == utils.GU_SHOU_NAME {
|
|
|
+ //策略与固收
|
|
|
+ for _, v := range vChartPermissionn.CheckList {
|
|
|
+ item := new(models.CygxXzsChooseCategory)
|
|
|
+ categoryId := v
|
|
|
+ item.CategoryId = v
|
|
|
+ item.IdCygx = mapReport[categoryId]
|
|
|
+ item.UserId = user.UserId
|
|
|
+ item.Mobile = user.Mobile
|
|
|
+ item.Email = user.Email
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
+ item.RealName = user.RealName
|
|
|
+ item.FollowType = followType
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ itemsCategory = append(itemsCategory, item)
|
|
|
+ celueIds = append(celueIds, v)
|
|
|
+ }
|
|
|
+ } else if vChartPermissionn.ChartPermissionName == utils.ZHOU_QI_NAME {
|
|
|
+ //周期
|
|
|
+ for _, v := range vChartPermissionn.CheckList {
|
|
|
+ item := new(models.CygxXzsChooseCategoryZhouqi)
|
|
|
+ item.CategoryId = v
|
|
|
+ item.UserId = user.UserId
|
|
|
+ item.Email = user.Email
|
|
|
+ item.Mobile = user.Mobile
|
|
|
+ item.RealName = user.RealName
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
+ item.FollowType = followType
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ itemsZhouqi = append(itemsZhouqi, item)
|
|
|
+ zhouqiIds = append(zhouqiIds, v)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //正常带有产业的行业
|
|
|
+ for _, v := range vChartPermissionn.CheckList {
|
|
|
+ item := new(models.CygxIndustryFllow)
|
|
|
+ item.IndustrialManagementId = v
|
|
|
+ item.UserId = user.UserId
|
|
|
+ item.Mobile = user.Mobile
|
|
|
+ item.Email = user.Email
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
+ item.RealName = user.RealName
|
|
|
+ item.Type = 1
|
|
|
+ item.FollowType = followType
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ item.Source = 2
|
|
|
+ itemsFllow = append(itemsFllow, item)
|
|
|
+ industryIds = append(industryIds, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ err = models.AddCygxXzsChooseSendFollow(user.Mobile, itemsFllow, itemsCategory, itemsZhouqi, industryIds, celueIds, zhouqiIds)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "保存失败!"
|
|
|
+ br.ErrMsg = "保存失败!,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "保存成功"
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 推送更新内容
|
|
|
+// @Description 推送更新内容接口
|
|
|
+// @Param request body models.SubmitChooseSendResp true "type json string"
|
|
|
+// @Success 200 {object} models.CygxXzsChooseSendResp
|
|
|
+// @router /choose/submit_push [post]
|
|
|
+func (this *ReportController) ChooseSubmitPush() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if user.Mobile == "" {
|
|
|
+ br.Msg = "提交失败!"
|
|
|
+ br.ErrMsg = "提交失败,手机号不能为空"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var req models.SubmitChooseSendResp
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ isPush := req.IsPush // 是否接受推送
|
|
|
+ isRefuse := req.IsRefuse
|
|
|
+ isSubjective := req.IsSubjective
|
|
|
+ isObjective := req.IsObjective
|
|
|
+
|
|
|
+ isRefuse = 1 - isPush // 是否拒绝推送,与是否接收推送进行取反(兼容老的数据库字段)
|
|
|
+ if isRefuse == 0 && isSubjective == 0 && isObjective == 0 {
|
|
|
+ br.Msg = "请至少选择一项主客观内容"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果为1 则不做任何推送 ,主观客观默认改成0
|
|
|
+ if isRefuse == 1 {
|
|
|
+ isSubjective = 0
|
|
|
+ isObjective = 0
|
|
|
+ }
|
|
|
+ mobile := user.Mobile
|
|
|
+ item := new(models.CygxXzsChooseSend)
|
|
|
+ item.UserId = user.UserId
|
|
|
+ item.Mobile = user.Mobile
|
|
|
+ item.Email = user.Email
|
|
|
+ item.CompanyId = user.CompanyId
|
|
|
+ item.CompanyName = user.CompanyName
|
|
|
+ item.RealName = user.RealName
|
|
|
+ item.CreateTime = time.Now()
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ item.IsRefuse = req.IsRefuse
|
|
|
+ item.IsSubjective = isSubjective
|
|
|
+ item.IsObjective = isObjective
|
|
|
+ count, err := models.GetXzsChooseSendCountByMobile(mobile)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "GetXzsChooseSendCountByMobile,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果有记录就新增,没有记录就修改
|
|
|
+ if count == 0 {
|
|
|
+ err = models.AddCygxXzsChooseSendPush(item)
|
|
|
+ } else {
|
|
|
+ err = models.UpdateCygxXzsChooseSendPush(item)
|
|
|
+ }
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "保存失败!"
|
|
|
+ br.ErrMsg = "保存失败!,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "保存成功"
|
|
|
+}
|