Skip to content

Commit

Permalink
workflow Run History Development
Browse files Browse the repository at this point in the history
  • Loading branch information
Strato-YangSungHun committed Sep 19, 2024
1 parent 2667c5a commit 0797edb
Show file tree
Hide file tree
Showing 5 changed files with 171 additions and 67 deletions.
16 changes: 10 additions & 6 deletions src/main/java/kr/co/mcmp/workflow/Entity/WorkflowHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ public class WorkflowHistory {
@JoinColumn(name = "workflow_idx", nullable = false)
private Workflow workflow;

@Column(name = "run_script")
private String runScript;
@Column(name = "data_type")
private String dataType;

@Column(name = "run_user_id", nullable = false)
private String runUserId;
@Lob
@Column(name = "data", columnDefinition = "CLOB")
private String data;

@Column(name = "run_date")
private LocalDateTime runDate;
@Column(name = "user_id", nullable = false)
private String userId;

@Column(name = "date")
private LocalDateTime date;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import kr.co.mcmp.workflow.dto.entityMappingDto.WorkflowHistoryDto;
import kr.co.mcmp.workflow.service.WorkflowService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

Expand All @@ -23,7 +20,7 @@ public class WorkflowHistoryController {

@Operation(summary="워크플로우 이력 조회")
@GetMapping("/{workflowIdx}")
public ResponseWrapper<List<WorkflowHistoryDto>> getWorkflowHistoryList(@PathVariable Long workflowIdx) {
return new ResponseWrapper<>(workflowService.getWorkflowHistoryList(workflowIdx));
public ResponseWrapper<List<WorkflowHistoryDto>> getWorkflowHistoryList(@PathVariable Long workflowIdx, @RequestParam String dataType) {
return new ResponseWrapper<>(workflowService.getWorkflowHistoryList(workflowIdx, dataType));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@
public class WorkflowHistoryDto {
private Long workflowHistoryIdx;
private Long workflowIdx;
private String runScript;
private String runUserId;
private LocalDateTime runDate;
private String dataType;
private String data;
private String userId;
private LocalDateTime date;

// from : 외부 (entity -> dto)
public static WorkflowHistoryDto from(WorkflowHistory workflowHistory) {
return WorkflowHistoryDto.builder()
.workflowHistoryIdx(workflowHistory.getWorkflowHistoryIdx())
.workflowIdx(workflowHistory.getWorkflow().getWorkflowIdx())
.runScript(workflowHistory.getRunScript())
.runUserId(workflowHistory.getRunUserId())
.runDate(workflowHistory.getRunDate())
.dataType(workflowHistory.getDataType())
.data(workflowHistory.getData())
.userId(workflowHistory.getUserId())
.date(workflowHistory.getDate())
.build();
}

Expand All @@ -33,9 +35,10 @@ public static WorkflowHistoryDto of(WorkflowHistoryDto workflowHistoryDto) {
return WorkflowHistoryDto.builder()
.workflowHistoryIdx(workflowHistoryDto.getWorkflowHistoryIdx())
.workflowIdx(workflowHistoryDto.getWorkflowIdx())
.runScript(workflowHistoryDto.getRunScript())
.runUserId(workflowHistoryDto.getRunUserId())
.runDate(workflowHistoryDto.getRunDate())
.dataType(workflowHistoryDto.getDataType())
.data(workflowHistoryDto.getData())
.userId(workflowHistoryDto.getUserId())
.date(workflowHistoryDto.getDate())
.build();
}

Expand All @@ -44,9 +47,10 @@ public static WorkflowHistory toEntity(WorkflowHistoryDto workflowHistoryDto, Wo
return WorkflowHistory.builder()
.workflowHistoryIdx(workflowHistoryDto.getWorkflowHistoryIdx())
.workflow(WorkflowDto.toEntity(workflowDto, ossDto, ossTypeDto))
.runScript(workflowHistoryDto.getRunScript())
.runUserId(workflowHistoryDto.getRunUserId())
.runDate(workflowHistoryDto.getRunDate())
.dataType(workflowHistoryDto.getDataType())
.data(workflowHistoryDto.getData())
.userId(workflowHistoryDto.getUserId())
.date(workflowHistoryDto.getDate())
.build();
}

Expand All @@ -55,14 +59,16 @@ public static WorkflowHistory buildEntity(
WorkflowDto workflowDto,
OssDto ossDto,
OssTypeDto ossTypeDto,
String runScript,
String runUserId,
LocalDateTime runDate) {
String dataType,
String data,
String userId,
LocalDateTime date) {
return WorkflowHistory.builder()
.workflow(WorkflowDto.toEntity(workflowDto, ossDto, ossTypeDto))
.runScript(runScript)
.runUserId(runUserId)
.runDate(runDate)
.dataType(dataType)
.data(data)
.userId(userId)
.date(date)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public interface WorkflowService {
List<WorkflowStageMappingDto> getWorkflowTemplate(String workflowName);

// Workflow History
List<WorkflowHistoryDto> getWorkflowHistoryList(Long workflowIdx);
List<WorkflowHistoryDto> getWorkflowHistoryList(Long workflowIdx, String dataType);

// Workflow Param
List<WorkflowParamDto> getWorkflowParamList();
Expand Down
Loading

0 comments on commit 0797edb

Please sign in to comment.