client_test.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package dingtalk
  2. import (
  3. "dashoo.cn/opms_libary/plugin/dingtalk/workflow"
  4. "fmt"
  5. "github.com/alibabacloud-go/tea/tea"
  6. "testing"
  7. )
  8. func TestQuerySchemaByProcessCode(t *testing.T) {
  9. client := NewClient()
  10. w := client.GetWorkflow()
  11. s, _ := w.QuerySchemaByProcessCode("PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19")
  12. fmt.Println(s)
  13. }
  14. func TestStartProcessInstance(t *testing.T) {
  15. client := NewClient()
  16. w := client.GetWorkflow()
  17. //formComponentValues0Details0Details0 := &workflow.StartProcessInstanceRequestFormComponentValuesDetailsDetails{
  18. // Id: tea.String("PhoneField_IZI2LP8QF6O0"),
  19. // BizAlias: tea.String("Phone"),
  20. // Name: tea.String("PhoneField"),
  21. // Value: tea.String("123xxxxxxxx"),
  22. // ExtValue: tea.String("总个数:1"),
  23. // ComponentType: tea.String("PhoneField"),
  24. //}
  25. //formComponentValues0Details0 := &workflow.StartProcessInstanceRequestFormComponentValuesDetails{
  26. // Id: tea.String("PhoneField_IZI2LP8QF6O0"),
  27. // BizAlias: tea.String("Phone"),
  28. // Name: tea.String("PhoneField"),
  29. // Value: tea.String("123xxxxxxxx"),
  30. // ExtValue: tea.String("总个数:1"),
  31. // Details: []*workflow.StartProcessInstanceRequestFormComponentValuesDetailsDetails{formComponentValues0Details0Details0},
  32. //}
  33. //表单信息
  34. TextField_1RC8GZWYGO4G0 := &workflow.StartProcessInstanceRequestFormComponentValues{
  35. Id: tea.String("TextField_1RC8GZWYGO4G0"),
  36. Name: tea.String("单行输入框"),
  37. Value: tea.String("123xxxxxxxx"),
  38. }
  39. DDAttachment_17PC5KQBVEM80 := &workflow.StartProcessInstanceRequestFormComponentValues{
  40. Id: tea.String("DDAttachment_17PC5KQBVEM80"),
  41. Name: tea.String("附件"),
  42. Value: tea.String("123xxxxxxxx"),
  43. }
  44. startProcessInstanceRequest := &workflow.StartProcessInstanceRequest{
  45. OriginatorUserId: tea.String("47073111989114"),
  46. ProcessCode: tea.String("PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19"),
  47. DeptId: tea.Int64(435711466),
  48. FormComponentValues: []*workflow.StartProcessInstanceRequestFormComponentValues{TextField_1RC8GZWYGO4G0, DDAttachment_17PC5KQBVEM80},
  49. }
  50. //w.StartProcessInstance("47073111989114", "PROC-7A5F6215-A8CF-4DD1-AB2C-5B1AB84C4E19", 435711466)
  51. resp, _ := w.StartProcessInstance(startProcessInstanceRequest)
  52. fmt.Println(resp)
  53. }