meeting_probabilities.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. package data_manage
  2. import (
  3. sql2 "database/sql"
  4. "eta/eta_task/global"
  5. "eta/eta_task/utils"
  6. "gorm.io/gorm"
  7. "time"
  8. )
  9. // MeetingProbabilities excel表格详情表
  10. type MeetingProbabilities struct {
  11. MeetingInfoId int `gorm:"primaryKey"`
  12. Content string `description:"表格内容"`
  13. ExcelImage string `description:"表格图片"`
  14. DateTime string `description:"数据日期"`
  15. IsDelete int `description:"是否删除,0:未删除,1:已删除"`
  16. ModifyTime time.Time `description:"最近修改日期"`
  17. CreateTime time.Time `description:"创建日期"`
  18. }
  19. func (m *MeetingProbabilities) AfterFind(db *gorm.DB) (err error) {
  20. m.DateTime = utils.GormDateStrToDateStr(m.DateTime)
  21. return
  22. }
  23. type MeetingProbabilitiesResp struct {
  24. Ret int
  25. Msg string
  26. ErrMsg string
  27. ErrCode string
  28. Data []*MeetingProbabilities
  29. }
  30. // AddMeetingProbabilities 新增表格
  31. func AddMeetingProbabilities(meetingInfo *MeetingProbabilities) (newId int, err error) {
  32. o := global.DbMap[utils.DbNameIndex]
  33. // 表格信息入库
  34. err = o.Create(meetingInfo).Error
  35. if err != nil {
  36. return
  37. }
  38. newId = meetingInfo.MeetingInfoId
  39. return
  40. }
  41. func GetMeetingProbabilitiesAll(dateStr string) (list []*MeetingProbabilities, err error) {
  42. o := global.DbMap[utils.DbNameIndex]
  43. sql := `SELECT * FROM meeting_probabilities WHERE date_time>=?`
  44. err = o.Raw(sql, dateStr).Find(&list).Error
  45. return
  46. }
  47. type ISheet struct {
  48. ScrollTop int `json:"scrollTop"`
  49. ScrollLeft int `json:"scrollLeft"`
  50. Index string `json:"index"`
  51. Status int `json:"status"`
  52. JfGirdSelectSave []struct{} `json:"jfgird_select_save"`
  53. LuckySheetSelectSave []struct{} `json:"luckysheet_select_save"`
  54. Data [][]interface{} `json:"data"`
  55. Config map[string]struct {
  56. } `json:"config"`
  57. VisibleDataRow []int `json:"visibledatarow"`
  58. VisibleDataColumn []int `json:"visibledatacolumn"`
  59. ChWidth int `json:"ch_width"`
  60. RhHeight int `json:"rh_height"`
  61. LuckySheetSelectionRange []int `json:"luckysheet_selection_range"`
  62. ZoomRatio int `json:"zoomRatio"`
  63. CellData []ISheetCellData `json:"celldata"`
  64. }
  65. type ISheetData struct {
  66. M string `json:"m"`
  67. Ct ISheetDataCt `json:"ct"`
  68. V string `json:"v"`
  69. }
  70. type ISheetDataCt struct {
  71. Fa string `json:"fa"`
  72. T string `json:"t"`
  73. }
  74. type ISheetCellData struct {
  75. R int `json:"r"`
  76. C int `json:"c"`
  77. V ISheetData `json:"v"`
  78. }
  79. type SheetData struct {
  80. Data [][]*struct {
  81. Ct struct {
  82. Fa string `json:"fa"`
  83. T string `json:"t"`
  84. } `json:"ct"`
  85. M string `json:"m"`
  86. V float64 `json:"v"`
  87. } `json:"data"`
  88. }
  89. // AddExcelInfoReq 新增表格请求
  90. type AddExcelInfoReq struct {
  91. ExcelName string `description:"表格名称"`
  92. Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
  93. ExcelType int `description:"表格类型,1:指标列,2:日期列,默认:1"`
  94. ExcelImage string `description:"表格截图"`
  95. ExcelClassifyId int `description:"分类id"`
  96. Content string `description:"Excel表格内容"`
  97. TableData interface{} `description:"自定义表格的数据内容"`
  98. }
  99. func GetMeetingProbabilitiesMaxDate() (maxDate time.Time, err error) {
  100. o := global.DbMap[utils.DbNameIndex]
  101. sql := ` SELECT max(a.date_time) AS max_date FROM meeting_probabilities as a `
  102. var timeNull sql2.NullTime
  103. err = o.Raw(sql).Scan(&timeNull).Error
  104. if err != nil {
  105. return
  106. }
  107. if timeNull.Valid {
  108. maxDate = timeNull.Time
  109. }
  110. return
  111. }