package cn.cslg.pas.controller; import cn.cslg.pas.common.core.base.Constants; import cn.cslg.pas.common.dto.QuerySplitDTO; import cn.cslg.pas.common.model.cronModel.Records; import cn.cslg.pas.common.utils.Response; import cn.cslg.pas.common.vo.business.SplitVO; import cn.cslg.pas.domain.business.ReportProject; import cn.cslg.pas.exception.XiaoShiException; import cn.cslg.pas.service.business.FeatureService; import cn.cslg.pas.service.business.ReportProjectService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.*; /** * 特征Controller层 * * @Author lrj * @Date 2023/12/5 */ @Slf4j @RequestMapping(Constants.API_XiaoSHI + "/feature") @RestController public class FeatureController { @Autowired private FeatureService featureService; @Autowired private ReportProjectService reportProjectService; @Operation(summary = "拆分查询特征") @PostMapping("/spiltFeature") public Response spiltFeature(@RequestBody SplitVO splitVO) throws Exception { try { Records records = new Records(); records.setData(featureService.splitPatentFeature(splitVO)); return Response.success(records); } catch (Exception e) { return Response.error(e.getMessage()); } } @Operation(summary = "查询拆分信息") @PostMapping("/getSplitMessage") public Response getSplitMessage(@RequestBody QuerySplitDTO splitDTO) throws Exception { try { Records records = new Records(); records.setData(featureService.getSplitMessage(splitDTO)); return Response.success(records); } catch (Exception e) { return Response.error(e.getMessage()); } } @Operation(summary = "查询权要") @GetMapping("/getPatentRight") public Response queryCustomField(String patentNo) throws Exception { try { Records records = new Records(); records.setData(featureService.getPatentRight(patentNo)); return Response.success(records); } catch (Exception e) { return Response.error(e.getMessage()); } } @Operation(summary = "查询权要树") @GetMapping("/getPatentRightTree") public Response getPatentRightTree(String patentNo) throws Exception { try { Records records = new Records(); records.setData(featureService.getPatentRightTree(patentNo)); return Response.success(records); } catch (Exception e) { return Response.error(e.getMessage()); } } @Operation(summary = "查询特征") @PostMapping("/getFeatrues") public Response getFeatrues(@RequestBody SplitVO splitVO) throws Exception { try { Records records = new Records(); splitVO.setIfReSplit(false); if (splitVO.getProjectId() != null) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); queryWrapper.eq(ReportProject::getProjectId, splitVO.getProjectId()); ReportProject reportProject = reportProjectService.getOne(queryWrapper, false); if (reportProject != null) { splitVO.setPatentNo(reportProject.getSignPatentNo()); } else { throw new XiaoShiException("未查询到报告"); } } records.setData(featureService.splitPatentFeature(splitVO)); return Response.success(records); } catch (Exception e) { return Response.error(e.getMessage()); } } }