Skip to content

Commit

Permalink
#48 refactor some controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
gavin2lee committed Feb 24, 2021
1 parent 30f5f34 commit c88d0d3
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 55 deletions.
5 changes: 1 addition & 4 deletions src/main/java/com/webank/taskman/base/BaseConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
public interface BaseConverter<D, E> {

E toEntity(D dto);

D toDto(E entity);

List<E> toEntity(List<D> dtoList);

List <D> toDto(List<E> entityList);
List<D> toDto(List<E> entityList);

}
8 changes: 3 additions & 5 deletions src/main/java/com/webank/taskman/constant/RoleTypeEnum.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.webank.taskman.constant;

public enum RoleTypeEnum {
public enum RoleTypeEnum {

MANAGE_ROLE(0,"MANAGE_ROLE"),
USE_ROLE(1,"USE_ROLE"),
;
MANAGE_ROLE(0, "MANAGE_ROLE"), USE_ROLE(1, "USE_ROLE");

private int type;

private String description;
Expand All @@ -30,5 +29,4 @@ public void setDescription(String description) {
this.description = description;
}


}
18 changes: 0 additions & 18 deletions src/main/java/com/webank/taskman/constant/SecurityConsts.java

This file was deleted.

12 changes: 9 additions & 3 deletions src/main/java/com/webank/taskman/constant/TaskNodeTypeEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

public enum TaskNodeTypeEnum {

SSTN("SSTN","SSTN node "),
SUTN("SUTN","SUTN node"),// artificial
;
SSTN("SSTN", "SSTN node "), SUTN("SUTN", "SUTN node");

private String type;

private String description;
Expand All @@ -22,5 +21,12 @@ public void setType(String type) {
this.type = type;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

public enum TemplateTypeEnum {

REQUEST("0","request"),
TASK("1","task"),
;
REQUEST("0", "request"), TASK("1", "task");
private String type;

private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ public JsonResponse platformProcessCreate(@RequestBody DynamicWorkflowInstCreati
}

@PostMapping("/attach-file")
public JsonResponse s3UploadFile(@RequestParam(value = "file") MultipartFile attachFile) throws Exception {
public JsonResponse uploadS3File(@RequestParam(value = "file") MultipartFile attachFile) throws Exception {
String attachFileId = attachFileService.uploadServiceRequestAttachFile(attachFile);

return okayWithData(attachFileId);
}

@GetMapping("/{attach-id}/attach-file")
public void S3DownloadFile(@PathVariable(value = "attach-id") String serviceRequestId, HttpServletResponse response)
public void downloadS3File(@PathVariable(value = "attach-id") String serviceRequestId, HttpServletResponse response)
throws Exception {
if (serviceRequestId == null || serviceRequestId.isEmpty())
throw new Exception("Invalid service-request-id: " + serviceRequestId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ public class TaskmanFormController {
private FormItemTemplateConverter formItemTemplateConverter;

@PostMapping("/template/save")
public JsonResponse createFormTemplate(@Valid @RequestBody SaveFormTemplateReq req){
public JsonResponse createFormTemplate(@Valid @RequestBody SaveFormTemplateReq req) {

FormTemplateResp formTemplateResp = formTemplateService.saveFormTemplateByReq(req);
return JsonResponse.okayWithData(formTemplateResp);
}

@DeleteMapping("/template/delete/{id}")
public JsonResponse formTemplateDelete(@PathVariable("id") String id) throws Exception {
public JsonResponse formTemplateDelete(@PathVariable("id") String id) {
formTemplateService.deleteFormTemplate(id);
return JsonResponse.okay();
}

@GetMapping("/template/detail/{tempType}/{tempId}")
public JsonResponse formTemplateDetail(@PathVariable("tempType") String tempType,
@PathVariable("tempId") String tempId) throws Exception {
@PathVariable("tempId") String tempId) {
return JsonResponse
.okayWithData(formTemplateService.detailFormTemplate(new SaveFormTemplateReq(tempId, tempType)));
}

@DeleteMapping("/item/delete/{id}")
public JsonResponse formItemTemplateDelete(@PathVariable("id") String id) throws Exception {
public JsonResponse formItemTemplateDelete(@PathVariable("id") String id) {
formItemTemplateService.deleteRequestTemplateByID(id);
return JsonResponse.okay();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ public class TaskmanRequestController {
private RequestInfoService requestInfoService;

@PostMapping("/template/group/save")
public JsonResponse requestGroupTemplateSave(@Valid @RequestBody SaveRequestTemplateGropReq req)
{
public JsonResponse requestGroupTemplateSave(@Valid @RequestBody SaveRequestTemplateGropReq req) {
return JsonResponse.okayWithData(requestTemplateGroupService.saveTemplateGroupByReq(req));
}

Expand All @@ -73,7 +72,7 @@ public JsonResponse requestGroupTemplateSearch(@PathVariable("page") Integer pag
}

@GetMapping("/template/group/available")
public JsonResponse requestGroupTemplateAvailable() throws TaskmanRuntimeException {
public JsonResponse requestGroupTemplateAvailable() {
LambdaQueryWrapper lambdaQueryWrapper = new RequestTemplateGroup().setStatus(StatusEnum.DEFAULT.toString())
.getLambdaQueryWrapper();
List<RequestTemplateGroupDTO> dtoList = requestTemplateGroupConverter
Expand All @@ -82,14 +81,13 @@ public JsonResponse requestGroupTemplateAvailable() throws TaskmanRuntimeExcepti
}

@DeleteMapping("/template/group/delete/{id}")
public JsonResponse requestGroupTemplateDelete(@PathVariable("id") String id) throws TaskmanRuntimeException {
public JsonResponse requestGroupTemplateDelete(@PathVariable("id") String id) {
requestTemplateGroupService.deleteTemplateGroupByIDService(id);
return okay();
}

@PostMapping("/template/save")
public JsonResponse requestTemplateSave(@Valid @RequestBody SaveRequestTemplateReq req)
throws TaskmanRuntimeException {
public JsonResponse requestTemplateSave(@Valid @RequestBody SaveRequestTemplateReq req) {
RequestTemplateDTO requestTemplateDTO = requestTemplateService.saveRequestTemplate(req);
return JsonResponse.okayWithData(requestTemplateDTO);
}
Expand All @@ -115,21 +113,20 @@ public JsonResponse requestTemplateRelease(@RequestBody SaveRequestTemplateReq r

@PostMapping("/template/search/{page}/{pageSize}")
public JsonResponse requestTemplateSearch(@PathVariable("page") Integer page,
@PathVariable("pageSize") Integer pageSize, @RequestBody(required = false) QueryRequestTemplateReq req)
throws TaskmanRuntimeException {
@PathVariable("pageSize") Integer pageSize, @RequestBody(required = false) QueryRequestTemplateReq req) {
QueryResponse<RequestTemplateDTO> queryResponse = requestTemplateService.selectRequestTemplatePage(page,
pageSize, req);
return JsonResponse.okayWithData(queryResponse);
}

@DeleteMapping("/template/delete/{id}")
public JsonResponse requestTemplateDelete(@PathVariable("id") String id) throws TaskmanRuntimeException {
public JsonResponse requestTemplateDelete(@PathVariable("id") String id) {
requestTemplateService.deleteRequestTemplateService(id);
return okay();
}

@GetMapping("/template/detail/{id}")
public JsonResponse requestTemplateDetail(@PathVariable("id") String id) throws TaskmanRuntimeException {
public JsonResponse requestTemplateDetail(@PathVariable("id") String id) {
RequestTemplateResp detailRequestTemplateResq = requestTemplateService.detailRequestTemplate(id);
return JsonResponse.okayWithData(detailRequestTemplateResq);
}
Expand All @@ -147,20 +144,19 @@ public JsonResponse requestTemplateAvailable() {
}

@PostMapping("/save")
public JsonResponse requestInfoSave(@RequestBody CreateTaskDto req) throws TaskmanRuntimeException {
public JsonResponse requestInfoSave(@RequestBody CreateTaskDto req) {
return okayWithData(requestInfoService.saveRequestInfoByDto(req));
}

@PostMapping("/search/{page}/{pageSize}")
public JsonResponse requestInfoSearch(@PathVariable("page") Integer page,
@PathVariable("pageSize") Integer pageSize, @RequestBody(required = false) QueryRequestInfoReq req)
throws TaskmanRuntimeException {
@PathVariable("pageSize") Integer pageSize, @RequestBody(required = false) QueryRequestInfoReq req) {
QueryResponse<RequestInfoResq> list = requestInfoService.selectRequestInfoPage(page, pageSize, req);
return JsonResponse.okayWithData(list);
}

@GetMapping("/details/{id}")
public JsonResponse requestInfoDetail(@PathVariable("id") String id) throws TaskmanRuntimeException {
public JsonResponse requestInfoDetail(@PathVariable("id") String id) {
RequestInfoResq requestInfoResq = requestInfoService.selectDetail(id);
return JsonResponse.okayWithData(requestInfoResq);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class TaskmanTaskController {
private TaskInfoService taskInfoService;

@PostMapping("/template/save")
public JsonResponse taskTemplateSave(@Valid @RequestBody SaveTaskTemplateReq taskTemplateReq) throws Exception {
public JsonResponse taskTemplateSave(@Valid @RequestBody SaveTaskTemplateReq taskTemplateReq){

TaskTemplateResp taskTemplateResp = taskTemplateService.saveTaskTemplateByReq(taskTemplateReq);
return JsonResponse.okayWithData(taskTemplateResp);
Expand All @@ -54,7 +54,7 @@ public JsonResponse taskTemplateSearch( @PathVariable("page") Integer page,
}

@GetMapping("/template/detail/{id}")
public JsonResponse taskTemplateDetail(@PathVariable("id") String id) throws Exception {
public JsonResponse taskTemplateDetail(@PathVariable("id") String id){
TaskTemplateResp taskTemplateResp = taskTemplateService.taskTemplateDetail(id);
return JsonResponse.okayWithData(taskTemplateResp);
}
Expand Down

0 comments on commit c88d0d3

Please sign in to comment.