ecology_maven/com/api/aiyh_guijiu/web/ConflictWorkflowController....

158 lines
4.2 KiB
Java
Raw Normal View History

2021-11-14 15:29:16 +08:00
package com.api.aiyh_guijiu.web;
import aiyh.utils.ApiResult;
import aiyh.utils.zwl.common.ToolUtil;
import com.api.aiyh_guijiu.service.WorkflowQueueService;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
* @author EBU7-dev1-ayh
* @create 2021/9/3 0003 12:08
*
*/
@Path("/change2Workflow")
public class ConflictWorkflowController {
private final WorkflowQueueService workflowQueueService = new WorkflowQueueService();
private final ToolUtil toolUtil = new ToolUtil();
private final String className = "QueryWorkflow";
/**
*
*
* @return
*/
@Path("/queryWatermark/{workflowId}")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String queryWatermark(@PathParam("workflowId") String workflowId) {
try {
return workflowQueueService.getWatermarkConfig(workflowId);
}catch (Exception e){
toolUtil.writeErrorLog(className + "======> queryWatermark",e.toString());
return ApiResult.error(e.toString());
}
}
/**
*
*
* @param request
* @param response
* @param param
* @return
*/
@Path("/addWatermark")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String addWatermark(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody Map<String, String> param) {
User user = HrmUserVarify.getUser(request, response);
try {
return workflowQueueService.addWaterMark(user, param);
}catch (Exception e){
toolUtil.writeErrorLog(className + "======> addWatermark",e.toString());
return ApiResult.error(e.toString());
}
}
/**
*
*
* @param workflowId id
* @return
*/
@Path("/queryWorkflow/config/{workflowId}")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String queryWorkflowConfig(@PathParam("workflowId") String workflowId) {
try {
return workflowQueueService.getWorkflowConflictConfig(workflowId);
}catch (Exception e){
toolUtil.writeErrorLog(className + "======> queryWorkflowConfig",e.toString());
return ApiResult.error(e.toString());
}
}
/**
*
*
* @param param
* @return
*/
@Path("/queryConflict")
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String queryWorkflowQueue(@RequestBody Map<String, String> param) {
try {
return workflowQueueService.getWorkflowQueue(param);
}catch (Exception e){
toolUtil.writeErrorLog(className + "======> queryWorkflowQueue",e.toString());
e.printStackTrace();
return ApiResult.error(e.toString());
}
}
/**
* ps
*
* @param imgIds
* @return ps
*/
@Path("/picIsPs/{imgIds}")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String queryPicIsPs(@PathParam("imgIds") String imgIds) {
try {
return workflowQueueService.getPicIsPs(imgIds);
}catch (Exception e){
toolUtil.writeErrorLog(className + "======> queryPicIsPs",e.toString());
return ApiResult.error(e.toString());
}
}
/**
* ps
*
* @return
*/
@Path("/queryPicPsConfig/{workflowId}")
@GET
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public String queryPicPsConfig(@PathParam("workflowId") String workflowId) {
try {
return workflowQueueService.getPicIsPsConfig(workflowId);
}catch (Exception e){
toolUtil.writeErrorLog(className + "======> queryPicPsConfig",e.toString());
return ApiResult.error(e.toString());
}
}
}