rcvr.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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-government-management/pb"
  7. "smart-government-management/pb/v1"
  8. "github.com/jaryhe/gopkgs/tasker/rpctasker"
  9. "google.golang.org/grpc"
  10. "smart-government-management/impl/v1/provider"
  11. "smart-government-management/impl/v1/device"
  12. "smart-government-management/impl/v1/user"
  13. "smart-government-management/impl/v1/alarm"
  14. "smart-government-management/impl/v1/company"
  15. "smart-government-management/impl/v1/dust"
  16. "smart-government-management/impl/v1/staff"
  17. "smart-government-management/impl/v1/tower"
  18. )
  19. // 具体实现
  20. type Rcvr struct {
  21. }
  22. func Register(s *grpc.Server) {
  23. pb.RegisterSmartSiteGovernmentServer(s, &Rcvr{})
  24. }
  25. func (c *Rcvr) ChangePasswd(ctx context.Context, req *v1.ChangePasswdRequest) (reply *v1.ChangePasswdReply, err error) {
  26. t1 := func() error {
  27. reply, err = user.ChangePasswd(ctx, req)
  28. return err
  29. }
  30. return reply, rpctasker.Exec(ctx, t1)
  31. }
  32. func (c *Rcvr) EmailUpdate(ctx context.Context, req *v1.EmailUpdateRequest) (reply *v1.EmailUpdateReply, err error) {
  33. t1 := func() error {
  34. reply, err = user.EmailUpdate(ctx, req)
  35. return err
  36. }
  37. return reply, rpctasker.Exec(ctx, t1)
  38. }
  39. func (c *Rcvr) EmailPrepare(ctx context.Context, req *v1.EmailPrepareRequest) (reply *v1.EmailPrepareReply, err error) {
  40. t1 := func() error {
  41. reply, err = user.EmailPrepare(ctx, req)
  42. return err
  43. }
  44. return reply, rpctasker.Exec(ctx, t1)
  45. }
  46. func (c *Rcvr) PhoneUpdate(ctx context.Context, req *v1.PhoneUpdateRequest) (reply *v1.PhoneUpdateReply, err error) {
  47. t1 := func() error {
  48. reply, err = user.PhoneUpdate(ctx, req)
  49. return err
  50. }
  51. return reply, rpctasker.Exec(ctx, t1)
  52. }
  53. func (c *Rcvr) UserInfo(ctx context.Context, req *v1.UserInfoRequest) (reply *v1.UserInfoReply, err error) {
  54. t1 := func() error {
  55. reply, err = user.UserInfo(ctx, req)
  56. return err
  57. }
  58. return reply, rpctasker.Exec(ctx, t1)
  59. }
  60. func (c *Rcvr) SetPhone(ctx context.Context, req *v1.SetPhoneRequest) (reply *v1.SetPhoneReply, err error) {
  61. t1 := func() error {
  62. reply, err = user.SetPhone(ctx, req)
  63. return err
  64. }
  65. return reply, rpctasker.Exec(ctx, t1)
  66. }
  67. func (c *Rcvr) GetPhone(ctx context.Context, req *v1.GetPhoneRequest) (reply *v1.GetPhoneReply, err error) {
  68. t1 := func() error {
  69. reply, err = user.GetPhone(ctx, req)
  70. return err
  71. }
  72. return reply, rpctasker.Exec(ctx, t1)
  73. }
  74. func (c *Rcvr) Publicity(ctx context.Context, req *v1.PublicityRequest) (reply *v1.PublicityReply, err error) {
  75. t1 := func() error {
  76. reply, err = provider.Publicity(ctx, req)
  77. return err
  78. }
  79. return reply, rpctasker.Exec(ctx, t1)
  80. }
  81. func (c *Rcvr) DeviceTypeList(ctx context.Context, req *v1.DeviceTypeListRequest) (reply *v1.DeviceTypeListReply, err error) {
  82. t1 := func() error {
  83. reply, err = device.DeviceTypeList(ctx, req)
  84. return err
  85. }
  86. return reply, rpctasker.Exec(ctx, t1)
  87. }
  88. func (c *Rcvr) DeviceAllTypeList(ctx context.Context, req *v1.DeviceAllTypeListRequest) (reply *v1.DeviceAllTypeListReply, err error) {
  89. t1 := func() error {
  90. reply, err = device.DeviceAllTypeList(ctx, req)
  91. return err
  92. }
  93. return reply, rpctasker.Exec(ctx, t1)
  94. }
  95. func (c *Rcvr) DeviceList(ctx context.Context, req *v1.DeviceListRequest) (reply *v1.DeviceListReply, err error) {
  96. t1 := func() error {
  97. reply, err = device.DeviceList(ctx, req)
  98. return err
  99. }
  100. return reply, rpctasker.Exec(ctx, t1)
  101. }
  102. func (c *Rcvr) ChannelList(ctx context.Context, req *v1.ChannelListRequest) (reply *v1.ChannelListReply, err error) {
  103. t1 := func() error {
  104. reply, err = device.ChannelList(ctx, req)
  105. return err
  106. }
  107. return reply, rpctasker.Exec(ctx, t1)
  108. }
  109. func (c *Rcvr) VedioList(ctx context.Context, req *v1.VedioListRequest) (reply *v1.VedioListReply, err error) {
  110. t1 := func() error {
  111. reply, err = device.VedioList(ctx, req)
  112. return err
  113. }
  114. return reply, rpctasker.Exec(ctx, t1)
  115. }
  116. func (c *Rcvr) DockingApprove(ctx context.Context, req *v1.DockingApproveRequest) (reply *v1.DockingApproveReply, err error) {
  117. t1 := func() error {
  118. reply, err = device.DockingApprove(ctx, req)
  119. return err
  120. }
  121. return reply, rpctasker.Exec(ctx, t1)
  122. }
  123. func (c *Rcvr) ProviderList(ctx context.Context, req *v1.ProviderListRequest) (reply *v1.ProviderListReply, err error) {
  124. t1 := func() error {
  125. reply, err = provider.ProviderList(ctx, req)
  126. return err
  127. }
  128. return reply, rpctasker.Exec(ctx, t1)
  129. }
  130. func (c *Rcvr) ProviderApprove(ctx context.Context, req *v1.ProviderApproveRequest) (reply *v1.ProviderApproveReply, err error) {
  131. t1 := func() error {
  132. reply, err = provider.ProviderApprove(ctx, req)
  133. return err
  134. }
  135. return reply, rpctasker.Exec(ctx, t1)
  136. }
  137. func (c *Rcvr) Login(ctx context.Context, req *v1.LoginRequest) (reply *v1.LoginReply, err error) {
  138. t1 := func() error {
  139. reply, err = user.Login(ctx, req)
  140. return err
  141. }
  142. return reply, rpctasker.Exec(ctx, t1)
  143. }
  144. func (c *Rcvr) CompanyList(ctx context.Context, req *v1.CompanyListRequest) (reply *v1.CompanyListReply, err error) {
  145. t1 := func() error {
  146. reply, err = company.CompanyList(ctx, req)
  147. return err
  148. }
  149. return reply, rpctasker.Exec(ctx, t1)
  150. }
  151. func (c *Rcvr) ProjectList(ctx context.Context, req *v1.ProjectListRequest) (reply *v1.ProjectListReply, err error) {
  152. t1 := func() error {
  153. reply, err = company.ProjectList(ctx, req)
  154. return err
  155. }
  156. return reply, rpctasker.Exec(ctx, t1)
  157. }
  158. func (c *Rcvr) ProjectChangeInfoList(ctx context.Context, req *v1.ProjectChangeInfoListRequest) (reply *v1.ProjectChangeInfoListReply, err error) {
  159. t1 := func() error {
  160. reply, err = company.ProjectChangeInfoList(ctx, req)
  161. return err
  162. }
  163. return reply, rpctasker.Exec(ctx, t1)
  164. }
  165. func (c *Rcvr) CompanyApprove(ctx context.Context, req *v1.CompanyApproveRequest) (reply *v1.CompanyApproveReply, err error) {
  166. t1 := func() error {
  167. reply, err = company.CompanyApprove(ctx, req)
  168. return err
  169. }
  170. return reply, rpctasker.Exec(ctx, t1)
  171. }
  172. func (c *Rcvr) ProjectStatistic(ctx context.Context, req *v1.ProjectStatisticRequest) (reply *v1.ProjectStatisticReply, err error) {
  173. t1 := func() error {
  174. reply, err = company.ProjectStatistic(ctx, req)
  175. return err
  176. }
  177. return reply, rpctasker.Exec(ctx, t1)
  178. }
  179. func (c *Rcvr) ProjectTypeStatistic(ctx context.Context, req *v1.ProjectTypeStatisticRequest) (reply *v1.ProjectTypeStatisticReply, err error) {
  180. t1 := func() error {
  181. reply, err = company.ProjectTypeStatistic(ctx, req)
  182. return err
  183. }
  184. return reply, rpctasker.Exec(ctx, t1)
  185. }
  186. func (c *Rcvr) StaffStatistic(ctx context.Context, req *v1.StaffStatisticRequest) (reply *v1.StaffStatisticReply, err error) {
  187. t1 := func() error {
  188. reply, err = company.StaffStatistic(ctx, req)
  189. return err
  190. }
  191. return reply, rpctasker.Exec(ctx, t1)
  192. }
  193. func (c *Rcvr) CompanyStatistic(ctx context.Context, req *v1.CompanyStatisticRequest) (reply *v1.CompanyStatisticReply, err error) {
  194. t1 := func() error {
  195. reply, err = company.CompanyStatistic(ctx, req)
  196. return err
  197. }
  198. return reply, rpctasker.Exec(ctx, t1)
  199. }
  200. func (c *Rcvr) DeviceDelJobList(ctx context.Context, req *v1.DeviceDelJobListRequest) (reply *v1.DeviceDelJobListReply, err error) {
  201. t1 := func() error {
  202. reply, err = device.DeviceDelJobList(ctx, req)
  203. return err
  204. }
  205. return reply, rpctasker.Exec(ctx, t1)
  206. }
  207. func (c *Rcvr) DeviceStatistic(ctx context.Context, req *v1.DeviceStatisticRequest) (reply *v1.DeviceStatisticReply, err error) {
  208. t1 := func() error {
  209. reply, err = device.DeviceStatistic(ctx, req)
  210. return err
  211. }
  212. return reply, rpctasker.Exec(ctx, t1)
  213. }
  214. func (c *Rcvr) DeviceTypeStatistic(ctx context.Context, req *v1.DeviceTypeStatisticRequest) (reply *v1.DeviceTypeStatisticReply, err error) {
  215. t1 := func() error {
  216. reply, err = device.DeviceTypeStatistic(ctx, req)
  217. return err
  218. }
  219. return reply, rpctasker.Exec(ctx, t1)
  220. }
  221. func (c *Rcvr) SetPasswd(ctx context.Context, req *v1.SetPasswdRequest) (reply *v1.SetPasswdReply, err error) {
  222. t1 := func() error {
  223. reply, err = user.SetPasswd(ctx, req)
  224. return err
  225. }
  226. return reply, rpctasker.Exec(ctx, t1)
  227. }
  228. func (c *Rcvr) AlarmList(ctx context.Context, req *v1.AlarmListRequest) (reply *v1.AlarmListReply, err error) {
  229. t1 := func() error {
  230. reply, err = alarm.AlarmList(ctx, req)
  231. return err
  232. }
  233. return reply, rpctasker.Exec(ctx, t1)
  234. }
  235. func (c *Rcvr) AlarmHandle(ctx context.Context, req *v1.AlarmHandleRequest) (reply *v1.AlarmHandleReply, err error) {
  236. t1 := func() error {
  237. reply, err = alarm.AlarmHandle(ctx, req)
  238. return err
  239. }
  240. return reply, rpctasker.Exec(ctx, t1)
  241. }
  242. func (c *Rcvr) AlarmProject(ctx context.Context, req *v1.AlarmProjectRequest) (reply *v1.AlarmProjectReply, err error) {
  243. t1 := func() error {
  244. reply, err = alarm.AlarmProject(ctx, req)
  245. return err
  246. }
  247. return reply, rpctasker.Exec(ctx, t1)
  248. }
  249. func (c *Rcvr) AlarmReasonStatistic(ctx context.Context, req *v1.AlarmReasonStatisticRequest) (reply *v1.AlarmReasonStatisticReply, err error) {
  250. t1 := func() error {
  251. reply, err = alarm.AlarmReasonStatistic(ctx, req)
  252. return err
  253. }
  254. return reply, rpctasker.Exec(ctx, t1)
  255. }
  256. func (c *Rcvr) AlarmDeviceStatistic(ctx context.Context, req *v1.AlarmDeviceStatisticRequest) (reply *v1.AlarmDeviceStatisticReply, err error) {
  257. t1 := func() error {
  258. reply, err = alarm.AlarmDeviceStatistic(ctx, req)
  259. return err
  260. }
  261. return reply, rpctasker.Exec(ctx, t1)
  262. }
  263. func (c *Rcvr) AlarmIncreaseStatistic(ctx context.Context, req *v1.AlarmIncreaseStatisticRequest) (reply *v1.AlarmIncreaseStatisticReply, err error) {
  264. t1 := func() error {
  265. reply, err = alarm.AlarmIncreaseStatistic(ctx, req)
  266. return err
  267. }
  268. return reply, rpctasker.Exec(ctx, t1)
  269. }
  270. func (c *Rcvr) AlarmPercentStatistic(ctx context.Context, req *v1.AlarmPercentStatisticRequest) (reply *v1.AlarmPercentStatisticReply, err error) {
  271. t1 := func() error {
  272. reply, err = alarm.AlarmPercentStatistic(ctx, req)
  273. return err
  274. }
  275. return reply, rpctasker.Exec(ctx, t1)
  276. }
  277. func (c *Rcvr) DustAqi(ctx context.Context, req *v1.DustAqiRequest) (reply *v1.DustAqiReply, err error) {
  278. t1 := func() error {
  279. reply, err = dust.DustAqi(ctx, req)
  280. return err
  281. }
  282. return reply, rpctasker.Exec(ctx, t1)
  283. }
  284. // 最近一次扬尘数据
  285. func (c *Rcvr) LatestDustMonitorData(ctx context.Context, req *v1.LatestDustMonitorDataRequest) (reply *v1.LatestDustMonitorDataReply, err error) {
  286. t1 := func() error {
  287. reply, err = dust.LatestDustMonitorData(ctx, req)
  288. return err
  289. }
  290. return reply, rpctasker.Exec(ctx, t1)
  291. }
  292. func (c *Rcvr) StaffTypeStatistics(ctx context.Context, req *v1.StaffTypeStatisticsRequest) (reply *v1.StaffTypeStatisticsReply, err error) {
  293. t1 := func() error {
  294. reply, err = staff.StaffTypeStatistics(ctx, req)
  295. return err
  296. }
  297. return reply, rpctasker.Exec(ctx, t1)
  298. }
  299. func (c *Rcvr) LaborCompanyStatistics(ctx context.Context, req *v1.LaborCompanyStatisticsRequest) (reply *v1.LaborCompanyStatisticsReply, err error) {
  300. t1 := func() error {
  301. reply, err = staff.LaborCompanyStatistics(ctx, req)
  302. return err
  303. }
  304. return reply, rpctasker.Exec(ctx, t1)
  305. }
  306. func (c *Rcvr) StaffWorkTypeStatistics(ctx context.Context, req *v1.StaffWorkTypeStatisticsRequest) (reply *v1.StaffWorkTypeStatisticsReply, err error) {
  307. t1 := func() error {
  308. reply, err = staff.StaffWorkTypeStatistics(ctx, req)
  309. return err
  310. }
  311. return reply, rpctasker.Exec(ctx, t1)
  312. }
  313. func (c *Rcvr) LatestTowerMonitorData(ctx context.Context, req *v1.LatestTowerMonitorDataRequest) (reply *v1.LatestTowerMonitorDataReply, err error) {
  314. t1 := func() error {
  315. reply, err = tower.LatestTowerMonitorData(ctx, req)
  316. return err
  317. }
  318. return reply, rpctasker.Exec(ctx, t1)
  319. }