Browse Source

add:计量大学三方接口通行接入

lileilei 2 years ago
parent
commit
17e18a4eda

+ 19 - 0
src/main/java/com/yixin/ms/model/enums/CanPassEnum.java

@@ -0,0 +1,19 @@
+package com.yixin.ms.model.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author: lileilei
+ * @date: 2022/8/29 14:39
+ * @description:
+ */
+@AllArgsConstructor
+@Getter
+public enum CanPassEnum {
+    THROUGH("1", "通过"),
+    NOT_THROUGH("0", "不通过");
+
+    private String code;
+    private String desc;
+}

+ 89 - 0
src/main/java/com/yixin/ms/server/JiliangUniversityServer.java

@@ -0,0 +1,89 @@
+package com.yixin.ms.server;
+
+import cn.hutool.cache.CacheUtil;
+import cn.hutool.cache.impl.TimedCache;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpUtil;
+import com.alibaba.fastjson.JSON;
+import com.google.common.collect.Maps;
+import com.yixin.ms.boot.restful.RestCode;
+import com.yixin.ms.server.dto.JiliangCanPassDTO;
+import com.yixin.ms.server.dto.JiliangCanPassDataDTO;
+import com.yixin.ms.server.vo.HealthResultVO;
+import com.yixin.ms.server.vo.JiliangCanPassVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @author: lileilei
+ * @date: 2022/8/25 15:53
+ * @description: 计量大学校园平台开放接口服务
+ */
+@Slf4j
+@Component
+public class JiliangUniversityServer {
+    /**
+     * token 缓存标识
+     */
+    private static final String TOKEN = "jiliang_token";
+
+    @Value("${jiliang.appKey}")
+    private String appKey;
+    @Value("${jiliang.appSecret}")
+    private String appSecret;
+    @Value("${jiliang.getTokenUrl}")
+    private String getTokenUrl;
+    @Value("jiliang.canPassUrl")
+    private String canPassUrl;
+
+    /**
+     * 请求密钥有效时间为 一天
+     *
+     * @see <a href="https://www.hutool.cn/docs/#/cache/TimedCache">定时缓存</a>
+     */
+    private static TimedCache<String, String> tokenCache = CacheUtil.newTimedCache(24 * 60 * 60 * 1000);
+
+    /**
+     * 获取accesskey(有效期一天)
+     * @return
+     */
+    public String getToken(){
+        String token = tokenCache.get(TOKEN);
+        if(StrUtil.isNotEmpty(token)){
+            return token;
+        }
+
+        Map<String, Object> paramMap = MapUtil.newHashMap();
+        paramMap.put("appKey", appKey);
+        paramMap.put("appSecret", appSecret);
+        String body = HttpUtil.post(getTokenUrl, paramMap);
+        HealthResultVO resultVO = JSON.parseObject(body, HealthResultVO.class);
+        if(resultVO.getCode().equals(Integer.valueOf(RestCode.SUCCESS.getCode()))){
+            tokenCache.put(TOKEN, resultVO.getData().toString());
+        }
+
+        log.info("计量大学开放平台获取token响应内容:{}", body);
+        return resultVO.getData().toString();
+    }
+
+    /**
+     * 获取通过结果 0-不通过,1-通过
+     * @param dto
+     * @return
+     */
+    public String canPass(JiliangCanPassDataDTO dto){
+        Map<String, String> headers = Maps.newHashMap();
+        headers.put("x-access-token", this.getToken());
+        String body = HttpUtil.createPost(canPassUrl).addHeaders(headers).body(JSON.toJSONString(new JiliangCanPassDTO().setData(dto))).execute().body();
+        HealthResultVO<JiliangCanPassVO> resultVO = JSON.parseObject(body, HealthResultVO.class);
+        if(resultVO.getCode().equals(Integer.valueOf(RestCode.SUCCESS.getCode()))){
+            resultVO.setData(JSON.parseObject(JSON.toJSONString(resultVO.getData()), JiliangCanPassVO.class));
+        }
+
+        return resultVO.getData().getCanPass();
+    }
+}

+ 15 - 0
src/main/java/com/yixin/ms/server/dto/JiliangCanPassDTO.java

@@ -0,0 +1,15 @@
+package com.yixin.ms.server.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @author: lileilei
+ * @date: 2022/8/25 16:16
+ * @description:
+ */
+@Data
+@Accessors(chain = true)
+public class JiliangCanPassDTO {
+    private JiliangCanPassDataDTO data;
+}

+ 25 - 0
src/main/java/com/yixin/ms/server/dto/JiliangCanPassDataDTO.java

@@ -0,0 +1,25 @@
+package com.yixin.ms.server.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * @author: lileilei
+ * @date: 2022/8/25 16:16
+ * @description:
+ */
+@Data
+@Accessors(chain = true)
+public class JiliangCanPassDataDTO {
+    @ApiModelProperty("身份证号")
+    private String idCard;
+
+    @ApiModelProperty("刷码时间")
+    private Date opTime;
+
+    @ApiModelProperty("设备编码")
+    private String sn;
+}

+ 20 - 0
src/main/java/com/yixin/ms/server/vo/JiliangCanPassVO.java

@@ -0,0 +1,20 @@
+package com.yixin.ms.server.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @author: lileilei
+ * @date: 2022/8/25 16:42
+ * @description:
+ */
+@Data
+@Accessors(chain = true)
+public class JiliangCanPassVO {
+    @ApiModelProperty("0为不通过,1为通过")
+    private String canPass;
+
+    @ApiModelProperty("身份证号")
+    private String idCard;
+}

+ 15 - 251
src/main/java/com/yixin/ms/service/impl/HealthCodeServiceImpl.java

@@ -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());

+ 7 - 0
src/main/resources/application-dev.yml

@@ -150,3 +150,10 @@ scenic:
   verifyUrl: https://test.d6.com.cn/data/notify/demo/verify
   queryUrl: https://test.d6.com.cn/data/notify/demo/query
   consumeUrl: https://test.d6.com.cn/data/notify/demo/consume
+
+#计量大学校园平台开放接口服务
+jiliang:
+  appKey: SnNOJW1cx
+  appSecret: 43f97444e459668c3e19e7bef47491873ba15477
+  getTokenUrl: https://test-api.teamcube.cn/teamcube-coop/app-platform/api/rest/api_token
+  canPassUrl: https://test-api.teamcube.cn/teamcube-coop/app-platform/api/rest/update_op/yqfkgl/xym/Dzjjk

+ 7 - 0
src/main/resources/application-prod.yml

@@ -147,3 +147,10 @@ scenic:
   queryUrl: https://api.d6.com.cn/openapi/v1/query
   consumeUrl: https://api.d6.com.cn/openapi/v1/consume
 
+#计量大学校园平台开放接口服务
+jiliang:
+  appKey: SnNOJW1cx
+  appSecret: 43f97444e459668c3e19e7bef47491873ba15477
+  getTokenUrl: https://test-api.teamcube.cn/teamcube-coop/app-platform/api/rest/api_token
+  canPassUrl: https://test-api.teamcube.cn/teamcube-coop/app-platform/api/rest/update_op/yqfkgl/xym/Dzjjk
+

+ 7 - 0
src/main/resources/application-test.yml

@@ -158,3 +158,10 @@ scenic:
   queryUrl: https://api.d6.com.cn/openapi/v1/query
   consumeUrl: https://api.d6.com.cn/openapi/v1/consume
 
+#计量大学校园平台开放接口服务
+jiliang:
+  appKey: SnNOJW1cx
+  appSecret: 43f97444e459668c3e19e7bef47491873ba15477
+  getTokenUrl: https://test-api.teamcube.cn/teamcube-coop/app-platform/api/rest/api_token
+  canPassUrl: https://test-api.teamcube.cn/teamcube-coop/app-platform/api/rest/update_op/yqfkgl/xym/Dzjjk
+