|
@@ -0,0 +1,46 @@
|
|
|
+package com.winhc.dataworks.flow.touch.service;
|
|
|
+
|
|
|
+import com.aliyuncs.IAcsClient;
|
|
|
+import com.aliyuncs.dataworks_public.model.v20180601.CreateManualDagRequest;
|
|
|
+import com.aliyuncs.dataworks_public.model.v20180601.CreateManualDagResponse;
|
|
|
+import com.aliyuncs.http.ProtocolType;
|
|
|
+import com.helospark.lightdi.annotation.Autowired;
|
|
|
+import com.helospark.lightdi.annotation.Service;
|
|
|
+import com.winhc.dataworks.flow.touch.configuration.DataWorksAccessProperties;
|
|
|
+import lombok.SneakyThrows;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author: XuJiakai
|
|
|
+ * @Date: 2020/6/22 11:28
|
|
|
+ * @Description:
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Service
|
|
|
+public class TouchService {
|
|
|
+ @Autowired
|
|
|
+ private DataWorksAccessProperties dataWorksAccessProperties;
|
|
|
+ @Autowired
|
|
|
+ private IAcsClient client;
|
|
|
+
|
|
|
+ @SneakyThrows
|
|
|
+ public CreateManualDagResponse touch(String projectName
|
|
|
+ , String flowName, String bizDate) {
|
|
|
+ log.info("触发任务:{}.{} {}", projectName, flowName, bizDate);
|
|
|
+ CreateManualDagRequest request = new CreateManualDagRequest();
|
|
|
+ request.setProjectName(projectName);
|
|
|
+ request.setFlowName(flowName);
|
|
|
+ request.setBizdate(bizDate + " 00:00:00");
|
|
|
+ request.setRegionId(dataWorksAccessProperties.getRegionId());
|
|
|
+ request.setProtocol(ProtocolType.HTTP);
|
|
|
+ CreateManualDagResponse response = client.getAcsResponse(request);
|
|
|
+ log.info("\n任务结果:\n\trequestId:{},\n\treturnCode:{},\n\treturnErrorSolution:{},\n\treturnMessage:{},\n\treturnValue:{}",
|
|
|
+ response.getRequestId()
|
|
|
+ , response.getReturnCode()
|
|
|
+ , response.getReturnErrorSolution()
|
|
|
+ , response.getReturnMessage()
|
|
|
+ , response.getReturnValue());
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|