rcvr.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // Copyright 2019 github.com. All rights reserved.
  2. // Use of this source code is governed by github.com.
  3. package impl
  4. import (
  5. "context"
  6. "smart-provincial/impl/v1/provincial_department"
  7. "smart-provincial/pb"
  8. pb_v1 "smart-provincial/pb/v1"
  9. "github.com/jaryhe/gopkgs/tasker/rpctasker"
  10. "google.golang.org/grpc"
  11. )
  12. // 具体实现
  13. type Rcvr struct {
  14. }
  15. func Register(s *grpc.Server) {
  16. pb.RegisterSmartProvincialServer(s, &Rcvr{})
  17. }
  18. // 省厅获取项目编码
  19. func (c *Rcvr) ProvincialGetProjectCode(ctx context.Context, req *pb_v1.ProvincialGetProjectCodeRequest) (reply *pb_v1.ProvincialGetProjectCodeReply, err error) {
  20. t1 := func() error {
  21. reply, err = provincial_department.ProvincialGetProjectCode(ctx, req)
  22. return err
  23. }
  24. return reply, rpctasker.Exec(ctx, t1)
  25. }
  26. // 提交项目信息
  27. func (c *Rcvr) ProvincialPostProject(ctx context.Context, req *pb_v1.ProvincialPostProjectRequest) (reply *pb_v1.ProvincialPostProjectReply, err error) {
  28. t1 := func() error {
  29. reply, err = provincial_department.ProvincialPostProject(ctx, req)
  30. return err
  31. }
  32. return reply, rpctasker.Exec(ctx, t1)
  33. }
  34. // 提交扬尘设备信息
  35. func (c *Rcvr) ProvincialPostDustDevice(ctx context.Context, req *pb_v1.ProvincialPostDustDeviceRequest) (reply *pb_v1.ProvincialPostDustDeviceReply, err error) {
  36. t1 := func() error {
  37. reply, err = provincial_department.ProvincialPostDustDevice(ctx, req)
  38. return err
  39. }
  40. return reply, rpctasker.Exec(ctx, t1)
  41. }
  42. // 提交扬尘监测数据
  43. func (c *Rcvr) ProvincialPostDustData(ctx context.Context, req *pb_v1.ProvincialPostDustDataRequest) (reply *pb_v1.ProvincialPostDustDataReply, err error) {
  44. t1 := func() error {
  45. reply, err = provincial_department.ProvincialPostDustData(ctx, req)
  46. return err
  47. }
  48. return reply, rpctasker.Exec(ctx, t1)
  49. }
  50. func (c *Rcvr) ProvincialVerifyData(ctx context.Context, req *pb_v1.ProvincialVerifyDataRequest) (reply *pb_v1.ProvincialVerifyDataReply, err error) {
  51. t1 := func() error {
  52. reply, err = provincial_department.ProvincialVerifyData(ctx, req)
  53. return err
  54. }
  55. return reply, rpctasker.Exec(ctx, t1)
  56. }
  57. func (c *Rcvr) ProvincialPostTeam(ctx context.Context, req *pb_v1.ProvincialPostTeamRequest) (reply *pb_v1.ProvincialPostTeamReply, err error) {
  58. t1 := func() error {
  59. reply, err = provincial_department.ProvincialPostTeam(ctx, req)
  60. return err
  61. }
  62. return reply, rpctasker.Exec(ctx, t1)
  63. }
  64. func (c *Rcvr) ProvincialPostStaff(ctx context.Context, req *pb_v1.ProvincialPostStaffRequest) (reply *pb_v1.ProvincialPostStaffReply, err error) {
  65. t1 := func() error {
  66. reply, err = provincial_department.ProvincialPostStaff(ctx, req)
  67. return err
  68. }
  69. return reply, rpctasker.Exec(ctx, t1)
  70. }
  71. func (c *Rcvr) ProvincialPostStaffAttendance(ctx context.Context, req *pb_v1.ProvincialPostStaffAttendanceRequest) (reply *pb_v1.ProvincialPostStaffAttendanceReply, err error) {
  72. t1 := func() error {
  73. reply, err = provincial_department.ProvincialPostStaffAttendance(ctx, req)
  74. return err
  75. }
  76. return reply, rpctasker.Exec(ctx, t1)
  77. }