Commit 2f94b337 authored by chuwanshun's avatar chuwanshun

注释增加

parent 77b78eec
......@@ -16,9 +16,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.cesgroup.kingkong</groupId>
<artifactId>kingkong-webmvc-spring-boot-starter</artifactId>
......@@ -42,10 +40,6 @@
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<dependency>
<groupId>com.cesgroup.kingkong</groupId>
<artifactId>kingkong-webmvc-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>
......
......@@ -29,14 +29,11 @@ public class QueryService {
@Autowired
private EsMapper esMapper;
/**
* 通过ID获取数据
*
* @param index 索引,类似数据库
* @param type 类型,类似表
* @param id 数据ID
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @return Map<String,Object>
/**根据id查询专利
* @param id
* @return
* Map<String,Object>
*/
public Map<String, Object> getById(String id) {
Map<String, Object> result = new HashMap<String, Object>();
......@@ -45,10 +42,13 @@ public class QueryService {
String PRE_VALID_NAME = "^[A-Za-z][A-Za-z].*$";
long ti = System.currentTimeMillis();
System.out.println("开始查询:" + ti);
//复合zl.23232.3这种标准格式的
if (isValidId(id, VALID_NAME)) {
//如果id是以zl开头的,把zl替换成CN
if ("zl".equalsIgnoreCase(id.substring(0, 2))) {
id = "CN" + id.substring(2, id.length());
}
//不是标准形式,但id前缀是以字母开头的
} else if (isValidId(id, PRE_VALID_NAME)) {
if ("zl".equalsIgnoreCase(id.substring(0, 2))) {
id = "CN" + id.substring(2, id.length());
......@@ -56,12 +56,13 @@ public class QueryService {
if (id.lastIndexOf(".") != -1) {
id = id.substring(0, id.lastIndexOf("."));
}
//以上两种情况都不满足,没有前缀的情况(纯数字)
} else {
// 如果都不符合,先切割点之前的数字,然后拼接成CN+数字方式
// 如果id中有点,先切割点之前的数字,然后拼接成CN+数字方式
if (id.lastIndexOf(".") != -1) {
id = id.substring(0, id.lastIndexOf("."));
}
//默认,直接将id字符串拼接成CN
id = "CN".concat(id);
}
result = queryById(id);
......@@ -243,27 +244,29 @@ public class QueryService {
null != legalStatusJsonObject ? legalStatusJsonObject.getString("granted_status") : "");
String kind_code_desc = sourceJsonObject.getString("patent_type");
resultMap.put("kind_code_desc", kind_code_desc);
JSONObject ipcJsonObject = sourceJsonObject.getJSONObject("ipcs");
if(null!=ipcJsonObject) {
JSONArray IPC_list = ipcJsonObject.getJSONArray("mainclass");
List<String> ipcNames = new ArrayList<String>();
if(null!=IPC_list) {
for (int j = 0; j < IPC_list.size(); j++) {
String nameString = null != IPC_list.getString(j)
? null!=PatentTypeEnum.parse(IPC_list.getString(j))?PatentTypeEnum.parse(IPC_list.getString(j)).getMessage().replaceAll(" ", ""):""
: "";
ipcNames.add(nameString);
}
resultMap.put("IPC_list", IPC_list);
resultMap.put("IPC_desc", ipcNames);
}else {
resultMap.put("IPC_list", "");
resultMap.put("IPC_desc", "");
JSONObject ipcJsonObject = sourceJsonObject.getJSONObject("ipcs");
if (null != ipcJsonObject) {
JSONArray IPC_list = ipcJsonObject.getJSONArray("mainclass");
List<String> ipcNames = new ArrayList<String>();
if (null != IPC_list) {
for (int j = 0; j < IPC_list.size(); j++) {
String nameString = null != IPC_list.getString(j)
? null != PatentTypeEnum.parse(IPC_list.getString(j))
? PatentTypeEnum.parse(IPC_list.getString(j)).getMessage().replaceAll(" ", "")
: ""
: "";
ipcNames.add(nameString);
}
}else {
resultMap.put("IPC_list", IPC_list);
resultMap.put("IPC_desc", ipcNames);
} else {
resultMap.put("IPC_list", "");
resultMap.put("IPC_desc", "");
}
}
} else {
resultMap.put("IPC_list", "");
resultMap.put("IPC_desc", "");
}
String appcountry = StringUtils.isNoneBlank(sourceJsonObject.getString("appno"))
? sourceJsonObject.getString("appno").substring(0, 2)
: "";
......@@ -326,7 +329,7 @@ public class QueryService {
}
newApplicants.add(assigneesMap);
}
resultMap.put("assignees", newApplicants);
JSONArray ownersObjectArray = sourceJsonObject.getJSONArray("owners");
......@@ -372,22 +375,22 @@ public class QueryService {
if (newOwners.size() > 0) {
resultMap.put("owners", newOwners);
} else {
try {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
ObjectOutputStream oo = new ObjectOutputStream(bo);
oo.writeObject(newApplicants);
// 从流里读出来
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
ObjectInputStream oi = new ObjectInputStream(bi);
Object aObject= oi.readObject();
resultMap.put("owners", aObject);
} catch (Exception e) {
e.printStackTrace();
}
try {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
ObjectOutputStream oo = new ObjectOutputStream(bo);
oo.writeObject(newApplicants);
// 从流里读出来
ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
ObjectInputStream oi = new ObjectInputStream(bi);
Object aObject = oi.readObject();
resultMap.put("owners", aObject);
} catch (Exception e) {
e.printStackTrace();
}
}
JSONObject abstrJsonObject = sourceJsonObject.getJSONObject("abstract");
String abstract1="";
if(null!=abstrJsonObject) {
String abstract1 = "";
if (null != abstrJsonObject) {
abstract1 = StringUtils.isNotBlank(abstrJsonObject.getString("text_zh"))
? abstrJsonObject.getString("text_zh")
: abstrJsonObject.getString("text_en");
......
......@@ -33,7 +33,6 @@ public class SearchContrllor {
long before = new Date().getTime();
Map<String, Object> params = RSAEncryptUtil.resolveParamsForSign(sign, secretKeyService.getById(2));
String id = MapUtils.getString(params, "id");
//String id = "CN86105552";
RestAPIResult<Object> panResult = new RestAPIResult<Object>(secretKeyService);
Map<String, Object> result = null;
if(StringUtils.isNotBlank(id)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment