oa.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package gn
  2. import (
  3. "eta_gn/eta_bridge/controller/resp"
  4. "eta_gn/eta_bridge/global"
  5. gnRequest "eta_gn/eta_bridge/models/request/gn"
  6. "eta_gn/eta_bridge/services/gn"
  7. "github.com/gin-gonic/gin"
  8. "github.com/go-playground/validator/v10"
  9. )
  10. // OA
  11. // @Description: 发布OA待办
  12. // @author: Roc
  13. // @receiver gc
  14. // @datetime 2024-10-29 13:23:42
  15. // @param c *gin.Context
  16. func (gc *GuoNengController) OA(c *gin.Context) {
  17. var req gnRequest.PostOAReq
  18. if e := c.Bind(&req); e != nil {
  19. err, ok := e.(validator.ValidationErrors)
  20. if !ok {
  21. resp.FailData("参数解析失败", "Err:"+e.Error(), c)
  22. return
  23. }
  24. resp.FailData("参数解析失败", err.Translate(global.Trans), c)
  25. return
  26. }
  27. oaReq := gn.OASendDbReq{
  28. AppPersonId: req.AppPersonId,
  29. AppPersonName: req.AppPersonName,
  30. AppTaskUrl: req.AppTaskUrl,
  31. TaskName: req.TaskName,
  32. StatusName: req.StatusName,
  33. Status: req.Status,
  34. AppTaskId: req.AppTaskId,
  35. }
  36. oaResp, err := gn.OASendDb(oaReq)
  37. if err != nil {
  38. resp.FailData("请求失败", err.Error(), c)
  39. return
  40. }
  41. resp.OkData("请求成功", oaResp.Data.TaskId, c)
  42. }