interface.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package backend
  2. import (
  3. "bytes"
  4. "context"
  5. "io"
  6. "kpt-tmr-group/config"
  7. "kpt-tmr-group/pkg/di"
  8. operationPb "kpt-tmr-group/proto/go/backend/operation"
  9. "kpt-tmr-group/store/kptstore"
  10. "go.uber.org/dig"
  11. )
  12. var Module = di.Options(di.Provide(NewStore))
  13. type Hub struct {
  14. dig.In
  15. OpsService KptService
  16. }
  17. type StoreEntry struct {
  18. dig.In
  19. Cfg *config.AppConfig
  20. DB *kptstore.DB
  21. //SSO *sso.Cache
  22. // AsynqClient asynqsvc.Client
  23. // Cache *redis.Client
  24. }
  25. func NewStore(store StoreEntry) KptService {
  26. return &store
  27. }
  28. type KptService interface {
  29. Operation
  30. SystemOperation
  31. }
  32. type Operation interface {
  33. // CreateGroupPasture 牧场管理相关
  34. CreateGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  35. EditGroupPasture(ctx context.Context, req *operationPb.AddPastureRequest) error
  36. SearchGroupPastureList(ctx context.Context, req *operationPb.SearchPastureRequest) (*operationPb.SearchPastureResponse, error)
  37. DeleteGroupPasture(ctx context.Context, pastureId int64) error
  38. ResetPasswordGroupPasture(ctx context.Context, pastureId int64) error
  39. IsShowGroupPasture(ctx context.Context, req *operationPb.IsShowGroupPasture) error
  40. // ParentCattleCategoryList 牧畜类别
  41. ParentCattleCategoryList(ctx context.Context) map[operationPb.CattleCategoryParent_Kind]string
  42. AddCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error
  43. EditCattleCategory(ctx context.Context, req *operationPb.AddCattleCategoryRequest) error
  44. IsShowCattleCategory(ctx context.Context, req *operationPb.IsShowCattleCategory) error
  45. DeleteCattleCategory(ctx context.Context, cattleCategoryId int64) error
  46. SearchCattleCategoryList(ctx context.Context, req *operationPb.SearchCattleCategoryRequest) (*operationPb.SearchCattleCategoryResponse, error)
  47. // ParentForageCategoryList 饲料类别相关
  48. ParentForageCategoryList(ctx context.Context) map[operationPb.ForageCategoryParent_Kind]string
  49. AddForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error
  50. EditForageCategory(ctx context.Context, req *operationPb.AddForageCategoryRequest) error
  51. IsShowForageCategory(ctx context.Context, req *operationPb.IsShowForageCategory) error
  52. DeleteForageCategory(ctx context.Context, cattleCategoryId int64) error
  53. SearchForageCategoryList(ctx context.Context, req *operationPb.SearchForageCategoryRequest) (*operationPb.SearchForageCategoryResponse, error)
  54. // CreateForage 饲料相关
  55. CreateForage(ctx context.Context, req *operationPb.AddForageRequest) error
  56. EditForage(ctx context.Context, req *operationPb.AddForageRequest) error
  57. SearchForageList(ctx context.Context, req *operationPb.SearchForageListRequest) (*operationPb.SearchForageListResponse, error)
  58. ForageEnumList(ctx context.Context) *operationPb.ForageEnumList
  59. DeleteForageList(ctx context.Context, ids []int64) error
  60. IsShowForage(ctx context.Context, req *operationPb.IsShowForage) error
  61. ExcelImportForage(ctx context.Context, req io.Reader) error
  62. ExcelExportForage(ctx context.Context, req *operationPb.SearchForageListRequest) (*bytes.Buffer, error)
  63. ExcelTemplateForage(ctx context.Context) (*bytes.Buffer, error)
  64. // CreateFeedFormula 饲料配方
  65. CreateFeedFormula(ctx context.Context, req *operationPb.AddFeedFormulaRequest) error
  66. EditFeedFormula(ctx context.Context, req *operationPb.AddFeedFormulaRequest) error
  67. SearchFeedFormulaList(ctx context.Context, req *operationPb.SearchFeedFormulaRequest) (*operationPb.SearchFeedFormulaListResponse, error)
  68. IsShowFeedFormula(ctx context.Context, req *operationPb.IsShowModifyFeedFormula) error
  69. DeleteFeedFormula(ctx context.Context, feedFormulaId int64) error
  70. ExcelImportFeedFormula(ctx context.Context, req io.Reader) error
  71. ExcelExportFeedFormula(ctx context.Context, req *operationPb.SearchFeedFormulaRequest) (*bytes.Buffer, error)
  72. ExcelTemplateFeedFormula(ctx context.Context) (*bytes.Buffer, error)
  73. }
  74. type SystemOperation interface {
  75. // Auth 系统用户相关
  76. Auth(ctx context.Context, auth *operationPb.UserAuthData) (*operationPb.SystemToken, error)
  77. GetUserInfo(ctx context.Context, token string) (*operationPb.UserAuth, error)
  78. CreateSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  79. SearchSystemUserList(ctx context.Context, req *operationPb.SearchUserRequest) (*operationPb.SearchUserResponse, error)
  80. EditSystemUser(ctx context.Context, req *operationPb.AddSystemUser) error
  81. DeleteSystemUser(ctx context.Context, userId int64) error
  82. ResetPasswordSystemUser(ctx context.Context, userId int64) error
  83. DetailsSystemUser(ctx context.Context, userId int64) (*operationPb.UserDetails, error)
  84. IsShowSystemUser(ctx context.Context, req *operationPb.IsShowSystemUserRequest) error
  85. GetSystemUserPermissions(ctx context.Context, token string) (*operationPb.SystemUserMenuPermissions, error)
  86. // CreateSystemRole 系统角色相关
  87. CreateSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  88. EditSystemRole(ctx context.Context, req *operationPb.AddRoleRequest) error
  89. DeleteSystemRole(ctx context.Context, roleId int64) error
  90. GetRolePermissions(ctx context.Context, roleId int64) (*operationPb.RolePermissionsList, error)
  91. SearchSystemRoleList(ctx context.Context, req *operationPb.SearchRoleRequest) (*operationPb.SearchRoleResponse, error)
  92. // CreateSystemMenu 系统菜单权限
  93. CreateSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  94. EditSystemMenu(ctx context.Context, req *operationPb.AddMenuRequest) error
  95. IsShowSystemMenu(ctx context.Context, req *operationPb.IsShowSystemMenuRequest) error
  96. SearchSystemMenuList(ctx context.Context, req *operationPb.SearchMenuRequest) (*operationPb.SearchMenuResponse, error)
  97. DeleteSystemMenu(ctx context.Context, menuId int64) error
  98. // SearchMobileList 移动端
  99. SearchMobileList(ctx context.Context, req *operationPb.SearchMobileRequest) (*operationPb.SearchMobileResponse, error)
  100. }