suggestion.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. package v1
  2. import (
  3. "git.getensh.com/common/gopkgs/logger"
  4. "git.getensh.com/common/gopkgs/tasker/httptasker"
  5. "git.getensh.com/common/gopkgs/util"
  6. "github.com/gin-gonic/gin"
  7. "go.uber.org/zap"
  8. "net/http"
  9. "property-applete-gateway/errors"
  10. param_v1 "property-applete-gateway/param/v1"
  11. "property-applete-gateway/pb"
  12. "property-applete-gateway/pb/v1"
  13. "property-applete-gateway/utils"
  14. )
  15. //
  16. // @Summary 新增工单
  17. // @Description 新增工单
  18. // @Tags 投诉与建议
  19. // @Accept json
  20. // @Produce json
  21. // @Param token header string true "token"
  22. // @Param body body v1.SuggestionOrderAddBody true "信息"
  23. // @Success 200 {object} v1.SuggestionOrderAddResponse
  24. // @Failure 500 {object} base.HTTPError
  25. // @Router /api/v1/suggestion/order [post]
  26. func (c *Controller) SuggestionOrderAdd(ctx *gin.Context) {
  27. // 解析参数
  28. req := &param_v1.SuggestionOrderAddRequest{}
  29. parseParamTask := func() error {
  30. err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.SuggestionOrderAddBody)
  31. if err != nil {
  32. logger.Error("func",
  33. zap.String("call", "util.ShouldBind"),
  34. zap.String("error", err.Error()))
  35. return errors.ParamsError
  36. }
  37. return nil
  38. }
  39. // 业务处理
  40. handleServiceTask := func() error {
  41. tokenInfo, err := utils.GetSubjectValue(ctx)
  42. if err != nil {
  43. return err
  44. }
  45. // 响应数据
  46. resp := param_v1.SuggestionOrderAddResponse{}
  47. rpcReq := &v1.SuggestionOrderAddRequest{
  48. GardenId:tokenInfo.GardenId,
  49. SuggestionType:req.SuggestionType,
  50. // 报修人
  51. ApplyPeople:req.ApplyPeople,
  52. // 报修人电话
  53. ApplyPeoplePhone:req.ApplyPeoplePhone,
  54. // 上级处理人
  55. LastUid:tokenInfo.Uid,
  56. // 报修内容
  57. ApplyContent:req.ApplyContent,
  58. // 报修图片
  59. ApplyPic:req.ApplyPic,
  60. ByCompany:tokenInfo.ByCompany,
  61. HouseholdUid:0,
  62. }
  63. rpcRsp, err := pb.Garden.SuggestionOrderAdd(ctx, rpcReq)
  64. if err != nil {
  65. s, _ := json.MarshalToString(req)
  66. logger.Error("func",
  67. zap.String("call", "pb.Garden.SuggestionOrderAdd"),
  68. zap.String("params", s),
  69. zap.String("error", err.Error()))
  70. return errors.ErrorTransForm(err)
  71. }
  72. resp.Data = *rpcRsp
  73. ctx.JSON(http.StatusOK, resp)
  74. logReq := OperationLogRequest{
  75. Module:ModuleSuggestion,
  76. Action:ActionSuggestionOrderAdd,
  77. Origin:nil,
  78. Target:req.SuggestionOrderAddBody,
  79. UserName:tokenInfo.UserName,
  80. Uid:tokenInfo.Uid,
  81. Cid:tokenInfo.Cid,
  82. GardenId:tokenInfo.GardenId,
  83. }
  84. go OperationLogAdd(&logReq)
  85. return nil
  86. }
  87. // 执行任务
  88. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  89. }
  90. //
  91. // @Summary 修改工单
  92. // @Description 修改工单
  93. // @Tags 投诉与建议
  94. // @Accept json
  95. // @Produce json
  96. // @Param token header string true "token"
  97. // @Param body body v1.SuggestionOrderUpdateBody true "信息"
  98. // @Success 200 {object} v1.SuggestionOrderUpdateResponse
  99. // @Failure 500 {object} base.HTTPError
  100. // @Router /api/v1/suggestion/order [put]
  101. func (c *Controller) SuggestionOrderUpdate(ctx *gin.Context) {
  102. // 解析参数
  103. req := &param_v1.SuggestionOrderUpdateRequest{}
  104. parseParamTask := func() error {
  105. err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.SuggestionOrderUpdateBody)
  106. if err != nil {
  107. logger.Error("func",
  108. zap.String("call", "util.ShouldBind"),
  109. zap.String("error", err.Error()))
  110. return errors.ParamsError
  111. }
  112. return nil
  113. }
  114. // 业务处理
  115. handleServiceTask := func() error {
  116. tokenInfo, err := utils.GetSubjectValue(ctx)
  117. if err != nil {
  118. return err
  119. }
  120. // 响应数据
  121. resp := param_v1.SuggestionOrderUpdateResponse{}
  122. rpcReq := &v1.SuggestionOrderUpdateRequest{
  123. GardenId:tokenInfo.GardenId,
  124. Id:req.Id,
  125. SuggestionType:req.SuggestionType,
  126. // 报修人
  127. ApplyPeople:req.ApplyPeople,
  128. // 报修人电话
  129. ApplyPeoplePhone:req.ApplyPeoplePhone,
  130. // 报修内容
  131. ApplyContent:req.ApplyContent,
  132. // 报修图片
  133. ApplyPic:req.ApplyPic,
  134. HouseholdUid:0,
  135. }
  136. rpcRsp, err := pb.Garden.SuggestionOrderUpdate(ctx, rpcReq)
  137. if err != nil {
  138. s, _ := json.MarshalToString(req)
  139. logger.Error("func",
  140. zap.String("call", "pb.Garden.SuggestionOrderUpdate"),
  141. zap.String("params", s),
  142. zap.String("error", err.Error()))
  143. return errors.ErrorTransForm(err)
  144. }
  145. ctx.JSON(http.StatusOK, resp)
  146. logReq := OperationLogRequest{
  147. Module:ModuleSuggestion,
  148. Action:ActionSuggestionOrderUpdate,
  149. Origin:rpcRsp.Origin,
  150. Target:req.SuggestionOrderUpdateBody,
  151. UserName:tokenInfo.UserName,
  152. Uid:tokenInfo.Uid,
  153. Cid:tokenInfo.Cid,
  154. GardenId:tokenInfo.GardenId,
  155. }
  156. go OperationLogAdd(&logReq)
  157. return nil
  158. }
  159. // 执行任务
  160. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  161. }
  162. //
  163. // @Summary 删除工单
  164. // @Description 删除工单
  165. // @Tags 投诉与建议
  166. // @Accept json
  167. // @Produce json
  168. // @Param token header string true "token"
  169. // @Param id query int true " "
  170. // @Success 200 {object} v1.SuggestionOrderDelResponse
  171. // @Failure 500 {object} base.HTTPError
  172. // @Router /api/v1/suggestion/order [delete]
  173. func (c *Controller) SuggestionOrderDel(ctx *gin.Context) {
  174. // 解析参数
  175. req := &param_v1.SuggestionOrderDelRequest{}
  176. parseParamTask := func() error {
  177. err := util.ShouldBind(ctx, &req.Header, nil, &req.SuggestionOrderDelQuery, nil)
  178. if err != nil {
  179. logger.Error("func",
  180. zap.String("call", "util.ShouldBind"),
  181. zap.String("error", err.Error()))
  182. return errors.ParamsError
  183. }
  184. return nil
  185. }
  186. // 业务处理
  187. handleServiceTask := func() error {
  188. tokenInfo, err := utils.GetSubjectValue(ctx)
  189. if err != nil {
  190. return err
  191. }
  192. // 响应数据
  193. resp := param_v1.SuggestionOrderDelResponse{}
  194. rpcReq := &v1.SuggestionOrderDelRequest{
  195. GardenId:tokenInfo.GardenId,
  196. Id:req.Id,
  197. HouseholdUid:0,
  198. }
  199. rpcRsp, err := pb.Garden.SuggestionOrderDel(ctx, rpcReq)
  200. if err != nil {
  201. s, _ := json.MarshalToString(req)
  202. logger.Error("func",
  203. zap.String("call", "pb.Garden.SuggestionOrderDel"),
  204. zap.String("params", s),
  205. zap.String("error", err.Error()))
  206. return errors.ErrorTransForm(err)
  207. }
  208. ctx.JSON(http.StatusOK, resp)
  209. logReq := OperationLogRequest{
  210. Module:ModuleSuggestion,
  211. Action:ActionSuggestionOrderDel,
  212. Origin:rpcRsp.Origin,
  213. Target:nil,
  214. UserName:tokenInfo.UserName,
  215. Uid:tokenInfo.Uid,
  216. Cid:tokenInfo.Cid,
  217. GardenId:tokenInfo.GardenId,
  218. }
  219. go OperationLogAdd(&logReq)
  220. return nil
  221. }
  222. // 执行任务
  223. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  224. }
  225. //
  226. // @Summary 工单列表
  227. // @Description 工单列表
  228. // @Tags 投诉与建议
  229. // @Accept json
  230. // @Produce json
  231. // @Param token header string true "token"
  232. // @Param page query int false " "
  233. // @Param page_size query int false " "
  234. // @Param status query int false " 1未派单 2 已派单 3 已完结 "
  235. // @Param apply_people query string false "报修人"
  236. // @Param apply_people_phone query string false "报修人电话"
  237. // @Param is_me query bool false " true: 指派给我的"
  238. // @Param suggestion_type query int false "投诉类型 1 投诉 2 建议"
  239. // @Success 200 {object} v1.SuggestionOrderListResponse
  240. // @Failure 500 {object} base.HTTPError
  241. // @Router /api/v1/suggestion/order [get]
  242. func (c *Controller) SuggestionOrderList(ctx *gin.Context) {
  243. // 解析参数
  244. req := &param_v1.SuggestionOrderListRequest{}
  245. parseParamTask := func() error {
  246. err := util.ShouldBind(ctx, &req.Header, nil, &req.SuggestionOrderListQuery, nil)
  247. if err != nil {
  248. logger.Error("func",
  249. zap.String("call", "util.ShouldBind"),
  250. zap.String("error", err.Error()))
  251. return errors.ParamsError
  252. }
  253. return nil
  254. }
  255. // 业务处理
  256. handleServiceTask := func() error {
  257. tokenInfo, err := utils.GetSubjectValue(ctx)
  258. if err != nil {
  259. return err
  260. }
  261. // 响应数据
  262. resp := param_v1.SuggestionOrderListResponse{}
  263. rpcReq := &v1.SuggestionOrderListRequest{
  264. GardenId:tokenInfo.GardenId,
  265. PageSize:req.PageSize,
  266. Page:req.Page,
  267. SuggestionType:req.SuggestionType,
  268. ApplyPeoplePhone:req.ApplyPeoplePhone,
  269. ApplyPeople:req.ApplyPeople,
  270. Status:req.Status,
  271. }
  272. if req.IsMe {
  273. rpcReq.CurrentUid = tokenInfo.Uid
  274. }
  275. rpcRsp, err := pb.Garden.SuggestionOrderList(ctx, rpcReq)
  276. if err != nil {
  277. s, _ := json.MarshalToString(req)
  278. logger.Error("func",
  279. zap.String("call", "pb.Garden.SuggestionOrderList"),
  280. zap.String("params", s),
  281. zap.String("error", err.Error()))
  282. return errors.ErrorTransForm(err)
  283. }
  284. if rpcRsp.List == nil {
  285. rpcRsp.List = make([]*v1.SuggestionOrderItem, 0)
  286. }
  287. resp.Data = *rpcRsp
  288. ctx.JSON(http.StatusOK, resp)
  289. return nil
  290. }
  291. // 执行任务
  292. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  293. }
  294. //
  295. // @Summary 工单详情
  296. // @Description 工单详情
  297. // @Tags 投诉与建议
  298. // @Accept json
  299. // @Produce json
  300. // @Param token header string true "token"
  301. // @Param id query int true " "
  302. // @Success 200 {object} v1.SuggestionOrderInfoResponse
  303. // @Failure 500 {object} base.HTTPError
  304. // @Router /api/v1/suggestion/order/info [get]
  305. func (c *Controller) SuggestionOrderInfo(ctx *gin.Context) {
  306. // 解析参数
  307. req := &param_v1.SuggestionOrderInfoRequest{}
  308. parseParamTask := func() error {
  309. err := util.ShouldBind(ctx, &req.Header, nil, &req.SuggestionOrderInfoQuery, nil)
  310. if err != nil {
  311. logger.Error("func",
  312. zap.String("call", "util.ShouldBind"),
  313. zap.String("error", err.Error()))
  314. return errors.ParamsError
  315. }
  316. return nil
  317. }
  318. // 业务处理
  319. handleServiceTask := func() error {
  320. tokenInfo, err := utils.GetSubjectValue(ctx)
  321. if err != nil {
  322. return err
  323. }
  324. // 响应数据
  325. resp := param_v1.SuggestionOrderInfoResponse{}
  326. rpcReq := &v1.SuggestionOrderInfoRequest{
  327. GardenId:tokenInfo.GardenId,
  328. Id:req.Id,
  329. }
  330. rpcRsp, err := pb.Garden.SuggestionOrderInfo(ctx, rpcReq)
  331. if err != nil {
  332. s, _ := json.MarshalToString(req)
  333. logger.Error("func",
  334. zap.String("call", "pb.Garden.SuggestionOrderInfo"),
  335. zap.String("params", s),
  336. zap.String("error", err.Error()))
  337. return errors.ErrorTransForm(err)
  338. }
  339. if rpcRsp.List == nil {
  340. rpcRsp.List = make([]*v1.SuggestionOrderPipelineData, 0)
  341. }
  342. resp.Data = *rpcRsp
  343. ctx.JSON(http.StatusOK, resp)
  344. return nil
  345. }
  346. // 执行任务
  347. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  348. }
  349. //
  350. // @Summary 派单
  351. // @Description 派单
  352. // @Tags 投诉与建议
  353. // @Accept json
  354. // @Produce json
  355. // @Param token header string true "token"
  356. // @Param body body v1.SuggestionOrderSendBody true "信息"
  357. // @Success 200 {object} v1.SuggestionOrderSendResponse
  358. // @Failure 500 {object} base.HTTPError
  359. // @Router /api/v1/suggestion/order/send [put]
  360. func (c *Controller) SuggestionOrderSend(ctx *gin.Context) {
  361. // 解析参数
  362. req := &param_v1.SuggestionOrderSendRequest{}
  363. parseParamTask := func() error {
  364. err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.SuggestionOrderSendBody)
  365. if err != nil {
  366. logger.Error("func",
  367. zap.String("call", "util.ShouldBind"),
  368. zap.String("error", err.Error()))
  369. return errors.ParamsError
  370. }
  371. return nil
  372. }
  373. // 业务处理
  374. handleServiceTask := func() error {
  375. tokenInfo, err := utils.GetSubjectValue(ctx)
  376. if err != nil {
  377. return err
  378. }
  379. // 响应数据
  380. resp := param_v1.SuggestionOrderSendResponse{}
  381. rpcReq := &v1.SuggestionOrderSendRequest{
  382. GardenId:tokenInfo.GardenId,
  383. Id:req.Id,
  384. CurrentUid:req.CurrentUid,
  385. Feedback:req.Feedback,
  386. LastUid:tokenInfo.Uid,
  387. ByCompany:tokenInfo.ByCompany,
  388. }
  389. _, err = pb.Garden.SuggestionOrderSend(ctx, rpcReq)
  390. if err != nil {
  391. s, _ := json.MarshalToString(req)
  392. logger.Error("func",
  393. zap.String("call", "pb.Garden.SuggestionOrderSend"),
  394. zap.String("params", s),
  395. zap.String("error", err.Error()))
  396. return errors.ErrorTransForm(err)
  397. }
  398. ctx.JSON(http.StatusOK, resp)
  399. logReq := OperationLogRequest{
  400. Module:ModuleSuggestion,
  401. Action:ActionSuggestionOrderSend,
  402. Origin:nil,
  403. Target:req.SuggestionOrderSendBody,
  404. UserName:tokenInfo.UserName,
  405. Uid:tokenInfo.Uid,
  406. Cid:tokenInfo.Cid,
  407. GardenId:tokenInfo.GardenId,
  408. }
  409. go OperationLogAdd(&logReq)
  410. return nil
  411. }
  412. // 执行任务
  413. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  414. }
  415. //
  416. // @Summary 结单
  417. // @Description 结单
  418. // @Tags 投诉与建议
  419. // @Accept json
  420. // @Produce json
  421. // @Param token header string true "token"
  422. // @Param body body v1.SuggestionOrderFinishBody true "信息"
  423. // @Success 200 {object} v1.SuggestionOrderFinishResponse
  424. // @Failure 500 {object} base.HTTPError
  425. // @Router /api/v1/suggestion/order/finish [put]
  426. func (c *Controller) SuggestionOrderFinish(ctx *gin.Context) {
  427. // 解析参数
  428. req := &param_v1.SuggestionOrderFinishRequest{}
  429. parseParamTask := func() error {
  430. err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.SuggestionOrderFinishBody)
  431. if err != nil {
  432. logger.Error("func",
  433. zap.String("call", "util.ShouldBind"),
  434. zap.String("error", err.Error()))
  435. return errors.ParamsError
  436. }
  437. return nil
  438. }
  439. // 业务处理
  440. handleServiceTask := func() error {
  441. tokenInfo, err := utils.GetSubjectValue(ctx)
  442. if err != nil {
  443. return err
  444. }
  445. // 响应数据
  446. resp := param_v1.SuggestionOrderFinishResponse{}
  447. rpcReq := &v1.SuggestionOrderFinishRequest{
  448. GardenId:tokenInfo.GardenId,
  449. Id:req.Id,
  450. Feedback:req.Feedback,
  451. LastUid:tokenInfo.Uid,
  452. ByCompany:tokenInfo.ByCompany,
  453. HandlePic:req.HandlePic,
  454. }
  455. _, err = pb.Garden.SuggestionOrderFinish(ctx, rpcReq)
  456. if err != nil {
  457. s, _ := json.MarshalToString(req)
  458. logger.Error("func",
  459. zap.String("call", "pb.Garden.SuggestionOrderFinish"),
  460. zap.String("params", s),
  461. zap.String("error", err.Error()))
  462. return errors.ErrorTransForm(err)
  463. }
  464. ctx.JSON(http.StatusOK, resp)
  465. logReq := OperationLogRequest{
  466. Module:ModuleSuggestion,
  467. Action:ActionSuggestionOrderFinish,
  468. Origin:nil,
  469. Target:req.SuggestionOrderFinishBody,
  470. UserName:tokenInfo.UserName,
  471. Uid:tokenInfo.Uid,
  472. Cid:tokenInfo.Cid,
  473. GardenId:tokenInfo.GardenId,
  474. }
  475. go OperationLogAdd(&logReq)
  476. return nil
  477. }
  478. // 执行任务
  479. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  480. }
  481. //
  482. // @Summary 退单
  483. // @Description 退单
  484. // @Tags 投诉与建议
  485. // @Accept json
  486. // @Produce json
  487. // @Param token header string true "token"
  488. // @Param body body v1.SuggestionOrderBackBody true "信息"
  489. // @Success 200 {object} v1.SuggestionOrderBackResponse
  490. // @Failure 500 {object} base.HTTPError
  491. // @Router /api/v1/suggestion/order/back [put]
  492. func (c *Controller) SuggestionOrderBack(ctx *gin.Context) {
  493. // 解析参数
  494. req := &param_v1.SuggestionOrderBackRequest{}
  495. parseParamTask := func() error {
  496. err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.SuggestionOrderBackBody)
  497. if err != nil {
  498. logger.Error("func",
  499. zap.String("call", "util.ShouldBind"),
  500. zap.String("error", err.Error()))
  501. return errors.ParamsError
  502. }
  503. return nil
  504. }
  505. // 业务处理
  506. handleServiceTask := func() error {
  507. tokenInfo, err := utils.GetSubjectValue(ctx)
  508. if err != nil {
  509. return err
  510. }
  511. // 响应数据
  512. resp := param_v1.SuggestionOrderBackResponse{}
  513. rpcReq := &v1.SuggestionOrderBackRequest{
  514. GardenId:tokenInfo.GardenId,
  515. Id:req.Id,
  516. Feedback:req.Feedback,
  517. LastUid:tokenInfo.Uid,
  518. ByCompany:tokenInfo.ByCompany,
  519. }
  520. _, err = pb.Garden.SuggestionOrderBack(ctx, rpcReq)
  521. if err != nil {
  522. s, _ := json.MarshalToString(req)
  523. logger.Error("func",
  524. zap.String("call", "pb.Garden.SuggestionOrderBack"),
  525. zap.String("params", s),
  526. zap.String("error", err.Error()))
  527. return errors.ErrorTransForm(err)
  528. }
  529. ctx.JSON(http.StatusOK, resp)
  530. logReq := OperationLogRequest{
  531. Module:ModuleSuggestion,
  532. Action:ActionSuggestionOrderBack,
  533. Origin:nil,
  534. Target:req.SuggestionOrderBackBody,
  535. UserName:tokenInfo.UserName,
  536. Uid:tokenInfo.Uid,
  537. Cid:tokenInfo.Cid,
  538. GardenId:tokenInfo.GardenId,
  539. }
  540. go OperationLogAdd(&logReq)
  541. return nil
  542. }
  543. // 执行任务
  544. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  545. }
  546. //
  547. // @Summary 回访
  548. // @Description 回访
  549. // @Tags 投诉与建议
  550. // @Accept json
  551. // @Produce json
  552. // @Param token header string true "token"
  553. // @Param body body v1.SuggestionOrderReturnVisitBody true "信息"
  554. // @Success 200 {object} v1.SuggestionOrderReturnVisitResponse
  555. // @Failure 500 {object} base.HTTPError
  556. // @Router /api/v1/suggestion/order/return_visit [put]
  557. func (c *Controller) SuggestionOrderReturnVisit(ctx *gin.Context) {
  558. // 解析参数
  559. req := &param_v1.SuggestionOrderReturnVisitRequest{}
  560. parseParamTask := func() error {
  561. err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.SuggestionOrderReturnVisitBody)
  562. if err != nil {
  563. logger.Error("func",
  564. zap.String("call", "util.ShouldBind"),
  565. zap.String("error", err.Error()))
  566. return errors.ParamsError
  567. }
  568. return nil
  569. }
  570. // 业务处理
  571. handleServiceTask := func() error {
  572. tokenInfo, err := utils.GetSubjectValue(ctx)
  573. if err != nil {
  574. return err
  575. }
  576. // 响应数据
  577. resp := param_v1.SuggestionOrderReturnVisitResponse{}
  578. rpcReq := &v1.SuggestionOrderReturnVisitRequest{
  579. GardenId:tokenInfo.GardenId,
  580. Id:req.Id,
  581. ReturnVisitLevel:req.ReturnVisitLevel,
  582. ReturnVisitContent:req.ReturnVisitContent,
  583. }
  584. _, err = pb.Garden.SuggestionOrderReturnVisit(ctx, rpcReq)
  585. if err != nil {
  586. s, _ := json.MarshalToString(req)
  587. logger.Error("func",
  588. zap.String("call", "pb.Garden.SuggestionOrderReturnVisit"),
  589. zap.String("params", s),
  590. zap.String("error", err.Error()))
  591. return errors.ErrorTransForm(err)
  592. }
  593. ctx.JSON(http.StatusOK, resp)
  594. logReq := OperationLogRequest{
  595. Module:ModuleSuggestion,
  596. Action:ActionSuggestionOrderReturnVisit,
  597. Origin:nil,
  598. Target:req.SuggestionOrderReturnVisitBody,
  599. UserName:tokenInfo.UserName,
  600. Uid:tokenInfo.Uid,
  601. Cid:tokenInfo.Cid,
  602. GardenId:tokenInfo.GardenId,
  603. }
  604. go OperationLogAdd(&logReq)
  605. return nil
  606. }
  607. // 执行任务
  608. httptasker.Exec(ctx, parseParamTask, handleServiceTask)
  609. }