123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- package cn.cslg.pas.controller;
- import cn.cslg.pas.common.core.annotation.Permission;
- import cn.cslg.pas.common.core.base.Constants;
- import cn.cslg.pas.common.model.dto.PatentDTO;
- import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
- import cn.cslg.pas.common.utils.auth.checkAuth;
- import cn.cslg.pas.domain.Patent;
- import cn.cslg.pas.common.model.vo.*;
- import cn.cslg.pas.common.utils.JsonUtils;
- import cn.cslg.pas.common.utils.Response;
- import cn.cslg.pas.common.utils.ResponseEnum;
- import cn.cslg.pas.common.utils.StringUtils;
- import cn.cslg.pas.domain.PatentRight;
- import cn.cslg.pas.service.*;
- import cn.cslg.pas.common.utils.CacheUtils;
- import cn.dev33.satoken.stp.StpUtil;
- import io.swagger.v3.oas.annotations.Operation;
- import io.swagger.v3.oas.annotations.tags.Tag;
- import lombok.RequiredArgsConstructor;
- import org.springframework.context.annotation.Lazy;
- import org.springframework.web.bind.annotation.*;
- import java.util.Collections;
- import java.util.List;
- /**
- * <p>
- * 专利 前端控制器
- * </p>
- *
- * @author 王岩
- * @since 2021-12-24
- */
- @Tag(name = "专利")
- @RestController
- @RequestMapping(Constants.API_VERSION_V2 + "/patent")
- @RequiredArgsConstructor(onConstructor_ = {@Lazy})
- public class PatentController {
- private final PatentService patentService;
- private final PatentFieldService patentFieldService;
- private final ProjectPatentLinkService projectPatentLinkService;
- private final ProjectFieldService projectFieldService;
- private final TaskService taskService;
- private final CacheUtils cacheUtils;
- private final ProjectFieldPatentLinkService projectFieldPatentLinkService;
- private final LoginUtils loginUtils;
- private final PatentRightService patentRightService;
- @GetMapping("/read/total")
- @Operation(summary = "专利阅读状态统计")
- public String getPatentReadTotal(PatentReadVO params) {
- return Response.success(projectPatentLinkService.getPatentReadTotal(params));
- }
- @checkAuth(FunId = "/workspace/folder/isRead")
- @Permission(roles = {1})
- @PostMapping("/read/update")
- @Operation(summary = "修改专利阅读状态")
- public String updatePatentReadStatus(@RequestBody PatentReadVO params) {
- return Response.success(projectPatentLinkService.updatePatentReadStatus(params));
- }
- @PostMapping("list")
- @Operation(summary = "专利列表")
- public String getList(@RequestBody PatentVO params) {
- return Response.success(patentService.getPageList(params));
- }
- @GetMapping("{id}")
- @Operation(summary = "根据ID获取专利")
- public String getPatentById(@PathVariable Integer id, Integer projectId) {
- return Response.success(patentService.getPatentDTOById(id, projectId));
- }
- @GetMapping("patentNo")
- @Operation(summary = "根据专利号获取专利所有信息")
- public String getPatentIdByPatentNo(String patentNo) {
- PatentDTO patentDTO =patentService.getPatentDTOById(patentNo);
- return Response.success(patentDTO);
- }
- @GetMapping("id")
- @Operation(summary = "根据专利号获取专利")
- public String getPatentByPatentNo(String patentNo) {
- Patent patent = patentService.getByPatentNo(patentNo);
- return Response.success(patent);
- }
- @PostMapping("ids")
- @Operation(summary = "根据范围获取专利ID")
- public String getPatentListIds(@RequestBody PatentVO params) {
- return Response.success(patentService.getPatentListIds(params));
- }
- @checkAuth(FunId = "/workspace/folder/exportPatent")
- @PostMapping("export")
- @Operation(summary = "导出专利")
- public String export(@RequestBody PatentExportParams params) {
- String id = cacheUtils.getSelectPatentIds(params.getKey());
- List<Integer> ids;
- if (StringUtils.isEmpty(id) && params.getPatentId() == null) {
- return Response.error(ResponseEnum.QUERY_CACHE_ERROR);
- }
- if (StringUtils.isNotEmpty(params.getKey())) {
- ids = StringUtils.changeStringToInteger(id, ",");
- } else {
- ids = Collections.singletonList(params.getPatentId());
- }
- Integer taskId = taskService.add2(params.getProjectId(), params.getSelected().stream().filter(PatentExportVO::getSelected).distinct().count(), ids.size());
- TaskParams taskParams = new TaskParams();
- taskParams.setTaskId(taskId);
- taskParams.setTaskType(2);
- taskParams.setIds(StringUtils.join(ids, ","));
- taskParams.setProjectId(params.getProjectId());
- taskParams.setSelected(JsonUtils.objectToJson(params.getSelected()));
- taskParams.setUserId(String.valueOf(loginUtils.getId()));
- patentService.exportPatent(taskParams);
- return Response.success(true);
- }
- @PostMapping("/query/source")
- @Operation(summary = "查看字段的统计数据")
- public String getPatentQuerySourcePageList(@RequestBody PatentQueryFieldSourceVO params) {
- return Response.success(patentService.getPatentQuerySourcePageList(params));
- }
- @PostMapping("/save/select")
- @Operation(summary = "保存选择的专利")
- public String saveSelectPatentIds(@RequestBody PatentVO params) {
- List<Integer> ids = patentService.getQueryPatentIds(params);
- return Response.success(cacheUtils.setSelectPatentIds(ids));
- }
- @checkAuth(FunId = "/workspace/folder/batchOperation/batchIndexing")
- @Permission(roles = {1})
- @PostMapping("/batch/index")
- @Operation(summary = "批量批量专利标引")
- public String patentBatchIndex(@RequestBody PatentBatchIndexVO params) {
- projectFieldPatentLinkService.patentBatchIndex(params);
- return Response.success(true);
- }
- @GetMapping("/index/setting")
- @Operation(summary = "获取专利标引情况")
- public String getPatentIndexSetting(PatentIndexSettingVO params) {
- return Response.success(projectFieldPatentLinkService.getPatentIndexSetting(params));
- }
- @GetMapping("/index/setting/all")
- @Operation(summary = "获取当前专利所有标引情况")
- public String getPatentIndexSetting2(Integer patentId, Integer projectId) {
- return Response.success(projectFieldPatentLinkService.getPatentIndexSetting2(patentId, projectId));
- }
- @checkAuth(FunId = "/workspace/details/indexing")
- @Permission(roles = {1})
- @PostMapping("/index/setting")
- @Operation(summary = "修改专利标引")
- public String updatePatentIndexSetting(@RequestBody PatentIndexSettingVO params) {
- projectFieldPatentLinkService.updatePatentIndexSetting(params);
- return Response.success(true);
- }
- @PostMapping("between")
- @Operation(summary = "获取当前专利相邻的两篇专利和统计信息")
- public String getBetweenPatentList(@RequestBody PatentVO params) {
- return Response.success(patentService.getBetweenPatentList(params));
- }
- @GetMapping("right")
- @Operation(summary = "根据专利号获得专利的权要")
- public String getRightList(String patentNo) {
- List<PatentRight> patentRights =patentRightService.getPatentRightByPatentNo(patentNo);
- return Response.success(patentRights);
- }
- @GetMapping("getPatentNos")
- @Operation(summary = "根据专题库号获得专利号")
- public String getPatentNos(Integer projectId) {
- String res =patentService.getPatentNos(projectId);
- return Response.success(res);
- }
- }
|