zoukankan      html  css  js  c++  java
  • 支付回调(hutool工具类)

    /**
     * 订单信息同步给商户
     *
     * @param corpId
     * @param jsonObject
     * @return
     */
    @Override
    public BaseResult orderCallBack(Long corpId, JSONObject jsonObject) {
        ApiCorpConfig apiCorpConfigQuery = new ApiCorpConfig();
        apiCorpConfigQuery.setCorpId(corpId);
        ApiCorpConfig apiCorpConfig = apiCorpConfigDao.selectOne(apiCorpConfigQuery);
        if (apiCorpConfig == null){
            throw new BaseBussinessException(ErrorCodeEnum.GW10019010);
        }
        String orderGrantNotifyAddress = apiCorpConfig.getOrderGrantNotifyAddress();
        if (StrUtil.isEmpty(orderGrantNotifyAddress)){
            return new BaseResult(false, 200, "没有配置回调地址");
        }
        NoticeSettlementVo noticeSettlementVo = new NoticeSettlementVo();
        noticeSettlementVo.setAppId(apiCorpConfig.getAppId());
        String jsonString  =JSON.toJSONString(jsonObject);
        noticeSettlementVo.setContent(jsonString);
        Long now = new Date().getTime();
        noticeSettlementVo.setTimestamp(now);
        String concatString = apiCorpConfig.getAppId()+apiCorpConfig.getSecret()+jsonString+ +now;
        String md5String = MD5Util.md5(concatString);
        noticeSettlementVo.setSign(md5String);
        String jsonBody = JSON.toJSONString(noticeSettlementVo);
        log.info("调用外部接口参数为:"+jsonBody);
        String body = "{\"flag\":\"false\"}";
        try {
            body = HttpRequest.post(orderGrantNotifyAddress).body(jsonBody).execute().body();
        }catch (Exception e){
            log.info(e.getMessage());
            e.printStackTrace();
        }
        log.info("调用外部接口返回值为:"+body);
        return JSON.parseObject(body,BaseResult.class);
    }
  • 相关阅读:
    AVR汇编初探之二《AVR的指令与汇编系统》
    Fedora 18 装完后干的事
    重建tempdb
    sqlserver 2008 r2 SqlClrProvider报错解析
    Analysis Memory In Sqlserver
    《设计模式之禅》学习笔记(七)
    容易弄错的繁体字
    《C Primer Plus》学习笔记
    什么是 Windows 能干而 Linux 干不了的事情
    MySQL中BLOB字段类型介绍
  • 原文地址:https://www.cnblogs.com/zhuxiang1029/p/15623907.html
Copyright © 2011-2022 走看看