add
yj
2024-12-05 b9900893177c78fc559223521fe839aa21000017
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.iotechn.unimall.biz.config;
 
import com.iotechn.unimall.biz.client.erp.ErpClient;
import com.iotechn.unimall.biz.client.erp.dobbin.DobbinErpClient;
import com.iotechn.unimall.biz.client.erp.mock.ErpMockClient;
import com.iotechn.unimall.data.properties.UnimallErpOpenPlatformProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
@Configuration
public class ErpConfig {
 
    @Autowired
    private UnimallErpOpenPlatformProperties unimallErpOpenPlatformProperties;
 
    @Bean
    public ErpClient erpClient() {
        if ("mock".equals(unimallErpOpenPlatformProperties.getEnable())) {
            return new ErpMockClient();
        } else if ("dobbin".equals(unimallErpOpenPlatformProperties.getEnable())) {
            return new DobbinErpClient();
        } else {
            return new ErpMockClient();
        }
 
    }
 
}