eta.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package response
  2. import (
  3. "eta/eta_mini_crm_ht/services"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "time"
  6. )
  7. type BaseFromBusinessIndex struct {
  8. IndexCode string `description:"指标编码"`
  9. IndexName string `description:"指标名称"`
  10. Unit string `description:"单位"`
  11. Frequency string `description:"频度"`
  12. SourceName string `description:"数据来源名称"`
  13. StartDate string `description:"指标开始时间"`
  14. EndDate string `description:"指标最新时间"`
  15. CreateTime string `description:"入库时间"`
  16. }
  17. type BaseFromBusinessIndexResponse struct {
  18. Paging *paging.PagingItem
  19. List []*BaseFromBusinessIndex
  20. LastUpdateTime string
  21. }
  22. func (idr *BaseFromBusinessIndexResponse) ToCrmRequest(resp *services.BaseFromBusinessIndexResp) (req BaseFromBusinessIndexResponse) {
  23. var crmList []*BaseFromBusinessIndex
  24. for _, item := range resp.List {
  25. crmList = append(crmList, &BaseFromBusinessIndex{
  26. IndexCode: item.IndexCode,
  27. IndexName: item.IndexName,
  28. Unit: item.Unit,
  29. Frequency: item.Frequency,
  30. SourceName: item.SourceName,
  31. StartDate: item.StartDate.Format(time.DateOnly),
  32. EndDate: item.EndDate.Format(time.DateOnly),
  33. CreateTime: item.CreateTime.Format(time.DateTime),
  34. })
  35. }
  36. return BaseFromBusinessIndexResponse{
  37. Paging: resp.Paging,
  38. List: crmList,
  39. LastUpdateTime: resp.LastUpdateTime,
  40. }
  41. }