approve_node.go 927 B

12345678910111213141516171819202122232425262728293031
  1. package data_approve
  2. import (
  3. "encoding/json"
  4. DataApprove "eta_gn/eta_api/models/data_manage/data_approve"
  5. "eta_gn/eta_api/models/data_manage/data_approve/response"
  6. "fmt"
  7. )
  8. // FormatDataApproveNode2Item 格式化报告审批节点信息
  9. func FormatDataApproveNode2Item(origin *DataApprove.DataApproveNode) (item *response.DataApproveNodeItem, err error) {
  10. if origin == nil {
  11. return
  12. }
  13. item = new(response.DataApproveNodeItem)
  14. item.DataApproveNodeId = origin.DataApproveNodeId
  15. item.DataApproveFlowId = origin.DataApproveFlowId
  16. item.PrevNodeId = origin.PrevNodeId
  17. item.NextNodeId = origin.NextNodeId
  18. item.NodeType = origin.NodeType
  19. item.ApproveType = origin.ApproveType
  20. item.Users = make([]*response.DataApproveNodeUser, 0)
  21. if origin.Users != "" {
  22. e := json.Unmarshal([]byte(origin.Users), &item.Users)
  23. if e != nil {
  24. err = fmt.Errorf("node users unmarshal err: %s", e.Error())
  25. return
  26. }
  27. }
  28. return
  29. }