Browse Source

add:对外开放健康码接口服务

lileilei 2 years ago
parent
commit
1eaa9ee58a

+ 7 - 0
src/main/java/com/yixin/ms/controller/HealthCodeController.java

@@ -5,6 +5,7 @@ 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.SMSOrIdCardUtils;
+import com.yixin.ms.model.dto.HealthCodeConfigDTO;
 import com.yixin.ms.model.dto.HealthCodeDTO;
 import com.yixin.ms.model.dto.ShortTermDTO;
 import com.yixin.ms.model.vo.HealtCodeUserVO;
@@ -37,6 +38,12 @@ public class HealthCodeController {
         return healthCodeService.getShortTerm(shortTermDTO);
     }
 
+    @ApiOperation("场所码注册")
+    @PostMapping("/saveHealthCodeConfig")
+    public RestResult saveHealthCodeConfig(@RequestBody HealthCodeConfigDTO configDTO) {
+        return healthCodeService.saveHealthCodeConfig(configDTO);
+    }
+
     @ApiOperation("创建token")
     @PostMapping("/addToken")
     public RestResult<String> addToken(String token) {

+ 32 - 0
src/main/java/com/yixin/ms/model/dto/HealthCodeConfigDTO.java

@@ -0,0 +1,32 @@
+package com.yixin.ms.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @author: lileilei
+ * @date: 2022/8/30 17:10
+ * @description:
+ */
+@Data
+@Accessors(chain = true)
+public class HealthCodeConfigDTO {
+    @ApiModelProperty(value = "注册到某个地址码")
+    private String addressCode;
+
+    @ApiModelProperty(value = "场所码单位名称")
+    private String unitName;
+
+    @ApiModelProperty(value = "场所码单位地址")
+    private String unitAddress;
+
+    @ApiModelProperty(value = "场所码管理员健康码信息")
+    private String managerHealthCode;
+
+    @ApiModelProperty(value = "设备编码")
+    private String sn;
+
+    @ApiModelProperty(value = "token")
+    private String token;
+}

+ 27 - 0
src/main/java/com/yixin/ms/model/enums/TokenEnum.java

@@ -0,0 +1,27 @@
+package com.yixin.ms.model.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author: lileilei
+ * @date: 2022/8/30 16:53
+ * @description:
+ */
+@AllArgsConstructor
+@Getter
+public enum TokenEnum {
+    UNIVERSAL_TOKEN("c527a375fa704c2184687fd4d38e4803");
+
+    private String code;
+
+    public static TokenEnum codeOf(String code){
+        for(TokenEnum tokenEnum : values()){
+            if(tokenEnum.getCode().equals(code)){
+                return tokenEnum;
+            }
+        }
+
+        return null;
+    }
+}

+ 34 - 0
src/main/java/com/yixin/ms/server/PlaceHealthCodeServer.java

@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.yixin.ms.boot.restful.RestResult;
 import com.yixin.ms.boot.uitls.RedisUtil;
 import com.yixin.ms.crypto.util.SzhzSm2Util;
+import com.yixin.ms.model.dto.HealthCodeConfigDTO;
 import com.yixin.ms.server.dto.DeviceScanCodeDTO;
 import com.yixin.ms.server.dto.DeviceScanIdCardDTO;
 import com.yixin.ms.server.dto.PlaceRecordDTO;
@@ -30,6 +31,7 @@ import org.springframework.web.client.RestTemplate;
 @Slf4j
 public class PlaceHealthCodeServer {
     private static final String TOKEN_KEY = "health:code:token";
+
     @Value("${health.code.clientId}")
     private String clientId;
 
@@ -54,6 +56,12 @@ public class PlaceHealthCodeServer {
     @Value("${health.code.queryPlaceInfoBySnUrl}")
     private String queryPlaceInfoBySnUrl;
 
+    @Value("${health.code.queryOpenPlaceInfoBySnUrl}")
+    private String queryOpenPlaceInfoBySnUrl;
+
+    @Value("${health.code.saveHealthCodeConfigUrl}")
+    private String saveHealthCodeConfigUrl;
+
     @Value("${health.code.savePlaceRecordUrl}")
     private String savePlaceRecordUrl;
 
@@ -189,10 +197,36 @@ public class PlaceHealthCodeServer {
         return result;
     }
 
+    /**
+     * 通过设备sn查询场所码信息
+     */
+    public RestResult<PlaceInfoVO> queryOpenPlaceInfoBySn(String sn) {
+        RestResult result = null;
+
+        try {
+            result = restTemplate.getForObject(new StringBuilder().append(queryOpenPlaceInfoBySnUrl).append("?sn=").append(sn).toString(), RestResult.class);
+            result.setData(JSON.parseObject(JSON.toJSONString(result.getData()), PlaceInfoVO.class));
+            log.info("通过设备sn: {}, 查询场所码信息返回内容:{}", sn, JSON.toJSONString(result));
+        } catch (Exception e) {
+            log.error("通过设备sn查询场所码信息异常:{}", e.getMessage());
+            e.printStackTrace();
+            return result;
+        }
+
+        return result;
+    }
+
+
+
     /**
      * 保存场所记录
      */
     public RestResult<PlaceInfoVO> savePlaceRecord(PlaceRecordDTO dto) {
         return restTemplate.postForObject(savePlaceRecordUrl, dto, RestResult.class);
     }
+
+
+    public RestResult saveHealthCodeConfig(HealthCodeConfigDTO configDTO) {
+        return restTemplate.postForObject(saveHealthCodeConfigUrl, configDTO, RestResult.class);
+    }
 }

+ 9 - 0
src/main/java/com/yixin/ms/server/vo/PlaceInfoVO.java

@@ -34,4 +34,13 @@ public class PlaceInfoVO {
 
     @ApiModelProperty("景区预约标识")
     private Boolean scenicFlag;
+
+    @ApiModelProperty("每秒请求数")
+    private Integer requestNumber;
+
+    @ApiModelProperty("注册状态")
+    private Boolean registerStatus;
+
+    @ApiModelProperty(value = "是否开启场所码")
+    private Boolean enableStatus;
 }

+ 8 - 0
src/main/java/com/yixin/ms/service/HealthCodeService.java

@@ -2,6 +2,7 @@ package com.yixin.ms.service;
 
 
 import com.yixin.ms.boot.restful.RestResult;
+import com.yixin.ms.model.dto.HealthCodeConfigDTO;
 import com.yixin.ms.model.dto.HealthCodeDTO;
 import com.yixin.ms.model.dto.ShortTermDTO;
 import com.yixin.ms.model.vo.HealtCodeUserVO;
@@ -33,5 +34,12 @@ public interface HealthCodeService {
      * @return
      */
     RestResult<HealthCodeVO> queryInfoByBarCode(HealthCodeDTO healthCodeDTO);
+
+    /**
+     * 场所码注册
+     * @param configDTO
+     * @return
+     */
+    RestResult saveHealthCodeConfig(HealthCodeConfigDTO configDTO);
 }
 

+ 88 - 150
src/main/java/com/yixin/ms/service/impl/HealthCodeServiceImpl.java

@@ -5,8 +5,6 @@ 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;
@@ -21,34 +19,43 @@ 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.HealthCodeConfigDTO;
 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.dto.DeviceScanCodeDTO;
+import com.yixin.ms.server.dto.DeviceScanIdCardDTO;
+import com.yixin.ms.server.vo.DeviceScanIdCardVO;
+import com.yixin.ms.server.vo.HealthCodeVO;
+import com.yixin.ms.server.vo.HealthResultVO;
+import com.yixin.ms.server.vo.PlaceInfoVO;
 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.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 
 import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
 
 
 @Slf4j
 @Service
 public class HealthCodeServiceImpl implements HealthCodeService {
+    /**
+     * 设备限制访问标识
+     */
+    private static final String LIMIT_REQUEST_NUMBER = "health:limit:number:";
+
     @Autowired
     private RedisUtil redisUtil;
     @Autowired
@@ -56,34 +63,7 @@ public class HealthCodeServiceImpl implements HealthCodeService {
     @Autowired
     private HealthCodeServer healthCodeServer;
     @Autowired
-    private HealthServer healthServer;
-    @Autowired
-    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));
-//        }
-//    }
+    private RedisTemplate redisTemplate;
 
     @Override
     public HealtCodeUserVO getShortTermCertificate(ShortTermDTO shortTermDTO) {
@@ -126,16 +106,24 @@ 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(TokenEnum.codeOf(shortTermDTO.getToken()) == null){
+            throw new ServiceException(700, "token有误,请检查");
+        }
+
+        if (StrUtil.isEmpty(shortTermDTO.getSn())) {
+            throw new ServiceException("设备编码必传,请检查入参信息");
+        }
+
         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为空哦");
-        }
-
         /**
          * \\000026https://h5.dingtalk.com/healthAct/index.html?stateCouncilBarCode=ffd631d12c5ee80fe77fe0fb4347b4e8&flag=1#/result
          * 扫码参数兼容问题处理
@@ -162,105 +150,68 @@ public class HealthCodeServiceImpl implements HealthCodeService {
         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);
-                    }
+        RestResult<PlaceInfoVO> placeInfoResult = placeHealthCodeServer.queryOpenPlaceInfoBySn(shortTermDTO.getSn());
+        if(placeInfoResult == null){
+            throw new ServiceException("浙江服务平台异常,请稍后");
+        }
 
-                    //景区预约,走预约码查询
-                    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(placeInfoResult.getData() == null){
+            throw new ServiceException("设备暂无调用权限,请联系管理员");
+        }
 
-                    //景区预约,走健康码查询
-                    if (placeInfoVO.getScenicFlag() && !NumberUtil.isNumber(shortTermDTO.getHealthCode())) {
-                        RestResult<HealthCodeVO> restResult = healthServer.queryInfoByBarCode(shortTermDTO.getHealthCode());
-                        HealthCodeVO healthCodeVO = null;
+        if (placeInfoResult != null && placeInfoResult.getData() != null){
+            if(placeInfoResult.getData().getRequestNumber().equals(0)){
+                throw new ServiceException("设备每秒请求次数限制,请联系管理员");
+            }
 
-                        if (restResult.getCode() == RestCode.SUCCESS.getCode()) {
-                            healthCodeVO = restResult.getData();
-                        }
+            String cacheKey = new StringBuilder().append(LIMIT_REQUEST_NUMBER).append(shortTermDTO.getSn()).toString();
+            int times = 1;
+            Object timesStr = redisTemplate.opsForValue().get(cacheKey);
+            if (timesStr == null) {
+                //设备限制单位时间访问次数
+                redisTemplate.opsForValue().set(cacheKey, times, 1, TimeUnit.SECONDS);
+            } else {
+                redisTemplate.opsForValue().increment(cacheKey);
+                if(Integer.valueOf(timesStr.toString()) > placeInfoResult.getData().getRequestNumber()){
+                    throw new ServiceException("设备每秒请求次数限制,请联系管理员");
+                }
+            }
+        }
 
-                        if (healthCodeVO != null) {
-                            ScenicVerifyVO verifyVO = scenicServer.verify(new ScenicVerifyDTO().setIdNumber(healthCodeVO.getIdNum()), placeInfoVO.getAdminId());
-                            if (!verifyVO.getReleaseStatus()) {
-                                throw new ServiceException(verifyVO.getMessage());
-                            }
+        if (placeInfoResult != null && placeInfoResult.getData() != null && !placeInfoResult.getData().getEnableStatus() && StrUtil.isNotEmpty(shortTermDTO.getHealthCode())) {
+            throw new ServiceException("设备扫码未绑定场所码,请联系管理员");
+        }
 
-                            shortTermDTO.setName(verifyVO.getUserName()).setIdNumber(verifyVO.getIdNumber());
-                        }
+        if (placeInfoResult != null && placeInfoResult.getData() != null && placeInfoResult.getData().getEnableStatus()) {
+            HealthResultVO<DeviceScanIdCardVO> scanIdCardResult = null;
+            if (StrUtil.isNotEmpty(shortTermDTO.getHealthCode())) {
+                scanIdCardResult = this.deviceScanCode(shortTermDTO);
+            } else {
+                scanIdCardResult = this.deviceScanIdCardEncrypt(shortTermDTO);
+            }
 
-                        scanIdCardResult = this.deviceScanCode(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 {
-                    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);
+                    userVO.setNuclein(Lists.newArrayList());
                 }
 
-                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);
+                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());
             }
         } else {
-            //设备sn为空默认走之前的健康码查询
+            //之前的健康码查询
             userVO = this.getShortTermCertificate(shortTermDTO);
         }
 
@@ -296,16 +247,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 +285,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,13 +314,6 @@ 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);
         }
 
@@ -462,6 +391,15 @@ public class HealthCodeServiceImpl implements HealthCodeService {
         return healthCodeServer.queryInfoByBarCode(healthCodeDTO.getBarCode());
     }
 
+    @Override
+    public RestResult saveHealthCodeConfig(HealthCodeConfigDTO configDTO) {
+        if(TokenEnum.codeOf(configDTO.getToken()) == null){
+            throw new ServiceException(700, "token有误,请检查");
+        }
+
+        return placeHealthCodeServer.saveHealthCodeConfig(configDTO);
+    }
+
     public HealtCodeUserVO getShortTermUser(String sfzh, String name) throws Exception {
         log.info("江干分局健康码传参,身份证{} 姓名 {}", sfzh, name);
         JSONObject jsonObject = new JSONObject();

+ 3 - 1
src/main/resources/application-dev.yml

@@ -1,7 +1,7 @@
 server:
   port: 8801
   servlet:
-    context-path: /traffic-violation-publicity
+    context-path: /open-health-code
     session:
       persistent: false
 
@@ -123,6 +123,8 @@ health:
     deviceScanIdCardEncryptUrl: https://szhzjkm.hangzhou.gov.cn:8097/api/v1/health/code/device/scanIdCardEncrypt
     deviceScanCodeUrl: https://szhzjkm.hangzhou.gov.cn:8097/api/v1/health/code/device/scanCode
     queryPlaceInfoBySnUrl: http://192.168.11.14:9100/yx-fyzd/api/open/queryPlaceInfoBySn
+    queryOpenPlaceInfoBySnUrl: http://127.0.0.1:9100/yx-fyzd/api/open/queryOpenPlaceInfoBySn
+    saveHealthCodeConfigUrl: http://127.0.0.1:9100/yx-fyzd/api/open/saveHealthCodeConfig
     savePlaceRecordUrl: http://192.168.11.14:9100/yx-fyzd/api/open/savePlaceRecord
 
 #省共享IRS数据资源

+ 4 - 2
src/main/resources/application-prod.yml

@@ -1,7 +1,7 @@
 server:
-  port: 9108
+  port: 9109
   servlet:
-    context-path: /health-code
+    context-path: /open-health-code
     session:
       persistent: false
 
@@ -119,6 +119,8 @@ health:
     deviceScanIdCardEncryptUrl: https://szhzjkm.hangzhou.gov.cn:9095/api/v1/health/code/device/scanIdCardEncrypt
     deviceScanCodeUrl: https://szhzjkm.hangzhou.gov.cn:9095/api/v1/health/code/device/scanCode
     queryPlaceInfoBySnUrl: https://noise.hz-hanghui.com:8088/yx-fyzd/api/open/queryPlaceInfoBySn
+    queryOpenPlaceInfoBySnUrl: https://noise.hz-hanghui.com:8088/yx-fyzd/api/open/queryOpenPlaceInfoBySn
+    saveHealthCodeConfigUrl: https://noise.hz-hanghui.com:8088/yx-fyzd/api/open/saveHealthCodeConfig
     savePlaceRecordUrl: https://noise.hz-hanghui.com:8088/yx-fyzd/api/open/savePlaceRecord
 
 #省共享IRS数据资源

+ 3 - 1
src/main/resources/application-test.yml

@@ -1,7 +1,7 @@
 server:
   port: 8801
   servlet:
-    context-path: /health-code
+    context-path: /open-health-code
     session:
       persistent: false
 
@@ -119,6 +119,8 @@ health:
     deviceScanIdCardEncryptUrl: https://szhzjkm.hangzhou.gov.cn:9095/api/v1/health/code/device/scanIdCardEncrypt
     deviceScanCodeUrl: https://szhzjkm.hangzhou.gov.cn:9095/api/v1/health/code/device/scanCode
     queryPlaceInfoBySnUrl: http://127.0.0.1:9100/yx-fyzd/api/open/queryPlaceInfoBySn
+    queryOpenPlaceInfoBySnUrl: http://127.0.0.1:9100/yx-fyzd/api/open/queryOpenPlaceInfoBySn
+    saveHealthCodeConfigUrl: http://127.0.0.1:9100/yx-fyzd/api/open/saveHealthCodeConfig
     savePlaceRecordUrl: http://127.0.0.1:9100/yx-fyzd/api/open/savePlaceRecord
 
 #省共享IRS数据资源