|
@@ -141,6 +141,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctzdryDTO getPctzdry(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -165,7 +166,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
log.error("请求重点人员服务接口超时异常:{}", e.getMessage());
|
|
@@ -198,6 +199,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctztDTO getPctzt(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -223,7 +225,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
log.error("请求人员劣迹服务接口异常:{}", e.getMessage());
|
|
@@ -256,6 +258,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctzfbaDTO getPctzfba(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -281,7 +284,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
log.error("请求执法办案服务接口异常:{}", e.getMessage());
|
|
@@ -317,6 +320,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctdfkDTO getPctdfk(String idNumber, String ajbh, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -341,7 +345,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
log.error("请求打防控信息服务接口异常:{}", e.getMessage());
|
|
@@ -374,6 +378,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctjsryDTO getPctjsry(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -399,7 +404,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
log.error("请求监所人员服务接口异常:{}", e.getMessage());
|
|
@@ -434,6 +439,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctxdryDTO getPctxdry(String idNumber, String xm, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -460,7 +466,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
log.error("请求吸毒人员服务接口异常:{}", e.getMessage());
|
|
@@ -495,6 +501,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctqkryDTO getPctqkry(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -520,7 +527,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
log.error("请求前科人员服务接口异常:{}", e.getMessage());
|
|
@@ -551,7 +558,7 @@ public class ItfwServer {
|
|
|
* @param key
|
|
|
* @return
|
|
|
*/
|
|
|
- private Integer times(String key) {
|
|
|
+ private Integer exceptionTimes(String key) {
|
|
|
String cacheKey = key + ":times";
|
|
|
int times = 1;
|
|
|
String timesStr = stringRedisTemplate.opsForValue().get(cacheKey);
|
|
@@ -578,6 +585,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctrchlDTO getPctrchl(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -606,7 +614,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
|
|
@@ -641,6 +649,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public List<PctymDataDTO> getPctym(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -666,7 +675,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
|
|
@@ -702,6 +711,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PcthsResultDTO getPcths(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -726,12 +736,10 @@ public class ItfwServer {
|
|
|
}
|
|
|
PcthsVO pcthsVO = JSON.parseObject(body, PcthsVO.class);
|
|
|
if (CollectionUtil.isEmpty(pcthsVO.getData().getResult())) {
|
|
|
-// stringRedisTemplate.opsForValue().set(cacheKey, JSON.toJSONString(null), DateUtil.endOfDay(DateUtil.date()).getTime() - DateUtil.date().getTime(), TimeUnit.MILLISECONDS);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
PcthsResultDTO pcthsResultDTO = pcthsVO.getData().getResult().stream().findFirst().get();
|
|
|
-// stringRedisTemplate.opsForValue().set(cacheKey, JSON.toJSONString(pcthsResultDTO), DateUtil.endOfDay(DateUtil.date()).getTime() - DateUtil.date().getTime(), TimeUnit.MILLISECONDS);
|
|
|
return pcthsResultDTO;
|
|
|
}
|
|
|
|
|
@@ -745,6 +753,7 @@ public class ItfwServer {
|
|
|
*/
|
|
|
public PctzjzpResultDTO getPctzjzp(String idNumber, Integer timeout) {
|
|
|
if (StringUtils.isBlank(idNumber)) {
|
|
|
+ log.warn("身份证号码为空");
|
|
|
return null;
|
|
|
}
|
|
|
|
|
@@ -770,7 +779,7 @@ public class ItfwServer {
|
|
|
try {
|
|
|
body = this.baseAgentApi(properties, timeout - 200);
|
|
|
} catch (Exception e) {
|
|
|
- if (times(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
+ if (exceptionTimes(cacheStatusKey) > WebConstant.TIMEOUT_TIMES) {
|
|
|
stringRedisTemplate.opsForValue().set(cacheStatusKey, cacheStatusKey, WebConstant.STATUS_TIMEOUT, TimeUnit.MINUTES);
|
|
|
}
|
|
|
|
|
@@ -785,12 +794,11 @@ public class ItfwServer {
|
|
|
return null;
|
|
|
}
|
|
|
PctzjzpResultDTO pctzjzpResultDTO = JSON.parseObject(body, PctzjzpResultDTO.class);
|
|
|
+ Set<String> keys = stringRedisTemplate.keys(cacheStatusKey + "*");
|
|
|
+ stringRedisTemplate.delete(keys);
|
|
|
if (Integer.parseInt(pctzjzpResultDTO.getStatus()) != 200) {
|
|
|
-// stringRedisTemplate.opsForValue().set(cacheKey, JSON.toJSONString(null), DateUtil.endOfDay(DateUtil.date()).getTime() - DateUtil.date().getTime(), TimeUnit.MILLISECONDS);
|
|
|
return null;
|
|
|
}
|
|
|
- Set<String> keys = stringRedisTemplate.keys(cacheStatusKey + "*");
|
|
|
- stringRedisTemplate.delete(keys);
|
|
|
|
|
|
byte[] bytes = HttpRequest.get(pctzjzpResultDTO.getZjzUrl()).timeout(200).execute().bodyBytes();
|
|
|
pctzjzpResultDTO.setPhoto(Base64.encode(bytes));
|