Эх сурвалжийг харах

启用B2B时默认将企业信息同步给B2B

chenw 6 жил өмнө
parent
commit
6405773c00

+ 4 - 0
applications/commons/commons-server/pom.xml

@@ -104,6 +104,10 @@
             <groupId>com.google.zxing</groupId>
             <artifactId>javase</artifactId>
         </dependency>
+      <dependency>
+        <groupId>com.usoftchina.saas</groupId>
+        <artifactId>mall-api</artifactId>
+      </dependency>
     </dependencies>
 
     <build>

+ 20 - 1
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/ConfigsServiceImpl.java

@@ -2,6 +2,8 @@ package com.usoftchina.saas.commons.service.impl;
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.account.api.CompanyApi;
+import com.usoftchina.saas.account.dto.CompanyDTO;
 import com.usoftchina.saas.commons.cache.ConfigsCache;
 import com.usoftchina.saas.commons.dto.DocBaseDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
@@ -13,8 +15,11 @@ import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.api.CurrencyApi;
 import com.usoftchina.saas.document.dto.CurrencyDTO;
 import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.inquiry.api.EnConfigApi;
+import com.usoftchina.saas.inquiry.po.enConfig.AddOrUpdateEnterpriseRequest;
 import com.usoftchina.saas.page.PageDefault;
 import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.utils.http.HttpUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
@@ -35,7 +40,10 @@ public class ConfigsServiceImpl implements ConfigsService{
     private MessageLogService messageLogService;
     @Autowired
     private CurrencyApi currencyApi;
-
+    @Autowired
+    private EnConfigApi enConfigApi;
+    @Autowired
+    private CompanyApi companyApi;
 
     @Override
     public PageInfo getListData(@PageDefault(size = 10) PageRequest page, ListReqDTO req) {
@@ -113,6 +121,17 @@ public class ConfigsServiceImpl implements ConfigsService{
                 currencyApi.setStandard(currencyDTO);
             } else if("enableB2B".equals(con.getCode())){
                 int count = configsMapper.selectByCodeAndCompanyId(con.getCode(), BaseContextHolder.getCompanyId());
+                //将企业信息同步给B2B,用于平台开启数据传输
+                if ("1".equals(con.getData())){
+                    CompanyDTO companyDTO = companyApi.getCompanyById(BaseContextHolder.getCompanyId()).getData();
+                    enConfigApi.addOrUpdateEnterprise(new AddOrUpdateEnterpriseRequest(
+                            companyDTO.getUu(),
+                            companyDTO.getName(),
+                            true,
+                            true,
+                            companyDTO.getAccessKey()
+                    ));
+                }
                 if (count == 0){
                     //不存在,则插入
                     Configs configs = new Configs();

+ 8 - 1
applications/commons/commons-server/src/main/resources/application.yml

@@ -76,4 +76,11 @@ auth:
   public-key: auth/pub.key
 ribbon:
   ReadTimeout: 5000
-  ConnectTimeout: 5000
+  ConnectTimeout: 5000
+b2b:
+  baseUrl:
+    inquiry: https://test-inquiry.uuzcc.cn
+    Component: https://test-mall.uuzcc.cn
+    product: http://test-product.uuzcc.cn
+    common: http://test-b2b.uuzcc.cn
+    post: https://test-b2b-post.uuzcc.cn

+ 8 - 1
applications/commons/commons-server/src/main/resources/config/application-docker-prod.yml

@@ -20,4 +20,11 @@ spring:
     host: 10.10.100.173
     port: 6379
 logging:
-  destination: 10.10.100.160:5000
+  destination: 10.10.100.160:5000
+b2b:
+  baseUrl:
+    inquiry: https://api-inquiry.usoftchina.com
+    Component: https://mall.usoftchina.com
+    product: http://api-product.usoftchina.com
+    common: https://b2b-api.usoftchina.com
+    post: https://b2b-post.usoftchina.com

+ 11 - 0
applications/transfers/mall-api/src/main/java/com/usoftchina/saas/inquiry/po/enConfig/AddOrUpdateEnterpriseRequest.java

@@ -67,4 +67,15 @@ public class AddOrUpdateEnterpriseRequest {
     public void setAccessSecret(String accessSecret) {
         this.accessSecret = accessSecret;
     }
+
+    public AddOrUpdateEnterpriseRequest(Long enuu, String name, boolean saas, boolean saasPost, String accessSecret) {
+        this.enuu = enuu;
+        this.name = name;
+        this.saas = saas;
+        this.saasPost = saasPost;
+        this.accessSecret = accessSecret;
+    }
+
+    public AddOrUpdateEnterpriseRequest() {
+    }
 }