MallConfiguration.java
1.23 KB
package com.diligrp.cashier.mall;
import com.diligrp.cashier.mall.client.RtMallHttpClient;
import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan("com.diligrp.cashier.mall")
@MapperScan(basePackages = {"com.diligrp.cashier.mall.dao"}, markerInterface = MybatisMapperSupport.class)
public class MallConfiguration {
/**
* 创建大润发HTTP客户端
* 用于调用大润发订单详情接口
*/
@Bean
public RtMallHttpClient rtMallHttpClient(@Value("${rtmall.api.url:https://em-shop.feiniugo.com/api/externalapi/scanbuy/process}") String apiUrl,
RtMallDynamicProperty rtMallDynamicProperty) {
RtMallDynamicProperty.AppSecretDynamicProperty config = rtMallDynamicProperty.getAppSecrets().getFirst();
return new RtMallHttpClient(apiUrl, config.getAppKey(), config.getAppSecret());
}
}