|
@@ -5,42 +5,33 @@ import cn.hutool.core.date.DateUnit;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
import cn.hutool.core.util.DesensitizedUtil;
|
|
|
-import cn.hutool.core.util.NumberUtil;
|
|
|
-import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
-import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.excel.util.CollectionUtils;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.beust.jcommander.internal.Lists;
|
|
|
-import com.yixin.ms.boot.restful.RestCode;
|
|
|
import com.yixin.ms.boot.restful.RestResponse;
|
|
|
import com.yixin.ms.boot.restful.RestResult;
|
|
|
import com.yixin.ms.boot.restful.ServiceException;
|
|
|
import com.yixin.ms.boot.uitls.DESUtil;
|
|
|
import com.yixin.ms.boot.uitls.OkHttpUtils;
|
|
|
import com.yixin.ms.boot.uitls.RedisUtil;
|
|
|
-import com.yixin.ms.boot.uitls.SMSOrIdCardUtils;
|
|
|
import com.yixin.ms.model.dto.HealthCodeDTO;
|
|
|
-import com.yixin.ms.model.dto.HealthMockDTO;
|
|
|
import com.yixin.ms.model.dto.ShortTermDTO;
|
|
|
import com.yixin.ms.model.enums.*;
|
|
|
import com.yixin.ms.model.vo.HealtCodeNucleinVO;
|
|
|
import com.yixin.ms.model.vo.HealtCodeTypeVO;
|
|
|
import com.yixin.ms.model.vo.HealtCodeUserVO;
|
|
|
import com.yixin.ms.server.HealthCodeServer;
|
|
|
-import com.yixin.ms.server.HealthServer;
|
|
|
-import com.yixin.ms.server.PlaceHealthCodeServer;
|
|
|
-import com.yixin.ms.server.ScenicServer;
|
|
|
-import com.yixin.ms.server.dto.*;
|
|
|
-import com.yixin.ms.server.vo.*;
|
|
|
+import com.yixin.ms.server.JiliangUniversityServer;
|
|
|
+import com.yixin.ms.server.dto.JiliangCanPassDataDTO;
|
|
|
+import com.yixin.ms.server.vo.HealthCodeVO;
|
|
|
import com.yixin.ms.service.HealthCodeService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.nio.charset.Charset;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.Executor;
|
|
@@ -52,38 +43,11 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
@Autowired
|
|
|
private RedisUtil redisUtil;
|
|
|
@Autowired
|
|
|
- private PlaceHealthCodeServer placeHealthCodeServer;
|
|
|
- @Autowired
|
|
|
private HealthCodeServer healthCodeServer;
|
|
|
@Autowired
|
|
|
- private HealthServer healthServer;
|
|
|
- @Autowired
|
|
|
- private ScenicServer scenicServer;
|
|
|
+ private JiliangUniversityServer jiliangUniversityServer;
|
|
|
@Autowired
|
|
|
private Executor executor;
|
|
|
- //顺序
|
|
|
-// private static Integer index = 0;
|
|
|
-// private static List<HealthMockDTO> mockDTOList = Lists.newArrayList();
|
|
|
-
|
|
|
-// static {
|
|
|
-// if (CollectionUtil.isEmpty(mockDTOList)) {
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(0).setMzt("绿码").setNucleicExpirationTime(0));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(1).setMzt("绿码").setNucleicExpirationTime(24));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(2).setMzt("绿码").setNucleicExpirationTime(48));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(3).setMzt("绿码").setNucleicExpirationTime(72));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(4).setMzt("绿码").setNucleicExpirationTime(168));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(5).setMzt("黄码").setNucleicExpirationTime(0));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(6).setMzt("黄码").setNucleicExpirationTime(24));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(7).setMzt("黄码").setNucleicExpirationTime(48));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(8).setMzt("黄码").setNucleicExpirationTime(72));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(9).setMzt("黄码").setNucleicExpirationTime(168));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(10).setMzt("红码").setNucleicExpirationTime(0));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(11).setMzt("红码").setNucleicExpirationTime(24));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(12).setMzt("红码").setNucleicExpirationTime(48));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(13).setMzt("红码").setNucleicExpirationTime(72));
|
|
|
-// mockDTOList.add(new HealthMockDTO().setIndex(14).setMzt("红码").setNucleicExpirationTime(168));
|
|
|
-// }
|
|
|
-// }
|
|
|
|
|
|
@Override
|
|
|
public HealtCodeUserVO getShortTermCertificate(ShortTermDTO shortTermDTO) {
|
|
@@ -126,143 +90,27 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
@Override
|
|
|
public RestResult getShortTerm(ShortTermDTO shortTermDTO) {
|
|
|
log.info("健康码查询入参信息:{}", JSON.toJSONString(shortTermDTO));
|
|
|
+ if (StringUtils.isBlank(shortTermDTO.getToken())) {
|
|
|
+ throw new ServiceException(700, "token为空哦");
|
|
|
+ }
|
|
|
+
|
|
|
if (StrUtil.isEmpty(shortTermDTO.getHealthCode())) {
|
|
|
if (StringUtils.isBlank(shortTermDTO.getIdNumber()) && StringUtils.isBlank(shortTermDTO.getName())) {
|
|
|
throw new ServiceException(701, "身份证和姓名为空哦");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isBlank(shortTermDTO.getToken())) {
|
|
|
- throw new ServiceException(700, "token为空哦");
|
|
|
+ String canPass = jiliangUniversityServer.canPass(new JiliangCanPassDataDTO().setIdCard(shortTermDTO.getIdNumber()).setOpTime(DateUtil.date()).setSn(shortTermDTO.getSn()));
|
|
|
+ if(canPass.equals(CanPassEnum.NOT_THROUGH.getCode())){
|
|
|
+ throw new ServiceException("暂无通行权限,请联系工作人员");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * \\000026https://h5.dingtalk.com/healthAct/index.html?stateCouncilBarCode=ffd631d12c5ee80fe77fe0fb4347b4e8&flag=1#/result
|
|
|
- * 扫码参数兼容问题处理
|
|
|
+ * 核酸有效期时间限制
|
|
|
*/
|
|
|
- if (StrUtil.isNotEmpty(shortTermDTO.getHealthCode()) && shortTermDTO.getHealthCode().contains("http")) {
|
|
|
- shortTermDTO.setHealthCode(shortTermDTO.getHealthCode().substring(shortTermDTO.getHealthCode().indexOf("http")));
|
|
|
- }
|
|
|
-
|
|
|
- if (StrUtil.isNotEmpty(shortTermDTO.getHealthCode()) && shortTermDTO.getHealthCode().contains("HTTP")) {
|
|
|
- shortTermDTO.setHealthCode(shortTermDTO.getHealthCode().substring(shortTermDTO.getHealthCode().indexOf("HTTP")));
|
|
|
- }
|
|
|
-
|
|
|
- if (StrUtil.isNotEmpty(shortTermDTO.getHealthCode()) && (HttpUtil.isHttp(shortTermDTO.getHealthCode()) || HttpUtil.isHttps(shortTermDTO.getHealthCode()))) {
|
|
|
- log.info("请求健康码参数信息: {}", shortTermDTO.getHealthCode());
|
|
|
- //扫码推送参数为链接,提取杭州健康码barCode参数信息
|
|
|
- String barCode = HttpUtil.decodeParamMap(shortTermDTO.getHealthCode().toLowerCase(), Charset.defaultCharset()).get("statecouncilbarcode");
|
|
|
- if (StrUtil.isEmpty(barCode)) {
|
|
|
- throw new ServiceException("请打开支付宝选择杭州健康码重试");
|
|
|
- } else {
|
|
|
- shortTermDTO.setHealthCode(barCode);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- HealtCodeUserVO userVO = null;
|
|
|
- //核酸有效期时间,默认0不限制
|
|
|
Integer nucleicExpirationTime = 0;
|
|
|
- PlaceInfoVO placeInfoVO = null;
|
|
|
- if (StringUtils.isNotEmpty(shortTermDTO.getSn())) {
|
|
|
- RestResult<PlaceInfoVO> placeInfoResult = placeHealthCodeServer.queryPlaceInfoBySn(shortTermDTO.getSn());
|
|
|
- if (placeInfoResult != null && placeInfoResult.getData() != null) {
|
|
|
- nucleicExpirationTime = placeInfoResult.getData().getNucleicExpirationTime();
|
|
|
- }
|
|
|
-
|
|
|
- if (placeInfoResult != null && placeInfoResult.getData() != null && StrUtil.isEmpty(placeInfoResult.getData().getAddressCode()) && RestCode.SUCCESS.getCode() == placeInfoResult.getCode() && StrUtil.isNotEmpty(shortTermDTO.getHealthCode())) {
|
|
|
- throw new ServiceException("设备扫码未绑定场所码,请联系管理员");
|
|
|
- }
|
|
|
-
|
|
|
- if (placeInfoResult != null && placeInfoResult.getData() != null && StrUtil.isNotEmpty(placeInfoResult.getData().getAddressCode()) && RestCode.SUCCESS.getCode() == placeInfoResult.getCode()) {
|
|
|
- placeInfoVO = placeInfoResult.getData();
|
|
|
- HealthResultVO<DeviceScanIdCardVO> scanIdCardResult = null;
|
|
|
- if (StrUtil.isNotEmpty(shortTermDTO.getHealthCode())) {
|
|
|
- //非景区预约,通用健康码查询
|
|
|
- if (!placeInfoVO.getScenicFlag()) {
|
|
|
- scanIdCardResult = this.deviceScanCode(shortTermDTO);
|
|
|
- }
|
|
|
-
|
|
|
- //景区预约,走预约码查询
|
|
|
- if (placeInfoVO.getScenicFlag() && NumberUtil.isNumber(shortTermDTO.getHealthCode())) {
|
|
|
- ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setReservationCode(shortTermDTO.getHealthCode()), placeInfoVO.getAdminId());
|
|
|
- if (!verifyVO.getReleaseStatus()) {
|
|
|
- throw new ServiceException(verifyVO.getMessage());
|
|
|
- } else {
|
|
|
- shortTermDTO.setName(verifyVO.getUserName()).setIdNumber(verifyVO.getIdNumber());
|
|
|
- scanIdCardResult = this.deviceScanIdCardEncrypt(shortTermDTO);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //景区预约,走健康码查询
|
|
|
- if (placeInfoVO.getScenicFlag() && !NumberUtil.isNumber(shortTermDTO.getHealthCode())) {
|
|
|
- RestResult<HealthCodeVO> restResult = healthServer.queryInfoByBarCode(shortTermDTO.getHealthCode());
|
|
|
- HealthCodeVO healthCodeVO = null;
|
|
|
-
|
|
|
- if (restResult.getCode() == RestCode.SUCCESS.getCode()) {
|
|
|
- healthCodeVO = restResult.getData();
|
|
|
- }
|
|
|
-
|
|
|
- if (healthCodeVO != null) {
|
|
|
- ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setIdNumber(healthCodeVO.getIdNum()), placeInfoVO.getAdminId());
|
|
|
- if (!verifyVO.getReleaseStatus()) {
|
|
|
- throw new ServiceException(verifyVO.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- shortTermDTO.setName(verifyVO.getUserName()).setIdNumber(verifyVO.getIdNumber());
|
|
|
- }
|
|
|
-
|
|
|
- scanIdCardResult = this.deviceScanCode(shortTermDTO);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (placeInfoVO.getScenicFlag()) {
|
|
|
- ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setIdNumber(shortTermDTO.getIdNumber()), placeInfoVO.getAdminId());
|
|
|
- if (!verifyVO.getReleaseStatus()) {
|
|
|
- throw new ServiceException(verifyVO.getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- scanIdCardResult = this.deviceScanIdCardEncrypt(shortTermDTO);
|
|
|
- }
|
|
|
-
|
|
|
- if (scanIdCardResult == null || !scanIdCardResult.getCode().equals(Integer.valueOf(RestCode.SUCCESS.getCode()))) {
|
|
|
- //场所码查询若不成功走之前的
|
|
|
- userVO = this.getShortTermCertificate(shortTermDTO);
|
|
|
- } else {
|
|
|
- DeviceScanIdCardVO scanIdCardVO = scanIdCardResult.getData();
|
|
|
- userVO = new HealtCodeUserVO();
|
|
|
- //疫苗接种数量
|
|
|
- userVO.setVaccineNum(scanIdCardVO.getVaccinated());
|
|
|
- if (StrUtil.isNotEmpty(scanIdCardVO.getCheckTime())) {
|
|
|
- //核酸记录
|
|
|
- userVO.setNuclein(Lists.newArrayList(new HealtCodeNucleinVO().setChecktime(DateUtil.parseDateTime(scanIdCardVO.getCheckTime())).setReportTime(StrUtil.isEmpty(scanIdCardVO.getReportTime()) ? null : DateUtil.parseDateTime(scanIdCardVO.getReportTime())).setResult(scanIdCardVO.getCheckResult())));
|
|
|
- } else {
|
|
|
- userVO.setNuclein(Lists.newArrayList());
|
|
|
- }
|
|
|
-
|
|
|
- userVO.setData(Lists.newArrayList(new HealtCodeTypeVO().setMzt(HealthCodeLevelEnum.codeOf(scanIdCardVO.getLevel()).getDesc())));
|
|
|
- //行程信息
|
|
|
- userVO.setTravelValidation(scanIdCardVO.getTravelValidation());
|
|
|
- userVO.setUsername(StrUtil.isEmpty(shortTermDTO.getName()) ? scanIdCardVO.getUsername() : shortTermDTO.getName());
|
|
|
- PlaceRecordDTO placeRecordDTO = new PlaceRecordDTO().setName(StrUtil.isEmpty(shortTermDTO.getName()) ? scanIdCardVO.getUsername() : shortTermDTO.getName()).setIdNumber(shortTermDTO.getIdNumber()).setLevel(HealthCodeLevelEnum.codeOf(scanIdCardVO.getLevel()).getDesc())
|
|
|
- //检测时间
|
|
|
- .setCheckTime(scanIdCardVO.getCheckTime() == null ? null : DateUtil.parseDateTime(scanIdCardVO.getCheckTime()))
|
|
|
- //报告时间
|
|
|
- .setReportTime(scanIdCardVO.getReportTime() == null ? null : DateUtil.parseDateTime(scanIdCardVO.getReportTime()))
|
|
|
- //检测结果
|
|
|
- .setCheckResult(scanIdCardVO.getCheckResult()).setTravelValidation(scanIdCardVO.getTravelValidation()).setVaccinated(scanIdCardVO.getVaccinated()).setAddressCode(placeInfoVO.getAddressCode()).setUnitName(placeInfoVO.getUnitName()).setUnitAddress(placeInfoVO.getUnitAddress()).setManagerHealthCode(placeInfoVO.getManagerHealthCode()).setHealthCode(shortTermDTO.getHealthCode()).setAdminId(placeInfoVO.getAdminId()).setCreateTime(DateUtil.date());
|
|
|
- executor.execute(() -> {
|
|
|
- //保存场所记录
|
|
|
- placeHealthCodeServer.savePlaceRecord(placeRecordDTO);
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- //之前的健康码查询
|
|
|
- userVO = this.getShortTermCertificate(shortTermDTO);
|
|
|
- }
|
|
|
- } else {
|
|
|
- //设备sn为空默认走之前的健康码查询
|
|
|
- userVO = this.getShortTermCertificate(shortTermDTO);
|
|
|
- }
|
|
|
+ //设备sn为空默认走之前的健康码查询
|
|
|
+ HealtCodeUserVO userVO = this.getShortTermCertificate(shortTermDTO);
|
|
|
|
|
|
if (userVO != null) {
|
|
|
if (userVO.getData() == null || userVO.getData().isEmpty()) {
|
|
@@ -273,7 +121,6 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
userVO.setUsername(StrUtil.isEmpty(userVO.getUsername()) ? shortTermDTO.getName() : userVO.getUsername());
|
|
|
//身份证号
|
|
|
userVO.setIdNumber(StrUtil.isEmpty(userVO.getIdNumber()) ? shortTermDTO.getIdNumber() : userVO.getIdNumber());
|
|
|
-
|
|
|
//姓名和身份证号脱敏处理
|
|
|
userVO.setUsername(StrUtil.isEmpty(userVO.getUsername()) ? StrUtil.EMPTY : DesensitizedUtil.chineseName(userVO.getUsername()));
|
|
|
userVO.setIdNumber(StrUtil.isEmpty(userVO.getIdNumber()) ? StrUtil.EMPTY : DesensitizedUtil.idCardNum(userVO.getIdNumber(), 4, 4));
|
|
@@ -296,16 +143,6 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
|
|
|
//用户健康码信息
|
|
|
HealtCodeTypeVO codeTypeVO = userVO.getData().stream().findFirst().get();
|
|
|
- //TODO MOCK 测试 start
|
|
|
-// HealthMockDTO mockDTO = mockDTOList.get(index);
|
|
|
-// codeTypeVO.setMzt(mockDTO.getMzt());
|
|
|
-// nucleicExpirationTime = mockDTO.getNucleicExpirationTime();
|
|
|
-// index++;
|
|
|
-// if (index > 14) {
|
|
|
-// index = 0;
|
|
|
-// }
|
|
|
- //TODO MOCK 测试 end
|
|
|
-
|
|
|
//用户核酸信息
|
|
|
List<HealtCodeNucleinVO> nucleinList = userVO.getNuclein();
|
|
|
if (CollectionUtil.isNotEmpty(nucleinList)) {
|
|
@@ -344,18 +181,13 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
}
|
|
|
userVO.setOpenMsg(openMsg).setOpenVoiceMsg(openMsg);
|
|
|
} else {
|
|
|
- if (placeInfoVO != null && placeInfoVO.getScenicFlag()){
|
|
|
- userVO.setIsOpen(HealthOpenEnum.RELEASE.getCode()).setOpenMsg("绿码,欢迎入园").setOpenVoiceMsg("绿码,欢迎入园");
|
|
|
- }else{
|
|
|
- userVO.setIsOpen(HealthOpenEnum.RELEASE.getCode()).setOpenMsg("绿码,请通行").setOpenVoiceMsg("绿码,请通行");
|
|
|
- }
|
|
|
+ userVO.setIsOpen(HealthOpenEnum.RELEASE.getCode()).setOpenMsg("绿码,请通行").setOpenVoiceMsg("绿码,请通行");
|
|
|
}
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(nucleinList)) {
|
|
|
HealtCodeNucleinVO nucleinVO = nucleinList.stream().findFirst().get();
|
|
|
nucleinVO.setTitle("核酸检测").setContentColor(nucleicExpirationFlag ? ColorEnum.YELLOW.getValue() : ColorEnum.GREEN.getValue()).setIconUrl(nucleicExpirationFlag ? NucleicStatusEnum.NOT_AVAILABLE.getUrl() : NucleicStatusEnum.NEGATIVE.getUrl());
|
|
|
if (nucleinVO.getReportTime() != null && DateUtil.compare(nucleinVO.getChecktime(), nucleinVO.getReportTime()) > 0) {
|
|
|
-// nucleinVO.setContent(new StringBuilder().append(NucleicRuleEnum.TWENTY_FOUR.getValue()).append("H").append(" 结果未出").toString());
|
|
|
nucleinVO.setContent(new StringBuilder().append("结果未出").toString());
|
|
|
} else {
|
|
|
long betweenHour = DateUtil.between(nucleinVO.getShowTime(), DateUtil.date(), DateUnit.HOUR);
|
|
@@ -378,80 +210,12 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
.setVaccineIcoTitle("新冠疫苗").setVaccineIconUrl(HealthVaccineNumEnum.numOf(userVO.getVaccineNum()).getUrl()).setVaccineNumColor(ColorEnum.GREEN.getValue())
|
|
|
//行程信息
|
|
|
.setTravelValidationDesc(TravelValidationEnum.codeOf(userVO.getTravelValidation()).getDesc()).setTravelValidationTitle("动态行程卡").setTravelValidationIconUrl(TravelValidationEnum.codeOf(userVO.getTravelValidation()).getUrl());
|
|
|
- final PlaceInfoVO finalPlaceInfoVO = placeInfoVO;
|
|
|
- final HealtCodeUserVO finalUserVO = userVO;
|
|
|
- executor.execute(() -> {
|
|
|
- if (finalPlaceInfoVO != null && finalPlaceInfoVO.getScenicFlag() && finalUserVO.getIsOpen().equals(HealthOpenEnum.RELEASE.getCode())) {
|
|
|
- scenicServer.consume(new ScenicConsumeDTO().setIdNumber(shortTermDTO.getIdNumber()).setReservationCode(NumberUtil.isNumber(shortTermDTO.getHealthCode()) ? shortTermDTO.getHealthCode() : StrUtil.EMPTY), finalPlaceInfoVO.getAdminId());
|
|
|
- }
|
|
|
- });
|
|
|
return RestResponse.ok(userVO);
|
|
|
}
|
|
|
|
|
|
throw new ServiceException(703, "未查询到此数据");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 根据barCode查询健康码信息
|
|
|
- *
|
|
|
- * @param shortTermDTO
|
|
|
- * @return
|
|
|
- */
|
|
|
- private HealthResultVO<DeviceScanIdCardVO> deviceScanCode(ShortTermDTO shortTermDTO) {
|
|
|
- //健康码查询场所码信息
|
|
|
- HealthResultVO<DeviceScanIdCardVO> scanIdCardResult = placeHealthCodeServer.deviceScanCode(new DeviceScanCodeDTO().setDeviceId(shortTermDTO.getSn()).setHealthCodeQrCode(shortTermDTO.getHealthCode()).setUrlParams(shortTermDTO.getHealthCode()));
|
|
|
- //换绑场所码或者管理员健康码首次会提示设备未打卡等错误,重新发起调用
|
|
|
- if (scanIdCardResult == null || !scanIdCardResult.getCode().equals(Integer.valueOf(RestCode.SUCCESS.getCode()))) {
|
|
|
- if (scanIdCardResult != null && scanIdCardResult.getCode().equals(Integer.valueOf(RestCode.INVALID_TOKEN.getCode()))) {
|
|
|
- //清理token缓存
|
|
|
- placeHealthCodeServer.getToken(true);
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- Thread.sleep(500);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- scanIdCardResult = placeHealthCodeServer.deviceScanCode(new DeviceScanCodeDTO().setDeviceId(shortTermDTO.getSn()).setHealthCodeQrCode(shortTermDTO.getHealthCode()).setUrlParams(shortTermDTO.getHealthCode()));
|
|
|
- }
|
|
|
-
|
|
|
- return scanIdCardResult;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据证件号查询健康码信息
|
|
|
- *
|
|
|
- * @param shortTermDTO
|
|
|
- * @return
|
|
|
- */
|
|
|
- private HealthResultVO<DeviceScanIdCardVO> deviceScanIdCardEncrypt(ShortTermDTO shortTermDTO) {
|
|
|
- DeviceScanIdCardDTO scanIdCardDTO = new DeviceScanIdCardDTO().setDeviceId(shortTermDTO.getSn()).setIdNumber(shortTermDTO.getIdNumber());
|
|
|
- if (SMSOrIdCardUtils.isIdCard(shortTermDTO.getIdNumber())) {
|
|
|
- scanIdCardDTO.setIdType(IDTypeEnum.ID_CARD.getCode());
|
|
|
- } else {
|
|
|
- scanIdCardDTO.setIdType(IDTypeEnum.PASSPORT.getCode());
|
|
|
- }
|
|
|
-
|
|
|
- //扫人员证件查询场所码信息
|
|
|
- HealthResultVO<DeviceScanIdCardVO> scanIdCardResult = placeHealthCodeServer.deviceScanIdCardEncrypt(scanIdCardDTO);
|
|
|
- //换绑场所码或者管理员健康码首次会提示设备未打卡等错误,重新发起调用
|
|
|
- if (scanIdCardResult == null || !scanIdCardResult.getCode().equals(Integer.valueOf(RestCode.SUCCESS.getCode()))) {
|
|
|
- if (scanIdCardResult != null && scanIdCardResult.getCode().equals(Integer.valueOf(RestCode.INVALID_TOKEN.getCode()))) {
|
|
|
- //清理token缓存
|
|
|
- placeHealthCodeServer.getToken(true);
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- Thread.sleep(500);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- scanIdCardResult = placeHealthCodeServer.deviceScanIdCardEncrypt(scanIdCardDTO);
|
|
|
- }
|
|
|
-
|
|
|
- return scanIdCardResult;
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public RestResult<HealthCodeVO> queryInfoByBarCode(HealthCodeDTO healthCodeDTO) {
|
|
|
IrsTripAuthEnum authEnum = IrsTripAuthEnum.appKeyOf(healthCodeDTO.getAppKey());
|