k94314517
2024-10-30 47a53d22a025c0ed095c9c4ed2e1ce35ce54184e
server/visits/dmvisit_service/src/main/java/com/doumee/core/haikang/service/HKService.java
@@ -1,7 +1,10 @@
package com.doumee.core.haikang.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.haikang.model.HKConstants;
import com.doumee.core.haikang.model.HKTools;
import com.doumee.core.haikang.model.param.BaseListPageResponse;
@@ -10,6 +13,7 @@
import com.doumee.core.haikang.model.param.request.*;
import com.doumee.core.haikang.model.param.respose.*;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.HttpsUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -21,6 +25,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Slf4j
public class HKService {
@@ -1320,6 +1325,10 @@
        }
        return  null;
    }
    /**
     *获取月台组件配置的LED设备清单
     * @return
@@ -1457,6 +1466,42 @@
        }
        return  null;
    }
    public static BaseResponse sendSmsByHk(Map<String,Object> param,String url){
        log.info("【海康发送短信】================开始===="+JSONObject.toJSONString(param));
        try {
            TypeReference typeReference =
                    new TypeReference<BaseResponse>(){};
            String res = HttpsUtil.postJson(url, JSONObject.toJSONString(param));
            BaseResponse result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"海康发送短信");
            return  result;
        }catch (Exception e){
            log.error("【海康发送短信】================失败====:\n"+ e.getMessage());
            e.printStackTrace();
        }
       return null;
    }
    public static BaseResponse<MenuDataResponse> getMenuConfig(Map<String,String> param){
        log.info("【获取菜单功能配置项】================开始===="+ JSONObject.toJSONString(param));
        try {
            String res = HKTools.getHkMenu(param);
            TypeReference typeReference =
                    new TypeReference<BaseResponse<MenuDataResponse>>(){};
            BaseResponse<MenuDataResponse>   result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,"获取菜单功能配置项");
            return  result;
        }catch (Exception e){
            log.error("【获取菜单功能配置项】================失败====:\n"+ e.getMessage());
            e.printStackTrace();
        }
        return null;
    }
    private static void logResult(BaseResponse res,String name) {
        if(StringUtils.equals(res.getCode(),HKConstants.RESPONSE_SUCCEE)){
            log.info("【"+name+"】================成功====\n"+res);