knowledge_approve_node.go 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. package knowledge_approve
  2. import (
  3. "encoding/json"
  4. "eta_gn/eta_api/models/knowledge_approve"
  5. "eta_gn/eta_api/models/knowledge_approve/response"
  6. "fmt"
  7. )
  8. // FormatKnowledgeResourceApproveNode2Item 格式化报告审批节点信息
  9. func FormatKnowledgeResourceApproveNode2Item(origin *knowledge_approve.KnowledgeResourceApproveNode) (item *response.KnowledgeResourceApproveNodeItem, err error) {
  10. if origin == nil {
  11. return
  12. }
  13. item = new(response.KnowledgeResourceApproveNodeItem)
  14. item.KnowledgeResourceApproveNodeId = origin.KnowledgeResourceApproveNodeId
  15. item.KnowledgeResourceApproveFlowId = origin.KnowledgeResourceApproveFlowId
  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.KnowledgeResourceApproveNodeUser, 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. }