rcvr.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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. "property-system/impl/v1/application"
  7. "property-system/impl/v1/department"
  8. "property-system/impl/v1/garden"
  9. "property-system/impl/v1/permission"
  10. "property-system/impl/v1/spackage"
  11. "property-system/impl/v1/user"
  12. "property-system/pb"
  13. pb_v1 "property-system/pb/v1"
  14. "git.getensh.com/common/gopkgs/tasker/rpctasker"
  15. "google.golang.org/grpc"
  16. )
  17. // 具体实现
  18. type Rcvr struct {
  19. }
  20. func Register(s *grpc.Server) {
  21. pb.RegisterSystemServer(s, &Rcvr{})
  22. }
  23. // 系统用户登录
  24. func (c *Rcvr) Login(ctx context.Context, req *pb_v1.LoginRequest) (reply *pb_v1.LoginReply, err error) {
  25. t1 := func() error {
  26. reply, err = user.Login(ctx, req)
  27. return err
  28. }
  29. return reply, rpctasker.Exec(ctx, t1)
  30. }
  31. // 权限变更后重新获取权限
  32. func (c *Rcvr) PermissionReget(ctx context.Context, req *pb_v1.PermissionRegetRequest) (reply *pb_v1.PermissionRegetReply, err error) {
  33. t1 := func() error {
  34. reply, err = user.PermissionReget(ctx, req)
  35. return err
  36. }
  37. return reply, rpctasker.Exec(ctx, t1)
  38. }
  39. func (c *Rcvr) GardenChangeCompany(ctx context.Context, req *pb_v1.GardenChangeCompanyRequest) (reply *pb_v1.GardenChangeCompanyReply, err error) {
  40. t1 := func() error {
  41. reply, err = garden.GardenChangeCompany(ctx, req)
  42. return err
  43. }
  44. return reply, rpctasker.Exec(ctx, t1)
  45. }
  46. func (c *Rcvr) GardenInfos(ctx context.Context, req *pb_v1.GardenInfosRequest) (reply *pb_v1.GardenInfosReply, err error) {
  47. t1 := func() error {
  48. reply, err = garden.GardenInfos(ctx, req)
  49. return err
  50. }
  51. return reply, rpctasker.Exec(ctx, t1)
  52. }
  53. func (c *Rcvr) GardenIds(ctx context.Context, req *pb_v1.GardenIdsRequest) (reply *pb_v1.GardenIdsReply, err error) {
  54. t1 := func() error {
  55. reply, err = garden.GardenIds(ctx, req)
  56. return err
  57. }
  58. return reply, rpctasker.Exec(ctx, t1)
  59. }
  60. func (c *Rcvr) GardenList(ctx context.Context, req *pb_v1.GardenListRequest) (reply *pb_v1.GardenListReply, err error) {
  61. t1 := func() error {
  62. reply, err = garden.GardenList(ctx, req)
  63. return err
  64. }
  65. return reply, rpctasker.Exec(ctx, t1)
  66. }
  67. func (c *Rcvr) GardenAdd(ctx context.Context, req *pb_v1.GardenAddRequest) (reply *pb_v1.GardenAddReply, err error) {
  68. t1 := func() error {
  69. reply, err = garden.GardenAdd(ctx, req)
  70. return err
  71. }
  72. return reply, rpctasker.Exec(ctx, t1)
  73. }
  74. func (c *Rcvr) GardenUpdate(ctx context.Context, req *pb_v1.GardenUpdateRequest) (reply *pb_v1.GardenUpdateReply, err error) {
  75. t1 := func() error {
  76. reply, err = garden.GardenUpdate(ctx, req)
  77. return err
  78. }
  79. return reply, rpctasker.Exec(ctx, t1)
  80. }
  81. func (c *Rcvr) GardenDel(ctx context.Context, req *pb_v1.GardenDelRequest) (reply *pb_v1.GardenDelReply, err error) {
  82. t1 := func() error {
  83. reply, err = garden.GardenDel(ctx, req)
  84. return err
  85. }
  86. return reply, rpctasker.Exec(ctx, t1)
  87. }
  88. func (c *Rcvr) GardenKeyInfoChange(ctx context.Context, req *pb_v1.GardenKeyInfoChangeRequest) (reply *pb_v1.GardenKeyInfoChangeReply, err error) {
  89. t1 := func() error {
  90. reply, err = garden.GardenKeyInfoChange(ctx, req)
  91. return err
  92. }
  93. return reply, rpctasker.Exec(ctx, t1)
  94. }
  95. func (c *Rcvr) GardenKeyInfoApprove(ctx context.Context, req *pb_v1.GardenKeyInfoApproveRequest) (reply *pb_v1.GardenKeyInfoApproveReply, err error) {
  96. t1 := func() error {
  97. reply, err = garden.GardenKeyInfoApprove(ctx, req)
  98. return err
  99. }
  100. return reply, rpctasker.Exec(ctx, t1)
  101. }
  102. func (c *Rcvr) GardenKeyInfoChangeList(ctx context.Context, req *pb_v1.GardenKeyInfoChangeListRequest) (reply *pb_v1.GardenKeyInfoChangeListReply, err error) {
  103. t1 := func() error {
  104. reply, err = garden.GardenKeyInfoChangeList(ctx, req)
  105. return err
  106. }
  107. return reply, rpctasker.Exec(ctx, t1)
  108. }
  109. func (c *Rcvr) GardenApprove(ctx context.Context, req *pb_v1.GardenApproveRequest) (reply *pb_v1.GardenApproveReply, err error) {
  110. t1 := func() error {
  111. reply, err = garden.GardenApprove(ctx, req)
  112. return err
  113. }
  114. return reply, rpctasker.Exec(ctx, t1)
  115. }
  116. func (c *Rcvr) GardenEnableSet(ctx context.Context, req *pb_v1.GardenEnableSetRequest) (reply *pb_v1.GardenEnableSetReply, err error) {
  117. t1 := func() error {
  118. reply, err = garden.GardenEnableSet(ctx, req)
  119. return err
  120. }
  121. return reply, rpctasker.Exec(ctx, t1)
  122. }
  123. // 设置小区支付商户号
  124. func (c *Rcvr) GardenSetMch(ctx context.Context, req *pb_v1.GardenSetMchRequest) (reply *pb_v1.GardenSetMchReply, err error) {
  125. t1 := func() error {
  126. reply, err = garden.GardenSetMch(ctx, req)
  127. return err
  128. }
  129. return reply, rpctasker.Exec(ctx, t1)
  130. }
  131. func (c *Rcvr) GardenHouseCountLimit(ctx context.Context, req *pb_v1.GardenHouseCountLimitRequest) (reply *pb_v1.GardenHouseCountLimitReply, err error) {
  132. t1 := func() error {
  133. reply, err = garden.GardenHouseCountLimit(ctx, req)
  134. return err
  135. }
  136. return reply, rpctasker.Exec(ctx, t1)
  137. }
  138. func (c *Rcvr) GardenHouseCountChange(ctx context.Context, req *pb_v1.GardenHouseCountChangeRequest) (reply *pb_v1.GardenHouseCountChangeReply, err error) {
  139. t1 := func() error {
  140. reply, err = garden.GardenHouseCountChange(ctx, req)
  141. return err
  142. }
  143. return reply, rpctasker.Exec(ctx, t1)
  144. }
  145. // 设置小区支付模式
  146. func (c *Rcvr) GardenSetMchPayMode(ctx context.Context, req *pb_v1.GardenSetMchPayModeRequest) (reply *pb_v1.GardenSetMchPayModeReply, err error) {
  147. t1 := func() error {
  148. reply, err = garden.GardenSetMchPayMode(ctx, req)
  149. return err
  150. }
  151. return reply, rpctasker.Exec(ctx, t1)
  152. }
  153. // 获取公司下的小区支付模式信息
  154. func (c *Rcvr) CompanyMchGardenList(ctx context.Context, req *pb_v1.CompanyMchGardenListRequest) (reply *pb_v1.CompanyMchGardenListReply, err error) {
  155. t1 := func() error {
  156. reply, err = garden.CompanyMchGardenList(ctx, req)
  157. return err
  158. }
  159. return reply, rpctasker.Exec(ctx, t1)
  160. }
  161. func (c *Rcvr) LoginByPhone(ctx context.Context, req *pb_v1.LoginByPhoneRequest) (reply *pb_v1.LoginByPhoneReply, err error) {
  162. t1 := func() error {
  163. reply, err = user.LoginByPhone(ctx, req)
  164. return err
  165. }
  166. return reply, rpctasker.Exec(ctx, t1)
  167. }
  168. func (c *Rcvr) CheckPhone(ctx context.Context, req *pb_v1.CheckPhoneRequest) (reply *pb_v1.CheckPhoneReply, err error) {
  169. t1 := func() error {
  170. reply, err = user.CheckPhone(ctx, req)
  171. return err
  172. }
  173. return reply, rpctasker.Exec(ctx, t1)
  174. }
  175. func (c *Rcvr) CompanyEnterGarden(ctx context.Context, req *pb_v1.CompanyEnterGardenRequest) (reply *pb_v1.CompanyEnterGardenReply, err error) {
  176. t1 := func() error {
  177. reply, err = user.CompanyEnterGarden(ctx, req)
  178. return err
  179. }
  180. return reply, rpctasker.Exec(ctx, t1)
  181. }
  182. // 忘记密码重置密码
  183. func (c *Rcvr) ResetPassword(ctx context.Context, req *pb_v1.ResetPasswordRequest) (reply *pb_v1.ResetPasswordReply, err error) {
  184. t1 := func() error {
  185. reply, err = user.ResetPassword(ctx, req)
  186. return err
  187. }
  188. return reply, rpctasker.Exec(ctx, t1)
  189. }
  190. // 登录后修改密码
  191. func (c *Rcvr) ChangePassword(ctx context.Context, req *pb_v1.ChangePasswordRequest) (reply *pb_v1.ChangePasswordReply, err error) {
  192. t1 := func() error {
  193. reply, err = user.ChangePassword(ctx, req)
  194. return err
  195. }
  196. return reply, rpctasker.Exec(ctx, t1)
  197. }
  198. func (c *Rcvr) UserAdd(ctx context.Context, req *pb_v1.UserAddRequest) (reply *pb_v1.UserAddReply, err error) {
  199. t1 := func() error {
  200. reply, err = user.UserAdd(ctx, req)
  201. return err
  202. }
  203. return reply, rpctasker.Exec(ctx, t1)
  204. }
  205. func (c *Rcvr) UserDel(ctx context.Context, req *pb_v1.UserDelRequest) (reply *pb_v1.UserDelReply, err error) {
  206. t1 := func() error {
  207. reply, err = user.UserDel(ctx, req)
  208. return err
  209. }
  210. return reply, rpctasker.Exec(ctx, t1)
  211. }
  212. func (c *Rcvr) UserUpdate(ctx context.Context, req *pb_v1.UserUpdateRequest) (reply *pb_v1.UserUpdateReply, err error) {
  213. t1 := func() error {
  214. reply, err = user.UserUpdate(ctx, req)
  215. return err
  216. }
  217. return reply, rpctasker.Exec(ctx, t1)
  218. }
  219. func (c *Rcvr) UserList(ctx context.Context, req *pb_v1.UserListRequest) (reply *pb_v1.UserListReply, err error) {
  220. t1 := func() error {
  221. reply, err = user.UserList(ctx, req)
  222. return err
  223. }
  224. return reply, rpctasker.Exec(ctx, t1)
  225. }
  226. func (c *Rcvr) UserGardenChange(ctx context.Context, req *pb_v1.UserGardenChangeRequest) (reply *pb_v1.UserGardenChangeReply, err error) {
  227. t1 := func() error {
  228. reply, err = user.UserGardenChange(ctx, req)
  229. return err
  230. }
  231. return reply, rpctasker.Exec(ctx, t1)
  232. }
  233. func (c *Rcvr) GroupAdd(ctx context.Context, req *pb_v1.GroupAddRequest) (reply *pb_v1.GroupAddReply, err error) {
  234. t1 := func() error {
  235. reply, err = permission.GroupAdd(ctx, req)
  236. return err
  237. }
  238. return reply, rpctasker.Exec(ctx, t1)
  239. }
  240. func (c *Rcvr) GroupDel(ctx context.Context, req *pb_v1.GroupDelRequest) (reply *pb_v1.GroupDelReply, err error) {
  241. t1 := func() error {
  242. reply, err = permission.GroupDel(ctx, req)
  243. return err
  244. }
  245. return reply, rpctasker.Exec(ctx, t1)
  246. }
  247. func (c *Rcvr) GroupUpdate(ctx context.Context, req *pb_v1.GroupUpdateRequest) (reply *pb_v1.GroupUpdateReply, err error) {
  248. t1 := func() error {
  249. reply, err = permission.GroupUpdate(ctx, req)
  250. return err
  251. }
  252. return reply, rpctasker.Exec(ctx, t1)
  253. }
  254. func (c *Rcvr) GardenPermissionList(ctx context.Context, req *pb_v1.GardenPermissionListRequest) (reply *pb_v1.GardenPermissionListReply, err error) {
  255. t1 := func() error {
  256. reply, err = permission.GardenPermissionList(ctx, req)
  257. return err
  258. }
  259. return reply, rpctasker.Exec(ctx, t1)
  260. }
  261. func (c *Rcvr) GroupList(ctx context.Context, req *pb_v1.GroupListRequest) (reply *pb_v1.GroupListReply, err error) {
  262. t1 := func() error {
  263. reply, err = permission.GroupList(ctx, req)
  264. return err
  265. }
  266. return reply, rpctasker.Exec(ctx, t1)
  267. }
  268. func (c *Rcvr) GroupInfo(ctx context.Context, req *pb_v1.GroupInfoRequest) (reply *pb_v1.GroupInfoReply, err error) {
  269. t1 := func() error {
  270. reply, err = permission.GroupInfo(ctx, req)
  271. return err
  272. }
  273. return reply, rpctasker.Exec(ctx, t1)
  274. }
  275. func (c *Rcvr) SuperGroup(ctx context.Context, req *pb_v1.SuperGroupRequest) (reply *pb_v1.SuperGroupReply, err error) {
  276. t1 := func() error {
  277. reply, err = permission.SuperGroup(ctx, req)
  278. return err
  279. }
  280. return reply, rpctasker.Exec(ctx, t1)
  281. }
  282. func (c *Rcvr) DepartmentAdd(ctx context.Context, req *pb_v1.DepartmentAddRequest) (reply *pb_v1.DepartmentAddReply, err error) {
  283. t1 := func() error {
  284. reply, err = department.DepartmentAdd(ctx, req)
  285. return err
  286. }
  287. return reply, rpctasker.Exec(ctx, t1)
  288. }
  289. func (c *Rcvr) DepartmentDel(ctx context.Context, req *pb_v1.DepartmentDelRequest) (reply *pb_v1.DepartmentDelReply, err error) {
  290. t1 := func() error {
  291. reply, err = department.DepartmentDel(ctx, req)
  292. return err
  293. }
  294. return reply, rpctasker.Exec(ctx, t1)
  295. }
  296. func (c *Rcvr) DepartmentUpdate(ctx context.Context, req *pb_v1.DepartmentUpdateRequest) (reply *pb_v1.DepartmentUpdateReply, err error) {
  297. t1 := func() error {
  298. reply, err = department.DepartmentUpdate(ctx, req)
  299. return err
  300. }
  301. return reply, rpctasker.Exec(ctx, t1)
  302. }
  303. func (c *Rcvr) DepartmentList(ctx context.Context, req *pb_v1.DepartmentListRequest) (reply *pb_v1.DepartmentListReply, err error) {
  304. t1 := func() error {
  305. reply, err = department.DepartmentList(ctx, req)
  306. return err
  307. }
  308. return reply, rpctasker.Exec(ctx, t1)
  309. }
  310. // 应用相关
  311. func (c *Rcvr) ApplicationOrderAdd(ctx context.Context, req *pb_v1.ApplicationOrderAddRequest) (reply *pb_v1.ApplicationOrderAddReply, err error) {
  312. t1 := func() error {
  313. reply, err = application.ApplicationOrderAdd(ctx, req)
  314. return err
  315. }
  316. return reply, rpctasker.Exec(ctx, t1)
  317. }
  318. func (c *Rcvr) ApplicationOrderApprove(ctx context.Context, req *pb_v1.ApplicationOrderApproveRequest) (reply *pb_v1.ApplicationOrderApproveReply, err error) {
  319. t1 := func() error {
  320. reply, err = application.ApplicationOrderApprove(ctx, req)
  321. return err
  322. }
  323. return reply, rpctasker.Exec(ctx, t1)
  324. }
  325. func (c *Rcvr) ApplicationOrderAmount(ctx context.Context, req *pb_v1.ApplicationOrderAmountRequest) (reply *pb_v1.ApplicationOrderAmountReply, err error) {
  326. t1 := func() error {
  327. reply, err = application.ApplicationOrderAmount(ctx, req)
  328. return err
  329. }
  330. return reply, rpctasker.Exec(ctx, t1)
  331. }
  332. func (c *Rcvr) GardenApplicationList(ctx context.Context, req *pb_v1.GardenApplicationListRequest) (reply *pb_v1.GardenApplicationListReply, err error) {
  333. t1 := func() error {
  334. reply, err = application.GardenApplicationList(ctx, req)
  335. return err
  336. }
  337. return reply, rpctasker.Exec(ctx, t1)
  338. }
  339. // 套餐相关
  340. func (c *Rcvr) PackageOrderAdd(ctx context.Context, req *pb_v1.PackageOrderAddRequest) (reply *pb_v1.PackageOrderAddReply, err error) {
  341. t1 := func() error {
  342. reply, err = spackage.PackageOrderAdd(ctx, req)
  343. return err
  344. }
  345. return reply, rpctasker.Exec(ctx, t1)
  346. }
  347. func (c *Rcvr) PackageOrderApprove(ctx context.Context, req *pb_v1.PackageOrderApproveRequest) (reply *pb_v1.PackageOrderApproveReply, err error) {
  348. t1 := func() error {
  349. reply, err = spackage.PackageOrderApprove(ctx, req)
  350. return err
  351. }
  352. return reply, rpctasker.Exec(ctx, t1)
  353. }
  354. func (c *Rcvr) PackageOrderAmount(ctx context.Context, req *pb_v1.PackageOrderAmountRequest) (reply *pb_v1.PackageOrderAmountReply, err error) {
  355. t1 := func() error {
  356. reply, err = spackage.PackageOrderAmount(ctx, req)
  357. return err
  358. }
  359. return reply, rpctasker.Exec(ctx, t1)
  360. }
  361. func (c *Rcvr) CompanyPackageList(ctx context.Context, req *pb_v1.CompanyPackageListRequest) (reply *pb_v1.CompanyPackageListReply, err error) {
  362. t1 := func() error {
  363. reply, err = spackage.CompanyPackageList(ctx, req)
  364. return err
  365. }
  366. return reply, rpctasker.Exec(ctx, t1)
  367. }