common.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package handle
  4. import (
  5. "adm-dws/apis"
  6. "adm-dws/consts"
  7. "adm-dws/impl/task"
  8. "gorm.io/gorm"
  9. )
  10. // 处理函数的声明
  11. type Handler func(*gorm.DB, *apis.DwsMessage, string) ([]*apis.AdsMessage, []*apis.DwsMessage, error)
  12. type DwsTask struct {
  13. Function Handler `json:"function"` //任务处理函数
  14. OutputSourceCode string `json:"source_code"` // 任务输出源编码
  15. PrimaryKeys []string `json:"primary_keys"` // 任务输出主键
  16. }
  17. var DwsTaskMap = map[int32]DwsTask{
  18. 10001: {task.Dws1Task, consts.SOURCEDWS1, []string{"plate_no", "plate_type"}},
  19. 10002: {task.Dws2Task, consts.SOURCEDWS2, []string{"plate_no", "plate_type"}},
  20. 10003: {task.Dws3Task, consts.SOURCEDWS3, []string{"plate_no", "plate_type"}},
  21. 10004: {task.Dws4Task, consts.SOURCEDWS4, []string{"plate_no"}},
  22. 10005: {task.Dws5Task, consts.SOURCEDWS5, []string{"vin"}},
  23. 10006: {task.Dws6Task, consts.SOURCEDWS6, []string{"vin"}},
  24. 10007: {task.Dws7Task, consts.SOURCEDWS7, []string{"vin"}},
  25. 10008: {task.Dws8Task, consts.SOURCEDWS8, []string{"vin"}},
  26. 10009: {task.Dws9Task, consts.SOURCEDWS9, []string{"vin"}},
  27. 10010: {task.Dws10Task, consts.SOURCEDWS10, []string{"vin"}},
  28. 10011: {task.Dws11Task, consts.SOURCEDWS11, nil},
  29. 10012: {task.Dws12Task, consts.SOURCEDWS12, nil},
  30. 10013: {task.Dws13Task, consts.SOURCEDWS13, []string{"thrid_style_id"}},
  31. 10014: {task.Dws14Task, consts.SOURCEDWS14, nil},
  32. 10015: {task.Dws15Task, consts.SOURCEDWS15, []string{"id_card"}},
  33. 10016: {task.Dws16Task, consts.SOURCEDWS16, nil},
  34. 10017: {task.Dws17Task, consts.SOURCEDWS17, []string{"vin"}},
  35. }