|
@@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
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;
|
|
@@ -20,6 +22,7 @@ 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;
|
|
@@ -58,6 +61,29 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
private ScenicServer scenicServer;
|
|
|
@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) {
|
|
@@ -151,7 +177,7 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
HealthResultVO<DeviceScanIdCardVO> scanIdCardResult = null;
|
|
|
if (StrUtil.isNotEmpty(shortTermDTO.getHealthCode())) {
|
|
|
if (placeInfoVO.getScenicFlag() && NumberUtil.isNumber(shortTermDTO.getHealthCode())) {
|
|
|
- ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setReservationCode(shortTermDTO.getHealthCode()));
|
|
|
+ ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setReservationCode(shortTermDTO.getHealthCode()), placeInfoVO.getAdminId());
|
|
|
if (!verifyVO.getReleaseStatus()) {
|
|
|
throw new ServiceException(verifyVO.getMessage());
|
|
|
} else {
|
|
@@ -166,8 +192,8 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
healthCodeVO = restResult.getData();
|
|
|
}
|
|
|
|
|
|
- if(healthCodeVO != null){
|
|
|
- ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setIdNumber(healthCodeVO.getIdNum()));
|
|
|
+ if (healthCodeVO != null) {
|
|
|
+ ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setIdNumber(healthCodeVO.getIdNum()), placeInfoVO.getAdminId());
|
|
|
if (!verifyVO.getReleaseStatus()) {
|
|
|
throw new ServiceException(verifyVO.getMessage());
|
|
|
}
|
|
@@ -179,7 +205,7 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
}
|
|
|
} else {
|
|
|
if (placeInfoVO.getScenicFlag()) {
|
|
|
- ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setIdNumber(shortTermDTO.getIdNumber()));
|
|
|
+ ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setIdNumber(shortTermDTO.getIdNumber()), placeInfoVO.getAdminId());
|
|
|
if (!verifyVO.getReleaseStatus()) {
|
|
|
throw new ServiceException(verifyVO.getMessage());
|
|
|
}
|
|
@@ -237,6 +263,10 @@ 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));
|
|
|
/**
|
|
|
* 0 未接种 对应0针
|
|
|
*
|
|
@@ -256,6 +286,16 @@ 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)) {
|
|
@@ -324,7 +364,7 @@ public class HealthCodeServiceImpl implements HealthCodeService {
|
|
|
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));
|
|
|
+ scenicServer.consume(new ScenicConsumeDTO().setIdNumber(shortTermDTO.getIdNumber()).setReservationCode(NumberUtil.isNumber(shortTermDTO.getHealthCode()) ? shortTermDTO.getHealthCode() : StrUtil.EMPTY), finalPlaceInfoVO.getAdminId());
|
|
|
}
|
|
|
});
|
|
|
return RestResponse.ok(userVO);
|