rcvr.go 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package impl
  4. import (
  5. "context"
  6. "adm-vehicle-style/pb"
  7. v1 "adm-vehicle-style/pb/v1"
  8. "adm-vehicle-style/impl/v1/brand"
  9. "adm-vehicle-style/impl/v1/maintainance"
  10. "adm-vehicle-style/impl/v1/query"
  11. "adm-vehicle-style/impl/v1/series"
  12. "adm-vehicle-style/impl/v1/style"
  13. "git.getensh.com/common/gopkgsv2/tasker/rpctasker"
  14. "google.golang.org/grpc"
  15. )
  16. // 具体实现
  17. type Rcvr struct{}
  18. func Register(s *grpc.Server) {
  19. pb.RegisterVehicleStyleServer(s, &Rcvr{})
  20. }
  21. func (c *Rcvr) BrandList(ctx context.Context, req *v1.BrandListRequest) (reply *v1.BrandListReply, err error) {
  22. t1 := func() error {
  23. reply, err = brand.List(ctx, req)
  24. return err
  25. }
  26. return reply, rpctasker.Exec(ctx, t1)
  27. }
  28. func (c *Rcvr) Search(ctx context.Context, req *v1.SearchRequest) (reply *v1.SearchReply, err error) {
  29. t1 := func() error {
  30. reply, err = brand.Search(ctx, req)
  31. return err
  32. }
  33. return reply, rpctasker.Exec(ctx, t1)
  34. }
  35. func (c *Rcvr) UpdateSYBrand(ctx context.Context, req *v1.UpdateSYBrandRequest) (reply *v1.EmptyReply, err error) {
  36. t1 := func() error {
  37. reply, err = brand.Update(ctx, req)
  38. return err
  39. }
  40. return reply, rpctasker.Exec(ctx, t1)
  41. }
  42. func (c *Rcvr) GetMaker(ctx context.Context, req *v1.GetMakerRequest) (reply *v1.GetMakerReply, err error) {
  43. t1 := func() error {
  44. reply, err = brand.MakerList(ctx, req)
  45. return err
  46. }
  47. return reply, rpctasker.Exec(ctx, t1)
  48. }
  49. func (c *Rcvr) UpdateMaker(ctx context.Context, req *v1.UpdateMakerRequest) (reply *v1.EmptyReply, err error) {
  50. t1 := func() error {
  51. reply, err = brand.UpdateMaker(ctx, req)
  52. return err
  53. }
  54. return reply, rpctasker.Exec(ctx, t1)
  55. }
  56. func (c *Rcvr) SeriesList(ctx context.Context, req *v1.SeriesListRequest) (reply *v1.SeriesListReply, err error) {
  57. t1 := func() error {
  58. reply, err = series.List(ctx, req)
  59. return err
  60. }
  61. return reply, rpctasker.Exec(ctx, t1)
  62. }
  63. func (c *Rcvr) UpdateSeries(ctx context.Context, req *v1.UpdateSeriesRequest) (reply *v1.EmptyReply, err error) {
  64. t1 := func() error {
  65. reply, err = series.Update(ctx, req)
  66. return err
  67. }
  68. return reply, rpctasker.Exec(ctx, t1)
  69. }
  70. func (c *Rcvr) StyleList(ctx context.Context, req *v1.StyleListRequest) (reply *v1.StyleListReply, err error) {
  71. t1 := func() error {
  72. reply, err = style.List(ctx, req)
  73. return err
  74. }
  75. return reply, rpctasker.Exec(ctx, t1)
  76. }
  77. func (c *Rcvr) UpdateStyle(ctx context.Context, req *v1.UpdateStyleRequest) (reply *v1.EmptyReply, err error) {
  78. t1 := func() error {
  79. reply, err = style.Update(ctx, req)
  80. return err
  81. }
  82. return reply, rpctasker.Exec(ctx, t1)
  83. }
  84. func (c *Rcvr) StyleInfo(ctx context.Context, req *v1.StyleInfoRequest) (reply *v1.StyleInfoReply, err error) {
  85. t1 := func() error {
  86. reply, err = style.Info(ctx, req)
  87. return err
  88. }
  89. return reply, rpctasker.Exec(ctx, t1)
  90. }
  91. func (c *Rcvr) UpdateStyleInfo(ctx context.Context, req *v1.UpdateStyleInfoRequest) (reply *v1.EmptyReply, err error) {
  92. t1 := func() error {
  93. reply, err = style.UpdateStyleInfo(ctx, req)
  94. return err
  95. }
  96. return reply, rpctasker.Exec(ctx, t1)
  97. }
  98. func (c *Rcvr) MaintainManual(
  99. ctx context.Context,
  100. req *v1.MaintainManualRequest,
  101. ) (reply *v1.MaintainManualReply, err error) {
  102. t1 := func() error {
  103. reply, err = maintainance.Manual(ctx, req)
  104. return err
  105. }
  106. return reply, rpctasker.Exec(ctx, t1)
  107. }
  108. func (c *Rcvr) ItemList(ctx context.Context, req *v1.ItemListRequest) (reply *v1.ItemListReply, err error) {
  109. t1 := func() error {
  110. reply, err = maintainance.ItemList(ctx, req)
  111. return err
  112. }
  113. return reply, rpctasker.Exec(ctx, t1)
  114. }
  115. func (c *Rcvr) UpdateMaintainManual(
  116. ctx context.Context,
  117. req *v1.UpdateMaintainManualRequest,
  118. ) (reply *v1.EmptyReply, err error) {
  119. t1 := func() error {
  120. reply, err = maintainance.Update(ctx, req)
  121. return err
  122. }
  123. return reply, rpctasker.Exec(ctx, t1)
  124. }
  125. func (c *Rcvr) MaintainManualInfo(
  126. ctx context.Context,
  127. req *v1.MaintainManualInfoRequest,
  128. ) (reply *v1.MaintainManualInfoReply, err error) {
  129. t1 := func() error {
  130. reply, err = maintainance.Info(ctx, req)
  131. return err
  132. }
  133. return reply, rpctasker.Exec(ctx, t1)
  134. }
  135. func (c *Rcvr) StyleItem(
  136. ctx context.Context,
  137. req *v1.MaintainManualRequest,
  138. ) (reply *v1.StyleItemReply, err error) {
  139. t1 := func() error {
  140. reply, err = maintainance.StyleItem(ctx, req)
  141. return err
  142. }
  143. return reply, rpctasker.Exec(ctx, t1)
  144. }
  145. func (c *Rcvr) C2List(ctx context.Context, req *v1.C2ListRequest) (reply *v1.C2ListReply, err error) {
  146. t1 := func() error {
  147. reply, err = maintainance.C2List(ctx, req)
  148. return err
  149. }
  150. return reply, rpctasker.Exec(ctx, t1)
  151. }
  152. func (c *Rcvr) UpdateStyleItem(ctx context.Context, req *v1.UpdateStyleItemRequest) (reply *v1.EmptyReply, err error) {
  153. t1 := func() error {
  154. reply, err = maintainance.UpdateStyleItem(ctx, req)
  155. return err
  156. }
  157. return reply, rpctasker.Exec(ctx, t1)
  158. }
  159. func (c *Rcvr) DeleteMaintainace(
  160. ctx context.Context,
  161. req *v1.DeleteMaintainaceRequest,
  162. ) (reply *v1.EmptyReply, err error) {
  163. t1 := func() error {
  164. reply, err = maintainance.Delete(ctx, req)
  165. return err
  166. }
  167. return reply, rpctasker.Exec(ctx, t1)
  168. }
  169. func (c *Rcvr) ExportStyle(ctx context.Context, req *v1.ExportStyleRequest) (reply *v1.ExportStyleReply, err error) {
  170. t1 := func() error {
  171. reply, err = style.Export(ctx, req)
  172. return err
  173. }
  174. return reply, rpctasker.Exec(ctx, t1)
  175. }
  176. func (c *Rcvr) ExportStyleTaskList(
  177. ctx context.Context,
  178. req *v1.EmptyReply,
  179. ) (reply *v1.ExportStyleTaskListReply, err error) {
  180. t1 := func() error {
  181. reply, err = style.ExportTaskList(ctx, req)
  182. return err
  183. }
  184. return reply, rpctasker.Exec(ctx, t1)
  185. }
  186. func (c *Rcvr) DeleteExportStyleTask(
  187. ctx context.Context,
  188. req *v1.DeleteExportStyleTaskRequest,
  189. ) (reply *v1.EmptyReply, err error) {
  190. t1 := func() error {
  191. reply, err = style.DeleteExportTask(ctx, req)
  192. return err
  193. }
  194. return reply, rpctasker.Exec(ctx, t1)
  195. }
  196. func (c *Rcvr) Query(ctx context.Context, req *v1.QueryRequest) (reply *v1.QueryResponse, err error) {
  197. t1 := func() error {
  198. reply, err = query.Query(ctx, req)
  199. return err
  200. }
  201. return reply, rpctasker.Exec(ctx, t1)
  202. }
  203. func (c *Rcvr) DeleteStyleItem(
  204. ctx context.Context,
  205. req *v1.DeleteStyleItemRequest,
  206. ) (reply *v1.EmptyReply, err error) {
  207. t1 := func() error {
  208. reply, err = maintainance.DeleteStyleItem(ctx, req)
  209. return err
  210. }
  211. return reply, rpctasker.Exec(ctx, t1)
  212. }
  213. func (c *Rcvr) TemplateList(ctx context.Context, req *v1.TemplateListRequest) (reply *v1.TemplateListReply, err error) {
  214. t1 := func() error {
  215. reply, err = maintainance.TemplateList(ctx, req)
  216. return err
  217. }
  218. return reply, rpctasker.Exec(ctx, t1)
  219. }
  220. func (c *Rcvr) TemplateDetailList(
  221. ctx context.Context,
  222. req *v1.TemplateDetailListRequest,
  223. ) (reply *v1.TemplateDetailListReply, err error) {
  224. t1 := func() error {
  225. reply, err = maintainance.TemplateDetailList(ctx, req)
  226. return err
  227. }
  228. return reply, rpctasker.Exec(ctx, t1)
  229. }
  230. func (c *Rcvr) TemplateDetail(
  231. ctx context.Context,
  232. req *v1.TemplateDetailRequest,
  233. ) (reply *v1.TemplateDetailReply, err error) {
  234. t1 := func() error {
  235. reply, err = maintainance.TemplateDetail(ctx, req)
  236. return err
  237. }
  238. return reply, rpctasker.Exec(ctx, t1)
  239. }
  240. func (c *Rcvr) AddTemplateDetail(
  241. ctx context.Context,
  242. req *v1.AddTemplateDetailRequest,
  243. ) (reply *v1.AddTemplateDetailReply, err error) {
  244. t1 := func() error {
  245. reply, err = maintainance.AddTemplateDetail(ctx, req)
  246. return err
  247. }
  248. return reply, rpctasker.Exec(ctx, t1)
  249. }
  250. func (c *Rcvr) UpdateTemplateDetail(
  251. ctx context.Context,
  252. req *v1.UpdateMaintainManualRequest,
  253. ) (reply *v1.EmptyReply, err error) {
  254. t1 := func() error {
  255. reply, err = maintainance.UpdateTemplateDetail(ctx, req)
  256. return err
  257. }
  258. return reply, rpctasker.Exec(ctx, t1)
  259. }
  260. func (c *Rcvr) ChooseTemplateDetail(
  261. ctx context.Context,
  262. req *v1.ChooseTemplateDetailRequest,
  263. ) (reply *v1.EmptyReply, err error) {
  264. t1 := func() error {
  265. reply, err = maintainance.ChooseTemplateDetail(ctx, req)
  266. return err
  267. }
  268. return reply, rpctasker.Exec(ctx, t1)
  269. }
  270. func (c *Rcvr) TemplateItemList(ctx context.Context, req *v1.TemplateItemListRequest) (reply *v1.ItemListReply, err error) {
  271. t1 := func() error {
  272. reply, err = maintainance.TemplateItemList(ctx, req)
  273. return err
  274. }
  275. return reply, rpctasker.Exec(ctx, t1)
  276. }