|
@@ -30,26 +30,6 @@ func Destroy() {
|
|
|
http_client.Destroy(NGCwsClient)
|
|
|
}
|
|
|
|
|
|
-var workflowTemplateMap = map[string]string{
|
|
|
- "CGJH": "4e0f65ab8547436ba9f744c4dcaef14e",
|
|
|
- "CGDD": "5e9bb84779b34d31947107f2c4ead93d",
|
|
|
- "CGHT": "d0c7ac374d2a4ed58cd2ee5f1c065110",
|
|
|
- "RKZJ": "ffc0b6044e154707ad80d174c08236be",
|
|
|
- "RKYS": "bdf8eeaf78c146cd914aef8067dea8b2",
|
|
|
- "RK": "2b6338dcdddb4e51b992347e87a1044a",
|
|
|
- "XSHT": "2f1997724b4b49c99379a18bf7067cee",
|
|
|
- "XSDD": "e73bd99b5761464ea74a612d3eaf3ea7",
|
|
|
- "CK": "f82e46c9c4c04862a9babbf3734432e8",
|
|
|
- "SCJH": "762685ccfdc3499590d99d3a8d55b78f",
|
|
|
- "SCGD": "0d43eaff78bb4abf9d6c5634b74e212e",
|
|
|
- "SCZJ": "f5c091e62e6a4cef9a68fda99736fd2e",
|
|
|
- "BSD": "0973c19af66546899638d816cf5ee5c6",
|
|
|
- "BYD": "9d9762864db14271ad9ada7acc73bacd",
|
|
|
- "DBD": "c8aff838c20741758de134903d24934a",
|
|
|
- "KHTH": "1e12eb97c9db4e53bb0704bb1c3d93f7",
|
|
|
- "GYSTH": "459542e8b07a4cda93d98ba0234c079f",
|
|
|
-}
|
|
|
-
|
|
|
func StartWorkFlowByBusinessType(reqParams *request.StartWorkFlowByBusinessTypeRequest) error {
|
|
|
|
|
|
workflowTemplateId, err := getWorkTemplateInfoByBusinessType(reqParams.BusinessType, reqParams.TenantID)
|
|
@@ -60,6 +40,17 @@ func StartWorkFlowByBusinessType(reqParams *request.StartWorkFlowByBusinessTypeR
|
|
|
return errors.New("该业务类型未配置流程")
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ customStructureInfo, err := LaunchWorkflowPrepare(&request.LaunchWorkflowPrepareParams{
|
|
|
+ WorkflowTemplateID: workflowTemplateId,
|
|
|
+ CreateUserID: reqParams.CreateUserID,
|
|
|
+ TenantID: reqParams.TenantID,
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
businessObject := &request.WorkflowBusinessObject{
|
|
|
BusinessType: reqParams.BusinessType,
|
|
|
BusinessObject: reqParams.Data,
|
|
@@ -71,10 +62,11 @@ func StartWorkFlowByBusinessType(reqParams *request.StartWorkFlowByBusinessTypeR
|
|
|
businessObjectStr := string(jsonBytes)
|
|
|
|
|
|
err = StartWorkflow(&request.StartWorkflowRequest{
|
|
|
- LaunchUserName: reqParams.LaunchUserName,
|
|
|
WorkflowTemplateID: workflowTemplateId,
|
|
|
+ LaunchUserName: reqParams.LaunchUserName,
|
|
|
Matter: reqParams.Matter,
|
|
|
BusinessObject: businessObjectStr,
|
|
|
+ UserStructureID: customStructureInfo.ID,
|
|
|
CreateUserID: reqParams.CreateUserID,
|
|
|
TenantID: reqParams.TenantID,
|
|
|
})
|
|
@@ -135,3 +127,38 @@ func getWorkTemplateInfoByBusinessType(businessType string, tenantId string) (st
|
|
|
}
|
|
|
return respInfo.Info.WorkTemplateId, nil
|
|
|
}
|
|
|
+
|
|
|
+func LaunchWorkflowPrepare(reqParams *request.LaunchWorkflowPrepareParams) (*response.CustomStructureInfo, error) {
|
|
|
+
|
|
|
+ requestJson, err := json.Marshal(reqParams)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ postResponse, err := NGCwsClient.NewRequest(http_client.WithNewRequestTimeout(cwsTimeOut)).
|
|
|
+ Post(cwsUrl+service.StartWorkFlowPrepareMethodName, requestJson)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ resp := new(response.InfosResponse[response.PrepareInfo])
|
|
|
+ err = postResponse.Json(resp)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ if !resp.Success {
|
|
|
+ return nil, errors.New(resp.Msg)
|
|
|
+ }
|
|
|
+ customStructureInfo := &response.CustomStructureInfo{}
|
|
|
+ for _, info := range resp.Infos {
|
|
|
+ if 1 == info.Flag && len(info.ChooseData) > 0 {
|
|
|
+ customStructureInfo = &info.ChooseData[0]
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if utils.IsStringEmpty(customStructureInfo.ID) {
|
|
|
+ return nil, errors.New("发起流程前校验异常,人员组织信息不存在")
|
|
|
+ }
|
|
|
+
|
|
|
+ return customStructureInfo, nil
|
|
|
+}
|