package cn.cslg.pas.controller; import cn.cslg.pas.common.core.base.Constants; import cn.cslg.pas.common.dto.TranslateDTO; import cn.cslg.pas.common.utils.Response; import cn.cslg.pas.common.vo.TranslateVO; import cn.cslg.pas.service.common.TranslateService; import io.swagger.v3.oas.annotations.Operation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; @Slf4j @RequestMapping(Constants.API_XiaoSHI + "/translate") @RestController public class TranslateController { @Autowired private TranslateService translateService; @Operation(summary = "根据标题和摘要获取翻译内容") @PostMapping("/getTranslateByTIAndAb") public Response getTranslateByTIAndAb(@RequestBody TranslateDTO vo) throws Exception { TranslateVO translateVO = null; try { translateVO = translateService.getTranslateByTIAndAb(vo); } catch (Exception e) { return Response.error(e.getMessage()); } return Response.success(translateVO); } @Operation(summary = "根据权利要求或说明书获取翻译内容") @PostMapping("/getTranslate") public Response getTranslate(@RequestBody TranslateDTO vo) throws Exception { List translateVOS = new ArrayList<>(); try { translateVOS = translateService.getTranslate(vo); } catch (Exception e) { return Response.error(e.getMessage()); } return Response.success(translateVOS); } @Operation(summary = "翻译权利要求/说明书段落") @PostMapping("/getTranslateOrder") public Response getTranslateOrder(@RequestBody TranslateDTO vo) throws Exception { List translateVOS = new ArrayList<>(); try { translateVOS = translateService.getTranslateOrder(vo); } catch (Exception e) { return Response.error(e.getMessage()); } return Response.success(translateVOS); } @Operation(summary = "根据文本获取翻译内容") @PostMapping("/getTranslateByText") public Response getTranslateByText(@RequestBody TranslateDTO vo) throws Exception { TranslateVO translateVO = null; try { translateVO = translateService.getTranslateByText(vo); } catch (Exception e) { return Response.error(e.getMessage()); } return Response.success(translateVO); } }