123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package cn.cslg.pas.controller;
- import cn.cslg.pas.common.core.base.Constants;
- import cn.cslg.pas.common.dto.business.EventDTO;
- import cn.cslg.pas.common.dto.business.PatentDigProjectDTO;
- import cn.cslg.pas.common.dto.business.PatentDigProjectUpdateDTO;
- import cn.cslg.pas.common.dto.business.UpdateEventDTO;
- import cn.cslg.pas.common.model.cronModel.Records;
- import cn.cslg.pas.common.model.request.StringGroupRequest;
- import cn.cslg.pas.common.model.request.StringRequest;
- import cn.cslg.pas.common.utils.Response;
- import cn.cslg.pas.common.vo.RdProjectVO;
- import cn.cslg.pas.domain.business.RdProject;
- import cn.cslg.pas.exception.ConditionException;
- import cn.cslg.pas.exception.UnLoginException;
- import cn.cslg.pas.exception.XiaoShiException;
- import cn.cslg.pas.factorys.businessFactory.Business;
- import cn.cslg.pas.factorys.businessFactory.BusinessFactory;
- import cn.cslg.pas.service.business.PatentDigProjectService;
- import com.alibaba.fastjson.JSONObject;
- 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 org.springframework.web.multipart.MultipartFile;
- import java.util.List;
- /**
- * @author 李仁杰
- * @date 2023/11/2
- */
- @Slf4j
- @RequestMapping(Constants.API_XiaoSHI + "/patentDigProject")
- @RestController
- public class PatentDigProjectController {
- @Autowired
- private BusinessFactory businessFactory;
- @Operation(summary = "查询专利挖掘项目")
- @PostMapping("/queryPatentDigProject")
- public Response queryPatentDigProject(@RequestBody StringRequest stringRequest) throws Exception {
- Business business = businessFactory.getClass("patentDigProjectService");
- Records records = (Records) business.queryMessage(stringRequest);
- return Response.success(records);
- }
- @Operation(summary = "添加专利挖掘项目")
- @PostMapping("/addPatentDigProject")
- public Response addPatentDigProject(@RequestBody PatentDigProjectDTO patentDigProjectDTO) throws Exception {
- if (patentDigProjectDTO != null) {
- Business business = businessFactory.getClass("patentDigProjectService");
- Integer id = null;
- try {
- id = (Integer) business.addMessage(patentDigProjectDTO);
- } catch (Exception e) {
- if (e instanceof XiaoShiException) {
- return Response.error(e.getMessage());
- } else if (e instanceof UnLoginException) {
- return Response.unLogin(e.getMessage());
- } else if (e instanceof ConditionException) {
- return Response.conditionError(e.getMessage());
- }
- }
- return Response.success(id);
- } else {
- return Response.error("参数错误");
- }
- }
- @Operation(summary = "更新专利挖掘项目")
- @PostMapping("/updatePatentDigProject")
- public Response updatePatentDigProject(@RequestBody PatentDigProjectUpdateDTO patentDigProjectUpdateDTO) throws Exception {
- if (patentDigProjectUpdateDTO != null) {
- Business business = businessFactory.getClass("patentDigProjectService");
- business.updateMessage(patentDigProjectUpdateDTO);
- return Response.success(1);
- }
- else {
- return Response.error("参数错误");
- }
- }
- @Operation(summary = "删除专利挖掘项目")
- @PostMapping("/deletePatentDigProject")
- public Response deletePatentDigProject(@RequestBody List<Integer> ids) throws Exception {
- Business business = businessFactory.getClass("patentDigProjectService");
- business.deleteMessage(ids);
- return Response.success(ids);
- }
- @Operation(summary = "分组专利挖掘项目")
- @PostMapping("/groupPatentDigProject")
- public Response groupPatentDigProject(@RequestBody StringGroupRequest stringGroupRequest) throws Exception {
- Business business = businessFactory.getClass("patentDigProjectService");
- Records records = (Records)business.getGroup(stringGroupRequest,"patentDigProject");
- return Response.success(records);
- }
- @Operation(summary = "查询研发项目")
- @PostMapping("/getRdProjectByNumber")
- public Response getRdProjectByNumber( @RequestBody StringRequest stringRequest) throws Exception {
- Business business = businessFactory.getClass("patentDigProjectService");
- PatentDigProjectService projectService =(PatentDigProjectService)business;
- Records records= projectService.getRdProjectByNumber(stringRequest);
- return Response.success(records);
- }
- }
|