|
@@ -17,6 +17,7 @@ import com.example.xiaoshiweixinback.business.utils.ToolUtil;
|
|
import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
|
|
import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
|
|
import com.example.xiaoshiweixinback.domain.es.*;
|
|
import com.example.xiaoshiweixinback.domain.es.*;
|
|
import com.example.xiaoshiweixinback.entity.dto.patent.CollectPatentDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.patent.CollectPatentDTO;
|
|
|
|
+import com.example.xiaoshiweixinback.entity.dto.patent.DelCollectPatentDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.patent.PatentColumnDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.patent.PatentColumnDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.patent.SelectCollectPatentDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.patent.SelectCollectPatentDTO;
|
|
import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
|
|
import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
|
|
@@ -140,6 +141,54 @@ public class EsPatentService {
|
|
return records;
|
|
return records;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 删除收藏专利
|
|
|
|
+ * @param patentDTO
|
|
|
|
+ * @return
|
|
|
|
+ * @throws IOException
|
|
|
|
+ */
|
|
|
|
+ public boolean delCollectPatent(DelCollectPatentDTO patentDTO) throws IOException {
|
|
|
|
+ Integer assoPersonProductId = patentDTO.getAssoPersonProductId();
|
|
|
|
+ List<String> patentNos = patentDTO.getPatentNos();
|
|
|
|
+ List<String> patentIds = new ArrayList<>();
|
|
|
|
+ for (String patentNo : patentNos) {
|
|
|
|
+ List<String> list = this.selectPatentId(patentNo, assoPersonProductId);
|
|
|
|
+ patentIds.addAll(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!CollectionUtils.isEmpty(patentIds)) {
|
|
|
|
+ Integer num = esService.deleteWxPatent(patentIds);
|
|
|
|
+ if (num < 1) {
|
|
|
|
+ throw new BusinessException(ExceptionEnum.THE_FAIL_TO_DELETE);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //根据专利号、assoPersonProductId查询相关专利id
|
|
|
|
+ public List<String> selectPatentId(String patentNo,Integer assoPersonProductId) throws IOException {
|
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
|
+ SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
|
|
+ //设置查询索引
|
|
|
|
+ builder.index("wxpatent");
|
|
|
|
+ Query query = QueryBuilders.term(i -> i.field("product_id").value(assoPersonProductId));
|
|
|
|
+ Query q = QueryBuilders.hasChild(i -> i.type("product").query(query));
|
|
|
|
+ Query q1 = QueryBuilders.term(i -> i.field("patent_no.keyword").value(patentNo));
|
|
|
|
+ Query bool = QueryBuilders.bool(i -> i.must(q, q1));
|
|
|
|
+ builder.query(bool);
|
|
|
|
+ //解除最大条数限制
|
|
|
|
+ builder.trackTotalHits(i -> i.enabled(true));
|
|
|
|
+ SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
|
|
+ List<Hit<Patent>> hits = response.hits().hits();
|
|
|
|
+ for (Hit<Patent> hit : hits) {
|
|
|
|
+ String id = hit.id();
|
|
|
|
+ list.add(id);
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
//装载专利清单列表的数据
|
|
//装载专利清单列表的数据
|
|
public PatentColumnDTO getPatentColumnDTO(Patent patent, Integer projectId, String id) {
|
|
public PatentColumnDTO getPatentColumnDTO(Patent patent, Integer projectId, String id) {
|
|
PatentColumnDTO columnDTO = new PatentColumnDTO();
|
|
PatentColumnDTO columnDTO = new PatentColumnDTO();
|