|
@@ -4,10 +4,8 @@ import cn.cslg.pas.common.model.PersonnelVO;
|
|
|
import cn.cslg.pas.common.model.outApi.PatentStarDto;
|
|
|
import cn.cslg.pas.common.model.outApi.PatentStarListDto;
|
|
|
import cn.cslg.pas.common.model.vo.outApi.StarPatentVO;
|
|
|
-import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
-import cn.cslg.pas.common.utils.FormatUtil;
|
|
|
+import cn.cslg.pas.common.utils.*;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
|
-import cn.cslg.pas.common.utils.ThrowException;
|
|
|
import cn.cslg.pas.domain.*;
|
|
|
import cn.cslg.pas.service.upLoadPatent.RetrieveRecordService;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -19,10 +17,17 @@ import okhttp3.FormBody;
|
|
|
import okhttp3.OkHttpClient;
|
|
|
import okhttp3.Request;
|
|
|
import okhttp3.Response;
|
|
|
+
|
|
|
+import org.joda.time.DateTime;
|
|
|
+import org.joda.time.Days;
|
|
|
+import org.joda.time.Months;
|
|
|
+import org.joda.time.format.DateTimeFormat;
|
|
|
+import org.joda.time.format.DateTimeFormatter;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.regex.Matcher;
|
|
@@ -149,9 +154,11 @@ public class PatentStarApiService {
|
|
|
public void loadStarPatentVOS(List<StarPatentVO> starPatentVOS, JSONObject Data) {
|
|
|
String aa = Data.toString();
|
|
|
starPatentVOS.forEach(item -> {
|
|
|
+
|
|
|
//如果有公开号,则将公开号作为专利号
|
|
|
if (item.getPublicNo() != null && !item.getPublicNo().equals("")) {
|
|
|
item.setPatentNo(item.getPublicNo());
|
|
|
+
|
|
|
//如果没有公开号,但是有公告号,则将公告号作为公开号和专利号
|
|
|
} else if (item.getAnnounceNo() != null && !item.getAnnounceNo().equals("")) {
|
|
|
item.setPublicNo(item.getAnnounceNo());
|
|
@@ -160,6 +167,7 @@ public class PatentStarApiService {
|
|
|
System.out.println("");
|
|
|
|
|
|
}
|
|
|
+
|
|
|
//陈宇 ↓ 如果没有公开日就将公告日作为公开日
|
|
|
if (item.getPublicDate() == null || item.getPublicDate().equals("")) {
|
|
|
item.setPublicDate(item.getPublicAccreditDate());
|
|
@@ -178,6 +186,7 @@ public class PatentStarApiService {
|
|
|
item.getApplicant().add(patentApplicant);
|
|
|
}
|
|
|
);
|
|
|
+
|
|
|
if (item.getCurrentApplicantStr() != null && !item.getCurrentApplicantStr().equals("")) {
|
|
|
List<String> cApplicants = Arrays.asList(item.getCurrentApplicantStr().split(";"));
|
|
|
cApplicants.forEach(
|
|
@@ -190,12 +199,14 @@ public class PatentStarApiService {
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
//代理机构
|
|
|
if (item.getAgencyStr() != null && !item.getAgencyStr().equals("")) {
|
|
|
PatentAgency patentAgency = new PatentAgency();
|
|
|
patentAgency.setName(item.getAgencyStr().split(" ")[0]);
|
|
|
item.setAgency(patentAgency);
|
|
|
}
|
|
|
+
|
|
|
//发明人
|
|
|
if (item.getInventorStr() != null && !item.getInventorStr().equals("")) {
|
|
|
item.setInventor(new ArrayList<>());
|
|
@@ -209,6 +220,7 @@ public class PatentStarApiService {
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
//代理人
|
|
|
if (item.getAgentStr() != null && !item.getAgentStr().equals("")) {
|
|
|
List<String> agent = Arrays.asList(item.getAgentStr().split(";"));
|
|
@@ -241,7 +253,6 @@ public class PatentStarApiService {
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> patentStarSearchLocal(PatentStarListDto patentStarListDto) throws IOException {
|
|
|
-
|
|
|
RetrieveRecord retrieveRecord = new RetrieveRecord();
|
|
|
retrieveRecord.setConditions(patentStarListDto.getCurrentQuery());
|
|
|
if (patentStarListDto.getRetrieveRecordId() != null) {
|
|
@@ -273,11 +284,13 @@ public class PatentStarApiService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public Map<String, Object> patentStarSearchApi(PatentStarListDto patentStarListDto) throws IOException {
|
|
|
try {
|
|
|
- String formQuery = patentStarListDto.getCurrentQuery();
|
|
|
- patentStarListDto.setCurrentQuery(PatentStarApiService.formatQuery(formQuery));
|
|
|
-
|
|
|
+if(patentStarListDto.getFormed()==null||patentStarListDto.getFormed()==false) {
|
|
|
+ String formQuery = patentStarListDto.getCurrentQuery();
|
|
|
+ patentStarListDto.setCurrentQuery(PatentStarApiService.formatQuery(formQuery));
|
|
|
+}
|
|
|
} catch (Exception e) {
|
|
|
return null;
|
|
|
}
|
|
@@ -331,6 +344,62 @@ public class PatentStarApiService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ public List<PatentStarListDto> test(PatentStarListDto patentStarListDto) throws IOException {
|
|
|
+ DateTime nowDate = new DateTime();
|
|
|
+ DateTime date = DateUtils2.formStrToDateTime("2000-01-01");
|
|
|
+ //超过1万的列表
|
|
|
+ List<PatentStarListDto> patentStarListDtos = new ArrayList<>();
|
|
|
+ //返回的列表
|
|
|
+ List<PatentStarListDto> reDtos = new ArrayList<>();
|
|
|
+ patentStarListDto.setStartTime(date);
|
|
|
+ patentStarListDto.setEndTime(nowDate);
|
|
|
+ String formQuery = patentStarListDto.getCurrentQuery();
|
|
|
+ patentStarListDto.setOrginCondition(PatentStarApiService.formatQuery(formQuery));
|
|
|
+ patentStarListDtos.add(patentStarListDto);
|
|
|
+ while (patentStarListDtos.size() > 0) {
|
|
|
+ PatentStarListDto dto = patentStarListDtos.get(0);
|
|
|
+ patentStarListDtos.remove(dto);
|
|
|
+ Map<String, Object> map1 = this.patentStarSearchApi(dto);
|
|
|
+ Integer total1 = Integer.parseInt(map1.get("total").toString());
|
|
|
+ dto.setTotal(total1);
|
|
|
+ patentStarListDto.setFormed(true);
|
|
|
+ if (total1 > 10000) {
|
|
|
+ DateTime startTime1 = dto.getStartTime();
|
|
|
+ DateTime endTime1 = dto.getEndTime();
|
|
|
+ List<DateTime> dateTimes = DateUtils2.formStrToDateTime(startTime1, endTime1);
|
|
|
+ PatentStarListDto dto1 = new PatentStarListDto();
|
|
|
+ BeanUtils.copyProperties(dto, dto1);
|
|
|
+ dto1.setStartTime(dateTimes.get(0));
|
|
|
+ dto1.setEndTime(dateTimes.get(1));
|
|
|
+ this.setConditions(dto1);
|
|
|
+ PatentStarListDto dto2 = new PatentStarListDto();
|
|
|
+ BeanUtils.copyProperties(dto, dto2);
|
|
|
+ dto2.setStartTime(dateTimes.get(2));
|
|
|
+ dto2.setEndTime(dateTimes.get(3));
|
|
|
+ this.setConditions(dto2);
|
|
|
+ patentStarListDtos.add(dto1);
|
|
|
+ patentStarListDtos.add(dto2);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ reDtos.add(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return reDtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setConditions(PatentStarListDto patentStarListDto) {
|
|
|
+ DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMdd");
|
|
|
+ String startStr =formatter.print(patentStarListDto.getStartTime());
|
|
|
+ String endStr =formatter.print(patentStarListDto.getEndTime());
|
|
|
+ String cond = "*(" + startStr+ ">" + endStr + "/" + "AD)";
|
|
|
+ Integer len =patentStarListDto.getOrginCondition().length();
|
|
|
+ StringBuilder stringBuilder =new StringBuilder(patentStarListDto.getOrginCondition());
|
|
|
+ stringBuilder.insert(len-1,cond);
|
|
|
+ patentStarListDto.setCurrentQuery(stringBuilder.toString());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param appNo
|
|
|
* @return
|
|
@@ -371,6 +440,8 @@ public class PatentStarApiService {
|
|
|
}
|
|
|
return "{}";
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @param
|
|
|
* @return
|