jiangping
2024-07-24 892f3abd52e172e8ace6afd59285b9c6a7a3be28
server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java
@@ -67,7 +67,7 @@
     */
   @Override
   public ZTSysuserGetTokenResponse getSysuserToken(String  mobile){
       ZTBaseResponse<ZTSysuserGetTokenResponse> result = sendHttpRequest(
       ZTBaseResponse<ZTSysuserGetTokenResponse> result = sendSysHttpRequest(
               ZTConstants.IntegerUrl.USER_MOBILE_FASTLOGIN_URL+"?mobile="+mobile,
               ZTConstants.IntegerName.USER_MOBILE_FASTLOGIN_NAME,
               null,
@@ -672,6 +672,40 @@
        }
        return  null;
    }
    public   <T>   ZTBaseResponse<T> sendSysHttpRequest(String url,String name,String token,String userType,String param,TypeReference<ZTBaseResponse<T>> typeReference){
        log.info("【"+name+"】================开始===="+ JSONObject.toJSONString(param));
        String res = null;
        int success = 0;
        try {
            Map<String,String> headers = new HashMap<>();
            if(StringUtils.equals(userType,ZTConstants.CUSTOMER)){
                //如果是C端客户
                headers.put(ZTConstants.HEADER_TOKEN,token);
            }else{
                //如果是B端用户
                headers.put(ZTConstants.HEADER_SYSUSER_TOKEN,token);
            }
            headers.put(ZTConstants.HEADER_USERTYPE,userType);
            String index = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.ZBOM_ZHONGTAI_SYS_API_URL);
            res = HttpsUtil.postJsonWithHeaders(index+url,param,headers);
            ZTBaseResponse<T>  result = JSONObject.parseObject(res, typeReference.getType());
            logResult(result,name);
            if(Constants.equalsInteger(result.getCode(),ZTConstants.CODE_SUCCESS)){
                return  result;
            }else{
                success =1;
            }
        }catch (Exception e){
            success = 1;
            log.error("【"+name+"】================失败===="+ JSONObject.toJSONString(param));
        }finally {
            saveInterfaceLog(url,name,param,success,res);
        }
        return  null;
    }
    public  void  saveInterfaceLog(String url,String name,String  param,Integer success,String respone){
        if(interfaceLogMapper ==null){
            return;