Pārlūkot izejas kodu

贸易平台修改

fengx 6 mēneši atpakaļ
vecāks
revīzija
468da63569

+ 11 - 0
src/main/java/com/sunxung/factoring/service/customerinformation/impl/CustomerServiceImpl.java

@@ -16,6 +16,7 @@ import com.sunxung.factoring.entity.customerinformation.Customer;
 import com.sunxung.factoring.entity.customerinformation.SupplierBankCardInfo;
 import com.sunxung.factoring.entity.entprise.Enterprise;
 import com.sunxung.factoring.entity.sys.*;
+import com.sunxung.factoring.entity.tradingPlatform.Platform;
 import com.sunxung.factoring.entity.vo.ConditionVo;
 import com.sunxung.factoring.mapper.customerinformation.CustomerMapper;
 import com.sunxung.factoring.mapper.sys.UserMapper;
@@ -26,6 +27,7 @@ import com.sunxung.factoring.service.sys.OrgService;
 import com.sunxung.factoring.service.sys.RoleService;
 import com.sunxung.factoring.service.sys.UserOrgRelService;
 import com.sunxung.factoring.service.sys.UserService;
+import com.sunxung.factoring.service.tradingPlatform.PlatformService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.PropertySource;
@@ -77,6 +79,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
     @Autowired
     private IEnterpriseService iEnterpriseService;
 
+    @Autowired
+    private PlatformService platformService;
+
     @Override
     public GridPage<Customer> findList(ConditionVo conditionVo) {
         QueryWrapper<Customer> queryWrapper = new QueryWrapper<>();
@@ -411,6 +416,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
             }
             iEnterpriseService.updateById(enterprise);
         }
+        Platform platform = platformService.getOne(new QueryWrapper<Platform>().eq("fdd_customer_id", code)
+                .orderByDesc("gmt_create").last("limit 1"));
+        if (platform != null && type == 1){
+            platform.setAutoSignStatus(true);
+            platformService.updateById(platform);
+        }
     }
 
     /**

+ 46 - 19
src/main/java/com/sunxung/factoring/service/tradingPlatform/Impl/PlatformServiceImpl.java

@@ -14,15 +14,19 @@ import com.sunxung.factoring.entity.tradingPlatform.Platform;
 import com.sunxung.factoring.entity.vo.ConditionVo;
 import com.sunxung.factoring.mapper.tradingPlatform.PlatformMapper;
 import com.sunxung.factoring.service.businessmanagement.BusinessBasicInfoService;
+import com.sunxung.factoring.service.sys.UserService;
 import com.sunxung.factoring.service.tradingPlatform.PlatformService;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.client.RestTemplate;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author liutao yaFan
@@ -31,6 +35,12 @@ import java.util.List;
 public class PlatformServiceImpl extends ServiceImpl<PlatformMapper,Platform> implements PlatformService {
 
 
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Value("${sop.getEnterpriseInfoUrl}")
+    private String enterpriseInfoUrl;
+
     private static Logger logger = LogManager.getLogger(PlatformServiceImpl.class);
 
     @Override
@@ -41,27 +51,44 @@ public class PlatformServiceImpl extends ServiceImpl<PlatformMapper,Platform> im
         if(!list.isEmpty()){
             return new ResponseJson("500","企业已添加,勿重复操作");
         }
+
+        ResponseJson forObject = restTemplate.getForObject(enterpriseInfoUrl+"?code="+platform.getSocialCreditCode(), ResponseJson.class);
+        Map<String,String> data = (Map) forObject.getData();
+
+
+        platform.setAuthUrl(data.get("authUrl"));
+        platform.setShortAuthUrl(data.get("shortAuthUrl"));
+        platform.setAuthStatus(0);
+        platform.setFddCustomerId(data.get("fddCustomerId"));
+        platform.setAutoSignUrl(data.get("autoSignUrl"));
+        platform.setShortAutoSignUrl(data.get("shortAutoSignUrl"));
+        platform.setAutoSignStatus(false);
+        platform.setShortAutoSignUrlCreate(new Date());
+        Integer autoSignStatus = Integer.valueOf(data.get("autoSignStatus"));
+        platform.setAutoSignStatus(autoSignStatus == 1?true:false);
+        save(platform);
+
         //电子签章获取认证地址
 //        String customerId = ElectronicSignatureUtil.registerAccount(platform.getSocialCreditCode(), "2");
-        String authResult = ElectronicSignatureUtil.getAuthUrl("2",platform.getSocialCreditCode(),null);
-        JSONObject authJson = (JSONObject) JSONObject.parse(authResult);
-        String authUrl = authJson.getString("authUrl");
-        String customerId = authJson.getString("customerId");
-        String shortAuthUrl = ElectronicSignatureUtil.shortUrl(null, authUrl);
-        platform.setShortAuthUrl(shortAuthUrl);
-        platform.setShortAuthUrlCreate(new Date());
-        platform.setFddCustomerId(customerId);
-        platform.setAuthUrl(authUrl);
-        save(platform);
-        String transactionId = "platformFDD" + platform.getId()+"FDD"+ DateUtil.getCurrentDate().replace("-","").replace(" ","").replace(":","");
-        logger.error("transactionId:"+transactionId);
-        String beforeAutoSignUrl = ElectronicSignatureUtil.beforeAutoSign(transactionId,customerId,customerId);
-        String shortAutoSignUrl = ElectronicSignatureUtil.shortUrl(null, beforeAutoSignUrl);
-        platform.setShortAutoSignUrl(shortAutoSignUrl);
-        platform.setShortAutoSignUrlCreate(new Date());
-        platform.setAutoSignUrl(beforeAutoSignUrl);
-        platform.setAuthStatus(0);
-        updateById(platform);
+//        String authResult = ElectronicSignatureUtil.getAuthUrl("2",platform.getSocialCreditCode(),null);
+//        JSONObject authJson = (JSONObject) JSONObject.parse(authResult);
+//        String authUrl = authJson.getString("authUrl");
+//        String customerId = authJson.getString("customerId");
+//        String shortAuthUrl = ElectronicSignatureUtil.shortUrl(null, authUrl);
+//        platform.setShortAuthUrl(shortAuthUrl);
+//        platform.setShortAuthUrlCreate(new Date());
+//        platform.setFddCustomerId(customerId);
+//        platform.setAuthUrl(authUrl);
+//        save(platform);
+//        String transactionId = "platformFDD" + platform.getId()+"FDD"+ DateUtil.getCurrentDate().replace("-","").replace(" ","").replace(":","");
+//        logger.error("transactionId:"+transactionId);
+//        String beforeAutoSignUrl = ElectronicSignatureUtil.beforeAutoSign(transactionId,customerId,customerId);
+//        String shortAutoSignUrl = ElectronicSignatureUtil.shortUrl(null, beforeAutoSignUrl);
+//        platform.setShortAutoSignUrl(shortAutoSignUrl);
+//        platform.setShortAutoSignUrlCreate(new Date());
+//        platform.setAutoSignUrl(beforeAutoSignUrl);
+//        platform.setAuthStatus(0);
+//        updateById(platform);
         return new ResponseJson("新增成功");
     }
 

+ 5 - 2
src/main/resources/application-dev.yml

@@ -21,7 +21,7 @@ spring:
     master:
       continueOnError: true
       type: com.alibaba.druid.pool.DruidDataSource
-      url: jdbc:mysql://192.168.3.6:3106/factoring_trade_v2_20230918?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
+      url: jdbc:mysql://192.168.3.6:3106/factoring_trade_v2_online?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
       username: root
       password: root
       driver-class-name: com.mysql.jdbc.Driver
@@ -130,8 +130,9 @@ sop:
   getProjectCoreEnterpriseScoreUrl: http://localhost:8868/api/trade/getProjectCoreEnterpriseScore
   reviewResolutionReportUrl: http://localhost:8868/api/trade/reviewResolution/report
   getEnterpriseAreaUrl: http://localhost:8868/api/trade/getEnterpriseArea
-  getBusinessByKeyWordUrl: http://localhost:8868/api/trade/findBusinessName
+  getBusinessByKeyWordUrl: http://192.168.3.6:8868/api/trade/findBusinessName
   getFlushUrl: http://192.168.3.6:8868/sys/customer/flushByTrade/url
+  getEnterpriseInfoUrl: http://192.168.3.6:8868/sys/customer/getEnterpriseInfoByTrade
 
 fdd:
   contractUrl: "http://192.168.125.194:8888/#/register"
@@ -186,5 +187,7 @@ auth:
       - businessProcessingTask/doBusinessHistoryView
       - saleInvoice/doAdd
       - saleInvoice/c_doUpdate
+      - customer/flushUrlByCompany
+      - customer/flushStatusBySop
       - fileStorage/getUeconfig
       - fileStorage/imgUpload

+ 1 - 0
src/main/resources/application-prod.yml

@@ -133,6 +133,7 @@ sop:
   getEnterpriseAreaUrl: http://222.90.211.174:18868/api/trade/getEnterpriseArea
   getBusinessByKeyWordUrl: http://222.90.211.174:18868/api/trade/findBusinessName
   getFlushUrl: http://222.90.211.174:18868/sys/customer/flushByTrade/url
+  getEnterpriseInfoUrl: http://222.90.211.174:18868/sys/customer/getEnterpriseInfoByTrade
 
 fdd:
   contractUrl: "http://192.168.125.194:8888/#/register"