|
@@ -10,6 +10,7 @@ import cn.hutool.core.util.EnumUtil;
|
|
|
import cn.hutool.core.util.IdcardUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.rshy.project.hy.manager.RshyJkManager;
|
|
|
import com.rshy.project.hy.model.constant.ItfwConstant;
|
|
|
import com.rshy.project.hy.model.dto.NucleicAcidDTO;
|
|
@@ -77,7 +78,7 @@ public class RshyJkManagerImpl implements RshyJkManager {
|
|
|
public Future<RshyVo> getRshyInfo(RshyParam rshyParam) {
|
|
|
// timeout 转成毫秒 这里考虑到网络传输延时等原因,减去300ms
|
|
|
rshyParam.setTimeout((int) TimeUnit.MILLISECONDS.convert(rshyParam.getTimeout(), TimeUnit.SECONDS));
|
|
|
- int jkmTimeout = rshyParam.getTimeout() - 300;
|
|
|
+ int jkmTimeout = rshyParam.getTimeout() - 500;
|
|
|
RshyVo rshyVo = new RshyVo();
|
|
|
PctgkryDTO gkryDTO = new PctgkryDTO();
|
|
|
ResultDTO resultDTO = new ResultDTO();
|
|
@@ -103,19 +104,25 @@ public class RshyJkManagerImpl implements RshyJkManager {
|
|
|
if (jkmInfo != null) {
|
|
|
rshyParam.setSfzh(jkmInfo.getId_num());
|
|
|
rshyVo.setSfzh(jkmInfo.getId_num()).setXm(jkmInfo.getUser_name()).setHealthCode(jkmInfo.getColor_code_label()).setPhone(jkmInfo.getPn());
|
|
|
- saveIdentity(rshyParam.getBarCode(), rshyVo);
|
|
|
resultDTO.setPctjkmInfoDTO(jkmInfo);
|
|
|
+ if (rshyParam.getIdentity() == null) {
|
|
|
+ saveBarcode2DB(jkmInfo.getBar_code(), jkmInfo.getId_num());
|
|
|
+ }
|
|
|
} else {
|
|
|
rshyVo.setSfzh(rshyParam.getSfzh());
|
|
|
if (rshyParam.getIdentity() != null) {
|
|
|
rshyVo.setXm(rshyParam.getIdentity().getName());
|
|
|
rshyVo.setPhone(rshyParam.getIdentity().getPhone());
|
|
|
+ rshyVo.setAddress(rshyParam.getIdentity().getAddress());
|
|
|
+ rshyVo.setPhoto(rshyParam.getIdentity().getPhoto());
|
|
|
+ } else {
|
|
|
+ saveBarcode2DB(StrUtil.EMPTY, rshyParam.getSfzh());
|
|
|
}
|
|
|
}
|
|
|
int jkmUsedTime = (int) DateUtil.between(beginDate, DateTime.now(), DateUnit.MS);
|
|
|
System.out.println("健康码接口用时: " + jkmUsedTime + "毫秒");
|
|
|
|
|
|
- rshyParam.setTimeout(rshyParam.getTimeout() - jkmUsedTime - 400);
|
|
|
+ rshyParam.setTimeout(rshyParam.getTimeout() - jkmUsedTime - 600);
|
|
|
//剩余时间不到50ms,直接返回
|
|
|
if (rshyParam.getTimeout() <= 50) {
|
|
|
return new AsyncResult<>(rshyVo);
|
|
@@ -135,27 +142,30 @@ public class RshyJkManagerImpl implements RshyJkManager {
|
|
|
add(() -> resultDTO.setPctxcmResultDTO(itfwServer.getPctxcm(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
if (StrUtil.isBlank(rshyParam.getXm())) { // 刷健康码或者手动输入身份证号码,获取证件照片
|
|
|
add(() -> resultDTO.setPctzjzpResultDTO(itfwServer.getPctzjzp(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
- }
|
|
|
- if (StrUtil.isNotBlank(rshyParam.getPhoto())) {
|
|
|
- //add(() -> resultDTO.setPersonIdentifyDTO(viidServer.personIdentify(rshyParam.getPhoto(), rshyParam.getTimeout())));
|
|
|
- add(() -> quickRshyVo.set(getYitu(rshyParam.getPhoto(), (rshyParam.getTimeout()))));
|
|
|
+ } else {
|
|
|
+ add(() -> itfwServer.savePhoto2DB(rshyParam.getSfzh(), rshyParam.getPhoto()));
|
|
|
+ rshyVo.setPhoto(null);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- //if (rshyParam.getScreenLocked() == 0 && (barCodes == null || PassStatusEnum.GREEN_CODE.getDesc().equals(barCodes.getCOLOR_CODE_LABEL()))) {
|
|
|
- //绿码人员继续进行七大类管控接口、人车核录接口、杭州市重点人员底库数据查询接口比对
|
|
|
- //if (PassStatusEnum.GREEN_CODE.getDesc().equals(jkmInfo.getColor_code_label())) {
|
|
|
- taskList.add(() -> resultDTO.getPctgkryDTO().setPctdfkDTO(itfwServer.getPctdfk(rshyParam.getSfzh(), "", rshyParam.getTimeout())));
|
|
|
- taskList.add(() -> resultDTO.getPctgkryDTO().setPctjsryDTO(itfwServer.getPctjsry(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
- taskList.add(() -> resultDTO.getPctgkryDTO().setPctztDTO(itfwServer.getPctzt(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
- taskList.add(() -> resultDTO.getPctgkryDTO().setPctzfbaDTO(itfwServer.getPctzfba(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
- taskList.add(() -> resultDTO.getPctgkryDTO().setPctqkryDTO(itfwServer.getPctqkry(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
- taskList.add(() -> resultDTO.getPctgkryDTO().setPctxdryDTO(itfwServer.getPctxdry(rshyParam.getSfzh(), "", rshyParam.getTimeout())));
|
|
|
- taskList.add(() -> resultDTO.getPctgkryDTO().setPctzdryDTO(itfwServer.getPctzdry(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
- taskList.add(() -> resultDTO.setPctrchlDTO(itfwServer.getPctrchl(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
- taskList.add(() -> resultDTO.setPctzdrydkResultDTO(itfwServer.getPctzdrydk(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
- //}
|
|
|
+ if (rshyParam.getScreenLocked() == 0) {
|
|
|
+ //没锁屏的情况下,继续进行七大类管控接口、人车核录接口、杭州市重点人员底库数据查询接口以及依图的比对
|
|
|
+ if (StrUtil.isNotBlank(rshyParam.getPhoto())) {
|
|
|
+ //add(() -> resultDTO.setPersonIdentifyDTO(viidServer.personIdentify(rshyParam.getPhoto(), rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> quickRshyVo.set(getYitu(rshyParam.getPhoto(), (rshyParam.getTimeout()))));
|
|
|
+ }
|
|
|
+ taskList.add(() -> resultDTO.getPctgkryDTO().setPctdfkDTO(itfwServer.getPctdfk(rshyParam.getSfzh(), "", rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> resultDTO.getPctgkryDTO().setPctjsryDTO(itfwServer.getPctjsry(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> resultDTO.getPctgkryDTO().setPctztDTO(itfwServer.getPctzt(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> resultDTO.getPctgkryDTO().setPctzfbaDTO(itfwServer.getPctzfba(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> resultDTO.getPctgkryDTO().setPctqkryDTO(itfwServer.getPctqkry(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> resultDTO.getPctgkryDTO().setPctxdryDTO(itfwServer.getPctxdry(rshyParam.getSfzh(), "", rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> resultDTO.getPctgkryDTO().setPctzdryDTO(itfwServer.getPctzdry(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> resultDTO.setPctrchlDTO(itfwServer.getPctrchl(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
+ taskList.add(() -> resultDTO.setPctzdrydkResultDTO(itfwServer.getPctzdrydk(rshyParam.getSfzh(), rshyParam.getTimeout())));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//异步流并发处理
|
|
|
// taskList.parallelStream().forEach(v -> {
|
|
@@ -194,17 +204,18 @@ public class RshyJkManagerImpl implements RshyJkManager {
|
|
|
//出生日期 从身份证号码中获取
|
|
|
Date date = DateUtil.parse(IdcardUtil.getBirthByIdCard(rshyVo.getSfzh()));
|
|
|
rshyVo.setBirthday(DateUtil.format(date, "yyyy-M-d"));
|
|
|
- //不是刷身份证,取地址、姓名、民族
|
|
|
- if (StrUtil.isBlank(rshyParam.getXm())) {
|
|
|
- if (resultDTO.getPctsfzResult() != null) {
|
|
|
- //有警察叔叔身份证接口返回数据
|
|
|
- rshyVo.setXm(resultDTO.getPctsfzResult().getCZRKXM());
|
|
|
- rshyVo.setAddress(resultDTO.getPctsfzResult().getCZRKZZ());
|
|
|
- rshyVo.setMz(resultDTO.getPctsfzResult().getCZRKMZ());
|
|
|
- } else {
|
|
|
- //户籍省份 从身份证号码中获取
|
|
|
- rshyVo.setAddress(IdcardUtil.getProvinceByIdCard(rshyVo.getSfzh()));
|
|
|
- }
|
|
|
+ //取地址、姓名、民族
|
|
|
+ if (resultDTO.getPctsfzResult() != null) {
|
|
|
+ //有警察叔叔身份证接口返回数据
|
|
|
+ rshyVo.setXm(resultDTO.getPctsfzResult().getCZRKXM());
|
|
|
+ rshyVo.setAddress(resultDTO.getPctsfzResult().getCZRKZZ());
|
|
|
+ rshyVo.setMz(resultDTO.getPctsfzResult().getCZRKMZ());
|
|
|
+ } else {
|
|
|
+ //户籍省份 从身份证号码中获取
|
|
|
+ rshyVo.setAddress(IdcardUtil.getProvinceByIdCard(rshyVo.getSfzh()));
|
|
|
+ }
|
|
|
+ if (StrUtil.isNotBlank(rshyParam.getXm()) && rshyVo.getXm() == null) {
|
|
|
+ rshyVo.setXm(rshyParam.getXm());
|
|
|
}
|
|
|
//人车核录核查结果
|
|
|
String hcjg = resultDTO.getPctrchlDTO() == null ? "" : resultDTO.getPctrchlDTO().getHcjg();
|
|
@@ -256,9 +267,10 @@ public class RshyJkManagerImpl implements RshyJkManager {
|
|
|
rshyVo.setPhoto(resultDTO.getPctzjzpResultDTO().getPhoto());
|
|
|
}
|
|
|
|
|
|
- //System.out.println(JSONObject.toJSONString(resultDTO));
|
|
|
if (resultDTO.getPctjkmInfoDTO() != null) {
|
|
|
- saveIdentity(resultDTO.getPctjkmInfoDTO().getBar_code(), rshyVo);
|
|
|
+ saveIdentity2DB(resultDTO.getPctjkmInfoDTO().getBar_code(), rshyVo);
|
|
|
+ } else {
|
|
|
+ saveIdentity2DB(StrUtil.EMPTY, rshyVo);
|
|
|
}
|
|
|
return new AsyncResult<>(rshyVo);
|
|
|
}
|
|
@@ -295,8 +307,14 @@ public class RshyJkManagerImpl implements RshyJkManager {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存身份信息到数据库
|
|
|
+ *
|
|
|
+ * @param barCode 健康码bar_code
|
|
|
+ * @param rshyVo
|
|
|
+ */
|
|
|
@Async
|
|
|
- protected void saveIdentity(String barCode, RshyVo rshyVo) {
|
|
|
+ protected void saveIdentity2DB(String barCode, RshyVo rshyVo) {
|
|
|
log.info("保存身份信息到数据库, 身份证号码: {}", rshyVo.getSfzh());
|
|
|
Identity identity = new Identity();
|
|
|
if (StrUtil.isNotBlank(barCode)) {
|
|
@@ -306,10 +324,24 @@ public class RshyJkManagerImpl implements RshyJkManager {
|
|
|
identity.setName(rshyVo.getXm());
|
|
|
identity.setAddress(rshyVo.getAddress());
|
|
|
identity.setPhone(rshyVo.getPhone());
|
|
|
- identity.setPhoto(rshyVo.getPhoto());
|
|
|
+ //identity.setPhoto(rshyVo.getPhoto());
|
|
|
identityService.saveOK(identity);
|
|
|
}
|
|
|
|
|
|
+ @Async
|
|
|
+ protected void saveBarcode2DB(String barCode, String idNum) {
|
|
|
+ LambdaQueryWrapper<Identity> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(Identity::getIdNum, idNum);
|
|
|
+ Identity identity = identityService.getOne(wrapper);
|
|
|
+ if (identity != null) return;
|
|
|
+ identity = new Identity();
|
|
|
+ if (StrUtil.isNotBlank(barCode)) {
|
|
|
+ identity.setBarCode(barCode);
|
|
|
+ }
|
|
|
+ identity.setIdNum(idNum);
|
|
|
+ identityService.save(identity);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 组装返回的核酸信息
|
|
|
*
|