report_push_status.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "eta/eta_mini_crm/models"
  5. "eta/eta_mini_crm/models/request"
  6. "eta/eta_mini_crm/models/response"
  7. "eta/eta_mini_crm/utils"
  8. "fmt"
  9. "strconv"
  10. "strings"
  11. "time"
  12. "github.com/rdlucklib/rdluck_tools/paging"
  13. )
  14. type ReportPushStatusController struct {
  15. BaseAuthController
  16. }
  17. // List
  18. // @Title pdf研报列表
  19. // @Description pdf研报列表
  20. // @Param PageSize query int true "每页数据条数"
  21. // @Param CurrentIndex query int true "当前页页码,从1开始"
  22. // @Param ClassifyIds query string true "分类id,可多选用英文,隔开"
  23. // @Param ChartPermissionIds query string true "品种id,可多选用英文,隔开"
  24. // @Param PublishStartDate query string true "发布开始时间"
  25. // @Param PublishEndDate query string true "发布结束时间"
  26. // @Param PushStartDate query string true "推送开始时间"
  27. // @Param PushEndDate query string true "推送结束时间"
  28. // @Param KeyWord query string true "报告标题/创建人"
  29. // @Param SelectedIds query string true "选择的报告id, isSelectAll:为true时,反选"
  30. // @Param IsSelectAll query bool true "是否全选"
  31. // @Param SortParam query string true "排序字段"
  32. // @Param SortType query string true "排序方式"
  33. // @Success 200 {object} models.ReportAuthorResp
  34. // @router /list [get]
  35. func (this *ReportPushStatusController) List() {
  36. br := new(models.BaseResponse).Init()
  37. defer func() {
  38. this.Data["json"] = br
  39. this.ServeJSON()
  40. }()
  41. pageSize, _ := this.GetInt("PageSize")
  42. currentIndex, _ := this.GetInt("CurrentIndex")
  43. classifyIds := this.GetString("ClassifyIds")
  44. selectedIds := this.GetString("SelectedIds")
  45. isSelectAll, _ := this.GetBool("IsSelectAll")
  46. chartPermissionIds := this.GetString("ChartPermissionIds")
  47. publishStartDate := this.GetString("PublishStartDate")
  48. publishEndDate := this.GetString("PublishEndDate")
  49. pushStartDate := this.GetString("PushStartDate")
  50. pushEndDate := this.GetString("PushEndDate")
  51. keyWord := this.GetString("KeyWord")
  52. sortParam := this.GetString("SortParam")
  53. sortType := this.GetString("SortType")
  54. if pageSize <= 0 {
  55. pageSize = utils.PageSize20
  56. }
  57. if currentIndex <= 0 {
  58. currentIndex = 1
  59. }
  60. var condition string
  61. var pars []interface{}
  62. if publishStartDate != "" && publishEndDate != "" {
  63. condition += " AND publish_time >= ?"
  64. publishStartTime, err := time.Parse(utils.FormatDate, publishStartDate)
  65. if err != nil {
  66. br.Msg = "日期格式有误"
  67. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  68. return
  69. }
  70. publishStartDateStr := publishStartTime.Format(utils.FormatDateTime)
  71. pars = append(pars, publishStartDateStr)
  72. condition += " AND publish_time <= ?"
  73. publishEndTime, err := time.Parse(utils.FormatDate, publishEndDate)
  74. if err != nil {
  75. br.Msg = "日期格式有误"
  76. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  77. return
  78. }
  79. publishEndTime = publishEndTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
  80. publishEndDateStr := publishEndTime.Format(utils.FormatDateTime)
  81. pars = append(pars, publishEndDateStr)
  82. }
  83. if pushStartDate != "" && pushEndDate != "" {
  84. condition += " AND push_time >= ?"
  85. pushStartTime, err := time.Parse(utils.FormatDate, pushStartDate)
  86. if err != nil {
  87. br.Msg = "日期格式有误"
  88. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  89. return
  90. }
  91. pushStartDateStr := pushStartTime.Format(utils.FormatDateTime)
  92. pars = append(pars, pushStartDateStr)
  93. condition += " AND push_time <= ?"
  94. pushEndTime, err := time.Parse(utils.FormatDate, pushEndDate)
  95. if err != nil {
  96. br.Msg = "日期格式有误"
  97. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  98. return
  99. }
  100. pushEndTime = pushEndTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
  101. pushEndDateStr := pushEndTime.Format(utils.FormatDateTime)
  102. pars = append(pars, pushEndDateStr)
  103. }
  104. if keyWord != "" {
  105. condition += ` AND title like ? `
  106. pars = utils.GetLikeKeywordPars(pars, keyWord, 1)
  107. }
  108. var sortCondition string
  109. if sortParam != "" && sortType != "" {
  110. sortCondition = " ORDER BY "
  111. var param, sort string
  112. switch sortParam {
  113. case "PublishTime":
  114. param = "publish_time"
  115. case "PushTime":
  116. param = "push_time"
  117. }
  118. switch sortType {
  119. case "asc":
  120. sort = " ASC "
  121. case "desc":
  122. sort = " DESC "
  123. }
  124. if param != "" && sort != "" {
  125. sortCondition += param + " " + sort
  126. } else {
  127. sortCondition = ""
  128. }
  129. }
  130. if sortCondition == "" {
  131. sortCondition = ` ORDER BY publish_time DESC `
  132. }
  133. classifyIdList := make([]int, 0)
  134. if classifyIds != "" {
  135. classifyArrStr := strings.Split(classifyIds, ",")
  136. if len(classifyArrStr) > 0 {
  137. for _, v := range classifyArrStr {
  138. tmp, _ := strconv.Atoi(v)
  139. classifyIdList = append(classifyIdList, tmp)
  140. }
  141. }
  142. }
  143. if chartPermissionIds != "" {
  144. idStrs := strings.Split(chartPermissionIds, ",")
  145. idInts := make([]int, 0)
  146. for _, id := range idStrs {
  147. tmp, _ := strconv.Atoi(id)
  148. idInts = append(idInts, tmp)
  149. }
  150. tmpClassifyList, err := models.GetClassifyIdsListByIds(idInts)
  151. if err != nil {
  152. br.Msg = "获取研报列表失败"
  153. br.ErrMsg = "品种获取分类失败,Err:" + err.Error()
  154. return
  155. }
  156. classifyIdList = append(classifyIdList, tmpClassifyList...)
  157. }
  158. if len(classifyIdList) > 0 {
  159. classifyIdList = utils.Unique(classifyIdList)
  160. condition += ` AND (classify_id_first IN (%s) AND classify_id_second IN (%s) AND classify_id_third IN (%s))`
  161. condition = fmt.Sprintf(condition, utils.GetOrmReplaceHolder(len(classifyIdList)), utils.GetOrmReplaceHolder(len(classifyIdList)), utils.GetOrmReplaceHolder(len(classifyIdList)))
  162. pars = append(pars, classifyIdList, classifyIdList, classifyIdList)
  163. }
  164. if isSelectAll {
  165. if selectedIds != "" {
  166. selectIdStrs := strings.Split(selectedIds, ",")
  167. if len(selectIdStrs) > 0 {
  168. condition += ` AND report_id NOT IN (` + utils.GetOrmReplaceHolder(len(selectIdStrs)) + `)`
  169. pars = append(pars, selectedIds)
  170. }
  171. }
  172. } else {
  173. if selectedIds != "" {
  174. selectIdStrs := strings.Split(selectedIds, ",")
  175. if len(selectIdStrs) > 0 {
  176. condition += ` AND report_id IN (` + utils.GetOrmReplaceHolder(len(selectIdStrs)) + `)`
  177. pars = append(pars, selectedIds)
  178. }
  179. }
  180. }
  181. startSize := utils.StartIndex(currentIndex, pageSize)
  182. total, err := models.GetReportCountByCondition(condition, pars)
  183. if err != nil {
  184. br.Msg = "获取研报列表失败"
  185. br.ErrMsg = "获取研报列表统计失败,Err:" + err.Error()
  186. return
  187. }
  188. reportList, err := models.GetReportPushStatusListByCondition(condition, pars, startSize, pageSize)
  189. if err != nil {
  190. br.Msg = "获取研报列表失败"
  191. br.ErrMsg = "获取研报列表失败,Err:" + err.Error()
  192. return
  193. }
  194. page := paging.GetPaging(currentIndex, pageSize, total)
  195. resp := new(response.ReportPushStatusResp)
  196. resp.List = reportList
  197. resp.Paging = page
  198. br.Data = resp
  199. br.Msg = "获取成功"
  200. br.Ret = 200
  201. br.Success = true
  202. }
  203. // PushCancel
  204. // @Title 取消推送报告
  205. // @Description 取消推送报告
  206. // @Param request body request.ReportPdfEditReq true "type json string"
  207. // @Success 200 {object} models.ReportAuthorResp
  208. // @router /pushCancel [post]
  209. func (this *ReportPushStatusController) PushCancel() {
  210. br := new(models.BaseResponse).Init()
  211. defer func() {
  212. this.Data["json"] = br
  213. this.ServeJSON()
  214. }()
  215. var req request.ReportPushStatusReq
  216. if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
  217. br.Msg = "参数错误"
  218. br.ErrMsg = "参数错误,Err:" + err.Error()
  219. return
  220. }
  221. reportPush, err := models.GetReportPushStatusByReportId(req.ReportId, 1)
  222. if err != nil && err.Error() != utils.ErrNoRow() {
  223. br.Msg = "推送失败"
  224. br.ErrMsg = "获取推送消息失败,Err:" + err.Error()
  225. return
  226. }
  227. if reportPush != nil {
  228. reportPush.State = 0
  229. reportPush.ModifyTime = time.Now()
  230. err = reportPush.Update([]string{"state", "modify_time"})
  231. if err != nil {
  232. br.Msg = "取消推送失败"
  233. br.ErrMsg = "取消推送失败,Err:" + err.Error()
  234. return
  235. }
  236. }
  237. br.Msg = "取消推送成功"
  238. br.Success = true
  239. br.Ret = 200
  240. }
  241. // Push
  242. // @Title 推送报告
  243. // @Description 推送报告
  244. // @Param request body request.ReportPdfEditReq true "type json string"
  245. // @Success 200 {object} models.ReportAuthorResp
  246. // @router /push [post]
  247. func (this *ReportPushStatusController) Push() {
  248. br := new(models.BaseResponse).Init()
  249. defer func() {
  250. this.Data["json"] = br
  251. this.ServeJSON()
  252. }()
  253. var req request.ReportPushStatusReq
  254. if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
  255. br.Msg = "参数错误"
  256. br.ErrMsg = "参数错误,Err:" + err.Error()
  257. return
  258. }
  259. count, err := models.GetReportCountById(req.ReportId)
  260. if err != nil {
  261. br.Msg = "研报未发布或已删除"
  262. br.ErrMsg = "研报查询失败,Err:" + err.Error()
  263. return
  264. }
  265. if count == 0 {
  266. br.Msg = "研报未发布或已删除"
  267. return
  268. }
  269. reportPush, err := models.GetReportPushStatusByReportId(req.ReportId, 0)
  270. if err != nil && err.Error() != utils.ErrNoRow() {
  271. br.Msg = "推送失败"
  272. br.ErrMsg = "获取推送消息失败,Err:" + err.Error()
  273. return
  274. }
  275. if reportPush != nil {
  276. reportPush.State = 1
  277. reportPush.ModifyTime = time.Now()
  278. reportPush.PushTime = time.Now()
  279. err = reportPush.Update([]string{"state", "modify_time", "push_time"})
  280. if err != nil {
  281. br.Msg = "推送失败"
  282. br.ErrMsg = "推送失败,Err:" + err.Error()
  283. return
  284. }
  285. }
  286. br.Msg = "推送成功"
  287. br.Success = true
  288. br.Ret = 200
  289. }
  290. // BatchPush
  291. // @Title 批量推送报告
  292. // @Description 批量推送报告
  293. // @Param request body request.BatchReportModifyPushStatusReq true "type json string"
  294. // @Success 200 {object} models.ReportAuthorResp
  295. // @router /batch/push [post]
  296. func (this *ReportPushStatusController) BatchPush() {
  297. br := new(models.BaseResponse).Init()
  298. defer func() {
  299. this.Data["json"] = br
  300. this.ServeJSON()
  301. }()
  302. var req request.BatchReportModifyPushStatusReq
  303. if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
  304. br.Msg = "参数错误"
  305. br.ErrMsg = "参数错误,Err:" + err.Error()
  306. return
  307. }
  308. var condition string
  309. var pars []interface{}
  310. if req.PublishStartDate != "" && req.PublishEndDate != "" {
  311. condition += " AND publish_time >= ?"
  312. publishStartTime, err := time.Parse(utils.FormatDate, req.PublishStartDate)
  313. if err != nil {
  314. br.Msg = "日期格式有误"
  315. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  316. return
  317. }
  318. publishStartDateStr := publishStartTime.Format(utils.FormatDateTime)
  319. pars = append(pars, publishStartDateStr)
  320. condition += " AND publish_time <= ?"
  321. publishEndTime, err := time.Parse(utils.FormatDate, req.PublishEndDate)
  322. if err != nil {
  323. br.Msg = "日期格式有误"
  324. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  325. return
  326. }
  327. publishEndTime = publishEndTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
  328. publishEndDateStr := publishEndTime.Format(utils.FormatDateTime)
  329. pars = append(pars, publishEndDateStr)
  330. }
  331. if req.PushStartDate != "" && req.PushEndDate != "" {
  332. condition += " AND push_time >= ?"
  333. pushStartTime, err := time.Parse(utils.FormatDate, req.PushStartDate)
  334. if err != nil {
  335. br.Msg = "日期格式有误"
  336. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  337. return
  338. }
  339. pushStartDateStr := pushStartTime.Format(utils.FormatDateTime)
  340. pars = append(pars, pushStartDateStr)
  341. condition += " AND push_time <= ?"
  342. pushEndTime, err := time.Parse(utils.FormatDate, req.PushEndDate)
  343. if err != nil {
  344. br.Msg = "日期格式有误"
  345. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  346. return
  347. }
  348. pushEndTime = pushEndTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
  349. pushEndDateStr := pushEndTime.Format(utils.FormatDateTime)
  350. pars = append(pars, pushEndDateStr)
  351. }
  352. if req.KeyWord != "" {
  353. condition += ` AND title like ? `
  354. pars = utils.GetLikeKeywordPars(pars, req.KeyWord, 1)
  355. }
  356. classifyIdList := make([]int, 0)
  357. classifyIdList = append(classifyIdList, req.ClassifyIds...)
  358. tmpClassifyList, err := models.GetClassifyIdsListByIds(req.ChartPermissionIds)
  359. if err != nil {
  360. br.Msg = "获取研报列表失败"
  361. br.ErrMsg = "品种获取分类失败,Err:" + err.Error()
  362. return
  363. }
  364. classifyIdList = append(classifyIdList, tmpClassifyList...)
  365. if len(classifyIdList) > 0 {
  366. classifyIdList = utils.Unique(classifyIdList)
  367. condition += ` AND (classify_id_first IN (%s) AND classify_id_second IN (%s) AND classify_id_third IN (%s))`
  368. condition = fmt.Sprintf(condition, utils.GetOrmReplaceHolder(len(classifyIdList)), utils.GetOrmReplaceHolder(len(classifyIdList)), utils.GetOrmReplaceHolder(len(classifyIdList)))
  369. pars = append(pars, classifyIdList, classifyIdList, classifyIdList)
  370. }
  371. if req.IsSelectAll {
  372. if len(req.SelectedIds) > 0 {
  373. condition += ` AND report_id NOT IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
  374. pars = append(pars, req.SelectedIds)
  375. }
  376. } else {
  377. if len(req.SelectedIds) > 0 {
  378. condition += ` AND report_id IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
  379. pars = append(pars, req.SelectedIds)
  380. }
  381. }
  382. reportIds, err := models.GetReportIdListByCondition(condition, pars)
  383. if err != nil {
  384. br.Msg = "批量推送失败"
  385. br.ErrMsg = "查询研报失败,Err:" + err.Error()
  386. return
  387. }
  388. reportPush, err := models.GetReportPushStatusByReportIdAndState(reportIds, 0)
  389. if err != nil {
  390. br.Msg = "批量推送失败"
  391. br.ErrMsg = "查询推送状态失败,Err:" + err.Error()
  392. return
  393. }
  394. existReportMap := make(map[int]struct{})
  395. for _, v := range reportPush {
  396. existReportMap[v.ReportId] = struct{}{}
  397. }
  398. existReportIds := make([]int, 0)
  399. for _, v := range reportIds {
  400. if _, ok := existReportMap[v]; ok {
  401. existReportIds = append(existReportIds, v)
  402. }
  403. }
  404. err = models.BatchPushReport(existReportIds)
  405. if err != nil {
  406. br.Msg = "批量推送失败"
  407. br.ErrMsg = "批量修改推送失败,Err:" + err.Error()
  408. return
  409. }
  410. br.Msg = "推送成功"
  411. br.Success = true
  412. br.Ret = 200
  413. }
  414. // BatchPushCancel
  415. // @Title 批量撤销推送报告
  416. // @Description 批量撤销推送报告
  417. // @Param request body request.BatchReportModifyPushStatusReq true "type json string"
  418. // @Success 200 {object} models.ReportAuthorResp
  419. // @router /batch/pushCancel [post]
  420. func (this *ReportPushStatusController) BatchPushCancel() {
  421. br := new(models.BaseResponse).Init()
  422. defer func() {
  423. this.Data["json"] = br
  424. this.ServeJSON()
  425. }()
  426. var req request.BatchReportModifyPushStatusReq
  427. if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
  428. br.Msg = "参数错误"
  429. br.ErrMsg = "参数错误,Err:" + err.Error()
  430. return
  431. }
  432. var condition string
  433. var pars []interface{}
  434. if req.PublishStartDate != "" && req.PublishEndDate != "" {
  435. condition += " AND publish_time >= ?"
  436. publishStartTime, err := time.Parse(utils.FormatDate, req.PublishStartDate)
  437. if err != nil {
  438. br.Msg = "日期格式有误"
  439. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  440. return
  441. }
  442. publishStartDateStr := publishStartTime.Format(utils.FormatDateTime)
  443. pars = append(pars, publishStartDateStr)
  444. condition += " AND publish_time <= ?"
  445. publishEndTime, err := time.Parse(utils.FormatDate, req.PublishEndDate)
  446. if err != nil {
  447. br.Msg = "日期格式有误"
  448. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  449. return
  450. }
  451. publishEndTime = publishEndTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
  452. publishEndDateStr := publishEndTime.Format(utils.FormatDateTime)
  453. pars = append(pars, publishEndDateStr)
  454. }
  455. if req.PushStartDate != "" && req.PushEndDate != "" {
  456. condition += " AND push_time >= ?"
  457. pushStartTime, err := time.Parse(utils.FormatDate, req.PushStartDate)
  458. if err != nil {
  459. br.Msg = "日期格式有误"
  460. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  461. return
  462. }
  463. pushStartDateStr := pushStartTime.Format(utils.FormatDateTime)
  464. pars = append(pars, pushStartDateStr)
  465. condition += " AND push_time <= ?"
  466. pushEndTime, err := time.Parse(utils.FormatDate, req.PushEndDate)
  467. if err != nil {
  468. br.Msg = "日期格式有误"
  469. br.ErrMsg = "日期格式有误,Err:" + err.Error()
  470. return
  471. }
  472. pushEndTime = pushEndTime.Add(23*time.Hour + 59*time.Minute + 59*time.Second)
  473. pushEndDateStr := pushEndTime.Format(utils.FormatDateTime)
  474. pars = append(pars, pushEndDateStr)
  475. }
  476. if req.KeyWord != "" {
  477. condition += ` AND title like ? `
  478. pars = utils.GetLikeKeywordPars(pars, req.KeyWord, 1)
  479. }
  480. classifyIdList := make([]int, 0)
  481. classifyIdList = append(classifyIdList, req.ClassifyIds...)
  482. tmpClassifyList, err := models.GetClassifyIdsListByIds(req.ChartPermissionIds)
  483. if err != nil {
  484. br.Msg = "获取研报列表失败"
  485. br.ErrMsg = "品种获取分类失败,Err:" + err.Error()
  486. return
  487. }
  488. classifyIdList = append(classifyIdList, tmpClassifyList...)
  489. if len(classifyIdList) > 0 {
  490. classifyIdList = utils.Unique(classifyIdList)
  491. condition += ` AND (classify_id_first IN (%s) AND classify_id_second IN (%s) AND classify_id_third IN (%s))`
  492. condition = fmt.Sprintf(condition, utils.GetOrmReplaceHolder(len(classifyIdList)), utils.GetOrmReplaceHolder(len(classifyIdList)), utils.GetOrmReplaceHolder(len(classifyIdList)))
  493. pars = append(pars, classifyIdList, classifyIdList, classifyIdList)
  494. }
  495. if req.IsSelectAll {
  496. if len(req.SelectedIds) > 0 {
  497. condition += ` AND report_id NOT IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
  498. pars = append(pars, req.SelectedIds)
  499. }
  500. } else {
  501. if len(req.SelectedIds) > 0 {
  502. condition += ` AND report_id IN (` + utils.GetOrmReplaceHolder(len(req.SelectedIds)) + `)`
  503. pars = append(pars, req.SelectedIds)
  504. }
  505. }
  506. reportIds, err := models.GetReportIdListByCondition(condition, pars)
  507. if err != nil {
  508. br.Msg = "批量推送失败"
  509. br.ErrMsg = "查询研报失败,Err:" + err.Error()
  510. return
  511. }
  512. reportPush, err := models.GetReportPushStatusByReportIdAndState(reportIds, 1)
  513. if err != nil {
  514. br.Msg = "批量推送失败"
  515. br.ErrMsg = "查询推送状态失败,Err:" + err.Error()
  516. return
  517. }
  518. existReportMap := make(map[int]struct{})
  519. for _, v := range reportPush {
  520. existReportMap[v.ReportId] = struct{}{}
  521. }
  522. existReportIds := make([]int, 0)
  523. for _, v := range reportIds {
  524. if _, ok := existReportMap[v]; ok {
  525. existReportIds = append(existReportIds, v)
  526. }
  527. }
  528. err = models.BatchPushCancelReport(existReportIds)
  529. if err != nil {
  530. br.Msg = "批量取消推送失败"
  531. br.ErrMsg = "批量修改推送失败,Err:" + err.Error()
  532. return
  533. }
  534. br.Msg = "撤销推送成功"
  535. br.Success = true
  536. br.Ret = 200
  537. }