PatentFieldService.java 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. package cn.cslg.pas.service;
  2. import cn.cslg.pas.common.utils.Response;
  3. import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
  4. import cn.cslg.pas.domain.PatentField;
  5. import cn.cslg.pas.domain.ProjectField;
  6. import cn.cslg.pas.common.core.base.Constants;
  7. import cn.cslg.pas.common.model.vo.SystemFieldVO;
  8. import cn.cslg.pas.common.utils.CacheUtils;
  9. import cn.dev33.satoken.stp.StpUtil;
  10. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  11. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  12. import lombok.RequiredArgsConstructor;
  13. import org.springframework.context.annotation.Lazy;
  14. import org.springframework.stereotype.Service;
  15. import java.util.ArrayList;
  16. import java.util.Arrays;
  17. import java.util.Comparator;
  18. import java.util.List;
  19. import java.util.stream.Collectors;
  20. /**
  21. * <p>
  22. * 系统字段 服务类
  23. * </p>
  24. *
  25. * @author 王岩
  26. * @since 2022-03-04
  27. */
  28. @Service
  29. @RequiredArgsConstructor(onConstructor_ = {@Lazy})
  30. public class PatentFieldService {
  31. private final CacheUtils cacheUtils;
  32. private final ProjectFieldService projectFieldService;
  33. private final List<String> finalDefaultList = Arrays.asList("name", "ipcList", "applicationNo", "applicationDate", "applicant2", "applicant4");
  34. private final List<String> finalDefaultQuery = Arrays.asList("13", "18-6", "19-6", "25-12");
  35. private final List<String> finalProjectField = Arrays.asList("clientName", "scenarioid", "typeid", "technicalTheme");
  36. private final LoginUtils loginUtils;
  37. public List<PatentField> getUserFieldDataList(Integer projectId, String from) {
  38. List<PatentField> patentFieldList = this.getList(from);
  39. List<ProjectField> projectField = projectFieldService.getProjectFieldByProjectId(projectId);
  40. if (from.equals(Constants.SYSTEM_FIELD_QUERY)) {
  41. projectField = projectField.stream().filter(item -> !item.getType().equals(6)).collect(Collectors.toList());
  42. }
  43. patentFieldList.addAll(projectField.stream().map(item -> {
  44. PatentField field = new PatentField();
  45. field.setName(item.getName());
  46. field.setType(String.valueOf(item.getType()));
  47. field.setKey(String.valueOf(item.getId()));
  48. return field;
  49. }).collect(Collectors.toList()));
  50. return patentFieldList;
  51. }
  52. public List<PatentField> getUserSetting(SystemFieldVO params) {
  53. Integer createId =loginUtils.getId();
  54. if (params.getRefresh() != null && params.getRefresh()) {
  55. cacheUtils.deleteUserSystemFieldSetting(params.getProjectId(), params.getType(), params.getView(), 3,createId);
  56. }
  57. List<PatentField> dataList = this.getUserFieldDataList(params.getProjectId(), params.getType());
  58. List<PatentField> userSetting = cacheUtils.getUserSystemFieldSetting(params.getProjectId(), params.getType(), params.getView(), 3,createId);
  59. if (userSetting == null || userSetting.size() == 0) {
  60. List<PatentField> defaultList = new ArrayList<>();
  61. List<PatentField> patentFieldList = this.getList(params.getType());
  62. switch (params.getType()) {
  63. case Constants.SYSTEM_FIELD_QUERY:
  64. defaultList = patentFieldList.stream().filter(item -> finalDefaultQuery.contains(item.getKey())).collect(Collectors.toList());
  65. break;
  66. case Constants.SYSTEM_FIELD_PATENT_LIST:
  67. defaultList = patentFieldList.stream().filter(item -> finalDefaultList.contains(item.getKey())).collect(Collectors.toList());
  68. break;
  69. case Constants.SYSTEM_FIELD_PROJECT:
  70. defaultList = patentFieldList.stream().filter(item -> finalProjectField.contains(item.getKey())).collect(Collectors.toList());
  71. break;
  72. }
  73. cacheUtils.setUserSystemFieldSetting(params.getProjectId(), params.getType(), params.getView(), 3, defaultList,createId);
  74. userSetting = defaultList;
  75. }
  76. List<PatentField> finalUserSetting = userSetting;
  77. dataList.forEach(item -> {
  78. PatentField setting = finalUserSetting.stream().filter(patentField -> patentField.getKey().equals(item.getKey())).findFirst().orElse(null);
  79. item.setHidden(setting == null);
  80. item.setOrder(setting == null ? 0 : setting.getOrder());
  81. });
  82. return dataList.stream().sorted(Comparator.comparing(PatentField::getOrder)).collect(Collectors.toList());
  83. }
  84. public List<PatentField> setUserSetting(SystemFieldVO params) {
  85. List<PatentField> patentFieldList = params.getData().stream().filter(item -> !item.getHidden()).collect(Collectors.toList());
  86. for (int i = 0; i < patentFieldList.size(); i++) {
  87. patentFieldList.get(i).setHidden(null);
  88. patentFieldList.get(i).setOrder(i);
  89. }
  90. Integer createId =loginUtils.getId();
  91. cacheUtils.setUserSystemFieldSetting(params.getProjectId(), params.getType(), params.getView(), 3, patentFieldList,createId);
  92. params.setRefresh(false);
  93. return this.getUserSetting(params);
  94. }
  95. public List<PatentField> getList() {
  96. List<PatentField> dataList = new ArrayList<PatentField>() {{
  97. // add(new SystemField("name", "标题", Constants.SYSTEM_FIELD_QUERY, 1));
  98. // add(new SystemField("abstract", "摘要", Constants.SYSTEM_FIELD_QUERY, 1));
  99. // add(new SystemField("41-1", "公开(公告)号", Constants.SYSTEM_FIELD_QUERY, 1));
  100. // add(new SystemField("41-2", "申请号", Constants.SYSTEM_FIELD_QUERY, 2));
  101. add(new PatentField("18-6", "申请人", Constants.SYSTEM_FIELD_QUERY, 3));
  102. add(new PatentField("19-6", "权利人", Constants.SYSTEM_FIELD_QUERY, 4));
  103. add(new PatentField("20-0", "发明人", Constants.SYSTEM_FIELD_QUERY, 5));
  104. add(new PatentField("18-7", "[标]申请人", Constants.SYSTEM_FIELD_QUERY, 6));
  105. add(new PatentField("19-7", "[标]权利人", Constants.SYSTEM_FIELD_QUERY, 7));
  106. add(new PatentField("18-8", "[合并]申请人", Constants.SYSTEM_FIELD_QUERY, 8));
  107. add(new PatentField("19-8", "[合并]权利人", Constants.SYSTEM_FIELD_QUERY, 9));
  108. add(new PatentField("20-1", "[合并]发明人", Constants.SYSTEM_FIELD_QUERY, 9));
  109. add(new PatentField("13", "IPC分类号", Constants.SYSTEM_FIELD_QUERY, 10));
  110. add(new PatentField("15", "CPC分类号", Constants.SYSTEM_FIELD_QUERY, 11));
  111. add(new PatentField("17", "UPC分类号", Constants.SYSTEM_FIELD_QUERY, 12));
  112. add(new PatentField("16", "LOC分类号", Constants.SYSTEM_FIELD_QUERY, 13));
  113. add(new PatentField("25-12", "申请年", Constants.SYSTEM_FIELD_QUERY, 14));
  114. add(new PatentField("28-0", "受理局", Constants.SYSTEM_FIELD_QUERY, 15));
  115. add(new PatentField("37-0", "专利类型", Constants.SYSTEM_FIELD_QUERY, 16));
  116. add(new PatentField("29-17", "申请人国家", Constants.SYSTEM_FIELD_QUERY, 17));
  117. add(new PatentField("29-18", "申请人地区", Constants.SYSTEM_FIELD_QUERY, 18));
  118. add(new PatentField("36-0", "专利状态", Constants.SYSTEM_FIELD_QUERY, 19));
  119. add(new PatentField("40-0", "法律事件", Constants.SYSTEM_FIELD_QUERY, 20));
  120. add(new PatentField("26-12", "公开年", Constants.SYSTEM_FIELD_QUERY, 21));
  121. add(new PatentField("54-0", "标签", Constants.SYSTEM_FIELD_QUERY, 22));
  122. add(new PatentField("pname", "标题", Constants.SYSTEM_FIELD_EXPORT, 1));
  123. add(new PatentField("pname_out", "标题(译)", Constants.SYSTEM_FIELD_EXPORT, 1));
  124. add(new PatentField("patentno", "专利号", Constants.SYSTEM_FIELD_EXPORT, 2));
  125. add(new PatentField("abstract", "摘要", Constants.SYSTEM_FIELD_EXPORT, 3));
  126. add(new PatentField("abstract_out", "摘要(译)", Constants.SYSTEM_FIELD_EXPORT, 3));
  127. add(new PatentField("abstract_path", "摘要附图", Constants.SYSTEM_FIELD_EXPORT, 4));
  128. add(new PatentField("applicationno", "申请号", Constants.SYSTEM_FIELD_EXPORT, 5));
  129. add(new PatentField("appdate", "申请日", Constants.SYSTEM_FIELD_EXPORT, 6));
  130. add(new PatentField("publicno", "公开号", Constants.SYSTEM_FIELD_EXPORT, 7));
  131. add(new PatentField("publicdate", "公开日", Constants.SYSTEM_FIELD_EXPORT, 8));
  132. add(new PatentField("fpublicdate", "首次公开日", Constants.SYSTEM_FIELD_EXPORT, 9));
  133. add(new PatentField("publictono", "授权号", Constants.SYSTEM_FIELD_EXPORT, 10));
  134. add(new PatentField("publictodate", "授权日", Constants.SYSTEM_FIELD_EXPORT, 11));
  135. add(new PatentField("tags", "标签", Constants.SYSTEM_FIELD_EXPORT, 12));
  136. add(new PatentField("bureau", "受理局", Constants.SYSTEM_FIELD_EXPORT, 13));
  137. add(new PatentField("simplefamily", "简单同族", Constants.SYSTEM_FIELD_EXPORT, 14));
  138. add(new PatentField("inpadocfamily", "Inpadoc同族", Constants.SYSTEM_FIELD_EXPORT, 15));
  139. add(new PatentField("patsnapfamily", "扩展同族", Constants.SYSTEM_FIELD_EXPORT, 15));
  140. add(new PatentField("intclassno", "IPC主分类号", Constants.SYSTEM_FIELD_EXPORT, 16));
  141. add(new PatentField("ipc", "IPC分类号", Constants.SYSTEM_FIELD_EXPORT, 16));
  142. add(new PatentField("intclasscpcno", "CPC分类号", Constants.SYSTEM_FIELD_EXPORT, 17));
  143. add(new PatentField("intclassupcno", "UPC主分类号", Constants.SYSTEM_FIELD_EXPORT, 18));
  144. add(new PatentField("upc", "UPC分类号", Constants.SYSTEM_FIELD_EXPORT, 18));
  145. add(new PatentField("intclasslocno", "LOC分类号", Constants.SYSTEM_FIELD_EXPORT, 19));
  146. add(new PatentField("pstatus", "专利状态", Constants.SYSTEM_FIELD_EXPORT, 20));
  147. add(new PatentField("ptype", "专利类型", Constants.SYSTEM_FIELD_EXPORT, 21));
  148. add(new PatentField("law_datetime", "发生日期", Constants.SYSTEM_FIELD_EXPORT, 22));
  149. add(new PatentField("law_status", "法律状态", Constants.SYSTEM_FIELD_EXPORT, 23));
  150. add(new PatentField("law_simplestatus", "简单法律状态", Constants.SYSTEM_FIELD_EXPORT, 24));
  151. add(new PatentField("law_content", "事务内容", Constants.SYSTEM_FIELD_EXPORT, 25));
  152. add(new PatentField("applicant", "申请人", Constants.SYSTEM_FIELD_EXPORT, 26));
  153. add(new PatentField("applicant1", "[标]申请人", Constants.SYSTEM_FIELD_EXPORT, 26));
  154. add(new PatentField("rightholder", "权利人", Constants.SYSTEM_FIELD_EXPORT, 27));
  155. add(new PatentField("rightholder1", "[标]权利人", Constants.SYSTEM_FIELD_EXPORT, 27));
  156. add(new PatentField("applicantcountry", "申请人国家", Constants.SYSTEM_FIELD_EXPORT, 28));
  157. add(new PatentField("rightholdercountry", "权利人国家", Constants.SYSTEM_FIELD_EXPORT, 29));
  158. add(new PatentField("applicantaddress", "申请人地址", Constants.SYSTEM_FIELD_EXPORT, 30));
  159. add(new PatentField("rightholderaddress", "权利人地址", Constants.SYSTEM_FIELD_EXPORT, 31));
  160. // add(new SystemField("applicantaddr", "申请人省市区", Constants.SYSTEM_FIELD_EXPORT, 32));
  161. // add(new SystemField("rightholderaddr", "权利人省市区", Constants.SYSTEM_FIELD_EXPORT, 33));
  162. add(new PatentField("firstapplicant", "第一申请人", Constants.SYSTEM_FIELD_EXPORT, 34));
  163. add(new PatentField("firstrightholder", "第一权利人", Constants.SYSTEM_FIELD_EXPORT, 34));
  164. add(new PatentField("firstapplicantaddr", "第一申请人地址", Constants.SYSTEM_FIELD_EXPORT, 35));
  165. add(new PatentField("firstrightholderaddr", "第一权利人地址", Constants.SYSTEM_FIELD_EXPORT, 35));
  166. add(new PatentField("firstapplicantnum", "申请人数量", Constants.SYSTEM_FIELD_EXPORT, 36));
  167. add(new PatentField("inventor", "发明人", Constants.SYSTEM_FIELD_EXPORT, 37));
  168. add(new PatentField("firstnventoraddr", "第一发明人地址", Constants.SYSTEM_FIELD_EXPORT, 38));
  169. add(new PatentField("firstnventor", "第一发明人", Constants.SYSTEM_FIELD_EXPORT, 39));
  170. add(new PatentField("inventornum", "发明人数量", Constants.SYSTEM_FIELD_EXPORT, 40));
  171. add(new PatentField("num2", "权利要求数量", Constants.SYSTEM_FIELD_EXPORT, 41));
  172. add(new PatentField("content", "权利要求", Constants.SYSTEM_FIELD_EXPORT, 42));
  173. add(new PatentField("content_out", "权利要求(译)", Constants.SYSTEM_FIELD_EXPORT, 42));
  174. add(new PatentField("selfcontent", "独立权利要求", Constants.SYSTEM_FIELD_EXPORT, 43));
  175. add(new PatentField("priorityno", "优先权号", Constants.SYSTEM_FIELD_EXPORT, 44));
  176. add(new PatentField("prioritycountry", "优先权国家", Constants.SYSTEM_FIELD_EXPORT, 45));
  177. add(new PatentField("prioritydate", "优先权日", Constants.SYSTEM_FIELD_EXPORT, 46));
  178. add(new PatentField("page", "文献页数", Constants.SYSTEM_FIELD_EXPORT, 47));
  179. add(new PatentField("code", "文献代码", Constants.SYSTEM_FIELD_EXPORT, 48));
  180. add(new PatentField("manual", "说明书", Constants.SYSTEM_FIELD_EXPORT, 49));
  181. add(new PatentField("simplefamilynum", "简单同族数量", Constants.SYSTEM_FIELD_EXPORT, 50));
  182. add(new PatentField("inpadocfamilynum", "Inpadoc同族数量", Constants.SYSTEM_FIELD_EXPORT, 51));
  183. add(new PatentField("patsnapfamilynum", "扩展同族数量", Constants.SYSTEM_FIELD_EXPORT, 51));
  184. add(new PatentField("quoteno", "引用专利数量", Constants.SYSTEM_FIELD_EXPORT, 52));
  185. add(new PatentField("quotedno", "被引用数量", Constants.SYSTEM_FIELD_EXPORT, 53));
  186. add(new PatentField("quotedno3", "三年内被引用数量", Constants.SYSTEM_FIELD_EXPORT, 54));
  187. add(new PatentField("quotedno5", "五年内被引用数量", Constants.SYSTEM_FIELD_EXPORT, 55));
  188. add(new PatentField("agency", "代理机构", Constants.SYSTEM_FIELD_EXPORT, 56));
  189. add(new PatentField("agent", "代理人", Constants.SYSTEM_FIELD_EXPORT, 57));
  190. add(new PatentField("wonational", "WO国家阶段", Constants.SYSTEM_FIELD_EXPORT, 58));
  191. add(new PatentField("examiner", "审查员", Constants.SYSTEM_FIELD_EXPORT, 59));
  192. add(new PatentField("assexaminer", "助理审查员", Constants.SYSTEM_FIELD_EXPORT, 60));
  193. add(new PatentField("quote", "引用专利", Constants.SYSTEM_FIELD_EXPORT, 61));
  194. add(new PatentField("quoted", "被引用专利", Constants.SYSTEM_FIELD_EXPORT, 62));
  195. add(new PatentField("nonpatentquote", "非专利引用文献", Constants.SYSTEM_FIELD_EXPORT, 63));
  196. add(new PatentField("epcountry", "指定国状态", Constants.SYSTEM_FIELD_EXPORT, 64));
  197. add(new PatentField("name", "标题", Constants.SYSTEM_FIELD_PATENT_LIST, 1));
  198. // add(new PatentField("nameOut", "标题(译)", Constants.SYSTEM_FIELD_PATENT_LIST, 1));
  199. add(new PatentField("abstractStr", "摘要", Constants.SYSTEM_FIELD_PATENT_LIST, 3));
  200. // add(new PatentField("abstractOut", "摘要(译)", Constants.SYSTEM_FIELD_PATENT_LIST, 3));
  201. add(new PatentField("applicationNo", "申请号", Constants.SYSTEM_FIELD_PATENT_LIST, 4));
  202. add(new PatentField("applicationDate", "申请日", Constants.SYSTEM_FIELD_PATENT_LIST, 5));
  203. add(new PatentField("publicDate", "公开日", Constants.SYSTEM_FIELD_PATENT_LIST, 7));
  204. add(new PatentField("publicAccreditDate", "授权日", Constants.SYSTEM_FIELD_PATENT_LIST, 8));
  205. add(new PatentField("label", "标签", Constants.SYSTEM_FIELD_PATENT_LIST, 9));
  206. add(new PatentField("simpleFamily", "简单同族", Constants.SYSTEM_FIELD_PATENT_LIST, 10));
  207. add(new PatentField("inpadocFamily", "Inpadoc同族", Constants.SYSTEM_FIELD_PATENT_LIST, 11));
  208. add(new PatentField("patSnapFamily", "扩展同族", Constants.SYSTEM_FIELD_PATENT_LIST, 11));
  209. add(new PatentField("ipcList", "IPC分类号", Constants.SYSTEM_FIELD_PATENT_LIST, 12));
  210. add(new PatentField("cpcList", "CPC分类号", Constants.SYSTEM_FIELD_PATENT_LIST, 13));
  211. add(new PatentField("upcList", "UPC分类号", Constants.SYSTEM_FIELD_PATENT_LIST, 14));
  212. add(new PatentField("locList", "LOC分类号", Constants.SYSTEM_FIELD_PATENT_LIST, 15));
  213. add(new PatentField("rightNum", "权利要求数", Constants.SYSTEM_FIELD_PATENT_LIST, 16));
  214. add(new PatentField("simpleStatus", "专利状态", Constants.SYSTEM_FIELD_PATENT_LIST, 17));
  215. add(new PatentField("type", "专利类型", Constants.SYSTEM_FIELD_PATENT_LIST, 18));
  216. add(new PatentField("applicant1", "[标]权利人", Constants.SYSTEM_FIELD_PATENT_LIST, 19));
  217. add(new PatentField("applicant2", "权利人", Constants.SYSTEM_FIELD_PATENT_LIST, 20));
  218. add(new PatentField("applicant3", "[标]申请人", Constants.SYSTEM_FIELD_PATENT_LIST, 21));
  219. add(new PatentField("applicant4", "申请人", Constants.SYSTEM_FIELD_PATENT_LIST, 22));
  220. add(new PatentField("inventor", "发明人", Constants.SYSTEM_FIELD_PATENT_LIST, 23));
  221. add(new PatentField("quoteNum", "引用专利数量", Constants.SYSTEM_FIELD_PATENT_LIST, 24));
  222. add(new PatentField("quotedNum", "被引用数量", Constants.SYSTEM_FIELD_PATENT_LIST, 25));
  223. add(new PatentField("agency", "代理机构", Constants.SYSTEM_FIELD_PATENT_LIST, 26));
  224. add(new PatentField("agent", "代理人", Constants.SYSTEM_FIELD_PATENT_LIST, 27));
  225. add(new PatentField("publicAccreditNo", "授权号", Constants.SYSTEM_FIELD_PATENT_LIST, 28));
  226. add(new PatentField("publicNo", "公开号", Constants.SYSTEM_FIELD_PATENT_LIST, 29));
  227. add(new PatentField("clientName", "委托方", Constants.SYSTEM_FIELD_PROJECT, 1));
  228. add(new PatentField("scenarioid", "应用场景", Constants.SYSTEM_FIELD_PROJECT, 1));
  229. add(new PatentField("typeid", "调查类型", Constants.SYSTEM_FIELD_PROJECT, 1));
  230. add(new PatentField("technicalTheme", "技术主题", Constants.SYSTEM_FIELD_PROJECT, 1));
  231. add(new PatentField("contractNo", "合同号", Constants.SYSTEM_FIELD_PROJECT, 1));
  232. add(new PatentField("caseDate", "委案日", Constants.SYSTEM_FIELD_PROJECT, 1));
  233. add(new PatentField("createName", "创建人", Constants.SYSTEM_FIELD_PROJECT, 1));
  234. add(new PatentField("createTime", "创建时间", Constants.SYSTEM_FIELD_PROJECT, 1));
  235. add(new PatentField("departmentName", "所属部门", Constants.SYSTEM_FIELD_PROJECT, 1));
  236. add(new PatentField("personnelName", "专题库负责人", Constants.SYSTEM_FIELD_PROJECT, 1));
  237. }};
  238. return dataList;
  239. }
  240. public List<PatentField> getList(String type) {
  241. List<PatentField> patentFieldList = this.getList();
  242. return patentFieldList.stream().filter(item -> item.getType().equals(type)).collect(Collectors.toList());
  243. }
  244. //获得专题库的所有自定义字段
  245. //获得自定义字段列表
  246. public List<ProjectField> getPageList(Integer projectId) {
  247. LambdaQueryWrapper<ProjectField> queryWrapper = new LambdaQueryWrapper<>();
  248. queryWrapper.eq(ProjectField::getProjectId, projectId);
  249. queryWrapper.orderByDesc(ProjectField::getId);
  250. List<ProjectField> projectFields = projectFieldService.list(queryWrapper);
  251. return projectFields;
  252. }
  253. }